/* QuotaMap - single stylesheet. No inline styles anywhere (CSP style-src 'self'). */
:root {
  --bg: #f8f8f6;
  --surface: #ffffff;
  --ink: #1d1f23;
  --ink-2: #4a4f57;
  --muted: #646a73;
  --line: #d9dbe0;
  --grid: #e6e7ea;
  --accent: #1f5fbf;
  --accent-ink: #ffffff;
  --bar: #2f6fd0;
  --ok-bg: #e9f6ec; --ok-ink: #1d5a2c;
  --warn-bg: #fff4d9; --warn-ink: #6b4a00;
  --err-bg: #fdecec; --err-ink: #8a1c1c;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1c1f24;
    --ink: #e8eaed;
    --ink-2: #c3c7cd;
    --muted: #9aa0a8;
    --line: #353a42;
    --grid: #2a2e35;
    --accent: #7aa7f0;
    --accent-ink: #0d1420;
    --bar: #6a9ef0;
    --ok-bg: #173222; --ok-ink: #a6e0b5;
    --warn-bg: #3a2e10; --warn-ink: #f3d68a;
    --err-bg: #3d1a1a; --err-ink: #f4b4b4;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 860px; margin: 0 auto; padding: 0 1rem 2rem; }
a { color: var(--accent); }
h1 { font-size: 1.9rem; line-height: 1.2; margin: 1.5rem 0 .5rem; }
h2 { font-size: 1.25rem; margin: 1.25rem 0 .5rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
h4 { font-size: 1rem; margin: .8rem 0 .3rem; }

.site-header, .site-footer {
  max-width: 860px; margin: 0 auto; padding: 1rem;
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between;
}
.site-footer { display: block; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--line); }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); }
.site-header nav a { margin-left: 1rem; }

.hero .sub { font-size: 1.1rem; color: var(--ink-2); margin-top: 0; }
.steps { padding-left: 1.25rem; color: var(--ink-2); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}

label { display: block; font-weight: 600; margin: .75rem 0 .25rem; }
input[type="text"], input[type="email"], input[type="date"], select, textarea {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: .45rem .55rem;
  max-width: 100%;
}
textarea { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; }
input:focus, select:focus, textarea:focus, button:focus, a:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

button, .button {
  font: inherit; display: inline-block; cursor: pointer; text-decoration: none;
  border: 1px solid var(--line); border-radius: 6px; padding: .45rem .9rem;
  background: var(--surface); color: var(--ink);
}
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.link { border: 0; background: none; color: var(--accent); padding: .2rem .3rem; text-decoration: underline; }
button[disabled] { opacity: .6; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.row label { margin: 0; }

.note { color: var(--muted); font-size: .92rem; margin: .4rem 0; }
.msg { padding: .55rem .75rem; border-radius: 6px; margin: .6rem 0; }
.msg:empty { display: none; }
.msg.ok { background: var(--ok-bg); color: var(--ok-ink); }
.msg.warn { background: var(--warn-bg); color: var(--warn-ink); }
.msg.error { background: var(--err-bg); color: var(--err-ink); }
.msg a { color: inherit; }

table { border-collapse: collapse; width: 100%; margin: .5rem 0; font-size: .95rem; }
th, td { text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th { color: var(--ink-2); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.qm-edit input[name="amount"] { width: 8rem; text-align: right; }
.qm-edit input[name="unit"] { width: 8rem; }
.history-wrap { overflow-x: auto; }
.history td { white-space: nowrap; font-variant-numeric: tabular-nums; }
.history .share { color: var(--muted); }
.history .unit { color: var(--muted); font-weight: 400; }
.history .none { color: var(--muted); }
.arrow { display: inline-block; margin-left: .25rem; font-weight: 600; color: var(--ink-2); }

.qm-chart { margin: 1rem 0 1.5rem; }
.qm-chart figcaption { margin-bottom: .25rem; }
.qm-svg { display: block; width: 100%; height: auto; }
.qm-bar { fill: var(--bar); }
.qm-hit { fill: transparent; }
.qm-row:hover .qm-hit { fill: var(--grid); }
.qm-label { fill: var(--ink); font-size: 13px; }
.qm-value { fill: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.qm-axis { stroke: var(--line); stroke-width: 1; }
.qm-data { font-size: .9rem; }

.checklist ul { list-style: none; padding-left: 0; }
.checklist li label { display: inline; font-weight: 400; }

.key { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1rem; word-break: break-all;
  background: var(--bg); border: 1px dashed var(--line); padding: .5rem .75rem; display: inline-block; border-radius: 6px; }

.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (max-width: 560px) {
  h1 { font-size: 1.5rem; }
  .qm-edit input[name="amount"], .qm-edit input[name="unit"] { width: 5.5rem; }
}

@media print {
  :root { --bg: #fff; --surface: #fff; --ink: #000; --ink-2: #222; --muted: #444; --line: #999; --bar: #555; }
  body { background: #fff; color: #000; }
  .site-header nav, .site-footer, #tool, #qm-unlock, .actions, button, .hp, #qm-save, .key-form { display: none !important; }
  .card { border: 0; padding: 0; }
  .qm-hit { fill: transparent !important; }
  .qm-edit input, .qm-edit select { border: 0; background: none; }
  a { color: #000; text-decoration: none; }
  .qm-chart, .history-wrap { break-inside: avoid; }
}
