/* Financial Analyst — dashboard theme */

:root {
    --bg-main: #eceff1;
    --sidebar-green: #1e6f4a;
    --sidebar-green-dark: #165a3c;
    --sidebar-green-light: #2a8a5c;
    --card-white: #ffffff;
    --text-dark: #1a1a2e;
    --text-muted: #6b7280;
    --text-sidebar: #e8f5ee;
    --border-light: #e5e7eb;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --radius-card: 5px;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
    --sidebar-width: 240px;
    --font-family: "Segoe UI Variable Text", "Segoe UI", sans-serif;
}

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

html {
    font-size: 70%;
    font-family: var(--font-family);
}

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

/* ── Login page ── */

.login-footer-link {
    margin-top: 18px;
    text-align: center;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.login-footer-link a {
    color: var(--sidebar-green);
    font-weight: 600;
    text-decoration: none;
}

.login-footer-link a:hover {
    text-decoration: underline;
}

.form-hint--error {
    color: var(--accent-red);
    margin-top: 6px;
}

.admin-users-section + .admin-users-section {
    margin-top: 20px;
}

.admin-users-section h2 {
    margin: 0;
    font-size: 1.1rem;
}

.admin-users-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.admin-users-empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

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

.admin-users-table th,
.admin-users-table td {
    padding: 11px 14px;
    vertical-align: middle;
}

.admin-users-actions {
    display: flex;
    flex-flow: row nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.admin-users-table .admin-users-col-actions {
    min-width: 190px;
    width: auto;
    white-space: nowrap;
    text-align: right;
}

.admin-users-actions .admin-users-btn {
    flex: 0 0 auto;
}

.admin-users-table th.admin-users-col-actions,
.admin-users-table td.admin-users-col-actions {
    text-align: right;
}

.admin-users-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 7px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-card);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.admin-users-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex-shrink: 0;
}

.admin-users-btn--primary {
    background: var(--sidebar-green);
    color: #fff;
    border-color: var(--sidebar-green);
}

.admin-users-btn--primary:hover:not(:disabled) {
    background: var(--sidebar-green-dark);
    border-color: var(--sidebar-green-dark);
}

.admin-users-btn--danger {
    background: #fff;
    color: var(--accent-red);
    border-color: #fecaca;
}

.admin-users-btn--danger:hover:not(:disabled) {
    background: #fef2f2;
    border-color: var(--accent-red);
}

.admin-users-btn--ghost {
    background: #fff;
    color: var(--text-dark);
    border-color: var(--border-light);
}

.admin-users-btn--ghost:hover:not(:disabled) {
    background: #f8faf9;
    border-color: #d1d5db;
}

.admin-users-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.admin-users-modal .modal-footer {
    gap: 10px;
}

.admin-users-modal .modal-footer .admin-users-btn {
    min-width: 108px;
}

.admin-users-badge--client {
    background: #e8f0ec;
    color: #4a6358;
}

.admin-users-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--sidebar-green);
    background: rgba(49, 180, 133, 0.12);
    border-radius: 999px;
    vertical-align: middle;
}

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

.login-card {
    background: var(--card-white);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    width: 100%;
    max-width: 420px;
    padding: 40px 36px;
}

.login-brand {
    text-align: center;
    margin-bottom: 32px;
}

.login-brand-icon {
    width: 52px;
    height: 52px;
    background: var(--sidebar-green);
    border-radius: var(--radius-card);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.login-brand-icon svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}

.login-brand h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-dark);
}

.login-brand p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    font-size: 0.95rem;
    font-family: inherit;
    background: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.login-remember-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--sidebar-green);
}

.login-remember label {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--sidebar-green-light);
    box-shadow: 0 0 0 3px rgba(30, 111, 74, 0.15);
    background: #fff;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--sidebar-green);
    color: #fff;
    border: none;
    border-radius: var(--radius-card);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}

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

.alert-error {
    background: #fef2f2;
    color: var(--accent-red);
    border: 1px solid #fecaca;
    border-radius: var(--radius-card);
    padding: 10px 14px;
    font-size: 0.85rem;
    margin-bottom: 18px;
}

/* ── Dashboard net summary row ── */

.summary-row {
    display: flex;
    gap: 14px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: stretch;
}

.summary-card {
    flex: 1;
    min-width: 150px;
    background: var(--card-white);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-left: 4px solid #f15a4f;
}

.summary-card--positive {
    border-left-color: var(--accent-green);
}

.summary-card--negative {
    border-left-color: var(--accent-red);
}

.summary-card--inflow {
    border-left-color: #439dff;
}

.summary-card-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.summary-card-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.summary-card--positive .summary-card-value {
    color: #16a34a;
}

.summary-card--negative .summary-card-value {
    color: var(--accent-red);
}

.summary-card-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ── Dashboard layout ── */

.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-green);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-card);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo-icon svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

.sidebar-logo span {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    color: var(--text-sidebar);
    text-decoration: none;
    border-radius: var(--radius-card);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.sidebar-nav a svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-user {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 10px;
    word-break: break-all;
}

.sidebar-logout {
    display: inline-block;
    font-size: 0.85rem;
    color: #fff;
    text-decoration: none;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-card);
    transition: background 0.2s;
}

.sidebar-logout:hover {
    background: rgba(255, 255, 255, 0.22);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 28px 32px;
    background: var(--bg-main);
    min-height: 100vh;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

.page-header-main {
    flex: 1;
    min-width: 0;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.btn-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-with-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    flex-shrink: 0;
}

.btn-add-entry {
    padding: 10px 25px;
    background: #31b485;
    color: #fff;
    border: none;
    border-radius: var(--radius-card);
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-add-entry:hover {
    background: #2a9d72;
}

.btn-add-entry:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-add-entry.btn-inline {
    width: auto;
    margin-top: 0;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* ── Stat cards ── */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--card-white);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 22px 20px;
}

.stat-card-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 8px 0 6px;
    color: var(--text-dark);
}

.stat-card-change {
    font-size: 0.82rem;
    font-weight: 600;
}

.stat-card-change.positive {
    color: var(--accent-green);
}

.stat-card-change.negative {
    color: var(--accent-red);
}

.stat-card-change.neutral {
    color: var(--text-muted);
}

/* ── Content cards ── */

.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.content-card {
    background: var(--card-white);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 22px 20px;
}

.content-card h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 18px;
}

.chart-placeholder {
    height: 200px;
    background: linear-gradient(180deg, #f8faf9 0%, #eef4f0 100%);
    border-radius: var(--radius-card);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 12px;
    padding: 20px 24px 0;
}

.chart-bar {
    width: 36px;
    background: var(--sidebar-green-light);
    border-radius: var(--radius-card) var(--radius-card) 0 0;
    opacity: 0.85;
}

.dashboard-single-section {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.reports-section {
    margin-bottom: 40px;
}

.reports-section-header {
    margin-bottom: 20px;
}

.reports-section-header h2 {
    margin: 0 0 6px;
    font-size: 1.35rem;
    color: var(--sidebar-green);
}

.reports-section-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.report-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.report-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border: 1px solid #d9d9d9;
    border-radius: 5px;
    background: #e9e9e9;
    color: #4a4a4a;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.report-tab:hover {
    border-color: #d9d9d9;
    background: #f0f0f0;
}

.report-tab.active {
    background: #ffffff;
    border: solid 1px #d9d9d9;
    color: var(--sidebar-green);
}

.report-tab-panel.hidden {
    display: none;
}

.income-vs-cost-card {
    min-height: 420px;
}

.line-chart-wrap {
    position: relative;
    width: 100%;
    overflow: visible;
    border-radius: var(--radius-card);
    background: linear-gradient(180deg, #ffffff 0%, #f8faf9 100%);
    border-top: 2px solid #1f2937;
    padding: 8px 0 0;
}

.line-chart {
    display: block;
    width: 100%;
    height: 340px;
    position: relative;
    z-index: 1;
}

.line-chart-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.line-chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}

.line-chart-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.line-chart-legend-income {
    background: #1e6f4a;
}

.line-chart-legend-cost {
    background: #e67e22;
}

.line-chart-legend-tax {
    background: #dc2626;
}

.line-chart-point {
    cursor: pointer;
}

.line-chart-tooltip {
    position: fixed;
    z-index: 200;
    pointer-events: none;
    width: 280px;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid var(--border-light);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.82rem;
    color: var(--text-muted);
    max-height: calc(100vh - 24px);
    overflow-y: auto;
}

.line-chart-tooltip.hidden {
    display: none;
}

.line-chart-tooltip strong {
    color: #1f2937;
    font-size: 0.88rem;
}

.line-chart-tooltip-breakdown {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
}

.line-chart-tooltip-breakdown span {
    color: #374151;
    font-size: 0.8rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.category-chart-subtitle {
    margin: 4px 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.category-average-chart-card {
    margin-top: 0;
}

.category-bar-fill-average {
    opacity: 0.75;
}

.category-chart-card {
    min-height: 420px;
}

.category-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.category-chart-header h2 {
    margin-bottom: 0;
}

.category-chart-total {
    display: inline-flex;
    align-items: center;
    padding: 10px 11px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--sidebar-green);
    border: 1.5px solid var(--sidebar-green);
    border-radius: 6px;
    white-space: nowrap;
    line-height: 1;
}

.category-chart-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Force uniform height for all interactive controls in chart headers */
.category-chart-controls .cost-sheet-select,
.category-chart-controls .btn-limits,
.category-chart-controls .category-chart-total,
.category-chart-controls .cost-sheet-real-total,
.category-chart-controls .cost-sheet-total,
.category-chart-controls .btn-category-settings {
    height: 36px;
    box-sizing: border-box;
}

.btn-add-more {
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-secondary);
    background: #fff;
    border: 1.5px solid #c5d9cc;
    border-radius: 6px;
    white-space: nowrap;
    cursor: pointer;
    line-height: 1;
    transition: border-color 0.15s, background 0.15s;
}

.btn-add-more:hover {
    border-color: var(--sidebar-green);
    background: #f8fcf9;
    color: var(--sidebar-green-dark);
}

.modal-dialog--add-entry-picker {
    max-width: 920px;
    width: calc(100% - 32px);
}

.add-entry-picker-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.add-entry-picker-column-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(30, 111, 74, 0.15);
}

.add-entry-picker-column--cost .add-entry-picker-column-title {
    color: #c0392b;
    border-bottom-color: rgba(241, 90, 79, 0.35);
}

.add-entry-picker-column--inflow .add-entry-picker-column-title {
    color: #2b6cb0;
    border-bottom-color: rgba(67, 157, 255, 0.35);
}

.add-entry-picker-option {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.add-entry-picker-option:last-child {
    border-bottom: none;
}

.add-entry-picker-option-icon {
    width: 40px;
    height: 40px;
    background: rgba(30, 111, 74, 0.1);
    border-radius: var(--radius-card);
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-entry-picker-option-icon svg {
    width: 22px;
    height: 22px;
    fill: var(--sidebar-green);
}

.add-entry-picker-option-body h4 {
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.add-entry-picker-option-body p {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin: 0;
}

.add-entry-picker-action {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .add-entry-picker-grid {
        grid-template-columns: 1fr;
    }

    .page-header-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}

.modal-dialog--add-more {
    max-width: 420px;
    width: 92vw;
}

.add-more-description {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    line-height: 1.5;
}

.add-more-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.add-more-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.add-more-row:hover {
    background: #f4faf6;
}

.add-more-row input {
    width: 16px;
    height: 16px;
    accent-color: var(--sidebar-green);
    cursor: pointer;
}

.add-more-label {
    flex: 1;
    user-select: none;
}

.add-more-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.add-more-footer .btn-primary,
.add-more-footer .btn-secondary {
    width: auto;
    min-width: 100px;
    padding: 10px 20px;
    margin-top: 0;
    font-size: 0.88rem;
}

.month-filter-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.month-filter-form label {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.avg-range-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.avg-range-form label {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.comparison-remove-tax {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #1f2937;
    cursor: pointer;
    user-select: none;
}

.comparison-remove-tax input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--sidebar-green);
    cursor: pointer;
}

.category-exclude-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.category-exclude-filter input {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--sidebar-green);
    cursor: pointer;
}

.category-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-x: hidden;
    border-radius: var(--radius-card);
}

.category-bar-plot {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 0;
    min-height: 260px;
    width: 100%;
    padding: 6px 2px 0;
    background: linear-gradient(180deg, #f8faf9 0%, #eef4f0 100%);
    border-radius: var(--radius-card) var(--radius-card) 0 0;
}

.category-bar-labels {
    display: flex;
    justify-content: flex-start;
    gap: 0;
    width: 100%;
    padding: 8px 2px 10px;
    background: #fff;
    border-top: 1px solid var(--border-light);
    border-radius: 0 0 var(--radius-card) var(--radius-card);
}

.category-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1 1 0;
    min-width: 0;
    padding: 0 1px;
}

.category-bar-amount {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
    text-align: center;
    white-space: nowrap;
}

.category-bar-track {
    width: 100%;
    height: 190px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    position: relative;
}

.category-bar-fill {
    width: 82%;
    max-width: none;
    min-height: 6px;
    border-radius: 3px 3px 0 0;
    opacity: 0.95;
    transition: height 0.3s ease, background 0.2s ease;
    position: relative;
    z-index: 1;
}

.category-bar-fill--good {
    background: #34d399;
}

.category-bar-fill--over-limit {
    background: rgb(249 89 88);
}

/* ── Category Limit indicators ── */

.limit-fill {
    position: absolute;
    bottom: 0;
    left: 9%;
    right: 9%;
    background: rgb(255 255 255 / 64%);
    border-radius: 3px 3px 0 0;
    border: 1px dashed #25bf8c;
    border-bottom: none;
    pointer-events: none;
    z-index: 0;
    transition: height 0.3s ease;
}

.limit-line {
    position: absolute;
    left: 9%;
    right: 9%;
    height: 2px;
    background: #fbff3f;
    pointer-events: none;
    z-index: 2;
    border-radius: 1px;
}

/* ── Bar chart tooltip ── */

.chart-bar-tooltip {
    position: fixed;
    z-index: 3000;
    background: #420e4d;
    color: #f9fafb;
    border-radius: 10px;
    padding: 11px 15px;
    font-size: 0.82rem;
    pointer-events: none;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
    min-width: 170px;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.12s ease, transform 0.12s ease;
}

.chart-bar-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.tip-category {
    font-weight: 700;
    font-size: 0.87rem;
    margin-bottom: 8px;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    white-space: normal;
    line-height: 1.3;
}

.tip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 3px;
}

.tip-row--limit {
    opacity: 0.85;
}

.tip-label {
    color: #9ca3af;
    font-size: 0.78rem;
    white-space: nowrap;
}

.tip-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tip-status {
    margin-top: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 5px;
    text-align: center;
    letter-spacing: 0.01em;
}

.tip-over {
    background: rgba(224, 35, 35, 0.87);
    color: #ffffff;
}

.tip-under {
    background: #40b66b;
    color: #ffffff;
}

.category-bar-group[data-category] {
    cursor: crosshair;
}

/* ── Limits button (matches Real Costs frame, red theme) ── */

.btn-limits {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 8px 12px;
    margin: 0;
    color: #ef4444;
    background: #fef2f2;
    border: 1.5px solid #ef4444;
    border-radius: var(--radius-card);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
    box-sizing: border-box;
    appearance: none;
    transition: box-shadow 0.15s, background 0.15s;
}

.btn-limits:hover {
    background: #fde8e8;
    box-shadow: 0 0 0 2px #fecaca;
}

/* ── Limits modal ── */

.modal-dialog--limits {
    width: min(540px, 100%);
    max-height: 46vh;
    align-self: flex-start;
    margin-top: 48px;
}

.modal-dialog--limits .modal-footer {
    justify-content: flex-start;
    gap: 12px;
}

.limits-description {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.4;
}

.limits-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 22vh;
    overflow-y: auto;
}

.limits-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f0;
}

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

.limits-category-name {
    font-size: 0.87rem;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.limits-input-wrap {
    display: flex;
    align-items: center;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.limits-currency-sign {
    padding: 0 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
    align-self: stretch;
    display: flex;
    align-items: center;
}

.limits-input {
    width: 100px;
    padding: 5px 8px;
    border: none;
    outline: none;
    font-size: 0.87rem;
    font-family: inherit;
    background: transparent;
}

.limits-input:focus {
    background: #f0fdf4;
}

.limits-clear-btn {
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px 6px;
    border-radius: 4px;
    line-height: 1;
    font-family: inherit;
    transition: color 0.15s, background 0.15s;
}

.limits-clear-btn:hover {
    color: #ef4444;
    background: #fef2f2;
}

.limits-total-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-right: auto;
}

.limits-total-label strong {
    color: var(--text-dark);
    font-weight: 700;
}

.limits-footer-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.limits-btn-clear-all {
    padding: 7px 16px;
    background: transparent;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, color 0.15s;
}

.limits-btn-clear-all:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.limits-btn-save {
    padding: 7px 22px;
    background: var(--sidebar-green);
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.limits-btn-save:hover {
    background: var(--sidebar-green-dark);
}

.category-bar-label {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 1px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
    hyphens: auto;
}

.chart-empty {
    min-height: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    background: linear-gradient(180deg, #f8faf9 0%, #eef4f0 100%);
    border-radius: var(--radius-card);
}

.chart-empty a {
    color: var(--sidebar-green);
    font-weight: 600;
}

.category-list {
    list-style: none;
}

.category-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
}

.category-list li:last-child {
    border-bottom: none;
}

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

.category-amount {
    font-weight: 600;
}

/* ── Cost entry cards ── */

.entry-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.entry-card {
    background: var(--card-white);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    min-height: 220px;
}

.entry-card-icon {
    width: 48px;
    height: 48px;
    background: rgba(30, 111, 74, 0.1);
    border-radius: var(--radius-card);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}

.entry-card-icon svg {
    width: 26px;
    height: 26px;
    fill: var(--sidebar-green);
}

.entry-card h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.entry-card p {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.55;
    flex: 1;
}

.entry-card-badge {
    display: inline-block;
    margin-top: 18px;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sidebar-green);
    background: rgba(34, 197, 94, 0.12);
    border-radius: var(--radius-card);
    align-self: flex-start;
}

.entry-card--excel .excel-import-controls {
    margin-top: auto;
    padding-top: 18px;
}

.entry-card--manual .manual-entry-controls {
    margin-top: auto;
    padding-top: 18px;
}

.entry-card--photos .photo-import-controls {
    margin-top: auto;
    padding-top: 18px;
}

.excel-file-name {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    word-break: break-all;
}

.excel-import-actions {
    display: flex;
    gap: 10px;
}

.btn-secondary {
    padding: 10px 16px;
    background: #31b485;
    color: #ffffff;
    border: none;
    border-radius: var(--radius-card);
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-secondary:hover {
    background: rgb(37 139 102);
}

.btn-primary.btn-inline {
    width: auto;
    margin-top: 0;
    padding: 10px 16px;
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.cost-alert {
    margin-bottom: 18px;
    padding: 12px 16px;
    border-radius: var(--radius-card);
    font-size: 0.88rem;
    font-weight: 500;
}

.cost-alert--success {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.cost-alert--error {
    background: #fef2f2;
    color: var(--accent-red);
    border: 1px solid #fecaca;
}

.hidden {
    display: none !important;
}

.cost-sheet-section {
    margin-top: 28px;
}

.cost-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.cost-sheet-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.cost-sheet-count {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.cost-sheet-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 12px 14px;
    background: var(--card-white);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
}

.cost-sheet-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.bulk-selection-count {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.btn-danger {
    padding: 10px 16px;
    background: #fff;
    color: var(--accent-red);
    border: 1px solid #fecaca;
    border-radius: var(--radius-card);
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-danger:hover:not(:disabled) {
    background: #fef2f2;
    border-color: var(--accent-red);
}

.btn-danger:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.cost-sheet-rows-per-page {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cost-sheet-rows-per-page label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.cost-sheet-select {
    width: auto;
    min-width: 100px;
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px 12px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    font-size: 0.84rem;
    font-family: inherit;
    color: var(--text-dark);
    cursor: pointer;
    height: 36px;
    box-sizing: border-box;
    line-height: 1.2;
}

.cost-sheet-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}

.page-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    background: #fff;
    color: var(--text-dark);
    font-size: 0.84rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.page-btn:hover {
    border-color: var(--sidebar-green-light);
    color: var(--sidebar-green);
}

.page-btn--active {
    background: var(--sidebar-green);
    border-color: var(--sidebar-green);
    color: #fff;
}

.page-btn--active:hover {
    background: var(--sidebar-green-dark);
    border-color: var(--sidebar-green-dark);
    color: #fff;
}

.page-btn--arrow {
    min-width: 38px;
    font-size: 1rem;
    line-height: 1;
}

.page-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.page-ellipsis {
    min-width: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    user-select: none;
}

.col-select {
    width: 42px;
    text-align: center;
}

.col-select input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.cost-sheet-toolbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-left: auto;
}

.cost-sheet-total {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 8px 12px;
    border: 1px solid #1e6f4a;
    border-radius: var(--radius-card);
    background: #ffffff;
    white-space: nowrap;
}

/* Real Costs / Real Inflow box — highlighted variant */
.cost-sheet-real-total {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 8px 12px;
    border: 1.5px solid var(--sidebar-green);
    border-radius: var(--radius-card);
    background: #edf7f1;
    white-space: nowrap;
}

.cost-sheet-real-total-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--sidebar-green-dark);
}

.cost-sheet-total-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #1e6f4a;
}

.cost-sheet-total-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--sidebar-green);
}

.cost-sheet-range {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.cost-row-hidden {
    display: none;
}

.cost-month-header td {
    background: #eef6f1;
    color: var(--primary-dark, #1e6f4a);
    font-weight: 600;
    font-size: 0.9rem;
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
    border-top: 2px solid #d7e8de;
}

.cost-row-no-date td {
    background: #fff9db;
}

.cost-row-no-date:hover td {
    background: #fff3bf;
}

.cost-row-inflow td {
    background: #eef6f1;
}

.cost-row-inflow:hover td {
    background: #dcefe4;
}

.cost-row-inflow.cost-row-duplicate td {
    background: rgba(34, 197, 94, 0.08);
}

.review-row-inflow,
.review-row-inflow td {
    background: #eef6f1;
}

.review-row-inflow:hover td {
    background: #dcefe4;
}

.review-row-inflow .review-cell-uncertain {
    background: rgba(30, 111, 74, 0.08);
}

.review-row-inflow .review-cell-uncertain .review-input {
    border-color: var(--sidebar-green-light);
    background: #f5fbf7;
}

.cost-sheet-month-reset {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.cost-sheet-month-reset label {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.cost-sheet-category-filter,
.cost-sheet-duplicate-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.cost-sheet-category-filter label,
.cost-sheet-duplicate-filter label {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.category-filter-dropdown {
    position: relative;
}

.category-filter-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 180px;
    max-width: 240px;
    cursor: pointer;
    text-align: left;
}

.category-filter-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 20;
    min-width: 280px;
    max-width: min(360px, 80vw);
    padding: 10px;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
}

.category-filter-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 4px 8px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 8px;
}

.category-filter-options {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 280px;
    overflow-y: auto;
}

.category-filter-option {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 6px 4px;
    border-radius: 6px;
    font-size: 0.84rem;
    color: var(--text-dark);
    cursor: pointer;
}

.category-filter-option:hover {
    background: #f8faf9;
}

.category-filter-option input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
}

.category-filter-option span {
    line-height: 1.35;
    word-break: break-word;
}

.col-sortable {
    padding: 0;
}

.sortable-col-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    padding: 5px 5px;
    border: none;
    background: transparent;
    font: inherit;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    cursor: pointer;
    text-align: left;
}

.sortable-col-btn:hover,
.sortable-col-btn.is-active {
    color: var(--sidebar-green);
}

.sort-indicator {
    display: inline-block;
    min-width: 0.75rem;
    font-size: 0.65rem;
    line-height: 1;
}

.category-chart-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.month-filter-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.month-filter-form label {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.cost-sheet-table-wrap,
.review-table-wrap {
    background: var(--card-white);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    overflow-x: auto;
}

.cost-sheet-table,
.review-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.cost-sheet-table th,
.cost-sheet-table td,
.review-table th,
.review-table td {
    padding: 5px 5px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.cost-sheet-table th,
.review-table th {
    background: #f8faf9;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.cost-sheet-table tr:last-child td,
.review-table tr:last-child td {
    border-bottom: none;
}

.cost-sheet-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 28px 16px !important;
}

.row-actions {
    white-space: nowrap;
}

.col-title-content {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}



.duplicate-warning {
    display: inline-flex;
    flex-shrink: 0;
    color: var(--accent-red);
    line-height: 0;
}

.duplicate-warning svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.cost-row-duplicate td {
    background: rgba(239, 68, 68, 0.04);
}

.btn-link {
    border: none;
    background: transparent;
    color: var(--sidebar-green);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    margin-right: 12px;
}

.btn-link:hover {
    color: var(--sidebar-green-dark);
    text-decoration: underline;
}

.btn-delete {
    color: #ffffff;
    margin-right: 0;
    padding: 8px 10px;
    background: #ef4444;
    border: solid 1px #fefefe;
    border-radius: 5px;
    font-size: 9px;
    font-weight: 500;
}

.btn-delete:hover {
    color: #fff;
    background: #bd3131;
}

.modal-dialog--form {
    width: min(520px, 100%);
}

.modal-dialog--form-wide {
    width: min(640px, 100%);
}

.edit-entry-form--two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 16px;
}

.edit-entry-form--two-col .form-group {
    margin-bottom: 16px;
}

.edit-entry-form--two-col .form-group--full {
    grid-column: 1 / -1;
}

.edit-entry-form--two-col .form-group.hidden {
    display: none;
}

.edit-entry-form .form-group:last-child {
    margin-bottom: 0;
}

.edit-entry-source {
    padding: 11px 14px;
    background: #f8faf9;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    font-size: 0.9rem;
    color: var(--text-muted);
    word-break: break-word;
}

.edit-entry-final-amount {
    padding: 11px 14px;
    background: #f8faf9;
    border: 1px solid #d7e8de;
    border-radius: var(--radius-card);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--sidebar-green);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
}

.modal-dialog {
    position: relative;
    width: min(1100px, 100%);
    max-height: 90vh;
    background: var(--card-white);
    border-radius: var(--radius-card);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
}

.modal-header,
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.modal-footer {
    border-bottom: none;
    border-top: 1px solid var(--border-light);
    justify-content: flex-end;
}

.modal-footer--import {
    flex-direction: column;
    align-items: stretch;
}

.modal-footer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.modal-footer--import-setup {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
}

.modal-footer--import-setup .modal-inline-error {
    margin-right: auto;
}

.modal-footer--import-setup .modal-footer-actions {
    margin-left: auto;
    flex-shrink: 0;
}

.modal-inline-error {
    margin: 0;
    flex: 1;
    min-width: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: #b91c1c;
    line-height: 1.35;
}

.modal-inline-error.hidden {
    display: none;
}

.import-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.import-progress-track {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.import-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--sidebar-green);
    border-radius: 999px;
    transition: width 0.15s ease;
}

.import-progress-fill.is-indeterminate {
    width: 35% !important;
    transition: none;
    animation: import-progress-indeterminate 1.2s ease-in-out infinite;
}

@keyframes import-progress-indeterminate {
    0% {
        transform: translateX(-120%);
    }
    100% {
        transform: translateX(320%);
    }
}

.import-progress-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 4.5rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.modal-dialog--ocr-progress {
    width: min(440px, 92vw);
}

.ocr-progress-status {
    margin: 0 0 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main, #111827);
}

.ocr-progress-file {
    margin: 0 0 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
    word-break: break-all;
    min-height: 1.2em;
}

#ocr-progress-modal .import-progress {
    margin-top: 4px;
}

#ocr-progress-modal .modal-footer {
    justify-content: flex-end;
}

.import-setup-file-list {
    list-style: none;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-card, 10px);
    background: #f9fafb;
    max-height: 160px;
    overflow: auto;
}

.import-setup-file-list li {
    font-size: 0.88rem;
    color: var(--text-main, #111827);
    word-break: break-all;
    padding: 4px 0;
}

.import-setup-file-list li + li {
    border-top: 1px solid #eef2f7;
}

#excel-import-guide-modal {
    z-index: 1100;
}

.modal-dialog--excel-guide {
    width: min(760px, 100%);
}

.excel-import-guide-body {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 20px 24px 24px;
    overflow-y: auto;
}

.excel-import-guide-section-title {
    margin: 0 0 8px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.excel-import-guide-lead {
    margin: 0 0 12px;
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.excel-import-guide-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: #f8fafc;
}

.excel-import-guide-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.excel-import-guide-table th,
.excel-import-guide-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}

.excel-import-guide-table th {
    background: #eef6f1;
    color: #166534;
    font-weight: 700;
    white-space: nowrap;
}

.excel-import-guide-table tbody tr:last-child td {
    border-bottom: none;
}

.excel-import-guide-table td:nth-child(3),
.excel-import-guide-table td:nth-child(4),
.excel-import-guide-table th:nth-child(3),
.excel-import-guide-table th:nth-child(4) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.excel-import-guide-list {
    margin: 0;
    padding-left: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.excel-import-guide-list code {
    font-size: 0.82rem;
    padding: 1px 5px;
    border-radius: 4px;
    background: #eef2f7;
    color: var(--text-primary);
}

.form-hint {
    margin: 6px 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.required-mark {
    color: #dc2626;
    font-weight: 700;
}

.modal-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-header p,
.review-summary {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 24px 24px;
    overflow: auto;
}

.review-summary {
    margin: 18px 0;
    padding: 12px 14px;
    background: #f8faf9;
    border-radius: var(--radius-card);
}

.review-row-uncertain {
    background: #fffbeb;
}

.review-cell-uncertain {
    background: rgba(251, 191, 36, 0.08);
}

.review-input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    background: #fff;
    font-size: 0.84rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.review-input:focus {
    outline: none;
    border-color: var(--sidebar-green-light);
    box-shadow: 0 0 0 2px rgba(30, 111, 74, 0.12);
}

.review-cell-uncertain .review-input {
    border-color: #f59e0b;
    background: #fffdf5;
}

.review-select,
.review-date,
.review-text,
.review-amount {
    min-width: 130px;
}

.review-select--category {
    min-width: 156px;
}

#edit-entry-category {
    min-width: 156px;
}

.review-text {
    min-width: 160px;
}

.review-amount {
    min-width: 100px;
}

.review-select {
    cursor: pointer;
}

.review-select--ratio {
    min-width: 88px;
}

@media (max-width: 900px) {
    .entry-cards-grid {
        grid-template-columns: 1fr;
    }

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

    .sidebar {
        width: 72px;
    }

    .sidebar-logo span,
    .sidebar-nav a span,
    .sidebar-user,
    .sidebar-footer .sidebar-logout {
        display: none;
    }

    .sidebar-header {
        padding: 16px 12px;
        text-align: center;
    }

    .sidebar-nav a {
        justify-content: center;
        padding: 12px;
    }

    .main-content {
        margin-left: 72px;
        padding: 20px 16px;
    }

    .cost-sheet-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .cost-sheet-toolbar-left {
        width: 100%;
    }

    .cost-sheet-toolbar-right {
        width: 100%;
        justify-content: space-between;
    }

    .cost-sheet-pagination {
        justify-content: flex-start;
    }

    .cost-sheet-range {
        white-space: normal;
    }

    .edit-entry-form--two-col {
        grid-template-columns: 1fr;
    }
}

.transfer-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.transfer-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 21px;
    border: 1px solid #d9d9d9;
    border-radius: 5px;
    background: #e9e9e9;
    color: #4a4a4a;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.transfer-tab:hover {
    border-color: #d9d9d9;
    background: #f0f0f0;
}

.transfer-tab.active {
    background: #ffffff;
    border: solid 1px #d9d9d9;
    color: #1e1e1e;
}

.transfer-tab-count {
    font-size: 10px;
    font-weight: 600;
}

.transfer-tab-panel.hidden {
    display: none;
}

.transfer-table-total td {
    background: #f8faf9;
    border-top: 2px solid var(--border-light);
}

.preset-section {
    background: var(--card-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    padding: 24px;
    margin-bottom: 24px;
}

.preset-section-header {
    margin-bottom: 20px;
}

.preset-section-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.preset-section-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.preset-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.preset-row {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) minmax(280px, 1fr);
    gap: 16px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    background: #f8faf9;
}

.preset-row-label {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
}

.preset-row-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.preset-amount-input {
    width: 140px;
    min-width: 120px;
}

.preset-toggle {
    display: inline-flex;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    overflow: hidden;
    background: #fff;
}

.preset-toggle-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.preset-toggle-btn.active {
    background: var(--sidebar-green);
    color: #fff;
}

.preset-toggle-btn:not(.active):hover {
    background: #eef6f1;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-card);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

@media (max-width: 768px) {
    .preset-row {
        grid-template-columns: 1fr;
    }

    .preset-row-controls {
        flex-wrap: wrap;
    }
}

/* ── Categories page ── */

.categories-panel {
    background: var(--card-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    padding: 24px;
}

.categories-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.categories-type-tabs {
    display: inline-flex;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    overflow: hidden;
    background: #f8faf9;
}

.categories-type-tab {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.categories-type-tab.active {
    background: var(--sidebar-green);
    color: #fff;
}

.categories-type-tab:not(.active):hover {
    background: #eef6f1;
}

.categories-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.categories-category-tabs.hidden {
    display: none;
}

.categories-category-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 220px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    background: #fff;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.categories-category-tab.active {
    background: var(--sidebar-green);
    border-color: var(--sidebar-green);
    color: #fff;
}

.categories-category-tab:not(.active):hover {
    background: #eef6f1;
    border-color: var(--sidebar-green-light);
}

.categories-category-tab-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.categories-category-tab-count {
    flex-shrink: 0;
    min-width: 22px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    font-size: 0.68rem;
    font-weight: 700;
    text-align: center;
}

.categories-category-tab.active .categories-category-tab-count {
    background: rgba(255, 255, 255, 0.2);
}

.categories-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    min-width: min(100%, 420px);
}

.categories-search-input {
    min-width: 240px;
    flex: 1;
}

.categories-content {
    min-height: 120px;
}

.categories-empty {
    padding: 28px;
    text-align: center;
    color: var(--text-muted);
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-card);
    background: #f8faf9;
}

.categories-card {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    background: #f8faf9;
    padding: 18px;
}

.categories-card-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.categories-card-header h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.categories-card-header p {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.categories-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.categories-keyword-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.categories-keyword-item {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    min-height: 88px;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
}

.categories-keyword-text {
    font-size: 11px;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    word-break: break-word;
}

.categories-keyword-actions {
    display: flex;
    gap: 6px;
    justify-content: stretch;
}

.categories-chip-btn {
    flex: 1;
    border: 1px solid var(--border-light);
    background: #f8faf9;
    color: var(--sidebar-green);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 9px 4px;
    border-radius: var(--radius-card);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.categories-chip-btn:hover {
    background: #eef6f1;
    border-color: var(--sidebar-green-light);
}

.categories-chip-btn--danger {
    color: var(--accent-red);
}

.categories-chip-btn--danger:hover {
    background: #fef2f2;
    border-color: #fecaca;
}

.categories-keyword-empty {
    grid-column: 1 / -1;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 8px 2px;
}

.categories-icon-btn {
    border: 1px solid var(--border-light);
    background: #fff;
    color: var(--sidebar-green);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 6px 10px;
    border-radius: var(--radius-card);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.categories-icon-btn:hover {
    background: #eef6f1;
    border-color: var(--sidebar-green-light);
}

.categories-icon-btn--danger {
    color: var(--accent-red);
}

.categories-icon-btn--danger:hover {
    background: #fef2f2;
    border-color: #fecaca;
}

.categories-add-keyword-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.categories-add-keyword-input {
    flex: 1;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

@media (max-width: 1200px) {
    .categories-keyword-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .categories-keyword-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .categories-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .categories-toolbar-actions {
        width: 100%;
    }

    .categories-card-header {
        flex-direction: column;
    }

    .categories-keyword-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .categories-add-keyword-form {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .categories-keyword-grid {
        grid-template-columns: 1fr;
    }
}

.advanced-tools-card {
    max-width: 720px;
}

.advanced-tools-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}

.advanced-tools-selects {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 20px;
}

.advanced-tools-selects .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.advanced-tools-selects .form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.advanced-tools-selects .cost-sheet-select {
    min-width: 220px;
}

.advanced-tools-summary {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.5;
}

.advanced-tools-clear-btn {
    align-self: flex-end;
    width: auto;
    min-width: 160px;
    padding: 10px 20px;
    font-size: 0.88rem;
    font-family: inherit;
    cursor: pointer;
}

.advanced-tools-empty {
    margin: 16px 0 0;
    color: var(--text-muted);
}

#db-refresh-modal .modal-dialog {
    width: min(420px, 92vw);
}

#db-refresh-modal .btn-primary {
    width: auto;
    min-width: 120px;
    margin-top: 0;
    padding: 10px 20px;
}

.db-refresh-countdown {
    margin-bottom: 0;
    color: var(--text-muted);
}

.db-refresh-countdown strong {
    color: var(--sidebar-green-dark);
    font-size: 1.1rem;
}

/* ── Category Settings button ─────────────────────────────────────── */
.btn-category-settings {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 10px 11px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1.5px solid var(--sidebar-green);
    border-radius: 6px;
    background: transparent;
    color: var(--sidebar-green);
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    font-family: inherit;
}

.btn-category-settings:hover {
    background: var(--sidebar-green);
    color: #fff;
}

.btn-category-settings svg {
    width: 13px;
    height: 13px;
    fill: currentColor;
}

/* ── Category Settings overlay / dialog ──────────────────────────── */
.cat-settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 3000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 56px;
}

.cat-settings-dialog {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.22);
    width: min(760px, 95vw);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cat-settings-desc {
    margin: 0 24px 12px;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.cat-settings-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    overflow-y: auto;
    flex: 1;
    padding: 0 24px 16px;
}

.cat-settings-col {
    padding-right: 16px;
}

.cat-settings-col:last-child {
    padding-right: 0;
    padding-left: 16px;
    border-left: 1px solid #e8e8e8;
}

.cat-settings-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sidebar-green-dark);
    padding: 8px 0 6px;
    position: sticky;
    top: 0;
    background: #fff;
}

.cat-settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.cat-settings-label {
    font-size: 0.84rem;
    color: #333;
}

/* Toggle switch */
.cat-settings-toggle {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
    flex-shrink: 0;
}

.cat-settings-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cat-settings-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 22px;
    cursor: pointer;
    transition: background 0.2s;
}

.cat-settings-slider::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}

.cat-settings-toggle input:checked + .cat-settings-slider {
    background: var(--sidebar-green);
}

.cat-settings-toggle input:checked + .cat-settings-slider::before {
    transform: translateX(16px);
}

/* Footer */
.cat-settings-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 24px;
    border-top: 1px solid #eee;
}

.cat-settings-note {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.cat-settings-footer-actions {
    display: flex;
    gap: 10px;
}

/* Make both modal footer buttons equal size, overriding global .btn-primary width: 100% */
.cat-settings-footer .btn-primary,
.cat-settings-footer .btn-secondary {
    width: auto;
    min-width: 130px;
    padding: 10px 20px;
    margin-top: 0;
    font-size: 0.88rem;
}

/* ── Preset bar indicators (Dashboard) ─────────────────────────────────────── */

/* Red amount label for preset-overridden bars */
.category-bar-amount--preset {
    color: #c0392b;
    font-weight: 700;
}

/* Red star on axis label */
.category-bar-label--preset {
    color: #c0392b;
}

.preset-star {
    color: #c0392b;
    font-size: 0.85em;
    margin-left: 1px;
}

/* Preset row in the bar tooltip */
.tip-row--preset {
    background: #fff3e0;
    border-radius: 3px;
    padding: 1px 4px;
    margin: 2px -4px;
}

.tip-row--preset .tip-label { color: #e65100; }
.tip-row--preset .tip-value { color: #e65100; font-weight: 700; }

/* ── Real Costs / Real Inflow: clickable total box ──────────────────────────── */

.cost-sheet-real-total {
    cursor: pointer;
    transition: box-shadow 0.15s;
}

.cost-sheet-real-total:hover {
    border: 1.5px solid var(--sidebar-green);
    background: #cff9e6;
}

.cost-sheet-total.real-costs-breakdown-trigger {
    cursor: pointer;
    transition: box-shadow 0.15s;
}

.cost-sheet-total.real-costs-breakdown-trigger:hover {
    border: 1.5px solid var(--sidebar-green);
}

/* ── Real Costs breakdown modal ─────────────────────────────────────────────── */

.modal-dialog--real-costs {
    max-width: 500px;
    width: 92vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.real-costs-description {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    line-height: 1.5;
}

.real-costs-grid {
    overflow-y: auto;
    max-height: 48vh;
}

.real-costs-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.88rem;
}

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

.real-costs-row--preset {
    background: #fff8f0;
    border-radius: 4px;
    padding: 7px 8px;
    border-bottom: 1px solid #ffe5c0;
}

.real-costs-cat {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.real-costs-preset-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: #e65100;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.real-costs-amount {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.real-costs-actual-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.real-costs-empty {
    color: var(--text-muted);
    font-size: 0.88rem;
    text-align: center;
    padding: 20px 0;
}

.real-costs-footer-total {
    font-size: 0.92rem;
    color: var(--text-secondary);
}

.real-costs-footer-total strong {
    color: var(--sidebar-green-dark);
    font-size: 1rem;
}

/* ===== Auto Refund Detector Modal ===== */
.auto-refund-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.modal-dialog--auto-refund {
    background: var(--card-bg, #fff);
    border-radius: var(--radius-card, 10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    width: 100%;
    max-width: 500px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-dialog--auto-refund .modal-header {
    background: var(--sidebar-green, #2e7d5e);
    color: #fff;
    padding: 14px 20px;
}

.modal-dialog--auto-refund .modal-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.modal-dialog--auto-refund .modal-body {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ard-description {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.ard-amount-note {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin: 0;
}

.ard-loading {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
    text-align: center;
    padding: 8px 0;
}

.ard-no-match {
    font-size: 0.88rem;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 8px 12px;
    margin: 0;
}

/* Single row of equal-width, light-grey buttons */
.ard-actions {
    display: flex;
    gap: 8px;
    border-top: 1px solid #e5e7eb;
    padding-top: 14px;
    margin-top: 2px;
}

.btn-ard {
    flex: 1;
    padding: 9px 12px;
    font-size: 0.88rem;
    font-family: inherit;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    border: 1.5px solid #d1d5db;
    background: #f3f4f6;
    color: #374151;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.btn-ard:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.btn-ard--primary {
    background: var(--sidebar-green, #2e7d5e);
    border-color: var(--sidebar-green, #2e7d5e);
    color: #fff;
}

.btn-ard--primary:hover {
    background: var(--sidebar-green-dark, #256b4f);
    border-color: var(--sidebar-green-dark, #256b4f);
}

.btn-ard:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Match list */
.ard-matches {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
}

.ard-match-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 7px;
}

.ard-match-info {
    font-size: 0.88rem;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
}

.ard-match-info strong {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ard-match-info span {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

/* "Confirm Refund" button inside match rows — same style as btn-ard */
.btn-ard-confirm {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    border: 1.5px solid var(--sidebar-green, #2e7d5e);
    background: var(--sidebar-green, #2e7d5e);
    color: #fff;
    white-space: nowrap;
    transition: background 0.15s;
}

.btn-ard-confirm:hover {
    background: var(--sidebar-green-dark, #256b4f);
}

.btn-ard-confirm:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* keep old alias so nothing breaks */
.btn-ard-small {
    padding: 8px 14px;
    font-size: 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ===== Help page ===== */
.help-page {
    max-width: 780px;
    padding: 20px 22px;
}

.help-getting-started {
    margin-bottom: 22px;
    padding: 18px 20px;
    border-radius: var(--radius-card);
    border: 1.5px solid rgba(49, 180, 133, 0.45);
    background: linear-gradient(135deg, rgba(49, 180, 133, 0.12) 0%, rgba(49, 180, 133, 0.04) 100%);
}

.help-getting-started h2 {
    margin: 0 0 10px;
    font-size: 1.45rem;
    font-weight: 700;
    color: #1f7a59;
}

.help-getting-started p {
    margin: 0 0 12px;
    font-size: 1.02rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.help-getting-started .help-items li {
    font-size: 1.02rem;
}

.help-group + .help-group {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border-light);
}

.help-group h2 {
    margin: 0 0 8px;
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--sidebar-green-dark);
}

.help-items {
    margin: 0;
    padding: 0;
    list-style: none;
}

.help-items li {
    margin: 0 0 6px;
    font-size: 1.10rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

.help-items li:last-child {
    margin-bottom: 0;
}

.help-items strong {
    color: var(--text-dark);
    font-weight: 700;
}

/* Page header help icon + hover popover */
.page-help-wrap {
    position: relative;
    flex-shrink: 0;
}

.page-help-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1.5px solid var(--sidebar-green);
    border-radius: 6px;
    background: #fff;
    color: var(--sidebar-green);
    cursor: help;
    font-family: inherit;
    transition: background 0.15s, box-shadow 0.15s;
}

.page-help-trigger svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.page-help-trigger:hover,
.page-help-wrap:focus-within .page-help-trigger {
    background: #edf7f1;
    box-shadow: 0 2px 6px rgba(30, 111, 74, 0.12);
}

.page-help-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 60;
    width: min(380px, calc(100vw - 48px));
    padding: 14px 16px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    background: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.page-help-wrap:hover .page-help-popover,
.page-help-wrap:focus-within .page-help-popover {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.page-help-popover .help-items li {
    font-size: 0.84rem;
    margin-bottom: 5px;
}

.page-help-link {
    display: inline-block;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
    width: 100%;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--sidebar-green);
    text-decoration: none;
}

.page-help-link:hover {
    color: var(--sidebar-green-dark);
    text-decoration: underline;
}
