:root {
    --ink: #e9f1ed;
    --muted: #cbd8d3;
    --muted-strong: #dfe8e4;
    --placeholder: #aebdb8;
    --intro-muted: #edf4f1;
    --surface: rgba(11, 29, 37, 0.12);
    --surface-soft: rgba(31, 57, 64, 0.26);
    --line: rgba(200, 235, 224, 0.22);
    --line-strong: rgba(166, 210, 197, 0.82);
    --glass-highlight: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.018) 42%, rgba(125, 227, 208, 0.04));
    --accent: #b8f36b;
    --accent-dark: #153521;
    --aqua: #7de3d0;
    --warning: #ffd28a;
    --radius-large: 28px;
    --shadow: 0 26px 80px rgba(0, 0, 0, 0.24);
}

* {
    box-sizing: border-box;
}

html {
    background: #09151d url("mauritius-coast.jpg") center / cover fixed no-repeat;
    color-scheme: dark;
}

body {
    min-height: 100vh;
    min-width: 320px;
    margin: 0;
    background:
        radial-gradient(circle at 8% 10%, rgba(56, 128, 111, 0.17), transparent 33rem),
        radial-gradient(circle at 88% 18%, rgba(137, 229, 141, 0.09), transparent 28rem),
        linear-gradient(145deg, rgba(9, 21, 29, 0.56) 0%, rgba(13, 32, 40, 0.62) 57%, rgba(10, 23, 30, 0.76) 100%);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.55;
}

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

a:hover {
    color: #d9ffad;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(184, 243, 107, 0.48);
    outline-offset: 3px;
}

button,
input,
select {
    font: inherit;
}

.site-shell {
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
    padding: 24px 0 44px;
}

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

.intro-heading h1 {
    min-width: 0;
    flex: 1 1 auto;
}

.utility-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
    flex: 0 0 auto;
    font-size: 0.85rem;
    line-height: 0.98;
}

.utility-nav a {
    display: inline-flex;
    align-items: center;
    color: var(--intro-muted);
    text-decoration: underline;
    text-decoration-color: rgba(184, 243, 107, 0.42);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.source-strip,
.result-topline,
.card-heading,
.section-heading,
.minimum-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.intro {
    margin-bottom: 32px;
}

.result-label,
.projection span,
.field-label > span,
.field-label small,
.date-label,
.date-label small,
.section-heading span {
    text-transform: uppercase;
    letter-spacing: 0.13em;
}

h1,
h2,
h3,
p {
    margin: 0;
}

h1,
h2,
h3 {
    font-weight: 680;
}

h1 {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 18px;
    margin: 15px 0;
    color: #f5fbf6;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: -0.065em;
    line-height: 0.98;
}

.heading-flag {
    width: 52px;
    max-width: 52px;
    height: 33px;
    flex: 0 0 auto;
    border: 1px solid rgba(233, 241, 237, 0.2);
    border-radius: 6px;
    box-shadow: 0 7px 18px rgba(0, 0, 0, 0.2);
}

@media (min-width: 621px) {
    h1 {
        max-width: none;
        white-space: nowrap;
    }
}

@media (max-width: 620px) {
    .intro-heading {
        gap: 12px;
    }

    h1 {
        gap: 10px;
        font-size: clamp(0.95rem, calc(8vw - 10px), 1.6rem);
        white-space: nowrap;
    }

    .heading-flag {
        width: 36px;
        max-width: 36px;
        height: 23px;
    }
}

.intro-copy {
    max-width: 650px;
    color: var(--intro-muted);
    font-size: 1.08rem;
    line-height: 1.5;
}

@media (min-width: 901px) {
    .intro-copy {
        max-width: none;
        white-space: nowrap;
    }
}

.source-strip {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px 28px;
    margin-top: 20px;
    color: var(--intro-muted);
    font-size: 0.85rem;
}

.source-strip strong {
    color: var(--intro-muted);
    font-weight: 650;
}

.source-strip a {
    border-bottom: 1px solid rgba(184, 243, 107, 0.42);
    color: #d9ffad;
    padding-bottom: 2px;
}

.source-strip a {
    overflow-wrap: anywhere;
}

#rate-meta {
    flex-basis: 100%;
}

.site-footer {
    display: flex;
    justify-content: center;
    padding-top: 20px;
    font-size: 0.78rem;
}

.site-footer a {
    color: var(--muted);
    text-decoration: underline;
    text-decoration-color: rgba(203, 216, 211, 0.38);
    text-underline-offset: 3px;
}

.site-footer a:hover {
    color: var(--accent);
}

.data-status-error {
    color: #ffb6a0;
}

.calculator-layout {
    display: grid;
    grid-template-columns: minmax(320px, 0.83fr) minmax(420px, 1.17fr);
    gap: 18px;
    align-items: stretch;
}

.card {
    border: 1px solid var(--line);
    background: var(--glass-highlight), var(--surface);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), var(--shadow);
    backdrop-filter: blur(12px) saturate(125%);
    -webkit-backdrop-filter: blur(12px) saturate(125%);
}

.card {
    min-width: 0;
    border-radius: var(--radius-large);
    padding: 28px;
}

.input-card {
    display: flex;
    flex-direction: column;
}

.card-heading {
    align-items: flex-start;
    margin-bottom: 22px;
}

.result-topline {
    align-items: flex-start;
    margin-bottom: 0;
}

h2 {
    margin-top: 2px;
    font-size: 1.45rem;
    letter-spacing: -0.02em;
}

h3 {
    font-size: 1.02rem;
    letter-spacing: -0.01em;
}

.form-stack {
    display: grid;
    gap: 14px;
}

.field-label {
    display: grid;
    min-width: 0;
    gap: 7px;
    color: var(--muted-strong);
    font-size: 0.9rem;
    font-weight: 650;
}

.field-label > span {
    font-size: 0.69rem;
    font-weight: 800;
}

.field-label small {
    color: var(--muted);
    font-size: 0.6rem;
}

input,
select {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background-color: rgba(8, 22, 28, 0.46);
    color: var(--ink);
    font-size: 1rem;
    line-height: 1.2;
}

input {
    padding: 14px 15px;
}

#start-reading::placeholder,
#end-reading::placeholder {
    color: var(--placeholder);
    opacity: 1;
}

select {
    min-height: 50px;
    padding: 12px 42px 12px 15px;
    background-image: linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%);
    background-position: calc(100% - 19px) 22px, calc(100% - 13px) 22px;
    background-repeat: no-repeat;
    background-size: 6px 6px, 6px 6px;
    appearance: none;
}

input:hover,
select:hover {
    border-color: rgba(184, 243, 107, 0.9);
}

.reading-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.date-field {
    display: grid;
    min-width: 0;
    gap: 7px;
    color: var(--muted-strong);
    font-size: 0.9rem;
    font-weight: 650;
}

.date-label {
    font-size: 0.69rem;
    font-weight: 800;
    white-space: nowrap;
}

.date-label small {
    color: var(--muted);
    font-size: 0.6rem;
}

.date-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background-color: rgba(8, 22, 28, 0.46);
}

.date-control:hover {
    border-color: rgba(184, 243, 107, 0.9);
}

.date-control:focus-within {
    outline: 3px solid rgba(184, 243, 107, 0.48);
    outline-offset: 3px;
}

.date-select-button {
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1.2;
    padding-inline: 12px;
    padding-block: 14px;
    text-align: left;
}

.date-select-button.empty-date {
    color: var(--placeholder);
}

.date-select-button.empty-date svg {
    color: var(--placeholder);
}

.date-select-button:hover,
.date-select-button:focus-visible {
    border-color: transparent;
    outline: 0;
}

.date-select-button svg {
    width: 17px;
    flex: 0 0 auto;
    fill: none;
    color: rgba(220, 224, 226, 0.78);
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.5;
}

.date-picker-dialog {
    width: min(320px, calc(100% - 32px));
    height: fit-content;
    max-height: calc(100dvh - 32px);
    overflow: auto;
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    background: #10262e;
    box-shadow: var(--shadow);
    color: var(--ink);
    padding: 17px;
}

.date-picker-dialog[open] {
    display: grid;
    align-content: start;
    gap: 12px;
}

.date-picker-dialog::backdrop {
    background: rgba(3, 11, 15, 0.68);
    backdrop-filter: blur(3px);
}

.date-picker-heading {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    align-items: center;
    gap: 8px;
}

.date-picker-current-month {
    appearance: none;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 8px 4px;
    text-align: center;
}

.date-picker-nav,
.date-picker-today,
.date-picker-close,
.date-picker-day {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}

.date-picker-nav {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 1rem;
}

.date-picker-nav:hover,
.date-picker-nav:focus-visible,
.date-picker-current-month:hover,
.date-picker-current-month:focus-visible,
.date-picker-day:hover,
.date-picker-day:focus-visible {
    background: var(--surface-soft);
}

.date-picker-weekdays,
.date-picker-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.date-picker-weekdays span {
    color: var(--muted);
    font-size: 0.58rem;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
}

.date-picker-day,
.date-picker-empty {
    min-width: 0;
    aspect-ratio: 1;
}

.date-picker-day {
    border-radius: 999px;
    font-size: 0.82rem;
}

.date-picker-day.is-today {
    box-shadow: inset 0 0 0 1px var(--line-strong);
}

.date-picker-day.is-selected {
    background: var(--accent);
    color: var(--accent-dark);
    font-weight: 800;
}

.date-picker-actions {
    display: flex;
    justify-content: space-between;
}

.date-picker-today,
.date-picker-close {
    color: var(--muted-strong);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 2px;
}

.date-picker-today:hover,
.date-picker-today:focus-visible,
.date-picker-close:hover,
.date-picker-close:focus-visible {
    color: var(--accent);
}

.field-help {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.55;
}

.field-help {
    margin-top: -6px;
}

.hidden-field {
    display: none;
}

.form-error:not([hidden]) {
    display: grid;
    gap: 8px;
    margin-top: 20px;
    border: 1px solid rgba(255, 145, 119, 0.4);
    border-radius: 12px;
    background: rgba(108, 35, 35, 0.24);
    color: #ffb6a0;
    font-size: 0.84rem;
    line-height: 1.4;
    padding: 12px 14px;
}

#form-error-message {
    display: grid;
    gap: 4px;
}

.error-contact {
    color: #ffd0c2;
    font-size: 0.8rem;
    font-weight: 750;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.result-card {
    background:
        radial-gradient(circle at 95% 0%, rgba(184, 243, 107, 0.13), transparent 19rem),
        var(--glass-highlight),
        var(--surface);
}

.share-button {
    appearance: none;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--ink);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 750;
    padding: 7px 12px;
}

.share-button:hover:not(:disabled) {
    border-color: rgba(184, 243, 107, 0.45);
    color: var(--accent);
}

.share-button:disabled {
    cursor: default;
    opacity: 0.4;
}

.result-hero {
    margin: 24px 0 20px;
}

.result-label {
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 800;
}

.result-amount {
    display: block;
    margin: 8px 0 7px;
    color: var(--accent);
    font-size: clamp(2.5rem, 5vw, 4.4rem);
    letter-spacing: -0.075em;
    line-height: 0.98;
}

.result-hero p {
    color: var(--muted-strong);
    font-size: 0.9rem;
}

.projection-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.projection {
    min-width: 0;
    padding: 14px 12px 14px 0;
}

.projection + .projection {
    border-left: 1px solid var(--line);
    padding-left: 12px;
}

.projection span {
    display: block;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.59rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.projection strong {
    display: block;
    margin-top: 7px;
    color: var(--ink);
    font-size: 0.92rem;
    line-height: 1.2;
}

.breakdown-section {
    margin-top: 22px;
}

.section-heading {
    margin-bottom: 12px;
}

.section-heading span {
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 800;
}

.breakdown-list {
    display: grid;
    gap: 8px;
}

.breakdown-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 12px;
    align-items: center;
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--muted-strong);
    font-size: 0.78rem;
    padding: 10px 12px;
}

.breakdown-row strong {
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 700;
}

.breakdown-row .band-rate {
    color: var(--muted);
    white-space: nowrap;
}

.minimum-row {
    gap: 12px;
    margin-top: 9px;
    color: var(--muted);
    font-size: 0.72rem;
    padding: 3px 12px 0;
}

.minimum-row[hidden] {
    display: none;
}

.minimum-row strong {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
}

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

@media (max-width: 620px) {
    .site-shell {
        width: min(100% - 28px, 560px);
        padding-top: 16px;
    }

    .intro {
        margin-bottom: 24px;
    }

    .intro-copy {
        font-size: 0.98rem;
    }

    .card {
        border-radius: 21px;
        padding: 21px;
    }

    .projection-grid {
        grid-template-columns: 1fr 1fr;
    }

    .projection:nth-child(3) {
        border-left: 0;
        border-top: 1px solid var(--line);
        padding-left: 0;
    }

    .projection:nth-child(4) {
        border-top: 1px solid var(--line);
    }

}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
