.calc-page { background: #f8fafc; color: var(--slate-body); }
.calc-hero { padding: 4rem 0 3rem; background: linear-gradient(135deg, #1e1838, #34205c); color: #fff; }
.calc-breadcrumb { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.5rem; color: #cbd5e1; font-size: .9rem; }
.calc-breadcrumb a { color: #b9dcf3; }
.calc-kicker { color: #97caeb; font-size: .78rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.calc-hero h1 { max-width: 850px; margin: .5rem 0 1rem; color: #fff; font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1.1; }
.calc-intro { max-width: 800px; color: #e2e8f0; font-size: 1.1rem; line-height: 1.65; }
.calc-content { padding: 2.5rem 0 4rem; }
.calc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 2rem; align-items: start; }
.calc-main { min-width: 0; }

/* Directory */
.calc-sidebar { position: sticky; top: 6.5rem; max-height: calc(100vh - 8rem); overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; }
.calc-directory summary { padding: 1rem 1.2rem; color: var(--purple-navy); font-weight: 800; cursor: pointer; }
.calc-directory nav { padding: 0 .7rem 1rem; }
.calc-group-label { margin: .9rem .5rem .3rem; color: #575756; font-size: .74rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.calc-directory ul { margin: 0; padding: 0; list-style: none; }
.calc-directory li a { display: block; padding: .42rem .5rem; border-radius: 6px; color: #253452; font-size: .9rem; line-height: 1.3; text-decoration: none; }
.calc-directory li a:hover, .calc-directory li a:focus-visible { background: #eef6fb; text-decoration: underline; }
.calc-directory li a.active { background: var(--purple-navy); color: #fff; font-weight: 700; }

/* Units and tabs */
.calc-unit-switch { display: flex; justify-content: flex-end; align-items: center; gap: .6rem; margin-bottom: .9rem; font-size: .9rem; font-weight: 700; }
.calc-unit-switch select { padding: .4rem .6rem; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; }
.calc-tabs { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: -1px; }
.calc-tabs[hidden] { display: none; }
.calc-tab { padding: .6rem .85rem; border: 1px solid #e2e8f0; border-bottom: 0; border-radius: 8px 8px 0 0; background: #eef2f7; color: #253452; font: inherit; font-size: .88rem; font-weight: 650; line-height: 1.25; text-align: left; cursor: pointer; }
.calc-tab:hover { background: #dfeaf3; }
.calc-tab:focus-visible { outline: 3px solid #97caeb; outline-offset: -3px; }
.calc-tab[aria-selected="true"] { position: relative; background: #fff; color: var(--purple-navy); box-shadow: inset 0 3px 0 #34205c; }

/* Calculator panel */
.calc-panel { padding: 1.6rem; border: 1px solid #e2e8f0; border-radius: 0 12px 12px 12px; background: #fff; }
.calc-panel + .calc-panel { margin-top: 1rem; }
.calc-panel[hidden] { display: none; }
.calc-panel h2 { margin: 0 0 .4rem; color: var(--purple-navy); font-size: 1.4rem; }
.calc-summary { margin: 0 0 1.3rem; }
.calc-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem 1.3rem; }
.calc-field label { display: block; margin-bottom: .3rem; color: #253452; font-size: .88rem; font-weight: 650; line-height: 1.3; }
.calc-input-line { display: flex; align-items: stretch; }
.calc-input-line input, .calc-input-line select { flex: 1; min-width: 0; width: 100%; padding: .55rem .65rem; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; color: #1e293b; font: inherit; font-size: 16px; }
.calc-input-line input:not(:last-child) { border-radius: 6px 0 0 6px; }
.calc-input-line input:focus, .calc-input-line select:focus { outline: 2px solid #34205c; outline-offset: 1px; }
.calc-unit { display: flex; align-items: center; padding: 0 .6rem; border: 1px solid #cbd5e1; border-left: 0; border-radius: 0 6px 6px 0; background: #f1f5f9; color: #475569; font-size: .8rem; white-space: nowrap; }
.calc-hint { margin: .3rem 0 0; color: #575756; font-size: .78rem; line-height: 1.35; }
.calc-actions { margin-top: 1.3rem; }
.calc-submit { padding: .7rem 1.8rem; border: 0; border-radius: 8px; background: #34205c; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.calc-submit:hover, .calc-submit:focus-visible { background: #1e1838; }

/* Output */
.calc-output:not(:empty) { margin-top: 1.5rem; padding-top: 1.2rem; border-top: 1px solid #e2e8f0; }
.calc-output h3 { margin: 0 0 .8rem; color: var(--purple-navy); font-size: 1.1rem; }
.calc-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .7rem; margin: 0; }
.calc-results > div { padding: .75rem .9rem; border-left: 4px solid #97caeb; border-radius: 6px; background: #f1f7fb; }
.calc-results dt { color: #475569; font-size: .8rem; line-height: 1.3; }
.calc-results dd { margin: .2rem 0 0; color: var(--purple-navy); font-size: 1.15rem; font-weight: 800; overflow-wrap: anywhere; }
.calc-table-wrap { margin-top: 1rem; overflow-x: auto; }
.calc-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.calc-table th, .calc-table td { padding: .5rem .7rem; border-bottom: 1px solid #e2e8f0; text-align: right; white-space: nowrap; }
.calc-table th:first-child, .calc-table td:first-child { text-align: left; }
.calc-table th { background: #f1f5f9; color: #253452; }
.calc-row-mark td { background: #e7f3fb; font-weight: 800; }
.calc-note { margin: .8rem 0 0; color: #475569; font-size: .85rem; line-height: 1.5; }
.calc-error { margin: 0; padding: .7rem .9rem; border-left: 4px solid #b91c1c; border-radius: 6px; background: #fef2f2; color: #991b1b; font-weight: 600; }
.calc-disclaimer { margin: 1.3rem 0 0; color: #575756; font-size: .85rem; line-height: 1.55; }

/* Hub */
.calc-hub-group { margin-bottom: 2rem; }
.calc-hub-group h2 { margin: 0 0 .8rem; color: var(--purple-navy); font-size: 1.4rem; }
.calc-hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem; }
.calc-hub-card { display: flex; flex-direction: column; gap: .35rem; padding: 1.1rem; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; color: var(--slate-body); font-size: .9rem; line-height: 1.45; text-decoration: none; }
.calc-hub-card:hover, .calc-hub-card:focus-visible { border-color: #34205c; box-shadow: 0 8px 25px rgba(30,24,56,.08); }
.calc-hub-card strong { color: var(--purple-navy); font-size: 1.02rem; }
.calc-hub-card small { margin-top: auto; padding-top: .3rem; color: #315f83; font-weight: 700; }

@media (max-width: 900px) {
  .calc-layout { grid-template-columns: minmax(0, 1fr); gap: 1.2rem; }
  .calc-sidebar { position: static; max-height: none; order: -1; }
  .calc-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .calc-tab { flex: 0 0 auto; max-width: 230px; }
  .calc-panel { padding: 1.15rem; }
  .calc-fields { grid-template-columns: minmax(0, 1fr); }
}

/* Per-field units and advanced options */
.calc-input-line select.calc-unit-select { flex: 0 0 auto; width: auto; max-width: 45%; border-left: 0; border-radius: 0 6px 6px 0; background: #f1f5f9; color: #475569; font-size: .8rem; }
.calc-adv-toggle { display: block; margin: 1rem 0 0 auto; padding: .45rem 1rem; border: 1px solid #cbd5e1; border-radius: 999px; background: #fff; color: var(--purple-navy); font: inherit; font-size: .85rem; font-weight: 650; cursor: pointer; }
.calc-adv-toggle:hover, .calc-adv-toggle:focus-visible { background: #eef6fb; }
.calc-advanced { margin-top: 1rem; }
.calc-advanced[hidden] { display: none; }
