/* ═══════════════════════════════════════════════════════════════
   QualiCore APS — Design System v1.0
   Glassmorphism · Geometric Typography · Refined Palette
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&family=Syne:wght@600;700;800&display=swap');

/* ── TOKENS ─────────────────────────────────────────────────── */
:root {
  /* Brand */
  --navy:        #1E1B4B;
  --navy-mid:    #2D2A6E;
  --navy-light:  #4F46A8;
  --navy-xlight: #EEF0FF;

  /* Teal (accent) */
  --teal:        #0D9373;
  --teal-mid:    #10B68F;
  --teal-light:  #5DDCB6;
  --teal-bg:     #E6FAF5;

  /* Semantic */
  --green:       #047857;
  --green-bg:    #ECFDF5;
  --amber:       #B45309;
  --amber-bg:    #FFFBEB;
  --red:         #B91C1C;
  --red-bg:      #FEF2F2;
  --blue:        #1D4ED8;
  --blue-bg:     #EFF6FF;
  --purple:      #6D28D9;
  --purple-bg:   #F5F3FF;

  /* Neutrals */
  --slate-900:   #0F172A;
  --slate-800:   #1E293B;
  --slate-700:   #334155;
  --slate-600:   #475569;
  --slate-500:   #64748B;
  --slate-400:   #94A3B8;
  --slate-300:   #CBD5E1;
  --slate-200:   #E2E8F0;
  --slate-100:   #F1F5F9;
  --slate-50:    #F8FAFC;
  --white:       #FFFFFF;

  /* Surfaces */
  --bg:          #F0F2F8;
  --bg2:         #F8FAFC;
  --surface:     rgba(255,255,255,0.80);
  --surface-2:   rgba(255,255,255,0.60);
  --glass:       rgba(255,255,255,0.72);
  --glass-border: rgba(255,255,255,0.55);

  /* Typography */
  --font-display: 'Syne', sans-serif;
  --font:         'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'DM Mono', 'Fira Mono', monospace;

  /* Spacing scale */
  --sp-1: 4px;  --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px;  --sp-8: 32px;  --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px;

  /* Radius */
  --r-sm:  8px;
  --r:     12px;
  --r-lg:  16px;
  --r-xl:  24px;
  --r-2xl: 32px;

  /* Shadows — layered */
  --sh-xs:  0 1px 2px rgba(15,23,42,.04);
  --sh-sm:  0 1px 3px rgba(15,23,42,.05), 0 4px 12px rgba(15,23,42,.04);
  --sh:     0 2px 6px rgba(15,23,42,.05), 0 8px 24px rgba(15,23,42,.07);
  --sh-lg:  0 4px 12px rgba(15,23,42,.06), 0 16px 40px rgba(15,23,42,.10);
  --sh-xl:  0 8px 24px rgba(15,23,42,.08), 0 32px 64px rgba(15,23,42,.14);
  --sh-navy: 0 4px 20px rgba(30,27,75,.25);
  --sh-teal: 0 4px 20px rgba(13,147,115,.22);

  /* Transitions */
  --tr-fast:  all .12s cubic-bezier(.4,0,.2,1);
  --tr:       all .20s cubic-bezier(.4,0,.2,1);
  --tr-slow:  all .35s cubic-bezier(.4,0,.2,1);

  /* Navbar */
  --nav-h: 64px;
}

/* ── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--slate-800);
  background: var(--bg);
  min-height: 100vh;
  margin: 0;
}

/* ── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--slate-400); }

/* ── BACKGROUND MESH ────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% -10%, rgba(79,70,168,.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(13,147,115,.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── NAVBAR ─────────────────────────────────────────────────── */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--nav-h);
  background: rgba(30,27,75,.96);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(93,220,182,.18);
  padding: 0 var(--sp-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font);
  transition: box-shadow .3s;
}
#navbar.scrolled {
  box-shadow: 0 4px 32px rgba(0,0,0,.28);
}

.nav-logo {
  display: flex; align-items: center; gap: var(--sp-3);
  text-decoration: none; flex-shrink: 0;
}
.nav-logo-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: .95rem; font-weight: 800; color: #fff;
  box-shadow: var(--sh-teal);
  flex-shrink: 0;
}
.nav-logo-text { display: flex; flex-direction: column; }
.nav-logo-name {
  font-family: var(--font-display);
  font-size: .82rem; font-weight: 800;
  color: #fff; letter-spacing: .8px;
  line-height: 1.1;
}
.nav-logo-sub {
  font-size: .6rem; color: rgba(255,255,255,.45);
  letter-spacing: .3px;
}

#navLinks {
  display: flex; align-items: center;
  gap: 2px; list-style: none; padding: 0; margin: 0;
}
.nav-link-a {
  color: rgba(255,255,255,.82);
  text-decoration: none;
  font-size: .8rem; font-weight: 500;
  padding: 6px 11px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; gap: 5px;
  white-space: nowrap;
  transition: var(--tr);
}
.nav-link-a:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-link-a.admin-pill {
  color: var(--teal-light);
  background: rgba(93,220,182,.15);
  border: 1px solid rgba(93,220,182,.3);
  font-weight: 700;
}
.nav-link-a.admin-pill:hover { background: rgba(93,220,182,.25); }

/* Dropdown */
.has-dd { position: relative; }
.nav-dropdown {
  visibility: hidden; opacity: 0;
  position: absolute; top: calc(100% + 8px); left: 0;
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xl);
  min-width: 230px;
  padding: var(--sp-2);
  z-index: 2000;
  border: 1px solid var(--slate-200);
  transition: opacity .15s, visibility .15s, transform .15s;
  transform: translateY(-4px);
}
.has-dd:hover .nav-dropdown {
  visibility: visible; opacity: 1; transform: translateY(0);
}
.nav-dd-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 9px var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--slate-700);
  font-size: .8rem; font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: var(--tr-fast);
}
.nav-dd-item:hover { background: var(--slate-50); color: var(--navy); }
.nav-dd-item i { width: 16px; text-align: center; font-size: .75rem; color: var(--slate-500); }
.nav-dd-sep { height: 1px; background: var(--slate-200); margin: 4px 6px; }

#navToggle {
  display: none; flex-direction: column; gap: 5px;
  cursor: pointer; padding: 6px; background: none; border: none;
}
#navToggle span {
  display: block; width: 22px; height: 2px;
  background: rgba(255,255,255,.85); border-radius: 2px;
}

/* ── ADMIN LAYOUT ───────────────────────────────────────────── */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
  padding-top: var(--nav-h);
}

.admin-sidebar {
  width: 248px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-mid) 100%);
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.06);
}
.admin-sidebar::-webkit-scrollbar { width: 3px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); }

.sb-header {
  padding: var(--sp-5) var(--sp-4);
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sb-avatar {
  width: 42px; height: 42px;
  border-radius: var(--r);
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #fff; margin-bottom: var(--sp-3);
  box-shadow: var(--sh-teal);
}
.sb-name  { font-weight: 700; font-size: .88rem; color: #fff; }
.sb-role  { font-size: .7rem; color: rgba(255,255,255,.45); margin-top: 2px; }

.sb-nav { padding: var(--sp-3) var(--sp-2); flex: 1; }
.sb-section {
  font-size: .62rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: rgba(255,255,255,.3);
  padding: var(--sp-3) var(--sp-2) var(--sp-1);
}
.sb-item {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 9px var(--sp-3);
  border-radius: var(--r-sm);
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: .8rem; font-weight: 500;
  cursor: pointer;
  transition: var(--tr-fast);
  margin-bottom: 1px;
  border: none; background: none; width: 100%; text-align: left;
}
.sb-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.sb-item.active {
  background: rgba(93,220,182,.15);
  color: var(--teal-light);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--teal-light);
}
.sb-item i { width: 16px; text-align: center; font-size: .78rem; flex-shrink: 0; }

.sb-footer {
  padding: var(--sp-2) var(--sp-2) var(--sp-4);
  border-top: 1px solid rgba(255,255,255,.07);
}

.admin-main {
  flex: 1;
  padding: var(--sp-8);
  overflow-x: hidden;
  position: relative;
  z-index: 1;
}

/* ── PAGE HEADER ─────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-8);
  flex-wrap: wrap; gap: var(--sp-4);
}
.page-title {
  font-family: var(--font-display);
  font-size: 1.5rem; font-weight: 700;
  color: var(--navy); line-height: 1.2;
}
.page-sub { font-size: .82rem; color: var(--slate-500); margin-top: 4px; }

/* ── GLASS CARD ─────────────────────────────────────────────── */
.glass-card {
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh);
}

/* ── CARD ────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--r-xl);
  border: 1px solid var(--slate-200);
  box-shadow: var(--sh-sm);
  transition: var(--tr);
}
.card:hover { box-shadow: var(--sh-lg); transform: translateY(-2px); }

/* ── KPI CARD ────────────────────────────────────────────────── */
.kpi-card {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: var(--sp-5) var(--sp-6);
  border: 1px solid var(--slate-200);
  box-shadow: var(--sh-sm);
  transition: var(--tr);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.kpi-card.teal::before   { background: linear-gradient(90deg, var(--teal), var(--teal-light)); }
.kpi-card.amber::before  { background: linear-gradient(90deg, #D97706, #FBBF24); }
.kpi-card.red::before    { background: linear-gradient(90deg, #DC2626, #F87171); }
.kpi-card.blue::before   { background: linear-gradient(90deg, var(--blue), #60A5FA); }
.kpi-card.purple::before { background: linear-gradient(90deg, var(--purple), #A78BFA); }
.kpi-card.green::before  { background: linear-gradient(90deg, var(--green), #34D399); }
.kpi-card.navy::before   { background: linear-gradient(90deg, var(--navy), var(--navy-light)); }

.kpi-card:hover { box-shadow: var(--sh); transform: translateY(-2px); }

.kpi-icon {
  width: 40px; height: 40px;
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem; margin-bottom: var(--sp-4);
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 2rem; font-weight: 700;
  color: var(--slate-900); line-height: 1;
  margin-bottom: 4px;
}
.kpi-label { font-size: .75rem; color: var(--slate-500); font-weight: 500; }
.kpi-meta  { font-size: .72rem; color: var(--slate-400); margin-top: 4px; }
.kpi-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .7rem; font-weight: 600;
  padding: 2px 8px; border-radius: 99px;
  margin-top: var(--sp-3);
}
.kpi-badge.up   { background: var(--green-bg); color: var(--green); }
.kpi-badge.down { background: var(--red-bg);   color: var(--red);   }
.kpi-badge.flat { background: var(--slate-100); color: var(--slate-500); }

/* ── CHART CARD ─────────────────────────────────────────────── */
.chart-card {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  border: 1px solid var(--slate-200);
  box-shadow: var(--sh-sm);
}
.chart-card-hdr {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-5);
}
.chart-card-title {
  font-size: .85rem; font-weight: 700;
  color: var(--slate-800);
  display: flex; align-items: center; gap: var(--sp-2);
}
.chart-wrap { position: relative; }

/* ── FILTER BAR ─────────────────────────────────────────────── */
.filter-bar {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-6);
  display: flex; align-items: center;
  gap: var(--sp-3); flex-wrap: wrap;
  border: 1px solid var(--slate-200);
  box-shadow: var(--sh-xs);
}
.filter-bar label {
  font-size: .75rem; font-weight: 600;
  color: var(--slate-500); white-space: nowrap;
}
.filter-bar select, .filter-bar input[type=date] {
  padding: 7px var(--sp-3);
  border: 1.5px solid var(--slate-200);
  border-radius: var(--r-sm);
  font-size: .8rem; font-family: var(--font);
  color: var(--slate-700);
  background: var(--white);
  transition: var(--tr-fast);
}
.filter-bar select:focus, .filter-bar input[type=date]:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13,147,115,.1);
}

.period-btn {
  padding: 6px var(--sp-3);
  border-radius: var(--r-sm);
  border: 1.5px solid var(--slate-200);
  font-size: .75rem; font-weight: 600;
  cursor: pointer; background: var(--white);
  color: var(--slate-500); transition: var(--tr-fast);
  font-family: var(--font);
}
.period-btn.active, .period-btn:hover {
  background: var(--navy); color: #fff;
  border-color: var(--navy);
}

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 9px var(--sp-5);
  border-radius: var(--r);
  font-size: .8rem; font-weight: 600;
  cursor: pointer; border: none;
  font-family: var(--font);
  text-decoration: none;
  transition: var(--tr);
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--navy-mid), var(--navy-light));
  color: #fff;
  box-shadow: var(--sh-navy);
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 6px 24px rgba(30,27,75,.35); transform: translateY(-1px); }

.btn-teal {
  background: linear-gradient(135deg, var(--teal), var(--teal-mid));
  color: #fff;
  box-shadow: var(--sh-teal);
}
.btn-teal:hover { filter: brightness(1.08); box-shadow: 0 6px 24px rgba(13,147,115,.32); transform: translateY(-1px); }

.btn-outline {
  background: var(--white);
  color: var(--slate-700);
  border: 1.5px solid var(--slate-200);
  box-shadow: var(--sh-xs);
}
.btn-outline:hover { border-color: var(--slate-400); background: var(--slate-50); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--slate-600);
  border: 1.5px solid transparent;
}
.btn-ghost:hover { background: var(--slate-100); }

.btn-danger { background: linear-gradient(135deg,#DC2626,#EF4444); color:#fff; }
.btn-danger:hover { filter: brightness(1.08); transform: translateY(-1px); }

.btn-sm { padding: 6px 14px; font-size: .76rem; }
.btn-lg { padding: 12px var(--sp-8); font-size: .88rem; }
.btn-icon {
  padding: 8px;
  border-radius: var(--r-sm);
  background: var(--slate-100);
  color: var(--slate-600);
  border: none; cursor: pointer;
  transition: var(--tr-fast);
  font-size: .85rem;
}
.btn-icon:hover { background: var(--slate-200); color: var(--slate-800); }

/* ── BADGES ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  font-size: .68rem; font-weight: 700;
  padding: 3px 10px; border-radius: 99px;
  white-space: nowrap; letter-spacing: .2px;
}
.badge-teal    { background: var(--teal-bg);    color: var(--teal); }
.badge-green   { background: var(--green-bg);   color: var(--green); }
.badge-amber   { background: var(--amber-bg);   color: var(--amber); }
.badge-red     { background: var(--red-bg);     color: var(--red); }
.badge-blue    { background: var(--blue-bg);    color: var(--blue); }
.badge-purple  { background: var(--purple-bg);  color: var(--purple); }
.badge-navy    { background: var(--navy-xlight);color: var(--navy-mid); }
.badge-gray    { background: var(--slate-100);  color: var(--slate-600); }

/* Status dot */
.status-dot {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .75rem; font-weight: 500;
}
.status-dot::before {
  content: ''; width: 7px; height: 7px;
  border-radius: 50%; flex-shrink: 0;
}
.status-dot.green::before  { background: #10B981; box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
.status-dot.amber::before  { background: #F59E0B; box-shadow: 0 0 0 3px rgba(245,158,11,.2); }
.status-dot.red::before    { background: #EF4444; box-shadow: 0 0 0 3px rgba(239,68,68,.2); animation: pulse-dot 1.5s infinite; }
.status-dot.blue::before   { background: #3B82F6; }
.status-dot.gray::before   { background: var(--slate-400); }
@keyframes pulse-dot {
  0%,100% { box-shadow: 0 0 0 3px rgba(239,68,68,.2); }
  50%      { box-shadow: 0 0 0 6px rgba(239,68,68,.1); }
}

/* ── TABLE ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); }
.data-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.data-table thead th {
  background: var(--slate-50);
  padding: 11px var(--sp-4);
  text-align: left;
  font-weight: 700;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--slate-500);
  border-bottom: 1.5px solid var(--slate-200);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 12px var(--sp-4);
  border-bottom: 1px solid var(--slate-100);
  color: var(--slate-700);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr {
  transition: var(--tr-fast);
}
.data-table tbody tr:hover td {
  background: var(--slate-50);
}

/* ── FORMS ───────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--sp-5); }
.form-group label {
  display: block; font-size: .78rem;
  font-weight: 600; color: var(--slate-700);
  margin-bottom: var(--sp-2);
}
.form-group label.required::after {
  content: ' *'; color: var(--red); font-weight: 400;
}
.form-control {
  width: 100%;
  padding: 10px var(--sp-4);
  border: 1.5px solid var(--slate-200);
  border-radius: var(--r);
  font-size: .85rem;
  font-family: var(--font);
  color: var(--slate-800);
  background: var(--white);
  transition: var(--tr-fast);
}
.form-control:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13,147,115,.12);
}
.form-control::placeholder { color: var(--slate-400); }
.form-hint { font-size: .72rem; color: var(--slate-400); margin-top: 4px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-4); }

/* ── GRIDS ───────────────────────────────────────────────────── */
.kpi-grid     { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: var(--sp-4); margin-bottom: var(--sp-6); }
.kpi-grid-4   { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: var(--sp-4); margin-bottom: var(--sp-6); }
.kpi-grid-3   { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: var(--sp-4); margin-bottom: var(--sp-6); }
.two-col      { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); margin-bottom: var(--sp-5); }
.three-col    { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-5); margin-bottom: var(--sp-5); }

/* ── SECTION VIEWS ───────────────────────────────────────────── */
.section-view         { display: none; animation: fadeInUp .22s ease; }
.section-view.active  { display: block; }

/* ── ANIMATIONS ──────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Scroll reveal */
.reveal {
  opacity: 0; transform: translateY(18px);
  transition: opacity .5s ease, transform .5s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* Stagger children */
.stagger > * { animation: fadeInUp .3s ease both; }
.stagger > *:nth-child(1) { animation-delay: .05s; }
.stagger > *:nth-child(2) { animation-delay: .10s; }
.stagger > *:nth-child(3) { animation-delay: .15s; }
.stagger > *:nth-child(4) { animation-delay: .20s; }
.stagger > *:nth-child(5) { animation-delay: .25s; }
.stagger > *:nth-child(6) { animation-delay: .30s; }

/* ── PROGRESS BAR ────────────────────────────────────────────── */
.progress-wrap { background: var(--slate-100); border-radius: 99px; overflow: hidden; height: 8px; }
.progress-bar  {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--teal), var(--teal-light));
  transition: width .6s cubic-bezier(.4,0,.2,1);
}

/* ── MODAL ───────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(4px);
  z-index: 999;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; animation: fadeIn .2s ease; }
.modal-box {
  background: var(--white);
  border-radius: var(--r-2xl);
  width: 100%; max-width: 560px;
  max-height: 88vh; overflow-y: auto;
  padding: var(--sp-8);
  box-shadow: var(--sh-xl);
  animation: fadeInUp .22s ease;
}
.modal-hdr {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-6);
}
.modal-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; color: var(--navy); }

/* ── TOAST ───────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: var(--sp-6); right: var(--sp-6);
  z-index: 9999; display: flex; flex-direction: column; gap: var(--sp-2);
}
.toast {
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--slate-900); color: #fff;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-lg);
  font-size: .82rem; font-weight: 500;
  box-shadow: var(--sh-xl);
  animation: slideInLeft .25s ease;
  min-width: 260px;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast.warning { background: #D97706; }

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: var(--sp-16) var(--sp-8);
  color: var(--slate-400);
}
.empty-state i { font-size: 2.5rem; margin-bottom: var(--sp-4); opacity: .4; }
.empty-state p { font-size: .88rem; margin-top: var(--sp-2); }

/* ── ALERT BOXES ─────────────────────────────────────────────── */
.alert-box {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-4); border-radius: var(--r-lg);
  font-size: .82rem; margin-bottom: var(--sp-4);
  border: 1px solid;
}
.alert-box.info    { background: var(--blue-bg);   border-color: #BFDBFE; color: var(--blue); }
.alert-box.success { background: var(--green-bg);  border-color: #A7F3D0; color: var(--green); }
.alert-box.warning { background: var(--amber-bg);  border-color: #FDE68A; color: var(--amber); }
.alert-box.danger  { background: var(--red-bg);    border-color: #FECACA; color: var(--red); }

/* ── TABS ────────────────────────────────────────────────────── */
.tab-bar {
  display: flex; gap: 2px;
  background: var(--slate-100);
  border-radius: var(--r);
  padding: 3px;
  margin-bottom: var(--sp-6);
  width: fit-content;
}
.tab-btn {
  padding: 7px var(--sp-5);
  border-radius: var(--r-sm);
  font-size: .8rem; font-weight: 600;
  cursor: pointer; border: none;
  background: transparent; color: var(--slate-500);
  transition: var(--tr-fast); font-family: var(--font);
}
.tab-btn.active {
  background: var(--white); color: var(--navy);
  box-shadow: var(--sh-sm);
}

/* ── OVERVIEW BANNER ─────────────────────────────────────────── */
.overview-banner {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  border-radius: var(--r-2xl);
  padding: var(--sp-8) var(--sp-10);
  color: #fff; margin-bottom: var(--sp-6);
  position: relative; overflow: hidden;
}
.overview-banner::after {
  content: '';
  position: absolute;
  top: -50%; right: -10%;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  pointer-events: none;
}
.overview-banner h3 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.overview-banner p  { font-size: .82rem; opacity: .72; }
.ov-stats { display: flex; gap: var(--sp-8); flex-wrap: wrap; margin-top: var(--sp-5); }
.ov-stat { text-align: center; }
.ov-num  { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; line-height: 1; }
.ov-lbl  { font-size: .7rem; opacity: .65; margin-top: 2px; }

/* ── SEMAFOR ─────────────────────────────────────────────────── */
.semaforo {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 99px;
  font-size: .72rem; font-weight: 700;
}
.semaforo.verde   { background: var(--green-bg);  color: var(--green); }
.semaforo.amarelo { background: var(--amber-bg);  color: var(--amber); }
.semaforo.vermelho{ background: var(--red-bg);    color: var(--red);   }
.semaforo.azul    { background: var(--blue-bg);   color: var(--blue);  }

/* ── LOADING ─────────────────────────────────────────────────── */
#loading {
  display: none; position: fixed; inset: 0;
  background: rgba(30,27,75,.92);
  z-index: 9999;
  flex-direction: column; align-items: center; justify-content: center;
  color: #fff; gap: var(--sp-4);
}
#loading.show { display: flex; }
.spinner {
  width: 42px; height: 42px;
  border: 3px solid rgba(255,255,255,.2);
  border-top-color: var(--teal-light);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── HERO (public pages) ─────────────────────────────────────── */
.hero {
  padding-top: var(--nav-h);
  background: linear-gradient(135deg, #0D0B2B 0%, var(--navy) 50%, #0F2B4A 100%);
  color: #fff;
  padding: calc(var(--nav-h) + var(--sp-16)) var(--sp-6) var(--sp-12);
  text-align: center;
  position: relative; overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 30% 50%, rgba(13,147,115,.15), transparent),
    radial-gradient(ellipse 50% 40% at 70% 50%, rgba(93,220,182,.08), transparent);
  pointer-events: none;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2);
  border-radius: 99px; padding: 5px var(--sp-4);
  font-size: .72rem; font-weight: 600;
  letter-spacing: .5px; margin-bottom: var(--sp-5);
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800; margin-bottom: var(--sp-4);
  line-height: 1.15; position: relative; z-index: 1;
}
.hero h1 span { color: var(--teal-light); }
.hero p {
  font-size: 1rem; opacity: .82;
  max-width: 580px; margin: 0 auto var(--sp-8);
  line-height: 1.7; position: relative; z-index: 1;
}

/* ── PROTO (protocol pages) ────────────────────────────────── */
.proto-screen { display: none; animation: fadeInUp .22s ease; }
.proto-screen.active { display: block; }
.proto-progress-wrap {
  height: 4px;
  background: rgba(255,255,255,.15);
  border-radius: 99px; margin: var(--sp-4) 0;
}
.proto-progress-bar {
  height: 100%; background: var(--teal-light);
  border-radius: 99px; transition: width .4s cubic-bezier(.4,0,.2,1);
}
.step-badge {
  display: inline-block;
  background: var(--red); color: #fff;
  border-radius: 99px; padding: 3px 14px;
  font-size: .7rem; font-weight: 800;
  letter-spacing: .4px; margin-bottom: var(--sp-4);
}
.bundle-item {
  border-radius: var(--r-lg);
  border: 1.5px solid var(--slate-200);
  margin-bottom: var(--sp-3); overflow: hidden;
  transition: var(--tr-fast);
}
.bundle-item.done { border-color: var(--teal); }
.bundle-hdr {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4); cursor: pointer;
  background: var(--white); transition: var(--tr-fast);
}
.bundle-hdr:hover { background: var(--slate-50); }
.bundle-num {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--slate-100);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .8rem; flex-shrink: 0;
}
.bundle-item.done .bundle-num { background: var(--teal); color: #fff; }
.bundle-body {
  display: none; padding: 0 var(--sp-4) var(--sp-4);
  font-size: .82rem; line-height: 1.7;
  color: var(--slate-600);
}
.bundle-body.open { display: block; }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .three-col  { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  #navToggle { display: flex !important; }
  #navLinks  {
    display: none !important; flex-direction: column !important;
    position: fixed !important; top: var(--nav-h) !important;
    left: 0 !important; right: 0 !important;
    background: rgba(22,18,60,.98) !important;
    padding: var(--sp-3) !important; z-index: 999 !important;
  }
  #navLinks.mob-open { display: flex !important; }
  #navLinks li { width: 100% !important; }
  #navLinks .nav-link-a { width: 100% !important; padding: var(--sp-3) var(--sp-4) !important; }
  .nav-dropdown { position: static !important; visibility: visible !important; opacity: 1 !important; box-shadow: none !important; border: none !important; background: rgba(255,255,255,.06) !important; display: none !important; }
  .admin-sidebar { display: none; }
  .admin-main { padding: var(--sp-5); }
  .kpi-grid-4, .three-col, .two-col { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page-title { font-size: 1.25rem; }
}

/* ── UTILITIES ───────────────────────────────────────────────── */
.text-xs    { font-size: .72rem; }
.text-sm    { font-size: .8rem;  }
.text-base  { font-size: .88rem; }
.text-muted { color: var(--slate-500); }
.text-navy  { color: var(--navy); }
.text-teal  { color: var(--teal); }
.fw-600     { font-weight: 600; }
.fw-700     { font-weight: 700; }
.fw-display { font-family: var(--font-display); }
.mt-0  { margin-top: 0; }
.mb-0  { margin-bottom: 0; }
.mb-4  { margin-bottom: var(--sp-4); }
.mb-6  { margin-bottom: var(--sp-6); }
.mb-8  { margin-bottom: var(--sp-8); }
.gap-3 { gap: var(--sp-3); }
.flex  { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
