:root {
  color-scheme: light;
  --background: oklch(97.3% .004 247);
  --surface: #fff;
  --foreground: oklch(24% .03 258);
  --muted: oklch(48% .03 255);
  --primary: oklch(49% .09 222);
  --primary-hover: oklch(43% .085 222);
  --primary-soft: oklch(94% .03 215);
  --border: oklch(90% .012 250);
  --warning-soft: oklch(96% .045 85);
  --warning-foreground: oklch(38% .07 65);
  --shadow-card: 0 1px 2px oklch(24% .03 258 / .05), 0 12px 32px -16px oklch(24% .03 258 / .14);
  --shadow-lift: 0 2px 4px oklch(24% .03 258 / .06), 0 24px 48px -20px oklch(24% .03 258 / .25);
  --font-sans: "Public Sans", "Segoe UI", system-ui, sans-serif;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --bg: var(--background);
  --bg-deep: var(--primary-soft);
  --paper: var(--surface);
  --ink: var(--foreground);
  --line: var(--border);
  --accent: var(--primary);
  --accent-dark: var(--primary-hover);
  --good: oklch(40% .08 155);
  --good-bg: oklch(96% .02 155);
  --danger: oklch(46% .12 25);
  --danger-bg: oklch(96% .02 25);
  --shadow: var(--shadow-card);
  --serif: var(--font-display);
  --sans: var(--font-sans);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
body { margin: 0; background: var(--background); color: var(--foreground); font-family: var(--font-sans); font-size: 1rem; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-underline-offset: 4px; }
a:hover { color: var(--primary-hover); }
button, input, select { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { margin-top: 0; font-family: var(--font-display); letter-spacing: -.025em; line-height: 1.12; text-wrap: balance; }
p { margin-top: 0; }

.skip { position: fixed; z-index: 100; top: .75rem; left: .75rem; padding: .65rem 1rem; border-radius: 999px; background: var(--surface); color: var(--foreground); box-shadow: var(--shadow-card); text-decoration: none; transform: translateY(-160%); }
.skip:focus { transform: none; }

.wrap { width: min(72rem, calc(100% - 2.5rem)); margin-inline: auto; }
.site-header { position: sticky; z-index: 40; top: 0; display: flex; min-height: 4rem; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem max(1.25rem, calc((100% - 72rem) / 2)); border-bottom: 1px solid rgba(225, 229, 233, .78); background: rgba(246, 247, 248, .88); backdrop-filter: blur(14px); }
.brand { color: var(--foreground); font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; letter-spacing: -.045em; text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--foreground); }
.brand span { color: var(--primary); }
.langs { display: inline-flex; align-items: center; gap: .15rem; padding: .18rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.langs a { display: inline-flex; align-items: center; justify-content: center; padding: .26rem .52rem; border-radius: 999px; color: var(--muted); font-size: .75rem; font-weight: 700; line-height: 1; text-decoration: none; }
.langs a:hover { color: var(--foreground); background: rgba(40, 109, 131, .08); }
.langs a[aria-current="true"] { background: var(--primary); color: #fff; }
.nav { display: flex; flex-wrap: wrap; gap: .35rem; padding: 1rem 0 .25rem; }
.nav a { padding: .45rem .9rem; border-radius: 999px; background: transparent; color: var(--muted); font-size: .9rem; font-weight: 500; text-decoration: none; }
.nav a:hover { background: rgba(40, 109, 131, .06); color: var(--foreground); }
.nav a[aria-current="page"] { background: var(--primary-soft); color: var(--foreground); }

.kicker { margin: .4rem 0 .35rem; color: var(--primary); font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); margin: 0 0 .7rem; letter-spacing: -.045em; }
h2 { font-size: 1.45rem; margin: 1.5rem 0 .5rem; }
.lead { font-size: 1.08rem; max-width: 44rem; margin-top: 0; color: var(--muted); line-height: 1.75; }

.layout { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 1.5rem; align-items: start; margin: 1.5rem 0 3rem; }
.tool, .card, article, .home-grid a { background: var(--surface); border: 1px solid var(--border); border-radius: 1rem; box-shadow: var(--shadow-card); }
.tool { padding: 1.15rem; position: sticky; top: 5.25rem; }
form { display: grid; gap: .8rem; }
label { display: grid; gap: .3rem; font-size: .9rem; font-weight: 600; }
input, select, textarea { width: 100%; min-width: 0; max-width: 100%; border: 1px solid var(--border); background: var(--background); border-radius: .7rem; padding: .7rem .85rem; font-size: 1rem; }
input:focus, select:focus { border-color: var(--primary); outline: 3px solid rgba(40, 109, 131, .14); }
button { display: inline-flex; min-height: 2.65rem; align-items: center; justify-content: center; border: 0; border-radius: 999px; background: var(--primary); color: #fff; padding: .62rem 1.2rem; font-weight: 600; cursor: pointer; }
button:hover { background: var(--primary-hover); color: #fff; box-shadow: 0 5px 16px rgba(40, 109, 131, .18); }

.result { margin-top: 1rem; background: var(--good-bg); border-radius: .9rem; padding: .4rem .9rem .8rem; }
.result h2 { font-size: 1.15rem; margin: .6rem 0; }
.result dl { margin: 0; }
.result div { display: flex; justify-content: space-between; gap: .35rem 1rem; flex-wrap: wrap; padding: .45rem 0; border-top: 1px solid var(--border); }
.result dt { color: var(--muted); font-weight: 600; }
.result dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 700; }
.result .total dd { font-size: 1.25rem; color: var(--good); }
.group-title { margin: .8rem 0 0; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--good); }
.error { background: var(--danger-bg); color: var(--danger); border-radius: .8rem; padding: .7rem .8rem; margin-top: .8rem; }
.error:empty, .result:empty { display: none; }
.table-wrap { overflow: auto; max-height: 280px; margin-top: .7rem; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: .35rem .3rem; border-bottom: 1px solid var(--border); }
th:first-child, td:first-child { text-align: left; }
article { padding: 1.35rem 1.4rem 1.5rem; }
article p, article li { color: var(--muted); }
article strong { color: var(--foreground); }
.formula { background: var(--primary-soft); border-radius: .8rem; padding: .8rem 1rem; font-family: var(--font-display); overflow-x: auto; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin: 1.2rem 0 2.5rem; }
.home-grid a { display: block; padding: 1.15rem; text-decoration: none; color: inherit; transition: box-shadow .2s ease, transform .2s ease; }
.home-grid a:hover { box-shadow: var(--shadow-lift); transform: translateY(-3px); color: inherit; }
.home-grid strong { display: block; font-family: var(--font-display); font-size: 1.35rem; margin-bottom: .3rem; }
.home-grid span { color: var(--muted); }
.site-footer { width: auto; margin-top: 6rem; padding: 1.2rem max(1.25rem, calc((100% - 72rem) / 2)) 1.4rem; border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .88rem; }
.sources { font-size: .92rem; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .tool { position: static; }
}
@media (max-width: 767px) {
  .wrap { width: min(72rem, calc(100% - 2rem)); }
  .site-header { flex-wrap: wrap; align-items: center; padding-inline: 1rem; }
  .langs { flex: 0 0 auto; }
  .nav { display: grid; grid-template-columns: 1fr 1fr; }
  .nav a { min-width: 0; white-space: normal; line-height: 1.3; text-align: center; }
  .home-grid { grid-template-columns: 1fr; }
  .tool button, form button { width: 100%; }
  .site-footer { padding-inline: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
