/* Agent Toolkit shared styles. Same tokens as the Lead Engine dashboard: quiet neutral chrome on a 4px grid,
   sentence case, weights 400/500/600, color only where it means something. */
:root {
  --bg: #f5f5f3; --panel: #ffffff; --ink: #1d2327; --muted: #5f6b73; --line: rgba(29, 35, 39, .1); --soft: #f0f0ed;
  --hot: #b4410f; --hot-bg: #fbeae0; --warm: #94600a; --warm-bg: #f8efd9; --cold: #3f6283; --cold-bg: #e6edf4;
  --accent: #1f5f5b; --accent-bg: #e1efed; --good: #2c6e3f; --good-bg: #e3f1e6;
  --shadow: 0 1px 2px rgba(20, 24, 28, .05);
  --nav-w: 216px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141618; --panel: #1b1e21; --ink: #e8eaeb; --muted: #9aa5ad; --line: rgba(232, 234, 235, .09); --soft: #23272a;
    --hot: #f0956a; --hot-bg: #33231b; --warm: #e2bc62; --warm-bg: #312a17; --cold: #93b6d8; --cold-bg: #1d2832;
    --accent: #6cc4bb; --accent-bg: #16302e; --good: #7fcf95; --good-bg: #17301e;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
h2 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }
h3 { font-size: 13px; font-weight: 500; color: var(--muted); margin: 20px 0 8px; }
p { margin: 0 0 12px; }

/* ---- shell */
.tk-nav { position: fixed; inset: 0 auto 0 0; width: var(--nav-w); background: var(--panel); border-right: 1px solid var(--line);
  padding: 20px 12px; overflow-y: auto; z-index: 10; display: flex; flex-direction: column; }
.tk-nav .logo { display: flex; gap: 8px; align-items: center; padding: 0 8px 16px; font-weight: 600; font-size: 15px;
  color: var(--ink); text-decoration: none; }
.tk-nav .logo svg { flex: none; }
.tk-nav .grp { font-size: 12px; color: var(--muted); padding: 12px 8px 4px; }
.tk-nav a.item { display: block; padding: 6px 8px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.tk-nav a.item:hover { background: var(--soft); }
.tk-nav a.item[aria-current="page"] { background: var(--accent-bg); color: var(--accent); font-weight: 500; }
.tk-nav .who { margin-top: auto; padding: 16px 8px 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.tk-nav .tk-menu { display: none; }
.wrap { margin-left: var(--nav-w); padding: 24px 32px 48px; max-width: calc(var(--nav-w) + 1240px); }
.wrap.wide { max-width: none; }
header.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
header.top p { margin: 4px 0 0; color: var(--muted); max-width: 70ch; }
footer.tk-foot { color: var(--muted); font-size: 12px; margin-top: 32px; line-height: 1.6; max-width: 90ch; }

/* ---- pieces */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cols.side { grid-template-columns: minmax(0, 1fr) 400px; }
.cols > * + .card { margin-top: 0; }
.stack > * + * { margin-top: 16px; }
.sticky { position: sticky; top: 16px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > span { font-size: 13px; color: var(--muted); }
.field small { font-size: 12px; color: var(--muted); }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=tel], input[type=search], select, textarea {
  border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 0 8px; height: 36px; width: 100%; min-width: 0; }
textarea { height: auto; min-height: 88px; padding: 8px; resize: vertical; line-height: 1.5; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; }
.check { display: flex; gap: 8px; align-items: flex-start; } .check input { margin-top: 2px; flex: none; }
.btn { height: 36px; border-radius: 8px; border: 1px solid var(--accent); color: var(--accent); background: var(--accent-bg);
  padding: 0 12px; cursor: pointer; font-weight: 500; transition: background-color .15s ease; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: var(--panel); }
.btn.solid { background: var(--accent); color: var(--panel); } .btn.solid:hover { opacity: .9; background: var(--accent); }
.btn.quiet { border-color: var(--line); background: var(--panel); color: var(--ink); } .btn.quiet:hover { background: var(--soft); }
.btn.small { height: 28px; padding: 0 8px; font-size: 13px; }
.btn.danger { border-color: var(--line); background: var(--panel); color: var(--hot); }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bar .grow { flex: 1 1 200px; }
:is(a, button, input, select, textarea, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.big { font-size: 28px; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.2; }
.pill { display: inline-block; font-size: 12px; border-radius: 6px; padding: 0 8px; line-height: 20px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill.accent { background: var(--accent-bg); color: var(--accent); } .pill.hot { background: var(--hot-bg); color: var(--hot); }
.pill.warm { background: var(--warm-bg); color: var(--warm); } .pill.good { background: var(--good-bg); color: var(--good); }
.pill.cold { background: var(--cold-bg); color: var(--cold); }
.note { background: var(--soft); border-radius: 12px; padding: 12px; font-size: 13px; color: var(--muted); }
.note strong { color: var(--ink); font-weight: 500; }
.note.warn { background: var(--warm-bg); color: var(--ink); }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 500; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t .r, table.t th.r { text-align: right; font-variant-numeric: tabular-nums; }
.lines { list-style: none; margin: 0; padding: 0; }
.lines li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.lines li:last-child { border-bottom: 0; }
.lines li.total { font-weight: 600; border-top: 1px solid var(--ink); border-bottom: 0; margin-top: 4px; padding-top: 10px; font-size: 16px; }
.lines li.sub { font-weight: 500; }
.lines li span:first-child { color: var(--muted); } .lines li.total span:first-child, .lines li.sub span:first-child { color: var(--ink); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 12px; }
.kpi { background: var(--soft); border-radius: 12px; padding: 12px; }
.kpi .v { font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; } .kpi .k { font-size: 12px; color: var(--muted); }
.kpi.good .v { color: var(--good); } .kpi.bad .v { color: var(--hot); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button { height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--soft); padding: 0 12px; cursor: pointer; font-weight: 500; }
.tabs button[aria-pressed="true"] { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
a.tile { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-decoration: none;
  color: var(--ink); box-shadow: var(--shadow); transition: border-color .15s ease; }
a.tile:hover { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
a.tile b { display: block; font-weight: 600; margin-bottom: 4px; } a.tile span { color: var(--muted); font-size: 13px; }
.print-only { display: none; }
.print-head { border-bottom: 2px solid #1f5f5b; padding-bottom: 8px; margin-bottom: 16px; }
.print-head .who { font-size: 18px; font-weight: 600; } .print-head .brk { font-size: 15px; font-weight: 600; }

@media (max-width: 960px) {
  .tk-nav { inset: 0 0 auto 0; width: auto; height: 52px; padding: 0 12px; flex-direction: row; align-items: center; overflow: visible;
    border-right: 0; border-bottom: 1px solid var(--line); }
  .tk-nav .logo { padding: 0; flex: 1; }
  .tk-nav .tk-menu { display: inline-flex; }
  .tk-nav .tk-links { display: none; position: absolute; top: 52px; left: 0; right: 0; background: var(--panel); border-bottom: 1px solid var(--line);
    padding: 8px 12px 16px; max-height: calc(100vh - 52px); overflow-y: auto; }
  .tk-nav.open .tk-links { display: block; }
  .tk-nav .who { display: none; }
  .wrap { margin-left: 0; padding: 68px 12px 40px; }
  .cols, .cols.side { grid-template-columns: minmax(0, 1fr); }
  .sticky { position: static; }
}
@media print {
  :root { --bg: #fff; --panel: #fff; --ink: #000; --muted: #444; --line: #ccc; --soft: #f3f3f3; --accent: #1f5f5b; --accent-bg: #eee; --shadow: none; }
  .tk-nav, .no-print, footer.tk-foot { display: none !important; }
  .wrap { margin: 0; padding: 0; max-width: none; }
  .print-only { display: block; }
  .card { box-shadow: none; break-inside: avoid; }
  .sticky { position: static; }
  body { font-size: 12px; }
}
