:root {
  --bg: #f6f9f8;
  --surface: #ffffff;
  --text: #1b2430;
  --muted: #5b6676;
  --border: #dde3ec;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e3f4f1;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --ok: #15803d;
  --radius: 12px;
  --max: 960px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161d;
    --surface: #18202a;
    --text: #e6ebf2;
    --muted: #9aa6b6;
    --border: #2a3542;
    --accent: #4fd1c5;
    --accent-ink: #05201d;
    --accent-soft: #12302c;
    --warn: #f5b04a;
    --warn-soft: #3a2a10;
    --ok: #4ade80;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
img { max-width: 100%; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

header.site {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
header.site .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 24px; padding-top: 14px; padding-bottom: 14px;
}
.logo { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); }
.logo span { color: var(--accent); }
nav.main { display: flex; flex-wrap: wrap; gap: 4px 18px; }
nav.main a { text-decoration: none; color: var(--muted); font-size: .95rem; }
nav.main a:hover, nav.main a[aria-current="page"] { color: var(--accent); }

main { padding: 32px 0 48px; }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); line-height: 1.2; margin: 0 0 12px; }
h2 { font-size: 1.3rem; margin: 32px 0 10px; }
h3 { font-size: 1.05rem; margin: 20px 0 6px; }
.lead { font-size: 1.1rem; color: var(--muted); margin: 0 0 24px; }

.badge {
  display: inline-block; font-size: .8rem; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
  padding: 3px 10px; border-radius: 999px; margin-bottom: 12px;
}
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
a.card { text-decoration: none; color: inherit; display: block; transition: border-color .15s; }
a.card:hover { border-color: var(--accent); }
.card h3 { margin-top: 0; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }
.icon { font-size: 1.8rem; line-height: 1; margin-bottom: 10px; display: block; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin: 16px 0;
}
.note {
  background: var(--accent-soft); border-radius: var(--radius);
  padding: 14px 16px; font-size: .95rem; margin: 16px 0;
}
.warn { background: var(--warn-soft); color: var(--text); border-left: 4px solid var(--warn); }

label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: .95rem; }
input[type="text"], input[type="email"], input[type="date"], select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
textarea { min-height: 160px; resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin: 8px 0; }
.check input { margin-top: 5px; }
.row { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.btn {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); border: 0;
  padding: 10px 18px; border-radius: 8px; text-decoration: none; margin: 12px 8px 0 0;
}
.btn.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.drop {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 32px 16px; text-align: center; color: var(--muted); cursor: pointer;
  background: var(--surface);
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table-wrap { overflow-x: auto; }
.muted { color: var(--muted); }
.ok { color: var(--ok); font-weight: 600; }
.bad { color: var(--warn); font-weight: 600; }
.stat { font-size: 1.05rem; margin: 12px 0; }
.thumb-list { display: grid; gap: 12px; }
.thumb-item { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: start; }
.thumb-item img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

footer.site { border-top: 1px solid var(--border); background: var(--surface); font-size: .9rem; color: var(--muted); }
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; padding-top: 18px; padding-bottom: 18px; }
footer.site a { color: var(--muted); }
textarea.short { min-height: 64px; font-family: inherit; font-size: 1rem; }
textarea.tall { min-height: 420px; }
code { font-size: .9em; background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }
article { max-width: 760px; }
article h2 { margin-top: 36px; }
.meta { color: var(--muted); font-size: .9rem; margin: -4px 0 20px; }
.toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin: 20px 0; }
.toc strong { display: block; margin-bottom: 4px; }
.toc ol { margin: 0; padding-left: 20px; }
.result-big { font-size: 2rem; font-weight: 700; color: var(--accent); line-height: 1.2; }
.counter { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.counter small { display: block; color: var(--muted); font-weight: 400; }
.counter input { width: 72px; padding: 8px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; text-align: center; }
.related { margin-top: 40px; }
.compare td:first-child { font-weight: 600; white-space: nowrap; }
.provider { display: grid; gap: 4px 16px; grid-template-columns: 1fr auto; align-items: center; }
.provider .btn { margin: 0; white-space: nowrap; }
.provider p { margin: 4px 0 0; color: var(--muted); font-size: .95rem; }
.pill { display: inline-block; font-size: .78rem; border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; margin: 4px 4px 0 0; color: var(--muted); }
.result-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.result-table tr.total td { font-weight: 700; border-top: 2px solid var(--text); }
input[type="number"] { width: 100%; padding: 10px 12px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.ad-hint { font-size: .85rem; color: var(--muted); }
@media (max-width: 560px) { .provider { grid-template-columns: 1fr; } .provider .btn { justify-self: start; margin-top: 8px; } }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
