/* ==========================================================================
   GTME Agent — design system (light, two-accent)
   Single source of truth. Every value is a token; never hardcode hex in HTML.
   Two-accent rule (BINDING):
     blue   = the USER's actions (buttons, links, active nav)
     terra  = the AGENT's voice ONLY (✺ glyph, agent cards/chips, suggestions)
     green  = "verified" / healthy / positive only — never a generic accent
   ========================================================================== */

:root {
  /* surfaces */
  --page: #f6f5f2;
  --panel: #ffffff;
  --hairline: #e5e4df;
  --hairline-inner: #efeeea;
  --head-bg: #fafaf8;
  --code-bg: #f3f2ee;

  /* text */
  --text: #1f2530;
  --muted: #68707f;
  --faint: #9aa0ab;
  --ghost: #c5c3bc;
  --input-border: #d6d5cf;

  /* blue — user actions */
  --blue: #4054d6;
  --blue-pill-bg: #eef1fb;
  --blue-pill-border: #c6cdf2;

  /* terracotta — agent voice */
  --terra: #c96342;
  --terra-bg: #fbf3ef;
  --terra-border: #ecd3c7;
  --terra-light-border: #e3c4b5;

  /* severities */
  --crit: #cb3b4e;
  --crit-bg: #fdf6f7;
  --crit-border: #f0ccd2;
  --warn: #c98a1c;
  --warn-text: #a3761f;
  --warn-bg: #fcf7ec;
  --warn-border: #ecdcb8;
  --good: #1f8a5a;
  --good-bg: #f4faf6;
  --good-border: #b3dfc0;

  /* chat */
  --bubble: #2c3240;
  --winner-bg: #fdf9e8;

  /* type */
  --sans: 'Instrument Sans', -apple-system, system-ui, sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* shadow */
  --shadow-card: 0 1px 2px rgba(60, 55, 40, 0.04);
  --shadow-form: 0 1px 3px rgba(60, 55, 40, 0.05);
  --shadow-paper: 0 14px 40px rgba(60, 55, 40, 0.1);

  --maxw: 1100px;
  --paperw: 680px;
}

/* --- base ----------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 400 14px/1.55 var(--sans);
}
body.has-askbar { padding-bottom: 96px; }
body.has-composer { padding-bottom: 120px; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.verified { color: var(--good); font-weight: 600; }
.unverified { color: var(--warn-text); font-weight: 600; }
.stale { color: var(--warn-text); font-weight: 600; }
.wow-up { color: var(--good); font-weight: 600; }
.wow-down { color: var(--crit); font-weight: 600; }
.wow-flat { color: var(--muted); }
.glyph { color: var(--terra); }
hr.rule { border: 0; border-top: 1px solid var(--hairline); margin: 24px 0; }

/* --- layout --------------------------------------------------------------- */
.page { max-width: var(--maxw); margin: 0 auto; padding: 32px 24px 0; }
.cols { display: grid; grid-template-columns: 64fr 36fr; gap: 28px; margin-top: 28px; }
.cols-6040 { display: grid; grid-template-columns: 60fr 40fr; gap: 28px; margin-top: 24px; }
@media (max-width: 820px) {
  .cols, .cols-6040 { grid-template-columns: 1fr; }
}

/* --- top bar -------------------------------------------------------------- */
.topbar { background: var(--panel); border-bottom: 1px solid var(--hairline); }
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 13px 24px;
  display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand-glyph {
  width: 24px; height: 24px; border-radius: 7px; background: var(--terra);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff; flex-shrink: 0;
}
.brand-name { font-size: 14px; font-weight: 600; color: var(--text); }
.nav { display: flex; gap: 6px; margin-left: 16px; font-size: 13px; }
.nav a { color: var(--muted); padding: 5px 12px; border-radius: 7px; }
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a.active {
  background: var(--blue-pill-bg); color: var(--blue); font-weight: 600;
}
.nav a.disabled { color: var(--ghost); pointer-events: none; }
.sync-status { margin-left: auto; font-size: 12px; color: var(--faint); }

/* --- ask bar -------------------------------------------------------------- */
.askbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--panel); border-top: 1px solid var(--hairline);
}
.askbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 11px 24px;
  display: flex; align-items: center; gap: 12px;
}
.askbar-inner .glyph { font-size: 16px; }
.askbar input {
  flex: 1; border: none; background: transparent; padding: 4px 0;
  font: 400 13.5px var(--sans); color: var(--text);
}
.askbar input::placeholder { color: var(--faint); }
.askbar input:focus { outline: none; }
.kbd {
  font-size: 11.5px; color: var(--ghost); border: 1px solid var(--hairline);
  border-radius: 5px; padding: 1px 6px; font-family: var(--mono);
}

/* --- breadcrumb ----------------------------------------------------------- */
.breadcrumb { font-size: 13px; color: var(--faint); margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb .leaf { color: var(--text); font-weight: 600; }

/* --- typography ----------------------------------------------------------- */
.verdict {
  font-family: var(--serif); font-weight: 400; font-size: 31px;
  letter-spacing: -0.01em; line-height: 1.25;
  display: flex; align-items: baseline; gap: 12px;
}
.verdict .glyph { font-size: 24px; }
.verdict-sub { font-size: 13.5px; color: var(--muted); margin-top: 8px; }
.section-label {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--faint); font-weight: 600; margin: 0 0 10px;
}
h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 6px; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 10px; }

/* --- cards ---------------------------------------------------------------- */
.card {
  background: var(--panel); border: 1px solid var(--hairline);
  border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow-card);
  margin-bottom: 14px;
}
.card-title { font-size: 14.5px; font-weight: 600; }
/* severity spines: 3px left spine + matching tinted full border */
.card--crit { border: 1px solid var(--crit-border); border-left: 3px solid var(--crit); }
.card--warn { border: 1px solid var(--warn-border); border-left: 3px solid var(--warn); }
.card--info { border: 1px solid var(--hairline); border-left: 3px solid var(--faint); }
.card--good { border: 1px solid var(--good-border); border-left: 3px solid var(--good); }
/* the agent's card — terracotta */
.card--agent { background: var(--terra-bg); border: 1px solid var(--terra-border); }
.card--agent .card-title { color: var(--terra); }

/* --- buttons -------------------------------------------------------------- */
.btn, .btn--ghost, .btn--agent {
  display: inline-block; border-radius: 8px; padding: 7px 15px;
  font: 600 13px var(--sans); white-space: nowrap; cursor: pointer;
  border: 1px solid transparent; text-align: center;
}
.btn:hover, .btn--ghost:hover, .btn--agent:hover { text-decoration: none; }
.btn { background: var(--blue); color: #fff; }              /* primary user action */
.btn:hover { filter: brightness(1.06); }
.btn--ghost { background: var(--panel); color: var(--text); border-color: var(--input-border); font-weight: 500; }
.btn--ghost:hover { border-color: var(--faint); }
.btn--agent { background: var(--panel); color: var(--terra); border-color: var(--terra-light-border); }
.btn--agent:hover { background: var(--terra-bg); }
.btn[disabled], .btn--ghost[disabled] {
  opacity: 0.5; cursor: not-allowed; filter: none;
  background: var(--panel); color: var(--faint); border-color: var(--hairline);
}
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* --- chips / pills -------------------------------------------------------- */
.chip {
  display: inline-block; border-radius: 999px; padding: 4px 12px;
  font-size: 12.5px; border: 1px solid var(--hairline); color: var(--muted);
  background: var(--panel); cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--faint); text-decoration: none; }
.chip--agent { border-color: var(--terra-light-border); color: var(--terra); background: var(--terra-bg); }
.chip--blue { border-color: var(--blue-pill-border); color: var(--blue); background: var(--blue-pill-bg); }
.chip--active { background: var(--blue); color: #fff; border-color: var(--blue); }
.chip--stale {
  background: var(--warn-bg); border: 1px solid var(--warn-border);
  color: var(--warn-text); border-radius: 999px; padding: 1px 10px;
  font-size: 11.5px; font-weight: 600; cursor: default; display: inline-block;
}
.pill {
  display: inline-block; font-size: 11px; border-radius: 999px; padding: 2px 9px;
  border: 1px solid var(--hairline); color: var(--muted);
}
.pill--good { background: var(--good-bg); border-color: var(--good-border); color: var(--good); }
.pill--warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.pill--crit { background: var(--crit-bg); border-color: var(--crit-border); color: var(--crit); }

/* --- queue rows (standup) ------------------------------------------------- */
.queue-row {
  background: var(--panel); border-radius: 10px; padding: 16px 18px;
  margin-top: 8px; box-shadow: var(--shadow-card);
  display: flex; align-items: baseline; gap: 14px;
}
.queue-row .rank { font-size: 13px; color: var(--faint); font-weight: 600; flex-shrink: 0; }
.queue-row .qbody { flex: 1; }
.queue-row .qtitle { font-size: 15px; font-weight: 600; line-height: 1.4; }
.queue-row .why { font-size: 12.5px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.queue-row .qactions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.queue-more { font-size: 12.5px; color: var(--faint); padding: 14px 4px 0; }
.queue-more a, .link { color: var(--blue); font-weight: 600; cursor: pointer; }
.covered { padding: 26px 0; color: var(--muted); }
.act-tiny {
  background: none; border: none; color: var(--muted); font-size: 12px;
  cursor: pointer; padding: 5px 6px; border-radius: 6px;
}
.act-tiny:hover { color: var(--text); background: var(--head-bg); }

/* --- scoreboard ----------------------------------------------------------- */
.scoreboard {
  background: var(--panel); border: 1px solid var(--hairline); border-radius: 12px;
  padding: 20px 22px; box-shadow: var(--shadow-card); align-self: start;
}
.score-row { margin-top: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--hairline-inner); }
.score-row:last-child { border-bottom: none; padding-bottom: 0; }
.score-name { font-size: 14.5px; font-weight: 600; color: var(--text); }
.score-nums { font-size: 14px; margin-top: 4px; }
.score-nums b { font-weight: 600; }
.score-attr { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.score-links { font-size: 12.5px; margin-top: 6px; display: flex; gap: 12px; flex-wrap: wrap; }

/* --- data tables ---------------------------------------------------------- */
.dtable {
  width: 100%; background: var(--panel); border: 1px solid var(--hairline);
  border-radius: 10px; border-collapse: separate; border-spacing: 0; overflow: hidden;
  font-size: 13.5px;
}
.dtable th {
  text-align: left; background: var(--head-bg); color: var(--faint);
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600;
  padding: 10px 14px; border-bottom: 1px solid var(--hairline);
}
.dtable td { padding: 11px 14px; border-bottom: 1px solid var(--hairline-inner); vertical-align: top; }
.dtable tr:last-child td { border-bottom: none; }
.dtable td.num, .dtable th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dtable tr.killed td { opacity: 0.55; }
.dtable tr.winner td { background: var(--winner-bg); }
.dtable a { color: var(--blue); font-weight: 500; }

/* funnel strip */
.funnel {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px;
  background: var(--panel); border: 1px solid var(--hairline); border-radius: 10px;
  padding: 16px 18px; box-shadow: var(--shadow-card);
}
.funnel .step { font-size: 14px; }
.funnel .step b { font-weight: 600; }
.funnel .step .lbl { color: var(--muted); font-size: 12px; }
.funnel .arrow { color: var(--ghost); }

/* dash-bullets ("— text") */
.dash-bullet { display: flex; gap: 10px; margin: 8px 0; line-height: 1.5; font-size: 13.5px; }
.dash-bullet .dash { color: var(--ghost); }

/* --- forms ---------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field label, .field .lbl { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--input-border); border-radius: 8px;
  padding: 10px 13px; font: 400 14px var(--sans); color: var(--text); background: var(--panel);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue); }
.field--valid input { border-color: var(--good); }
.field--invalid input { border-color: var(--crit); }
.field-note { font-size: 12px; margin-top: 6px; color: var(--muted); }
.field-note--valid { color: var(--good); font-weight: 600; }
.field-note--invalid { color: var(--crit); }
.error {
  background: var(--crit-bg); border: 1px solid var(--crit-border); color: var(--crit);
  border-radius: 8px; padding: 10px 13px; margin-bottom: 14px; font-size: 13px;
}

/* --- chat ----------------------------------------------------------------- */
.chat-log { max-width: 840px; margin: 0 auto; }
.bubble-user {
  background: var(--bubble); color: #fff; border-radius: 14px 14px 3px 14px;
  padding: 11px 15px; margin: 14px 0 14px auto; max-width: 76%; width: fit-content;
  font-size: 14px; line-height: 1.5;
}
.agent-answer { font-size: 14.5px; line-height: 1.6; margin: 14px 0; }
.agent-answer .glyph { font-size: 15px; margin-right: 6px; }
.provenance {
  background: var(--code-bg); border: 1px solid var(--hairline); border-radius: 8px;
  padding: 12px 14px; font: 400 11.5px/1.7 var(--mono); color: var(--muted);
  white-space: pre-wrap; overflow-x: auto; margin: 10px 0;
}
.provenance .comment { color: var(--faint); }
.caveat { font-size: 12.5px; color: var(--muted); margin: 8px 0; line-height: 1.5; }
.hyp-row { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; font-size: 13.5px; }
.hyp-holds { color: var(--good); font-weight: 600; }
.hyp-rejected { color: var(--faint); }
.composer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--panel); border-top: 1px solid var(--hairline); padding: 12px 24px;
}
.composer-inner { max-width: 840px; margin: 0 auto; }
.composer-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.composer-row { display: flex; gap: 10px; align-items: center; }
.composer-row .glyph { font-size: 16px; }
.composer-row input {
  flex: 1; border: 1px solid var(--input-border); border-radius: 8px;
  padding: 10px 13px; font: 400 14px var(--sans);
}
.composer-row input:focus { outline: none; border-color: var(--blue); }
.send-btn {
  background: var(--blue); color: #fff; border: none; border-radius: 8px;
  padding: 9px 14px; font-size: 14px; cursor: pointer;
}

/* --- Monday paper --------------------------------------------------------- */
.paper {
  max-width: var(--paperw); margin: 28px auto; background: var(--panel);
  border: 1px solid var(--hairline); border-radius: 12px; padding: 46px 52px;
  box-shadow: var(--shadow-paper);
}
@media (max-width: 720px) { .paper { padding: 30px 24px; } }
.paper-banner {
  max-width: var(--paperw); margin: 16px auto -8px; background: var(--good-bg);
  border: 1px solid var(--good-border); color: var(--good); border-radius: 10px;
  padding: 10px 16px; font-size: 13px; text-align: center; font-weight: 600;
}
.paper-headline {
  font-family: var(--serif); font-weight: 400; font-size: 22px; line-height: 1.3;
  letter-spacing: -0.01em; margin: 4px 0 14px;
}
.paper-meta { font-size: 12px; color: var(--faint); }
/* segmented toggle (operator/client) */
.seg { display: inline-flex; border: 1px solid var(--input-border); border-radius: 8px; overflow: hidden; }
.seg a { padding: 6px 14px; font-size: 12.5px; color: var(--muted); background: var(--panel); }
.seg a:hover { text-decoration: none; }
.seg a.active { background: var(--blue); color: #fff; font-weight: 600; }
/* decision gate */
.gate { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.gate-agreed {
  background: var(--good-bg); border: 1px solid var(--good-border); color: var(--good);
  border-radius: 8px; padding: 7px 14px; font-size: 13px; font-weight: 600; display: inline-block;
}

/* --- styleguide helpers --------------------------------------------------- */
.sg-section { margin: 36px 0; }
.sg-swatches { display: flex; gap: 12px; flex-wrap: wrap; }
.sg-swatch { width: 92px; }
.sg-chip { height: 44px; border-radius: 8px; border: 1px solid var(--hairline); }
.sg-label { font-size: 11px; color: var(--muted); margin-top: 4px; font-family: var(--mono); }
