:root {
  --bg: #ffffff; --surface: #f6f6f7; --line: #e3e3e6; --text: #1d1d1f; --muted: #6b6b73;
  --accent: #ee4d2d; --accent-ink: #ffffff; --accent-soft: #fdeee9;
  --good: #1a7f4b; --bad: #c62828; --focus: #ee4d2d55;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #18181b; --surface: #232327; --line: #34343a; --text: #ececf0; --muted: #a0a0aa;
    --accent: #ff6a4d; --accent-soft: #3a211c; --good: #4cc98a; --bad: #ff7a7a; --focus: #ff6a4d66; }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { width: 400px; min-height: 520px; background: var(--bg); color: var(--text);
  font: 13px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
@media (min-width: 600px) { body.page { width: 440px; margin: 24px auto; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; } }

.top { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 10px; align-items: center; }
.brand strong { display: block; font-size: 14px; }
.brand small { color: var(--muted); font-size: 11px; }
.logo { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; }

.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 8px; }
.tab { flex: 1; background: none; border: 0; padding: 10px 4px; color: var(--muted); cursor: pointer;
  font: inherit; font-weight: 600; border-bottom: 2px solid transparent; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.panel { display: none; padding: 12px 14px 16px; }
.panel.active { display: block; }

.field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 12px; margin-bottom: 10px; color: var(--text); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
input[type=text], input[type=number], input[type=url], select {
  width: 100%; padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg);
  color: var(--text); font: inherit; font-weight: 400; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input { flex: 1; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.seg button { border: 0; background: var(--bg); color: var(--muted); padding: 8px 10px; cursor: pointer; font: inherit; font-weight: 600; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.hint { color: var(--muted); font-weight: 400; font-size: 11px; }
.check { display: flex; gap: 8px; align-items: center; margin: 2px 0 10px; cursor: pointer; }
details { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 12px; }
details[open] summary { margin-bottom: 8px; }
summary { cursor: pointer; font-weight: 600; }

button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 8px 12px; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.link { background: none; border: 0; padding: 6px 0; color: var(--accent); text-decoration: underline; }
.row-btns { display: flex; gap: 8px; margin-top: 8px; }

.result { background: var(--surface); border-radius: 10px; padding: 12px; }
.result.empty { color: var(--muted); text-align: center; padding: 18px 12px; }
.hero { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding-bottom: 10px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.hero .lbl { color: var(--muted); font-size: 12px; }
.hero .val { font-size: 24px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.lines { width: 100%; border-collapse: collapse; }
.lines td { padding: 4px 0; }
.lines td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lines tr.sub td { color: var(--muted); font-size: 12px; padding-left: 10px; }
.lines tr.total td { font-weight: 700; border-top: 1px solid var(--line); padding-top: 6px; }
.neg { color: var(--bad); }
.pos { color: var(--good); }
.tag { display: inline-block; font-size: 11px; background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 1px 6px; margin-left: 4px; font-weight: 600; }
.note { color: var(--muted); font-size: 11px; margin-top: 8px; }
.box { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-top: 10px; font-size: 12px; }

.lead { margin: 0 0 10px; color: var(--muted); }
.status { margin-top: 8px; font-size: 12px; }
.status.err { color: var(--bad); }
.status.ok { color: var(--good); }
.prod-card { background: var(--surface); border-radius: 10px; padding: 12px; margin-top: 10px; }
.prod-card h3 { margin: 0 0 4px; font-size: 13px; line-height: 1.3; }
.meta { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.cmp { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.cmp th, .cmp td { padding: 5px 4px; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.cmp th:first-child, .cmp td:first-child { text-align: left; }
.cmp th { color: var(--muted); font-weight: 600; font-size: 11px; }
.cmp tr.total td { font-weight: 700; color: var(--accent); border-bottom: 0; }

.rules { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.rules th { text-align: left; font-size: 11px; color: var(--muted); padding: 4px; }
.rules td { padding: 3px 4px; }
.rules input { padding: 6px; }
.notes { padding-left: 16px; color: var(--muted); font-size: 11.5px; margin: 6px 0 10px; }
.notes li { margin-bottom: 3px; }
.src { color: var(--muted); font-size: 10.5px; margin-top: 10px; }
