/* Tenthly brand palette (Brand Kit 2026-07): primary #0B4F8A, secondary
   #0F6E56, accent #7A2D00, dark #1A1A1A, light #F7F8FA.
   Semantics: blue = brand + primary actions; green = live/approved/success;
   rust = warnings, dry-run, open questions. */
:root {
  --paper: #f4f6f8; --surface: #fff; --surface-2: #edf0f4;
  --ink: #101c2c; --ink-soft: #3d4a5c; --ink-faint: #6b7788;
  --line: #e2e7ee; --accent: #0b4f8a; --accent-strong: #083a66; --accent-soft: #e7eef6;
  --gold: #a8842c; --gold-bright: #c9a24b;
  --success: #0f6e56; --success-soft: #e4f0eb;
  --amber: #7a2d00; --amber-soft: #f6eae2; --danger: #a3372e;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #10151b; --surface: #171e27; --surface-2: #1e2733;
    --ink: #ecf0f4; --ink-soft: #a4b0bc; --ink-faint: #6f7c89;
    --line: #28323f; --accent: #5b9dd6; --accent-strong: #82b6e2; --accent-soft: #142a41;
    --success: #4dbb97; --success-soft: #12291f;
    --amber: #d68a5c; --amber-soft: #2b1d12; --danger: #e08379;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); line-height: 1.55; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand .logo { width: 26px; height: 26px; color: var(--ink); flex: none; }
.brand .name { font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: .01em; }
.top-right { display: flex; align-items: center; gap: 14px; }
.modes { display: flex; gap: 7px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-faint); }
.who:empty { display: none; }
.help { font-size: 13px; color: var(--ink-faint); text-decoration: underline; }
.help:hover { color: var(--ink); }
.tk-fixed {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface-2); color: var(--ink);
}
.mode {
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 20px; background: var(--surface-2); color: var(--ink-faint);
}
.mode.live { color: var(--success); background: var(--success-soft); }
.mode.warn { color: var(--amber); background: var(--amber-soft); }
a.mode.connect { color: var(--accent); text-decoration: none; }
a.mode.connect:hover { background: var(--accent-soft); }

.wrap { max-width: 780px; margin: 0 auto; padding: 26px 20px 80px; }

/* Hero photo — matches the tenthly.ai site hero (Pexels 8112110, attorney at
   desk with Lady Justice). Previous option kept: '/assets/hero-columns.jpg'
   (neoclassical courthouse columns) — swap the url below to revert. */
.hero {
  background:
    linear-gradient(rgba(10, 20, 33, .84), rgba(10, 20, 33, .78)),
    url('/assets/hero-tenthly.jpg') center 32% / cover no-repeat;
  padding: 30px 20px 52px;
  border-bottom: 1px solid var(--line);
}
.hero-inner { max-width: 780px; margin: 0 auto; color: #fff; }
.hero .eyebrow {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .2em;
  color: var(--gold-bright); margin: 0 0 8px;
}
.hero h1 {
  font-family: var(--serif); font-size: 27px; font-weight: 600; letter-spacing: -.01em;
  line-height: 1.2; margin: 0 0 14px;
}
/* Numbered how-to, styled as a compact tool legend rather than marketing copy */
.hero .steps {
  margin: 0; padding: 0; list-style: none; counter-reset: step;
  display: flex; flex-direction: column; gap: 7px;
  font-size: 13.5px; line-height: 1.5; color: rgba(255,255,255,.85);
}
.hero .steps li { counter-increment: step; display: flex; align-items: baseline; gap: 8px; }
.hero .steps li::before {
  content: counter(step);
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  background: rgba(255,255,255,.16); color: #fff;
  font-family: var(--mono); font-size: 11px; line-height: 18px; text-align: center;
  position: relative; top: 3px;
}
.hero .steps b { color: #fff; font-weight: 600; }


/* Toasts replace window.alert() — a blocking OS dialog made the app's best
   moment ("6 entries billed to Clio") look like a system error. */
.toasts {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 50;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  width: min(560px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto; width: 100%;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-left: 4px solid var(--ink-faint); border-radius: 10px;
  padding: 12px 14px; font-size: 13.5px; line-height: 1.5;
  box-shadow: 0 10px 30px rgba(7, 26, 43, .18);
  display: flex; align-items: flex-start; gap: 10px;
  animation: toast-in .16s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.toast.success { border-left-color: var(--success); }
.toast.warn { border-left-color: var(--amber); }
.toast.error { border-left-color: var(--danger); }
.toast .toast-body { flex: 1 1 auto; min-width: 0; }
.toast .toast-body b { font-weight: 600; }
.toast .toast-body p { margin: 4px 0 0; color: var(--ink-soft); font-size: 12.5px; }
.toast .toast-action { flex: none; align-self: center; }
.toast .toast-x {
  flex: none; background: none; border: none; cursor: pointer; padding: 0 2px;
  color: var(--ink-faint); font-size: 15px; line-height: 1;
}
.toast .toast-x:hover { color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

.controls {
  display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px;
  margin-top: -40px; box-shadow: 0 6px 24px rgba(7, 26, 43, .12);
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); }
.field select, .field input, .card select, .card input, .card textarea {
  font: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px;
}
.spacer { flex: 1; }
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px; padding: 9px 15px;
  border: 1px solid transparent; transition: transform .06s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--line); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn:disabled { opacity: .5; cursor: default; }

/* ── Button semantics ────────────────────────────────────────────────────
   One rule the timekeeper can learn in a day: GREEN MEANS MONEY LEAVES
   TENTHLY. Only actions that post billable time to the billing system are
   .commit (green, per the brand palette's "green = live/approved/success").
   Navy .primary is the safe, repeatable main action of a section (run a
   reconcile, catch up, turn a question into a draft) — nothing bills.
   .quiet is a real secondary button for reversible negative actions
   ("Not billable", "Restore"), which used to be faint underlined links
   indistinguishable from "show"/"hide".
   Pilot trip points this answers: people couldn't tell what "Approve & bill"
   committed, and read "Not billable" as a label rather than a button. */
.btn.commit { background: var(--success); color: #fff; }
.btn.commit:hover { background: color-mix(in srgb, var(--success) 82%, #000); }
.btn.quiet {
  background: var(--surface); color: var(--ink-soft); border-color: var(--line);
}
.btn.quiet:hover { border-color: var(--danger); color: var(--danger); background: var(--surface); }
/* Restoring is recovery, not a negative act — never hover it red. */
.btn.quiet.restore:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.catchup {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin: 18px 0 0; padding: 12px 16px; border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line));
  background: color-mix(in srgb, var(--gold-bright) 8%, var(--surface));
  font-size: 13.5px; color: var(--ink-soft);
}
.catchup[hidden] { display: none; } /* display:flex would beat the hidden attribute */
.catchup .catchup-msg b { color: var(--ink); }
.catchup .btn { margin-left: auto; }
/* The × sits INSIDE a chip that does something else (jump to that day), so a
   near-miss used to dismiss the day you meant to open. Give it real padding,
   a separating rule, and a hover box so the two targets read as two targets. */
.catchup .chip .x {
  display: inline-block; margin-left: 7px; padding: 0 4px;
  border-left: 1px solid color-mix(in srgb, var(--ink-faint) 30%, transparent);
  border-radius: 3px;
  color: var(--ink-faint); font-weight: 600;
}
.catchup .chip .x:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }

/* Habit + value counters — a calm line, but readable (James, 2026-11-14: "The writing is small and hard to see") */
.stats {
  font-size: 15px; color: var(--ink-soft); margin: 18px 2px 0;
}
.stats b { color: var(--ink); }
.stats .sep { color: var(--ink-faint); }
.stats .milestone { color: var(--gold); font-weight: 600; }
.stats .milestone b { color: var(--gold); }
.summary { font-size: 18px; line-height: 1.4; color: var(--ink); margin: 22px 2px 6px; min-height: 24px; }
.summary .link { font: inherit; font-weight: 600; color: var(--amber); padding: 0; }
.summary b { color: var(--ink); }
.runreport { font-size: 14px; color: var(--ink-soft); margin: 0 2px 10px; }
.runreport b { color: var(--ink); }
.sourcewarn {
  font-size: 13px; color: var(--amber); background: var(--amber-soft);
  border-radius: 8px; padding: 8px 12px; margin: 0 0 10px;
}
.sourcewarn b { color: inherit; }
.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.list > .card { min-width: 0; }
.empty { color: var(--ink-faint); text-align: center; padding: 40px; font-size: 14px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px;
  box-shadow: 0 1px 2px rgba(20,40,30,.04), 0 8px 22px rgba(20,40,30,.05);
}
.card.question { border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); background: color-mix(in srgb, var(--amber-soft) 45%, var(--surface)); }
.card.approved { border-color: color-mix(in srgb, var(--success) 55%, var(--line)); }
.card.synced { opacity: .62; }
.card.rejected { opacity: .5; }

.card .head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; min-width: 0; }
/* Possible-duplicate warning: time already in the billing system on the same
   matter + day, entered outside Tenthly (see duplicateWarningHtml). */
.dupewarn {
  font-size: 12.5px; color: var(--amber); background: var(--amber-soft);
  border: 1px solid color-mix(in srgb, var(--amber) 35%, var(--line));
  border-radius: 8px; padding: 8px 10px; margin: 0 0 8px;
}
.dupewarn .dupe-note { color: var(--ink-soft); font-style: italic; margin-top: 3px; }
.card .matter {
  font-family: var(--mono); font-size: 12.5px; color: var(--accent); font-weight: 600;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card select { min-width: 0; max-width: 100%; text-overflow: ellipsis; }
.card.question > select { width: 100%; }
.card .hours { font-family: var(--sans); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card .hours input { width: 62px; text-align: right; font-family: var(--sans); font-size: 17px; appearance: textfield; -moz-appearance: textfield; }
/* The native number spinner overlays the right-aligned value ("0.5" reads as
   "0.■") — hide it; typing and arrow keys still adjust. */
.card .hours input::-webkit-outer-spin-button,
.card .hours input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.card .src { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; }
/* Header label must stay one line — never a wall of raw source text. */
.card .head .src { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card textarea { width: 100%; min-height: 54px; resize: vertical; margin-top: 8px; line-height: 1.5; }

/* Evidence: where each proposed entry came from (source tag + time + subject) */
.evidence { list-style: none; margin: 6px 0 2px; padding: 0; display: grid; gap: 4px; }
.ev { display: flex; align-items: baseline; gap: 8px; font-size: 13px; min-width: 0; }
.tag {
  flex: none; font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 8px; border-radius: 20px; background: var(--surface-2); color: var(--ink-soft);
}
/* One color per source so the biller can place an entry's origin at a glance:
   blue = email, green = calendar, rust = call, teal = meet, gray = doc. */
.tag-gmail, .tag-outlook { background: var(--accent-soft); color: var(--accent); }
.tag-calendar { background: var(--success-soft); color: var(--success); }
.tag-voice, .tag-teams { background: var(--amber-soft); color: var(--amber); }
.tag-meet {
  background: color-mix(in srgb, var(--accent-soft) 50%, var(--success-soft));
  color: color-mix(in srgb, var(--accent) 50%, var(--success));
}
.tag-drive, .tag-onedrive { background: var(--surface-2); color: var(--ink-soft); }
.ev-time { flex: none; font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }
.ev-subject { flex: 1 1 auto; min-width: 60px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-who { flex: 0 1 auto; max-width: 38%; color: var(--ink-faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-more { color: var(--ink-faint); font-size: 12px; padding-left: 2px; }
.card .q { font-size: 15px; color: var(--ink); margin: 4px 0 12px; }
/* One-click matter suggestions on question cards (maildrop / client-name hits) */
.candidates { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.chip {
  font-family: var(--mono); font-size: 12px; cursor: pointer; padding: 4px 11px;
  border-radius: 20px; border: 1px solid var(--line); background: var(--surface); color: var(--accent);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip:hover { background: var(--accent-soft); border-color: var(--accent); }
/* A chip that DOES something (one-tap "bill this gap to that matter") must
   not look like a chip that merely navigates (the catch-up date chips).
   Action chips are filled and carry a verb; navigation chips stay outlines. */
.chip.action {
  background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  font-family: var(--sans); font-size: 12.5px; font-weight: 600;
}
.chip.action:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.card .q b { color: var(--amber); }
.card .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.card .row .spacer { flex: 1; }
.card .billing { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.card .billing .nocharge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-faint); cursor: pointer; }
.card .billing .nocharge input { width: auto; margin: 0; cursor: pointer; }
.card .billing .rate { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); margin-left: auto; }
.card .billing .category { width: auto; max-width: 220px; font-size: 12.5px; color: var(--ink-faint); padding: 4px 8px; }
.card .billing .category-fixed { font-size: 12px; color: var(--ink-faint); }

/* Held duplicates: what a bulk action couldn't decide, handed back as a
   decision list. Amber like the per-card warning — same problem, same colour —
   but a panel, because these need an answer before they can ever bill. */
.held {
  margin: 18px 0 4px; padding: 14px 16px; border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--amber) 40%, var(--line));
  background: color-mix(in srgb, var(--amber-soft) 55%, var(--surface));
}
.held[hidden] { display: none; }
.held-head { font-size: 13.5px; color: var(--ink-soft); margin-bottom: 12px; }
.held-row {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px;
}
.held-row:last-of-type { margin-bottom: 4px; }
.held-what { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.held-matter { font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--accent); }
.held-when { font-size: 12px; color: var(--ink-faint); }
/* Side by side on a desktop, stacked on a phone — the comparison IS the tool. */
.held-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 620px) { .held-compare { grid-template-columns: 1fr; } }
.held-side {
  min-width: 0; padding: 8px 10px; border-radius: 8px; background: var(--surface-2);
  display: flex; flex-direction: column; gap: 2px;
}
.held-label {
  font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-faint);
}
.held-side b { font-size: 15px; font-variant-numeric: tabular-nums; }
.held-narr { font-size: 12.5px; color: var(--ink-soft); line-height: 1.45; }
.held-actions { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.held-actions .btn.quiet { margin-left: auto; }
.held-foot { font-size: 12.5px; color: var(--ink-faint); }

/* Ready-to-bill bulk bar + the unclaimed-time drawer (question demotion) */
.approveall { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; margin-bottom: 12px; background: var(--surface-2); border-radius: 10px; font-size: 13.5px; color: var(--ink-faint); }
.drawer { margin-top: 18px; border-top: 1px solid var(--surface-2); padding-top: 6px; }
.drawer-head { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: none; font: inherit; font-size: 14.5px; color: var(--ink-soft); cursor: pointer; padding: 8px 4px; text-align: left; }
.drawer-head:hover { color: var(--ink); }
.drawer-caret { font-size: 11px; width: 12px; }
.drawer-body { margin-top: 6px; }
/* Questions for the person: a bar they cannot miss, in the open-questions colour. */
.drawer-unclaimed { border-top: none; padding-top: 0; }
.drawer-unclaimed .drawer-head {
  font-size: 16px; font-weight: 600; color: var(--amber); background: var(--amber-soft);
  border: 1px solid color-mix(in srgb, var(--amber) 28%, transparent); border-radius: 10px; padding: 13px 16px;
}
.drawer-unclaimed .drawer-head:hover { color: var(--amber); border-color: var(--amber); }
.drawer-unclaimed .drawer-caret { font-size: 13px; width: 14px; }
.drawer-unclaimed .drawer-title { flex: 1 1 auto; }
.drawer-unclaimed .drawer-hint { flex: none; font-size: 13.5px; font-weight: 600; text-decoration: underline; }
.drawer-unclaimed .drawer-body { margin-top: 10px; }
.stalebar { font-size: 14px; color: var(--ink-soft); margin: 6px 2px 10px; }
.pill { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; padding: 3px 9px; border-radius: 20px; }
.pill.approved { color: var(--success); background: var(--success-soft); }
.pill.synced { color: var(--ink-faint); background: var(--surface-2); }
.link { background: none; border: none; color: var(--ink-faint); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; padding: 4px; }
.link:hover { color: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: 13.5px; }

/* Type-to-search matter picker (draft-card header + question card) */
.picker { position: relative; min-width: 0; }
.card .head .picker { flex: 1 1 auto; max-width: 62%; }
.card .head .hours { flex: none; }
.picker input {
  width: 100%; font-family: var(--mono); font-size: 12.5px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px;
  overflow: hidden; text-overflow: ellipsis;
}
.picker input:focus { outline: none; border-color: var(--accent); }
.picker ul {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 264px; overflow-y: auto; margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(7, 26, 43, .16);
}
.card.question .picker ul { min-width: 100%; }
.picker li {
  padding: 7px 10px; border-radius: 7px; font-size: 13px; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.picker li.active, .picker li:hover { background: var(--accent-soft); color: var(--accent); }
.picker li.note { color: var(--ink-faint); cursor: default; }
.picker li.note:hover { background: none; color: var(--ink-faint); }

/* Hours that aren't a valid number, and a date that hasn't happened yet. */
.hours-error { color: #b3261e; font-size: 13.5px; margin: 6px 0 0; flex-basis: 100%; }
.hours-error[hidden] { display: none; }
.card .hours input.invalid { border-color: #b3261e; outline-color: #b3261e; }
.approveall .hours-error { margin: 0; flex-basis: auto; }

/* Phone: a compact header. The logo, name and help link share one line and the
   status pills sit on a second, never wrapping inside a pill. */
@media (max-width: 480px) {
  .topbar { flex-wrap: wrap; padding: 8px 14px; row-gap: 4px; }
  .top-right { display: contents; }
  .help { margin-left: auto; white-space: nowrap; }
  .who { order: 3; }
  .modes { order: 2; flex: 1 0 100%; flex-wrap: wrap; gap: 5px; }
  .mode { white-space: nowrap; font-size: 9.5px; padding: 2px 7px; }
}
