/* Toolssy — shared styles. No external fonts, no frameworks. */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f0ea;
  --text: #1f2421;
  --muted: #5b625e;
  --border: #e3ded4;
  --brand: #2f7d5b;
  --brand-strong: #23614a;
  --brand-soft: #e4f2eb;
  --accent: #c8702a;
  --warn-bg: #fff4e5;
  --warn-text: #7a4100;
  --danger-bg: #fdecec;
  --danger-text: #8f1d1d;
  --ok-bg: #e8f5ec;
  --ok-text: #1d5c34;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
  --max: 1080px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141716;
    --surface: #1c201e;
    --surface-2: #232826;
    --text: #e9ece9;
    --muted: #a4aca7;
    --border: #313834;
    --brand: #5cc193;
    --brand-strong: #7fd3ab;
    --brand-soft: #1f3a2e;
    --accent: #e3994f;
    --warn-bg: #3a2a12;
    --warn-text: #ffd59c;
    --danger-bg: #3d1a1a;
    --danger-text: #ffb4b4;
    --ok-bg: #173323;
    --ok-text: #a9e6bf;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--brand-strong); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); margin: .2em 0 .4em; }
h2 { font-size: 1.5rem; margin: 2em 0 .6em; }
h3 { font-size: 1.15rem; margin: 1.5em 0 .4em; }
p, ul, ol { margin: 0 0 1em; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; inset-inline-start: 16px; top: -100px; }
.skip:focus { top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.25rem; color: var(--text); text-decoration: none; }
.logo svg { width: 30px; height: 30px; }
.nav { display: flex; gap: 4px 18px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .95rem; padding: 6px 0; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--brand-strong); }

/* Breadcrumbs */
.crumbs { font-size: .88rem; color: var(--muted); margin: 18px 0 0; }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: "›"; margin-right: 6px; }
.crumbs a { color: var(--muted); }

main { padding-bottom: 48px; }
.lede { font-size: 1.12rem; color: var(--muted); max-width: 760px; }
.meta-line { font-size: .88rem; color: var(--muted); }

/* Layout */
.tool-layout { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) {
  .tool-layout { grid-template-columns: minmax(0, 1fr) 300px; }
}
.content { max-width: 760px; }
aside .card { position: sticky; top: 16px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.calc { padding: 22px; margin: 18px 0 8px; }
.calc h2 { margin-top: 0; font-size: 1.25rem; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.tools-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin: 16px 0; }
.tool-card { display: block; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; transition: border-color .15s, transform .15s; }
.tool-card:hover { border-color: var(--brand); transform: translateY(-2px); color: var(--text); }
.tool-card .ico { font-size: 1.6rem; line-height: 1; }
.tool-card h3 { margin: 10px 0 4px; font-size: 1.08rem; color: var(--brand-strong); }
.tool-card p { margin: 0; font-size: .93rem; color: var(--muted); }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--brand-soft); color: var(--brand-strong); padding: 2px 8px; border-radius: 99px; }

/* Forms */
label { display: block; font-weight: 600; font-size: .93rem; margin-bottom: 6px; }
.hint { font-weight: 400; color: var(--muted); font-size: .84rem; }
input[type="number"], input[type="date"], input[type="text"], select {
  width: 100%; font: inherit; font-size: 1rem; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-height: 46px;
}
input:focus, select:focus, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 40%, transparent); outline-offset: 1px; border-color: var(--brand); }
.inline { display: flex; gap: 8px; }
.inline > :first-child { flex: 1; }
.inline select { width: auto; min-width: 84px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg label { margin: 0; font-weight: 600; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 9px 14px; cursor: pointer; font-size: .93rem; }
.seg input:checked + span { background: var(--brand); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--accent); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; border: 0; border-radius: 10px; padding: 12px 22px; min-height: 46px; cursor: pointer; background: var(--brand); color: #fff; }
.btn:hover { background: var(--brand-strong); }
@media (prefers-color-scheme: dark) { .btn { color: #0f1a14; } .seg input:checked + span { color: #0f1a14; } }
.btn-ghost { background: transparent; color: var(--brand-strong); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.error { color: var(--danger-text); font-size: .9rem; margin-top: 10px; min-height: 1em; }

/* Results */
.result { margin-top: 20px; border-radius: 12px; background: var(--brand-soft); padding: 18px; }
.result[hidden] { display: none; }
.result .big { font-size: 2rem; font-weight: 800; line-height: 1.2; color: var(--brand-strong); }
.result .sub { color: var(--muted); font-size: .95rem; }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 14px; }
.stat { background: var(--surface); border-radius: 10px; padding: 12px; border: 1px solid var(--border); }
.stat b { display: block; font-size: 1.2rem; }
.stat span { font-size: .82rem; color: var(--muted); }
.level { border-radius: 12px; padding: 16px; margin-top: 14px; }
.level-ok { background: var(--ok-bg); color: var(--ok-text); }
.level-warn { background: var(--warn-bg); color: var(--warn-text); }
.level-danger { background: var(--danger-bg); color: var(--danger-text); }
.level h3 { margin: 0 0 6px; color: inherit; }
.level p:last-child { margin-bottom: 0; }

/* Notices */
.notice { border-left: 4px solid var(--accent); background: var(--warn-bg); color: var(--warn-text); padding: 14px 16px; border-radius: 0 10px 10px 0; margin: 18px 0; font-size: .95rem; }
.notice.urgent { border-color: #c62828; background: var(--danger-bg); color: var(--danger-text); }
.notice p:last-child { margin: 0; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 12px 0 20px; border: 1px solid var(--border); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; background: var(--surface); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--surface-2); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
td.wrap-cell { white-space: normal; min-width: 220px; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 14px 0 0; border-left: 3px solid var(--brand); }
.timeline li { position: relative; padding: 0 0 14px 18px; }
.timeline li::before { content: ""; position: absolute; left: -8px; top: 6px; width: 13px; height: 13px; border-radius: 50%; background: var(--surface); border: 3px solid var(--brand); }
.timeline b { display: block; }
.timeline span { color: var(--muted); font-size: .92rem; }

/* Chart */
.chart { margin-top: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .axis { stroke: var(--border); }
.chart .lbl { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 3; }
.chart .band { fill: var(--brand); opacity: .14; }
.chart .now { fill: var(--accent); }

/* Names */
.names { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; list-style: none; padding: 0; }
.names li button { font: inherit; font-weight: 700; font-size: 1.05rem; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 99px; padding: 8px 16px; cursor: pointer; }
.names li button:hover { border-color: var(--brand); }
.names li button.saved { background: var(--brand); color: #fff; border-color: var(--brand); }
.saved-list { margin-top: 14px; font-size: .95rem; }

/* FAQ */
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px 16px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 700; padding: 10px 0; }
.faq details[open] summary { border-bottom: 1px solid var(--border); margin-bottom: 10px; }

/* Hero */
.hero { padding: 40px 0 10px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); max-width: 780px; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 0; }

.side-links { list-style: none; padding: 0; margin: 0; }
.side-links li { padding: 7px 0; border-bottom: 1px solid var(--border); }
.side-links li:last-child { border: 0; }
.side-links a { text-decoration: none; font-weight: 600; }
.toc { font-size: .95rem; }
.toc ol { padding-left: 20px; margin: 0; }

/* Footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 32px 0; font-size: .92rem; color: var(--muted); }
.footer-grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.site-footer h2 { font-size: 1rem; margin: 0 0 8px; color: var(--text); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 4px 0; }
.site-footer a { color: var(--muted); }
.fineprint { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); font-size: .85rem; }

@media print {
  .site-header, .site-footer, aside, .actions, .crumbs { display: none; }
  body { background: #fff; color: #000; }
}

/* Home + misc */
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.step { position: relative; }
.step-n { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; }
.step h3, .grid-3 .card h3 { margin-top: 10px; }
.grid-3 .card p { margin: 0; color: var(--muted); font-size: .95rem; }
.side-h { margin-top: 0; font-size: 1rem; }
.prose { max-width: 760px; }
.lang-list { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.lang-list a[aria-current] { color: var(--brand-strong); font-weight: 700; }
.hero .pill-row .btn { text-decoration: none; }
a.btn { text-decoration: none; }
a.btn:hover { color: #fff; }
a.btn-ghost:hover { color: var(--brand-strong); }

/* Right-to-left languages */
[dir="rtl"] .crumbs li + li::before { content: "‹"; margin: 0 0 0 6px; }
[dir="rtl"] .timeline { border-left: 0; border-right: 3px solid var(--brand); }
[dir="rtl"] .timeline li { padding: 0 18px 14px 0; }
[dir="rtl"] .timeline li::before { left: auto; right: -8px; }
[dir="rtl"] .notice { border-left: 0; border-right: 4px solid var(--accent); border-radius: 10px 0 0 10px; }
[dir="rtl"] th, [dir="rtl"] td { text-align: right; }
[dir="rtl"] .toc ol { padding-left: 0; padding-right: 20px; }
