/* Meltworks brand: Spruce and Flame (direction B). Fonts are served from static/fonts (OFL). */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url("fonts/space-grotesk-latin.woff2") format("woff2"); }

:root {
  --bg: #f5f4ef;
  --panel: #ffffff;
  --ink: #1f2a23;
  --muted: #5c665f;
  --line: #dedcd3;
  --accent: #2f4a3a;
  --accent-ink: #ffffff;
  --accent-soft: #dce5dc;
  --flame: #e8a33d;
  --bar: #1f2a23;
  --bar-ink: #f5f4ef;
  --bar-muted: #c3ccc5;
  --bar-on: #2f4a3a;
  --good: #2b7a4b;
  --warn: #8c5a12;
  --warn-soft: #f8ecd6;
  --bad: #b23a3a;
  --bad-soft: #f8e1e1;
  --radius: 10px;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141a16;
    --panel: #1c241f;
    --ink: #eceee8;
    --muted: #a3ada6;
    --line: #313c35;
    --accent: #9cc5a8;
    --accent-ink: #141a16;
    --accent-soft: #263a2e;
    --bar: #0e1310;
    --bar-ink: #eceee8;
    --bar-muted: #a3ada6;
    --bar-on: #263a2e;
    --good: #6cc48d;
    --warn: #e3a74a;
    --warn-soft: #3a2f1c;
    --bad: #ee7b7b;
    --bad-soft: #3d2222;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-family: var(--display); font-weight: 700; letter-spacing: -.01em; font-size: 1.7rem; margin: 0 0 .25rem; line-height: 1.2; }
h2 { font-family: var(--display); font-weight: 700; font-size: 1.2rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem;
  padding: .7rem 16px; background: var(--bar); color: var(--bar-ink);
}
.brand { font-family: var(--display); font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em; color: var(--bar-ink);
  text-decoration: none; display: flex; align-items: center; gap: .55rem; min-width: 0; }
.brand svg { width: 26px; height: 26px; flex: 0 0 auto; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top nav a.who { border-color: color-mix(in srgb, var(--bar-ink) 22%, transparent); }
.top .menu-btn { background: transparent; color: var(--bar-ink); border-color: color-mix(in srgb, var(--bar-ink) 30%, transparent); }
nav { display: flex; flex-wrap: wrap; gap: .25rem; }
nav a { color: var(--muted); text-decoration: none; padding: .35rem .65rem; border-radius: 6px; }
nav a:hover { color: var(--ink); background: var(--accent-soft); }
nav a[aria-current] { color: var(--ink); background: var(--accent-soft); font-weight: 600; }
.top nav a { color: var(--bar-muted); }
.top nav a:hover { color: var(--bar-ink); background: var(--bar-on); }
.top nav a[aria-current] { color: var(--bar-ink); background: var(--bar-on); }
.menu-btn { display: none; margin-left: auto; }
/* Category filters on list pages */
.filters { display: flex; gap: .35rem; overflow-x: auto; margin-bottom: 1rem; padding-bottom: .25rem; }
.filters a { flex: 0 0 auto; color: var(--muted); text-decoration: none; padding: .3rem .75rem; border-radius: 99px;
  border: 1px solid var(--line); background: var(--panel); font-size: .9rem; }
.filters a[aria-current] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

main { max-width: 1100px; margin: 0 auto; padding: 1.25rem 16px 4rem; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: .75rem; margin-bottom: 1.25rem; }
.head p { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid > .panel { margin-bottom: 0; }
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 1rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; text-decoration: none; color: inherit; }
.stat b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .85rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
td a { text-decoration: none; }
td a:hover { text-decoration: underline; }

.flash { padding: .6rem .9rem; border-radius: 8px; background: var(--accent-soft); margin: 0 0 1rem; }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.note { padding: .6rem .9rem; border-radius: 8px; background: var(--warn-soft); color: var(--warn); margin: .5rem 0; }
.tag { display: inline-block; font-size: .75rem; padding: .05rem .5rem; border-radius: 99px; background: var(--accent-soft); color: var(--ink); white-space: nowrap; }
.tag.low, .tag.retired { background: var(--bad-soft); color: var(--bad); }
.tag.approved { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.short { color: var(--bad); font-weight: 600; }
.good { color: var(--good); }
.bad { color: var(--bad); }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .2rem; }
label small { font-weight: 400; color: var(--muted); }
input, select, textarea, button, .button {
  font: inherit; color: inherit; border-radius: 8px; border: 1px solid var(--line);
  padding: .45rem .6rem; background: var(--bg);
}
input, select, textarea { width: 100%; }
textarea { min-height: 4.5rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.fields { display: grid; gap: .9rem 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 1rem; }
.fields .wide { grid-column: 1 / -1; }
.inline { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.inline > div { flex: 1 1 120px; }
.check { display: flex; gap: .4rem; align-items: center; font-weight: 400; }
.check input { width: auto; }

button, .button { cursor: pointer; background: var(--panel); text-decoration: none; display: inline-block; white-space: nowrap; }
button:hover, .button:hover { border-color: var(--accent); }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.primary:hover { filter: brightness(1.05); }
.danger { color: var(--bad); }
.link { border: 0; background: none; padding: 0; color: var(--accent); }

.rows { display: grid; gap: .5rem; margin-bottom: .5rem; }
.row { display: grid; grid-template-columns: 1fr 120px auto; gap: .5rem; align-items: center; }
.row .unit { color: var(--muted); font-size: .85rem; }
.total-line { font-weight: 600; margin: .25rem 0 1rem; }

.bar { height: 10px; border-radius: 99px; overflow: hidden; display: flex; background: var(--line); margin: .5rem 0 1rem; }
.bar span { display: block; height: 100%; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

.files { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.files li { border: 1px solid var(--line); border-radius: 8px; padding: .5rem; font-size: .85rem; overflow-wrap: anywhere; }
.files img { width: 100%; height: 110px; object-fit: contain; background: var(--bg); border-radius: 6px; display: block; margin-bottom: .35rem; }
.files .pdf { height: 110px; display: grid; place-items: center; background: var(--bg); border-radius: 6px; margin-bottom: .35rem; font-weight: 700; color: var(--muted); }

.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }

@media (max-width: 760px) {
  .top { flex-wrap: wrap; }
  .menu-btn { display: inline-block; }
  #main-nav { display: none; width: 100%; flex-direction: column; gap: 0; padding-top: .25rem; }
  #main-nav.open { display: flex; }
  #main-nav a { padding: .65rem .5rem; border-top: 1px solid color-mix(in srgb, var(--bar-ink) 14%, transparent); border-radius: 0; }
}
@media (max-width: 600px) {
  h1 { font-size: 1.35rem; }
  .head { align-items: flex-start; }
  .actions .button, .actions button { padding: .5rem .75rem; }
  .row { grid-template-columns: 1fr 90px auto; }
  th, td { padding: .45rem .4rem; }
  .hide-sm { display: none; }
}

/* Label previews */
.label-preview { display: grid; place-items: center; position: relative; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; height: 180px; overflow: hidden; margin-bottom: .5rem; text-decoration: none; color: var(--muted); }
.label-preview.big { height: auto; min-height: 220px; max-height: 70vh; padding: .5rem; }
.label-preview img, .label-preview canvas { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.label-preview.big img, .label-preview.big canvas { max-height: calc(70vh - 1rem); }
.label-preview canvas { display: none; }
.label-preview.drawn canvas { display: block; }
.label-preview.drawn .pdf-fallback { display: none; }
.pdf-fallback { font-weight: 700; padding: 1rem; text-align: center; overflow-wrap: anywhere; }
.empty-label { gap: .5rem; align-content: center; text-align: center; padding: 1rem; border-style: dashed; }
.label-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.label-grid .panel { margin: 0; }
.label-card h2 { font-size: 1rem; margin: .25rem 0 0; }
.label-card p { margin: .2rem 0; }
.files .label-preview { height: 110px; }

/* Home */
details.fold > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .5rem; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
details.fold[open] > summary::before { transform: rotate(90deg); }
details.fold > summary h2 { margin: 0; }
details.fold[open] > summary { margin-bottom: .75rem; }
details.history { margin-top: 1rem; }
details.history > summary { cursor: pointer; color: var(--accent); font-weight: 600; }
details.history[open] > summary { margin-bottom: .5rem; }
[hidden] { display: none !important; }
.quick { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 1rem; }
.quick-card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .85rem 1rem; text-decoration: none; color: var(--ink); }
.quick-card:hover { border-color: var(--accent); }
.quick-card b { display: block; color: var(--accent); }
.quick-card span { color: var(--muted); font-size: .85rem; }
.todo { list-style: none; margin: 0; padding: 0; }
.todo li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .5rem 0;
  border-top: 1px solid var(--line); }
.todo li:first-child { border-top: 0; }
.todo .button { flex: 0 0 auto; font-size: .9rem; padding: .3rem .7rem; }
h2 .tag { vertical-align: middle; font-weight: 600; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }

/* Tables that become cards on phones */
@media (max-width: 600px) {
  table.cards thead { display: none; }
  table.cards, table.cards tbody { display: block; width: 100%; }
  table.cards tr { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: .25rem .75rem;
    border-bottom: 1px solid var(--line); padding: .6rem 0; }
  table.cards td { display: block; border: 0; padding: .1rem 0; }
  table.cards td:first-child, table.cards td.full { grid-column: 1 / -1; }
  table.tag-table tr { grid-template-columns: 1fr 1fr; }
  table.cards td[data-label]::before { content: attr(data-label); display: block; font-size: .8rem; color: var(--muted); font-weight: 600; }
  table.cards td.num { text-align: left; }
}

/* Settings: radio choices with a description underneath */
.choice { display: grid; grid-template-columns: auto 1fr; gap: .1rem .6rem; align-items: start; font-weight: 400;
  padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 8px; margin-bottom: .5rem; cursor: pointer; }
.choice input { width: auto; margin-top: .3rem; grid-row: span 2; }
.choice b { font-weight: 600; }
.choice small { color: var(--muted); grid-column: 2; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
details.more > summary { cursor: pointer; color: var(--accent); margin: .5rem 0; }

/* Anything marked hidden stays hidden, whatever its display style. */
[hidden] { display: none !important; }

/* Production */
.prod-cards { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.prod-card { display: grid; gap: .2rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); color: inherit; text-decoration: none; }
.prod-card:hover { border-color: var(--accent); }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--accent); }
.timer.up { color: var(--bad); }
.timer.big { font-size: 2rem; margin: .5rem 0 .25rem; }
.step-now { border-color: var(--accent); }
.target { font-size: 1.1rem; }
.steps { padding-left: 1.4rem; margin: 0; display: grid; gap: .55rem; }
.steps li.done { color: var(--muted); }
.steps li.done b::before { content: "✓ "; color: var(--good); }
.steps li.now b { color: var(--accent); }
.tag.making { background: var(--warn-soft); color: var(--warn); }
.tag.curing { background: var(--accent-soft); }
.tag.ready { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.tag.cancelled { background: var(--bad-soft); color: var(--bad); }
.row.step-edit { grid-template-columns: 1fr; gap: .5rem; padding: .75rem; border: 1px solid var(--line); border-radius: var(--radius); }
.step-main { display: grid; gap: .4rem; }
.step-opts { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.step-opts label { font-size: .8rem; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; }
.step-move { display: flex; gap: 1rem; justify-content: flex-end; }
code.topic { display: inline-block; margin-top: .25rem; padding: .2rem .5rem; font-size: 1rem; user-select: all; overflow-wrap: anywhere; }

/* Color ideas and swatches */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem; }
.swatch { display: flex; gap: .6rem; align-items: flex-start; text-align: left; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: inherit; font: inherit; }
button.swatch { cursor: pointer; }
button.swatch:hover { border-color: var(--ink); }
.swatch .dot, .dot { flex: 0 0 auto; width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); display: inline-block; vertical-align: middle; }
.dot.sm { width: .9rem; height: .9rem; }
.color-ideas { margin-bottom: .75rem; }
.step-now p.instr { white-space: pre-line; }

/* Spacing helpers */
.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 1rem; }
.inline > .shrink { flex: 0 0 auto; }

/* Sign-in and People */
.narrow { max-width: 32rem; }
.fields.one { grid-template-columns: 1fr; }
nav a.who { border: 1px solid var(--line); }
.foot { max-width: 1100px; margin: -2.5rem auto 0; padding: 0 16px 2rem; font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.foot a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: .35rem; }
.foot svg { width: 14px; height: 14px; }
.big-code code { font-size: 1.4rem; letter-spacing: .05em; user-select: all; }
.people { list-style: none; margin: 0; padding: 0; }
.people li { padding: .75rem 0; border-top: 1px solid var(--line); }
.people li:first-child { border-top: 0; padding-top: 0; }
.person { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: .5rem 1rem; align-items: center; }
.person input[name=name] { margin-top: .25rem; }
@media (max-width: 700px) { .person { grid-template-columns: 1fr 1fr; } .person > div:first-child { grid-column: 1 / -1; } }

/* Sign-up: the studio address field, and the field only bots fill in. */
.slug-row { display: flex; align-items: center; gap: .35rem; }
.slug-row input { flex: 1; min-width: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Billing: plan cards */
.plans { margin-bottom: 1rem; }
.plan .price { font-size: 1.4rem; margin: .25rem 0 .5rem; }
.plan-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Front page (meltworks.app) */
.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 2rem; background: var(--bar); color: var(--bar-ink);
  border-radius: 18px; padding: 2.5rem 2rem; margin: .5rem 0 2rem; }
.hero-text { flex: 999 1 420px; min-width: 0; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: .75rem; }
.hero .lead { font-size: 1.1rem; color: var(--bar-muted); max-width: 38rem; margin: 0 0 1.5rem; }
.hero .muted { color: var(--bar-muted); }
.hero .primary { background: var(--flame); border-color: var(--flame); color: #1f2a23; }
.hero-mark { flex: 1 1 160px; display: flex; justify-content: center; }
.hero-mark svg { width: min(200px, 40vw); height: auto; }
.button.big { padding: .7rem 1.2rem; font-size: 1.05rem; }
.tag.soon { background: var(--flame); color: #1f2a23; font-size: .9rem; padding: .25rem .75rem; font-weight: 600; }
.section-title { font-size: 1.5rem; margin-top: 1rem; }
.features { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 2rem; }
.features .panel { margin: 0; }
.features h3 { margin-top: 0; font-family: var(--display); font-size: 1.05rem; }
.features p { margin: 0; color: var(--muted); }
@media (max-width: 600px) { .hero { padding: 1.75rem 1.25rem; } .hero-mark { display: none; } }

/* Reorder buttons (a supply whose SKU / link is a web address) */
.button.sm { font-size: .85rem; padding: .25rem .65rem; }
.reorder { margin-top: .35rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
