:root {
  --bg: #f4f6fa; --surface: #fff; --surface-2: #eef1f6; --border: #e1e6ee; --text: #121826; --muted: #64708a;
  --accent: #0f766e; --accent-2: #0891b2; --accent-hover: #0b5f58; --accent-soft: #e0f5f1; --on-accent: #fff;
  --good: #15803d; --good-soft: #e3f5e8; --warn: #b45309; --warn-soft: #fdf0d9; --bad: #b42318; --bad-soft: #fde8e6;
  --info: #1d4ed8; --info-soft: #e5edff;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(16 24 40 / .05), 0 1px 3px rgb(16 24 40 / .04);
  --shadow-lg: 0 10px 30px -8px rgb(16 24 40 / .18);
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --side-w: 236px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0f14; --surface: #151a22; --surface-2: #1c222c; --border: #283040; --text: #e8ecf3; --muted: #94a0b8;
    --accent: #2dd4bf; --accent-2: #38bdf8; --accent-hover: #5eead4; --accent-soft: #0f2f2c; --on-accent: #04201c;
    --good: #4ade80; --good-soft: #10301c; --warn: #fbbf24; --warn-soft: #33260c; --bad: #f87171; --bad-soft: #3a1714;
    --info: #7aa2ff; --info-soft: #14233f;
    --shadow: none; --shadow-lg: 0 10px 30px -8px rgb(0 0 0 / .6);
  }
}
:root[data-theme="dark"] {
  --bg: #0c0f14; --surface: #151a22; --surface-2: #1c222c; --border: #283040; --text: #e8ecf3; --muted: #94a0b8;
  --accent: #2dd4bf; --accent-2: #38bdf8; --accent-hover: #5eead4; --accent-soft: #0f2f2c; --on-accent: #04201c;
  --good: #4ade80; --good-soft: #10301c; --warn: #fbbf24; --warn-soft: #33260c; --bad: #f87171; --bad-soft: #3a1714;
  --info: #7aa2ff; --info-soft: #14233f;
  --shadow: none; --shadow-lg: 0 10px 30px -8px rgb(0 0 0 / .6);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.02em; font-weight: 700; }
h2 { font-size: 16px; margin: 0 0 10px; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: 14px; margin: 0 0 6px; font-weight: 650; }
p { margin: 0 0 10px; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.icon { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -.2em; }

/* layout */
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
main.wrap { padding-top: 26px; padding-bottom: 56px; }
.topbar { background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar::before { content: ""; display: block; height: 3px; background: var(--grad); }
.topbar .wrap { display: flex; align-items: center; gap: 16px; height: 56px; }
.topbar .wrap.wide { max-width: none; }
.brand { font-weight: 800; font-size: 18px; color: var(--text); letter-spacing: -.03em; display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 2px; }
.nav a { color: var(--muted); padding: 7px 12px; border-radius: 8px; font-weight: 550; display: inline-flex; gap: 7px; align-items: center; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.topbar .spacer { flex: 1; }
.searchbox { flex: 1; max-width: 380px; position: relative; }
.searchbox input { width: 100%; background: var(--surface-2); border-color: transparent; padding-left: 34px; border-radius: 999px; }
.searchbox input:focus { background: var(--surface); border-color: var(--accent); }
.searchbox .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .muted { max-width: 70ch; }
.stack > * + * { margin-top: 18px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.products { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
@media (max-width: 800px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .nav a span { display: none; }
  .searchbox { display: none; }
}
@media (max-width: 520px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

/* console shell: sidebar + content */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: calc(100vh - 59px); }
.shell > main.wrap { max-width: 1280px; width: 100%; margin: 0; }
.side { background: var(--surface); border-right: 1px solid var(--border); padding: 18px 12px; position: sticky; top: 59px; height: calc(100vh - 59px); overflow-y: auto; }
.side h4 { margin: 14px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.side h4:first-child { margin-top: 0; }
.side a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--muted); font-weight: 550; }
.side a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.side a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.side a .badge { margin-left: auto; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; display: flex; gap: 4px; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--border); }
  .side h4 { display: none; }
  .side a { white-space: nowrap; }
}

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card.lift { transition: box-shadow .15s, transform .15s, border-color .15s; }
.card.lift:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.card-head h2 { margin: 0; }
.stat { display: flex; flex-direction: column; gap: 2px; position: relative; padding-left: 70px; min-height: 84px; justify-content: center; }
.stat .ico { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.stat .ico .icon { width: 20px; height: 20px; }
.stat.good .ico { background: var(--good-soft); color: var(--good); }
.stat.bad .ico { background: var(--bad-soft); color: var(--bad); }
.stat.warn .ico { background: var(--warn-soft); color: var(--warn); }
.stat.info .ico { background: var(--info-soft); color: var(--info); }
.stat .label { color: var(--muted); font-size: 12px; font-weight: 600; }
.stat .value { font-size: 26px; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .sub { font-size: 12px; color: var(--muted); }
.stat.good .value { color: var(--good); } .stat.bad .value { color: var(--bad); }

/* controls */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 11px; min-height: 36px; width: 100%;
}
input[type=checkbox] { width: auto; min-height: 0; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
label { font-weight: 550; font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.field .help { color: var(--muted); font-size: 12px; margin-top: 3px; }
.errorlist { list-style: none; margin: 3px 0 0; padding: 0; color: var(--bad); font-size: 12px; }
.btn {
  font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; border-color: color-mix(in srgb, var(--muted) 40%, var(--border)); }
.btn.primary { background: var(--grad); border-color: transparent; color: var(--on-accent); box-shadow: 0 1px 2px rgb(0 0 0 / .15); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: transparent; }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 12px; }
.btn.icon-only { padding: 0; width: 30px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.inline-form { display: inline; margin: 0; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13px; color: var(--text); margin: 0; }

/* chips, badges */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); font-weight: 550; font-size: 12px; }
.chip:hover { color: var(--text); text-decoration: none; border-color: var(--muted); }
.chip.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; background: var(--surface-2); color: var(--muted); }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge .pulse { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.7); } }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
th.right, td.right { text-align: right; }
.progress { height: 7px; border-radius: 4px; background: var(--surface-2); overflow: hidden; min-width: 60px; }
.progress > span { display: block; height: 100%; background: var(--grad); border-radius: 4px; }
.progress.hot > span { background: var(--bad); }
.progress.busy > span { width: 35%; animation: slide 1.3s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }

/* products */
.product { display: flex; flex-direction: column; gap: 8px; padding: 14px; }
.product .thumb { height: 130px; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 10px; border: 1px solid var(--border); overflow: hidden; }
.product .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.product .name { font-weight: 650; color: var(--text); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 36px; }
.product .brand { font-size: 12px; color: var(--muted); }
.price { font-size: 19px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.price.big { font-size: 32px; }
.old-price { color: var(--muted); text-decoration: line-through; font-size: 12px; }
.shop-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; padding: 4px 0; }
.shop-line .who { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.shop-line.best .who { color: var(--text); font-weight: 650; }
.shop-line.best .num { color: var(--good); font-weight: 750; }
.hero-thumb { width: 130px; height: 130px; background: #fff; border-radius: 12px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; flex: none; overflow: hidden; }
.hero-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.chart-box { position: relative; height: 320px; }
.chart-box.short { height: 220px; }

/* feedback */
.messages { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: min(400px, calc(100vw - 36px)); }
.toast { background: var(--text); color: var(--bg); padding: 11px 15px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 550; animation: rise .25s ease-out; }
.toast.error { background: var(--bad); color: #fff; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
.empty { text-align: center; padding: 44px 16px; color: var(--muted); }
.empty h2 { color: var(--text); }
.pager { display: flex; justify-content: center; gap: 8px; align-items: center; margin-top: 16px; }
.log { background: #0d1117; color: #c9d1d9; padding: 14px; border-radius: var(--radius); font: 12px/1.55 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; max-height: 460px; overflow: auto; margin: 0; }
details.pop { position: relative; }
details.pop > summary { list-style: none; cursor: pointer; }
details.pop > summary::-webkit-details-marker { display: none; }
details.pop .panel { position: absolute; right: 0; top: calc(100% + 6px); width: 280px; z-index: 5; box-shadow: var(--shadow-lg); }
.hint { background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 11px 14px; font-size: 13px; }
.warning { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 11px 14px; font-size: 13px; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent), var(--bg); }
.auth .card { width: 100%; max-width: 380px; padding: 28px; box-shadow: var(--shadow-lg); }
.auth .brand { justify-content: center; margin-bottom: 4px; font-size: 22px; }
.auth .tagline { text-align: center; color: var(--muted); margin-bottom: 18px; }
.auth-foot { text-align: center; margin-top: 14px; color: var(--muted); }

/* task manager */
.task { display: flex; flex-direction: column; gap: 10px; border-top: 3px solid var(--tc, var(--accent)); }
.task header { display: flex; align-items: center; gap: 8px; }
.task header h3 { margin: 0; flex: 1; font-size: 15px; }
.task .info { color: var(--muted); font-size: 12.5px; min-height: 36px; }
.task .metrics { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; min-height: 20px; }
.task .metrics b { font-variant-numeric: tabular-nums; }
.task .actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.task .actions input[type=number] { width: 84px; min-height: 30px; padding: 4px 8px; font-size: 12px; }
.task .when-active { display: none; }
.task.is-active .when-active { display: flex; }
.task.is-active .when-idle { display: none; }
.task .last { font-size: 12px; color: var(--muted); }
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }

/* category manager */
.cat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .cat-layout { grid-template-columns: 1fr; } }
.cat-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.cat-tools .grow { flex: 1; min-width: 180px; position: relative; }
.cat-tools .grow input { padding-left: 32px; }
.cat-tools .grow .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 15px; }
.tree { list-style: none; margin: 0; padding: 8px; }
.tree ul { list-style: none; margin: 0; padding-left: 22px; position: relative; }
.tree ul::before { content: ""; position: absolute; left: 10px; top: 0; bottom: 14px; border-left: 1px dashed var(--border); }
.node { position: relative; }
.node-row { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 9px; border: 1px solid transparent; cursor: default; }
.node-row:hover { background: var(--surface-2); }
.node-row .grip { color: var(--muted); cursor: grab; opacity: .45; }
.node-row:hover .grip { opacity: 1; }
.node-row .twist { width: 22px; height: 22px; border-radius: 6px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; padding: 0; }
.node-row .twist:hover { background: var(--border); }
.node-row .twist .icon { transition: transform .12s; }
.node.open > .node-row .twist .icon { transform: rotate(90deg); }
.node-row .twist.leaf { visibility: hidden; }
.node-row .label { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.node-row .label input { min-height: 28px; padding: 2px 8px; }
.node-row .counts { display: flex; gap: 4px; }
.node-row .tools { display: flex; gap: 2px; opacity: 0; }
.node-row:hover .tools, .node-row:focus-within .tools { opacity: 1; }
.node:not(.open) > ul { display: none; }
.node.selected > .node-row { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.node.dragging > .node-row { opacity: .4; }
.node-row.drop-into { background: var(--accent-soft); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.node-row.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.node-row.drop-after { box-shadow: 0 3px 0 var(--accent); }
.node.match > .node-row .label { color: var(--accent); }
.node.hidden { display: none; }
.cat-side { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 14px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12.5px; color: var(--muted); }
.crumbs b { color: var(--text); }
.tip { font-size: 12px; color: var(--muted); }
.kbd { border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: 11px; background: var(--surface-2); }

/* product comparison */
.cmp { display: grid; gap: 16px; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }
@media (max-width: 800px) { .cmp { grid-template-columns: 1fr; } }
.cmp-card { position: relative; display: flex; flex-direction: column; gap: 12px; }
.cmp-card.win { border-color: var(--good); box-shadow: 0 0 0 1px var(--good), var(--shadow); }
.cmp-card .ribbon { position: absolute; top: -10px; right: 14px; }
.cmp-card .top { display: flex; gap: 12px; align-items: flex-start; }
.cmp-card .top .hero-thumb { width: 84px; height: 84px; }
.cmp-card h3 { font-size: 15px; margin: 0 0 2px; line-height: 1.3; }
.cmp-shops { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.cmp-shops .shop-line { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.cmp-shops .shop-line:last-child { border-bottom: 0; }
.verdict { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 12px; background: var(--good-soft); color: var(--good); font-weight: 600; }
.ac { position: relative; flex: 1; min-width: 220px; }
.ac-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 30; max-height: 360px; overflow-y: auto; padding: 4px; }
.ac-item { display: flex; gap: 10px; align-items: center; padding: 7px 9px; border-radius: 9px; cursor: pointer; color: var(--text); }
.ac-item:hover, .ac-item[aria-selected="true"] { background: var(--accent-soft); text-decoration: none; }
.ac-item img { width: 36px; height: 36px; object-fit: contain; background: #fff; border-radius: 6px; border: 1px solid var(--border); }
.ac-item .t { flex: 1; min-width: 0; }
.ac-item .t b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-empty { padding: 12px; color: var(--muted); }
.stat:not(:has(.ico)) { padding-left: 16px; min-height: 0; }
.unit-line { display: flex; gap: 6px; flex-wrap: wrap; }
.sec h3 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kv { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 6px 14px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.proof-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.proof-row:last-child { border-bottom: 0; }
.proof-row .hash { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.fold > summary { cursor: pointer; font-weight: 650; padding: 4px 0; }
.nutri { white-space: pre-line; }

.pause-banner { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 9px 16px; background: var(--bad); color: #fff; font-size: 13px; }
.pause-banner .btn { background: #fff; color: var(--bad); border-color: transparent; }
.master { margin-bottom: 18px; border-left: 4px solid var(--accent); }
.master .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.master.is-paused { border-left-color: var(--bad); background: var(--bad-soft); }
.master.is-paused .ico { background: var(--bad); color: #fff; }

/* product page: simple overview + tabs */
.overview { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .overview { grid-template-columns: 1fr; } }
.shops { display: flex; flex-direction: column; }
.shop-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.shop-row:last-child { border-bottom: 0; }
.shop-row.best { background: color-mix(in srgb, var(--good-soft) 55%, transparent); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 10px; overflow-x: auto; background: var(--surface-2); }
.tabs [role="tab"] { font: inherit; font-weight: 600; color: var(--muted); background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 12px 14px; cursor: pointer; white-space: nowrap; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: center; }
.tabs [role="tab"]:hover { color: var(--text); }
.tabs [role="tab"][aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); background: var(--surface); border-radius: 8px 8px 0 0; }
.tabpanel { padding: 18px; }
.tabpanel[hidden] { display: none; }
.proof { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
.proof .proof-row { background: var(--surface-2); }

/* ===== v2 UX layer: motion, switches, bigger targets ===== */
:root { --ease: cubic-bezier(.2,.8,.2,1); --spring: cubic-bezier(.34,1.56,.64,1); }
html { scroll-behavior: smooth; }
main.wrap { animation: page-in .38s var(--ease) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } }
.brand img { width: 30px; height: 30px; border-radius: 9px; box-shadow: 0 2px 6px rgb(3 105 161 / .35); transition: transform .35s var(--spring); }
.brand:hover img { transform: rotate(-8deg) scale(1.08); }
.auth .brand img { width: 44px; height: 44px; border-radius: 13px; }
.btn { transition: background .15s, border-color .15s, box-shadow .15s, transform .12s var(--ease), filter .15s; min-height: 38px; }
.btn.sm { min-height: 32px; }
.btn:active { transform: scale(.96); }
.chip { transition: all .18s var(--ease); cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 550; padding: 6px 13px; }
.chip:active { transform: scale(.95); }
.chip.on { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent) inset; }
.card.product { transition: box-shadow .2s var(--ease), transform .2s var(--ease), border-color .2s; }
.card.product:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.product .thumb img { transition: transform .35s var(--ease); }
.card.product:hover .thumb img { transform: scale(1.06); }
.nav a, .side a { transition: background .15s, color .15s; }
tbody tr { transition: background .12s; }
.toast { animation: rise .3s var(--spring); transition: opacity .4s, transform .4s; }
.toast.leave { opacity: 0; transform: translateX(20px); }
.link-btn { background: none; border: 0; color: var(--accent); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.link-btn:hover { background: var(--accent-soft); }
mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
@media (hover: none) { .btn, .chip, .nav a { min-height: 42px; } }

/* thin progress line while something loads */
body.busy-top::after { content: ""; position: fixed; top: 0; left: 0; height: 3px; width: 40%; background: var(--grad); z-index: 100; animation: slide 1s ease-in-out infinite; }

/* switches */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; margin: 0; font-weight: 550; font-size: 13px; color: var(--text); user-select: none; padding: 6px 0; position: relative; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 42px; height: 24px; border-radius: 999px; background: var(--border); position: relative; flex: none; transition: background .2s var(--ease); }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .25s var(--spring), width .15s; }
.switch input:checked + .track { background: var(--grad); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch:active .track::after { width: 22px; }
.switch:active input:checked + .track::after { transform: translateX(14px); }
.sm-card.saving { opacity: .75; }
.sm-card.saved { animation: flash-ok .9s var(--ease); }
@keyframes flash-ok { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 55%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }

/* shop category translation page */
.shop-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.shop-tab { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 600; transition: all .18s var(--ease); }
.shop-tab:hover { color: var(--text); text-decoration: none; transform: translateY(-1px); }
.shop-tab.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.searchbox.inline { position: relative; min-width: 220px; flex: 1; max-width: none; }
.searchbox.inline input { background: var(--surface); border-color: var(--border); border-radius: 999px; }
.save-bar { position: sticky; bottom: 0; margin-top: 12px; padding: 12px 14px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 5; }
tr.changed td { background: var(--warn-soft); }
tr.focus td { animation: focus-row 2.4s var(--ease); }
@keyframes focus-row { 0%, 60% { background: var(--accent-soft); } }
tr[hidden] { display: none; }
.shelf-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin: 0 -10px; border-radius: 9px; color: var(--text); transition: background .15s; }
.shelf-row:hover { background: var(--surface-2); text-decoration: none; }
.shelf-row > span:nth-child(2) { flex: 1; font-weight: 600; }

/* duplicates review */
.dup { transition: max-height .45s var(--ease), opacity .35s, transform .35s var(--ease), padding .45s, margin .45s; overflow: hidden; }
.dup.busy { opacity: .6; pointer-events: none; }
.dup.gone { max-height: 0 !important; opacity: 0; transform: translateX(40px); padding-top: 0; padding-bottom: 0; margin-top: 0 !important; border-width: 0; }
.dup-head { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.dup-sides { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: stretch; }
.dup-side { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.dup-thumb { width: 80px; height: 80px; flex: none; background: #fff; border: 1px solid var(--border); border-radius: 10px; display: grid; place-items: center; overflow: hidden; }
.dup-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.dup-side .btn { margin-top: 8px; }
.dup-eq { align-self: center; font-size: 26px; color: var(--muted); font-weight: 700; }
.dup-actions { margin-top: 14px; }
@media (max-width: 800px) { .dup-sides { grid-template-columns: 1fr; } .dup-eq { text-align: center; } }

/* product card: cheapest price first */
.best-block { display: flex; flex-direction: column; gap: 2px; }
.best-price { display: flex; align-items: baseline; gap: 8px; }
.best-at { display: flex; align-items: center; gap: 6px; font-size: 12.5px; flex-wrap: wrap; }
.others { border-top: 1px dashed var(--border); padding-top: 6px; }

/* explorer */
.explorer { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 20px; align-items: start; }
.filters { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 16px; scrollbar-width: thin; }
.filter-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.filter-title h3 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.filters-toggle { display: none; margin-bottom: 12px; }
.results-col { min-width: 0; }
.searchbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; position: sticky; top: 64px; z-index: 12; padding: 6px 0; background: var(--bg); }
.ac.big { position: relative; flex: 1; min-width: 240px; }
.ac.big > .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.ac.big input { padding-left: 40px; min-height: 46px; border-radius: 999px; font-size: 15px; box-shadow: var(--shadow); }
.sort { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); }
.sort select { width: auto; min-height: 40px; }
.ac-list { max-height: 440px; overflow-y: auto; animation: rise .18s var(--ease); }
.ac-group { padding: 8px 10px 3px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.ac-ico { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-weight: 700; flex: none; }
.ac-item { transition: background .1s; }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.fchip { display: inline-flex; align-items: center; gap: 7px; border: 0; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 8px 5px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); animation: pop .25s var(--spring); }
.fchip span { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--accent) 18%, transparent); font-size: 14px; line-height: 1; }
.fchip:hover span { background: var(--accent); color: var(--on-accent); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.results-head { margin-bottom: 12px; color: var(--muted); }
.results-head strong { color: var(--text); font-size: 16px; }
#results { transition: opacity .2s; }
#results.loading { opacity: .45; pointer-events: none; }
.reveal > * { animation: reveal .45s var(--ease) both; }
.reveal > *:nth-child(2) { animation-delay: .03s; } .reveal > *:nth-child(3) { animation-delay: .06s; } .reveal > *:nth-child(4) { animation-delay: .09s; }
.reveal > *:nth-child(5) { animation-delay: .12s; } .reveal > *:nth-child(6) { animation-delay: .15s; } .reveal > *:nth-child(n+7) { animation-delay: .18s; }
@keyframes reveal { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* category tree with tri-state boxes */
.ctree, .ctree ul { list-style: none; margin: 0; padding: 0; }
.ctree { margin-top: 8px; }
.ctree ul { padding-left: 14px; margin-left: 10px; border-left: 1px solid var(--border); }
.cnode[hidden] { display: none; }
.crow { display: flex; align-items: center; gap: 2px; }
.ctwist { width: 26px; height: 30px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 6px; display: grid; place-items: center; padding: 0; flex: none; }
.ctwist:hover { background: var(--surface-2); color: var(--text); }
.ctwist.leaf { visibility: hidden; }
.ctwist .icon { transition: transform .25s var(--spring); }
.cnode.open > .crow .ctwist .icon { transform: rotate(90deg); }
.cpick { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; margin: 0; padding: 6px 8px; border-radius: 8px; cursor: pointer; color: var(--text); font-weight: 550; font-size: 13px; transition: background .12s; position: relative; }
.cpick:hover { background: var(--surface-2); }
.cpick input { position: absolute; opacity: 0; width: 0; height: 0; }
.cbox { width: 18px; height: 18px; border-radius: 5px; border: 2px solid color-mix(in srgb, var(--muted) 55%, transparent); flex: none; display: grid; place-items: center; transition: all .18s var(--spring); }
.cbox::after { content: ""; width: 8px; height: 4px; border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: rotate(-45deg) scale(0) translate(1px, -1px); transition: transform .18s var(--spring); }
.cnode.is-on > .crow .cbox { background: var(--grad); border-color: transparent; }
.cnode.is-on > .crow .cbox::after { transform: rotate(-45deg) scale(1) translate(1px, -1px); }
.cnode.is-mid > .crow .cbox { background: var(--accent-soft); border-color: var(--accent); }
.cnode.is-mid > .crow .cbox::after { width: 8px; height: 0; border-left: 0; border-bottom: 2.5px solid var(--accent); transform: scale(1); }
.cpick input:focus-visible + .cbox { outline: 2px solid var(--accent); outline-offset: 2px; }
.cname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cnode.hit > .crow .cname { color: var(--accent); font-weight: 700; }
.ccount { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cnode.is-on > .crow .cname { font-weight: 700; }
.csub { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--ease); }
.csub > ul { overflow: hidden; min-height: 0; }
.cnode.open > .csub { grid-template-rows: 1fr; }
@media (max-width: 900px) {
  .explorer { grid-template-columns: 1fr; }
  .filters-toggle { display: inline-flex; }
  .filters { position: static; max-height: 0; padding-top: 0; padding-bottom: 0; overflow: hidden; border-width: 0; opacity: 0; transition: max-height .35s var(--ease), opacity .25s, padding .35s; }
  .explorer.filters-open .filters { max-height: 1400px; padding: 14px; border-width: 1px; opacity: 1; overflow-y: auto; }
  .searchbar { top: 60px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

.error-frame { width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: 10px; background: #fff; }

.route-tile { display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.route-tile .label { color: var(--muted); font-size: 12px; font-weight: 600; }
.route-tile .value { font-size: 24px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.route-tile .sub { color: var(--muted); font-size: 12px; }
.split { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.split > span { display: block; height: 100%; background: #7c3aed; border-radius: 4px; transition: width .6s var(--ease); }
.split.direct > span { background: #64748b; }

/* task schedules */
.sched { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; background: var(--accent-soft); color: var(--text); }
.sched.off { background: var(--surface-2); }
.sched-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface); color: var(--accent); flex: none; }
.sched.off .sched-ico { color: var(--muted); }
.sched-text { flex: 1; min-width: 0; font-size: 12.5px; line-height: 1.35; }
.sched-dialog { border: 0; border-radius: 16px; padding: 22px; width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.sched-dialog::backdrop { background: rgb(8 12 20 / .55); backdrop-filter: blur(3px); }
.sched-dialog[open] { animation: pop-in .25s var(--spring); }
@keyframes pop-in { from { opacity: 0; transform: scale(.92) translateY(10px); } }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; margin: 12px 0; }
.seg label { margin: 0; }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg span { display: block; text-align: center; padding: 9px 4px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--muted); transition: all .18s var(--ease); }
.seg input:checked + span { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.sched-pane { margin: 8px 0; }
.sched-pane[hidden] { display: none; }
.week { display: flex; gap: 6px; margin-top: 12px; }
.week label { margin: 0; }
.week input { position: absolute; opacity: 0; width: 0; height: 0; }
.week span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--border); cursor: pointer; font-weight: 650; color: var(--muted); transition: all .15s var(--spring); }
.week input:checked + span { background: var(--grad); color: var(--on-accent); border-color: transparent; transform: scale(1.06); }
.week input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* shop comparison */
.crumbs-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.matrix th, .matrix td { padding: 8px 10px; }
.matrix td strong { font-variant-numeric: tabular-nums; }
.matrix .tone { transition: filter .15s; }
.matrix .tone:hover { filter: brightness(.95); }
.tone-5, .tone5 { background: color-mix(in srgb, var(--bad) 38%, transparent); } .tone4 { background: color-mix(in srgb, var(--bad) 30%, transparent); }
.tone3 { background: color-mix(in srgb, var(--bad) 22%, transparent); } .tone2 { background: color-mix(in srgb, var(--bad) 14%, transparent); }
.tone1 { background: color-mix(in srgb, var(--bad) 7%, transparent); } .tone0 { background: transparent; }
.tone-1 { background: color-mix(in srgb, var(--good) 8%, transparent); } .tone-2 { background: color-mix(in srgb, var(--good) 15%, transparent); }
.tone-3 { background: color-mix(in srgb, var(--good) 23%, transparent); } .tone-4 { background: color-mix(in srgb, var(--good) 31%, transparent); }
.tone-5 { background: color-mix(in srgb, var(--good) 40%, transparent); }
.gaps { display: flex; flex-direction: column; }
.gap { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(140px, 1fr) auto; gap: 18px; align-items: center; padding: 12px 8px; border-bottom: 1px solid var(--border); color: var(--text); border-radius: 10px; transition: background .15s, transform .15s var(--ease); }
.gap:last-child { border-bottom: 0; }
.gap:hover { background: var(--surface-2); text-decoration: none; transform: translateX(3px); }
.gap-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gap-num { text-align: right; }
.strip { position: relative; height: 6px; margin: 0 9px; border-radius: 3px; background: linear-gradient(90deg, var(--good-soft), var(--bad-soft)); }
.strip .pt { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .15s var(--spring); }
.gap:hover .strip .pt { transform: scale(1.25); }
@media (max-width: 800px) { .gap { grid-template-columns: 1fr auto; } .gap .strip { grid-column: 1 / -1; order: 3; } }
