/* Kickback. Warm paper, deep green header, money green accent; same family as ClockWork. */
:root {
  color-scheme: light;
  --paper: #f5f3ee; --card: #fffefb; --ink: #1c1d1a; --ink-2: #4f514c; --ink-3: #686b65;
  --line: #e2ded4; --line-2: #cfcabd; --head: #0f2419; --head-ink: #e8f0ea; --head-dim: #b5c7bb;
  --accent: #0d7340; --accent-ink: #fff; --accent-soft: #e2f2e8;
  --bad: #b3372f; --bad-soft: #fbe9e6; --warn: #7a5000; --warn-soft: #fff3d6; --good: #0c6e2a; --good-soft: #e3f4e6;
  --radius: 16px; --shadow: 0 1px 2px rgba(28,29,26,.05), 0 8px 24px rgba(28,29,26,.06); --focus: #2a78d6;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #121412; --card: #1b1d1b; --ink: #eef0ec; --ink-2: #c2c6bf; --ink-3: #a1a69d;
    --line: #2c2f2b; --line-2: #3d413b; --head: #0a150f; --head-ink: #e8f0ea; --head-dim: #a9bcae;
    --accent: #5fd08f; --accent-ink: #04140b; --accent-soft: #15291d;
    --bad: #f08a80; --bad-soft: #3a1d1a; --warn: #f2c25c; --warn-soft: #33290f; --good: #6fd88f; --good-soft: #173020;
    --shadow: none; --focus: #7fb2ff;
  }
}
* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.7rem, 4.4vw, 2.5rem); line-height: 1.1; letter-spacing: -.025em; margin: .2rem 0 .45rem; }
h2, .h2 { font-size: 1.15rem; letter-spacing: -.015em; margin-bottom: .6rem; font-weight: 700; }
h3 { font-size: 1rem; margin-bottom: .4rem; }
code { font-size: .9em; background: var(--accent-soft); padding: 1px 5px; border-radius: 6px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 12px; top: 12px; background: var(--card); padding: 8px 12px; z-index: 30; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-2); } .small { font-size: .88rem; } .lede { color: var(--ink-2); font-size: 1.06rem; max-width: 64ch; margin-bottom: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .11em; font-size: .74rem; font-weight: 700; color: var(--accent); margin: 0; }
.eyebrow a { color: inherit; text-decoration: none; } .eyebrow a:hover { text-decoration: underline; }

/* header */
.top { background: var(--head); color: var(--head-ink); position: sticky; top: 0; z-index: 10; }
.top-inner { max-width: 1100px; margin: auto; padding: 10px 20px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em; }
.brand img { display: block; border-radius: 8px; }
.tag { color: var(--head-dim); font-size: .85rem; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.top nav a { color: var(--head-dim); text-decoration: none; font-weight: 650; padding: 8px 11px; border-radius: 9px; font-size: .95rem; }
.top nav a:hover, .top nav a[aria-current] { color: #fff; background: rgba(255,255,255,.1); }

.shell { max-width: 1100px; margin: 0 auto; padding: 26px 20px 60px; }
.foot { max-width: 1100px; margin: 0 auto; padding: 0 20px 36px; color: var(--ink-3); font-size: .85rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.narrow { max-width: 620px; margin: 40px auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 4px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.section-head h2 { margin: 0; }

/* notices and states */
.toast { border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-weight: 600; border: 1px solid transparent; }
.toast.good { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 25%, transparent); }
.toast.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.notice { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 18px; }
.notice h2 { margin-bottom: 2px; font-size: 1.02rem; } .notice p { margin: 0; color: var(--ink-2); max-width: 75ch; }
.warn { background: var(--warn-soft); color: var(--ink); border-radius: 12px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.warn pre { white-space: pre-wrap; font-size: .85rem; margin: 6px 0 0; }
.warn + .warn { margin-top: 10px; } .steps .warn { margin: 10px 0; }
.empty { color: var(--ink-2); margin: 6px 0; }
.flag { display: inline-block; font-size: .78rem; font-weight: 700; border-radius: 999px; padding: 1px 9px; }
.flag.bad { background: var(--bad-soft); color: var(--bad); } .flag.good { background: var(--good-soft); color: var(--good); }
.flag.wait { background: var(--warn-soft); color: var(--warn); }

/* buttons & forms */
.btn, button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 9px 16px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; }
.btn:hover, button:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.danger-ghost { border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: transparent; color: var(--bad); }
.btn.small { min-height: 36px; padding: 5px 12px; font-size: .9rem; }
button:disabled { opacity: .6; cursor: progress; }
label { display: block; font-weight: 650; margin-bottom: 6px; }
.opt { font-weight: 500; color: var(--ink-3); }
input, textarea { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--card); border: 1px solid var(--line-2); border-radius: 11px; padding: 10px 12px; }
input[type=file] { padding: 9px; }
input[readonly], textarea[readonly] { background: var(--paper); }
textarea { resize: vertical; line-height: 1.45; }
.field { margin-bottom: 16px; } .hint { color: var(--ink-3); font-size: .85rem; margin: 5px 0 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.form-actions form { margin: 0; }
.copy-row { display: flex; gap: 8px; } .copy-row input { flex: 1; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); border-bottom: 1px solid var(--line-2); }
tfoot th, tfoot td { border-bottom: 0; font-weight: 750; padding-top: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.date { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.claims td:first-child { white-space: nowrap; }
main [id] { scroll-margin-top: 76px; } /* links like #items land below the sticky header */
dialog.modal .toast { margin: 10px 0 4px; }
dialog.modal form > .form-actions { position: sticky; bottom: -24px; background: var(--card); padding: 12px 0 14px; margin-bottom: -14px; border-top: 1px solid var(--line); }
.backlink { margin: 0 0 4px; font-weight: 650; } .backlink a { text-decoration: none; } .backlink a:hover { text-decoration: underline; }
.sub { display: block; color: var(--ink-3); font-size: .85rem; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn { margin-left: 4px; }
.copy-link { display: inline-block; font-size: .82rem; margin-left: 8px; padding: 5px 2px; }
.also { margin-top: 16px; } .also ul, .files { margin: 0 0 4px; padding-left: 20px; }
.files li { margin: 4px 0; }

/* details and prose */
details summary { cursor: pointer; font-weight: 700; }
details.notes { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
details[open] summary { margin-bottom: 8px; }
summary.h2 { margin: 0; }
.prose p, .prose li { max-width: 78ch; } .prose ul, .prose ol { padding-left: 22px; } .prose li { margin: 4px 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 14px 0 20px; }
.facts div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.facts dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; }
.facts dd { margin: 4px 0 0; }

/* export steps */
.steps { list-style: none; padding: 0; margin: 20px 0 0; counter-reset: step; }
.steps > li { counter-increment: step; position: relative; padding-left: 64px; }
.steps > li::before { content: counter(step); position: absolute; left: 20px; top: 20px; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; display: grid; place-items: center; }
.file-name { word-break: break-word; }

/* file viewer */
.file-title { font-size: clamp(1.2rem, 3vw, 1.6rem); word-break: break-word; }
.viewer { width: 100%; height: 80vh; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; }
.viewer-img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; }
.viewer-text { white-space: pre-wrap; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }

/* dialogs: read-only lists, edit in a modal (works without JavaScript too) */
dialog.modal { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); padding: 24px; width: min(580px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
dialog.modal::backdrop { background: rgba(8,16,11,.55); }
dialog.modal[data-open]:not([open]) { display: block; position: static; margin: 0 auto 18px; }
dialog.modal h2 { margin-bottom: 4px; }
.remove-form { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 14px; }

/* drag and drop */
.dropzone { position: fixed; inset: 12px; z-index: 40; border: 3px dashed var(--accent); border-radius: 22px; background: color-mix(in srgb, var(--paper) 88%, transparent); display: grid; place-items: center; pointer-events: none; }
.dropzone[hidden] { display: none; }
.dropzone p { font-size: 1.4rem; font-weight: 800; color: var(--accent); background: var(--card); padding: 14px 22px; border-radius: 14px; box-shadow: var(--shadow); }

@media (max-width: 720px) {
  .shell { padding: 18px 14px 50px; } .card { padding: 18px 16px; } main [id] { scroll-margin-top: 104px; }
  .top-inner { padding: 8px 14px; gap: 8px; } .tag { display: none; }
  .top nav { margin-left: 0; width: 100%; } .top nav a { padding: 6px 9px; font-size: .9rem; }
  .row2 { grid-template-columns: 1fr; gap: 0; }
  .page-head { align-items: stretch; } .head-actions { width: 100%; } .head-actions .btn { flex: 1 1 140px; }
  .drop-hint { display: none; }
  table.items thead, table.claims thead { display: none; }
  table.items tr, table.claims tr { display: block; border-bottom: 1px solid var(--line-2); padding: 8px 0; }
  table.items td, table.claims td { display: flex; justify-content: space-between; gap: 14px; border: 0; padding: 4px 0; text-align: right; }
  table.items td::before, table.claims td::before { content: attr(data-label); font-weight: 650; color: var(--ink-3); text-align: left; flex: none; }
  table.items td.actions { justify-content: flex-end; white-space: normal; flex-wrap: wrap; gap: 6px; padding-top: 8px; }
  table.items td.actions::before { content: none; }
  table.items tfoot tr { display: flex; justify-content: space-between; } table.items td:empty { display: none; }
  .sub { text-align: right; }
  .steps > li { padding-left: 16px; padding-top: 58px; } .steps > li::before { left: 16px; top: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
form.inline { display: inline; margin: 0; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; }
