/* Shared styles for the Classroom (/classroom/) and Staff Console (/staff/).
   Black, gold and white to match the main BEACON app. */

@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(/fonts/plus-jakarta-sans-latin.woff2) format('woff2');
}

:root {
  --gold: #D4AF37;
  --gold-light: #F3D063;
  --gold-deep: #B38728;
  --black: #000;
  --ink: #09090b;
  --panel: #111113;
  --panel-2: #18181b;
  --line: rgba(212, 175, 55, .28);
  --line-soft: rgba(255, 255, 255, .08);
  --text: #fff;
  --muted: rgba(255, 255, 255, .64);
  --ok: #86efac;
  --warn: #fcd34d;
  --bad: #fca5a5;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: radial-gradient(1200px 500px at 85% -10%, rgba(212, 175, 55, .12), transparent 60%), var(--black);
  color: var(--text);
  font: 15px/1.55 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
a { color: var(--gold-light); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px clamp(12px, 3vw, 28px);
  background: rgba(0, 0, 0, .86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand img { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); }
.brand strong { display: block; font-size: 15px; letter-spacing: .01em; }
.brand span { display: block; font-size: 11px; color: var(--gold); text-transform: uppercase; letter-spacing: .12em; font-weight: 700; }
.topbar nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.who { font-size: 13px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-chip { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; padding: 3px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--gold-light); }

/* ---------- Buttons and inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: none;
  padding: 9px 14px; border-radius: 10px;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  transition: border-color .15s, background .15s, color .15s;
}
.btn:hover { border-color: var(--gold); color: var(--gold-light); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-gold { background: linear-gradient(135deg, var(--gold-light), var(--gold) 55%, var(--gold-deep)); color: #000; border: 0; }
.btn-gold:hover { color: #000; filter: brightness(1.06); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-danger:hover { border-color: var(--bad); color: var(--bad); }

label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 14px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 10px; padding: 9px 11px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 175, 55, .18); }
textarea { resize: vertical; min-height: 70px; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--gold); }

/* ---------- Layout ---------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: clamp(14px, 3vw, 28px); }
.card { background: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(14px, 2.4vw, 22px); }
.card + .card { margin-top: 16px; }
.card h2 { margin: 0 0 4px; font-size: 18px; }
.card h3 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); }
.lede { color: var(--muted); margin: 0 0 14px; font-size: 14px; }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.split { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; }
@media (max-width: 960px) { .split { grid-template-columns: 1fr; } .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .who { display: none; }
  .topbar { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .brand strong { font-size: 13px; }
  .brand span { font-size: 10px; }
  .topbar nav { width: 100%; justify-content: flex-start; gap: 6px; }
  .btn-sm { padding: 6px 10px; font-size: 12px; }
}

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 4px; margin-bottom: 16px; background: var(--ink); border: 1px solid var(--line); border-radius: 12px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; font: inherit; font-size: 13px; font-weight: 700; color: var(--muted); background: none; border: 0; padding: 9px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--gold); color: #000; }

/* ---------- Hero / auth ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 24px; align-items: center; padding: clamp(20px, 5vw, 56px) 0; }
.hero h1 { font-size: clamp(28px, 4.4vw, 46px); line-height: 1.08; margin: 0 0 14px; letter-spacing: -.02em; }
.hero h1 em { font-style: normal; background: linear-gradient(135deg, var(--gold-light), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 16px; max-width: 54ch; }
.promise { margin-top: 18px; padding: 14px 16px; border-left: 3px solid var(--gold); background: rgba(212, 175, 55, .07); border-radius: 0 10px 10px 0; font-style: italic; color: #fff; }
.feature-list { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; }
.feature-list li { display: flex; gap: 10px; align-items: flex-start; color: rgba(255, 255, 255, .85); }
.feature-list li::before { content: ''; flex: 0 0 8px; height: 8px; margin-top: 8px; border-radius: 50%; background: var(--gold); }
.auth-card form { display: grid; gap: 10px; }
.auth-switch { display: flex; gap: 6px; margin-bottom: 14px; }
.auth-msg { min-height: 20px; font-size: 13px; margin: 4px 0 0; color: var(--muted); }
.auth-msg.error { color: var(--bad); }
.auth-msg.ok { color: var(--ok); }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; min-height: 520px; max-height: calc(100vh - 170px); }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 4px 2px 12px; }
.msg { padding: 12px 14px; border-radius: 12px; max-width: 100%; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; max-width: 88%; background: var(--panel-2); border: 1px solid var(--line-soft); white-space: pre-wrap; }
.msg.assistant { background: var(--panel); border: 1px solid var(--line); }
.msg.assistant.thinking { color: var(--muted); }
.msg.assistant.thinking::after { content: '…'; animation: blink 1s steps(3) infinite; }
@keyframes blink { 50% { opacity: .3; } }
.msg-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.sources { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted); }
.sources ol { margin: 4px 0 0; padding-left: 18px; }
.starters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { font: inherit; font-size: 12px; font-weight: 600; padding: 6px 11px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--gold-light); cursor: pointer; }
.chip:hover { background: rgba(212, 175, 55, .12); }
.composer { display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.composer textarea { min-height: 46px; max-height: 180px; }
.empty-chat { margin: auto; text-align: center; color: var(--muted); max-width: 44ch; padding: 20px; }
.empty-chat strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }

/* ---------- Markdown inside answers ---------- */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { font-size: 15px; margin: 14px 0 6px; color: var(--gold-light); }
.md p { margin: 8px 0; }
.md ul, .md ol { margin: 8px 0; padding-left: 22px; }
.md li { margin: 3px 0; }
.md code { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }
.md pre { background: var(--panel-2); padding: 10px; border-radius: 8px; overflow-x: auto; }
.md table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line-soft); padding: 6px 8px; text-align: left; vertical-align: top; }
.md th { background: var(--panel-2); color: var(--gold-light); }
.md blockquote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--gold); color: var(--muted); }
.cite { font-size: 11px; font-weight: 800; color: var(--gold); vertical-align: super; }

/* ---------- Tables and lists ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 12px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.data th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--gold); background: var(--panel); padding: 9px 10px; position: sticky; top: 0; }
table.data td { padding: 9px 10px; border-top: 1px solid var(--line-soft); vertical-align: top; }
table.data tr.done td { opacity: .5; }
table.data td.num { text-align: right; }
.badge { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; }
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.badge.bad { color: var(--bad); }
.badge.info { color: var(--muted); }
.badge.gold { color: var(--gold-light); }
.findings { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.findings li { font-size: 12px; display: grid; grid-template-columns: auto 1fr; gap: 6px; align-items: start; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--panel); border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px 14px; }
.tile .label { font-size: 12px; color: var(--muted); }
.tile .value { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tile .value.pos { color: var(--ok); }
.tile .value.neg { color: var(--bad); }

/* ---------- Workbook ---------- */
.steps { display: grid; gap: 10px; }
details.step { border: 1px solid var(--line-soft); border-radius: 12px; background: var(--panel); }
details.step[open] { border-color: var(--line); }
details.step summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; padding: 12px 14px; font-weight: 700; }
details.step summary::-webkit-details-marker { display: none; }
.step-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--gold); color: #000; flex: 0 0 auto; }
.step-body { padding: 0 14px 14px; display: grid; gap: 10px; }
.progress { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 600; }
.line-items { display: grid; gap: 6px; }
.line-item { display: grid; grid-template-columns: minmax(0, 1fr) 130px 34px; gap: 6px; }
.check-item { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: start; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.check-item:first-child { border-top: 0; }
.check-item .office { font-size: 12px; color: var(--muted); }
.check-item input[type="text"] { margin-top: 6px; font-size: 13px; padding: 6px 9px; }
.save-state { font-size: 12px; color: var(--muted); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; background: var(--panel-2); border: 1px solid var(--gold); color: var(--text); padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); max-width: calc(100vw - 32px); }
.toast.error { border-color: var(--bad); }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .75); display: grid; place-items: center; padding: 16px; }
.modal { width: min(900px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--ink); border: 1px solid var(--gold); border-radius: var(--radius); padding: 20px; }

.notice { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(212, 175, 55, .06); font-size: 14px; }
.notice.warn { border-color: rgba(252, 211, 77, .5); }
.notice code { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--gold-light); }
