/* Lanyard by Reconvene (identity v0.1, B6 tile): navy holds, teal connects.
   Geist for words, Geist Mono for facts and labels. White canvas, paper for
   quiet panels, teal ink for buttons and links. Buttons 5px, cards 15px. */
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300..700&family=Geist+Mono:wght@400;500&display=swap');

/* ------------------------------------------------------------------ tokens */
:root {
  /* Reconvene palette */
  --chalk-50: #f7f6f4; --chalk-100: #eeece9; --chalk-200: #dcdad7; --chalk-300: #c3c2bf; --chalk-600: #6e6d6a;
  --navy-950: #142230; --navy-800: #384653; --ink-900: #0b2b39; --ink-600: #516976;
  --teal-100: #d7f5f1; --teal-600: #128a81; --teal-700: #006d66; --teal-800: #00544e;
  --peri-100: #e0edff; --peri-300: #9bbef2; --peri-400: #80a1d2; --peri-800: #2e4363;
  --amber-100: #ffeac5; --amber-300: #efb646; --amber-800: #593e00;
  --brick-100: #fbe4df; --brick-600: #b5422e; --brick-800: #7a2618;

  /* Lanyard palette */
  --lan-navy: #142230; --lan-teal: #128a81; --lan-teal-ink: #0d6f67; --lan-teal-lt: #3fc1b5; --lan-teal-tint: #e3f3f1;
  --lan-paper: #f7f6f4; --lan-line: #e4e1d8; --lan-muted: #5b6670; --lan-grey: #a9b4bf;
  --lan-sky: #9bbef2; --lan-amber: #efb646; --lan-ember: #d0741a; --lan-blue: #3f74c9;

  /* roles (names used across the app) */
  --bg: #ffffff;
  --panel: #ffffff;
  --sidebar: var(--chalk-50);
  --line: var(--lan-line);
  --line-strong: #d6d2c6;
  --text: var(--navy-950);
  --text-2: var(--navy-800);
  --muted: var(--lan-muted);
  --accent: var(--lan-teal-ink);      /* primary buttons and links */
  --accent-hover: #0a5b55;
  --accent-soft: var(--lan-teal-tint);
  --accent-ink: #ffffff;
  --brand: var(--teal-600);           /* links, highlights, focus */
  --ok: var(--teal-800); --ok-soft: var(--teal-100);
  --warn: var(--amber-800); --warn-soft: var(--amber-100);
  --bad: var(--brick-800); --bad-soft: var(--brick-100);
  --info: var(--peri-800); --info-soft: var(--peri-100);
  --soft: var(--chalk-50);
  --radius: 15px;
  --shadow: none;
  --shadow-lg: 0 0 0 1px rgba(20, 34, 48, .06), 0 14px 30px -18px rgba(20, 34, 48, .45);
  --mono: 'Geist Mono', ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { background: var(--bg); }
body { margin: 0; color: var(--text); font: 14px/1.5 Geist, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; font-feature-settings: "ss01"; }
a { color: var(--lan-teal-ink); }
.label { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
code { font: 12px var(--mono); background: var(--chalk-100); padding: 1px 5px; border-radius: 5px; }
h1, h2, h3 { letter-spacing: -.02em; font-weight: 600; }
:focus-visible { outline: 2px solid var(--lan-teal); outline-offset: 2px; }

/* ------------------------------------------------------------------ app shell */
body.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 12px; gap: 2px; overflow-y: auto; }
.sidebar .logo { display: grid; gap: 4px; padding: 6px 8px 16px; text-decoration: none; }
.sidebar .logo img { height: 26px; width: auto; display: block; }
.sidebar .logo small { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.sidebar .group { font-size: 12px; font-weight: 500; color: var(--muted); padding: 14px 10px 4px; }
.sidebar a.nav { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; }
.sidebar a.nav svg { width: 16px; height: 16px; flex: none; color: var(--text-2); }
.sidebar a.nav:hover { background: #efede8; }
.sidebar a.nav[aria-current="page"] { background: var(--lan-teal-tint); color: var(--lan-teal-ink); }
.sidebar a.nav[aria-current="page"] svg { color: var(--lan-teal-ink); }
.sidebar .foot { margin-top: auto; border-top: 1px solid var(--line); padding: 12px 8px 2px; display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.sidebar .foot .from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.2) blur(6px); font-size: 14px; }
.topbar .crumbs { color: var(--muted); }
.topbar .crumbs b { color: var(--text); font-weight: 500; }
.topbar .right { display: flex; align-items: center; gap: 10px; font-weight: 500; }
@media (max-width: 900px) {
  body.shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px 12px; }
  .sidebar .logo { padding: 4px 8px; }
  .sidebar .group, .sidebar .foot { display: none; }
  .topbar { position: static; }
}

/* ------------------------------------------------------------------ page layout */
main { max-width: 1240px; margin: 0 auto; padding: 28px 32px 72px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
main > *, .grid-2 > *, .cols > * { min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; margin: 0; letter-spacing: -.035em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
section { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; background: var(--panel); }
section h2 { font-size: 14px; margin: 0 0 4px; letter-spacing: -.01em; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } main { padding: 20px 16px 64px; } }

/* ------------------------------------------------------------------ controls */
button, .btn { font: inherit; font-size: 13px; font-weight: 500; border: 1px solid var(--line-strong); background: #fff; color: var(--text); padding: 6px 12px; border-radius: 5px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; line-height: 1.35; white-space: nowrap; transition: background .12s, border-color .12s; }
button:hover, .btn:hover { background: var(--chalk-50); border-color: var(--chalk-300); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover, .btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger, .btn.danger { color: var(--brick-600); }
button.ghost, .btn.ghost { border-color: transparent; background: transparent; }
button.ghost:hover, .btn.ghost:hover { background: var(--chalk-100); }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea { font: inherit; font-size: 13px; border: 1px solid var(--line-strong); border-radius: 5px; padding: 6px 10px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--lan-teal); outline-offset: -1px; border-color: var(--lan-teal); }
input[type=checkbox], input[type=radio] { accent-color: var(--teal-600); }
textarea { width: 100%; min-height: 160px; font-family: var(--mono); font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.small { font-size: 12px; color: var(--muted); }
.error { color: var(--brick-600); font-size: 13px; }

/* ------------------------------------------------------------------ badges */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--chalk-100); color: var(--text-2); text-decoration: none; white-space: nowrap; line-height: 1.6; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info, .pill.job { background: var(--info-soft); color: var(--info); }
.pill.live { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.pill.plain::before { display: none; }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; background: var(--chalk-50); }
tr:last-child td { border-bottom: 0; }
table tr:hover td { background: #fbfaf9; }
section > .table-wrap { margin: 0 -20px -18px; border-top: 1px solid var(--line); }
section > .table-wrap th:first-child, section > .table-wrap td:first-child { padding-left: 20px; }

/* ------------------------------------------------------------------ cards, tiles */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: grid; gap: 10px; align-content: start; background: #fff; }
.card h3 { margin: 0; font-size: 15px; }
.meta-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.kv { display: flex; gap: 20px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.kv strong { color: var(--text); font-size: 18px; display: block; font-weight: 600; letter-spacing: -.02em; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; background: #fff; }
.tile .label { font-size: 13px; color: var(--text); font-weight: 600; letter-spacing: -.01em; }
.tile .value { font-size: 30px; font-weight: 500; line-height: 1.15; margin-top: 6px; letter-spacing: -.04em; }
.tile .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.empty-state { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty-state strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ------------------------------------------------------------------ dialogs, toast */
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: min(640px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); color: var(--text); }
dialog::backdrop { background: rgba(20, 34, 48, .35); }
.stack { display: grid; gap: 12px; }
.stack label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: 420px; background: var(--navy-950); color: var(--chalk-50); padding: 11px 16px; border-radius: 10px; font-size: 13px; display: none; z-index: 50; box-shadow: var(--shadow-lg); }

/* older page header (outbox) */
header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: #fff; }
header h1 { font-size: 18px; margin: 0; }
.status { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; align-items: center; }

/* ------------------------------------------------------------------ editor page */
.editor-page { height: 100vh; display: flex; flex-direction: column; }
.editor-page header { padding: 10px 16px; }
#stripoEditorContainer { flex: 1; min-height: 0; }
.notice { padding: 24px; max-width: 640px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
