:root {
  --bg: #F6F6F3;
  --surface: #FFFFFF;
  --ink: #101828;
  --muted: #667085;
  --line: #E4E7EC;
  --accent: #0E7C66;
  --accent-dark: #0B5E4E;
  --accent-soft: #E3F2EC;
  --amber: #B45309;
  --amber-soft: #FDF0DC;
  --slate: #475467;
  --danger: #B42318;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-dark);
}

.container {
  width: min(1120px, 100% - 40px);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  font-size: 18px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
}

.brand-accent {
  color: var(--accent);
}

.nav {
  display: flex;
  gap: 20px;
  margin-left: 8px;
}

.nav a {
  color: var(--slate);
  font-weight: 600;
  font-size: 14px;
}

.nav a[aria-current="page"] {
  color: var(--ink);
}

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--slate);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.header-badge {
  margin-left: auto;
}

.hero {
  padding: 44px 0 28px;
}

.hero h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1.15;
  letter-spacing: 0;
  font-weight: 800;
  max-width: 720px;
}

.hero-sub {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 17px;
  max-width: 640px;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.trust-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate);
}

.trust-chip svg {
  width: 15px;
  height: 15px;
  color: var(--accent);
}

.calculator-section {
  padding: 16px 0 44px;
}

.calc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.muted {
  color: var(--muted);
  font-size: 12.5px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.control {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
  padding: 0 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 124, 102, 0.15);
}

.input-with-select {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 10px;
}

.control-select-inline {
  font-weight: 600;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--slate);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  padding: 8px 6px;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.category-card svg {
  width: 20px;
  height: 20px;
}

.category-card:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.category-card[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.advanced {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #FCFCFA;
}

.advanced summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 14px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--slate);
  list-style: none;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced summary svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.advanced-body {
  padding: 0 14px 14px;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--slate);
  cursor: pointer;
  margin-top: 4px;
}

.check-line input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.panel-result {
  position: sticky;
  top: 84px;
}

.result-total {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.result-label {
  margin: 0 0 3px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

.total-number {
  margin: 0;
  font-size: 38px;
  line-height: 1.1;
  font-weight: 800;
  color: var(--accent-dark);
  letter-spacing: 0;
}

.per-unit-block {
  text-align: right;
}

.per-unit {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
}

.chart-wrap {
  position: relative;
  height: 210px;
  margin: 18px 0 6px;
}

.breakdown {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 9px;
}

.breakdown li {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.breakdown .b-label {
  font-weight: 600;
  color: var(--slate);
  white-space: nowrap;
}

.breakdown .b-track {
  height: 7px;
  border-radius: 999px;
  background: #EEF0F3;
  overflow: hidden;
}

.breakdown .b-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.breakdown .b-value {
  font-weight: 700;
  white-space: nowrap;
  text-align: right;
}

.breakdown .b-fill.alt {
  background: var(--amber);
}

.breakdown .b-fill.neutral {
  background: #98A2B3;
}

.estimate-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 16px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12.5px;
  font-weight: 600;
}

.estimate-note svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin-top: 1px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.05s;
  text-decoration: none;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}

.btn-light {
  background: #fff;
  color: var(--accent-dark);
  border-color: rgba(255, 255, 255, 0.55);
}

.alert-form {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.alert-form > label {
  display: block;
  margin-bottom: 7px;
  font-size: 13.5px;
  font-weight: 600;
}

.alert-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.alert-ok {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 600;
}

.alert-ok svg {
  width: 15px;
  height: 15px;
}

.saved-section {
  padding: 34px 0 48px;
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
}

.saved-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 42px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.saved-empty svg {
  width: 30px;
  height: 30px;
  color: #98A2B3;
}

.saved-empty p {
  margin: 0;
  font-size: 14px;
  max-width: 360px;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.saved-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 13.5px;
}

.saved-table th,
.saved-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.saved-table th {
  background: #FAFAF8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.saved-table tr:last-child td {
  border-bottom: 0;
}

.saved-table td.num {
  font-weight: 700;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.icon-btn:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

.compare-panel {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px;
}

.compare-panel h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
}

.compare-panel h3 svg {
  width: 17px;
  height: 17px;
  color: var(--accent);
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.compare-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #FCFCFA;
}

.compare-card h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
}

.compare-card dl {
  margin: 0;
  display: grid;
  gap: 5px;
  font-size: 12.5px;
}

.compare-card dt {
  color: var(--muted);
  font-weight: 600;
}

.compare-card dd {
  margin: 0;
  font-weight: 700;
}

.band {
  background: var(--accent-dark);
  color: #fff;
  padding: 34px 0;
}

.band-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.band h2 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: 0;
}

.band p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14.5px;
  max-width: 620px;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 22px 0;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-inner p {
  margin: 0;
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #fff;
  padding: 11px 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Article page */
.guide-page {
  background: #fff;
}

.article-main {
  padding: 34px 0 56px;
}

.article {
  max-width: 780px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 18px;
}

.article h1 {
  margin: 0 0 12px;
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: 0;
  font-weight: 800;
}

.article-lede {
  font-size: 18px;
  color: var(--slate);
  margin: 0 0 28px;
}

.article h2 {
  margin: 32px 0 10px;
  font-size: 22px;
  letter-spacing: 0;
  font-weight: 800;
}

.article p {
  color: var(--slate);
  font-size: 15.5px;
}

.formula {
  background: var(--accent-soft);
  border: 1px solid #C6E4D5;
  color: var(--accent-dark);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-weight: 700;
  font-size: 15.5px;
  margin: 14px 0 18px;
}

.article-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0 18px;
  font-size: 14px;
}

.article-table th,
.article-table td {
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--line);
}

.article-table th {
  background: #FAFAF8;
  font-size: 12.5px;
  text-transform: uppercase;
  color: var(--muted);
}

.article-list {
  margin: 12px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  color: var(--slate);
  font-size: 15px;
}

.faq {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #FCFCFA;
  margin: 10px 0;
}

.faq summary {
  padding: 14px 16px;
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq p {
  margin: 0;
  padding: 0 16px 14px;
  font-size: 14.5px;
}

.article-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 40px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #FCFCFA;
}

.article-cta h2 {
  margin: 0 0 4px;
}

.article-cta p {
  margin: 0;
  font-size: 14px;
}

.print-only {
  display: none;
}

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

  .panel-result {
    position: static;
  }

  .category-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 620px) {
  .container {
    width: min(100% - 28px, 1120px);
  }

  .header-inner {
    gap: 12px;
    min-height: 58px;
  }

  .nav {
    gap: 12px;
  }

  .header-badge {
    display: none;
  }

  .hero {
    padding: 30px 0 20px;
  }

  .hero h1 {
    font-size: 28px;
  }

  .hero-sub {
    font-size: 15.5px;
  }

  .panel {
    padding: 16px;
  }

  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .field-row,
  .input-with-select,
  .alert-inline {
    grid-template-columns: 1fr;
  }

  .total-number {
    font-size: 32px;
  }

  .band-inner,
  .article-cta {
    flex-direction: column;
    align-items: flex-start;
  }

  .article h1 {
    font-size: 27px;
  }
}

@media print {
  .site-header,
  .hero,
  .panel-inputs,
  .action-row,
  .alert-form,
  .saved-section,
  .band,
  .site-footer,
  .toast {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .panel-result {
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .chart-wrap {
    height: 190px;
  }

  .print-only {
    display: block;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 2px solid var(--ink);
  }
}
