/* ============================================================================
   mlms-app.css — "Civic Editorial" design system
   Municipal LMS mockup. Paper + ink-navy, serif headlines (Newsreader),
   Public Sans for UI. The tenant accent (--brand) is the one expressive color,
   resolved per tenant at page load (white-label). WCAG 2.1 AA throughout.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* — Brand (white-label; overridden per tenant by app.js) — */
  --brand:        #0C5A73;   /* tenant accent */
  --brand-strong: #08475C;   /* hover / pressed */
  --brand-ink:    #ffffff;   /* text on brand */
  --brand-soft:   #0c5a7314; /* ~8% tint for fills */
  --brand-line:   #0c5a7333;

  /* — Civic paper & ink — */
  --paper:    #FBF9F4;
  --paper-2:  #F4F1E8;
  --surface:  #FFFFFF;
  --ink:      #1A2330;       /* primary text */
  --ink-2:    #46505F;       /* secondary */
  --ink-3:    #5E6877;       /* muted / captions — darkened for AA on warm paper (A8) */
  --line:     #E7E2D6;       /* hairline */
  --line-2:   #D8D2C4;

  /* — Status (AA text shades + soft backgrounds) — */
  --ok:        #1C6B43;  --ok-soft:     #E7F1EB;
  --warn:      #875600;  --warn-soft:   #F8EFD8;
  --danger:    #A1231C;  --danger-soft: #FaE8E6;
  --info:      #1F4E79;  --info-soft:   #EAF0F6;

  /* — Type — */
  --font-display: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* — Shape & depth — */
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(26,35,48,.05), 0 1px 1px rgba(26,35,48,.04);
  --shadow:    0 4px 16px -6px rgba(26,35,48,.14), 0 2px 4px rgba(26,35,48,.05);
  --focus: 0 0 0 3px var(--paper), 0 0 0 5px var(--brand);

  --sidebar-w: 248px;
  --topbar-h: 64px;
  --maxw: 1180px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  /* subtle warm paper grain via layered gradients */
  background-image:
    radial-gradient(1200px 600px at 100% -10%, #ffffff 0%, rgba(255,255,255,0) 55%),
    radial-gradient(900px 500px at -10% 110%, var(--paper-2) 0%, rgba(244,241,232,0) 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* — Headings: editorial serif — */
h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin: 0;
}
h1 { font-size: clamp(26px, 3.2vw, 33px); line-height: 1.12; font-weight: 480; }
h2 { font-size: 21px; line-height: 1.2; }
h3 { font-size: 17px; line-height: 1.25; }

p { margin: 0 0 1em; }
a { color: var(--brand); text-decoration-color: var(--brand-line); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--brand); }

small, .caption { font-size: 12.5px; color: var(--ink-3); }

/* Eyebrow / section label — tracked caps Public Sans */
.eyebrow {
  font-size: 11.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3);
}

/* — Focus visibility (AA 2.4.7) — */
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ============================================================================
   App shell: topbar + sidebar + view
   ============================================================================ */

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 18px;
  padding: 0 22px;
  background: rgba(251,249,244,.82);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; color: inherit; }
.brand .monogram {
  flex: none;
  width: 38px; height: 38px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--brand); color: var(--brand-ink);
  font-family: var(--font-display); font-weight: 600; font-size: 16px;
  letter-spacing: .02em;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), var(--shadow-sm);
}
.brand .wordmark { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand .wordmark b { font-family: var(--font-display); font-weight: 560; font-size: 15.5px; letter-spacing: -.01em; white-space: nowrap; }
.brand .wordmark span { font-size: 11px; color: var(--ink-3); letter-spacing: .03em; white-space: nowrap; }

.topbar .spacer { flex: 1; }

.searchbox {
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 12px; min-width: 220px; max-width: 340px; flex: 1;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 9px;
  color: var(--ink-3);
}
.searchbox input { border: none; background: none; outline: none; width: 100%; font: inherit; color: var(--ink); padding: 0; min-height: 0; }
.searchbox svg { flex: none; }

/* Demo + user cluster */
.demo-switch { display: flex; align-items: center; gap: 8px; }
.demo-switch select {
  height: 36px; padding: 0 30px 0 11px; min-height: 0; width: auto;
  font-size: 13px; color: var(--ink-2);
  border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface);
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7585' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.demo-switch .lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }

.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: grid; place-items: center; cursor: pointer;
  background: var(--brand-soft); color: var(--brand-strong);
  border: 1px solid var(--brand-line);
  font-weight: 700; font-size: 13px; letter-spacing: .02em;
}

.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; align-items: start; }

.sidebar {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px;
}
.nav-group-label { padding: 14px 12px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 9px;
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 14.5px;
  transition: background .12s ease, color .12s ease;
}
.nav-item svg { flex: none; color: var(--ink-3); transition: color .12s ease; }
.nav-item:hover { background: var(--paper-2); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }
.nav-item[aria-current="page"] svg { color: var(--brand); }
.sidebar .grow { flex: 1; }
.sidebar .help {
  margin-top: auto; padding: 14px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.sidebar .help b { font-family: var(--font-display); font-weight: 560; font-size: 14px; }
.sidebar .help p { font-size: 12.5px; color: var(--ink-3); margin: 4px 0 0; }

.view { min-height: calc(100vh - var(--topbar-h)); padding: 34px clamp(20px, 4vw, 52px) 80px; }
.view-inner { max-width: var(--maxw); margin: 0 auto; }

/* ============================================================================
   Primitives: buttons, chips, cards, meters, tables
   ============================================================================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 9px;
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  border: 1px solid transparent; background: var(--surface); color: var(--ink);
  white-space: nowrap; transition: transform .04s ease, background .12s ease, border-color .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-ghost { border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { background: var(--paper-2); border-color: var(--ink-3); }
.btn-sm { height: 34px; padding: 0 13px; font-size: 13px; border-radius: 8px; }
.btn-link { background: none; border: none; color: var(--brand); padding: 0; height: auto; font-weight: 600; }

/* status chip */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 650; letter-spacing: .005em; white-space: nowrap;
  background: var(--paper-2); color: var(--ink-2);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.chip.solid { color: #fff; }
.chip.ok      { background: var(--ok-soft);     color: var(--ok); }
.chip.warn    { background: var(--warn-soft);   color: var(--warn); }
.chip.danger  { background: var(--danger-soft); color: var(--danger); }
.chip.info    { background: var(--info-soft);   color: var(--info); }
.chip.plain::before { display: none; }
.chip.tag { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }
.chip.tag::before { display: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 22px; }

/* progress meter */
.meter { height: 8px; border-radius: 999px; background: var(--paper-2); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.meter.ok > span { background: var(--ok); }
.meter.warn > span { background: var(--warn); }
.meter.danger > span { background: var(--danger); }
.meter-row { display: flex; align-items: center; gap: 12px; }
.meter-row .meter { flex: 1; }
.meter-row .pct { font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 700; color: var(--ink-2); min-width: 38px; text-align: right; }

/* stat */
.stat .num { font-family: var(--font-display); font-weight: 500; font-size: 34px; line-height: 1; letter-spacing: -.02em; }
.stat .lbl { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }

/* table */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); padding: 0 14px 10px; border-bottom: 1px solid var(--line);
}
.table td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--paper); }

/* person cell */
.person { display: flex; align-items: center; gap: 11px; }
.person .ava {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--paper-2); color: var(--ink-2); font-weight: 700; font-size: 12px;
  border: 1px solid var(--line-2);
}
.person .nm { font-weight: 600; font-size: 14px; }
.person .ti { font-size: 12px; color: var(--ink-3); }

/* dividers / utility */
.rule { height: 1px; background: var(--line); border: 0; margin: 24px 0; }
.row { display: flex; align-items: center; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--ink-3); }
.serif { font-family: var(--font-display); }
.tnum { font-variant-numeric: tabular-nums; }

/* staggered page-load reveal */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.reveal { animation: rise .5s cubic-bezier(.2,.7,.2,1) both; }
@media (prefers-reduced-motion: reduce) { .reveal { animation: none; } }

/* ============================================================================
   Page components
   ============================================================================ */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-head .greet { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--brand-strong); margin-bottom: 8px; }
.page-head .sub { color: var(--ink-2); margin: 8px 0 0; max-width: 60ch; }

/* compliance status banner */
.banner {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm);
  margin-bottom: 30px;
}
.banner .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.banner.is-ok    { border-left: 4px solid var(--ok); }      .banner.is-ok .dot    { background: var(--ok); }
.banner.is-warn  { border-left: 4px solid var(--warn); }    .banner.is-warn .dot  { background: var(--warn); }
.banner.is-danger{ border-left: 4px solid var(--danger); }  .banner.is-danger .dot{ background: var(--danger); }
.banner b { font-family: var(--font-display); font-weight: 560; font-size: 17px; }
.banner .b-sub { color: var(--ink-2); font-size: 14px; }
.banner .spacer { flex: 1; }

/* section header */
.section-head { display: flex; align-items: baseline; gap: 10px; margin: 30px 0 14px; }
.section-head h2 { font-size: 18px; }
.section-head .count { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }

/* course / assignment cards */
.card-list { display: flex; flex-direction: column; gap: 14px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

.course-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease; }
.course-card:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.cc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.cc-tags { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 9px; }
.cc-title { font-size: 18px; }
.cc-sum { color: var(--ink-2); font-size: 13.5px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-meta { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-3); flex-wrap: wrap; }
.cc-meta .dot-sep::before { content: "·"; margin-right: 14px; color: var(--line-2); }
.cc-foot { display: flex; align-items: center; gap: 16px; margin-top: 2px; }
.cc-foot .meter-row { flex: 1; }
.cc-foot.simple { justify-content: space-between; }
.due { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.due.warn { color: var(--warn); } .due.danger { color: var(--danger); } .due.ok { color: var(--ok); }

/* goal teaser */
.goal-card { padding: 20px 22px; display: grid; gap: 14px; }
.goal-card .target { display: flex; align-items: center; gap: 12px; }
.goal-card .target .ring {
  width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-strong); font-family: var(--font-display); font-weight: 600;
}
.gap-list { display: flex; flex-direction: column; gap: 8px; }
.gap-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); }
.gap-item .gi-name { font-weight: 600; font-size: 14px; flex: 1; }
.gap-item.held { opacity: .72; }

/* two-column page (content + rail) */
.cols { display: grid; grid-template-columns: 1fr 320px; gap: 26px; align-items: start; }
.rail { display: flex; flex-direction: column; gap: 16px; position: sticky; top: calc(var(--topbar-h) + 24px); }

/* course detail */
.course-hero { margin-bottom: 22px; }
.course-hero h1 { margin: 10px 0 12px; }
.course-hero .chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.player {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm);
}
.player-stage {
  aspect-ratio: 16 / 9; display: grid; place-items: center; gap: 14px;
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(255,255,255,.10), rgba(0,0,0,0) 60%),
    linear-gradient(150deg, var(--brand-strong), var(--brand));
  color: #fff; text-align: center; padding: 20px;
}
.player-stage .play { width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.4); cursor: pointer; }
.player-stage .play:hover { background: rgba(255,255,255,.26); }
.player-stage .now { font-family: var(--font-display); font-size: 19px; }
.player-stage .cap { font-size: 12.5px; opacity: .85; letter-spacing: .04em; }
.player-bar { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line); }

.attest { margin-top: 16px; display: flex; gap: 12px; padding: 16px 18px; border: 1px dashed var(--brand-line); border-radius: var(--radius); background: var(--brand-soft); }
.attest input { width: 18px; height: 18px; min-height: 0; flex: none; margin-top: 2px; accent-color: var(--brand); }
.attest label { font-size: 13.5px; color: var(--ink-2); margin: 0; font-weight: 500; }

/* module / lesson list */
.module { margin-bottom: 18px; }
.module-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.module-h .mn { font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--ink-3); }
.module-h h3 { font-size: 15px; }
.lesson { display: flex; align-items: center; gap: 13px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); margin-bottom: 8px; }
.lesson .lt { width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center; background: var(--paper-2); color: var(--ink-2); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.lesson.done .lt { background: var(--ok-soft); color: var(--ok); }
.lesson { font: inherit; color: var(--ink); }
.lesson .ln { flex: 1; font-size: 14px; font-weight: 500; }
.lesson .lm { font-size: 12px; color: var(--ink-3); }
.lesson.playing { border-color: var(--brand); box-shadow: inset 3px 0 0 var(--brand); }

/* stats row (team) */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.stat-card { padding: 18px 20px; }
.stat-card .num { font-family: var(--font-display); font-weight: 500; font-size: 32px; line-height: 1; letter-spacing: -.02em; }
.stat-card .num.ok { color: var(--ok); } .stat-card .num.warn { color: var(--warn); } .stat-card .num.danger { color: var(--danger); }
.stat-card .lbl { font-size: 12.5px; color: var(--ink-3); margin-top: 8px; }

.filter-row { display: flex; gap: 8px; margin: 8px 0 18px; flex-wrap: wrap; }
.filter-chip { height: 32px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.filter-chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* tabbed player panel */
.tabbar { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab {
  font: inherit; font-size: 14px; font-weight: 600; color: var(--ink-3);
  background: none; border: none; padding: 10px 14px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--brand-strong); border-bottom-color: var(--brand); }
.tabpanel { animation: rise .3s ease both; }

textarea { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 8px; resize: vertical; color: var(--ink); min-height: 0; }

/* quiz runner */
.quiz { padding: 24px; }
.quiz-head { margin-bottom: 18px; }
.quiz-head h3 { font-size: 19px; margin-top: 2px; }
.quiz-q { padding: 16px 0; border-top: 1px solid var(--line); }
.quiz-qn { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.quiz-qt { font-size: 15.5px; font-weight: 600; margin-bottom: 12px; }
.quiz-opts { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; font-weight: 500; margin: 0; }
.quiz-opt:hover { border-color: var(--line-2); background: var(--paper); }
.quiz-opt input { width: 18px; height: 18px; min-height: 0; flex: none; accent-color: var(--brand); margin: 0; }
.quiz-foot { display: flex; align-items: center; gap: 16px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.quiz-result { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-radius: 10px; flex: 1; }
.quiz-result.pass { background: var(--ok-soft); }
.quiz-result.fail { background: var(--warn-soft); }
.qr-score { font-family: var(--font-display); font-size: 30px; font-weight: 500; line-height: 1; }
.quiz-result.pass .qr-score { color: var(--ok); }
.quiz-result.fail .qr-score { color: var(--warn); }

/* resources / policy / notes panels */
.res-list { display: flex; flex-direction: column; gap: 8px; }
.res-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); text-decoration: none; color: inherit; }
.res-row:hover { border-color: var(--line-2); background: var(--paper); }
.res-ic { width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); font-size: 15px; }
.res-nm { flex: 1; font-weight: 600; font-size: 14px; }
.policy { max-width: 70ch; }
.policy p { font-size: 15px; line-height: 1.6; }

/* admin forms / segmented control */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 0 0 6px; }
.swatch { display: inline-flex; align-items: center; gap: 10px; }
.swatch .chip-color { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line-2); flex: none; }
.seg { display: inline-flex; background: var(--paper-2); border-radius: 9px; padding: 3px; }
.seg button { font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2); background: none; border: none; padding: 6px 12px; border-radius: 7px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* toast notifications */
.toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 11px; max-width: 380px;
  padding: 13px 16px; border-radius: 11px; background: var(--ink); color: #fff;
  font-size: 14px; box-shadow: 0 12px 30px -8px rgba(26,35,48,.5);
  animation: toast-in .28s cubic-bezier(.2,.8,.2,1) both;
}
.toast.out { animation: toast-out .3s ease forwards; }
.toast-ic { width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--ok); color: #fff; }
.toast.error .toast-ic { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* modal (authoring idiom) */
.modal-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(26,35,48,.42); backdrop-filter: blur(2px); display: grid; place-items: center; padding: 24px; animation: rise .2s ease both; }
.modal { width: 100%; max-width: 520px; background: var(--surface); border-radius: 14px; box-shadow: 0 24px 60px -16px rgba(26,35,48,.45); overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 18px; }
.modal-x { background: none; border: none; font-size: 16px; color: var(--ink-3); cursor: pointer; padding: 4px 8px; border-radius: 7px; }
.modal-x:hover { background: var(--paper-2); color: var(--ink); }
.modal-body { padding: 22px; max-height: 60vh; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); background: var(--paper); }

/* accessibility issue list (reviewer) */
.issue-list { margin: 0 0 16px; padding-left: 18px; }
.issue-list li { font-size: 13.5px; color: var(--ink-2); margin-bottom: 6px; }

/* activity feed */
.feed { display: flex; flex-direction: column; }
.feed-row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.feed-row:last-child { border-bottom: none; }
.feed-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-top: 7px; flex: none; }
.feed-row .ft { font-size: 14px; }
.feed-row .fw { font-size: 12px; color: var(--ink-3); margin-top: 1px; }

/* course editor */
.ed-mod { padding: 16px 18px; margin-bottom: 14px; }
.ed-mod-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.ed-mod-h .mn { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; color: var(--ink-3); }
.ed-mod-h h3 { font-size: 15px; }
.ed-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 8px; background: var(--surface); }
.ed-kind { width: 34px; height: 30px; border-radius: 7px; flex: none; display: grid; place-items: center; background: var(--paper-2); color: var(--ink-2); font-size: 10.5px; font-weight: 700; letter-spacing: .03em; }
.ed-nm { flex: 1; min-width: 0; }
.ctrls { flex: none; }
.iconbtn {
  width: 30px; height: 30px; border-radius: 7px; flex: none; font: inherit; font-size: 13px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); cursor: pointer;
  display: grid; place-items: center; min-height: 0; padding: 0;
}
.iconbtn:hover { background: var(--paper-2); border-color: var(--ink-3); color: var(--ink); }
.iconbtn.danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

/* quiz builder */
.qb-q .seg button { font-size: 12px; padding: 5px 10px; }
.qb-opts { display: flex; flex-direction: column; gap: 8px; }
.qb-opt { display: flex; align-items: center; gap: 10px; }
.qb-opt input[type="text"] { flex: 1; }
.qb-mark { display: grid; place-items: center; width: 34px; height: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); flex: none; }
.qb-mark input { width: 17px; height: 17px; min-height: 0; margin: 0; accent-color: var(--ok); }

/* simple two-pane admin layout */
.admin-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: start; }
.role-card { padding: 18px 20px; margin-bottom: 14px; }
.role-card .rh { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.req-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.req-row .rn { flex: 1; font-size: 14px; font-weight: 500; }

@media (max-width: 980px) { .cols { grid-template-columns: 1fr; } .rail { position: static; } .stat-row { grid-template-columns: repeat(2,1fr); } .form-grid { grid-template-columns: 1fr; } .admin-cols { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .nav-toggle { display: grid; }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: 280px; z-index: 60;
    transform: translateX(-100%); transition: transform .22s cubic-bezier(.2,.8,.2,1);
    background: var(--paper); border-right: 1px solid var(--line);
  }
  body.nav-open .sidebar { transform: none; box-shadow: 0 12px 40px -8px rgba(26,35,48,.3); }
  body.nav-open .nav-backdrop { display: block; }
  .brand .wordmark span { display: none; }
  .searchbox { display: none; }
  .demo-switch .lbl { display: none; }
  .page-head { flex-direction: column; align-items: flex-start; }
}

/* ============================================================================
   Review refinements (P0/P1): inputs, validation, status icons, states,
   record signature, responsive tables, mobile drawer, toast controls.
   ============================================================================ */

/* C2 — styled form controls (Civic Editorial) */
.field input, .field select, input.input, select.select {
  font: inherit; width: 100%; min-height: 42px; padding: 9px 12px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.field select, select.select {
  -webkit-appearance: none; appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7585' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.field input:focus, .field select:focus, input.input:focus, select.select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.field input::placeholder { color: var(--ink-3); }

/* C3 — inline validation */
.field.err input, .field.err select, .field.err textarea { border-color: var(--danger); }
.field.err input:focus { box-shadow: 0 0 0 3px var(--danger-soft); }
.field .err-msg { display: none; margin-top: 6px; font-size: 12.5px; color: var(--danger); font-weight: 600; }
.field.err .err-msg { display: flex; align-items: center; gap: 5px; }

/* A2 — status icon inside chip (replaces the generic dot) */
.chip.ico::before { display: none; }
.chip svg { width: 13px; height: 13px; flex: none; }

/* V1 — record / ledger signature (monospace identifiers + completion stamp) */
.mono { font-family: var(--font-mono); font-size: .92em; letter-spacing: -.01em; }
.rec-id { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); letter-spacing: -.02em; }
.record {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1px solid var(--line); border-left: 3px solid var(--ok); border-radius: var(--radius-sm);
  background: var(--paper);
}
.record .stamp {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--ok-soft); color: var(--ok); font-size: 17px;
}
.record .r-id { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); }
.record .r-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* U1/V6 — skeleton shimmer */
.skel { position: relative; overflow: hidden; background: var(--paper-2); border-radius: var(--radius-sm); }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent); animation: shimmer 1.3s infinite; }
.skel-line { height: 12px; margin: 8px 0; }
.skel-card { height: 92px; margin-bottom: 14px; }
@keyframes shimmer { 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skel::after { animation: none; } }

/* U2 — empty state */
.empty { text-align: center; padding: 48px 24px; }
.empty .e-ic { width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 16px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); }
.empty h3 { font-size: 18px; margin-bottom: 6px; }
.empty p { color: var(--ink-3); font-size: 14px; max-width: 42ch; margin: 0 auto 18px; }

/* U1 — error state (replaces raw <pre>) */
.errstate { max-width: 480px; margin: 12vh auto; text-align: center; padding: 32px; }
.errstate .e-ic { width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 16px; display: grid; place-items: center; background: var(--danger-soft); color: var(--danger); font-size: 24px; font-weight: 700; }
.errstate h2 { font-size: 22px; margin-bottom: 8px; }
.errstate p { color: var(--ink-2); margin-bottom: 18px; }

/* A4 — responsive tables (cards containing a table scroll horizontally on small screens) */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card:has(table.table) { overflow-x: auto; }
table.table { min-width: 560px; }
.th-sort { font: inherit; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); background: none; border: none; padding: 0; cursor: pointer; }
.th-sort:hover { color: var(--ink); }
.th-arr { color: var(--brand); font-size: 10px; }
.table.compact td { padding: 9px 14px; }
.table.compact th { padding: 0 14px 8px; }

/* A1 — mobile nav: hamburger + backdrop (desktop hidden) */
.nav-toggle {
  display: none; width: 38px; height: 38px; flex: none; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface); place-items: center; color: var(--ink-2); padding: 0;
}
.nav-toggle:hover { background: var(--paper-2); }
.nav-backdrop { display: none; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 55; background: rgba(26,35,48,.38); }

/* U5 — toast close + pause-on-hover */
.toast { padding-right: 12px; }
.toast .toast-x { background: none; border: none; color: rgba(255,255,255,.7); cursor: pointer; font-size: 14px; padding: 2px 4px; margin-left: 4px; }
.toast .toast-x:hover { color: #fff; }
.toast:hover { animation-play-state: paused; }

/* §4 — notification bell + inbox */
.bell-wrap { position: relative; }
.iconbell { position: relative; width: 38px; height: 38px; flex: none; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); display: grid; place-items: center; color: var(--ink-2); cursor: pointer; padding: 0; }
.iconbell:hover { background: var(--paper-2); }
.iconbell svg { width: 19px; height: 19px; }
.bell-badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.notif-panel { position: absolute; top: calc(100% + 8px); right: 0; width: 360px; max-width: 86vw; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); z-index: 40; overflow: hidden; }
.notif-head { display: flex; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.notif-head b { font-family: var(--font-display); font-size: 16px; }
.notif { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.notif:last-child { border-bottom: none; }
.notif:hover { background: var(--paper); }
.notif.unread { background: var(--brand-soft); }
.notif-ic { width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center; }
.notif-ic svg { width: 15px; height: 15px; }
.notif-ic.info { background: var(--info-soft); color: var(--info); }
.notif-ic.warn { background: var(--warn-soft); color: var(--warn); }
.notif-ic.danger { background: var(--danger-soft); color: var(--danger); }
.notif-ic.ok { background: var(--ok-soft); color: var(--ok); }
.notif-empty { padding: 30px 20px; text-align: center; }
.menu-item { display: block; padding: 11px 16px; font-size: 14px; font-weight: 500; color: var(--ink); text-decoration: none; border-top: 1px solid var(--line); }
.menu-item:hover { background: var(--paper); }

/* G4 — assignment "why" line */
.why-line { font-size: 12.5px; color: var(--brand-strong); font-weight: 600; margin: 2px 0 0; }

/* G1 — competency panel */
.comp-list { display: flex; flex-direction: column; gap: 10px; }
.comp-row { display: flex; align-items: flex-start; gap: 11px; }
.comp-row > .chip { margin-top: 1px; }

/* §2 — completion certificate card */
.cert { overflow: hidden; }
.cert-top { background: linear-gradient(150deg, var(--brand-strong), var(--brand)); color: #fff; padding: 22px 24px; display: flex; align-items: center; gap: 12px; }
.cert-top .seal { width: 44px; height: 44px; border-radius: 10px; background: rgba(255,255,255,.16); box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); display: grid; place-items: center; flex: none; }
.cert-top .ce { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
.cert-top .ct { font-family: var(--font-display); font-size: 19px; line-height: 1.15; margin-top: 2px; }
.cert-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; padding: 18px 24px; }
.cert-grid .k { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.cert-grid .v { margin-top: 3px; font-size: 14px; font-weight: 600; }
.cert-foot { display: flex; align-items: center; gap: 10px; padding: 0 24px 20px; flex-wrap: wrap; }

/* §3 — author "returned for revision" panel */
.returned { border: 1px solid var(--line); border-left: 4px solid var(--danger); border-radius: var(--radius); background: var(--surface); padding: 16px 18px; margin-bottom: 16px; }
.returned .rh { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.returned .rh b { font-family: var(--font-display); font-size: 16px; }
.returned ul { margin: 0; padding-left: 18px; font-size: 14px; color: var(--ink-2); }
.returned li { margin-bottom: 5px; }

/* §5 — launch-your-city setup path */
.setup-step { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.setup-step.cur { border-color: var(--brand); background: var(--brand-soft); }
.setup-step.locked { opacity: .55; }
.setup-step .sb { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 13px; font-family: var(--font-mono); }
.setup-step .sb.done { background: var(--ok-soft); color: var(--ok); }
.setup-step .sb.cur { background: var(--brand); color: #fff; }
.setup-step .sb.todo { background: var(--paper-2); color: var(--ink-3); }
.setup-step .sb svg { width: 15px; height: 15px; }

