/* ============================================================================
   Lintel — admin design system
   Grounded in the subject: a lintel is the stone that bears weight above a door.
   The product is about thresholds — teaching HELD until standing is attested,
   then OPENED. The visual language is architectural and record-keeping, not
   decorative: hairline rules, an inscription serif, monospace for provenance.
   ========================================================================== */

:root {
  /* Paper & ink — cooler and more architectural than cream; deliberately not
     the warm-cream/terracotta AI-default. */
  --paper:      #F5F4F1;   /* stone paper */
  --paper-2:    #FBFAF9;   /* raised surface */
  --ink:        #161A2E;   /* doorway shadow — primary */
  --ink-soft:   #3A3E52;
  --muted:      #6B6E7C;
  --rule:       #E2E0DA;   /* hairline */
  --rule-2:     #D0CDC5;

  /* State — the threshold. Brass = opened/attested. Slate = held (never red). */
  --brass:      #8A6D3B;
  --brass-soft: #F0E9DB;
  --held:       #5B5570;
  --held-soft:  #ECEAF0;
  --ok:         #3B6152;
  --ok-soft:    #E4EDE7;

  --serif: "Iowan Old Style", "Palatino Linotype", "Palatino", "Georgia", serif;
  --sans:  ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono:  ui-monospace, "SF Mono", "JetBrains Mono", "Menlo", "Consolas", monospace;

  --rail: 248px;
  --maxc: 960px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- App shell: quiet left rail + content ------------------------------- */
.app { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }

.rail {
  background: var(--ink);
  color: #C9CAD4;
  padding: 22px 0 30px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.rail .brand {
  display: flex; align-items: baseline; gap: 9px;
  padding: 0 22px 4px;
  font-family: var(--serif);
  font-size: 21px; font-weight: 600; letter-spacing: .01em; color: #fff;
}
.rail .brand .mark { /* the lintel: a stone bearing weight — a capped vertical */
  display: inline-block; width: 15px; height: 15px; position: relative;
}
.rail .brand .mark::before { content: ""; position: absolute; left: 2px; top: 0; width: 11px; height: 3px; background: var(--brass); }
.rail .brand .mark::after  { content: ""; position: absolute; left: 4px; top: 3px; width: 3px; height: 12px; background: #6E7189; }
.rail .inst {
  padding: 2px 22px 20px; font-size: 12.5px; color: #888CA0;
  border-bottom: 1px solid #262B44; margin-bottom: 12px;
}

.rail nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.rail .group { padding: 16px 10px 6px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; color: #6E7189; }
.rail nav a {
  color: #C9CAD4; padding: 7px 10px; border-radius: 4px; font-size: 14px;
  display: flex; align-items: center; gap: 9px;
}
.rail nav a:hover { background: #222741; color: #fff; text-decoration: none; }
.rail nav a.active { background: #262B47; color: #fff; }
.rail nav a.active::before { content: ""; width: 3px; height: 15px; background: var(--brass); border-radius: 2px; margin-left: -10px; margin-right: 7px; }
.rail .foot { margin-top: auto; padding: 16px 22px 0; font-size: 12px; color: #6E7189; }

/* ---- Content ------------------------------------------------------------ */
.content { min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px; height: 62px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky; top: 0; z-index: 5;
}
.topbar .crumbs { font-size: 13px; color: var(--muted); font-family: var(--mono); }
.topbar .crumbs a { color: var(--muted); }
.topbar .crumbs .sep { margin: 0 7px; opacity: .5; }
.topbar .who { font-size: 13px; color: var(--muted); }
.topbar .who form { display: inline; }
.topbar .who button { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; margin-left: 14px; }
.topbar .who button:hover { color: var(--ink); text-decoration: underline; }

.main { max-width: var(--maxc); padding: 34px 40px 80px; }

/* Page header */
.page-head { margin-bottom: 26px; }
.page-head .eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--brass); margin-bottom: 8px; }
.page-head h1 { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 6px; }
.page-head .lede { color: var(--muted); font-size: 15px; max-width: 60ch; margin: 0; }

/* Sections */
.section { margin-top: 38px; }
.section > h2 { font-family: var(--serif); font-size: 19px; font-weight: 600; margin: 0 0 4px; }
.section > .hint { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; }

/* ---- Tables: the register look ------------------------------------------ */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table thead th {
  text-align: left; font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); font-weight: 500;
  padding: 0 16px 10px 0; border-bottom: 1px solid var(--rule-2);
}
.table tbody td { padding: 12px 16px 12px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.table tbody tr:hover td { background: var(--paper-2); }
.table .mono { font-family: var(--mono); font-size: 13px; }
.table .empty td { color: var(--muted); padding: 22px 0; border-bottom: 0; }

/* ---- Threshold badges: open / held / neutral ---------------------------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; letter-spacing: .04em; padding: 3px 9px; border-radius: 3px; text-transform: uppercase; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.badge.open  { background: var(--brass-soft); color: #6B5325; }
.badge.open::before  { background: var(--brass); }
.badge.held  { background: var(--held-soft); color: #4A4560; }
.badge.held::before  { background: var(--held); }
.badge.ok    { background: var(--ok-soft); color: #2C4A3D; }
.badge.ok::before    { background: var(--ok); }
.badge.flat  { background: #EDEBE6; color: var(--muted); }
.badge.flat::before  { background: var(--muted); }

/* ---- Cards / list rows (used sparingly, rules not shadows) -------------- */
.panel { border: 1px solid var(--rule); border-radius: 5px; background: var(--paper-2); padding: 20px 22px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { border: 1px solid var(--rule); border-radius: 5px; background: var(--paper-2); padding: 15px 18px; margin-bottom: 10px; }
.rows li .title { font-size: 15px; }
.rows li .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* The threshold rule — a thin bar marking open vs held content. The signature. */
.thr { border-left: 3px solid var(--rule-2); padding-left: 16px; }
.thr.is-open { border-left-color: var(--brass); }
.thr.is-held { border-left-color: var(--held); }

/* ---- Forms -------------------------------------------------------------- */
.field { margin: 0 0 15px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; }
.field .note { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input:not([type]), select, textarea {
  width: 100%; padding: 9px 11px; font-family: var(--sans); font-size: 14.5px;
  border: 1px solid var(--rule-2); border-radius: 4px; background: var(--paper-2); color: var(--ink);
}
input:focus, select:focus, textarea:focus { border-color: var(--brass); background: #fff; outline: none; }
.form-narrow { max-width: 440px; }

.btn { display: inline-flex; align-items: center; gap: 7px; font-family: var(--sans); font-size: 14px; font-weight: 500; padding: 9px 16px; border-radius: 4px; border: 1px solid var(--ink); background: var(--ink); color: #fff; cursor: pointer; }
.btn:hover { background: #23283F; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule-2); }
.btn.ghost:hover { background: var(--paper-2); border-color: var(--muted); }
.btn.small { padding: 6px 11px; font-size: 13px; }

/* ---- Notices ------------------------------------------------------------ */
.notice { padding: 12px 15px; border-radius: 4px; font-size: 14px; margin-bottom: 18px; border-left: 3px solid; }
.notice.err  { background: var(--held-soft); border-color: var(--held); color: #443F58; }
.notice.info { background: var(--brass-soft); border-color: var(--brass); color: #5F4A20; }

/* ---- Inline stat strip (dashboard) -------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.stats .stat { background: var(--paper-2); padding: 18px 20px; }
.stats .stat .n { font-family: var(--serif); font-size: 27px; font-weight: 600; line-height: 1; }
.stats .stat .l { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }

.quiet { color: var(--muted); }
.mono { font-family: var(--mono); }

/* ---- Responsive: rail collapses to a top bar --------------------------- */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: column; }
  .rail nav { display: grid; grid-template-columns: repeat(2,1fr); }
  .main { padding: 24px 20px 60px; }
  .topbar { padding: 0 20px; }
}

/* Quiz authoring */
.q-block{padding:14px 16px}
.q-prompt{font-size:15px;line-height:1.5;margin-bottom:8px}
.q-num{color:var(--muted,#777);font-weight:600;margin-right:2px}
.q-answers{list-style:none;margin:8px 0 0;padding:0;font-size:14px}
.q-answers li{padding:2px 0;color:#555}
.q-answers li.correct{color:#25473A;font-weight:600}
.q-optrow{display:flex;gap:10px;align-items:center;margin:6px 0}
.q-optrow input[type=text]{flex:1}
.q-optck{white-space:nowrap;font-size:13px;color:#555;display:flex;align-items:center;gap:5px}
.q-opt{display:flex;align-items:center;gap:8px;font-size:14px}
.q-match{display:flex;gap:10px;align-items:center;margin:6px 0}
.q-match input{flex:1}

/* Card + back-link (used by quiz authoring and the invite page) */
.card{background:var(--paper-2);border:1px solid var(--rule);border-radius:4px;padding:16px 18px;margin:10px 0}
.back{color:var(--muted);font-size:13px}
.back:hover{color:var(--ink)}
