@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700&family=Space+Grotesk:wght@400;500;700&display=swap");

:root {
    --bg: #050505;
    --bg-secondary: #111111;
    --panel: rgba(17, 17, 17, 0.84);
    --panel-strong: rgba(24, 24, 24, 0.96);
    --text: #f2f2f2;
    --muted: #a3a3a3;
    --line: rgba(255, 255, 255, 0.12);
    --accent: #57f1cf;
    --accent-dark: #2ad3b3;
    --accent-soft: rgba(87, 241, 207, 0.14);
    --success-bg: rgba(64, 212, 171, 0.16);
    --success-text: #8bf0d5;
    --error-bg: rgba(255, 92, 122, 0.14);
    --error-text: #ff97af;
    --shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 15% 15%, rgba(87, 241, 207, 0.1), transparent 20%),
        radial-gradient(circle at 82% 12%, rgba(255, 255, 255, 0.04), transparent 24%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.018) 25%, transparent 25%) 0 0 / 24px 24px,
        linear-gradient(315deg, rgba(255, 255, 255, 0.018) 25%, transparent 25%) 0 0 / 24px 24px,
        linear-gradient(180deg, var(--bg) 0%, #020202 100%);
    min-height: 100vh;
}

a {
    color: inherit;
}

code {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 0.15rem 0.4rem;
    font-family: "Consolas", monospace;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    border: 0;
    border-radius: 0;
    padding: 0.9rem 1.2rem;
    background: var(--accent);
    color: #041017;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease;
}

button:hover {
    transform: translateY(-1px);
    background: var(--accent-dark);
}

button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    background: var(--accent);
}

.ghost-button {
    background: transparent;
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.92);
}

.danger-button {
    color: #ffb1c0;
    border-color: rgba(255, 151, 175, 0.24);
}

.page-shell {
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.5rem 0 3rem;
}

.topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
}

.brand-block {
    min-width: 0;
}

.brand {
    font-size: clamp(2rem, 5vw, 3rem);
    font-family: "Orbitron", "Bahnschrift", sans-serif;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    text-shadow: 0 0 18px rgba(87, 241, 207, 0.28);
}

.tagline {
    margin: 0.3rem 0 0;
    color: var(--muted);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    font-size: 0.78rem;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
    min-width: 0;
}

.nav a {
    text-decoration: none;
    padding: 0;
    color: var(--muted);
    transition: color 0.18s ease;
}

.nav a:hover,
.nav-button:hover {
    color: var(--accent);
}

.nav-button {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-weight: 500;
}

.nav-button:hover {
    background: transparent;
    transform: none;
}

.panel {
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.92);
    border-radius: 0;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.panel {
    padding: 1.5rem;
}

.auth-panel {
    max-width: 560px;
    margin: 4rem auto 0;
}

.welcome-strip {
    margin-bottom: 1rem;
}

.dashboard-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.82rem;
    color: var(--accent);
}

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

.summary-shell,
.content-grid {
    display: grid;
    gap: 1.25rem;
}

.summary-shell {
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    margin-bottom: 1.25rem;
}

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

.single-top {
    grid-template-columns: 1fr;
}

.summary-total {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.25rem 0;
}

.chart-panel {
    margin: 0 0 1rem;
}

.line-chart {
    width: 100%;
    height: 92px;
    display: block;
}

.chart-line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 0.65;
    stroke-linecap: square;
    stroke-linejoin: round;
}

.trend-positive .chart-line {
    stroke: #79efc0;
}

.trend-negative .chart-line {
    stroke: #ff8ea7;
}

.trend-neutral .chart-line {
    stroke: rgba(255, 255, 255, 0.75);
}

.summary-total span,
.metric-row span {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.82rem;
}

.summary-total strong {
    font-size: clamp(2.1rem, 5vw, 3.8rem);
    line-height: 1;
}

.summary-panel {
    display: grid;
    gap: 0.8rem;
    padding: 0;
}

.metric-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.metric-row span,
.metric-row strong {
    text-align: right;
    font-size: 0.95rem;
    font-weight: 500;
}

.summary-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.18);
    margin: 0.2rem 0 0.1rem;
}

.summary-subtitle {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.82rem;
}

.account-balance-list {
    display: grid;
    gap: 0.65rem;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-grid {
    display: grid;
    gap: 1rem;
}

.form-grid label {
    display: grid;
    gap: 0.45rem;
    color: var(--muted);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.92);
    border-radius: 0;
    padding: 0.9rem 1rem;
    background: var(--panel-strong);
    color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
    outline: 1px solid rgba(86, 240, 208, 0.45);
    border-color: rgba(86, 240, 208, 0.45);
    box-shadow: 0 0 0 4px rgba(86, 240, 208, 0.08);
}

textarea {
    resize: vertical;
}

.hidden {
    display: none !important;
}

.field-hint {
    margin: -0.25rem 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.plain-section {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
}

.booking-page {
    display: grid;
    grid-template-columns: 1fr;
}

.booking-panel {
    max-width: 720px;
}

.inline-link {
    color: var(--accent);
    text-decoration: none;
}

.inline-link:hover {
    text-decoration: underline;
}

.full-width {
    grid-column: 1 / -1;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.checkbox-row input {
    width: auto;
}

.item-list {
    display: grid;
    gap: 1rem;
}

.filter-grid {
    display: grid;
    grid-template-columns: 1.4fr 0.9fr 0.9fr auto;
    gap: 1rem;
    align-items: end;
}

.filter-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.bookings-panel {
    margin-top: 1.25rem;
}

.account-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.account-panel {
    margin-top: 0;
}

.cashflow-summary {
    display: grid;
    gap: 0.8rem;
    margin-bottom: 1.25rem;
}

.account-total {
    font-size: 1.2rem;
}

.account-list {
    display: grid;
    gap: 1rem;
}

.account-card .item-type {
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.account-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.account-setting-form {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.dashboard-balance-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 1rem;
}

.account-balance-row {
    grid-template-columns: minmax(0, 1fr) 132px 150px;
}

.balance-main {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.balance-name {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.82rem;
}

.dashboard-balance-row strong {
    font-size: 1rem;
    text-align: right;
    width: 100%;
}

.sort-handle {
    padding: 0;
    background: transparent;
    color: var(--muted);
    border: 0;
    box-shadow: none;
    opacity: 0;
    pointer-events: none;
    transform: none;
    font-size: 1rem;
    line-height: 1;
}

.account-balance-row:hover .sort-handle,
.account-balance-row.is-dragging .sort-handle {
    opacity: 1;
    pointer-events: auto;
}

.sort-handle:hover {
    background: transparent;
    color: var(--accent);
}

.sortable-account-row {
    cursor: default;
}

.sortable-account-row.is-dragging {
    opacity: 0.55;
}

.total-balance-row strong {
    font-size: clamp(2rem, 5vw, 3.6rem);
    line-height: 1;
}

.trend-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    width: 132px;
    min-width: 132px;
}

.trend-slot {
    width: 132px;
    min-width: 132px;
}

.trend-slot.is-empty {
    visibility: hidden;
}

.trend-value {
    font-size: 0.92rem;
}

.trend-positive .trend-value {
    color: #79efc0;
}

.trend-negative .trend-value {
    color: #ff8ea7;
}

.trend-neutral .trend-value {
    color: var(--muted);
}

.trend-arrow {
    display: inline-block;
    width: 0;
    height: 0;
}

.trend-arrow-up {
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid #79efc0;
}

.trend-arrow-down {
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 10px solid #ff8ea7;
}

.trend-arrow-flat {
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.46);
}

.period-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.period-link {
    min-width: 42px;
    padding: 0.5rem 0.7rem;
    color: var(--muted);
    text-decoration: none;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.period-link.is-active,
.period-link:hover {
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.9);
}

.floating-menu {
    position: fixed;
    right: 1.4rem;
    bottom: 1.4rem;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.7rem;
}

.floating-menu-items {
    display: none;
    flex-direction: column;
    gap: 0.55rem;
    align-items: stretch;
}

.floating-menu.is-open .floating-menu-items {
    display: flex;
}

.floating-menu-items a {
    min-width: 148px;
    padding: 0.75rem 0.95rem;
    background: rgba(14, 14, 14, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text);
    text-decoration: none;
    text-align: left;
    box-shadow: var(--shadow);
}

.floating-trigger {
    width: 52px;
    height: 52px;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    line-height: 1;
    box-shadow: var(--shadow);
}

.item-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.92);
    border-radius: 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
}

.item-main {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 1rem;
}

.item-type {
    display: inline-block;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0.55rem;
    border-radius: 0;
    font-size: 0.85rem;
}

.item-type-income {
    background: rgba(64, 212, 171, 0.14);
    color: #8bf0d5;
}

.item-type-expense {
    background: rgba(255, 92, 122, 0.14);
    color: #ff97af;
}

.item-type-transfer {
    background: rgba(91, 142, 255, 0.16);
    color: #a8c8ff;
}

.item-type-correction {
    background: rgba(255, 215, 117, 0.16);
    color: #ffd978;
}

.cashflow-marker {
    margin-left: 0.5rem;
}

.cashflow-marker-standard {
    background: rgba(255, 255, 255, 0.08);
    color: #d2d2d2;
}

.cashflow-marker-optional {
    background: rgba(255, 215, 117, 0.16);
    color: #ffd978;
}

.cashflow-marker-reducible {
    background: rgba(87, 241, 207, 0.16);
    color: #9df7e6;
}

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

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 0.9rem 0.5rem;
    border-bottom: 1px solid var(--line);
}

th {
    color: var(--muted);
    font-weight: 500;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.inline-form input {
    min-width: 160px;
    padding: 0.65rem 0.8rem;
}

.inline-save {
    padding: 0.65rem 0.95rem;
}

.flash-stack {
    display: grid;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.flash {
    border-radius: 0;
    padding: 0.95rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.92);
}

.flash-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.flash-error {
    background: var(--error-bg);
    color: var(--error-text);
}

@media (max-width: 860px) {
    .item-card,
    .item-main {
        flex-direction: column;
    }

    .summary-shell,
    .content-grid,
    .account-grid {
        grid-template-columns: 1fr;
    }

    .page-shell {
        width: min(100% - 1rem, 1120px);
    }

    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
    }

    .nav {
        justify-content: flex-end;
        align-content: start;
    }

    .metric-row {
        align-items: baseline;
    }

    .dashboard-topline {
        flex-direction: column;
        align-items: stretch;
    }

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

    .filter-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .account-actions,
    .account-setting-form {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-balance-row {
        grid-template-columns: minmax(0, 1fr) auto auto;
        align-items: center;
        justify-items: stretch;
    }

    .account-balance-row {
        grid-template-columns: minmax(0, 1fr) 132px 150px;
    }

    .dashboard-balance-row strong,
    .trend-badge {
        text-align: right;
        justify-content: flex-end;
        min-width: 0;
    }

    .period-nav {
        justify-content: flex-start;
    }

    .floating-menu {
        right: 1rem;
        bottom: 1rem;
    }
}
