/* Glintside creator tools. Layout: a single working column (~70ch) for copy, tools as a two-pane
   "desk" (inputs left, live result right) that stacks on phones. Look: plain office paper, ink,
   and one stamp colour used only for totals and the main action. System fonts only (CSP: no remote fonts). */
:root {
  --paper: #f7f5f0;
  --sheet: #ffffff;
  --ink: #1e2128;
  --muted: #5c6270;
  --rule: #dcd8ce;
  --stamp: #b3361f;
  --stamp-ink: #ffffff;
  --stamp-soft: #f6e4df;
  --ok: #1f6b45;
  --ok-soft: #e2f1e8;
  --focus: #2f5fb3;
  --f-display: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15171b;
    --sheet: #1d2026;
    --ink: #e8e6e1;
    --muted: #a1a6b2;
    --rule: #343842;
    --stamp: #ef7a5f;
    --stamp-ink: #1a0e0a;
    --stamp-soft: #3a221c;
    --ok: #7ed3a2;
    --ok-soft: #1c3226;
    --focus: #8fb0f0;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.6 var(--f-body); }
a { color: inherit; text-underline-offset: .2em; }
a:hover { color: var(--stamp); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.wrap { width: min(100% - 32px, 1080px); margin: 0 auto; }
.narrow { max-width: 70ch; }
.skip { position: absolute; left: 16px; top: -100px; padding: 8px 12px; background: var(--sheet); }
.skip:focus { top: 8px; }

.top { border-bottom: 1px solid var(--rule); }
.top-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; padding: 16px 0; }
.logo { font-family: var(--f-display); font-weight: 700; text-decoration: none; letter-spacing: .01em; }
.logo span { color: var(--muted); font-weight: 500; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 15px; }

main { padding: 40px 0 64px; }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 2.9rem); letter-spacing: -.015em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }
p { margin: 0; }
.eyebrow { font: 600 12px/1.4 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.lede { font-size: 1.15rem; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.section { display: flex; flex-direction: column; gap: 18px; margin-top: 48px; }
.note { font-size: 14px; color: var(--muted); }

/* Tool cards on the hub */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; gap: 8px; padding: 20px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; text-decoration: none; }
.card:hover { border-color: var(--ink); color: inherit; }
.card .go { margin-top: auto; padding-top: 6px; font-weight: 600; color: var(--stamp); }

/* The desk: inputs and result side by side */
.desk { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 28px; }
@media (max-width: 820px) { .desk { grid-template-columns: minmax(0, 1fr); } }
.pane { background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.result { position: sticky; top: 16px; }
@media (max-width: 820px) { .result { position: static; } }
fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
legend { font-family: var(--f-display); font-weight: 700; padding: 0; margin-bottom: 4px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; min-width: 0; }
label .hint { font-weight: 400; color: var(--muted); }
.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; padding: 8px 10px; width: 100%; min-width: 0; }
.check input { width: auto; }
textarea { min-height: 90px; resize: vertical; }
input[type="number"] { font-variant-numeric: tabular-nums; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 15px/1 var(--f-body); padding: 12px 16px; border-radius: 4px; border: 1px solid var(--stamp); background: var(--stamp); color: var(--stamp-ink); cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.08); color: var(--stamp-ink); }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.quiet:hover { border-color: var(--ink); color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Results */
.total { display: flex; flex-direction: column; gap: 2px; padding: 16px; background: var(--stamp-soft); border-radius: 4px; }
.total b { font: 700 clamp(1.6rem, 4vw, 2.1rem)/1.1 var(--f-display); color: var(--stamp); font-variant-numeric: tabular-nums; }
.lines { width: 100%; border-collapse: collapse; font-size: 15px; }
.lines td { padding: 7px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.lines td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 12px; }
.copybox { white-space: pre-wrap; font: 14px/1.55 var(--f-mono); background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; padding: 12px; overflow-wrap: anywhere; }
.status { font-size: 14px; min-height: 1.4em; }
.status.ok { color: var(--ok); }
.status.bad { color: var(--stamp); }

/* Waitlist */
.waitlist { margin-top: 56px; padding: 24px; border: 2px solid var(--ink); border-radius: 6px; background: var(--sheet); display: flex; flex-direction: column; gap: 16px; }
.waitlist .done { padding: 14px; border-radius: 4px; background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Invoice sheet */
.invoice { background: #ffffff; color: #1e2128; border: 1px solid var(--rule); border-radius: 4px; padding: 28px; font-size: 14px; display: flex; flex-direction: column; gap: 18px; overflow-x: auto; }
.invoice h2 { font-size: 1.6rem; letter-spacing: .02em; }
.inv-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.inv-parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.inv-parties p, .inv-meta p { white-space: pre-line; }
.inv-label { font: 600 11px/1.4 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: #5c6270; }
.inv-items { width: 100%; border-collapse: collapse; min-width: 420px; }
.inv-items th { text-align: left; font: 600 11px/1.4 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: #5c6270; border-bottom: 2px solid #1e2128; padding: 6px 4px; }
.inv-items td { border-bottom: 1px solid #dcd8ce; padding: 8px 4px; vertical-align: top; }
.inv-items .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inv-totals { margin-left: auto; min-width: 240px; border-collapse: collapse; }
.inv-totals td { padding: 4px 4px; }
.inv-totals .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inv-totals tr.grand td { border-top: 2px solid #1e2128; font-weight: 700; font-size: 16px; padding-top: 8px; }
.inv-endorse { font-weight: 700; border: 1px solid #1e2128; padding: 8px 10px; }
.inv-notes { white-space: pre-line; color: #3a3f4a; }
.items-editor { display: flex; flex-direction: column; gap: 10px; }
.item-row { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: end; }
@media (max-width: 480px) { .item-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .item-row label:first-child { grid-column: 1 / -1; } }

.foot { border-top: 1px solid var(--rule); padding: 24px 0 36px; font-size: 14px; color: var(--muted); }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; }

[hidden] { display: none !important; }

@media print {
  body { background: #fff; }
  .top, .foot, .waitlist, .pane.inputs, .no-print, .page-intro { display: none !important; }
  main { padding: 0; }
  .desk { display: block; margin: 0; }
  .pane.result { border: 0; padding: 0; position: static; }
  .invoice { border: 0; padding: 0; }
}

/* Guides and FAQs */
.crumbs { font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.prose { display: flex; flex-direction: column; gap: 14px; }
.prose ul, .prose ol, .section ul, .section ol { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 6px; }
.prose h3 { margin-top: 8px; }
.quote { padding: 12px 16px; border-left: 3px solid var(--stamp); background: var(--sheet); font-family: var(--f-mono); font-size: 15px; }
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; background: var(--sheet); }
table.data caption { text-align: left; font-size: 14px; color: var(--muted); padding-bottom: 8px; }
table.data th, table.data td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--rule); }
table.data th { font-weight: 600; }
.tool-cta { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; margin-top: 40px; padding: 22px; background: var(--sheet); border: 1px solid var(--rule); border-left: 4px solid var(--stamp); border-radius: 6px; }
.tool-cta-title { font-family: var(--f-display); font-weight: 700; font-size: 1.25rem; }
.faq details { border-bottom: 1px solid var(--rule); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin-top: 8px; }
.guide-links { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; }
.sources ul { font-size: 15px; }
.more { margin-top: 24px; }
@media print { .tool-cta, .faq, .crumbs, [data-tool="invoice"] .section { display: none !important; } }
