html, body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

h1:focus {
    outline: none;
}

/* ---------- Account-Bereich (statisch gerendert, Bootstrap) ---------- */

.account-shell {
    min-height: 100vh;
    background: #f6f7f5;
    display: flex;
    flex-direction: column;
}

.account-header {
    background: #2e5e4e;
    color: #fff;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.account-header a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

.account-main {
    flex: 1;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.account-card {
    max-width: 440px;
    margin: 0 auto;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    padding: 2rem;
}

.btn-primary {
    background-color: #2e5e4e;
    border-color: #2e5e4e;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: #244a3e;
    border-color: #244a3e;
}

a {
    color: #2e5e4e;
}

.recovery-code {
    font-size: 1.1rem;
    letter-spacing: 0.05em;
}

.qr-code svg {
    width: 200px;
    height: 200px;
}

.validation-message {
    color: #b00020;
}

/* ---------- Fehleranzeige Blazor ---------- */

#blazor-error-ui {
    background: #ffffe0;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 2000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "Ein Fehler ist aufgetreten.";
}

/* ---------- App ---------- */

.amount-negative {
    color: var(--mud-palette-error);
    white-space: nowrap;
}

.amount-positive {
    color: var(--mud-palette-success);
    white-space: nowrap;
}

.upload-zone {
    border-style: dashed !important;
}

/* Natives Datei-Input unsichtbar, ausgelöst über das Label (barrierearm per Tastatur/Screenreader über das Label). */
.upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}
/* ---------- Kategorien ---------- */

.category-dot {
    display: inline-block;
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    margin-right: 0.4rem;
    flex-shrink: 0;
}

.category-option {
    display: inline-flex;
    align-items: center;
}

.category-option-child {
    padding-left: 1.25rem;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    font-size: 0.8125rem;
}

.category-cell {
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 4px;
}

.category-cell:hover {
    background-color: var(--mud-palette-action-default-hover);
}

.inline-category,
.inbox-select,
.bulk-select,
.reassign-select {
    min-width: 14rem;
}

.category-row,
.rule-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    flex-wrap: wrap;
}

.category-row-child {
    padding-left: 2.5rem;
}

.category-name {
    min-width: 10rem;
}

.color-field .mud-input-adornment-start .mud-icon-root {
    color: var(--category-color);
}

/* ---------- Regeln ---------- */

.rule-row {
    cursor: grab;
}

.rule-row-dragging {
    opacity: 0.5;
}

.rule-row-inactive .rule-text {
    opacity: 0.55;
}

.rule-priority {
    min-width: 1.5rem;
    text-align: right;
}

.rule-text {
    flex: 1 1 18rem;
    min-width: 0;
}

.date-field {
    max-width: 11rem;
}

/* ---------- Buchungen / Inbox ---------- */

.transaction-row {
    cursor: pointer;
}

.inbox-group {
    height: 100%;
}

.inbox-group-text {
    min-width: 0;
}

.inbox-sample {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-table th {
    width: 11rem;
    font-weight: 500;
    vertical-align: top;
}

.raw-data {
    font-size: 0.75rem;
    white-space: pre-wrap;
    word-break: break-all;
    background-color: var(--mud-palette-background-gray);
    padding: 0.5rem;
    border-radius: 4px;
}

/* Gruppentitel (Art) in der Kategorieauswahl */
.category-group-header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 1 !important;
    color: var(--mud-palette-text-secondary) !important;
}

/* Bearbeitungsformulare bleiben beim Scrollen langer Listen sichtbar (unter der App-Leiste). */
.edit-form {
    position: sticky;
    top: calc(var(--mud-appbar-height) + 8px);
    z-index: 5;
    max-height: calc(100vh - var(--mud-appbar-height) - 16px);
    overflow-y: auto;
}

.mud-alert.edit-form {
    background-color: var(--mud-palette-surface);
    box-shadow: var(--mud-elevation-4);
}

/* ---------- Fixkosten ---------- */

.summary-card {
    height: 100%;
}

.recurring-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    flex-wrap: wrap;
}

.recurring-text {
    flex: 1 1 18rem;
    min-width: 0;
}

.recurring-total td {
    border-top: 2px solid var(--mud-palette-lines-default);
}

.recurring-icon {
    vertical-align: middle;
    margin-left: 0.25rem;
    color: var(--mud-palette-primary);
}

.recurring-name {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.interval-select {
    max-width: 11rem;
}

/* ---------- Auswertungen ---------- */

.stat-tile {
    height: 100%;
}

.stat-label {
    color: var(--mud-palette-text-secondary);
}

/* Kennzahlen in Systemschrift mit proportionalen Ziffern (dataviz: kein tabular-nums für Einzelwerte). */
.stat-value {
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0.15rem 0;
    white-space: nowrap;
}

.stat-delta {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.8125rem;
    color: var(--mud-palette-text-secondary);
}

.stat-delta-good {
    color: #006300;
}

.stat-delta-bad {
    color: #D03B3B;
}

.mud-theme-dark .stat-delta-good,
.mud-dark .stat-delta-good {
    color: #0CA30C;
}

.stat-delta-label {
    margin-left: 0.25rem;
    font-size: 0.75rem;
}

.stat-caption {
    display: block;
    color: var(--mud-palette-text-secondary);
}

.category-table td,
.pivot-table td,
.monthly-table td,
.counterparty-table td {
    font-variant-numeric: tabular-nums;
}

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

.pivot-name {
    white-space: nowrap;
    position: sticky;
    left: 0;
    background-color: var(--mud-palette-surface);
}

.pivot-child .pivot-name {
    padding-left: 2.5rem !important;
}

.pivot-root td {
    font-weight: 500;
}

.pivot-total td {
    border-top: 2px solid var(--mud-palette-lines-default);
}

.trend-category {
    min-width: 16rem;
}

.magnitude-track {
    height: 4px;
    margin-top: 4px;
    background-color: var(--mud-palette-lines-default);
    border-radius: 2px;
    max-width: 16rem;
}

.magnitude-bar {
    height: 4px;
    border-radius: 2px;
}

/* ---------- KI-Vorschläge ---------- */

.suggestion-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-top: 1px solid var(--mud-palette-lines-default);
    flex-wrap: wrap;
}

.suggestion-text {
    flex: 1 1 16rem;
    min-width: 0;
}

.suggestion-select {
    min-width: 15rem;
    max-width: 20rem;
}
