/* The staff dashboard. One file, system fonts, no outside resource. The colours follow the
   product's palette (web/src/styles/design-tokens.css); dark follows the browser's setting. */
:root {
  --bg: #f1f0ed;
  --surface: #f8f7f5;
  --line: rgb(74 82 79 / .18);
  --text: #101516;
  --muted: #4d5758;
  --accent: #006f9c;
  --accent-text: #ffffff;
  --accent-soft: #d4e0e5;
  --good: #2c6f5b;
  --good-soft: #d9ebe4;
  --bad: #a83c3c;
  --bad-soft: #f3dcdc;
  --warn-soft: #f1e6c8;
  --mine: #d4e0e5;
  --theirs: #ffffff;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181a;
    --surface: #1d2326;
    --line: rgb(220 228 226 / .16);
    --text: #eef1f0;
    --muted: #a9b4b3;
    --accent: #5db9dd;
    --accent-text: #06202b;
    --accent-soft: #1f3a46;
    --good: #7fcfb5;
    --good-soft: #1c3a31;
    --bad: #f0a3a3;
    --bad-soft: #472626;
    --warn-soft: #40381f;
    --mine: #1f3a46;
    --theirs: #262d30;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 22px; line-height: 1.25; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 8px; }
h3 { font-size: 14px; margin: 0 0 6px; }
p { margin: 0 0 10px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px; z-index: 5; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The top bar and the navigation */
.top { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 16px; padding: 0 16px; min-height: 52px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 650; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand span { font-weight: 400; color: var(--muted); }
#nav { display: flex; align-items: center; gap: 4px; flex: 1; }
#nav a { padding: 8px 12px; border-radius: 8px; color: var(--text); text-decoration: none; }
#nav a:hover { background: var(--accent-soft); }
#nav a[aria-current="page"] { background: var(--accent-soft); font-weight: 600; }
.who { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.menu { display: none; margin-left: auto; }
main { max-width: 1400px; margin: 0 auto; padding: 20px 16px 60px; }
main:focus { outline: none; }

/* Buttons and fields */
button, select, input, textarea { font: inherit; color: inherit; }
button, .button { min-height: 38px; padding: 6px 14px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button.quiet, .button.quiet { background: transparent; color: var(--accent); border-color: var(--line); }
button.danger { background: var(--bad); border-color: var(--bad); color: var(--bg); }
button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button:disabled { opacity: .55; cursor: default; }
select, input[type="search"], input[type="text"], textarea { min-height: 38px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); max-width: 100%; }
textarea { width: 100%; min-height: 64px; resize: vertical; }
label { font-size: 13px; color: var(--muted); display: inline-flex; flex-direction: column; gap: 3px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.row.end { justify-content: flex-end; }
.row.center { align-items: center; }
.bar { margin: 14px 0; }
.head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 14px; }

/* Cards, tiles and tables */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 0 0 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 14px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tile .label { color: var(--muted); font-size: 13px; }
.tile .value { font-size: 24px; font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile .sub { color: var(--muted); font-size: 13px; }
.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover { background: var(--accent-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.nowrap { white-space: nowrap; }
td.clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.clip.open { white-space: pre-wrap; overflow-wrap: anywhere; }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12.5px; background: var(--accent-soft); white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.wait { background: var(--warn-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
details > summary { cursor: pointer; padding: 6px 0; }
pre { margin: 6px 0; padding: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; font: 12.5px/1.45 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.notice { padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); margin-bottom: 14px; }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.pager { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
ul.plainlist { list-style: none; margin: 0; padding: 0; }
ul.plainlist li { padding: 7px 0; border-bottom: 1px solid var(--line); }
ul.plainlist li:last-child { border-bottom: 0; }

/* The two small charts on the overview */
.chart svg { width: 100%; height: 72px; display: block; }
.chart .bars rect { fill: var(--accent); }
.chart.bad .bars rect { fill: var(--bad); }
.chart .base { stroke: var(--line); stroke-width: 1; }
.chart .ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }

/* The conversation */
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: min(680px, 88%); align-self: flex-start; }
.msg.mine { align-self: flex-end; }
.msg .meta { font-size: 12.5px; color: var(--muted); margin: 0 4px 2px; }
.msg.mine .meta { text-align: right; }
.bubble { background: var(--theirs); border: 1px solid var(--line); border-radius: 14px; padding: 9px 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine .bubble { background: var(--mine); }
.msg.at .bubble { outline: 2px solid var(--accent); }
.msg.first .bubble { border-style: dashed; color: var(--muted); }
.msg.system { align-self: center; max-width: 100%; }
.bubble img, .bubble video { display: block; max-width: 100%; max-height: 360px; border-radius: 8px; margin-top: 6px; }
.bubble audio { display: block; max-width: 100%; margin-top: 6px; }
.made { margin: 4px 4px 0; font-size: 14px; }
.made > summary { color: var(--accent); }
.made .inside { border-left: 3px solid var(--accent-soft); padding: 4px 0 4px 12px; }
.call { border: 1px solid var(--line); border-radius: 10px; padding: 2px 10px; margin: 6px 0; background: var(--surface); }
.review { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }

/* Chips: filters and choices that show at a glance what is on */
.filters { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.chiprow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chiplabel { font-size: 13px; color: var(--muted); min-width: 64px; }
.chip { min-height: 32px; padding: 3px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 13.5px; }
.chip.small { min-height: 28px; padding: 2px 10px; font-size: 12.5px; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.toolpick > summary { font-size: 13px; color: var(--muted); }
.toolpick .chiprow { max-height: 160px; overflow-y: auto; padding: 4px 0; }
.counter { font-size: 13.5px; color: var(--muted); margin: 4px 0 10px; }
.empty { color: var(--muted); padding: 18px; border: 1px dashed var(--line); border-radius: 12px; background: var(--surface); }

/* The review desk */
.answers { display: flex; flex-direction: column; gap: 10px; }
.answer { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--warn-soft); border-radius: 12px; padding: 10px 14px; }
.answer.reviewed { border-left-color: var(--good-soft); }
.answer.current { outline: 2px solid var(--accent); outline-offset: 1px; }
.answer:focus { outline: 2px solid var(--accent); }
.answer .meta { gap: 6px 10px; font-size: 13px; }
.answer .meta .open { margin-left: auto; min-height: 32px; }
.answer .qa { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0 4px; }
.answer .qa p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pill.tool { background: var(--bg); border: 1px solid var(--line); font-family: var(--mono); font-size: 12px; }
.review .more { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.review .more[hidden] { display: none; }
.review input.note { width: 100%; }
button.mark-good[aria-pressed="true"] { background: var(--good); border-color: var(--good); color: var(--bg); }
button.mark-bad[aria-pressed="true"] { background: var(--bad); border-color: var(--bad); color: var(--bg); }
.mark { margin-top: 6px; }
.under { margin: 4px 4px 0; }
.under .review { border-top: 0; margin-top: 6px; padding-top: 0; }

/* How an answer was made: the tool calls as a timeline */
ol.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
ol.timeline li { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; background: var(--surface); }
ol.timeline li.failed { border-color: var(--bad); background: var(--bad-soft); }
ol.timeline .at { color: var(--muted); min-width: 64px; }
.track { height: 6px; background: var(--bg); border-radius: 3px; margin: 6px 0 2px; overflow: hidden; }
.track .span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
li.failed .track .span { background: var(--bad); }
.call { border: 0; padding: 0; margin: 0; background: transparent; }

/* Sortable headings */
th button.sort { background: none; border: 0; color: inherit; font: inherit; font-weight: 600; padding: 0; min-height: 0; cursor: pointer; }
th button.sort:hover { color: var(--accent); }
th[aria-sort] button.sort { color: var(--text); }

/* Overview: what needs a look */
.card.look { border-left: 4px solid var(--accent); }
.card.look li a { font-weight: 550; }

/* Abilities */
.grow { flex: 1 1 260px; }
.grow input { width: 100%; }
.legend { margin: 0 0 12px; color: var(--muted); line-height: 2; }
.abilities { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; align-items: start; }
details.ability { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
details.ability[open] { grid-column: 1 / -1; }
details.ability.off { background: var(--bg); }
details.ability.off .title { color: var(--muted); }
details.ability > summary { list-style: none; cursor: pointer; }
details.ability > summary::-webkit-details-marker { display: none; }
details.ability > summary p { margin: 4px 0; }
details.ability .state { color: var(--muted); }
details.ability ul.can { margin: 4px 0 8px; padding-left: 18px; }
details.ability .inside { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
details.ability .inside h3 { margin-top: 12px; }
.tool-row p { margin: 4px 0; }
ul.fields li { padding: 3px 0; border: 0; }
.pill.eff-read { background: var(--accent-soft); border-color: transparent; }
.pill.eff-write { background: var(--warn-soft); border-color: transparent; }
.pill.eff-ask { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.tool.match { outline: 2px solid var(--accent); }
.prose { font-size: 14px; }
.prose p { margin: 0 0 8px; }
.prose ul, .prose ol { margin: 0 0 10px; padding-left: 20px; }
.prose li { margin: 2px 0; }
.prose h3 { margin: 12px 0 4px; }
details.rules > summary { color: var(--accent); }

code.secret { font-family: var(--mono); font-size: 13px; padding: 6px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow-wrap: anywhere; }
.who .access { color: var(--accent); margin: 0 6px; }

/* The sign-in page and the plain pages the server writes */
.plain, .signin { max-width: 420px; margin: 12vh auto; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }

dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); padding: 20px; max-width: min(440px, 92vw); }
dialog::backdrop { background: rgb(0 0 0 / .45); }

@media (max-width: 760px) {
  .top { flex-wrap: wrap; padding: 0 12px; }
  .menu { display: inline-flex; }
  #nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding: 4px 0 12px; }
  #nav.open { display: flex; }
  #nav a { padding: 11px 12px; }
  .who { margin: 8px 12px 0; white-space: normal; }
  main { padding: 16px 16px 48px; }
  .msg { max-width: 94%; }
  dl.facts { grid-template-columns: 1fr; gap: 0; }
  dl.facts dd { margin-bottom: 8px; }
  .two { grid-template-columns: 1fr; }
  .answer .qa { grid-template-columns: 1fr; }
  .answer .meta .open { margin-left: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  tbody tr.link, #nav a, button { transition: background-color .12s; }
}
