/* Griot portal — dark-only for beta (settled 2026-08-13). Tokens are the working palette from
   spec/griot-brand.md, synced from the griot-marketing identity guide + site. Keep structured
   so a light theme can be added later without rework. */

@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/space-grotesk-var.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono-var.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --bg: #050C0A;
  --panel: #0D1D17;
  --surface: #102420;
  --text: #ECF4EE;
  --muted: #90A89B;
  --muted-dim: #5F7268;
  --line: rgba(125, 165, 145, 0.14);
  --green: #23D97C;
  --green-soft: #7EF0B3;
  --green-deep: #13A861;
  --on-green: #04140D;
  --gold: #E7B24C;
  --gold-soft: #F4D18A;
  --cyan: #22CFE6;
  --cyan-soft: #8FE9F5;
  --red: #E5484D;
  --red-soft: #F2A0A3;

  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius-card: 16px;
  --radius-button: 11px;
  --radius-chip: 6px;

  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; font-weight: 600; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; font-weight: 600; margin: 1.6rem 0 0.6rem; }
a { color: var(--green-soft); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; }

/* ---- Shell ---- */
.topbar {
  display: flex; align-items: center; gap: 2rem;
  padding: 0.8rem 1.6rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar .logo img { height: 26px; display: block; }
.topbar nav { display: flex; gap: 1.2rem; flex: 1; }
.topbar nav a {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-chip);
}
.topbar nav a:hover { color: var(--text); text-decoration: none; background: var(--surface); }
.topbar nav a.active { color: var(--green); }
.topbar .who { display: flex; align-items: center; gap: 0.8rem; font-size: 0.82rem; color: var(--muted); }

main { max-width: 1200px; margin: 0 auto; padding: 2rem 1.6rem 4rem; }

/* ---- Cards / panels ---- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.2rem;
}
.card h2:first-child { margin-top: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.2rem; }

.stat { display: flex; flex-direction: column; gap: 0.15rem; }
.stat .n { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; }
.stat .l { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

/* ---- Buttons (mono — site convention) ---- */
.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.82rem; font-weight: 600;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-button);
  border: 1px solid transparent;
  background: var(--green);
  color: var(--on-green);
  cursor: pointer;
  box-shadow: 0 0 14px rgba(35, 217, 124, 0.18);
}
.btn:hover { background: var(--green-soft); text-decoration: none; }
.btn:active { background: var(--green-deep); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--muted); background: var(--surface); }
.btn.danger { background: transparent; color: var(--red-soft); border-color: rgba(229, 72, 77, 0.4); box-shadow: none; }
.btn.danger:hover { background: rgba(229, 72, 77, 0.12); }
.btn.small { font-size: 0.72rem; padding: 0.25rem 0.6rem; }

/* ---- Forms ---- */
label { display: block; font-size: 0.78rem; color: var(--muted); margin: 0.8rem 0 0.25rem; text-transform: uppercase; letter-spacing: 0.06em; }
input[type="text"], input[type="password"], input[type="email"], input[type="number"], select, textarea {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.5rem 0.7rem;
  font-family: var(--font-body);
  font-size: 0.92rem;
}
textarea.mono, input.mono { font-family: var(--font-mono); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(35, 217, 124, 0.4); border-color: var(--green-deep); }
.filters { display: flex; gap: 0.8rem; align-items: end; flex-wrap: wrap; margin-bottom: 1.2rem; }
.filters > div { min-width: 160px; }
.filters label { margin-top: 0; }
.inline-form { display: inline; }

/* ---- Tables ---- */
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.55rem 0.9rem 0.55rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em;
  background: transparent;
}
tr:hover td { background: rgba(16, 36, 32, 0.5); }
td.upc, td.id { font-family: var(--font-mono); font-size: 0.82rem; white-space: nowrap; }
.empty { color: var(--muted); padding: 2rem 0; text-align: center; font-size: 0.92rem; }

/* ---- Status chips (mapping from spec/griot-brand.md) ---- */
.chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem; font-weight: 600;
  padding: 0.12rem 0.55rem;
  border-radius: var(--radius-chip);
  border: 1px solid transparent;
  white-space: nowrap;
}
.chip.imported { color: var(--muted); border-color: var(--line); }
.chip.preprocessing, .chip.queued, .chip.processing { color: var(--gold); border-color: rgba(231, 178, 76, 0.35); }
.chip.sent { color: var(--cyan); border-color: rgba(34, 207, 230, 0.35); }
.chip.delivered { color: var(--on-green); background: var(--green); }
.chip.error { color: var(--red-soft); border-color: rgba(229, 72, 77, 0.45); }
.chip.takendown { color: var(--muted-dim); border-color: var(--line); text-decoration: line-through; }
.chip.none { color: var(--muted-dim); border-color: transparent; }

/* ---- Timeline (release detail) ---- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 9.5rem 11rem 1fr;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}
.timeline .t { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.timeline .k { font-family: var(--font-mono); font-size: 0.75rem; color: var(--green-soft); }
.timeline .d { color: var(--text); overflow-wrap: anywhere; }
.timeline .d .detail { color: var(--muted); font-family: var(--font-mono); font-size: 0.75rem; }

/* ---- Flash messages ---- */
.flash { border-radius: var(--radius-chip); padding: 0.7rem 1rem; margin-bottom: 1.2rem; font-size: 0.9rem; }
.flash.ok { background: rgba(35, 217, 124, 0.12); border: 1px solid rgba(35, 217, 124, 0.4); color: var(--green-soft); }
.flash.err { background: rgba(229, 72, 77, 0.1); border: 1px solid rgba(229, 72, 77, 0.4); color: var(--red-soft); }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 380px; padding: 2.4rem 2.2rem; text-align: center; }
.login-card img { height: 72px; margin-bottom: 1.4rem; }
.login-card form { text-align: left; margin-top: 1rem; }
.login-card .btn { width: 100%; margin-top: 1.4rem; }
.login-tag { color: var(--muted); font-size: 0.85rem; margin: 0; }

/* ---- Pager ---- */
.pager { display: flex; gap: 0.6rem; align-items: center; margin-top: 1rem; font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }

/* ---- Detail header ---- */
.detail-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.detail-head .upc { font-family: var(--font-mono); color: var(--muted); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1.2rem; margin: 0; font-size: 0.88rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
dl.kv dd.mono { font-family: var(--font-mono); font-size: 0.82rem; }

/* Profile menu (topbar) — a <details> dropdown; layout JS closes it on outside click/Escape. */
.profile-menu { position: relative; }
.profile-menu > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.45rem;
  color: var(--muted); font-size: 0.82rem; padding: 0.3rem 0.55rem; border-radius: 8px;
  border: 1px solid transparent; user-select: none;
}
.profile-menu > summary::-webkit-details-marker { display: none; }
.profile-menu > summary:hover, .profile-menu[open] > summary {
  color: var(--text); background: var(--surface); border-color: var(--line);
}
.pm-caret { font-size: 0.6rem; color: var(--muted-dim); }
.pm-chip {
  font-size: 0.7rem; color: var(--gold); background: rgba(231, 178, 76, 0.12);
  border: 1px solid rgba(231, 178, 76, 0.35); padding: 0.1rem 0.45rem; border-radius: 999px;
  max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pm-panel {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 250px; z-index: 50;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.35rem; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.pm-heading {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted-dim); padding: 0.4rem 0.6rem 0.2rem;
}
.pm-form { margin: 0; }
.pm-item {
  display: flex; justify-content: space-between; align-items: center; gap: 0.8rem;
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  color: var(--text); font-size: 0.85rem; font-family: inherit;
  padding: 0.45rem 0.6rem; border-radius: 7px;
}
.pm-item:hover { background: var(--surface); text-decoration: none; color: var(--text); }
.pm-item.active, .pm-item.active .pm-role { color: var(--green); }
.pm-role { font-size: 0.72rem; color: var(--muted-dim); white-space: nowrap; }
.pm-divider { height: 1px; background: var(--line); margin: 0.35rem 0.2rem; }
.pm-sub > summary { list-style: none; }
.pm-sub > summary::-webkit-details-marker { display: none; }
.pm-sub[open] > summary .pm-caret { display: inline-block; transform: rotate(90deg); }
.pm-subpanel { padding: 0.15rem 0 0.15rem 0.55rem; }
.pm-viewas-row {
  display: flex; align-items: center; gap: 0.4rem; padding: 0.28rem 0.6rem; font-size: 0.85rem;
}
.pm-viewas-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-empty { color: var(--muted-dim); font-size: 0.82rem; padding: 0.3rem 0.6rem; }
