/* ============================================================
   GenExa — Design System
   Paleta: Blanco + Naranja Quemado (#C45E1A) + Gris
   ============================================================ */

:root {
  --ob:          #C45E1A;
  --ob-dark:     #A34C14;
  --ob-light:    #F5E6D8;
  --ob-mid:      #E8935A;
  --gray:        #6B6B6B;
  --gray-light:  #F4F4F2;
  --gray-mid:    #D1D0CB;
  --gray-dark:   #3A3A38;
  --white:       #FFFFFF;
  --text:        #1A1A1A;
  --text-muted:  #7A7A7A;
  --border:      #E0DED8;
  --success:     #2E8A4A;
  --success-bg:  #E6F5ED;
  --warning-bg:  #FFF3E0;
  --danger:      #C0392B;
  --danger-bg:   #FDECEA;
  --info-bg:     #EEF2FF;
  --info:        #534AB7;

  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:  0 2px 8px rgba(0,0,0,0.08);
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--gray-light);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ob); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ─── Layout Shell ─── */
.app-shell        { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.topbar           { height: 52px; background: var(--white); border-bottom: 1px solid var(--border);
                    display: flex; align-items: center; padding: 0 20px; gap: 16px; flex-shrink: 0; z-index: 100; }
.topbar__logo     { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; color: var(--text); }
.topbar__logo-mark{ width: 30px; height: 30px; background: var(--ob); border-radius: var(--radius-md);
                    display: flex; align-items: center; justify-content: center; }
.topbar__logo-mark svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; }
.topbar__logo span{ color: var(--ob); }
.topbar__spacer   { flex: 1; }
.topbar__user     { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-muted); }
.avatar           { width: 32px; height: 32px; border-radius: 50%; background: var(--ob-light);
                    display: flex; align-items: center; justify-content: center;
                    font-size: 11px; font-weight: 600; color: var(--ob); flex-shrink: 0; }

.body-layout      { display: flex; flex: 1; overflow: hidden; }

/* ─── Sidebar ─── */
.sidebar          { width: 210px; background: var(--white); border-right: 1px solid var(--border);
                    overflow-y: auto; padding: 16px 0; flex-shrink: 0; }
.sidebar__section { padding: 0 10px; margin-bottom: 6px; }
.sidebar__label   { font-size: 10px; font-weight: 600; color: var(--text-muted);
                    text-transform: uppercase; letter-spacing: 0.9px; padding: 8px 8px 4px; display: block; }
.nav-item         { display: flex; align-items: center; gap: 9px; padding: 7px 10px;
                    border-radius: var(--radius-md); cursor: pointer; font-size: 13px;
                    color: var(--text-muted); transition: all 0.12s; margin-bottom: 1px; text-decoration: none; }
.nav-item i       { font-size: 16px; flex-shrink: 0; }
.nav-item:hover   { background: var(--gray-light); color: var(--text); text-decoration: none; }
.nav-item.active  { background: var(--ob-light); color: var(--ob); font-weight: 500; }
.nav-item.active i{ color: var(--ob); }
.sidebar__divider { height: 1px; background: var(--border); margin: 8px 14px; }

/* ─── Main Content ─── */
.main-content     { flex: 1; overflow-y: auto; padding: 24px; }

/* ─── Page Header ─── */
.page-header      { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.page-title       { font-size: 20px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.page-subtitle    { font-size: 13px; color: var(--text-muted); }
.page-actions     { display: flex; gap: 8px; flex-shrink: 0; }

/* ─── Cards ─── */
.card             { background: var(--white); border: 0.5px solid var(--border);
                    border-radius: var(--radius-lg); padding: 16px 20px; }
.card--borderless { border-color: transparent; box-shadow: var(--shadow-sm); }

/* ─── Stat Cards ─── */
.stats-grid       { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card        { background: var(--white); border: 0.5px solid var(--border);
                    border-radius: var(--radius-md); padding: 14px 16px; }
.stat-card__value { font-size: 26px; font-weight: 600; line-height: 1.2; color: var(--text); }
.stat-card__label { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.stat-card__trend { font-size: 11px; margin-top: 6px; display: flex; align-items: center; gap: 3px; }
.stat-card__trend.up   { color: var(--success); }
.stat-card__trend.warn { color: var(--ob); }

/* ─── Buttons ─── */
.btn              { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
                    border-radius: var(--radius-md); font-size: 13px; font-weight: 500;
                    cursor: pointer; border: none; transition: all 0.12s; line-height: 1; }
.btn-primary      { background: var(--ob); color: #fff; }
.btn-primary:hover{ background: var(--ob-dark); }
.btn-secondary    { background: var(--white); color: var(--text); border: 0.5px solid var(--border); }
.btn-secondary:hover { background: var(--gray-light); }
.btn-danger       { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a32820; }
.btn-sm           { padding: 5px 10px; font-size: 12px; }
.btn-icon         { padding: 7px; border-radius: var(--radius-md); background: none;
                    border: 0.5px solid var(--border); cursor: pointer; color: var(--text-muted);
                    display: inline-flex; transition: all 0.12s; }
.btn-icon:hover   { background: var(--gray-light); color: var(--text); }
button:disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Forms ─── */
.form-group       { margin-bottom: 16px; }
.form-label       { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted);
                    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 5px; }
.form-label.required::after { content: ' *'; color: var(--ob); }
.form-control     { width: 100%; padding: 8px 12px; border: 0.5px solid var(--border);
                    border-radius: var(--radius-md); font-size: 13px; color: var(--text);
                    background: var(--white); transition: border-color 0.12s; }
.form-control:focus { outline: none; border-color: var(--ob); box-shadow: 0 0 0 3px rgba(196,94,26,0.1); }
.form-control.is-invalid { border-color: var(--danger); }
.form-error       { font-size: 11px; color: var(--danger); margin-top: 4px; }
.form-hint        { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
select.form-control { appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B6B6B' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ─── Tables ─── */
.table-wrap       { background: var(--white); border: 0.5px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.table-header     { display: flex; align-items: center; justify-content: space-between;
                    padding: 12px 16px; border-bottom: 0.5px solid var(--border); }
.table-header__title { font-size: 13px; font-weight: 600; color: var(--text); }
.table            { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th         { padding: 9px 16px; text-align: left; font-size: 11px; font-weight: 600;
                    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px;
                    background: var(--gray-light); border-bottom: 0.5px solid var(--border); }
.table td         { padding: 11px 16px; color: var(--text); border-bottom: 0.5px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #FAFAF8; }
.table--striped tbody tr:nth-child(even) td { background: #FAFAF8; }

/* ─── Badges / Pills ─── */
.badge            { display: inline-flex; align-items: center; padding: 3px 9px;
                    border-radius: 100px; font-size: 11px; font-weight: 600; }
.badge-active     { background: var(--success-bg); color: var(--success); }
.badge-inactive   { background: var(--gray-light); color: var(--gray); }
.badge-orange     { background: var(--ob-light); color: var(--ob); }
.badge-warning    { background: var(--warning-bg); color: var(--ob); }
.badge-danger     { background: var(--danger-bg); color: var(--danger); }
.badge-info       { background: var(--info-bg); color: var(--info); }

/* ─── Alerts ─── */
.alert            { padding: 12px 16px; border-radius: var(--radius-md); font-size: 13px;
                    display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.alert-success    { background: var(--success-bg); color: var(--success); border-left: 3px solid var(--success); }
.alert-warning    { background: var(--warning-bg); color: var(--ob); border-left: 3px solid var(--ob); }
.alert-danger     { background: var(--danger-bg); color: var(--danger); border-left: 3px solid var(--danger); }
.alert-info       { background: var(--info-bg); color: var(--info); border-left: 3px solid var(--info); }

/* ─── Modals ─── */
.modal-overlay    { position: fixed; inset: 0; background: rgba(0,0,0,0.45);
                    display: flex; align-items: center; justify-content: center; z-index: 1000;
                    opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.modal-overlay.open{ opacity: 1; pointer-events: all; }
.modal            { background: var(--white); border-radius: var(--radius-lg); padding: 24px;
                    width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
                    box-shadow: var(--shadow-md); }
.modal__header    { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px;
                    position: sticky; top: -24px; background: var(--white); padding-top: 24px;
                    margin-top: -24px; z-index: 1; }
.modal__title     { font-size: 16px; font-weight: 600; color: var(--text); }
.modal__footer    { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px;
                    border-top: 0.5px solid var(--border);
                    position: sticky; bottom: -24px; background: var(--white); padding-bottom: 24px;
                    margin-bottom: -24px; }

/* ─── Upload area ─── */
.upload-area      { border: 1.5px dashed var(--gray-mid); border-radius: var(--radius-md);
                    padding: 28px; text-align: center; cursor: pointer; transition: all 0.12s; }
.upload-area:hover{ border-color: var(--ob); background: var(--ob-light); }
.upload-area i    { font-size: 32px; color: var(--ob); display: block; margin-bottom: 10px; }
.upload-area__text{ font-size: 13px; color: var(--text-muted); }

/* ─── Progress ─── */
.progress-bar     { height: 5px; background: var(--gray-light); border-radius: 3px; overflow: hidden; }
.progress-fill    { height: 100%; background: var(--ob); border-radius: 3px; transition: width 0.3s ease; }

/* ─── Checkbox / Switch ─── */
.checkbox-label   { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--ob); cursor: pointer; }

/* ─── Two-column grids ─── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main-content { padding: 16px; }
}

/* ─── Utilities ─── */
.text-muted   { color: var(--text-muted) !important; }
.text-ob      { color: var(--ob) !important; }
.text-danger  { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-sm      { font-size: 12px !important; }
.text-xs      { font-size: 11px !important; }
.fw-500       { font-weight: 500 !important; }
.fw-600       { font-weight: 600 !important; }
.mt-1 { margin-top: 4px; }   .mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }  .mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 24px; }  .mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 24px; }
.d-flex   { display: flex; }
.gap-2    { gap: 8px; }
.gap-3    { gap: 12px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-100    { width: 100%; }
.mono     { font-family: 'Courier New', monospace; }

/* ─── PWA Offline indicator ─── */
.offline-banner { background: var(--ob); color: #fff; text-align: center; padding: 6px;
                  font-size: 12px; font-weight: 500; display: none; }
body.offline .offline-banner { display: block; }

/* ─── Loading spinner ─── */
.spinner { width: 20px; height: 20px; border: 2px solid var(--border);
           border-top-color: var(--ob); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toast notifications ─── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--gray-dark); color: #fff; padding: 10px 16px; border-radius: var(--radius-md);
         font-size: 13px; box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 8px;
         animation: toastIn 0.2s ease; }
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
