:root {
    --ink: #172d2a;
    --muted: #74837f;
    --green: #18a978;
    --green-dark: #087557;
    --mint: #dff5ea;
    --cream: #f7f8f3;
    --card: #ffffff;
    --line: #e5ebe6;
    --coral: #f08d72;
    --navy: #315a63;
    --shadow: 0 16px 50px rgba(30, 65, 57, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    background: var(--cream);
    color: var(--ink);
    font-family: Inter, "Segoe UI", system-ui, sans-serif;
    line-height: 1.5;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

/* Kopfzeile und Logo */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 78px;
    padding: 0 max(24px, calc((100% - 1220px) / 2));
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}

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

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    background: var(--green);
    color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(24, 169, 120, 0.25);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.user-dot {
    display: grid;
    place-items: center;
    width: 35px;
    height: 35px;
    background: var(--mint);
    color: var(--green-dark);
    border-radius: 50%;
    font-weight: 700;
}

.user-name {
    font-weight: 600;
}

.icon-button,
.delete {
    background: transparent;
    color: var(--muted);
    border: 0;
    font-size: 20px;
}

/* Grundlayout */

.page {
    width: min(1220px, calc(100% - 40px));
    margin: 46px auto 70px;
}

.hero {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin-bottom: 34px;
}

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

.hero h1 {
    margin: 0;
    font-size: clamp(32px, 5vw, 50px);
    font-weight: 800;
    letter-spacing: -0.045em;
}

.hero p,
.panel-head p {
    margin: 5px 0 0;
    color: var(--muted);
}

.month-picker {
    display: flex;
    gap: 8px;
}

.month-picker input,
.muted {
    padding: 10px 14px;
    background: #ffffff;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.month-submit {
    padding: 10px 14px;
    background: var(--green);
    color: #ffffff;
    border: 1px solid var(--green);
    border-radius: 12px;
    font-weight: 700;
}

.month-submit:hover {
    background: var(--green-dark);
    border-color: var(--green-dark);
}

/* Kennzahlen */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat,
.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.stat {
    min-height: 190px;
    padding: 22px;
}

.stat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.stat-head i {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    background: #f1f5f2;
    color: var(--green);
    border-radius: 9px;
    font-style: normal;
}

.stat strong {
    display: block;
    margin-top: 20px;
    font-size: 27px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.stat small,
.auth-card small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
}

.stat.income {
    background: linear-gradient(145deg, #effbf5, #ffffff);
}

.stat.balance {
    background: var(--ink);
    color: #ffffff;
    border-color: var(--ink);
}

.stat.balance.negative {
    background: #6e3d38;
    border-color: #6e3d38;
}

.stat.balance .stat-head,
.stat.balance small {
    color: #bed0cb;
}

.balance-note {
    margin-top: 18px;
    color: #bfead9;
    font-size: 12px;
}

.text-button {
    margin-top: 17px;
    padding: 0;
    background: transparent;
    color: var(--green-dark);
    border: 0;
    font-weight: 700;
}

.progress {
    height: 5px;
    margin-top: 23px;
    overflow: hidden;
    background: #edf1ee;
    border-radius: 4px;
}

.progress span {
    display: block;
    height: 100%;
    background: var(--navy);
    border-radius: 4px;
}

.progress.coral span {
    background: var(--coral);
}

/* Panels und Forecast */

.content-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 18px;
    margin-top: 18px;
}

.panel {
    padding: 26px;
}

.panel.wide {
    margin-top: 18px;
}

.panel-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
}

.panel h2,
.auth-card h2,
.dialog-card h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.badge {
    padding: 6px 10px;
    background: var(--mint);
    color: var(--green-dark);
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
}

.forecast-body {
    display: grid;
    grid-template-columns: 190px 1fr;
    align-items: center;
    gap: 32px;
    margin-top: 30px;
}

.donut {
    position: relative;
    display: grid;
    place-items: center;
    width: 170px;
    aspect-ratio: 1;
    background: conic-gradient(
        var(--green) calc(var(--spent) * 1%),
        #e8eeea 0
    );
    border-radius: 50%;
}

.donut::before {
    position: absolute;
    inset: 18px;
    background: #ffffff;
    border-radius: 50%;
    content: "";
}

.donut div {
    position: relative;
    text-align: center;
}

.donut strong {
    display: block;
    font-size: 28px;
    font-weight: 800;
}

.donut span {
    color: var(--muted);
    font-size: 12px;
}

.forecast-lines > div {
    display: flex;
    justify-content: space-between;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}

.forecast-lines .result {
    padding-top: 18px;
    border: 0;
}

.forecast-lines .current-balance-line {
    color: var(--green-dark);
    font-weight: 700;
}

.forecast-lines .result b {
    color: var(--green-dark);
    font-size: 17px;
}

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 50%;
}

.green {
    background: var(--green);
}

.navy {
    background: var(--navy);
}

.coral {
    background: var(--coral);
}

/* Formulare und Buttons */

label {
    display: grid;
    gap: 6px;
    color: #4f625e;
    font-size: 12px;
    font-weight: 700;
}

input,
select {
    width: 100%;
    padding: 11px 12px;
    background: #fbfcfa;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 11px;
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(24, 169, 120, 0.1);
}

.quick-form,
.stack {
    display: grid;
    gap: 14px;
    margin-top: 23px;
}

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

.primary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--green);
    color: #ffffff;
    border: 0;
    border-radius: 12px;
    box-shadow: 0 9px 20px rgba(24, 169, 120, 0.2);
    font-weight: 700;
}

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

.outline {
    padding: 9px 13px;
    background: #ffffff;
    color: var(--green-dark);
    border: 1px solid var(--green);
    border-radius: 11px;
    font-weight: 700;
}

.edit-button {
    padding: 7px 11px;
    background: #ffffff;
    color: var(--green-dark);
    border: 1px solid var(--line);
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
}

.edit-button:hover {
    background: var(--mint);
    border-color: #bde5d5;
}

/* Tabellen und Status */

.table-wrap {
    margin: 22px -6px -8px;
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 650px;
    border-collapse: collapse;
}

th {
    padding: 10px 13px;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-align: left;
    text-transform: uppercase;
}

td {
    padding: 14px 13px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}

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

td small {
    display: block;
    color: var(--muted);
}

.status {
    padding: 5px 10px;
    background: var(--mint);
    color: var(--green-dark);
    border: 0;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
}

.status.off {
    background: #eeeeee;
    color: #777777;
}

.planned-booking {
    background: #fbfefc;
}

.booking-state {
    display: inline-block;
    min-width: 92px;
    padding: 5px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}

.booking-state.planned {
    background: #fff3d7;
    color: #8b6414;
}

.booking-state.booked {
    background: var(--mint);
    color: var(--green-dark);
}

.booking-state.income {
    background: #e1f0ff;
    color: #24628d;
}

.amount-positive {
    color: var(--green-dark);
}

.bookings-table .booking-delete-heading,
.bookings-table .booking-delete-cell {
    width: 32px;
    padding-right: 0;
}

.bookings-table th:last-child,
.bookings-table td:last-child {
    width: 250px;
    padding-left: 8px;
}

.booking-status-cell {
    text-align: left;
}

.delete-form {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin: 0;
}

.booking-delete-cell .delete {
    width: 24px;
    height: 24px;
    padding: 0;
}

.empty {
    padding: 38px 20px;
    color: var(--muted);
    text-align: center;
}

.empty span {
    font-size: 30px;
}

.empty h3 {
    margin: 8px 0 0;
    color: var(--ink);
}

.empty p {
    margin: 4px;
}

.empty.compact {
    padding: 20px;
}

/* Verlaufsgrafik */

.legend {
    display: flex;
    gap: 15px;
    color: var(--muted);
    font-size: 12px;
}

.chart {
    display: flex;
    align-items: stretch;
    gap: 14px;
    height: 210px;
    margin-top: 28px;
    border-bottom: 1px solid var(--line);
}

.chart-col {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    min-width: 24px;
}

.bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    width: 100%;
    height: 180px;
}

.bar {
    display: block;
    width: min(13px, 38%);
    min-height: 2px;
    border-radius: 5px 5px 0 0;
}

.income-bar {
    background: var(--green);
}

.cost-bar {
    background: var(--coral);
}

.chart-col span {
    padding-top: 7px;
    color: var(--muted);
    font-size: 10px;
}

/* Meldungen */

.alert {
    margin-bottom: 18px;
    padding: 12px 15px;
    background: #e6f7ef;
    color: #116547;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.alert.error {
    background: #fff0ed;
    color: #934735;
}

/* Anmeldung und Ersteinrichtung */

.auth-body {
    min-height: 100vh;
    background: #edf7f1;
}

.auth-shell {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    min-height: 100vh;
}

.auth-intro {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 60px clamp(35px, 7vw, 110px);
    overflow: hidden;
    background: var(--ink);
    color: #ffffff;
}

.auth-intro::after {
    position: absolute;
    right: -190px;
    bottom: -180px;
    width: 420px;
    height: 420px;
    border: 90px solid rgba(24, 169, 120, 0.09);
    border-radius: 50%;
    content: "";
}

.auth-intro .brand {
    color: #ffffff;
}

.auth-intro h1 {
    margin: 18px 0;
    font-size: clamp(42px, 6vw, 74px);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.06em;
}

.auth-intro h1 em {
    color: #73dbb4;
    font-style: normal;
}

.auth-intro p {
    max-width: 500px;
    color: #b9cbc6;
    font-size: 18px;
}

.auth-pills {
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.auth-pills span {
    padding: 8px 12px;
    color: #b9cbc6;
    border: 1px solid #38514c;
    border-radius: 99px;
    font-size: 12px;
}

.auth-card {
    align-self: center;
    width: min(430px, calc(100% - 50px));
    margin: auto;
    padding: 38px;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.auth-card > div > p,
.dialog-card > p {
    color: var(--muted);
    font-size: 14px;
}

.mini-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-bottom: 20px;
    background: var(--mint);
    color: var(--green);
    border-radius: 13px;
}

.auth-card small {
    margin-top: 22px;
    text-align: center;
}

.auth-card .alert {
    margin-top: 18px;
    margin-bottom: 0;
}

/* Dialoge */

dialog {
    max-width: none;
    padding: 0;
    background: transparent;
    border: 0;
}

dialog::backdrop {
    background: rgba(15, 35, 31, 0.58);
    backdrop-filter: blur(3px);
}

.dialog-card {
    position: relative;
    display: grid;
    gap: 15px;
    width: min(500px, calc(100vw - 30px));
    padding: 28px;
    background: #ffffff;
    border-radius: 20px;
}

.dialog-close {
    position: absolute;
    top: 15px;
    right: 18px;
    background: transparent;
    color: var(--muted);
    border: 0;
    font-size: 24px;
}

.field-hint {
    margin: -3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

/* Tablets */

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

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

    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-intro {
        min-height: 42vh;
        padding: 35px;
    }

    .auth-intro h1 {
        font-size: 45px;
    }

    .auth-card {
        margin: 35px auto;
    }

    .auth-pills {
        display: none;
    }
}

/* Smartphones */

@media (max-width: 600px) {
    .page {
        width: min(100% - 24px, 1220px);
        margin-top: 25px;
    }

    .topbar {
        padding: 0 14px;
    }

    .user-name {
        display: none;
    }

    .hero {
        align-items: start;
        gap: 20px;
    }

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

    .forecast-body {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .forecast-lines {
        width: 100%;
    }

    .panel {
        padding: 20px;
    }

    .panel-head {
        gap: 12px;
    }

    .outline {
        font-size: 12px;
    }

    .chart {
        gap: 4px;
        overflow-x: auto;
    }

    .chart-col {
        min-width: 27px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .auth-intro {
        min-height: 36vh;
    }

    .auth-intro h1 {
        font-size: 36px;
    }

    .auth-card {
        padding: 27px;
    }

    .brand {
        font-size: 15px;
    }
}
