:root {
  --bg: #edf1f0;
  --surface: #ffffff;
  --surface-2: #f5f8f7;
  --surface-3: #e5ebe9;
  --ink: #13201e;
  --ink-2: #46544f;
  --ink-3: #7a8986;
  --line: #d6dfdc;
  --accent: #0b6e69;
  --accent-press: #08524e;
  --accent-ink: #ffffff;
  --accent-soft: #dcefec;
  --good: #2f7d4b;
  --good-soft: #ddf0e3;
  --warn: #9a6210;
  --warn-soft: #f6e8cf;
  --bad: #b3342a;
  --bad-soft: #f7deda;
  --scrim: rgba(10, 20, 19, 0.42);
  --shadow: 0 1px 2px rgba(19, 32, 30, 0.06), 0 6px 20px rgba(19, 32, 30, 0.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", Tahoma, sans-serif;
  --mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1312;
    --surface: #141d1c;
    --surface-2: #1a2625;
    --surface-3: #22302e;
    --ink: #e4ecea;
    --ink-2: #a9b8b4;
    --ink-3: #75857f;
    --line: #2a3836;
    --accent: #3cb4aa;
    --accent-press: #5cc9bf;
    --accent-ink: #04201d;
    --accent-soft: #15393a;
    --good: #62c485;
    --good-soft: #173323;
    --warn: #e2aa4c;
    --warn-soft: #3a2c12;
    --bad: #f07a6d;
    --bad-soft: #401d1a;
    --scrim: rgba(0, 0, 0, 0.6);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1312;
  --surface: #141d1c;
  --surface-2: #1a2625;
  --surface-3: #22302e;
  --ink: #e4ecea;
  --ink-2: #a9b8b4;
  --ink-3: #75857f;
  --line: #2a3836;
  --accent: #3cb4aa;
  --accent-press: #5cc9bf;
  --accent-ink: #04201d;
  --accent-soft: #15393a;
  --good: #62c485;
  --good-soft: #173323;
  --warn: #e2aa4c;
  --warn-soft: #3a2c12;
  --bad: #f07a6d;
  --bad-soft: #401d1a;
  --scrim: rgba(0, 0, 0, 0.6);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.noscript { padding: 16px; }
.num { font-variant-numeric: tabular-nums; }
svg.i { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- app bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 2px;
  padding: calc(var(--safe-t) + 6px) 6px 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  min-height: 60px;
}
.appbar .ttl { flex: 1; min-width: 0; padding: 0 8px; }
.appbar .ttl h1 { font-size: 17px; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar .ttl p { margin: 0; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brandmark { width: 34px; height: 34px; margin-inline-start: 6px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: 13px; letter-spacing: .02em; }
.iconbtn {
  width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: var(--ink);
  display: inline-grid; place-items: center; flex: none;
}
.iconbtn:active { background: var(--surface-3); }
.iconbtn.accent { color: var(--accent); }

/* ---------- layout ---------- */
.content { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(120px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.with-tabs .content { padding-bottom: calc(var(--tabbar-h) + 110px + var(--safe-b)); }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin: 6px 2px -4px; }
.muted { color: var(--ink-3); }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 650; font-size: 15px; text-decoration: none;
}
.btn:active { background: var(--surface-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:active { background: var(--accent-press); }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn.lg { min-height: 54px; font-size: 16px; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.linkbtn { border: 0; background: none; color: var(--accent); font-weight: 650; padding: 8px 4px; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
  padding: 10px 16px calc(10px + var(--safe-b));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.with-tabs .dock { bottom: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: 10px; }
.dock > * { max-width: 688px; margin: 0 auto; }

/* ---------- cards & lists ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 13px 12px 13px 14px;
}
button.item:active { background: var(--surface-2); }
.item .t { font-weight: 650; font-size: 15.5px; overflow-wrap: anywhere; }
.item .s { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.item .chev { color: var(--ink-3); }
.item.sel { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.check { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line); display: grid; place-items: center; flex: none; color: var(--accent-ink); }
.item.sel .check { background: var(--accent); border-color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.tag { font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); font-weight: 550; }
.tag b { color: var(--ink); }
.empty { text-align: center; padding: 34px 18px; color: var(--ink-3); }
.empty h3 { color: var(--ink); margin: 0 0 6px; font-size: 17px; }
.empty p { margin: 0 auto; max-width: 34ch; }

/* ---------- stat strip ---------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 11px; min-width: 0; }
.stat .l { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v { font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; overflow-wrap: anywhere; }
.stat .v.small { font-size: 14px; line-height: 1.3; font-weight: 700; }
.stat .sub { margin-top: 3px; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; background: var(--surface-3); color: var(--ink-2); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tabbar button {
  flex: 1; height: var(--tabbar-h); border: 0; background: none; color: var(--ink-3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 12px; font-weight: 650; position: relative;
}
.tabbar button.on { color: var(--accent); }
.tabbar button.on::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.tabbar .cnt { font-variant-numeric: tabular-nums; }

/* ---------- segmented / chips ---------- */
.seg { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 7px 12px; border-radius: 8px; font-weight: 650; font-size: 13.5px; color: var(--ink-2); min-height: 36px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.scrollx { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 1px 4px; margin: 0 -16px; padding-inline: 16px; }
.scrollx::-webkit-scrollbar { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  min-height: 42px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14.5px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip:active { background: var(--surface-3); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.soft { background: var(--surface-2); font-weight: 550; font-size: 13.5px; min-height: 38px; }
.chip.recent { max-width: 100%; white-space: normal; text-align: start; line-height: 1.2; padding-block: 6px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .flabel { font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.input {
  width: 100%; min-height: 50px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); font-size: 17px;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.big { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; }
.input.code { font-family: var(--mono); letter-spacing: .06em; font-size: 20px; text-align: center; font-weight: 650; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stepper { display: grid; grid-template-columns: 56px 1fr 56px; gap: 8px; }
.stepper .btn { padding: 0; font-size: 22px; }
.err { color: var(--bad); font-size: 13px; font-weight: 600; }

/* ---------- product picker ---------- */
.picked {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--accent-soft); color: var(--ink); min-height: 54px;
}
.picked .t { font-weight: 750; font-size: 16.5px; line-height: 1.25; }
.picked.none { background: var(--surface-2); color: var(--ink-3); border: 1px dashed var(--line); }
.picked.none .t { font-weight: 600; }
.search { position: relative; }
.search svg { position: absolute; top: 14px; inset-inline-start: 13px; color: var(--ink-3); width: 20px; height: 20px; }
.search .input { padding-inline-start: 42px; font-size: 16px; }
.sugg { display: flex; flex-direction: column; margin-top: 6px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.sugg button { text-align: start; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 11px 14px; font-weight: 600; min-height: 46px; }
.sugg button:last-child { border-bottom: 0; }
.sugg button:active, .sugg button.hl { background: var(--accent-soft); }
.sugg small { color: var(--ink-3); font-weight: 500; }
.pgroup { display: flex; flex-direction: column; gap: 7px; }

/* ---------- defect counters ---------- */
.dcat { display: flex; flex-direction: column; gap: 7px; }
.dcat h4 { margin: 4px 2px 0; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); font-weight: 750; }
.dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.dcell { display: flex; min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.dcell.on { border-color: var(--accent); background: var(--accent-soft); }
.dplus {
  flex: 1; min-width: 0; min-height: 58px; border: 0; background: none; text-align: start;
  display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 12px;
}
.dplus .n { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; line-height: 1.2; overflow-wrap: anywhere; }
.dplus .c { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent); min-width: 1ch; }
.dplus:active { background: var(--surface-3); }
.dminus { width: 42px; border: 0; border-inline-start: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 22px; font-weight: 700; }
.dcell.on .dminus { border-color: var(--accent); }
.dcell.single.on .dplus .n { font-weight: 750; }
.dgrid.single .dcell { cursor: pointer; }

/* ---------- sheets & dialogs ---------- */
.layer { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; justify-content: flex-end; background: var(--scrim); animation: fade .16s ease-out; }
.layer.center { justify-content: center; align-items: center; padding: 20px; }
.sheet {
  background: var(--bg); width: 100%; max-width: 760px; margin: 0 auto;
  border-radius: 18px 18px 0 0; display: flex; flex-direction: column; max-height: 100%;
  animation: up .2s cubic-bezier(.2,.8,.2,1);
}
.sheet.full { height: 100%; border-radius: 0; }
.sheet-head { display: flex; align-items: center; gap: 4px; padding: calc(var(--safe-t) + 6px) 6px 6px; background: var(--surface); border-bottom: 1px solid var(--line); border-radius: inherit; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.sheet:not(.full) .sheet-head { padding-top: 8px; }
.sheet-head h2 { flex: 1; margin: 0; padding: 0 8px; font-size: 17px; font-weight: 700; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 18px; overscroll-behavior: contain; }
.sheet-foot { padding: 10px 16px calc(10px + var(--safe-b)); background: var(--surface); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.sheet-foot .row .btn { flex: 1; }
.livebar { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-2); flex-wrap: wrap; }
.livebar b { color: var(--ink); font-variant-numeric: tabular-nums; }
.dialog { background: var(--surface); border-radius: 16px; width: 100%; max-width: 420px; padding: 18px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); animation: pop .16s ease-out; }
.dialog h3 { margin: 0; font-size: 18px; }
.dialog p { margin: 0; color: var(--ink-2); }
.dialog .row { justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .6; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .layer, .sheet, .dialog { animation: none; } }

.menu { display: flex; flex-direction: column; padding: 6px 0 calc(8px + var(--safe-b)); background: var(--surface); }
.menu button { display: flex; align-items: center; gap: 14px; border: 0; background: none; padding: 14px 20px; font-size: 16px; font-weight: 550; text-align: start; }
.menu button:active { background: var(--surface-3); }
.menu button.danger { color: var(--bad); }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; top: calc(var(--safe-t) + 66px); transform: translateX(-50%) translateY(-12px);
  z-index: 60; background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px;
  font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; box-shadow: var(--shadow);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
#toast button { border: 0; background: none; color: var(--accent-soft); font-weight: 800; padding: 4px; text-transform: uppercase; font-size: 13px; letter-spacing: .04em; }
.busy { position: fixed; inset: 0; z-index: 70; background: var(--scrim); display: grid; place-items: center; }
.busy div { background: var(--surface); padding: 16px 22px; border-radius: 14px; font-weight: 650; display: flex; gap: 12px; align-items: center; }
.spin { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- report (on screen) ---------- */
.rtools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.report { display: flex; flex-direction: column; gap: 14px; }
.report[dir="rtl"] { font-family: var(--font); }
.rsec { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.rsec > h3 { margin: 0; font-size: 16.5px; font-weight: 750; line-height: 1.3; padding-bottom: 8px; border-bottom: 2px solid var(--surface-3); }
.rsec h4 { margin: 0 0 6px; font-size: 13px; font-weight: 750; color: var(--accent); letter-spacing: .02em; }
.rsec h5 { margin: 6px 0 -4px; font-size: 15px; font-weight: 750; padding-top: 10px; border-top: 1px dashed var(--line); }
.rsec h5 small { font-weight: 600; color: var(--ink-3); font-size: 13px; }
.rkpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.rkpi { background: var(--surface-2); border-radius: 10px; padding: 9px 10px; min-width: 0; }
.rkpi .l { font-size: 11.5px; color: var(--ink-3); font-weight: 650; }
.rkpi .v { font-size: 21px; font-weight: 750; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.rkpi .v .pill { font-size: 12px; }
.rkpi .v small { font-size: 13px; color: var(--ink-3); font-weight: 650; }
.rline { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13.5px; color: var(--ink-2); }
.rline b { color: var(--ink); font-variant-numeric: tabular-nums; }
.facts { display: flex; flex-direction: column; }
.fact { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--surface-3); flex-wrap: wrap; }
.fact:last-child { border-bottom: 0; }
.fact .l { color: var(--ink-3); font-size: 13px; }
.fact .v { font-weight: 700; text-align: end; }
.fact .v small { color: var(--ink-3); font-weight: 600; margin-inline-start: 6px; font-variant-numeric: tabular-nums; unicode-bidi: isolate; display: inline-block; }
.fact .v small.good { color: var(--good); }
.fact .v small.warn { color: var(--warn); }
.fact .v small.bad { color: var(--bad); }
.tscroll { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
table.rt { border-collapse: collapse; width: 100%; font-size: 13.5px; font-variant-numeric: tabular-nums; }
table.rt th { text-align: start; font-size: 11.5px; font-weight: 750; color: var(--ink-2); background: var(--surface-2); padding: 7px 6px; min-width: 64px; max-width: 150px; vertical-align: bottom; }
table.rt th.e, table.rt td.e { text-align: end; }
table.rt td { padding: 7px 6px; border-bottom: 1px solid var(--surface-3); vertical-align: middle; }
table.rt td.s { min-width: 96px; }
@media (max-width: 520px) { table.rt .hn { display: none; } }
table.rt td.strong { font-weight: 650; }
table.rt td.muted { color: var(--ink-2); }
table.rt tr.total td { font-weight: 750; border-top: 2px solid var(--ink); border-bottom: 0; }
table.rt td.bar { background-image: linear-gradient(to right, var(--accent-soft) var(--bar), transparent var(--bar)); background-repeat: no-repeat; }
.report[dir="rtl"] table.rt td.bar { background-image: linear-gradient(to left, var(--accent-soft) var(--bar), transparent var(--bar)); }
.legend { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.note { color: var(--ink-3); font-style: italic; margin: 0; }

/* ---------- settings ---------- */
.set-sec { display: flex; flex-direction: column; gap: 10px; }
.set-sec > h2 { margin: 8px 2px 0; font-size: 13px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.ed { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.ed-head { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.ed-head .t { flex: 1; font-weight: 750; font-size: 15.5px; min-width: 0; }
.ed-row { display: flex; align-items: center; gap: 2px; padding: 2px 4px 2px 14px; border-bottom: 1px solid var(--surface-3); min-height: 48px; }
.ed-row:last-child { border-bottom: 0; }
.ed-row .t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ed-row .iconbtn { width: 40px; height: 40px; color: var(--ink-3); }
.ed-row .iconbtn svg, .ed-head .iconbtn svg { width: 19px; height: 19px; }
.ed-add { display: block; width: 100%; border: 0; background: none; color: var(--accent); font-weight: 700; text-align: start; padding: 13px 14px; }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; flex-wrap: wrap; }
.setrow > div:first-child { flex: 1 1 170px; min-width: 0; }
.setrow .t { font-weight: 650; }
.setrow .s { font-size: 13px; color: var(--ink-3); }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line); transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.mini-input { width: 76px; min-height: 42px; text-align: center; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- export ---------- */
.exp-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.exp-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); text-align: start; min-height: 96px;
}
.exp-btn:active { background: var(--surface-3); }
.ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.exp-btn .t { font-weight: 750; font-size: 15px; }
.exp-btn .s { font-size: 12.5px; color: var(--ink-3); line-height: 1.3; }
.optlist { display: flex; flex-direction: column; gap: 6px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); min-height: 48px; }
.opt input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.opt span { flex: 1; font-weight: 600; }
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gallery figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.gallery img { display: block; width: 100%; height: auto; }
.gallery figcaption { font-size: 12px; padding: 6px 8px; color: var(--ink-2); font-weight: 600; }
.textprev { width: 100%; min-height: 220px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 12px; font: 13px/1.45 var(--font); resize: vertical; }

@media (min-width: 560px) {
  .dgrid { grid-template-columns: repeat(3, 1fr); }
  .exp-actions { grid-template-columns: repeat(4, 1fr); }
  .gallery { grid-template-columns: repeat(3, 1fr); }
}
