/* ══════════════════════════════════════════════
   Peganom Müşteri Yönetimi — Global Styles
   ══════════════════════════════════════════════ */

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #dbeafe;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --sidebar-w: 260px;
    --topbar-h: 60px;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-100);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── LOGIN PAGE ── */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo svg { margin-bottom: 12px; }
.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}
.login-logo p {
    color: var(--gray-500);
    font-size: 14px;
}

.login-error {
    background: var(--danger-light);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

/* ── FORM ── */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--gray-700);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color .2s;
    background: #fff;
    color: var(--gray-800);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-success { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-500);
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: color .2s, background .2s;
}
.btn-icon:hover { color: var(--gray-800); background: var(--gray-100); }

.link { font-size: 13px; font-weight: 600; }

/* ── SIDEBAR ── */
.sidebar {
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--gray-900);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform .3s;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 8px;
    color: var(--gray-400);
    font-size: 14px;
    font-weight: 500;
    transition: all .2s;
    text-decoration: none;
    position: relative;
}
.nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,.06);
    text-decoration: none;
}
.nav-item.active {
    color: #fff;
    background: var(--primary);
}
.nav-badge {
    position: absolute;
    right: 12px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
}
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}
.sidebar-footer .btn-icon { color: var(--gray-400); }
.sidebar-footer .btn-icon:hover { color: #fff; background: rgba(255,255,255,.1); }

/* ── TOPBAR (mobile) ── */
.topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
    z-index: 90;
}
.topbar-title { font-size: 18px; font-weight: 700; }

/* ── MAIN ── */
.main-content {
    margin-left: var(--sidebar-w);
    padding: 32px;
    min-height: 100vh;
}

.page { display: none; }
.page.active { display: block; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h2 {
    font-size: 22px;
    font-weight: 700;
}

/* ── STAT CARDS ── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.teal { background: #ccfbf1; color: #0d9488; }
.stat-icon.pink { background: #fce7f3; color: #db2777; }
.stat-icon.amber { background: #fef3c7; color: #d97706; }

.stat-grid-secondary { margin-top: -8px; }

.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--gray-500); }

/* ── ALERT ── */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}
.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border: 1px solid #fde68a;
}
.alert-danger {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fca5a5;
}

/* ── CARDS ── */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 16px 20px; }

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ── PAGE STATS BAR ── */
.page-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.page-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fff;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    padding: 12px 24px;
    min-width: 120px;
    flex: 1;
}
.page-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.2;
}
.page-stat-label {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}
.page-stat-item.stat-active { border-color: #d1fae5; background: #f0fdf4; }
.page-stat-item.stat-active .page-stat-value { color: #059669; }
.page-stat-item.stat-paused { border-color: #fde68a; background: #fefce8; }
.page-stat-item.stat-paused .page-stat-value { color: #92400e; }
.page-stat-item.stat-passive { border-color: #fecaca; background: #fef2f2; }
.page-stat-item.stat-passive .page-stat-value { color: #dc2626; }
.page-stat-item.stat-overdue { border-color: #fecaca; background: #fef2f2; }
.page-stat-item.stat-overdue .page-stat-value { color: #dc2626; }

/* ── TOOLBAR ── */
.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}
.search-input:focus {
    outline: none;
    border-color: var(--primary);
}
.select-filter {
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    min-width: 140px;
}

/* ── TABLE ── */
.table-wrapper { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 14px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }

/* ── BADGES ── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-active { background: var(--success-light); color: #065f46; }
.badge-paused { background: #fef3c7; color: #92400e; }
.badge-passive { background: var(--gray-200); color: var(--gray-600); }
.badge-pending { background: var(--warning-light); color: #92400e; }
.badge-paid { background: var(--success-light); color: #065f46; }
.badge-overdue { background: var(--danger-light); color: #991b1b; }
.badge-todo { background: var(--gray-200); color: var(--gray-600); }
.badge-in_progress { background: var(--primary-light); color: var(--primary-dark); }
.badge-done { background: var(--success-light); color: #065f46; }
.badge-low { background: var(--gray-200); color: var(--gray-500); }
.badge-normal { background: var(--primary-light); color: var(--primary); }
.badge-high { background: var(--warning-light); color: #92400e; }
.badge-urgent { background: var(--danger-light); color: #991b1b; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-info { background: var(--primary-light); color: var(--primary-dark); }

/* ── TASK BOARD ── */
.task-board {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}
.task-column {
    background: var(--gray-50);
    border-radius: var(--radius);
    min-height: 300px;
}
.task-column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 2px solid;
}
.task-column-header.todo { border-color: var(--gray-400); }
.task-column-header.progress { border-color: var(--primary); }
.task-column-header.done { border-color: var(--success); }
.col-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.todo .col-dot { background: var(--gray-400); }
.progress .col-dot { background: var(--primary); }
.done .col-dot { background: var(--success); }
.col-count {
    font-size: 12px;
    background: var(--gray-200);
    color: var(--gray-600);
    padding: 1px 8px;
    border-radius: 10px;
    margin-left: auto;
}

.task-list {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-card {
    background: #fff;
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: var(--shadow);
    transition: box-shadow .2s;
    border-left: 3px solid transparent;
}
.task-card:hover { box-shadow: var(--shadow-lg); }
.task-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
}
.task-card-delete {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--gray-400);
    border-radius: 4px;
    flex-shrink: 0;
    transition: color .2s, background .2s;
}
.task-card-delete:hover { color: var(--danger); background: rgba(239,68,68,.1); }
.task-card.priority-low { border-left-color: var(--gray-300); }
.task-card.priority-normal { border-left-color: var(--primary); }
.task-card.priority-high { border-left-color: var(--warning); }
.task-card.priority-urgent { border-left-color: var(--danger); }

.task-card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}
.task-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--gray-500);
}
.task-card-customer {
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

/* ── MODAL ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}
.modal-overlay.show { display: flex; }

.modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-sm { max-width: 380px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--gray-100);
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close {
    font-size: 22px;
    color: var(--gray-400);
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
}

.modal-body { padding: 20px 24px; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--gray-100);
}

/* ── Dashboard list items ── */
.dash-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
}
.dash-item:last-child { border-bottom: none; }
.dash-item-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dash-item-title { font-size: 14px; font-weight: 600; }
.dash-item-sub { font-size: 12px; color: var(--gray-500); }

.text-muted { color: var(--gray-400); font-size: 14px; }

/* ── Action buttons in table ── */
.action-group {
    display: flex;
    gap: 4px;
}
.btn-action {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: var(--gray-400);
    transition: all .2s;
}
.btn-action:hover { background: var(--gray-100); color: var(--gray-700); }
.btn-action.edit:hover { color: var(--primary); }
.btn-action.delete:hover { color: var(--danger); }
.btn-action.pay:hover { color: var(--success); }
.btn-action.pause:hover { color: #d97706; }
.btn-action.activate:hover { color: var(--success); }

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-400);
}
.empty-state svg { margin-bottom: 12px; opacity: .5; }
.empty-state p { font-size: 14px; }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .task-board { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .topbar { display: flex; }
    .main-content {
        margin-left: 0;
        padding: 80px 16px 24px;
    }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .form-row { grid-template-columns: 1fr; }
    .data-table th:nth-child(n+4),
    .data-table td:nth-child(n+4) { display: none; }
    .data-table th:last-child,
    .data-table td:last-child { display: table-cell; }
    .cal-day { min-height: 70px; }
    .cal-event { font-size: 10px; }
    .notes-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ── CALENDAR ── */
.calendar-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.calendar-nav h3 {
    min-width: 160px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}
.cal-header {
    background: var(--gray-100);
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-600);
}
.cal-day {
    background: #fff;
    min-height: 100px;
    padding: 6px;
    cursor: pointer;
    transition: background .15s;
}
.cal-day:hover { background: var(--gray-50); }
.cal-day.empty { background: var(--gray-50); cursor: default; }
.cal-day.today { background: #eff6ff; }
.cal-day-num {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--gray-700);
}
.cal-day.today .cal-day-num { color: var(--primary); }
.cal-event {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}
.cal-event:hover { opacity: .85; }
.cal-event small { font-weight: 600; }
.cal-more {
    font-size: 11px;
    color: var(--gray-400);
    text-align: center;
}

/* ── NOTES ── */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.note-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    transition: box-shadow .2s, transform .2s;
}
.note-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.note-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.note-pin { color: var(--warning); }
.note-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 50px;
    background: var(--gray-100);
    color: var(--gray-500);
}
.note-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
    cursor: pointer;
    margin-bottom: 6px;
}
.note-title:hover { color: var(--primary); }
.note-snippet {
    font-size: 13px;
    color: var(--gray-500);
    line-height: 1.5;
    margin-bottom: 12px;
}
.note-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.note-date {
    font-size: 12px;
    color: var(--gray-400);
}
.note-has-img {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--gray-400);
    margin-bottom: 8px;
}

/* ── NOTE EDITOR ── */
.note-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    border: 1px solid var(--gray-200);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--gray-50);
}
.note-editor-toolbar button, .note-editor-toolbar .toolbar-btn {
    background: none;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 4px;
    color: var(--gray-600);
    font-size: 13px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.note-editor-toolbar button:hover, .note-editor-toolbar .toolbar-btn:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}
.toolbar-sep {
    width: 1px;
    height: 18px;
    background: var(--gray-200);
    margin: 0 4px;
}
.note-editor-content {
    border: 1px solid var(--gray-200);
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 12px 14px;
    min-height: 180px;
    max-height: 450px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-700);
    outline: none;
    background: #fff;
}
.note-editor-content:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}
.note-editor-content img {
    max-width: 100%;
    border-radius: 6px;
    margin: 8px 0;
}
.note-editor-content ul, .note-editor-content ol {
    padding-left: 20px;
    margin: 4px 0;
}
.note-editor-content b, .note-editor-content strong { font-weight: 600; }
.note-editor-content i, .note-editor-content em { font-style: italic; }
.note-editor-content u { text-decoration: underline; }

/* ── SETTINGS ── */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}

/* ── FILE UPLOAD ZONES ── */
.file-upload-zones {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.file-upload-zone {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px dashed var(--gray-200);
    border-radius: 8px;
    background: var(--gray-50);
    overflow: hidden;
}
.fuz-icon { color: var(--gray-400); flex-shrink: 0; }
.fuz-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow: hidden; }
.fuz-info strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fuz-current { font-size: 12px; color: var(--success); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fuz-btn { flex-shrink: 0; }
.fuz-del { flex-shrink: 0; }
.file-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; margin-right: 8px; }

/* ── COLOR PICKER ── */
.color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.color-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color .15s, transform .15s;
}
.color-dot:hover { transform: scale(1.15); }
.color-dot.active { border-color: var(--gray-700); }

/* ── CHECKBOX LABEL ── */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--gray-600);
}
.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* ══════════════════════════════════════════════
   v4: Detail Tabs, Expense Categories, Chart
   ══════════════════════════════════════════════ */

/* ── Detail Tabs ── */
.detail-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 16px;
}
.detail-tab {
    padding: 10px 20px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .15s, border-color .15s;
}
.detail-tab:hover { color: var(--gray-700); }
.detail-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.detail-panel { display: none; }
.detail-panel.active { display: block; }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.detail-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .3px;
}
.detail-value {
    font-size: 14px;
    color: var(--gray-800);
}
.detail-value a {
    color: var(--primary);
    text-decoration: none;
}
.detail-value a:hover {
    text-decoration: underline;
}

/* ── Expense Category Badges ── */
.expense-cat {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.cat-office { background: #dbeafe; color: #1e40af; }
.cat-tax { background: #fce7f3; color: #9d174d; }
.cat-software { background: #e0e7ff; color: #3730a3; }
.cat-ads { background: #ffedd5; color: #c2410c; }
.cat-salary { background: #dcfce7; color: #166534; }
.cat-hosting { background: #f3e8ff; color: #6b21a8; }
.cat-freelance { background: #fef9c3; color: #854d0e; }
.cat-other { background: var(--gray-100); color: var(--gray-600); }

/* ── Chart Container ── */
#incomeExpenseChart {
    width: 100% !important;
    max-height: 280px;
}

/* ── Button sm ── */
.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 6px;
}

/* ── Modal wider for detail ── */
@media (min-width: 768px) {
    .modal-body:has(.detail-tabs) {
        min-width: 560px;
    }
}

/* ══════════════════════════════════════════════
   Notification System
   ══════════════════════════════════════════════ */
.notification-wrapper {
    position: relative;
}
.notification-bell {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s;
}
.notification-bell:hover {
    background: var(--primary-light);
    color: var(--primary);
}
.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}
.notification-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    max-height: 400px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,.15), 0 2px 10px rgba(0,0,0,.08);
    z-index: 100;
    overflow: hidden;
}
.notification-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 14px;
}
.notification-list {
    max-height: 340px;
    overflow-y: auto;
}
.notification-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background .15s;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
}
.notification-item:last-child { border-bottom: none; }
.notification-item:hover { background: var(--gray-50); }
.notification-icon { font-size: 16px; flex-shrink: 0; }
.notification-text { flex: 1; }
.notification-danger { border-left: 3px solid var(--danger); }
.notification-warning { border-left: 3px solid var(--warning); }
.notification-info { border-left: 3px solid var(--primary); }

/* ══════════════════════════════════════════════
   Dashboard Design Improvements
   ══════════════════════════════════════════════ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Stat card hover effect */
.stat-card {
    transition: transform .2s, box-shadow .2s;
    border: 1px solid var(--gray-100);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Dashboard cards improved */
.dashboard-grid .card {
    border: 1px solid var(--gray-100);
    transition: box-shadow .2s;
}
.dashboard-grid .card:hover {
    box-shadow: var(--shadow-lg);
}
.card-header h3 {
    font-size: 15px;
    font-weight: 600;
}

/* Sidebar gradient */
.sidebar {
    background: linear-gradient(180deg, var(--gray-900) 0%, #1a2332 100%);
}

/* Sidebar brand area */
.sidebar-header {
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* Sidebar active item highlight */
.nav-item.active {
    background: rgba(59, 130, 246, 0.15);
    border-left: 3px solid var(--primary);
}

@media (max-width: 480px) {
    .notification-panel { width: 290px; right: -10px; }
}
