:root {
    --slate-950: #172019;
    --slate-900: #243128;
    --slate-800: #32443a;
    --slate-700: #4d6156;
    --stone-50: #f8f8f4;
    --stone-100: #eef1ea;
    --stone-200: #e1e7de;
    --stone-300: #cdd7cb;
    --stone-500: #6f7b73;
    --brand-green-700: #0f6d38;
    --brand-green-600: #1a8147;
    --brand-green-500: #2a9756;
    --brand-green-100: #dbefe1;
    --brand-green-050: #f1f8f3;
    --white: #ffffff;
    --danger: #b84545;
    --success: #2f7a50;
    --shadow: 0 18px 40px rgba(23, 32, 25, 0.08);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
    --container: min(1160px, calc(100% - 2rem));
    --font-sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--slate-950);
    background:
        radial-gradient(circle at top left, rgba(42, 151, 86, 0.08), transparent 24%),
        linear-gradient(180deg, #fafbf8 0%, #f0f3ee 100%);
}
a { color: var(--brand-green-700); text-decoration: none; }
img { display: block; max-width: 100%; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 1rem; border-bottom: 1px solid var(--stone-200); text-align: left; }
input, select, textarea, button {
    font: inherit;
}

.container { width: var(--container); margin: 0 auto; }
.container-admin {
    width: calc(100% - 2rem);
    max-width: none;
}
.narrow { max-width: 760px; }
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(14px);
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(23, 32, 25, 0.08);
    box-shadow: 0 12px 30px rgba(23, 32, 25, 0.06);
}
.nav-shell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
}
.brand {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.75rem;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(15, 109, 56, 0.12);
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(23, 32, 25, 0.05);
}
.brand-logo { max-height: 56px; width: auto; }
.brand-fallback {
    display: inline-block;
    color: var(--slate-950);
    font-weight: 700;
    letter-spacing: 0.02em;
}
.site-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}
.site-nav a {
    color: var(--slate-900);
    font-size: 0.95rem;
    font-weight: 600;
}
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 1.2rem;
    border-radius: 999px;
    border: 1px solid transparent;
    background: linear-gradient(135deg, var(--brand-green-700), var(--brand-green-500));
    color: var(--white);
    font-weight: 700;
    box-shadow: var(--shadow);
}
.button-small { padding: 0.7rem 1rem; }
.button-secondary {
    background: var(--white);
    color: var(--brand-green-700);
    border-color: rgba(15, 109, 56, 0.18);
}
.button-ghost {
    background: transparent;
    color: var(--white);
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: none;
}
.hero {
    padding: 4rem 0 3rem;
    background:
        radial-gradient(circle at top right, rgba(219, 239, 225, 0.18), transparent 28%),
        radial-gradient(circle at bottom left, rgba(42, 151, 86, 0.14), transparent 30%),
        linear-gradient(135deg, #213129 0%, #304238 54%, #46624f 100%);
    color: var(--white);
}
.hero-grid, .split-panel, .footer-grid, .card-grid {
    display: grid;
    gap: 1.5rem;
}
.hero-grid, .split-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; }
.hero h1 { font-size: clamp(2.4rem, 5vw, 4.4rem); line-height: 1.02; margin: 0 0 1rem; }
.eyebrow {
    margin: 0 0 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #d8f0e0;
    font-size: 0.78rem;
    font-weight: 700;
}
.lead { font-size: 1.1rem; line-height: 1.7; max-width: 62ch; color: rgba(255, 255, 255, 0.86); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.5rem; }
.hero-visual img, .illustration-card img {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.hero-visual img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}
.section, .page-header { padding: 3rem 0; }
.section-muted { background: rgba(255, 255, 255, 0.7); }
.card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card, .table-card, .illustration-card, .rate-tile, .notice-box {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(23, 32, 25, 0.08);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.card, .rate-tile, .notice-box { padding: 1.5rem; }
.service-card {
    display: grid;
    align-content: start;
}
.service-card-media {
    width: min(180px, 100%);
    margin: 0 auto 1.1rem;
}
.service-circle-visual {
    width: min(320px, 100%);
    margin: 0 auto;
}
.table-card { overflow: hidden; }
.table-card table thead {
    background: var(--brand-green-050);
}
.table-card table th {
    white-space: nowrap;
}
.rate-board th,
.rate-board td {
    vertical-align: middle;
}
.rate-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.rate-flag {
    width: 30px;
    height: 20px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid rgba(23, 32, 25, 0.12);
    background: var(--white);
    flex-shrink: 0;
}
.rate-flag-preview {
    margin-bottom: 0.65rem;
}
.rate-flag-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    min-height: 36px;
    margin-bottom: 0.65rem;
    border: 1px dashed var(--stone-300);
    border-radius: 8px;
    background: var(--stone-100);
    color: var(--stone-500);
    font-size: 0.82rem;
}
.rate-tile {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}
.rate-tile .label {
    margin: 0 0 0.35rem;
    color: var(--stone-500);
}
.rate-tile .value {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: var(--brand-green-700);
}
.stacked-form { display: grid; gap: 1rem; }
.stacked-form label { font-weight: 600; }
.stacked-form input, .stacked-form select, .stacked-form textarea {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid var(--stone-300);
    border-radius: var(--radius-sm);
    background: var(--white);
}
.stacked-form input:focus, .stacked-form select:focus, .stacked-form textarea:focus {
    outline: none;
    border-color: rgba(26, 129, 71, 0.55);
    box-shadow: 0 0 0 4px rgba(26, 129, 71, 0.12);
}
.field-block {
    display: grid;
    gap: 0.45rem;
}
.stacked-form input.is-invalid,
.stacked-form select.is-invalid,
.stacked-form textarea.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px rgba(184, 69, 69, 0.12);
}
.field-error {
    margin: 0;
    color: var(--danger);
    font-size: 0.92rem;
    line-height: 1.45;
}
.stacked-form input.is-readonly,
.stacked-form textarea.is-readonly,
.stacked-form input[readonly],
.stacked-form textarea[readonly] {
    background: var(--stone-100);
    color: var(--stone-500);
}
.calculator-results {
    display: grid;
    gap: 0.8rem;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, var(--brand-green-050), var(--white));
}
.calculator-results div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}
.microcopy {
    color: var(--stone-500);
    line-height: 1.6;
}
.steps {
    margin: 0;
    padding-left: 1.2rem;
    line-height: 1.8;
}
.detail-stack p { margin: 0 0 0.75rem; }
.footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.site-footer {
    margin-top: 4rem;
    padding: 3rem 0;
    background:
        radial-gradient(circle at top left, rgba(42, 151, 86, 0.08), transparent 28%),
        linear-gradient(180deg, var(--slate-950) 0%, #101710 100%);
    color: rgba(255, 255, 255, 0.88);
}
.site-footer a { color: #c8efd5; }
.flash {
    padding: 0.9rem 0;
    color: var(--white);
}
.flash-success { background: var(--success); }
.flash-error { background: var(--danger); }
.flash-info { background: var(--brand-green-700); }
.rates-last-updated {
    margin: 1rem 0 1.25rem;
    color: var(--stone-500);
    font-weight: 600;
}
.admin-sheet-toolbar,
.admin-sheet-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.admin-sheet-toolbar input[type="text"] {
    flex: 1 1 320px;
}
.admin-rate-board input[type="text"],
.admin-rate-board input[type="number"],
.admin-rate-board input[type="file"] {
    width: 100%;
    padding: 0.65rem 0.7rem;
    border: 1px solid var(--stone-300);
    border-radius: 10px;
}
.admin-rate-board input[type="checkbox"] {
    width: 20px;
    height: 20px;
}
.drag-cell {
    width: 56px;
    text-align: center;
}
.drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.65rem 0.5rem;
    border: 1px dashed var(--stone-300);
    border-radius: 10px;
    background: var(--stone-100);
    color: var(--stone-500);
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: grab;
    box-shadow: none;
    user-select: none;
    touch-action: none;
}
.admin-rate-row.is-dragging {
    opacity: 0.45;
    pointer-events: none;
}
.is-sorting-rates {
    cursor: grabbing;
}
.is-sorting-rates .drag-handle {
    cursor: grabbing;
}
.admin-rate-row.drag-over-top td {
    border-top: 3px solid var(--brand-green-600);
}
.admin-rate-row.drag-over-bottom td {
    border-bottom: 3px solid var(--brand-green-600);
}
.admin-rate-row.is-marked-for-removal {
    opacity: 0.45;
    background: rgba(184, 69, 69, 0.08);
}
.tv-rates-page {
    min-height: 100vh;
    padding: 2.5rem;
    background:
        radial-gradient(circle at top left, rgba(42, 151, 86, 0.14), transparent 26%),
        linear-gradient(180deg, #122117 0%, #193126 100%);
    color: var(--white);
}
.tv-rates-shell {
    display: grid;
    gap: 1.5rem;
}
.tv-rates-header h1 {
    margin: 0;
    font-size: clamp(2rem, 3.5vw, 3.5rem);
}
.tv-rates-table-card {
    background: rgba(255, 255, 255, 0.97);
    color: var(--slate-950);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
}
.tv-rate-board th,
.tv-rate-board td {
    padding: 1.2rem 1.35rem;
    font-size: clamp(1.05rem, 1.7vw, 1.7rem);
}
.tv-rate-board th {
    font-size: clamp(1rem, 1.45vw, 1.3rem);
}
.tv-rate-flag {
    width: 42px;
    height: 28px;
}
.tv-rates-footer {
    display: grid;
    gap: 0.45rem;
    font-size: clamp(1rem, 1.3vw, 1.3rem);
    color: rgba(255, 255, 255, 0.9);
}
.tv-rates-footer p {
    margin: 0;
}
@media (max-width: 900px) {
    .tv-rates-page {
        padding: 1.25rem;
    }
}
.portal-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
}
.portal-shell-guest {
    grid-template-columns: 1fr;
    max-width: 1120px;
}
.portal-sidebar {
    height: fit-content;
    position: sticky;
    top: 6.5rem;
}
.portal-menu {
    display: grid;
    gap: 0.7rem;
}
.portal-menu a {
    padding: 0.8rem 0.95rem;
    border-radius: var(--radius-sm);
    background: var(--brand-green-050);
    color: var(--slate-900);
    font-weight: 600;
}
.portal-main {
    min-width: 0;
    display: grid;
    gap: 1.5rem;
}
.portal-main-guest {
    max-width: 100%;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.form-grid-wide {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.form-grid .full {
    grid-column: 1 / -1;
}
.check-group {
    display: grid;
    gap: 0.85rem;
}
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.metric-grid, .detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.metric-grid .card, .detail-grid div {
    padding: 1rem 1.2rem;
}
.detail-grid span {
    display: block;
    color: var(--stone-500);
    margin-bottom: 0.25rem;
}
.inline-form {
    display: inline;
}
.table-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
}
.text-button {
    border: 0;
    background: none;
    color: var(--brand-green-700);
    cursor: pointer;
    padding: 0;
}
.field-note {
    margin: 0.45rem 0 0;
    color: var(--stone-500);
    font-size: 0.92rem;
    line-height: 1.55;
}
.beneficiary-mode-note {
    margin-top: -0.25rem;
}
.beneficiary-mode-note p,
.beneficiary-save-panel label {
    margin: 0;
}
.beneficiary-save-panel {
    display: grid;
    gap: 0.75rem;
}
.alert-card {
    border-left: 4px solid var(--brand-green-500);
}
.auth-card {
    padding: 2rem;
}
.auth-header {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 1.5rem;
    align-items: start;
    margin-bottom: 1rem;
}
.auth-lead {
    margin: 0;
    color: var(--stone-500);
    line-height: 1.7;
    max-width: 62ch;
}
.auth-note {
    padding: 1rem 1.2rem;
    border-radius: var(--radius-md);
    background: var(--brand-green-050);
    border: 1px solid rgba(15, 109, 56, 0.1);
}
.auth-note p {
    margin: 0;
    color: var(--slate-800);
    line-height: 1.65;
}
.consent-panel {
    margin-top: 0.5rem;
}
.honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    color: var(--brand-green-600);
}
.nav-icon svg {
    width: 1.2rem;
    height: 1.2rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (max-width: 980px) {
    .hero-grid, .split-panel, .footer-grid, .card-grid, .portal-shell, .form-grid, .metric-grid, .detail-grid, .auth-header, .form-grid-wide {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .nav-shell, .site-nav {
        align-items: flex-start;
    }
    .nav-shell {
        flex-direction: column;
    }
    .site-nav {
        justify-content: flex-start;
    }
    th, td {
        padding: 0.85rem 0.7rem;
        font-size: 0.92rem;
    }
}
