:root {
    --bg-dark: #0b0f19;
    --bg-card: rgba(22, 30, 49, 0.75);
    --bg-card-border: rgba(255, 255, 255, 0.08);
    --accent-blue: #3b82f6;
    --accent-teal: #14b8a6;
    --accent-purple: #8b5cf6;
    --accent-red: #ef4444;
    --accent-green: #10b981;
    --accent-amber: #f59e0b;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Container Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: rgba(15, 23, 42, 0.9);
    border-right: 1px solid var(--bg-card-border);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

.logo-icon {
    font-size: 1.8rem;
}

.brand-text h2 {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge {
    font-size: 0.65rem;
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.nav-item:hover, .nav-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: #ffffff;
    border-left: 3px solid var(--accent-blue);
}

.system-status {
    background: rgba(30, 41, 59, 0.5);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--bg-card-border);
    font-size: 0.8rem;
}

.status-title {
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    font-size: 0.7rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
}

.status-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

.status-indicator.offline .dot {
    background: var(--text-muted);
    box-shadow: none;
}

.status-indicator.offline {
    color: var(--text-muted);
}

.status-version {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--bg-card-border);
    color: var(--text-muted);
    font-size: 0.7rem;
    letter-spacing: 0.02em;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-title h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

.current-user-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.current-user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.account-visibility-tag {
    margin-left: 0.5rem;
}

.account-type-select {
    width: auto;
}

#accounts-modal-body dd {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--bg-card-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 1.25rem;
}

.metric-card.alert {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.05);
}

.metric-card-clickable {
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.metric-card-clickable:hover,
.metric-card-clickable:focus-visible {
    transform: translateY(-2px);
    border-color: var(--accent-blue);
    outline: none;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.metric-trend {
    font-size: 0.8rem;
    font-weight: 500;
}

.metric-trend.positive { color: var(--accent-green); }
.metric-trend.negative { color: var(--accent-red); }

/* Layout Grids & Cards */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--bg-card-border);
    font-weight: 600;
}

.data-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* Tags & Badges */
.tag {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.tag-danger { background: rgba(239, 68, 68, 0.2); color: var(--accent-red); }
.tag-success { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); }
.tag-info { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.tag-warning { background: rgba(245, 158, 11, 0.2); color: var(--accent-amber); }

/* Anomaly Feed */
.anomaly-item {
    background: rgba(239, 68, 68, 0.08);
    border-left: 4px solid var(--accent-red);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

.anomaly-title {
    font-weight: 600;
    color: #fca5a5;
    margin-bottom: 0.25rem;
}

.anomaly-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.anomaly-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.anomaly-confirm-btn {
    margin-top: 0.6rem;
}

/* Transactions tab: "Finanzguru KI-Engine" tag turned into a nav link */
.tag-link {
    border: none;
    background: inherit;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.tag-link:hover,
.tag-link:focus-visible {
    background: rgba(59, 130, 246, 0.35);
    transform: translateY(-1px);
    outline: none;
}

/* AI tag chips (Overview) */
.tag-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.tag-chip-count {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 0.7rem;
    font-weight: 700;
}

/* AI budgets (Overview) */
.ai-status-line {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.budget-item {
    margin-bottom: 1rem;
}

.budget-item:last-child {
    margin-bottom: 0;
}

.budget-item-label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.budget-bar-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    margin-bottom: 0.35rem;
}

.budget-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--accent-green);
    transition: width 0.3s ease;
}

.budget-bar-fill.warning { background: var(--accent-amber); }
.budget-bar-fill.over { background: var(--accent-red); }

.budget-item-amount {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Briefing Box */
.briefing-box {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--bg-card-border);
    padding: 1.5rem;
    border-radius: 8px;
    line-height: 1.7;
    white-space: pre-wrap;
}

/* Chat Interface */
.chat-card {
    display: flex;
    flex-direction: column;
    height: 500px;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-right: 0.5rem;
    margin-bottom: 1rem;
}

.chat-bubble {
    max-width: 80%;
    padding: 0.9rem 1.2rem;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.chat-bubble.agent {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.chat-bubble.user {
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.chat-input-row {
    display: flex;
    gap: 0.75rem;
}

/* Rendered Markdown output (Market-Briefing content, KI Finanzagent chat replies) — see
   renderMarkdown() in app.js. */
.markdown-content h2, .markdown-content h3, .markdown-content h4 {
    color: var(--text-primary);
    margin: 1.1em 0 0.5em;
    line-height: 1.3;
}

.markdown-content h2:first-child, .markdown-content h3:first-child, .markdown-content h4:first-child {
    margin-top: 0;
}

.markdown-content h2 { font-size: 1.15rem; }
.markdown-content h3 { font-size: 1.05rem; }
.markdown-content h4 { font-size: 0.95rem; color: var(--text-secondary); }

.markdown-content p {
    margin: 0 0 0.75em;
    line-height: 1.6;
}

.markdown-content p:last-child {
    margin-bottom: 0;
}

.markdown-content ul, .markdown-content ol {
    margin: 0 0 0.75em;
    padding-left: 1.4em;
    line-height: 1.6;
}

.markdown-content li {
    margin-bottom: 0.25em;
}

.markdown-content hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 1em 0;
}

.markdown-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.chat-input-row input {
    flex: 1;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--bg-card-border);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
}

/* While the initial auth check (app.js's DOMContentLoaded) hasn't resolved yet, keep both the
 * app shell and the login screen hidden rather than flashing the unauthenticated app shell for
 * a moment -- app.js removes this class as soon as it knows which one to show. */
body.auth-pending .app-container,
body.auth-pending .login-screen.active {
    display: none !important;
}

/* Login screen (see index.html's comment on why this is a real <a href>, not a JS redirect) */
.login-screen {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: var(--bg-dark);
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-screen.active { display: flex; }

.login-card {
    max-width: 380px;
    width: 100%;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: 16px;
    padding: 2.5rem 2rem;
}

.login-card .logo-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.login-card h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-card .subtitle {
    margin-bottom: 1.75rem;
}

.login-btn {
    text-decoration: none;
    justify-content: center;
    font-size: 1rem;
    padding: 0.85rem 1.2rem;
}

.login-hint {
    margin-top: 1.25rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--bg-dark);
    border: 1px solid var(--bg-card-border);
    border-radius: 12px;
    width: 450px;
    max-width: calc(100vw - 2rem);
    max-height: calc(100vh - 4rem);
    padding: 1.5rem;
    /* Content can grow beyond the viewport (long lists, charts, ...); scrolling the whole
       box rather than adding a separate body wrapper keeps every existing modal's markup
       untouched. The header is pinned via `sticky` below so the close button stays reachable
       instead of scrolling off-screen with the rest of the content. */
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    position: sticky;
    top: -1.5rem;
    margin-top: -1.5rem;
    padding-top: 1.5rem;
    background: var(--bg-dark);
    z-index: 1;
}

.close-btn {
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--bg-card-border);
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    color: #fff;
    font-family: inherit;
}

.btn-block { width: 100%; justify-content: center; }

.settings-hint {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.settings-status-line {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.75rem;
}

.settings-checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    padding: 0.4rem 0;
    cursor: pointer;
}

.settings-checkbox-row input[type="checkbox"] {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

#summary-settings-card .card-header { margin-bottom: 0.75rem; }

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 1rem;
    font-size: 0.9rem;
}

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--bg-card-border);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 1.1rem;
    cursor: pointer;
    margin-right: 0.75rem;
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 900px) {
    .app-container {
        position: relative;
    }

    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
    }

    .top-header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .header-title {
        display: flex;
        align-items: center;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 8px 0 24px rgba(0, 0, 0, 0.4);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    .sidebar-backdrop.open {
        opacity: 1;
        pointer-events: auto;
    }

    .main-content {
        padding: 1.25rem;
    }

    /* Was a fixed 2-column grid at every width -- on a phone this squeezed every card's
       content (charts, lists) into a clipped half-width column. Collapses to one column at
       the same breakpoint the sidebar itself collapses to a mobile layout. */
    .grid-2col {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 520px) {
    /* Stays 2-per-row even on a phone (was 1-per-row, stacking all four full-width above the
       fold) so the actual page content is reachable without scrolling past all four tiles
       first. Tighter padding/gap/font-size keep a large formatted EUR value from wrapping or
       overflowing its ~150px-wide half of the row. */
    .metrics-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
    }

    .metric-card {
        padding: 0.85rem;
    }

    .metric-header {
        font-size: 0.75rem;
    }

    .metric-value {
        font-size: 1.15rem;
        overflow-wrap: break-word;
    }

    .metric-trend {
        font-size: 0.72rem;
    }
}

/* Card header with multiple action buttons */
.card-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Transactions table toolbar (search + count) */
.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.table-toolbar .form-control {
    max-width: 360px;
    flex: 1;
}

.table-count-info {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

.table-footer {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

/* Clickable rows (transactions table, anomaly feed) */
.clickable-row {
    cursor: pointer;
    transition: background 0.15s ease;
}

.clickable-row:hover {
    background: rgba(59, 130, 246, 0.08);
}

.row-highlight {
    animation: rowHighlightFlash 2s ease;
}

@keyframes rowHighlightFlash {
    0%, 100% { background: transparent; }
    15%, 60% { background: rgba(59, 130, 246, 0.25); }
}

/* Transaction detail modal */
.detail-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.6rem 1.25rem;
}

.detail-list dt {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.detail-list dt.clickable-row {
    padding: 2px 6px;
    margin: -2px -6px;
    border-radius: 4px;
}

.detail-list dd {
    font-weight: 500;
}

.detail-subsection-title {
    margin: 1rem 0 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.amazon-suborder-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.amazon-suborder-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    font-size: 0.85rem;
}

.amazon-suborder-note {
    margin-left: 0.4rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 400;
}

.amazon-suborder-purpose {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 0.15rem;
}

/* Market indices row */
.indices-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.index-chip {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--bg-card-border);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 110px;
}

.index-name {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.index-price {
    font-weight: 600;
}

.index-change.positive { color: var(--accent-green); }
.index-change.negative { color: var(--accent-red); }

/* Transactions tab: Alle Transaktionen / Verträge & Abos toggle */
.view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.view-toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bg-card-border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.view-toggle-btn.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--accent-blue);
    color: #60a5fa;
}

.hidden { display: none; }

/* Larger modal variant (budget detail: period selector + chart + list) */
.modal-content-lg {
    width: 640px;
}

.budget-detail-summary {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0.5rem 0 0.75rem;
}

.budget-detail-transactions {
    max-height: 260px;
    overflow-y: auto;
    margin-top: 1rem;
}

.budget-detail-tx-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.85rem;
}

.budget-detail-tx-row:last-child {
    border-bottom: none;
}

.budget-detail-tx-main {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.budget-detail-tx-meta {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Refunds card (Overview) */
.refund-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.85rem;
}

.refund-item:last-child {
    border-bottom: none;
}

.refund-meta {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.refund-more-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding-top: 0.75rem;
}

.refund-toggle-link {
    cursor: pointer;
    text-decoration: underline;
}

.refund-toggle-link:hover {
    color: var(--text-primary);
}

.refund-read-btn {
    flex-shrink: 0;
    padding: 2px 9px;
    font-size: 0.85rem;
    line-height: 1.4;
}

.refund-detail-position {
    padding: 0.9rem 1rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 0.6rem;
}

/* Überträge view (Transaktionen tab) */
.transfers-route-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 0 0 1rem;
}

.transfer-route-chip {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.transfer-route-chip strong {
    color: var(--text-primary);
}

.refund-detail-position:last-child {
    margin-bottom: 0;
}

.refund-item-resolved {
    opacity: 0.65;
}

.refund-total-line {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.refund-credits-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.refund-credit-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.7rem;
}

.paperless-doc-link {
    margin-top: 0.75rem;
}

.paperless-doc-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.paperless-doc-badge {
    text-decoration: none;
    filter: grayscale(0.3);
    opacity: 0.85;
}

.paperless-doc-badge:hover {
    filter: none;
    opacity: 1;
}

.refund-detail-position-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* finanzen.net zero summary (Overview) */
.zero-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.zero-summary-stat-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-bottom: 0.3rem;
}

.zero-summary-stat-value {
    font-size: 1.15rem;
    font-weight: 600;
}

.zero-summary-stat-value.negative { color: var(--accent-red); }
.zero-summary-stat-value.positive { color: var(--accent-green); }
