/* ICAB Information System — User Manual
   Brand ramp mirrors the real --color-primary-* maroon tokens used on the
   public /auth pages (src/app/globals.css), not the internal blue --color-brand-*
   admin-dashboard scale — students meet the maroon identity first. */

:root {
  --brand-25: #fffaf9;
  --brand-50: #fff3f1;
  --brand-100: #ffece9;
  --brand-200: #fedbd6;
  --brand-300: #edaaa1;
  --brand-400: #c32148;
  --brand-500: #9e0b0f;
  --brand-600: #860000;
  --brand-700: #670000;
  --brand-800: #4b0000;
  --brand-900: #310000;
  --brand-950: #1b0000;

  --gray-25: #fcfcfd;
  --gray-50: #f9fafb;
  --gray-100: #f2f4f7;
  --gray-200: #e4e7ec;
  --gray-300: #d0d5dd;
  --gray-400: #98a2b3;
  --gray-500: #667085;
  --gray-600: #475467;
  --gray-700: #344054;
  --gray-800: #1d2939;
  --gray-900: #101828;
  --gray-950: #0c111d;

  --success-500: #12b76a;
  --warning-500: #f79009;
  --error-500: #f04438;

  --bg: #ffffff;
  --bg-subtle: var(--gray-25);
  --bg-raised: #ffffff;
  --text: var(--gray-900);
  --text-muted: var(--gray-500);
  --border: var(--gray-200);
  --sidebar-bg: var(--gray-25);
  --code-bg: var(--gray-100);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, 0.10);
  --radius: 10px;
  --topbar-h: 64px;
  --sidebar-w: 272px;
  --toc-w: 224px;
}

:root[data-theme="dark"] {
  --bg: var(--gray-950);
  --bg-subtle: #0f1420;
  --bg-raised: var(--gray-900);
  --text: var(--gray-50);
  --text-muted: var(--gray-400);
  --border: var(--gray-800);
  --sidebar-bg: #0f1420;
  --code-bg: #161c2c;
  --shadow: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--gray-950);
    --bg-subtle: #0f1420;
    --bg-raised: var(--gray-900);
    --text: var(--gray-50);
    --text-muted: var(--gray-400);
    --border: var(--gray-800);
    --sidebar-bg: #0f1420;
    --code-bg: #161c2c;
    --shadow: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.45);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Outfit", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background 0.15s ease, color 0.15s ease;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- Top bar ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  margin-right: 8px;
}
.brand .mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--brand-500);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand .mark svg { width: 16px; height: 16px; }
.brand .name-full { display: inline; }
.brand .name-short { display: none; color: var(--text-muted); font-weight: 500; }

.menu-toggle {
  display: none;
  background: none; border: none; color: var(--text);
  padding: 6px; border-radius: 8px; cursor: pointer;
}
.menu-toggle:hover { background: var(--bg-subtle); }
.menu-toggle svg { width: 20px; height: 20px; }

.topnav {
  display: flex;
  gap: 4px;
  margin-right: auto;
}
.topnav a {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}
.topnav a:hover { background: var(--bg-subtle); color: var(--text); }
.topnav a.active { color: var(--brand-600); background: var(--brand-50); }
:root[data-theme="dark"] .topnav a.active,
@media (prefers-color-scheme: dark) { .topnav a.active { color: var(--brand-300); background: rgba(158,11,15,0.15); } }

.search-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 280px;
  max-width: 40vw;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}
.search-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.search-btn kbd {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.icon-btn {
  background: none; border: 1px solid transparent; color: var(--text-muted);
  width: 36px; height: 36px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--bg-subtle); border-color: var(--border); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: block; }
}

/* ---------- Layout ---------- */
.shell {
  display: flex;
  padding-top: var(--topbar-h);
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 20px 12px 40px;
}
.sidebar-group { margin-bottom: 22px; }
.sidebar-group h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 6px 10px;
  font-weight: 700;
}
.sidebar a {
  display: block;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  margin: 1px 0;
}
.sidebar a:hover { background: var(--bg-raised); color: var(--text); }
.sidebar a.active {
  color: var(--brand-600);
  background: var(--brand-50);
  border-left-color: var(--brand-500);
  font-weight: 600;
}
:root[data-theme="dark"] .sidebar a.active { color: var(--brand-300); background: rgba(158,11,15,0.14); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sidebar a.active { color: var(--brand-300); background: rgba(158,11,15,0.14); }
}

.content-col {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  justify-content: center;
}

main {
  width: 100%;
  max-width: 760px;
  padding: 40px 32px 100px;
}

.toc {
  width: var(--toc-w);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--topbar-h) + 40px);
  align-self: flex-start;
  padding: 0 20px 40px 0;
  font-size: 13px;
}
.toc h5 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 0 0 10px; }
.toc a { display: block; padding: 5px 0; color: var(--text-muted); border-left: 2px solid var(--border); padding-left: 12px; }
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--brand-600); border-left-color: var(--brand-500); font-weight: 600; }
.toc a.sub { padding-left: 24px; font-size: 12.5px; }

/* ---------- Breadcrumb / headings ---------- */
.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { margin: 0 6px; }

h1 { font-size: 34px; line-height: 1.2; margin: 0 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 22px; margin: 40px 0 12px; letter-spacing: -0.005em; scroll-margin-top: 90px; }
h3 { font-size: 17px; margin: 28px 0 10px; scroll-margin-top: 90px; }
main h4 { font-size: 14.5px; margin: 24px 0 8px; scroll-margin-top: 90px; }
p { line-height: 1.7; color: var(--text); }
.lead { font-size: 17px; color: var(--text-muted); line-height: 1.65; }
ul, ol { line-height: 1.8; padding-left: 22px; }
li { margin-bottom: 4px; }
strong { font-weight: 650; }
hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }

/* ---------- Home hero ---------- */
.hero { max-width: 860px; margin: 0 auto; padding: 64px 32px 20px; text-align: left; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; color: var(--brand-600);
  background: var(--brand-50); padding: 5px 12px; border-radius: 999px; margin-bottom: 18px;
}
:root[data-theme="dark"] .eyebrow { color: var(--brand-300); background: rgba(158,11,15,0.15); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .eyebrow { color: var(--brand-300); background: rgba(158,11,15,0.15); } }
.hero h1 { font-size: 46px; max-width: 640px; }
.hero p.lead { max-width: 580px; font-size: 18px; }

.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 32px 0 8px; }
.hero-card {
  position: relative;
  border-radius: 16px;
  padding: 28px;
  min-height: 150px;
  display: flex; flex-direction: column; justify-content: flex-end;
  overflow: hidden;
  border: 1px solid var(--border);
}
.hero-card.a { background: linear-gradient(135deg, var(--brand-500), var(--brand-800)); }
.hero-card.b { background: linear-gradient(135deg, var(--gray-800), var(--brand-900)); }
.hero-card h3 { color: #fff; margin: 0 0 6px; font-size: 20px; }
.hero-card p { color: rgba(255,255,255,0.82); font-size: 13.5px; margin: 0; line-height: 1.5; }

.section-title { font-size: 24px; margin: 56px 0 8px; }
.section-sub { color: var(--text-muted); margin: 0 0 24px; font-size: 15px; }

.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.cat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--bg-raised);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow .15s ease;
}
.cat-card:hover { border-color: var(--brand-300); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.cat-card .ic {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--brand-50); color: var(--brand-600);
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
:root[data-theme="dark"] .cat-card .ic { background: rgba(158,11,15,0.15); color: var(--brand-300); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cat-card .ic { background: rgba(158,11,15,0.15); color: var(--brand-300); } }
.cat-card .ic svg { width: 18px; height: 18px; }
.cat-card h4 { margin: 0 0 4px; font-size: 15px; }
.cat-card p { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.5; }

.quicklinks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; margin-bottom: 60px; }
.quicklinks a { display: flex; align-items: center; gap: 8px; padding: 8px 0; font-size: 14px; color: var(--text); border-bottom: 1px solid var(--border); }
.quicklinks a:hover { color: var(--brand-600); }
.quicklinks a svg { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }

.home-main { max-width: 980px; margin: 0 auto; padding: 0 32px 100px; }

/* ---------- Callouts ---------- */
.callout {
  border-radius: 10px;
  padding: 14px 16px;
  margin: 20px 0;
  border: 1px solid var(--border);
  border-left-width: 4px;
  font-size: 14px;
  line-height: 1.6;
}
.callout p { margin: 0; font-size: 14px; }
.callout strong.label { display: block; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.callout.note { border-left-color: var(--brand-500); background: var(--brand-25); }
.callout.note strong.label { color: var(--brand-700); }
.callout.tip { border-left-color: var(--success-500); background: rgba(18,183,106,0.07); }
.callout.tip strong.label { color: #067647; }
.callout.warn { border-left-color: var(--warning-500); background: rgba(247,144,9,0.08); }
.callout.warn strong.label { color: #b54708; }
:root[data-theme="dark"] .callout.note { background: rgba(158,11,15,0.10); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .callout.note { background: rgba(158,11,15,0.10); } }

/* ---------- Steps ---------- */
.steps { list-style: none; padding: 0; counter-reset: step; margin: 24px 0; }
.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 44px;
  margin-bottom: 28px;
}
.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--brand-500); color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.steps h4 { margin: 3px 0 6px; font-size: 15.5px; }
.steps p { margin: 0 0 10px; font-size: 14.5px; }

/* ---------- Process flow diagram ---------- */
.flow-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 16px 0 24px; font-size: 13px; }
.flow-legend .key { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); }
.flow-legend .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.flow { max-width: 620px; margin: 0 auto 32px; display: flex; flex-direction: column; align-items: center; }
.flow-node {
  width: 100%;
  border: 1px solid var(--border);
  border-left: 4px solid var(--gray-300);
  border-radius: 12px;
  padding: 14px 18px;
  background: var(--bg-raised);
}
.flow-node[data-role="student"] { border-left-color: var(--brand-500); }
.flow-node[data-role="rep"] { border-left-color: #0ba5ec; }
.flow-node[data-role="principal"] { border-left-color: #12b76a; }
.flow-node[data-role="registrar"] { border-left-color: #6938ef; }
.flow-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flow-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--gray-400); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.flow-node[data-role="student"] .flow-num { background: var(--brand-500); }
.flow-node[data-role="rep"] .flow-num { background: #0ba5ec; }
.flow-node[data-role="principal"] .flow-num { background: #12b76a; }
.flow-node[data-role="registrar"] .flow-num { background: #6938ef; }
.flow-title { font-weight: 700; font-size: 14.5px; }
.flow-role {
  margin-left: auto;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-subtle); border: 1px solid var(--border);
  padding: 2px 9px; border-radius: 999px; white-space: nowrap;
}
.flow-desc { font-size: 13px; color: var(--text-muted); margin: 6px 0 0 36px; line-height: 1.6; }

.flow-connector { position: relative; width: 2px; height: 26px; background: var(--border); }
.flow-connector::after {
  content: "";
  position: absolute; left: 50%; bottom: -1px; transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 6px solid var(--border);
}

/* Decision outcomes on gate (review/approval) stages */
.flow-outcomes { display: flex; gap: 8px; flex-wrap: wrap; margin: 11px 0 0 36px; }
.flow-outcome {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 6px;
  border: 1px solid transparent;
}
.flow-outcome.go { color: #067647; background: rgba(18,183,106,0.1); border-color: rgba(18,183,106,0.3); }
.flow-outcome.resubmit { color: #b54708; background: rgba(247,144,9,0.1); border-color: rgba(247,144,9,0.3); }
.flow-outcome.reject { color: #b42318; background: rgba(240,68,56,0.1); border-color: rgba(240,68,56,0.3); }

/* Notification indicator per stage */
.flow-notify {
  display: flex; align-items: flex-start; gap: 6px;
  margin: 10px 0 0 36px; padding-top: 9px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px; color: var(--text-muted); line-height: 1.5;
}
.flow-notify svg { width: 14px; height: 14px; color: #0ba5ec; flex-shrink: 0; margin-top: 1px; }
.flow-notify strong { color: var(--text); font-weight: 600; }

/* ---------- Screenshot placeholder ---------- */
figure.shot {
  margin: 12px 0 4px;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  background: var(--bg-subtle);
  aspect-ratio: 16/9;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  color: var(--text-muted);
}
figure.shot svg { width: 30px; height: 30px; opacity: 0.6; }
figure.shot figcaption { font-size: 12.5px; text-align: center; padding: 0 16px; }
figure.shot figcaption .fname { display: block; font-weight: 600; color: var(--text); margin-top: 2px; }

/* Real screenshot (as opposed to the dashed placeholder above) */
figure.shot.is-real {
  border-style: solid;
  background: var(--bg-raised);
  aspect-ratio: auto;
  padding: 8px;
  box-shadow: var(--shadow);
}
figure.shot.is-real img { border-radius: 6px; width: 100%; display: block; }
figure.shot.is-real figcaption { padding: 10px 4px 2px; }

/* ---------- Table ---------- */
table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.03em; }
code { background: var(--code-bg); padding: 2px 6px; border-radius: 5px; font-size: 0.9em; }

.pagenav { display: flex; justify-content: space-between; margin-top: 56px; gap: 16px; }
.pagenav a {
  border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px;
  max-width: 48%; font-size: 13px; color: var(--text-muted);
}
.pagenav a:hover { border-color: var(--brand-300); }
.pagenav a .lbl { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.pagenav a .ttl { color: var(--text); font-weight: 600; font-size: 14.5px; }
.pagenav a.next { text-align: right; margin-left: auto; }

/* ---------- Search modal ---------- */
.search-overlay {
  position: fixed; inset: 0; background: rgba(16,24,40,0.5);
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 12vh; z-index: 200;
}
.search-overlay.open { display: flex; }
.search-modal {
  width: 560px; max-width: 92vw; max-height: 60vh;
  background: var(--bg-raised); border-radius: 14px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.search-modal input {
  border: none; border-bottom: 1px solid var(--border);
  padding: 16px 18px; font-size: 15px; background: transparent; color: var(--text); outline: none;
}
.search-results { overflow-y: auto; padding: 8px; }
.search-results a { display: block; padding: 10px 12px; border-radius: 8px; }
.search-results a:hover, .search-results a.sel { background: var(--bg-subtle); }
.search-results .r-title { font-size: 14px; font-weight: 600; }
.search-results .r-group { font-size: 12px; color: var(--text-muted); }
.search-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13.5px; }

/* ---------- Footer ---------- */
footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 32px;
  font-size: 12.5px;
  color: var(--text-muted);
  max-width: 760px;
}
.home-main footer.site-footer { max-width: none; margin-top: 40px; }

/* ---------- Overlay (mobile sidebar) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(16,24,40,0.4); z-index: 90; display: none; }
.scrim.open { display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .toc { display: none; }
}
@media (max-width: 1024px) {
  .menu-toggle { display: flex; align-items: center; justify-content: center; }
  .brand .name-full { display: none; }
  .brand .name-short { display: inline; }
  .topnav { display: none; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
    z-index: 95;
  }
  .sidebar.open { transform: translateX(0); }
  .content-col { margin-left: 0; }
  .card-grid { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: 1fr 1fr; }
  .quicklinks { grid-template-columns: 1fr; }
  .hero h1 { font-size: 34px; }
}
@media (max-width: 640px) {
  .search-btn { width: 44px; padding: 8px; justify-content: center; }
  .search-btn span.lbl, .search-btn kbd { display: none; }
  .cat-grid { grid-template-columns: 1fr; }
  main { padding: 28px 18px 80px; }
  .hero { padding: 40px 18px 10px; }
}
