:root {
  --bg: #f6f6f8;
  --surface: #ffffff;
  --surface-2: #f0f0f4;
  --text: #1a1a22;
  --muted: #6b6b78;
  --border: #e2e2e8;
  --accent: #0f766e;
  --accent-text: #ffffff;
  --accent-soft: #e6f4f2;
  --ok: #15803d;
  --warn: #b45309;
  --bad: #b91c1c;
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111116;
    --surface: #1a1a21;
    --surface-2: #23232c;
    --text: #ececf1;
    --muted: #9a9aa8;
    --border: #2e2e39;
    --accent: #2dd4bf;
    --accent-text: #0b1514;
    --accent-soft: #15302d;
    --ok: #4ade80;
    --warn: #fbbf24;
    --bad: #f87171;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .25rem; }
p { margin: 0 0 .75rem; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }
pre { background: var(--surface-2); padding: .75rem; border-radius: 8px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
[hidden] { display: none !important; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-size: .9rem; font-weight: 500; text-decoration: none;
  padding: .45rem .85rem; border-radius: 8px; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
button:hover, .button:hover { background: var(--surface-2); }
button.primary, .button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.primary:hover, .button.primary:hover { filter: brightness(1.05); }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--surface-2); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: .45rem .65rem; max-width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; }
.stack > * + * { margin-top: .75rem; }
.row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.spread { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* Layout: a sidebar on wide screens, a top bar with a menu button on narrow ones. */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border); padding: 1rem .75rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--text); text-decoration: none; padding: 0 .5rem; }
.brand svg { color: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .4rem .6rem; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .92rem;
}
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .group { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .75rem .6rem .25rem; }
.nav .indent { padding-left: 1.4rem; }
.nav .indent2 { padding-left: 2.2rem; }
.side .me { margin-top: auto; padding: .5rem; border-top: 1px solid var(--border); font-size: .85rem; }
.topbar { display: none; }
main.content { padding: 1.5rem max(16px, 2rem) 3rem; max-width: 1100px; width: 100%; }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: .6rem 16px;
  }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; height: 100%; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
  main.content { padding: 1rem 16px 3rem; }
}

.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .5rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.page-head { margin-bottom: 1.25rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .75rem; }
a.tile { color: inherit; text-decoration: none; display: block; }
a.tile:hover { border-color: var(--accent); }

.badge {
  display: inline-block; min-width: 1.4rem; padding: 0 .45rem; border-radius: 999px; text-align: center;
  font-size: .75rem; font-weight: 600; line-height: 1.4rem; background: var(--accent); color: var(--accent-text);
}
.pill {
  display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border-radius: 999px;
  font-size: .78rem; font-weight: 500; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.pill.ok { color: var(--ok); }
.pill.warn { color: var(--warn); }
.pill.bad { color: var(--bad); }
.pill.run { color: var(--accent); }
.dot { width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; display: inline-block; }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tabs button {
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: .55rem .75rem; color: var(--muted); white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters select { min-width: 0; flex: 1 1 140px; max-width: 220px; }

.convo { display: grid; gap: .6rem; }
.convo .meta { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; font-size: .82rem; color: var(--muted); }
.convo .title { font-weight: 600; overflow-wrap: anywhere; }
.convo .excerpt { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; border-left: 3px solid var(--border); padding-left: .7rem; margin: 0; }
.convo .why { font-size: .85rem; }
.convo .reply { background: var(--surface-2); border-radius: 8px; padding: .65rem .75rem; font-size: .9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.convo .actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.score { font-variant-numeric: tabular-nums; font-weight: 700; }
.score.high { color: var(--ok); }
.score.mid { color: var(--warn); }

.platform { font-weight: 600; color: var(--text); }

.runs { width: 100%; border-collapse: collapse; font-size: .88rem; }
.runs th, .runs td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.runs th { color: var(--muted); font-weight: 500; font-size: .8rem; }
.table-wrap { overflow-x: auto; }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }

#toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 1rem); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: .55rem 1rem; border-radius: 8px; font-size: .9rem; transition: all .2s; z-index: 50;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.signin { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.signin .card { width: 100%; max-width: 360px; padding: 2rem 1.5rem; }
.button.google { width: 100%; }
.narrow { max-width: 480px; margin: 3rem auto; }

/* Platform badges: the brand's color behind its mark, so the source reads at a glance. */
:root { --icon-cut: #ffffff; }
.pf {
  display: inline-flex; align-items: center; gap: .35rem; padding: .12rem .5rem .12rem .3rem; border-radius: 999px;
  font-size: .78rem; font-weight: 600; color: #fff; line-height: 1.3;
}
.pf svg { width: 15px; height: 15px; flex: none; }
.pf-reddit { background: #ff4500; --icon-cut: #ff4500; }
.pf-x { background: #000; }
.pf-threads { background: #101010; }
.pf-linkedin { background: #0a66c2; }
.pf-web { background: var(--muted); }
@media (prefers-color-scheme: dark) {
  .pf-x, .pf-threads { background: #f2f2f2; color: #000; }
}
.pf-mini { display: inline-flex; width: 13px; height: 13px; margin-right: .1rem; }
.pf-mini svg { width: 13px; height: 13px; }
.pf-mini.pf-reddit { color: #ff4500; --icon-cut: var(--surface-2); }
.pf-mini.pf-linkedin { color: #0a66c2; }

.pill.kind { text-transform: capitalize; color: var(--accent); background: var(--accent-soft); }
.convo .message { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .95rem; }
.why-ask { border-top: 1px dashed var(--border); padding-top: .6rem; display: grid; gap: .45rem; }
button.chip { font-size: .82rem; padding: .25rem .65rem; border-radius: 999px; }

details.kb { border: 1px solid var(--border); border-radius: 10px; padding: .55rem .75rem; }
details.kb summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; align-items: baseline; }
details.kb summary::-webkit-details-marker { display: none; }
details.kb[open] summary { margin-bottom: .5rem; }
.kb-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9rem; color: var(--text); margin-bottom: .5rem; }
