:root {
  --bg: #f5f7ff;
  --bg-2: #eef2ff;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #4b5563;
  --primary: #4f46e5;
  --primary-2: #6366f1;
  --primary-dark: #3730a3;
  --border: #dbe3ff;
  --shadow-soft: 0 16px 40px rgba(39, 51, 130, 0.09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(900px 460px at 15% -10%, #dde6ff, transparent), linear-gradient(180deg, var(--bg), var(--bg-2));
  color: var(--text);
  line-height: 1.72;
}

.container { width: min(980px, 92%); margin: 0 auto; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid #e8ecff;
}
.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
}
.brand { text-decoration: none; font-weight: 800; color: var(--text); }
.top-links a { text-decoration: none; color: #4a5676; margin-left: 1rem; font-size: 0.95rem; }
.top-links a:hover { color: var(--primary); }

.hero { padding: 2.3rem 0 1.4rem; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.8rem; }
.badge {
  background: #e9edff;
  color: #2e3a8b;
  border-radius: 999px;
  padding: 0.23rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
}
.hero h1 {
  font-size: clamp(1.9rem, 4.8vw, 3rem);
  line-height: 1.1;
  margin: 0 0 0.65rem;
  letter-spacing: -0.025em;
}
.hero p { margin: 0; color: var(--muted); font-size: 1.07rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  padding: 1.25rem;
}

.warning-box {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  background: #fff8e5;
  border: 1px solid #f6d48b;
  border-radius: 14px;
  padding: 0.86rem 0.9rem;
  margin-bottom: 1rem;
}
.warning-box svg { flex-shrink: 0; margin-top: 0.18rem; }

.simulator-card { margin-bottom: 1.4rem; }
.simulator-card h2 { margin-top: 0; }

.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.mode-tab {
  border: 1px solid #cad4ff;
  background: #f4f6ff;
  color: #344272;
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.mode-tab[aria-selected="true"] {
  background: #ffffff;
  color: #293abc;
  border-color: #97a8ff;
  box-shadow: 0 4px 14px rgba(55, 73, 184, 0.16);
}

.tab-description {
  margin: 0 0 1rem;
  color: #43506f;
}

.tab-panel[hidden] { display: none; }

.fieldset-toggle { border: 0; margin: 0 0 1rem; padding: 0; }
.fieldset-toggle legend { font-weight: 700; margin-bottom: 0.45rem; }
.segmented {
  display: inline-flex;
  background: #f4f6ff;
  border: 1px solid #cfd8ff;
  border-radius: 12px;
  padding: 0.2rem;
}
.segmented input { display: none; }
.segmented span {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  color: #516084;
}
.segmented input:checked + span {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 4px 14px rgba(55, 73, 184, 0.2);
}

label { display: block; font-weight: 700; margin-bottom: 0.36rem; }
.input-hint { font-weight: 500; color: #67748f; font-size: 0.85rem; }
input, select {
  width: 100%;
  border: 1px solid #cad4ff;
  border-radius: 12px;
  padding: 0.72rem 0.75rem;
  font: inherit;
  background: #fff;
  margin-bottom: 0.82rem;
}
input:focus, select:focus { outline: 2px solid #dde2ff; border-color: #95a7ff; }
.tax-help { margin: -0.35rem 0 0.55rem; color: #5d6b85; font-size: 0.86rem; }

.tax-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.tax-chip {
  border: 1px solid #ccd5ff;
  background: #eef2ff;
  color: #32408f;
  border-radius: 999px;
  padding: 0.35rem 0.76rem;
  font-weight: 700;
  cursor: pointer;
}
.tax-chip:hover { background: #e3e9ff; }

button[type="submit"], .copy-btn, #accept-cookies {
  border: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border-radius: 12px;
  padding: 0.75rem 0.95rem;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
button[type="submit"]:hover, .copy-btn:hover, #accept-cookies:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.error { color: #b42318; font-weight: 700; }

.results { margin-top: 1rem; background: #fbfcff; padding: 1.2rem; }
.results-title { margin: 0 0 0.5rem; text-align: center; color: #1f2a72; font-size: clamp(1.15rem, 2.6vw, 1.45rem); }
.result-big {
  text-align: center;
  font-size: clamp(1.55rem, 4.8vw, 2.45rem);
  font-weight: 900;
  color: #1f2b88;
  margin: 0 0 0.8rem;
}
.result-panel {
  border: 1px solid #d8e0ff;
  border-radius: 14px;
  padding: 0.85rem;
  background: #f8faff;
}
.result-panel h4 { margin: 0 0 0.45rem; font-size: 1rem; color: #2a377f; }
.result-panel p { margin: 0.22rem 0; font-size: 1.05rem; }
.result-panel.ask strong { font-size: 1.12rem; }
.result-panel.gain p { color: #334155; }
.result-divider { height: 1px; margin: 0.85rem 0; background: linear-gradient(90deg, transparent, #cfd9ff, transparent); }
.ready-text {
  border: 1px solid #d5dfff;
  background: #f4f7ff;
  border-radius: 12px;
  padding: 0.8rem;
  margin: 0.9rem 0 0.7rem;
}
.copy-btn { width: 100%; }

.toc { margin-bottom: 1.35rem; }
.toc-title { margin-top: 0; }
.toc ul { margin: 0; padding-left: 1.2rem; }
.toc a { color: #2e4099; font-weight: 600; }

.editorial section { margin: 2.4rem 0; padding-bottom: 0.4rem; border-bottom: 1px solid #edf1ff; }
.editorial h2 { margin-bottom: 0.45rem; font-size: clamp(1.35rem, 3vw, 1.9rem); }
.editorial h3 { margin-bottom: 0.35rem; font-size: clamp(1.05rem, 2.2vw, 1.3rem); }
.editorial p { margin: 0.58rem 0; max-width: 78ch; }
.editorial ul, .editorial ol { margin: 0.5rem 0 0.9rem 1.2rem; }
.editorial li { margin: 0.35rem 0; }

.callout {
  border-left: 4px solid var(--primary);
  background: #eef2ff;
  box-shadow: inset 0 0 0 1px #dbe3ff;
  border-radius: 12px;
  padding: 0.74rem 0.82rem;
  margin: 0.8rem 0;
}
.callout.warn { border-left-color: #b36a00; background: #fff7e6; }
.callout.error { border-left-color: #b42318; background: #fff1f1; }
.callout.tip { border-left-color: #0f766e; background: #ebfffa; }

.schema-steps {
  border: 1px dashed #b6c5ff;
  border-radius: 14px;
  background: #f8faff;
  text-align: center;
  padding: 0.8rem;
  margin: 0.8rem 0;
  font-weight: 600;
}

.editorial table { width: 100%; border-collapse: collapse; margin-top: 0.65rem; }
.editorial th, .editorial td { border: 1px solid #d8e1ff; padding: 0.55rem; text-align: left; }
.editorial th { background: #eaf0ff; }
.editorial tbody tr:nth-child(even) { background: #f9fbff; }

.faq-item {
  border: 1px solid #dce4ff;
  background: #fdfdff;
  border-radius: 12px;
  padding: 0.72rem;
  margin-bottom: 0.6rem;
}
.faq-item h3 { margin: 0 0 0.22rem; }
.faq-item p { margin: 0; }

.site-footer {
  margin-top: 2.2rem;
  border-top: 1px solid #e3e8ff;
  background: #fff;
  padding: 1.2rem 0 3rem;
  font-size: 0.92rem;
}
.site-footer p { margin: 0.45rem 0; color: #334155; }
.site-footer a { color: #2d3f99; }

.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: #101f46;
  color: #fff;
  border-top: 1px solid #273a75;
}
.cookie-wrap {
  width: min(980px, 92%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.65rem 0;
}
.cookie-wrap p { margin: 0; font-size: 0.9rem; }
.cookie-wrap a { color: #a9c4ff; }

.back-to-sim {
  position: fixed;
  right: 0.9rem;
  bottom: 4.25rem;
  text-decoration: none;
  color: #fff;
  background: #1f2d6f;
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  box-shadow: 0 8px 22px rgba(16, 24, 66, 0.25);
}

.theme-toggle {
  border: 1px solid #cfd8ff;
  border-radius: 999px;
  background: #eef2ff;
  color: #24306f;
  font: inherit;
  font-weight: 700;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
}

.theme-toggle:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #93a5ff;
  outline-offset: 2px;
}

.viz-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin: 1rem 0;
}

.chart-card {
  border: 1px solid #d8e0ff;
  border-radius: 14px;
  padding: 0.75rem;
  background: #ffffff;
}

.chart-card h4 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.chart-card canvas {
  width: 100% !important;
  height: 260px !important;
}

.negotiation-block {
  border: 1px solid #d6e1ff;
  background: #f8faff;
  border-radius: 14px;
  padding: 0.85rem;
  margin-bottom: 0.75rem;
}

.negotiation-block h4 {
  margin: 0 0 0.4rem;
}

[data-theme="dark"] {
  --bg: #0b1020;
  --bg-2: #131a33;
  --card: #111a2e;
  --text: #e8ecff;
  --muted: #b5c0dd;
  --border: #273352;
  --shadow-soft: 0 18px 40px rgba(2, 6, 23, 0.45);
}

[data-theme="dark"] body {
  background: radial-gradient(900px 460px at 15% -10%, #1e2b50, transparent), linear-gradient(180deg, var(--bg), var(--bg-2));
}

[data-theme="dark"] .site-header {
  background: rgba(16, 26, 46, 0.88);
  border-bottom-color: #2a3961;
}

[data-theme="dark"] .brand,
[data-theme="dark"] .top-links a,
[data-theme="dark"] .toc a,
[data-theme="dark"] .site-footer a {
  color: #d7e0ff;
}

[data-theme="dark"] .warning-box,
[data-theme="dark"] .result-panel,
[data-theme="dark"] .chart-card,
[data-theme="dark"] .negotiation-block,
[data-theme="dark"] .ready-text,
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] .segmented,
[data-theme="dark"] .cookie-banner,
[data-theme="dark"] .faq-item {
  background: #16223d;
  border-color: #2b3b62;
  color: #e8ecff;
}

[data-theme="dark"] .mode-tab {
  background: #1b2947;
  color: #d8e2ff;
  border-color: #33466f;
}

[data-theme="dark"] .mode-tab[aria-selected="true"] {
  background: #16223d;
  border-color: #6177c6;
  color: #eef2ff;
}

[data-theme="dark"] .theme-toggle,
[data-theme="dark"] .tax-chip {
  background: #1b2947;
  color: #d8e2ff;
  border-color: #33466f;
}

@media (max-width: 900px) {
  .nav-wrap {
    flex-wrap: wrap;
  }
}

@media (max-width: 760px) {
  .viz-grid {
    grid-template-columns: 1fr;
  }

  .theme-toggle {
    order: 3;
    width: 100%;
  }
}
@media (max-width: 760px) {
  .top-links { display: none; }
  .card { padding: 1rem; }
}
