/*
 * Sparverein Saarland – shared visual language, ported from the original
 * tool (sparverein-ergebnis_71.html). Palette, typography, and component
 * styles (buttons, inputs, tables, cards, nav) are kept consistent with the
 * customer's existing tool so the new Symfony app feels like the same
 * application. Montserrat is self-hosted via fonts.css (see ADR-013, GDPR).
 */

:root {
    --primary:       #C8430A;   /* Sparverein-Orange */
    --primary-dark:  #922E06;
    --primary-light: #FDF0EB;
    --sidebar-bg:    #1C2B3A;   /* Dunkles Navy */
    --sidebar-hover: #243547;
    --text:          #1a1a1a;
    --text-muted:    #6b7280;
    --border:        #e5e7eb;
    --bg:            #F8F7F4;   /* Warmes Creme */
    --white:         #ffffff;
    --pos:           #15803d;
    --neg:           #b91c1c;
    --shadow:        0 1px 6px rgba(0, 0, 0, 0.09);
    --radius:        6px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
}

h1, h2, h3, h4 {
    margin: 0 0 12px;
    color: var(--sidebar-bg);
    font-weight: 600;
}

h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }

p {
    margin: 0 0 12px;
    line-height: 1.5;
}

a {
    color: var(--primary);
}

/* ===== APP SHELL (left sidebar + fluid main) ===== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-main {
    flex: 1;
    min-width: 0;
    padding: 24px 28px;
    max-width: 1400px;
}

/* Unauthenticated pages (login, reset password) render centered on the
   light background — the .login-page/.login-card styles do the framing. */
.app-guest {
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 232px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    align-self: stretch;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

/* Brand / logo */
.sidebar-brand {
    display: block;
    padding: 18px 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--white);
    text-decoration: none;
}

.sidebar-brand .brand-logo {
    display: block;
    width: 100%;
    max-width: 180px;
    height: auto;
}

.sidebar-brand .brand-fallback {
    display: none;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-brand small {
    font-size: 11px;
    font-weight: 500;
    color: #94a3b8;
    letter-spacing: 0;
}

/* Primary navigation */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 10px 6px;
}

.sidebar-nav a,
.sidebar-nav .is-disabled {
    display: block;
    padding: 9px 12px;
    border-radius: var(--radius);
    border-left: 3px solid transparent;
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: var(--white);
}

.sidebar-nav a.is-active {
    background: rgba(200, 67, 10, 0.25);
    border-left-color: var(--primary);
    color: var(--white);
}

.sidebar-nav .is-disabled {
    color: #64748b;
    cursor: not-allowed;
}

/* Section label */
.sidebar-section {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    padding: 14px 16px 6px;
}

/* Month history list */
.sidebar-months {
    flex: 1;
    list-style: none;
    margin: 0;
    padding: 0 10px 16px;
    overflow-y: auto;
}

.sidebar-year {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    padding: 8px 10px 3px;
}

/* Collapsible year groups: current year open, older years disclose on click. */
.sidebar-year-group + .sidebar-year-group {
    margin-top: 2px;
}

summary.sidebar-year {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: color 0.12s;
}

/* Hide the native disclosure triangle (WebKit/Blink + the standard marker). */
summary.sidebar-year::-webkit-details-marker {
    display: none;
}
summary.sidebar-year::marker {
    content: '';
}

/* Own caret so it rotates consistently across browsers. */
summary.sidebar-year::before {
    content: '';
    flex: none;
    width: 0;
    height: 0;
    border-left: 4px solid currentColor;
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
    transition: transform 0.12s;
}
.sidebar-year-group[open] > summary.sidebar-year::before {
    transform: rotate(90deg);
}

summary.sidebar-year:hover {
    color: #e2e8f0;
}
summary.sidebar-year:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius);
}

.sidebar-year-months {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-months a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    margin-bottom: 1px;
    border-radius: var(--radius);
    border-left: 3px solid transparent;
    font-size: 12px;
    font-weight: 600;
    color: #e2e8f0;
    text-decoration: none;
    transition: background 0.12s;
}

.sidebar-months a:hover {
    background: var(--sidebar-hover);
}

.sidebar-months a.is-active {
    background: rgba(200, 67, 10, 0.25);
    border-left-color: var(--primary);
}

.month-state {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}

/* Account block (bottom) */
.sidebar-account {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding: 14px 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-account .account-email {
    font-size: 12px;
    color: #94a3b8;
    word-break: break-all;
}

.sidebar-account a {
    font-size: 12px;
    font-weight: 600;
    color: #cbd5e1;
    text-decoration: none;
}

.sidebar-account a:hover {
    color: var(--white);
}

.sidebar-account form {
    margin-top: 4px;
}

.sidebar-account .btn-outline {
    width: 100%;
    justify-content: center;
}

/* ===== CARDS / PANELS / SECTIONS ===== */
.card,
.section {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 14px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.card-header,
.section-header {
    background: var(--sidebar-bg);
    color: var(--white);
    padding: 9px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header .unit-hint {
    margin-left: auto;
    font-size: 10px;
    font-weight: 400;
    color: #94a3b8;
    text-transform: none;
    letter-spacing: 0;
}

.card-body,
.section-body {
    padding: 20px;
}

/* ===== BUTTONS ===== */
.btn,
button,
input[type="submit"] {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
    text-decoration: none; /* anchors styled as .btn are chips, not underlined links */
    background: var(--primary);
    color: var(--white);
}

/* Inline action-bar icons (Tabler): fixed size, never shrink, follow the label colour. */
.btn-icon {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
}

.btn:hover,
button:hover,
input[type="submit"]:hover {
    background: var(--primary-dark);
}

button:disabled,
.btn:disabled,
input[type="submit"]:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* A .btn mid-submit (e.g. a bulk import processing many files): spinner + disabled look. */
.btn[aria-busy="true"] {
    opacity: 0.75;
    cursor: wait;
}

.btn[aria-busy="true"]::after {
    content: "";
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* ===== KEYBOARD FOCUS ===== */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.sidebar-nav a:focus-visible,
.sidebar-months a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-navy {
    background: var(--sidebar-bg);
}

.btn-navy:hover {
    background: #131f2d;
}

.btn-outline {
    background: var(--white);
    color: var(--sidebar-bg);
    border: 1.5px solid #d1d5db;
}

.btn-outline:hover {
    background: var(--white);
    border-color: var(--sidebar-bg);
}

.btn-danger {
    background: var(--neg);
    color: var(--white);
}

.btn-danger:hover {
    background: #991b1b;
}

.btn-danger-outline {
    background: var(--white);
    color: var(--neg);
    border: 1.5px solid var(--neg);
}

.btn-danger-outline:hover {
    background: var(--neg);
    color: var(--white);
}

/* Detail-view action row: buttons on one line; the last item (finalize/unlock) sits right. */
.detail-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.detail-actions-end {
    margin-left: auto;
}

/* Per-row rename form: name input beside the button, not full-width like other text inputs. */
/* :not([hidden]) so the UA `[hidden]{display:none}` still wins when the rename form is
   toggled off (see inline_edit_controller). */
.inline-rename:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Bank disclosure: the dark section header doubles as the accordion toggle. */
details.gs-bank > summary.section-header {
    cursor: pointer;
    list-style: none;
}
details.gs-bank > summary.section-header::-webkit-details-marker {
    display: none;
}
details.gs-bank > summary.section-header::before {
    content: '';
    flex: none;
    width: 0;
    height: 0;
    border-left: 5px solid currentColor;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform 0.12s;
}
details.gs-bank[open] > summary.section-header::before {
    transform: rotate(90deg);
}
details.gs-bank > summary.section-header:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.inline-rename input[type="text"] {
    width: auto;
    flex: 1 1 auto;
}

.gs-table th,
.gs-table td {
    text-align: left;
    vertical-align: middle;
}

.gs-table th:last-child,
.gs-table td:last-child {
    text-align: right;
}

.gs-table th:first-child,
.gs-table td:first-child {
    width: 140px;
    font-variant-numeric: tabular-nums;
}

.gs-alias-row td:first-child {
    padding-left: 28px;
}

/* Keep the row's Bearbeiten + Löschen on one line rather than stacking. */
.gs-table .row-actions {
    flex-wrap: nowrap;
    align-items: center;
}

.gs-toolbar {
    margin-bottom: 20px;
}

/* ===== MODAL (finalize confirm / unlock reason) ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.modal-overlay.is-open {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: 10px;
    padding: 28px;
    width: 420px;
    max-width: 96vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    white-space: normal;
}

.modal h2 {
    margin-bottom: 10px;
    color: var(--sidebar-bg);
}

.modal p {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ===== FORMS / INPUTS ===== */
.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
}

.field label,
label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    padding: 8px 10px;
    border: 1.5px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
    color: var(--text);
    background: var(--white);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* File input: the native "Datei auswählen" button styled as a secondary (.btn-outline). */
input[type="file"] {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 8px 16px;
    border: 1.5px solid #d1d5db;
    border-radius: var(--radius);
    background: var(--white);
    color: var(--sidebar-bg);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

input[type="file"]::file-selector-button:hover {
    border-color: var(--sidebar-bg);
}

input[type="file"]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ===== FORM LAYOUT (create / edit) ===== */
/* Keep the entry form compact instead of full-page-wide rows. */
.form-narrow {
    max-width: 680px;
}

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

.field .help-text,
.field small {
    font-size: 11px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-muted);
}

/* Label with a trailing info icon (hover reveals a [data-tooltip] note). */
.field-label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.field-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--text-muted);
    color: var(--white);
    font-size: 10px;
    font-weight: 700;
    font-style: normal;
    line-height: 1;
    cursor: help;
}

.field-info:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

/* Status line under the "Zinssatz aus dem Vormonat übernehmen" action. */
.field-status:empty {
    display: none;
}

/* ===== CHECKBOX LISTS (grouped document selection) ===== */
/* Overrides the global uppercase/muted label styling so each option reads as a
   normal, roomy checkbox row. */
.check-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text);
    cursor: pointer;
}

.check-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex: 0 0 auto;
    accent-color: var(--primary);
    cursor: pointer;
}

.check-item input[type="checkbox"]:disabled {
    cursor: default;
}

/* When "Alle" locks the individual boxes, mute them so it's clear they are all
   included and controlled by the master toggle. */
.check-item input[type="checkbox"]:disabled + span {
    color: var(--text-muted);
}

.check-item em {
    font-style: normal;
    color: var(--text-muted);
    font-size: 12px;
}

/* The "Alle …" master row, set off from the individual options below it. */
.check-master {
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

/* Horizontal variant used on the send-compose screen: the applicable documents for one
   recipient laid out in a wrapping row, with an "Alle" toggle set off on the left. */
.check-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
}

.check-all-master {
    font-weight: 600;
    padding-right: 16px;
    border-right: 1px solid var(--border);
}

.versand-empf {
    white-space: nowrap;
    vertical-align: top;
}

/* Per-recipient send status on the Freigabe screen. */
.status-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.status-pill--ok {
    background: #dcfce7;
    color: #0c6b2b;
}

.status-pill--err {
    background: #fee2e2;
    color: #c31414;
}

.status-pill--offen {
    background: #e5e7eb;
    color: #4b5563;
}

/* In-field convenience action (e.g. "Zinssatz aus dem Vormonat übernehmen").
   Rendered as a compact outline button so it clearly reads as clickable. */
.btn-carryover {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 5px 11px;
    background: var(--white);
    border: 1.5px solid #d1d5db;
    border-radius: var(--radius);
    color: var(--sidebar-bg);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
}

.btn-carryover:hover {
    border-color: var(--sidebar-bg);
    background: #f8fafc;
}

.btn-carryover:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-carryover .btn-icon {
    flex: none;
}

/* Reinertrag-Konto rows: fields and their submit button sit on one baseline. */
/* :not([hidden]) so the UA `[hidden]{display:none}` still wins when the inline edit
   form is toggled off (see inline_edit_controller). */
.inline-form:not([hidden]) {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.inline-form input[name="kontonummer"] {
    width: 12em;
}

.konto-add-heading {
    margin-top: 16px;
}

/* Sachgewinn collection: each row lays its three fields + remove button inline. */
.collection-rows [data-collection-row] {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.collection-rows [data-collection-row] > div:first-child {
    flex: 1;
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr) 130px;
    gap: 12px;
}

.collection-rows [data-collection-row] > div:first-child > div {
    margin-bottom: 0;
}

/* Lift the "Entfernen" button off the row's flex-end baseline (which sits at the help
   text) up to the input line, so it lines up with the fields instead of floating low. */
.collection-rows [data-collection-row] .btn-outline {
    margin-bottom: 15px;
}

.collection-rows [data-collection-row] .help-text {
    font-size: 11px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-muted);
    margin: 0;
}

/* ===== TABLES ===== */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f8fafc;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 8px 12px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

th:first-child {
    text-align: left;
}

td {
    padding: 8px 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.row-actions form {
    margin: 0;
}

/* Equal-width action buttons (e.g. "Bearbeiten" / "Löschen" stacked in a narrow cell). */
.row-actions--equal .btn {
    min-width: 120px;
    justify-content: center;
}

.users-table th,
.users-table td {
    text-align: left;
}

.users-table th:last-child {
    text-align: right;
}

.td-r {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

tr.sum-row td {
    background: #f8fafc;
    font-weight: 600;
    border-top: 2px solid var(--border);
    color: var(--sidebar-bg);
}

/* Verkaufsstatistik deltas */
.delta { font-variant-numeric: tabular-nums; }
.delta.pos { color: #15803d; }
.delta.neg { color: #b91c1c; }
.delta.zero { color: var(--muted, #64748b); }

.verkaufsart-eingerueckt td:first-child {
    padding-left: 28px;
    color: var(--muted, #64748b);
}

/* Fixed grid so the six Verkaufsstatistik tables share one label column and outer edges. */
.stat-table {
    table-layout: fixed;
}

.stat-table__label {
    width: 30%;
}

/* Reinertrag-Konto table: size columns to content (overrides stat-table's fixed
   layout) and keep the number vertically centred against its action button. */
.konto-table {
    table-layout: auto;
}

.konto-table td,
.konto-table th {
    vertical-align: middle;
}

/* Headers over left-aligned text values (the global `th` is right-aligned for
   numeric tables; this table's Kontonummer column holds left-aligned text). */
.konto-table th {
    text-align: left;
}

/* Narrow, right-aligned action column (the "Bearbeiten" button). */
.stat-table__action {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

/* ===== ALERTS ===== */
.alert {
    border-radius: var(--radius);
    padding: 10px 16px;
    margin-bottom: 20px;
    font-size: 13px;
}

.alert-error,
.alert-reset_password_error {
    background: var(--primary-light);
    border: 1px solid #e5c0b0;
    color: var(--primary-dark);
}

.alert-warning {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #78350f;
}

/* ===== CARRY-OVER BANNER ===== */
/* Scope display to :not([hidden]) so the UA `[hidden]{display:none}` still wins. */
.carry-over-banner:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 12px;
}

.carry-over-banner {
    background: var(--primary-light);
    border: 1px solid #e5c0b0;
    color: var(--primary-dark);
    border-radius: var(--radius);
    padding: 10px 16px;
    margin-bottom: 16px;
    font-size: 13px;
}

.carry-over-banner span {
    flex: 1;
}

/* ===== LOGIN ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 24px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 380px;
    padding: 32px;
}

.login-card h1 {
    text-align: center;
    margin-bottom: 24px;
}

.login-card .field {
    margin-bottom: 18px;
}

.login-card button {
    width: 100%;
    justify-content: center;
    margin-top: 6px;
}

/* ===== DASHBOARD ACTION CARDS ===== */
.action-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.action-card {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.action-card:hover {
    border-color: var(--sidebar-bg);
    transform: translateY(-1px);
}

.action-card .action-icon {
    font-size: 24px;
}

.action-card strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--sidebar-bg);
}

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

.action-card.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.action-card.is-disabled:hover {
    border-color: var(--border);
    transform: none;
}

/* ===== KPI CARDS ===== */
.kpi-card {
    background: var(--white);
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}

.kpi-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--sidebar-bg);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

/* ===== FINANCIAL CALCULATION BREAKDOWN ===== */
.calc-grid {
    padding: 4px 0;
}

.calc-group {
    padding: 4px 0;
}

.calc-group-hdr,
.calc-row.group-header {
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 16px;
    border-bottom: 1px solid var(--border);
}

.calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.calc-row:last-child {
    border-bottom: none;
}

.calc-row.subtotal {
    background: #f8fafc;
    font-weight: 600;
    border-top: 2px solid var(--border);
    border-bottom: 2px solid var(--border);
}

.calc-row.grand-total {
    background: var(--primary-light);
    font-weight: 600;
    border-top: 2px solid #e5c0b0;
    font-size: 15px;
}

.calc-label {
    color: #374151;
}

.calc-label small {
    display: block;
    font-size: 11px;
    color: #9ca3af;
    font-weight: 400;
    margin-top: 1px;
}

.calc-val-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.calc-val {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.calc-pct {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 70px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.calc-row.grand-total .calc-val {
    color: var(--pos);
}

.calc-row.grand-total.warn .calc-val {
    color: var(--neg);
}

/* ===== HISTORISCHER VERLAUF ===== */
.empty-state {
    background: var(--white, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 8px);
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted, #64748b);
}

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

.verlauf-table {
    font-size: 13px;
}

.verlauf-table a {
    text-decoration: none;
}

.verlauf-table th,
.verlauf-table td {
    white-space: nowrap;
}

.verlauf-table tr.gj-header td {
    background: var(--sidebar-bg, #1C2B3A);
    color: #fff;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.verlauf-table tr.gj-sum td {
    background: var(--primary-light, #FDF0EB);
    font-weight: 600;
    border-top: 2px solid #e5c0b0;
    color: var(--primary-dark, #922E06);
}

.verlauf-table tr.draft td {
    color: var(--text-muted, #64748b);
    font-style: italic;
}

.verlauf-table tr.clickable-row {
    cursor: pointer;
}

.verlauf-table tr.clickable-row:hover td {
    background: var(--primary-light, #FDF0EB);
}

/* Payout columns (Sach-/Geldgewinne) render red, as in the original tool — the
   draft-scoped selector keeps red winning over the muted draft-row color. */
.verlauf-table td.amount-neg,
.verlauf-table tr.draft td.amount-neg {
    color: var(--neg);
}

.verlauf-table .lock-icon {
    font-size: 10px;
    margin-left: 4px;
}

.verlauf-table .draft-dot {
    font-size: 10px;
    margin-left: 4px;
    color: #f59e0b;
}

/* Document action bar on the month detail view (Slice A). */
.doc-actions { display: flex; gap: 1rem 2.25rem; flex-wrap: wrap; border: 1px solid #e5e7eb; border-radius: 8px; padding: 0.75rem 1rem; margin: 1rem 0; }
/* Groups are separated by spacing (column-gap) instead of a border: a border-left
   divider strays to the left of a group that wraps onto a second row. */
.doc-actions-group { display: flex; flex-direction: column; gap: 0.4rem; }
.doc-actions-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.5px; color: #6b7280; }
.doc-actions-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
/* A .btn rendered as a non-clickable <span> (e.g. Abo-Auswertung with no ABOS data).
   pointer-events stays enabled so the [data-tooltip] hover still fires. */
.btn-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: auto; }
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute; left: 0; top: 100%; margin-top: 4px;
    padding: 4px 8px; background: var(--sidebar-bg); color: var(--white);
    font-size: 12px; white-space: nowrap; border-radius: 4px; z-index: 20;
}

/* Inline hint boxes (e.g. the Auslosungsdatum modal). */
.hint { border-radius: 4px; padding: 8px 12px; font-size: 12px; margin-bottom: 10px; }
.hint-ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; }
.hint-warn { background: #fef3c7; border: 1px solid #f59e0b; color: #78350f; }

/* ===== PRINT UTILITIES ===== */
@media print {
    .no-print { display: none !important; }
}
