/* Stad10 – shared styles. Light by default, dark via prefers-color-scheme. */
:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #eef1ec;
  --text: #17201a;
  --muted: #5a665d;
  --line: #d9dfd8;
  --brand: #0f7a3d;
  --brand-ink: #ffffff;
  --brand-soft: #e3f2e8;
  --accent: #c2410c;
  --good: #15803d;
  --bad: #b91c1c;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1411;
    --surface: #171e19;
    --surface-2: #1f2822;
    --text: #e7ece8;
    --muted: #9aa79e;
    --line: #2c372f;
    --brand: #34c26f;
    --brand-ink: #06210f;
    --brand-soft: #173523;
    --accent: #fb923c;
    --good: #4ade80;
    --bad: #f87171;
    --shadow: none;
    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: 16px/1.6 var(--font); }
img, svg { max-width: 100%; }
a { color: var(--brand); text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.3rem); margin: .4rem 0 .5rem; }
h2 { font-size: 1.35rem; margin: 2.2rem 0 .6rem; }
h3 { font-size: 1.1rem; margin: 1.5rem 0 .4rem; }
p, ul, ol { margin: 0 0 1rem; }
table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: .45rem .5rem; text-align: left; vertical-align: top; }
th { font-weight: 600; background: var(--surface-2); }
.table-wrap { overflow-x: auto; margin: 0 0 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table-wrap table th:first-child, .table-wrap table td:first-child { padding-left: .8rem; }
code, kbd { font-family: var(--mono); font-size: .92em; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 6px 10px; z-index: 10; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 760px; }
main.wrap { padding-bottom: 3rem; }

/* header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 18px; min-height: 58px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.logo-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); font-size: .9rem; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; }
.nav::-webkit-scrollbar { display: none; }
.nav a { white-space: nowrap; padding: 6px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: .95rem; }
.nav a:hover, .nav a[aria-current] { background: var(--brand-soft); color: var(--text); }
@media (max-width: 640px) { .top-in { padding-top: 8px; padding-bottom: 6px; gap: 6px; } .nav { width: 100%; } }

/* breadcrumbs, lead */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 1rem 0 0; font-size: .88rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 6px; }
.crumbs a { color: var(--muted); }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 760px; }
.updated { color: var(--muted); font-size: .9rem; margin-top: 2rem; }

/* cards & grids */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: .8rem 0 1rem; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.card:hover { border-color: var(--brand); }
.card-t { font-weight: 650; }
.card-d { color: var(--muted); font-size: .92rem; }
.home-sec h2 a { color: var(--text); text-decoration: none; }
.home-sec h2 a:hover { color: var(--brand); }

/* article */
.article { max-width: 760px; }
.article li { margin-bottom: .35rem; }
.note { background: var(--brand-soft); border-left: 4px solid var(--brand); padding: .7rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 0 0 1rem; }
.warn { background: color-mix(in srgb, var(--accent) 12%, transparent); border-left: 4px solid var(--accent); padding: .7rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 0 0 1rem; }
.formula { font-family: var(--mono); background: var(--surface-2); padding: .6rem .9rem; border-radius: 8px; overflow-x: auto; white-space: nowrap; margin: 0 0 1rem; }

/* FAQ */
.faq { max-width: 760px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 8px; }
.faq summary { cursor: pointer; padding: 12px 16px; font-weight: 600; }
.faq-a { padding: 0 16px 12px; }
.faq-a p:last-child { margin-bottom: 0; }

/* related */
.related { margin-top: 2.5rem; border-top: 1px solid var(--line); }

/* tool panel + controls */
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); margin: 1.2rem 0 1.5rem; }
.tool h2:first-child, .tool h3:first-child { margin-top: 0; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label, .lbl { font-size: .88rem; color: var(--muted); font-weight: 600; }
input[type=text], input[type=number], select, textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; min-height: 42px; width: 100%;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.btn { font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 10px; padding: 9px 14px; min-height: 42px; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.small { padding: 5px 10px; min-height: 34px; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.result { background: var(--brand-soft); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; }
.big { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.muted { color: var(--muted); }
.err { color: var(--bad); font-weight: 600; }
.ok { color: var(--good); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex-wrap: wrap; }
.seg button { font: inherit; border: 0; background: var(--surface); color: var(--text); padding: 8px 12px; cursor: pointer; min-height: 40px; }
.seg button[aria-pressed=true] { background: var(--brand); color: var(--brand-ink); }
.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 10px 0; }
.kpi div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.kpi b { display: block; font-size: 1.4rem; }
.kpi span { font-size: .85rem; color: var(--muted); }
.svgbox { background: var(--surface-2); border-radius: var(--radius); padding: 10px; overflow: hidden; }
.svgbox svg { display: block; width: 100%; height: auto; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* footer */
.foot { background: var(--surface); border-top: 1px solid var(--line); padding: 1.6rem 0; margin-top: 2rem; }
.foot-links { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.foot-links a { color: var(--text); text-decoration: none; font-size: .95rem; }
.foot-links a:hover { color: var(--brand); }
.foot-note { color: var(--muted); font-size: .88rem; margin: .3rem 0; }

/* print: only the tool/print area */
@media print {
  .top, .foot, .crumbs, .related, .faq, .lead, .updated, .no-print, .article { display: none !important; }
  body { background: #fff; color: #000; }
  .tool { border: 0; box-shadow: none; padding: 0; }
}
