:root {
    --navy: #173653;
    --navy-dark: #102a43;
    --teal: #078577;
    --teal-dark: #05695f;
    --pellet: #c66a22;
    --pellet-dark: #9e5019;
    --blue: #2d67e3;
    --green: #087f5b;
    --red: #c92a2a;
    --amber: #e59b17;
    --ink: #14263a;
    --muted: #64748b;
    --line: #dce4ea;
    --soft: #f4f7f9;
    --white: #ffffff;
    --shadow: 0 12px 32px rgba(15, 42, 67, 0.08);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--soft);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at top right, rgba(7, 133, 119, 0.07), transparent 30rem),
        var(--soft);
    font-family:
        Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--navy);
    color: var(--white);
    box-shadow: 0 4px 18px rgba(15, 42, 67, 0.2);
}

.topbar-inner {
    width: min(1180px, calc(100% - 32px));
    min-height: 68px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--white);
    text-decoration: none;
    white-space: nowrap;
}

.brand-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: linear-gradient(135deg, #18a999, #087f70);
    font-weight: 900;
    font-size: 19px;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 14px;
}

.brand small {
    margin-top: 1px;
    color: #c8d8e6;
    font-size: 10px;
}

.navigation {
    display: flex;
    align-items: center;
    gap: 4px;
}

.navigation a,
.nav-button {
    border: 0;
    border-radius: 8px;
    padding: 9px 11px;
    color: #d9e6ef;
    background: transparent;
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
}

.navigation a:hover,
.navigation a.active,
.nav-button:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.12);
}

.navigation form {
    margin: 0;
}

.page {
    width: min(1180px, calc(100% - 32px));
    min-height: calc(100vh - 130px);
    margin: 0 auto;
    padding: 34px 0 52px;
}

.footer {
    padding: 20px 16px 30px;
    color: var(--muted);
    text-align: center;
    font-size: 12px;
}

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

h1 {
    margin-bottom: 8px;
    color: var(--navy-dark);
    font-size: clamp(26px, 4vw, 38px);
    line-height: 1.12;
}

h2 {
    margin-bottom: 6px;
    color: var(--navy-dark);
    font-size: 19px;
}

p {
    margin-bottom: 0;
}

.eyebrow {
    display: block;
    margin-bottom: 6px;
    color: var(--teal);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.muted {
    color: var(--muted);
}

.hero {
    max-width: 760px;
    margin: 12px 0 28px;
}

.hero p,
.page-head p {
    color: var(--muted);
}

.page-head {
    margin: 0 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
}

.page-head > div:first-child {
    max-width: 760px;
}

.portal-grid,
.split-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.portal-card {
    min-height: 260px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow);
}

.portal-card p {
    min-height: 72px;
    color: var(--muted);
}

.portal-symbol {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: white;
    background: var(--teal);
    font-size: 25px;
    font-weight: 900;
}

.pellet-card .portal-symbol {
    background: var(--pellet);
}

.pellet-card .eyebrow {
    color: var(--pellet-dark);
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 9px 14px;
    text-decoration: none;
    font-weight: 750;
    font-size: 13px;
    cursor: pointer;
}

.button.primary {
    color: var(--white);
    background: var(--teal);
}

.button.primary:hover {
    background: var(--teal-dark);
}

.button.secondary {
    color: var(--navy-dark);
    border-color: var(--line);
    background: var(--white);
}

.button.secondary:hover {
    border-color: #b8c7d3;
    background: #f8fafc;
}

.button.wide {
    width: 100%;
}

.notice,
.alert {
    margin-top: 22px;
    padding: 14px 16px;
    border: 1px solid #bfe3db;
    border-radius: 12px;
    color: #17665a;
    background: #edf9f6;
    font-size: 13px;
}

.alert.error {
    margin: 16px 0;
    border-color: #f2c1c1;
    color: #9b2424;
    background: #fff1f1;
}

.section-title {
    margin: 28px 0 12px;
}

.card-list {
    display: grid;
    gap: 14px;
}

.statement-card,
.history-card,
.panel,
.summary-card,
.metric {
    border: 1px solid var(--line);
    background: var(--white);
}

.statement-card,
.history-card,
.panel {
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.statement-card {
    padding: 22px;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.history-card {
    padding: 20px;
    border-left: 4px solid #8aa0b4;
}

.card-heading,
.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.card-heading.compact {
    align-items: center;
}

.card-heading h2 {
    margin: 7px 0 3px;
}

.badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 800;
}

.badge.final {
    color: #0a6648;
    background: #dff7ed;
}

.badge.history {
    color: #526579;
    background: #edf1f5;
}

.badge.small {
    margin-left: 6px;
    padding: 3px 6px;
    font-size: 9px;
}

.balance {
    text-align: right;
    white-space: nowrap;
}

.balance small,
.balance strong {
    display: block;
}

.balance small {
    color: var(--muted);
    font-size: 10px;
}

.balance strong {
    margin-top: 3px;
    font-size: 20px;
}

.balance.positive strong,
.text-positive {
    color: var(--green);
}

.balance.negative strong,
.text-negative {
    color: var(--red);
}

.metric-grid,
.summary-grid {
    display: grid;
    gap: 12px;
}

.metric-grid.four,
.summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-grid {
    margin-top: 18px;
}

.metric {
    min-width: 0;
    padding: 14px;
    border-radius: 11px;
    background: #f7f9fb;
}

.metric span,
.summary-card span,
.detail-grid span,
.detail-list span {
    display: block;
    color: var(--muted);
    font-size: 11px;
}

.metric strong,
.summary-card strong {
    display: block;
    margin-top: 4px;
    overflow-wrap: anywhere;
}

.overview-metrics {
    margin: 18px 0;
}

.summary-grid {
    margin-bottom: 18px;
}

.summary-card {
    min-height: 118px;
    padding: 19px;
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.summary-card strong {
    color: var(--navy-dark);
    font-size: 23px;
}

.summary-card small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
}

.summary-card.pellet-accent {
    border-color: #ecc7aa;
    background: linear-gradient(135deg, #fff9f3, #ffffff);
}

.summary-card.pellet-accent strong {
    color: var(--pellet-dark);
}

.panel {
    margin-bottom: 18px;
    padding: 20px;
}

.panel-head {
    margin-bottom: 16px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.detail-grid > div,
.detail-list > div {
    padding: 13px 14px;
    border-radius: 10px;
    background: #f7f9fb;
}

.detail-grid strong,
.detail-list strong {
    display: block;
    margin-top: 4px;
    color: var(--navy-dark);
}

.detail-list {
    display: grid;
    gap: 9px;
}

.detail-list > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 11px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    font-size: 13px;
}

th,
td {
    padding: 12px 13px;
    border-bottom: 1px solid #e6ebef;
    text-align: left;
    white-space: nowrap;
}

th {
    color: #4d6174;
    background: #f4f7f9;
    font-size: 11px;
    letter-spacing: 0.02em;
}

tbody tr:hover {
    background: #f9fbfc;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tfoot th {
    color: var(--navy-dark);
    background: #edf7f5;
    font-size: 13px;
}

.table-actions {
    display: flex;
    gap: 10px;
}

.table-actions a {
    color: var(--teal-dark);
    font-weight: 750;
    text-decoration: none;
}

.table-actions a:hover {
    text-decoration: underline;
}

.monthly-table table {
    min-width: 1040px;
    font-size: 12px;
}

.monthly-table th,
.monthly-table td {
    padding: 9px 8px;
    text-align: right;
}

.monthly-table th:first-child,
.monthly-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    text-align: left;
    background: #f4f7f9;
}

.monthly-table td.zero {
    color: #b4bec7;
}

.bar-chart {
    display: grid;
    gap: 10px;
}

.bar-row {
    min-height: 34px;
    display: grid;
    grid-template-columns: 54px minmax(120px, 1fr) 105px;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

a.bar-row {
    border-radius: 8px;
    padding: 2px 5px;
}

a.bar-row:hover {
    background: #f4f7f9;
}

.bar-year,
.bar-date,
.bar-value {
    font-size: 11px;
}

.bar-date {
    min-width: 82px;
}

.bar-value {
    text-align: right;
}

.bar-track {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8edf1;
}

.bar-fill {
    width: 0;
    height: 100%;
    display: block;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--blue), #5790ff);
}

.bar-fill.pellet {
    background: linear-gradient(90deg, var(--pellet-dark), #e28a42);
}

.bar-fill.price {
    background: linear-gradient(90deg, var(--teal-dark), #1caf9e);
}

.price-bars .bar-row {
    grid-template-columns: 88px minmax(120px, 1fr) 105px;
}

.login-wrap {
    min-height: calc(100vh - 190px);
    display: grid;
    place-items: center;
}

.login-card {
    width: min(440px, 100%);
    padding: 32px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--white);
    box-shadow: 0 22px 60px rgba(15, 42, 67, 0.14);
}

.login-card h1 {
    font-size: 29px;
}

.login-form {
    display: grid;
    gap: 8px;
    margin-top: 22px;
}

.login-form label {
    margin-top: 6px;
    color: #42566a;
    font-size: 12px;
    font-weight: 750;
}

.login-form input {
    width: 100%;
    height: 45px;
    border: 1px solid #cbd5de;
    border-radius: 9px;
    padding: 0 12px;
    color: var(--ink);
    background: var(--white);
    outline: none;
}

.login-form input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(7, 133, 119, 0.12);
}

.login-form .button {
    margin-top: 12px;
    border: 0;
}

.notice ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

@media (max-width: 900px) {
    .topbar-inner {
        padding: 10px 0;
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .navigation {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .navigation a,
    .nav-button {
        white-space: nowrap;
    }

    .metric-grid.four,
    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 700px) {
    .page {
        width: min(100% - 20px, 1180px);
        padding-top: 22px;
    }

    .topbar-inner {
        width: min(100% - 20px, 1180px);
    }

    .page-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }

    .portal-grid,
    .split-grid {
        grid-template-columns: 1fr;
    }

    .portal-card {
        min-height: auto;
        grid-template-columns: 1fr;
        padding: 21px;
    }

    .portal-card p {
        min-height: auto;
    }

    .statement-card,
    .history-card,
    .panel {
        padding: 16px;
    }

    .card-heading {
        flex-direction: column;
    }

    .balance {
        text-align: left;
    }

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

    .bar-row {
        grid-template-columns: 42px minmax(80px, 1fr) 92px;
        gap: 7px;
    }

    .price-bars .bar-row {
        grid-template-columns: 76px minmax(80px, 1fr) 92px;
    }
}

@media (max-width: 480px) {
    .metric-grid.four,
    .metric-grid.two,
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .button-row,
    .button-row .button {
        width: 100%;
    }

    .login-card {
        padding: 23px 18px;
    }

    .detail-list > div {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .bar-row {
        grid-template-columns: 40px minmax(60px, 1fr) 82px;
    }

    .bar-value {
        font-size: 10px;
    }
}
