/* Kitforge Labs label maker. System fonts, no external requests. */
:root {
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-2: #f0f0ec;
  --text: #1b1d21;
  --muted: #5b616b;
  --border: #d9d9d2;
  --accent: #1f6f5c;
  --accent-strong: #165445;
  --accent-text: #ffffff;
  --accent-soft: #e3f1ec;
  --warn-bg: #fff6e0;
  --warn-text: #6a4a00;
  --focus: #2b67d1;
  --sheet-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 8px 24px rgba(0, 0, 0, .08);
  --cell-stroke: #b9c4cc;
  --cell-sel: #2b67d1;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16181d;
    --surface: #1e2128;
    --surface-2: #262a32;
    --text: #e8e9ec;
    --muted: #a3a9b4;
    --border: #353a44;
    --accent: #5cc3a4;
    --accent-strong: #7fd4ba;
    --accent-text: #0d1f1a;
    --accent-soft: #1d3a32;
    --warn-bg: #3a3017;
    --warn-text: #f3d98c;
    --focus: #7fb0ff;
    --sheet-shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16181d;
  --surface: #1e2128;
  --surface-2: #262a32;
  --text: #e8e9ec;
  --muted: #a3a9b4;
  --border: #353a44;
  --accent: #5cc3a4;
  --accent-strong: #7fd4ba;
  --accent-text: #0d1f1a;
  --accent-soft: #1d3a32;
  --warn-bg: #3a3017;
  --warn-text: #f3d98c;
  --focus: #7fb0ff;
  --sheet-shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); margin: 0 0 .5rem; }
h2 { font-size: 1.4rem; margin: 2.2rem 0 .8rem; }
h3 { font-size: 1.1rem; margin: 1.2rem 0 .6rem; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .875rem; margin: .35rem 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* header / footer */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 700; }
.brand svg { color: var(--accent); }
.site-header nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.site-header nav a { color: var(--text); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .95rem; }
.site-header nav a:hover { background: var(--surface-2); }
.site-footer { margin-top: 4rem; padding: 2rem 0 3rem; border-top: 1px solid var(--border); font-size: .9rem; color: var(--muted); }
.site-footer nav { margin: .5rem 0; }
.disclaimer { font-size: .8rem; color: var(--muted); }

/* hero & content */
.hero { padding: 1.8rem 16px 1rem; }
.lede { font-size: 1.1rem; color: var(--muted); max-width: 52rem; margin: 0; }
.content { max-width: 1000px; }
.prose { max-width: 760px; padding-top: 1.5rem; }
.crumbs { padding-top: 1rem; font-size: .875rem; color: var(--muted); }
.steps li, .features li { margin: .4rem 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
figure { margin: 0; }
figcaption { font-size: .85rem; color: var(--muted); margin-top: .4rem; }
.diagram { width: 100%; height: auto; max-height: 560px; }
.d-page { fill: #fff; stroke: #9aa3ad; stroke-width: 2; }
.d-label { fill: #e3f1ec; stroke: #1f6f5c; stroke-width: 1.5; }
.d-dim { stroke: #c0392b; stroke-width: 2; }
.d-arrow { fill: #c0392b; }
.d-text { fill: var(--text); font-family: system-ui, sans-serif; paint-order: stroke; }
.dims { border-collapse: collapse; width: 100%; font-size: .95rem; }
.dims th, .dims td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.dims th { font-weight: 600; width: 45%; }
.same-as { font-size: .9rem; color: var(--muted); word-spacing: .1em; }
.faq details { border-bottom: 1px solid var(--border); padding: .6rem 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: .5rem 0 0; }
.tpl-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.tpl-grid a { display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); height: 100%; }
.tpl-grid a:hover { border-color: var(--accent); }
.tpl-grid span { font-size: .875rem; }
.table-wrap { overflow-x: auto; max-width: 100%; }
.tpl-table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.tpl-table th, .tpl-table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tpl-table td:last-child { white-space: normal; }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-strong); color: var(--accent-text); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn:disabled { opacity: .6; cursor: progress; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-size: 1.2rem; line-height: 1; }
.icon-btn:disabled { opacity: .4; cursor: default; }
label { font-weight: 600; font-size: .9rem; display: block; margin: .2rem 0 .25rem; }
input[type="text"], input[type="number"], select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-height: 40px;
}
textarea { resize: vertical; line-height: 1.4; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; min-height: 40px; }
.field { min-width: 0; }
.field.small { width: 120px; flex: 0 0 auto; }
.grow { flex: 1 1 160px; }
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin: .5rem 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: .5rem 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 38px; padding: 0 10px; margin: 0; background: var(--surface); color: var(--text); border: 0; border-right: 1px solid var(--border); font: inherit; font-size: .875rem; font-weight: 500; cursor: pointer; position: relative; }
.seg > :last-child { border-right: 0; }
.seg-btn[aria-pressed="true"], .seg-btn:has(input:checked) { background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.seg-btn input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-btn:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: -3px; }

/* editor */
.editor { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; gap: 20px; align-items: start; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.ed-controls { min-width: 0; }
.ed-preview { position: sticky; top: 12px; min-width: 0; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 10px; margin: .8rem 0; }
.tabs [role="tab"] { border: 0; background: transparent; color: var(--text); font: inherit; font-size: .875rem; font-weight: 600; padding: 8px 6px; border-radius: 7px; cursor: pointer; min-height: 40px; }
.tabs [role="tab"][aria-selected="true"] { background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.12); color: var(--accent-strong); }
.pane { margin-bottom: .5rem; }
.group { border-top: 1px solid var(--border); padding: .4rem 0; }
.group > summary { cursor: pointer; font-weight: 700; padding: .5rem 0; list-style-position: outside; }
.pro-tag { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-strong); background: var(--accent-soft); border-radius: 999px; padding: 1px 8px; margin-left: 6px; vertical-align: middle; }
.is-pro .pro-tag { display: none; }
.drop { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; border: 2px dashed var(--border); border-radius: var(--radius); padding: 14px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.paste { margin: .6rem 0; }
.paste summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: .4rem 0 .6rem; }
.chip { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: .8rem; cursor: pointer; font-family: ui-monospace, Menlo, Consolas, monospace; }
.chip:hover { border-color: var(--accent); }
.table-wrap table { border-collapse: collapse; font-size: .8rem; width: 100%; }
.table-wrap th, .table-wrap td { border: 1px solid var(--border); padding: 4px 6px; text-align: left; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.saved { list-style: none; padding: 0; margin: .4rem 0; }
.saved li { display: flex; gap: 10px; align-items: center; padding: 4px 0; }
.saved li span { flex: 1; }

.preview-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.sheet-view { background: var(--surface-2); border-radius: var(--radius); padding: 16px; display: flex; justify-content: center; }
.sheet-view svg { width: 100%; max-width: 640px; height: auto; max-height: 78vh; box-shadow: var(--sheet-shadow); background: #fff; display: block; }
.sheet-view .cell { fill: none; stroke: var(--cell-stroke); stroke-width: .75; }
.sheet-view .cell.skipped { fill: #eceff1; stroke-dasharray: 3 2; }
.sheet-view .cell.selected { stroke: var(--cell-sel); stroke-width: 2; fill: rgba(43, 103, 209, .06); }
.sheet-view .hit { cursor: pointer; }
.sheet-view .hit:hover { fill: rgba(31, 111, 92, .07); }
.warnings p { background: var(--warn-bg); color: var(--warn-text); border-radius: 8px; padding: 8px 12px; margin: 8px 0 0; font-size: .875rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* pricing */
.pricing { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 1rem 0; }
.price-card { border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; background: var(--surface); }
.price-card.featured { border: 2px solid var(--accent); }
.price-card h3 { margin-top: 0; }
.price { font-size: 2rem; font-weight: 800; margin: .2rem 0; }
.price span { font-size: 1rem; font-weight: 500; color: var(--muted); }
.price-card ul { padding-left: 1.1rem; }
.buy { display: flex; flex-wrap: wrap; gap: 8px; }
.pricing.compact .price-card:first-child { display: none; }
.license-form { max-width: 620px; }

/* dialog */
.dialog { border: 1px solid var(--border); border-radius: 14px; padding: 20px; max-width: 560px; width: calc(100% - 32px); background: var(--bg); color: var(--text); }
.dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dialog h2 { margin-top: 0; }

/* print path: only the generated pages are printed */
#print-root { display: none; }
@media print {
  html.printing body > *:not(#print-root) { display: none !important; }
  html.printing #print-root { display: block; }
  html.printing body, html.printing { background: #fff; margin: 0; padding: 0; }
  #print-root .print-page { break-after: page; page-break-after: always; margin: 0; padding: 0; line-height: 0; }
  #print-root .print-page:last-child { break-after: auto; page-break-after: auto; }
  #print-root svg { display: block; }
}

@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; padding: 12px; }
  .ed-preview { position: static; order: -1; }
  .two-col { grid-template-columns: 1fr; }
  .sheet-view { padding: 8px; }
}
@media (max-width: 480px) {
  .tabs [role="tab"] { font-size: .8rem; }
  .field.small { width: calc(50% - 7px); }
  .site-header nav a { padding: 6px 6px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
.brand span { white-space: nowrap; }
@media (max-width: 480px) {
  .site-header nav a[href="/#editor"] { display: none; }
  .site-header nav a { font-size: .9rem; }
}
