:root {
    --pb-primary: #d63b1c;
    --pb-primary-dark: #a82c11;
    --pb-accent: #ffc107;
    --pb-bg: #f5f6f8;
    --pb-sidebar-bg: #ffffff;
    --pb-text-muted: #6c757d;
    --pb-success: #198754;
    --pb-danger: #dc3545;
    --pb-card-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
    --pb-sidebar-width: 260px;
}

body {
    background-color: var(--pb-bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.brand-mark {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--pb-primary), var(--pb-accent));
    color: #fff;
    border-radius: 8px;
    font-size: 1.1rem;
}

/* Navbar wordmark logosu */
.brand-logo {
    height: 30px;
    width: auto;
    display: block;
}
@media (max-width: 575.98px) {
    .brand-logo { height: 25px; }
}

/* Giriş ekranı wordmark logosu */
.auth-logo-img {
    height: 52px;
    width: auto;
    max-width: 100%;
}

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--pb-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* === Sidebar === */
.sidebar {
    width: var(--pb-sidebar-width);
    background: var(--pb-sidebar-bg);
    min-height: calc(100vh - 56px);
    position: sticky;
    top: 56px;
    align-self: flex-start;
    flex-shrink: 0;
    transition: transform 0.25s ease;
    z-index: 1040;
}

.sidebar-inner { height: 100%; overflow-y: auto; }

.sidebar-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--pb-text-muted);
    font-weight: 600;
    margin-bottom: 0.5rem;
    padding-left: 0.75rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #212529;
    text-decoration: none;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    margin-bottom: 4px;
    font-weight: 500;
    transition: all 0.15s;
}

.sidebar-link i { font-size: 1.05rem; color: var(--pb-text-muted); }
.sidebar-link:hover { background-color: rgba(214, 59, 28, 0.07); color: var(--pb-primary); }
.sidebar-link:hover i { color: var(--pb-primary); }

.sidebar-link.active {
    background: linear-gradient(135deg, var(--pb-primary), var(--pb-primary-dark));
    color: #fff;
}
.sidebar-link.active i { color: #fff; }

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1039;
}
.sidebar-backdrop.show { display: block; }

/* === Mobile sidebar behavior === */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        top: 56px;
        left: 0;
        height: calc(100vh - 56px);
        transform: translateX(-100%);
        box-shadow: 0 0 30px rgba(0,0,0,0.15);
    }
    .sidebar.show { transform: translateX(0); }
    .main-content { width: 100%; }
}

/* === Stat cards === */
.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 1.25rem;
    border: 1px solid #eef0f3;
    box-shadow: var(--pb-card-shadow);
    height: 100%;
}
.stat-card .stat-label {
    color: var(--pb-text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; margin-top: 0.4rem; }
.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}
.stat-card.income .stat-icon { background: rgba(25,135,84,0.12); color: #198754; }
.stat-card.expense .stat-icon { background: rgba(220,53,69,0.12); color: #dc3545; }
.stat-card.profit .stat-icon { background: rgba(13,110,253,0.12); color: #0d6efd; }
.stat-card.earning .stat-icon { background: rgba(255,193,7,0.18); color: #b07f00; }
.stat-card.neutral .stat-icon { background: rgba(108,117,125,0.12); color: #6c757d; }

.stat-card.profit.negative .stat-value,
.stat-card.earning.negative .stat-value { color: #dc3545; }

/* === Generic card === */
.card-soft {
    background: #fff;
    border: 1px solid #eef0f3;
    border-radius: 14px;
    box-shadow: var(--pb-card-shadow);
}
.card-soft .card-header {
    background: transparent;
    border-bottom: 1px solid #eef0f3;
    padding: 1rem 1.25rem;
    font-weight: 600;
}
.card-soft .card-body { padding: 1.25rem; }

/* Tables */
.table-soft thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--pb-text-muted);
}
.table-soft tbody td { vertical-align: middle; }

/* Auth */
.auth-shell {
    min-height: 100vh;
    background: linear-gradient(135deg, #2a0f08 0%, #d63b1c 60%, #ffc107 130%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 18px;
    padding: 2rem;
    box-shadow: 0 25px 60px rgba(0,0,0,0.25);
}
.auth-logo {
    width: 64px; height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--pb-primary), var(--pb-accent));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

/* Forms */
.form-label { font-weight: 500; font-size: 0.9rem; }
.form-control, .form-select { border-radius: 8px; }
.btn-primary {
    background-color: var(--pb-primary);
    border-color: var(--pb-primary);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--pb-primary-dark);
    border-color: var(--pb-primary-dark);
}
.btn-outline-primary {
    color: var(--pb-primary);
    border-color: var(--pb-primary);
}
.btn-outline-primary:hover {
    background-color: var(--pb-primary);
    border-color: var(--pb-primary);
}

.badge.bg-income { background-color: rgba(25,135,84,0.12) !important; color: #198754; }
.badge.bg-expense { background-color: rgba(220,53,69,0.12) !important; color: #dc3545; }

.money-positive { color: #198754; font-weight: 600; }
.money-negative { color: #dc3545; font-weight: 600; }

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.page-header h1 { font-size: 1.4rem; font-weight: 700; margin: 0; }
.page-header .subtitle { color: var(--pb-text-muted); font-size: 0.9rem; }

/* Share input row */
.share-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

/* Report chart legend */
.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

/* === Dark Theme === */
[data-bs-theme="dark"] {
    --pb-bg: #1a1d20;
    --pb-sidebar-bg: #212529;
    --pb-card-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}
[data-bs-theme="dark"] body { background-color: var(--pb-bg); }
[data-bs-theme="dark"] .stat-card,
[data-bs-theme="dark"] .card-soft {
    background: #2b2f33;
    border-color: #3a3f44;
}
[data-bs-theme="dark"] .card-soft .card-header {
    border-bottom-color: #3a3f44;
    color: #e9ecef;
}
[data-bs-theme="dark"] .sidebar {
    background: var(--pb-sidebar-bg) !important;
    border-right-color: #3a3f44 !important;
}
[data-bs-theme="dark"] .sidebar-link { color: #dee2e6; }
[data-bs-theme="dark"] .sidebar-link i { color: #adb5bd; }
[data-bs-theme="dark"] .sidebar-link:hover { background: rgba(214, 59, 28, 0.15); }
[data-bs-theme="dark"] .table-soft thead th {
    background: #2b2f33;
    border-bottom-color: #3a3f44;
}
[data-bs-theme="dark"] .stat-card .stat-value { color: #e9ecef; }
[data-bs-theme="dark"] .table > :not(caption) > * > * { color: #dee2e6; }
[data-bs-theme="dark"] code, [data-bs-theme="dark"] pre {
    background-color: #2b2f33;
    color: #f8c471;
}
[data-bs-theme="dark"] .alert-warning { background-color: #4a3d1a; color: #ffe69c; border-color: #6a5a30; }
[data-bs-theme="dark"] .alert-success { background-color: #1c3a25; color: #b3e1c1; border-color: #2d5a3a; }
[data-bs-theme="dark"] .alert-info { background-color: #1a3a4a; color: #b3d8e5; border-color: #2d5a6a; }
[data-bs-theme="dark"] .alert-danger { background-color: #4a1c25; color: #f1b8c3; border-color: #6a2d3a; }
[data-bs-theme="dark"] .badge.bg-light { background-color: #3a3f44 !important; color: #dee2e6 !important; }

/* === Help Modal === */
.help-modal .modal-body h6 {
    color: var(--pb-primary);
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}
.help-modal .modal-body h6:first-child { margin-top: 0; }
.help-modal .modal-body ul, .help-modal .modal-body ol {
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
}
.help-modal .modal-body li { margin-bottom: 0.35rem; line-height: 1.55; }
.help-modal .modal-body code,
.help-modal .modal-body kbd {
    padding: 0.15rem 0.35rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 0.875em;
}
[data-bs-theme="dark"] .help-modal .modal-body code,
[data-bs-theme="dark"] .help-modal .modal-body kbd {
    background-color: #2b2f33;
    color: #f8c471;
}
.help-modal .help-key {
    display: inline-block;
    padding: 1px 6px;
    font-size: 0.8em;
    background: #e9ecef;
    border-radius: 3px;
    font-weight: 600;
    color: #495057;
}
.help-tip-btn { white-space: nowrap; }
.help-modal .modal-body .help-tip {
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    padding: 0.5rem 0.75rem;
    margin: 0.75rem 0;
    border-radius: 4px;
    font-size: 0.92em;
}
[data-bs-theme="dark"] .help-modal .modal-body .help-tip {
    background: #4a3d1a; color: #ffe69c;
}

/* === Print styles === */
@media print {
    body { background: #fff !important; }
    .navbar, .sidebar, .sidebar-backdrop, .d-print-none, .page-header .d-flex.gap-2 { display: none !important; }
    .main-content { padding: 0 !important; }
    .card-soft { box-shadow: none !important; border: 1px solid #dee2e6 !important; page-break-inside: avoid; }
    .card-header { background: #f8f9fa !important; }
    .stat-card { box-shadow: none !important; border: 1px solid #dee2e6 !important; }
    canvas { max-height: 250px !important; }
    .pagination { display: none !important; }
    .table { font-size: 0.85rem; }
    a { color: inherit !important; text-decoration: none !important; }
    @page { margin: 1cm; }
}
