/* Shed Builder: blueprint paper + woodshop accents. No inline styles anywhere (strict CSP). */
:root {
  --navy: #0f2c52; --navy-2: #173d6e; --blue: #2a64a8; --line: #c9d6e6; --grid: rgba(42, 100, 168, .07);
  --paper: #f5f8fc; --card: #fff; --ink: #1b2533; --muted: #5d6b7d;
  --wood: #b5651d; --wood-2: #8f4d14; --wood-soft: #fbeedd;
  --ok: #1f7a4d; --bad: #b3261e; --bad-soft: #fdecea; --warn-soft: #fff6dc; --warn: #8a5a00;
  --r: 10px; --shadow: 0 1px 2px rgba(15, 44, 82, .06), 0 4px 14px rgba(15, 44, 82, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px; min-height: 100vh; display: flex; flex-direction: column;
}
[hidden] { display: none !important; }
a { color: var(--blue); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; color: var(--navy); }
h1 { font-size: 1.75rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: .95rem; margin-top: 1em; }
p { margin: 0 0 .7em; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small, small { font-size: .82rem; }
.block { display: block; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; z-index: 100; border-radius: 6px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid #f0a54a; outline-offset: 2px; }
main { flex: 1; padding-top: 24px; padding-bottom: 40px; }
main:focus, main:focus-visible { outline: none; }

/* ---- top bar */
.topbar { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); border-bottom: 3px solid var(--wood); }
.topbar-in { display: flex; align-items: center; gap: 20px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 1.2rem; letter-spacing: .01em; white-space: nowrap; }
.brand b { color: #f3b46b; font-weight: 700; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: #d6e2f2; text-decoration: none; padding: 8px 12px; border-radius: 8px; white-space: nowrap; font-weight: 500; }
.nav a:hover { background: var(--navy-2); color: #fff; }
.nav a[aria-current] { background: #fff; color: var(--navy); }
.account { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.account .who { color: #d6e2f2; max-width: 160px; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; }

/* ---- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; border-radius: 8px; padding: 9px 16px; border: 1px solid var(--line); background: #fff; color: var(--navy); cursor: pointer; text-decoration: none; line-height: 1.2; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { border-color: var(--blue); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--wood); border-color: var(--wood); color: #fff; }
.btn.primary:hover { background: var(--wood-2); border-color: var(--wood-2); }
.btn.ghost { background: transparent; }
.btn.ghost-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .4); }
.btn.ghost-light:hover { background: var(--navy-2); border-color: #fff; }
.btn.danger { color: var(--bad); border-color: #e7b7b3; background: #fff; }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.small { padding: 6px 11px; font-size: .86rem; }
.btn.big { padding: 12px 22px; font-size: 1.02rem; }
.linklike { background: none; border: 0; padding: 0; color: var(--blue); text-decoration: underline; font: inherit; cursor: pointer; }

/* ---- cards & layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; color: var(--navy-2); }
.hero { margin-bottom: 18px; max-width: 760px; }
.hero p { color: var(--muted); font-size: 1.02rem; }
.empty { text-align: center; padding: 48px 20px; max-width: 560px; margin: 30px auto; }
.design-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.live { position: sticky; top: 84px; }
.notice { background: var(--warn-soft); border: 1px solid #f1d58a; color: #5f4300; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.notice.small { font-size: .84rem; }

/* ---- form */
.form .group { border: 0; padding: 0 0 18px; margin: 0 0 18px; border-bottom: 1px dashed var(--line); min-width: 0; }
.form .group:last-of-type { border-bottom: 0; }
legend { font-weight: 700; color: var(--navy); font-size: 1.02rem; margin-bottom: 10px; padding: 0; display: flex; align-items: center; gap: 8px; }
.step { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff; font-size: .8rem; }
.row4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.field { display: block; font-weight: 600; font-size: .9rem; color: #2b3a4f; position: relative; }
.field .unit { color: var(--muted); font-weight: 400; }
input, select, textarea { display: block; margin-top: 4px; font: inherit; font-weight: 400; color: var(--ink); background: #fff; border: 1px solid #b9c7d8; border-radius: 7px; padding: 8px 10px; width: 100%; min-height: 40px; }
textarea { resize: vertical; min-height: 76px; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: 2px solid rgba(42, 100, 168, .25); outline-offset: 0; }
select:disabled { background: #eef2f7; color: var(--muted); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--bad); background: var(--bad-soft); }
.err { display: block; color: var(--bad); font-weight: 500; font-size: .8rem; margin-top: 3px; }
.err:empty { display: none; }
.count { position: absolute; right: 2px; bottom: -20px; color: var(--muted); font-weight: 400; }
.hint { color: var(--muted); font-size: .85rem; margin: 8px 0 0; }
.form-error { background: var(--bad-soft); color: var(--bad); border: 1px solid #f0b8b3; border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-weight: 600; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 10px; }

.style-pick { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.style-chip { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 6px; border: 2px solid var(--line); border-radius: 9px; cursor: pointer; font-size: .8rem; font-weight: 600; text-align: center; background: #fff; color: var(--navy); line-height: 1.15; }
.style-chip:hover { border-color: var(--blue); }
.style-chip.on { border-color: var(--wood); background: var(--wood-soft); }
.style-chip { position: relative; }
.style-chip input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; min-height: 0; margin: 0; opacity: 0; pointer-events: none; }
.style-chip:has(input:focus-visible) { outline: 3px solid #f0a54a; outline-offset: 2px; }
.style-chip img { width: 100%; max-width: 72px; height: auto; }

.chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.chip { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; cursor: pointer; background: #fff; }
.chip:hover { border-color: var(--blue); }
.chip input { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--wood); flex: none; }
.chip span { display: flex; flex-direction: column; line-height: 1.2; }
.chip small { color: var(--muted); }
.chip:has(input:checked) { border-color: var(--wood); background: var(--wood-soft); }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; margin-bottom: 14px; font-weight: 600; }
.switch { position: relative; }
.switch input { position: absolute; top: 0; left: 0; opacity: 0; width: 1px; height: 1px; min-height: 0; margin: 0; }
.switch .track { flex: none; width: 44px; height: 24px; border-radius: 12px; background: #c3cfdd; position: relative; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + .track { background: var(--wood); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid #f0a54a; outline-offset: 2px; }

/* live preview */
.live-figure { background: #fbfdff; border: 1px solid var(--line); border-radius: 8px; aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden; margin-bottom: 14px; }
.live-figure.busy svg { opacity: .55; transition: opacity .2s; }
.live-figure svg { width: 100%; height: 100%; }
.placeholder { color: var(--muted); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 10px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.facts > div { display: contents; }
.facts .total dt, .facts .total dd { border-top: 1px solid var(--line); padding-top: 8px; color: var(--wood-2); font-size: 1.1rem; font-weight: 700; }

/* ---- style library */
.style-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.style-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.style-card.current { border-color: var(--wood); box-shadow: 0 0 0 2px var(--wood-soft), var(--shadow); }
.style-pick-btn { background: #f2f6fb; border: 0; border-bottom: 1px solid var(--line); padding: 18px; cursor: pointer; display: block; width: 100%; }
.style-pick-btn img { width: 100%; height: auto; aspect-ratio: 4 / 3; transition: transform .2s; }
.style-pick-btn:hover img { transform: scale(1.03); }
.style-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.style-body p:not(.muted) { flex: 1; }
.style-body .btn { align-self: flex-start; }

/* ---- plan preview */
.plan-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.plan-head p { margin: 0; max-width: 680px; }
.plan-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; display: flex; flex-direction: column; min-width: 0; }
.stat .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.stat .v { font-size: 1.12rem; font-weight: 700; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .s { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.accent { background: var(--wood-soft); border-color: #ecc89f; }
.stat.accent .v { color: var(--wood-2); }
.warn-box { background: var(--warn-soft); border: 1px solid #f1d58a; border-radius: 9px; padding: 10px 14px; margin-bottom: 16px; color: #5f4300; }
.warn-box ul { margin: 4px 0 0; padding-left: 20px; }
.plan-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.drawings { padding: 0; overflow: hidden; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); background: #f2f6fb; overflow-x: auto; scrollbar-width: thin; }
.tabs button { font: inherit; font-weight: 600; border: 0; background: none; color: var(--muted); padding: 12px 16px; cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button:hover { color: var(--navy); }
.tabs button[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--wood); background: #fff; }
.panel { padding: 16px; }
.figs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.fig { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.fig.hero-fig { background: #fbfdff; }
.fig-open { display: block; width: 100%; border: 0; padding: 8px; background: none; cursor: zoom-in; flex: 1; }
.fig-open svg { width: 100%; height: auto; max-height: 640px; display: block; margin: 0 auto; }
.fig.hero-fig .fig-open svg { max-height: 420px; }
.fig figcaption { font-size: .85rem; font-weight: 600; color: var(--navy-2); padding: 7px 10px; border-top: 1px solid var(--line); background: #f7f9fc; }
.span2 { grid-column: 1 / -1; }

/* tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
table.data caption { text-align: left; font-weight: 700; color: var(--navy); padding: 0 0 8px; caption-side: top; }
table.data th, table.data td { padding: 7px 10px; border-bottom: 1px solid #e3eaf3; text-align: left; vertical-align: top; }
table.data thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #f7f9fc; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data .num { text-align: right; white-space: nowrap; }
table.data tr.group th { background: #eaf0f8; color: var(--navy); font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }
table.cuts td:nth-child(2) { white-space: nowrap; }

/* AI panel */
.ai { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; }
.ai .summary { font-size: .95rem; }
.ai ul { padding-left: 18px; margin: 0 0 6px; }
.ai li { margin-bottom: 4px; font-size: .9rem; }
.ai-loading { display: flex; gap: 12px; align-items: flex-start; color: var(--muted); font-size: .9rem; }
.spinner { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--wood); animation: spin .9s linear infinite; margin-top: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } * { transition: none !important; } }
.tweaks { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.tweak { font: inherit; text-align: left; border: 1px dashed var(--wood); background: var(--wood-soft); color: var(--wood-2); border-radius: 8px; padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.tweak:hover { background: #f8e1c4; }
.tweak small { color: #6f4d2c; }
.tweak.done { border-style: solid; border-color: var(--ok); background: #e7f5ee; color: var(--ok); }
.tweak:disabled { cursor: default; }
.disclaimer { margin-top: 18px; font-size: .84rem; color: var(--muted); border-left: 3px solid var(--wood); padding-left: 12px; max-width: 900px; }

/* ---- materials */
.mat-controls { display: grid; grid-template-columns: 320px 1fr auto; gap: 20px; align-items: center; margin-bottom: 16px; }
.mat-controls p { margin: 0; }
.field.inline { gap: 6px; }
.waste-wrap { display: flex; align-items: center; gap: 12px; }
.waste-wrap input { margin: 0; padding: 0; min-height: 0; border: 0; accent-color: var(--wood); }
.waste-wrap output { font-weight: 700; color: var(--wood-2); min-width: 3em; text-align: right; }
.mat-total { text-align: right; display: flex; flex-direction: column; }
.mat-total span { font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.mat-total strong { font-size: 1.8rem; color: var(--wood-2); font-variant-numeric: tabular-nums; }
#mat-tables { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.mat-cat { padding: 14px 16px 6px; }
table.mat caption { font-size: 1.05rem; }
table.mat caption .cat-total { float: right; }
table.mat .cat-total { color: var(--wood-2); font-variant-numeric: tabular-nums; }
table.mat th:first-child { width: 46%; }
table.mat th:nth-child(2) { width: 14%; }
table.mat th:nth-child(3) { width: 26%; }
table.mat th:nth-child(4) { width: 14%; }
table.mat .item { font-weight: 600; }
table.mat .unit { color: var(--muted); font-size: .82rem; }
.price-wrap { display: inline-flex; align-items: center; gap: 3px; }
.price-wrap .cur { color: var(--muted); }
input.price { display: inline-block; margin: 0; width: 92px; min-height: 32px; padding: 4px 8px; text-align: right; font-variant-numeric: tabular-nums; }
input.price[aria-invalid="true"] { border-color: var(--bad); background: var(--bad-soft); }
.tag { display: inline-block; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; padding: 1px 6px; border-radius: 4px; font-weight: 700; vertical-align: middle; }
.tag.example { background: #e8eef7; color: #4b5d75; }
td .tag.example { margin-left: 6px; }
.line { font-weight: 600; }

/* ---- downloads */
.dl-name { max-width: 520px; margin-bottom: 16px; }
.dl-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.dl { display: flex; flex-direction: column; gap: 6px; }
.dl > p:not(.muted) { flex: 1; color: #3b4a5e; font-size: .92rem; }
.dl .btn { margin-top: 6px; }
.dl img { margin-bottom: 4px; }

/* ---- auth */
.auth { max-width: 440px; margin: 20px auto; padding: 0 0 20px; overflow: hidden; }
.auth-tabs { margin-bottom: 18px; }
.auth-tabs button { flex: 1; }
.auth .form, .auth .notice { padding: 0 22px; display: flex; flex-direction: column; gap: 14px; }
.auth .notice { margin: 0 22px 14px; padding: 10px 12px; }
.auth .form .form-error { margin: 0; }

/* ---- my plans */
.plan-list { display: grid; gap: 12px; }
.saved { display: flex; align-items: center; gap: 16px; padding: 14px 18px; }
.saved.current { border-color: var(--wood); }
.saved img { flex: none; background: #f2f6fb; border-radius: 8px; padding: 6px; }
.saved-main { flex: 1; min-width: 0; }
.saved-main h2 { margin: 0 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-main p { margin: 0; }
.saved-actions { display: flex; gap: 8px; }

/* ---- footer, viewer, toasts */
.footer { background: var(--navy); color: #c6d4e7; font-size: .85rem; padding: 18px 0; border-top: 3px solid var(--wood); }
.footer p { margin: 0 0 4px; max-width: 900px; }
.footer strong { color: #fff; }
.footer .muted { color: #93a8c4; }
dialog#viewer { width: min(1100px, 96vw); height: min(860px, 92vh); padding: 0; border: 0; border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
dialog#viewer[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgba(10, 25, 45, .6); }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #f2f6fb; color: var(--navy); }
.viewer-bar span { display: flex; gap: 6px; }
.viewer-body { flex: 1; overflow: auto; padding: 14px; background: #fff; display: flex; }
.viewer-body svg { margin: auto; max-height: 100%; height: auto; }
.viewer-body svg.zoomed { max-height: none; margin: 0; flex: none; }
.toasts { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); font-size: .9rem; border-left: 4px solid #7fa6d6; animation: rise .2s ease-out; }
.toast.ok { border-left-color: #5cc48d; }
.toast.error { background: #5b1611; border-left-color: #ff8a80; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* ---- responsive */
@media (max-width: 1100px) {
  .design-grid, .plan-grid { grid-template-columns: minmax(0, 1fr); }
  .live, .ai { position: static; max-height: none; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mat-controls { grid-template-columns: 1fr auto; }
  .mat-controls p { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .wrap { padding: 0 14px; }
  .topbar-in { flex-wrap: wrap; gap: 0 12px; min-height: 0; padding-top: 8px; }
  .brand { flex: 1; }
  .nav { order: 3; flex: 0 0 100%; padding: 6px 0 8px; }
  .nav a { padding: 6px 10px; }
  main { padding-top: 16px; }
  h1 { font-size: 1.4rem; }
  .card { padding: 16px; }
  .row4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .style-pick { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .style-grid { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figs { grid-template-columns: minmax(0, 1fr); }
  .dl-grid { grid-template-columns: minmax(0, 1fr); }
  .mat-controls { grid-template-columns: minmax(0, 1fr); }
  .mat-total { text-align: left; }
  .plan-head { align-items: flex-start; }
  .saved { flex-wrap: wrap; }
  .saved img { width: 64px; height: auto; }
  .saved-actions { flex: 0 0 100%; }
  .actions .btn { flex: 1; }
  table.data th, table.data td { padding: 6px 6px; }
  /* material rows become small cards: item on top, qty | price | line total below */
  table.mat, table.mat caption, table.mat tbody { display: block; width: 100%; }
  table.mat caption { padding: 4px 0 8px; }
  table.mat thead { display: none; }
  table.mat tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.mat td { display: block; padding: 0; border: 0; }
  table.mat tr:last-child { border-bottom: 0; }
  table.mat td:first-child { grid-column: 1 / -1; }
  table.mat td.qty { text-align: left; }
  table.mat td.line { min-width: 5.5em; }
  table.mat .tag.example { display: table; margin: 4px 0 0 auto; }
  table.mat .tag.example[hidden] { display: none; }
  table.mat td .price-wrap { white-space: nowrap; }
  input.price { width: 74px; }
  .mat-cat { padding: 12px 10px 4px; }
}
@media (max-width: 420px) { .chips { grid-template-columns: minmax(0, 1fr); } }
@media print { .topbar, .footer, .plan-actions, .ai, .tabs { display: none; } body { background: #fff; } }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .4s, transform .4s; }
