/* ============================================================
   IIGOC ADMISSIONS PORTAL — THEME v3
   - Modern, polished, fully mobile-responsive
   - Keeps every existing class name so all pages benefit
   - Display: Fraunces | Body: Plus Jakarta Sans
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* Palette — refined */
  --navy:        #0b1b3d;
  --navy-2:      #14274f;
  --navy-3:      #1d3266;
  --navy-tint:   #eef1f8;

  /* Brand orange (logo) — primary accent */
  --brand:       #f36c0a;
  --brand-2:     #ff8a33;
  --brand-dark:  #c8540a;
  --brand-soft:  #fff1e6;
  --brand-tint:  #fde7d3;

  /* Gold kept as secondary/legacy accent, now mapped toward brand */
  --gold:        #f36c0a;
  --gold-2:      #ff8a33;
  --gold-soft:   #fff1e6;
  --cream:       #fbf7f2;
  --cream-2:     #f4ece3;
  --ivory:       #fffdfa;
  --paper:       #ffffff;

  --ink:         #1a1f2b;
  --ink-2:       #353b49;
  --ink-3:       #5b6377;
  --muted:       #7a8194;
  --muted-2:     #a5acbe;
  --border:      #ece5da;
  --border-2:    #ddd4c7;
  --line:        #f0e9df;

  --red:         #c0392b;   --red-soft:  #fff1f1;
  --green:       #167a4a;   --green-soft:#e8faf0;
  --amber:       #b06b14;   --amber-soft:#fff4dd;
  --blue:        #2a52be;   --blue-soft: #ebf0fc;
  --purple:      #6d3aff;   --purple-soft:#f1ecff;

  /* Surfaces & shadows */
  --shadow-1:    0 1px 2px rgba(11,27,61,.04), 0 1px 1px rgba(11,27,61,.02);
  --shadow-2:    0 4px 14px rgba(11,27,61,.06), 0 1px 4px rgba(11,27,61,.04);
  --shadow-3:    0 16px 44px rgba(11,27,61,.12), 0 4px 14px rgba(11,27,61,.06);
  --shadow-gold: 0 8px 24px rgba(243,108,10,.26);
  --shadow-navy: 0 8px 24px rgba(11,27,61,.22);

  --radius-xs:   6px;
  --radius-sm:   8px;
  --radius:      12px;
  --radius-lg:   18px;
  --radius-xl:   24px;
  --radius-pill: 999px;

  /* Motion */
  --t-fast: 120ms;
  --t-base: 200ms;
  --t-slow: 320ms;
  --ease-soft: cubic-bezier(.4,.0,.2,1);
}

* { margin:0; padding:0; box-sizing:border-box; }
*::before, *::after { box-sizing: border-box; }
html { scroll-behavior:smooth; -webkit-text-size-adjust:100%; }

/* Defensive: any SVG inside metric-icon must respect the parent. Some pages
   inject inline SVGs with no width attribute, which then expand to fill. */
.metric-icon svg,
.acct-tile-icon svg,
.btn svg,
.nav-link svg,
.nav-item svg,
.step-chip svg {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  flex-shrink: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

.serif { font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-weight: 700; letter-spacing: -.015em; }
a { color: var(--navy-2); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--brand); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
::selection { background: var(--gold-soft); color: var(--navy); }

/* ============================================================
   LAYOUT — sidebar + main
   ============================================================ */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}
.app.full { grid-template-columns: 1fr; }

/* Sidebar */
.sidebar {
  background: linear-gradient(180deg, #f36c0a 0%, #ea6406 50%, #d9560a 100%);
  color: #fff;
  padding: 1rem 0 1.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid rgba(0,0,0,.06);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.3) transparent;
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.3); border-radius: 99px; }
.sidebar::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 200px;
  background: radial-gradient(ellipse at top, rgba(255,255,255,.14), transparent 65%);
  pointer-events: none;
}

/* Defensive: any SVG in the sidebar that's missing stroke/fill attributes
   would otherwise render as solid black shapes. Force proper outline rendering. */
.sidebar svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Don't force these on the brand logo IMG or the gold avatar IMG — they're not SVGs anyway */

.sidebar .brand {
  display: flex; align-items: center; gap: 10px; padding: 0 1.1rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.18);
  margin-bottom: .7rem; position: relative; z-index: 1;
}
.brand-mark {
  width: 38px; height: 38px;
  background: #fff;
  border-radius: 10px;
  display: grid; place-items: center;
  overflow: hidden; padding: 3px;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
  flex-shrink: 0;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.brand-mark svg { width: 22px; height: 22px; stroke: var(--navy); fill: none; stroke-width: 2; }
.brand-text { line-height: 1.15; }
.brand-text strong {
  display: block; font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 1.08rem;
  font-weight: 700; color: #fff; letter-spacing: -.01em;
}
.brand-text small { font-size: .72rem; color: rgba(255,255,255,.8); font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }

.nav-section { padding: 0 .6rem; }
.nav-section h6 {
  font-size: .62rem; color: rgba(255,255,255,.7); padding: .75rem .85rem .3rem;
  text-transform: uppercase; letter-spacing: .12em; font-weight: 700;
  margin: 0;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: .5rem .85rem;
  color: rgba(255,255,255,.92); border-radius: 8px; margin-bottom: 1px;
  font-size: .84rem; font-weight: 600; transition: all var(--t-base);
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; opacity: .92; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.16); color: #fff; transform: translateX(2px); }
.nav-item.active {
  background: #fff;
  color: #d9560a;
  box-shadow: 0 4px 12px rgba(0,0,0,.14);
  font-weight: 700;
}
.nav-item.active svg { opacity: 1; color: #d9560a; }
.nav-item .badge-pill {
  margin-left: auto; background: var(--navy); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 99px;
}

.sidebar-bottom {
  position: absolute; bottom: 1.25rem; left: .85rem; right: .85rem;
  padding-top: 1.25rem; border-top: 1px solid rgba(255,255,255,.08);
}

/* Mobile menu toggle (default hidden on desktop) */
.menu-toggle, .mobile-toggle {
  display: none; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px;
  background: #fff; color: #0b1b3d; border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(11,27,61,.08);
  cursor: pointer;
  transition: all .15s;
}
.menu-toggle:hover, .mobile-toggle:hover {
  background: #0b1b3d; color: #fff; border-color: #0b1b3d;
}
.menu-toggle svg, .mobile-toggle svg {
  width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2.2;
  stroke-linecap: round; stroke-linejoin: round;
}
.menu-toggle svg line, .mobile-toggle svg line,
.menu-toggle svg path, .mobile-toggle svg path,
.menu-toggle svg polyline, .mobile-toggle svg polyline {
  stroke: currentColor !important;
}
.mobile-toggle { margin-right: .5rem; flex-shrink: 0; }
.overlay {
  display: none; position: fixed; inset: 0; background: rgba(11,27,61,.4);
  z-index: 997; backdrop-filter: blur(2px);
}
.overlay.open { display: block; }
body.no-scroll { overflow: hidden; }

/* Topbar (admin header) */
.topbar {
  display: flex; align-items: center; gap: .85rem;
  margin-bottom: 1.1rem; padding-bottom: .85rem;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-side { display: flex; align-items: center; gap: .55rem; flex-shrink: 0; }
.user-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 99px; padding: 3px 12px 3px 3px;
  box-shadow: 0 2px 6px rgba(11,27,61,.05);
  transition: all .15s;
}
.user-pill:hover { box-shadow: 0 4px 12px rgba(11,27,61,.08); transform: translateY(-1px); }
.user-pill-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: .76rem;
  box-shadow: 0 2px 6px rgba(249,115,22,.32);
}
.user-pill-text { line-height: 1.15; }
.user-pill-name { display: block; font-weight: 700; font-size: .8rem; color: #0b1b3d; }
.user-pill-sub { display: block; font-size: .62rem; color: #7a8194; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-top: 1px; }

/* Student-header alternates (.topbar-actions / .topbar-user / .uav / .meta) */
.topbar-actions { display: flex; align-items: center; gap: .55rem; flex-shrink: 0; }
.topbar-user {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 99px; padding: 3px 12px 3px 3px;
  text-decoration: none; color: var(--ink);
  box-shadow: 0 2px 6px rgba(11,27,61,.05);
  transition: all .15s;
}
.topbar-user:hover { box-shadow: 0 4px 12px rgba(11,27,61,.08); transform: translateY(-1px); color: var(--ink); }
.topbar-user .uav {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #f36c0a, #ff8a33);
  color: var(--navy); display: grid; place-items: center;
  font-weight: 800; font-size: .76rem; overflow: hidden;
  flex-shrink: 0;
}
.topbar-user .uav img { width: 100%; height: 100%; object-fit: cover; display: block; }
.topbar-title h1 {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1.4rem; font-weight: 600; color: var(--navy);
  letter-spacing: -.02em; line-height: 1.15; margin: 0;
}
.topbar-title p { color: var(--muted); font-size: .82rem; margin: 2px 0 0; }

/* Student sidebar user-card uses .meta not .user-meta */
.user-card .meta { flex: 1; min-width: 0; line-height: 1.2; }
.user-card .meta strong {
  display: block; color: #fff; font-weight: 600; font-size: .85rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-card .meta span {
  display: block; color: rgba(255,255,255,.8); font-size: .68rem;
  text-transform: uppercase; letter-spacing: .04em; font-weight: 500;
}
.user-card .user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }

/* Student nav uses h6 not .nav-section-title */
.sidebar .nav-section h6 {
  font-size: .65rem; color: rgba(255,255,255,.7);
  padding: 1rem 1.6rem .5rem;
  text-transform: uppercase; letter-spacing: .12em; font-weight: 700;
  margin: 0;
}
.sidebar .nav-link .badge {
  margin-left: auto;
  background: var(--navy);
  color: #fff;
  font-size: 10px; padding: 2px 8px; border-radius: 99px;
  font-weight: 800; box-shadow: 0 2px 6px rgba(0,0,0,.18);
}

/* Student brand-text */
.brand-text { line-height: 1.18; min-width: 0; }
.brand-text strong {
  display: block; font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 1.08rem;
  font-weight: 700; color: #fff; letter-spacing: -.01em;
}
.brand-text span {
  display: block; font-size: .7rem; color: rgba(255,255,255,.8);
  font-weight: 500; letter-spacing: .04em; text-transform: uppercase;
}

/* Student dashboard uses .metric (singular) — add definition so it doesn't fall apart */
.metric {
  background: #fff; border-radius: 10px; padding: .85rem 1rem;
  border: 1px solid var(--border); box-shadow: 0 2px 6px rgba(11,27,61,.04);
  transition: transform .2s, box-shadow .2s;
}
.metric:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(11,27,61,.08); }
.metric .lbl {
  font-size: .66rem; color: var(--muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px;
}
.metric .val {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1.45rem; font-weight: 600; color: var(--navy);
  line-height: 1; letter-spacing: -.02em;
}
.metric .sub { font-size: .7rem; color: var(--muted); margin-top: 4px; }

/* Container helper used by student pages */
.container { max-width: 1100px; margin: 0 auto; width: 100%; }

/* Student-page .alert custom (alert with rich content) */
.alert > div { line-height: 1.45; }

/* Sidebar foot user card (existing markup) */
.sidebar-foot {
  margin-top: 1.5rem; padding: 1rem .85rem 0;
  border-top: 1px solid rgba(255,255,255,.2);
  position: relative; z-index: 1;
}
.user-card {
  display: flex; align-items: center; gap: 12px;
  padding: .65rem; border-radius: 12px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
}
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #f36c0a, #ff8a33);
  color: #0b1b3d; display: grid; place-items: center;
  font-weight: 800; font-size: .92rem; flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(243,108,10,.4);
}
.user-meta { flex: 1; line-height: 1.2; min-width: 0; }
.user-name { color: #fff; font-weight: 600; font-size: .85rem;
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: rgba(255,255,255,.55); font-size: .68rem;
             text-transform: uppercase; letter-spacing: .04em; }
.user-out {
  color: rgba(255,255,255,.6); padding: 6px; border-radius: 8px;
  display: grid; place-items: center; flex-shrink: 0;
  transition: all var(--t-base);
}
.user-out:hover { background: rgba(255,255,255,.1); color: #fff; }

/* Brand variations used by header */
.brand-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, #fff 0%, var(--cream) 100%);
  border-radius: 12px; padding: 6px; flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.brand-meta { line-height: 1.18; min-width: 0; }
.admin-tag {
  display: inline-block; padding: 2px 8px; border-radius: 5px;
  background: rgba(243,108,10,.18); color: var(--gold-2);
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  font-weight: 700; margin-bottom: 6px;
}
.brand-name {
  display: block; font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 1.08rem;
  font-weight: 700; color: #fff; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-sub { font-size: .7rem; color: rgba(255,255,255,.55);
             font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }

/* Nav (header uses 'nav-link' not 'nav-item' in some places) */
.nav-section-title {
  font-size: .62rem; color: rgba(255,255,255,.7);
  padding: .75rem 1.2rem .3rem;
  text-transform: uppercase; letter-spacing: .12em; font-weight: 700;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: .5rem .85rem; margin: 1px .6rem;
  color: rgba(255,255,255,.92); border-radius: 8px;
  font-size: .84rem; font-weight: 600;
  transition: all var(--t-base);
  position: relative; text-decoration: none;
}
.nav-link svg,
.nav-link .nav-icon svg {
  width: 16px; height: 16px;
  opacity: .92; flex-shrink: 0;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2 !important;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Some markup uses .nav-icon as a wrapper span */
.nav-link .nav-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex-shrink: 0;
}
.nav-link:hover {
  background: rgba(255,255,255,.16);
  color: #fff; transform: translateX(3px);
}
.nav-link:hover svg { opacity: 1; color: #fff; }
.nav-link.active {
  background: #fff;
  color: #d9560a;
  box-shadow: 0 4px 12px rgba(0,0,0,.14);
  font-weight: 700;
}
.nav-link.active::before {
  content: ''; position: absolute; left: -1px; top: 6px; bottom: 6px; width: 3px;
  background: var(--navy);
  border-radius: 99px;
}
.nav-link.active svg { opacity: 1; color: #d9560a; }
.nav-badge {
  margin-left: auto;
  background: var(--navy);
  color: #fff;
  font-size: 10px; padding: 2px 8px; border-radius: 99px;
  font-weight: 800; min-width: 20px; text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

/* Content wrapper (admin) */
.content {
  padding-top: 0;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

/* Main */
.main {
  min-height: 100vh;
  padding: 1.1rem 1.4rem 2rem;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}
.page-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem;
  margin-bottom: 1rem; flex-wrap: wrap;
}
.page-title {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 1.45rem; font-weight: 600; color: var(--navy);
  letter-spacing: -.02em; line-height: 1.15;
}
.page-sub { color: var(--muted); font-size: .82rem; margin-top: 2px; }

/* ============================================================
   CARDS — the workhorse component
   ============================================================ */
.card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-1);
  border: 1px solid var(--border);
  margin-bottom: .85rem;
  position: relative;
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.card:hover { box-shadow: var(--shadow-2); }
.card-head {
  display: flex; justify-content: space-between; align-items: center; gap: .85rem;
  margin-bottom: .85rem; padding-bottom: .75rem;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.card-title {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 1.05rem; color: var(--navy);
  font-weight: 600; letter-spacing: -.01em;
}
.card-sub { color: var(--muted); font-size: .76rem; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: .55rem 1rem;
  border-radius: 8px;
  font-weight: 600; font-size: .82rem;
  cursor: pointer; transition: all var(--t-base) var(--ease-soft);
  white-space: nowrap; border: 1px solid transparent;
  text-decoration: none;
  position: relative; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-sm { padding: .42rem .7rem; font-size: .76rem; gap: 5px; }
.btn-sm svg { width: 12px; height: 12px; }
.btn-block { width: 100%; }

.btn-primary {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff; box-shadow: var(--shadow-navy);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(11,27,61,.32); color: #fff; }
.btn-primary:active { transform: translateY(0); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-2) 100%);
  color: var(--navy); box-shadow: var(--shadow-gold);
}
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(243,108,10,.36); color: var(--navy); }

.btn-ghost {
  background: var(--paper); color: var(--ink-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--cream); border-color: var(--border-2); color: var(--navy); }

.btn-danger {
  background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
  color: #fff; box-shadow: 0 8px 24px rgba(192,57,43,.28);
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(192,57,43,.36); color: #fff; }

.btn-success {
  background: linear-gradient(135deg, var(--green) 0%, #1ea35e 100%);
  color: #fff; box-shadow: 0 8px 24px rgba(22,122,74,.28);
}
.btn-success:hover { color: #fff; transform: translateY(-1px); }

/* ============================================================
   FORMS
   ============================================================ */
.field { margin-bottom: .7rem; }
.field label {
  display: block; font-size: .76rem; font-weight: 600; color: var(--ink-2);
  margin-bottom: .3rem;
}
.field .req { color: var(--red); margin-left: 2px; }
.field .hint { display: block; font-size: .68rem; color: var(--muted); margin-top: .25rem; }

input[type=text], input[type=email], input[type=number], input[type=tel],
input[type=date], input[type=password], input[type=search], input[type=url],
select, textarea {
  width: 100%; padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  font-size: .85rem;
  transition: all var(--t-base);
  color: var(--ink);
}
/* Defensive: checkboxes and radios MUST keep their native sizing —
   they can never be `width: 100%`, and they don't need our border. */
input[type=checkbox], input[type=radio] {
  width: auto !important;
  height: auto !important;
  padding: 0;
  background: transparent;
  border: 0;
  margin: 0;
  vertical-align: middle;
  accent-color: var(--navy);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--navy);
  box-shadow: 0 0 0 4px rgba(11,27,61,.08);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
textarea { resize: vertical; min-height: 72px; line-height: 1.45; }

input[type=file] {
  width: 100%; padding: .42rem;
  border: 1.5px dashed var(--border-2); border-radius: 8px;
  background: var(--cream); cursor: pointer;
  transition: all var(--t-base); font-size: .8rem;
}
input[type=file]:hover { border-color: var(--gold); background: var(--gold-soft); }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a8194' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 30px;
}

.form-row {
  display: grid; gap: .7rem; grid-template-columns: repeat(2, minmax(0, 1fr));
}
.form-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-row-1 { grid-template-columns: 1fr; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
.admin-table, .acct-table {
  width: 100%; border-collapse: collapse;
  font-size: .82rem;
  background: var(--paper);
}
.admin-table thead, .acct-table thead { background: var(--cream-2); }
.admin-table th, .acct-table th {
  text-align: left; padding: .6rem .85rem;
  font-size: .66rem; font-weight: 700; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
.admin-table td, .acct-table td {
  padding: .65rem .85rem; border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.admin-table tr:last-child td, .acct-table tr:last-child td { border-bottom: 0; }
.admin-table tbody tr, .acct-table tbody tr { transition: background var(--t-fast); }
.admin-table tbody tr:hover, .acct-table tbody tr:hover { background: var(--cream); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.sub-line { font-size: .72rem; color: var(--muted); margin-top: 2px; }

/* ============================================================
   BADGES, PILLS, CHIPS
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px; font-size: 11px;
  font-weight: 600; line-height: 1.4; white-space: nowrap;
  background: var(--cream-2); color: var(--ink-2);
}
.badge-dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.code-pill {
  display: inline-block; padding: 2px 8px; border-radius: var(--radius-pill);
  background: var(--navy-tint); color: var(--navy); font-size: .72rem;
  font-weight: 700; letter-spacing: .02em; font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.merit-pill {
  display: inline-block; padding: 4px 10px; border-radius: var(--radius-pill);
  background: var(--gold-soft); color: var(--amber);
  font-size: .8rem; font-weight: 700;
}

/* ============================================================
   ALERTS / FLASHES
   ============================================================ */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: .7rem 1rem; border-radius: var(--radius-sm);
  margin-bottom: .85rem; font-size: .82rem; font-weight: 500;
  border: 1px solid transparent; animation: slideDown var(--t-slow) var(--ease-soft);
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--green-soft); color: var(--green); border-color: rgba(22,122,74,.18); }
.alert-error,
.alert-danger  { background: var(--red-soft); color: var(--red); border-color: rgba(192,57,43,.16); }
.alert-warning { background: var(--amber-soft); color: var(--amber); border-color: rgba(176,107,20,.16); }
.alert-info    { background: var(--blue-soft); color: var(--blue); border-color: rgba(42,82,190,.16); }
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ============================================================
   METRIC CARDS (dashboards)
   ============================================================ */
.metrics {
  display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 1rem;
}
.metric-card,
a.metric-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform var(--t-base), box-shadow var(--t-base);
  min-height: 72px;
}
a.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  color: inherit;
}
.metric-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  pointer-events: none;
}
.metric-card.is-blue::before    { background: linear-gradient(90deg, #5b8def, var(--blue)); }
.metric-card.is-green::before   { background: linear-gradient(90deg, #2bd17c, var(--green)); }
.metric-card.is-amber::before   { background: linear-gradient(90deg, #ffb84d, var(--amber)); }
.metric-card.is-purple::before  { background: linear-gradient(90deg, #a182ff, var(--purple)); }
.metric-card.is-red::before     { background: linear-gradient(90deg, #ff7563, var(--red)); }

.metric-icon {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--cream);
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.metric-icon > svg,
.metric-card .metric-icon svg {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  display: block !important;
  flex-shrink: 0 !important;
}
.metric-card.is-blue   .metric-icon { background: var(--blue-soft); color: var(--blue); }
.metric-card.is-green  .metric-icon { background: var(--green-soft); color: var(--green); }
.metric-card.is-amber  .metric-icon { background: var(--amber-soft); color: var(--amber); }
.metric-card.is-purple .metric-icon { background: var(--purple-soft); color: var(--purple); }
.metric-card.is-red    .metric-icon { background: var(--red-soft); color: var(--red); }

.metric-body {
  flex: 1; min-width: 0;
  line-height: 1.2;
}
.metric-label {
  font-size: .66rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metric-value {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--navy);
  margin-top: 2px;
  letter-spacing: -.02em;
  line-height: 1;
}
.metric-delta { font-size: .76rem; font-weight: 600; margin-top: 4px; }
.metric-delta.up   { color: var(--green); }
.metric-delta.down { color: var(--red); }

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline { list-style: none; padding-left: 0; }
.timeline-item {
  display: grid; grid-template-columns: 32px 1fr;
  gap: 12px; padding: 0 0 .9rem; position: relative;
}
.timeline-item:not(:last-child)::after {
  content: ''; position: absolute; left: 15px; top: 32px; bottom: 0;
  width: 2px; background: var(--line);
}
.timeline-item.timeline-done:not(:last-child)::after { background: var(--gold); }
.timeline-dot {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--cream-2); color: var(--muted); font-weight: 700; font-size: .8rem;
  border: 2px solid var(--border); flex-shrink: 0;
  z-index: 1;
}
.timeline-done .timeline-dot {
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #fff; border-color: var(--gold);
  box-shadow: 0 3px 10px rgba(243,108,10,.3);
}
.timeline-current .timeline-dot {
  background: #fff; color: var(--navy);
  border-color: var(--navy); box-shadow: 0 0 0 3px rgba(11,27,61,.08);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(11,27,61,.08); }
  50%      { box-shadow: 0 0 0 6px rgba(11,27,61,.04); }
}
.timeline-body { padding-top: 4px; }
.timeline-title { font-weight: 600; color: var(--navy); font-size: .92rem; }
.timeline-sub { font-size: .76rem; color: var(--muted); margin-top: 2px; }

/* Inline action chips inside the timeline */
.step-actions {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.step-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  padding: 4px 9px; border-radius: 99px;
}
.step-chip-ok   { background: var(--green-soft); color: var(--green); }
.step-chip-wait { background: var(--amber-soft); color: var(--amber); }

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 1.25rem;
}
.filter-bar select, .filter-bar input[type=search], .filter-bar input[type=text] {
  width: auto; min-width: 200px; padding: .55rem .85rem; font-size: .85rem;
}
.search-input {
  display: flex; align-items: center; gap: 8px;
  background: var(--paper); border: 1px solid var(--border);
  border-radius: 10px; padding: 0 12px; min-width: 260px;
  transition: all var(--t-base);
}
.search-input:focus-within { border-color: var(--navy); box-shadow: 0 0 0 4px rgba(11,27,61,.08); }
.search-input svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.search-input input {
  border: 0; padding: .55rem 0; background: transparent;
  flex: 1; font-size: .88rem; outline: none;
}

/* ============================================================
   PAYMENTS / SLIPS UI
   ============================================================ */
.pay-block {
  background: var(--cream); border-radius: var(--radius);
  padding: 1.25rem; margin-bottom: 1rem; border: 1px solid var(--line);
}
.pay-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; margin-bottom: .75rem; flex-wrap: wrap;
}
.pay-label { font-size: .82rem; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.pay-amount {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 1.5rem; font-weight: 600;
  color: var(--navy); letter-spacing: -.01em;
}
.pay-form { background: var(--paper); padding: 14px; border-radius: 10px; margin-top: .75rem; }
.pay-meta {
  font-size: 13px; font-weight: 500;
  padding: 8px 14px; background: var(--green-soft); color: var(--green);
  border-radius: 8px; display: inline-block;
}
.pay-meta-ok   { color: var(--green); background: var(--green-soft); }
.pay-meta-warn { color: var(--amber); background: var(--amber-soft); border: 1px solid rgba(176,107,20,.2); }
.muted { color: var(--muted); }

/* ============================================================
   DOCUMENT TILE / DOC VIEWER
   ============================================================ */
.docs {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.doc {
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; text-align: center;
  transition: all var(--t-base); cursor: pointer;
}
.doc:hover { border-color: var(--gold); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.doc-thumb {
  width: 100%; aspect-ratio: 1 / 1.2; background: var(--cream);
  border-radius: 8px; overflow: hidden; margin-bottom: 8px;
  display: grid; place-items: center; color: var(--muted-2);
}
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-name { font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.doc-empty { color: var(--muted-2); font-size: .85rem; }

/* ============================================================
   MOBILE — RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 280px; z-index: 998;
    transform: translateX(-100%); transition: transform var(--t-slow) var(--ease-soft);
    box-shadow: var(--shadow-3);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle, .mobile-toggle { display: inline-flex !important; }
  .sidebar-backdrop, .overlay {
    display: none; position: fixed; inset: 0; background: rgba(11,27,61,.45);
    z-index: 997; backdrop-filter: blur(2px);
  }
  .sidebar-backdrop.show, .overlay.open { display: block; }
  .main { padding: 1.25rem 1rem 2rem; }
  .page-head, .topbar { flex-wrap: wrap; }
  .topbar-title h1, .page-title { font-size: 1.4rem; }
  /* Hide username text on small phones, keep avatar */
  .user-pill-text, .topbar-user span:first-child { display: none !important; }
  .user-pill, .topbar-user { padding: 4px; }
  body.no-scroll { overflow: hidden; }
}

@media (max-width: 640px) {
  .card { padding: 1.1rem; border-radius: var(--radius); }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .metric-card { padding: 1rem; }
  .metric-value { font-size: 1.5rem; }
  .metric-icon { flex-basis: 38px; width: 38px; height: 38px; }
  .metric-icon svg { width: 18px !important; height: 18px !important; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar select, .filter-bar input, .search-input { width: 100%; min-width: 0; }
  .btn { padding: .65rem 1rem; font-size: .85rem; }
  .admin-table th, .admin-table td,
  .acct-table th, .acct-table td { padding: .65rem .7rem; font-size: .8rem; }
  .timeline-item { grid-template-columns: 32px 1fr; gap: 12px; }
  .timeline-dot { width: 32px; height: 32px; font-size: .8rem; }
  .timeline-item:not(:last-child)::after { left: 15px; top: 32px; }
}

@media (max-width: 420px) {
  .metrics { grid-template-columns: 1fr; }
  .topbar-title h1, .page-title { font-size: 1.2rem; }
  .topbar-title p { font-size: .8rem; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar, .menu-toggle, .btn, .filter-bar { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .main { padding: 1rem; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}
