/* Localworks design system — matches AbraCalc "Instrument" theme so advanced.abracalc.com
   reads as the same product. Cool paper ground, single Braun-orange signal accent (#f25f1c),
   IBM Plex Sans + tabular IBM Plex Mono, small deliberate radius scale. Light default; dark opt-in. */
:root {
  --fg: #18181a; --muted: #6a6a64; --bg: #fbfbfa; --card: #ffffff; --accent: #f25f1c;
  --accent-fg: #fff; --line: #e4e4e1; --line-2: #d9d9d4; --ok: #0a7d54; --bad: #c0392b; --warn: #b4530a;
  --max: 1080px;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --r-sm: 4px; --r: 6px; --r-lg: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --fg: #ededeb; --muted: #9a9a93; --bg: #161617; --card: #1e1e20; --accent: #ff6a2b;
    --accent-fg: #161617; --line: #2e2e30; --line-2: #3a3a3c; color-scheme: dark; }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--sans); background: var(--bg); color: var(--fg);
  line-height: 1.6; font-size: 15.5px; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, .brand { font-family: var(--sans); letter-spacing: -.015em; font-weight: 600; line-height: 1.2; }
code, pre, .mono { font-family: var(--mono); }

/* top bar — mirrors AbraCalc .site-h */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center;
  justify-content: space-between; gap: 14px; padding: 0 18px; height: 56px;
  background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--fg); font-weight: 600; font-size: 20px; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 26px; height: 26px;
  border-radius: var(--r); background: var(--accent); color: var(--accent-fg); }
.brand-mark svg { display: block; width: 18px; height: 18px; }
.caps { display: flex; flex-wrap: wrap; gap: 6px; }
.cap { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted);
  padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.cap .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.cap.on .dot { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.cap.on { color: var(--fg); }

/* layout */
.app { max-width: var(--max); margin: 0 auto; padding: 20px 16px 60px; }
.foot { max-width: var(--max); margin: 0 auto; padding: 18px 16px; color: var(--muted); font-size: 13px;
  border-top: 1px solid var(--line); }

/* launcher */
.hero { padding: 18px 0 6px; max-width: 720px; }
.hero h1 { font-size: clamp(26px, 4vw, 38px); margin: 0 0 10px; }
.hero .accent { color: var(--accent); }
.hero p { color: var(--muted); font-size: 16px; margin: 0; }
.cat-title { margin: 28px 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 12px; }
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 15px; transition: border-color .12s, transform .12s; }
.card:hover { border-color: var(--accent); transform: translateY(-1px); text-decoration: none; }
.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.card-icon { width: 30px; height: 30px; color: var(--accent); }
.card-icon svg { width: 30px; height: 30px; }
.card h3 { margin: 0 0 3px; font-size: 16px; color: var(--fg); }
.card p { margin: 0; color: var(--muted); font-size: 13.5px; }
.weight { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; }
.weight.light { background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent); }
.weight.heavy { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }

/* tool view */
.back { display: inline-block; margin: 4px 0 14px; color: var(--muted); font-size: 14px; }
.tool-title { margin-bottom: 16px; }
.tool-title h2 { margin: 0; font-size: 24px; }
.tool-title .sub { color: var(--muted); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px; margin: 12px 0; }
.rows { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.note { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

/* controls — mirror AbraCalc button/inputs */
.btn { font-family: inherit; font-size: 14px; font-weight: 500; padding: 9px 16px; cursor: pointer;
  border: 1px solid var(--accent); border-radius: var(--r); background: var(--accent); color: var(--accent-fg); }
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn-ghost { background: var(--card); color: var(--fg); border-color: var(--line-2); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.fld { display: flex; flex-direction: column; gap: 5px; margin: 0; }
.fld-l { font-size: 13px; font-weight: 500; }
.fld-h { font-size: 12px; color: var(--muted); }
.in, .ta { width: 100%; font-family: inherit; font-size: 14px; padding: 9px 11px; color: var(--fg);
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r); }
.ta { font-family: var(--mono); font-size: 13px; min-height: 130px; resize: vertical; }
.in:focus, .ta:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.hidden { display: none !important; }

/* drop zone */
.drop { display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center;
  padding: 30px 18px; border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); background: var(--bg);
  color: var(--muted); cursor: pointer; transition: border-color .12s, background .12s; }
.drop:hover, .drop:focus, .drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--bg)); outline: none; }
.drop-i { width: 30px; height: 30px; color: var(--accent); }
.drop-i svg { width: 30px; height: 30px; }
.drop-t { font-size: 14px; color: var(--fg); }
.drop-s { font-size: 12.5px; }

/* status + output */
.status { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--muted); padding: 4px 0; }
.status.err { color: var(--bad); }
.status.ok { color: var(--ok); }
.status.busy { color: var(--fg); }
.spinner { width: 15px; height: 15px; border: 2px solid var(--line-2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.out { font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-word;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 12px;
  max-height: 420px; overflow: auto; margin: 0; }
table.lw { width: 100%; border-collapse: collapse; font-size: 13px; }
table.lw th, table.lw td { text-align: left; padding: 6px 9px; border-bottom: 1px solid var(--line); }
table.lw th { color: var(--muted); font-weight: 600; }
img.preview, canvas.preview { max-width: 100%; border: 1px solid var(--line); border-radius: var(--r); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
/* the result is the hero — orange, tabular mono, like AbraCalc .primary */
.bignum { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 30px; font-weight: 600;
  color: var(--accent); word-break: break-all; }
.swatch { height: 40px; border-radius: var(--r); border: 1px solid var(--line); }

/* download / work progress bar */
.pbar { margin: 12px 0; }
.pbar-top { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.pbar-l { font-weight: 500; color: var(--fg); }
.pbar-pct { font-family: var(--mono); }
.pbar-track { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.pbar-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 999px; transition: width .2s ease; }
.pbar-fill.ok { background: var(--ok); }
.pbar-fill.bad { background: var(--bad); }
.pbar.indet .pbar-fill { width: 40% !important; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
