/* Reclaimt design system, v0 (shared by every Reclaimt product UI).
   One file: tokens, then primitives (type, buttons, fields, pills, cards, tables, tabs, notices).
   No external fonts or assets: the service's CSP allows only same-origin styles, and a system stack keeps pages instant.
   Products add their own layout file (app.css, upload.css) and never redefine these primitives. */

:root {
  --paper: #f3f4f6;        /* page background */
  --surface: #ffffff;      /* cards, tables, bars */
  --surface-2: #f8f9fb;    /* table header, inset blocks */
  --ink: #15202b;          /* text */
  --ink-2: #5b6776;        /* secondary text */
  --ink-3: #8a94a3;        /* placeholders, hints */
  --line: #e4e8ee;         /* hairlines */
  --line-2: #cfd6df;       /* field borders */
  --accent: #2445c5;       /* Reclaimt blue: actions, links, focus */
  --accent-ink: #ffffff;
  --accent-hover: #1d3aa8;
  --accent-soft: #e9edfb;
  --ok: #1a7f4b;   --ok-soft: #e4f5ea;
  --warn: #a35a05; --warn-soft: #fcefdc;
  --bad: #b42318;  --bad-soft: #fcebe9;
  --shadow: 0 1px 2px rgba(21, 32, 43, .06), 0 1px 1px rgba(21, 32, 43, .04);
  --radius: 10px; --radius-sm: 7px; --radius-pill: 999px;
  --font: "Inter", "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --control: 38px;
  /* legacy aliases used by product styles */
  --bg: var(--paper); --fg: var(--ink); --muted: var(--ink-2); --card: var(--surface);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1216; --surface: #171b21; --surface-2: #1d2229; --ink: #e9ecf0; --ink-2: #a3acb8; --ink-3: #6f7987;
    --line: #262c35; --line-2: #343c47; --accent: #7c9cff; --accent-ink: #0f1216; --accent-hover: #93adff; --accent-soft: #1d2740;
    --ok: #6fd39a; --ok-soft: #14301f; --warn: #f0bd6a; --warn-soft: #3a2a10; --bad: #ff8d84; --bad-soft: #3d1a17;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; }
h1 { font-size: 24px; } h2 { font-size: 16px; } h3 { font-size: 15px; }
p { margin: 0 0 8px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
code { font: 12.5px/1.5 var(--mono); word-break: break-all; }
pre.mail { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; font: 13px/1.55 var(--mono); margin: 8px 0; }

/* keyboard focus is always visible */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- buttons */
button, .btn { font: inherit; font-weight: 500; min-height: var(--control); padding: 0 14px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  border-radius: var(--radius-sm); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; transition: background .12s, border-color .12s, color .12s; }
button:hover { background: var(--surface-2); border-color: var(--ink-3); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.link { border: none; background: none; color: var(--accent); padding: 0 6px; min-height: 30px; font-weight: 500; }
button.link:hover { background: var(--accent-soft); }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ---- fields */
input, select, textarea { font: inherit; min-height: var(--control); padding: 6px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); max-width: 100%; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input[type=checkbox] { min-height: 18px; min-width: 18px; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
input[type=file] { padding: 7px 10px; }
input[type=search] { min-width: 240px; }
textarea { line-height: 1.5; padding: 8px 10px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
label.inline { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-weight: 400; font-size: 14px; }

/* ---- status pills: a dot carries the status, so colour is never the only signal */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; line-height: 1; padding: 5px 9px 5px 8px; border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.bad { color: var(--bad); } .warn { color: var(--warn); } .ok { color: var(--ok); }

/* ---- notices */
.err, .note, .success { margin: 0 0 14px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid; font-size: 14px; }
.err { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.note { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.success { color: var(--ok); background: var(--ok-soft); border-color: transparent; }

/* ---- cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 14px; box-shadow: var(--shadow); }
.card > h2, .card > h3 { margin-bottom: 6px; }
.card > h2 + .muted, .card > h3 + .muted { margin-bottom: 12px; }
.card .card { box-shadow: none; background: var(--surface-2); margin-top: 12px; }
details.card > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
details.card > summary::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--ink-2); border-bottom: 1.5px solid var(--ink-2); transform: rotate(-45deg); transition: transform .12s; }
details.card[open] > summary::before { transform: rotate(45deg); }
details.card[open] > summary { margin-bottom: 12px; }
details > summary::-webkit-details-marker { display: none; }

/* ---- rows (simple flex forms) */
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.row:last-child { margin-bottom: 0; }
.row > label { align-items: stretch; }

/* ---- tables */
.table-wrap { overflow-x: auto; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin: 0 0 14px; }
.card .table-wrap { box-shadow: none; }
.table-wrap table { min-width: 520px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--ink-2); background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td .badge + .badge { margin-left: 6px; }
td .muted { font-size: 13px; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
td > button.link { margin: -6px 0; }

/* ---- segmented filter tabs */
.tabs { display: flex; gap: 2px; flex-wrap: wrap; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); width: max-content; max-width: 100%; margin: 0 0 14px; }
.tabs button { border: none; background: transparent; color: var(--ink-2); min-height: 32px; padding: 0 12px; font-weight: 500; }
.tabs button:hover { background: var(--surface); color: var(--ink); }
.tabs button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.tabs .count { font-variant-numeric: tabular-nums; color: var(--ink-3); font-weight: 400; }
.tabs button[aria-pressed="true"] .count { color: var(--ink-2); }

/* ---- lists */
ul, ol { margin: 6px 0; padding-left: 20px; }
li { margin: 3px 0; }

/* ---- reduced motion */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
