/* LexOffice — RTL Arabic Legal Office Management */
/* Manasety Brand: #0C2461 · #1849A9 · #078FD2 · #F2F2F2 */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');

/* ─── Design Tokens ──────────────────────── */
:root {
    --primary: #1849A9;
    --primary-dark: #0C2461;
    --primary-light: #e0ecf8;
    --primary-glow: rgba(24, 73, 169, 0.25);
    --accent: #078FD2;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #078FD2;

    --sidebar-width: 260px;
    --sidebar-bg: #0C2461;
    --sidebar-bg2: #1849A9;
    --sidebar-text: rgba(255,255,255,0.65);
    --sidebar-active-bg: rgba(7, 143, 210, 0.15);
    --sidebar-active-text: #fff;

    --bg: #071333;
    --surface: #0a1d4a;
    --surface-hover: #132d6b;
    --border: rgba(24, 73, 169, 0.15);
    --text-primary: #e8f0ff;
    --text-muted: #8ba3c9;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.12), 0 2px 4px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.2), 0 4px 12px rgba(0,0,0,0.1);

    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;

    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Light Mode ─────────────────────────── */
[data-bs-theme="light"] {
    --bg: #F2F2F2;
    --surface: #ffffff;
    --surface-hover: #f7f9fc;
    --border: rgba(12, 36, 97, 0.08);
    --text-primary: #0C2461;
    --text-muted: #64748b;
    --shadow-sm: 0 1px 3px rgba(12, 36, 97, 0.06), 0 1px 2px rgba(12, 36, 97, 0.04);
    --shadow-md: 0 4px 16px rgba(12, 36, 97, 0.08), 0 2px 6px rgba(12, 36, 97, 0.04);
    --shadow-lg: 0 12px 40px rgba(12, 36, 97, 0.12), 0 4px 12px rgba(12, 36, 97, 0.06);
}

[data-bs-theme="light"] .card { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-sm); }
[data-bs-theme="light"] .card-header { background: linear-gradient(180deg, #f8fafd 0%, #fff 100%); border-color: var(--border); color: var(--text-primary); }
[data-bs-theme="light"] .list-group-item { background: transparent; border-color: var(--border); color: var(--text-primary); }
[data-bs-theme="light"] .form-control,
[data-bs-theme="light"] .form-select { background: #fff; border-color: rgba(12,36,97,0.12); color: var(--text-primary) !important; }
[data-bs-theme="light"] .form-control:focus,
[data-bs-theme="light"] .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(7,143,210,0.12); }
[data-bs-theme="light"] .form-control::placeholder { color: #a0a8c0; }
[data-bs-theme="light"] .table { --bs-table-color: var(--text-primary); --bs-table-bg: transparent; --bs-table-border-color: var(--border); --bs-table-hover-bg: rgba(7,143,210,0.03); color: var(--text-primary); }
[data-bs-theme="light"] .table th { color: var(--text-muted); }
[data-bs-theme="light"] .modal-content { background: #fff; color: var(--text-primary); border-color: var(--border); box-shadow: var(--shadow-lg); }
[data-bs-theme="light"] .modal-header, [data-bs-theme="light"] .modal-footer { border-color: var(--border); }
[data-bs-theme="light"] .dropdown-menu { background: #fff; border-color: var(--border); box-shadow: var(--shadow-md); }
[data-bs-theme="light"] .dropdown-item { color: var(--text-primary); }
[data-bs-theme="light"] .dropdown-item:hover { background: rgba(7,143,210,0.05); color: var(--primary); }
[data-bs-theme="light"] .text-muted { color: var(--text-muted) !important; }
[data-bs-theme="light"] .bg-light { background: var(--bg) !important; }
[data-bs-theme="light"] .bg-white { background: var(--surface) !important; }
[data-bs-theme="light"] .border { border-color: var(--border) !important; }
[data-bs-theme="light"] .page-header h3 { color: var(--text-primary); }
[data-bs-theme="light"] .empty-state { color: rgba(12,36,97,0.35); }
[data-bs-theme="light"] .empty-state i { color: var(--accent); opacity: 0.4; }
[data-bs-theme="light"] input:-webkit-autofill { -webkit-box-shadow: 0 0 0 1000px #fff inset !important; -webkit-text-fill-color: var(--text-primary) !important; }

/* Dashboard light mode */
[data-bs-theme="light"] .dash-card { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-sm); }
[data-bs-theme="light"] .dash-card:hover { box-shadow: var(--shadow-md); }
[data-bs-theme="light"] .dash-card-head { border-color: var(--border); background: linear-gradient(180deg, #f8fafd 0%, #fff 100%); }
[data-bs-theme="light"] .dash-card-head .head-label { color: var(--text-primary); }
[data-bs-theme="light"] .dash-card-head .head-label i { color: var(--accent); }
[data-bs-theme="light"] .dash-list-item { border-color: rgba(12,36,97,0.06); color: var(--text-primary); }
[data-bs-theme="light"] .dash-list-item:hover { background: rgba(7,143,210,0.04); }
[data-bs-theme="light"] .item-main { color: var(--text-primary); }
[data-bs-theme="light"] .item-sub { color: var(--text-muted); }
[data-bs-theme="light"] .dash-empty { color: rgba(12,36,97,0.3); }
[data-bs-theme="light"] .fin-divider { background: rgba(12,36,97,0.1); }
[data-bs-theme="light"] .fin-label { color: var(--text-muted); }
[data-bs-theme="light"] .ds-val { color: var(--text-primary); }
[data-bs-theme="light"] .ds-lbl { color: var(--text-muted); }
[data-bs-theme="light"] .dash-stat { background: var(--bg); border-color: var(--border); }
[data-bs-theme="light"] .dash-stat:hover { box-shadow: var(--shadow-md); }
[data-bs-theme="light"] .dash-stat-primary { --bg: rgba(7,143,210,0.06); }
[data-bs-theme="light"] .dash-stat-success { --bg: rgba(16,185,129,0.06); }
[data-bs-theme="light"] .dash-stat-warning { --bg: rgba(245,158,11,0.06); }
[data-bs-theme="light"] .dash-stat-danger  { --bg: rgba(239,68,68,0.06); }
[data-bs-theme="light"] .fin-row { background: transparent; }
[data-bs-theme="light"] .fin-net { border-color: var(--border); }

/* Notification light mode */
[data-bs-theme="light"] .notif-item { color: var(--text-primary); }
[data-bs-theme="light"] .notif-item:hover { background: rgba(7,143,210,0.04); color: var(--text-primary); }
[data-bs-theme="light"] .notif-unread { background: rgba(7,143,210,0.04); }
[data-bs-theme="light"] .notif-open-btn { background: rgba(7,143,210,0.08); color: var(--accent); }

/* ─── Base ───────────────────────────────── */
body {
    font-family: 'Tajawal', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── Top Navbar ─────────────────────────── */
.top-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    min-height: 56px;
}

.topnav-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topnav-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.topnav-title h5 {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
}

.topnav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topnav-left {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.topnav-toggle {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 0.3rem;
}

.topnav-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    text-decoration: none;
}
.topnav-icon-btn:hover {
    background: rgba(7,143,210,0.08);
    border-color: var(--accent);
    color: var(--accent);
}

.topnav-notif-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    min-width: 18px;
    height: 18px;
    border-radius: 100px;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(239,68,68,0.4);
    animation: notifPulse 2s ease-in-out infinite;
}

@keyframes notifPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.topnav-user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.6rem 0.3rem 0.3rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}
.topnav-user-btn::after {
    font-size: 0.6rem;
    vertical-align: middle;
    margin-right: 0.15rem;
}
.topnav-user-btn:hover {
    background: rgba(7,143,210,0.06);
    border-color: rgba(7,143,210,0.2);
}

.topnav-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    object-fit: cover;
}

.topnav-avatar-placeholder {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.topnav-username {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Light mode navbar */
[data-bs-theme="light"] .top-navbar { background: rgba(255,255,255,0.85); backdrop-filter: blur(12px); }
[data-bs-theme="light"] .topnav-icon-btn { background: transparent; }
[data-bs-theme="light"] .topnav-icon-btn:hover { background: rgba(7,143,210,0.06); }
[data-bs-theme="light"] .topnav-user-btn { color: var(--text-primary); }

/* ─── Bootstrap Overrides ────────────────── */
.modal-content { background: var(--surface); border: 1px solid var(--border); color: var(--text-primary); border-radius: var(--radius); }
.modal-header, .modal-footer { border-color: var(--border); }
.dropdown-menu { background: var(--surface); border: 1px solid var(--border); color: var(--text-primary); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); padding: 0.35rem; }
.dropdown-item { color: var(--text-primary); border-radius: 6px; padding: 0.45rem 0.8rem; font-size: 0.85rem; transition: all var(--transition); }
.dropdown-item:hover { background: var(--surface-hover); }
.alert { border-radius: var(--radius-sm); }
.text-muted { color: var(--text-muted) !important; }
.bg-light { background: var(--surface) !important; }
.bg-white { background: var(--surface) !important; }
.border { border-color: var(--border) !important; }
.form-control, .form-select { color: var(--text-primary) !important; }
.form-control::placeholder { color: var(--text-muted); opacity: 0.6; }
input:-webkit-autofill, input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--surface) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
}

/* ─── Sidebar ────────────────────────────── */
.sidebar, #sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #081b4b 0%, #0C2461 35%, #143575 100%);
    color: var(--sidebar-text);
    z-index: 1040;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 24px rgba(0,0,0,0.25);
    border-left: 1px solid rgba(7,143,210,0.1);
}

#sidebar::-webkit-scrollbar { width: 3px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(7,143,210,0.2); border-radius: 3px; }

.sidebar .nav-item { margin: 2px 10px; }

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.9rem;
    color: var(--sidebar-text);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition);
    position: relative;
}

.sidebar .nav-link i {
    font-size: 1rem;
    width: 22px;
    text-align: center;
    opacity: 0.6;
    transition: all var(--transition);
}

.sidebar .nav-link:hover {
    background: rgba(7,143,210,0.1);
    color: #fff;
}
.sidebar .nav-link:hover i { opacity: 1; color: var(--accent); }

.sidebar .nav-link.active,
.sidebar .nav-link.active.bg-primary {
    background: linear-gradient(135deg, rgba(7,143,210,0.18) 0%, rgba(24,73,169,0.12) 100%) !important;
    color: #fff !important;
    font-weight: 700;
    border-right: 3px solid var(--accent);
    box-shadow: 0 2px 8px rgba(7,143,210,0.15);
}
.sidebar .nav-link.active i { opacity: 1; color: var(--accent); }

.sidebar small.text-muted {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.2) !important;
    padding: 0.6rem 0.9rem 0.3rem;
    font-weight: 700;
    display: block;
}

#sidebar .nav-link .badge {
    font-size: 0.65rem;
    padding: 0.15em 0.5em;
    font-weight: 700;
}

/* ─── Main Content ───────────────────────── */
.main-content {
    margin-right: var(--sidebar-width);
    min-height: 100vh;
}

/* ─── Legacy Top Bar ─────────────────────── */
.bg-white.border-bottom {
    background: var(--surface) !important;
    border-color: var(--border) !important;
}
.bg-white.border-bottom h5 {
    color: var(--text-primary);
    font-weight: 700;
}

/* ─── Page ───────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.page-header h3 {
    margin: 0;
    font-weight: 800;
    color: var(--text-primary);
    font-size: 1.35rem;
    letter-spacing: -0.3px;
}
.page-header small { color: var(--text-muted); }

/* ─── Cards ──────────────────────────────── */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--surface);
    color: var(--text-primary);
    transition: all var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    padding: 0.9rem 1.2rem;
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* ─── Tables ─────────────────────────────── */
.table {
    --bs-table-hover-bg: rgba(7, 143, 210, 0.04);
    --bs-table-color: var(--text-primary);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--border);
    color: var(--text-primary);
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    padding: 0.8rem 0.9rem;
}

.table td {
    vertical-align: middle;
    font-size: 0.88rem;
    padding: 0.75rem 0.9rem;
    border-color: var(--border);
}
.table tbody tr:last-child td { border-bottom: none; }

.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--surface-hover); }

/* ─── Badges ─────────────────────────────── */
.badge {
    font-weight: 600;
    padding: 0.3em 0.75em;
    border-radius: 6px;
    font-size: 0.73rem;
    letter-spacing: 0.2px;
}

/* ─── Forms ──────────────────────────────── */
.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    padding: 0.55rem 0.9rem;
    font-size: 0.88rem;
    transition: all var(--transition);
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(7,143,210,0.15);
    outline: 2px solid transparent;
}

/* ─── Buttons ────────────────────────────── */
.btn {
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    font-size: 0.85rem;
    padding: 0.5rem 1.1rem;
    letter-spacing: 0.1px;
}

.btn-primary {
    background: linear-gradient(135deg, #1849A9 0%, #0C2461 100%);
    border: none;
    box-shadow: 0 2px 8px rgba(12,36,97,0.25);
    color: #fff;
}
.btn-primary:hover {
    background: linear-gradient(135deg, #1d54be 0%, #0e2a6e 100%);
    box-shadow: 0 4px 16px rgba(12,36,97,0.35);
    color: #fff;
    transform: translateY(-1px);
}

.btn-outline-primary {
    border: 1.5px solid var(--primary);
    color: var(--primary);
    background: transparent;
}
.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    transform: translateY(-1px);
}

.btn-outline-secondary {
    border: 1.5px solid var(--border);
    color: var(--text-muted);
}
.btn-outline-secondary:hover {
    background: rgba(7,143,210,0.06);
    border-color: var(--accent);
    color: var(--accent);
}

/* ─── Auth Pages ─────────────────────────── */
.auth-card {
    max-width: 440px;
    margin: 0 auto;
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

/* ─── Avatar ─────────────────────────────── */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(7,143,210,0.25);
}

/* ─── Priority ───────────────────────────── */
.priority-critical { color: var(--danger); }
.priority-high { color: var(--warning); }
.priority-medium { color: var(--accent); }
.priority-low { color: var(--secondary); }

/* ─── Status Dots ────────────────────────── */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 6px;
}
.status-active { background: var(--success); box-shadow: 0 0 0 3px rgba(16,185,129,0.2); }
.status-pending { background: var(--warning); box-shadow: 0 0 0 3px rgba(245,158,11,0.2); }
.status-closed { background: var(--secondary); }

/* ─── Flash Messages ─────────────────────── */
.flash-message {
    animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Empty States ───────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.3;
    color: var(--accent);
}
.empty-state p {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

/* ─── List Group ─────────────────────────── */
.list-group-item {
    border-color: var(--border);
    padding: 0.8rem 1.2rem;
    background: transparent;
    color: var(--text-primary);
    transition: background var(--transition);
}
.list-group-item:first-child { border-top: none; }
.list-group-item:last-child { border-bottom: none; }

/* ─── Progress ───────────────────────────── */
.progress {
    border-radius: 100px;
    background: var(--primary-light);
    height: 6px;
    overflow: hidden;
}
.progress-bar {
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 100px;
}

/* ─── Pagination ─────────────────────────── */
.page-link {
    border-color: var(--border);
    color: var(--primary);
    border-radius: 8px !important;
    margin: 0 2px;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all var(--transition);
}
.page-link:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}
.page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(7,143,210,0.3);
}

/* ─── Utilities ──────────────────────────── */
.text-primary { color: var(--primary) !important; }
.bg-primary { background: var(--primary) !important; }

hr {
    border-color: var(--border);
    opacity: 1;
}

/* ─── File Name Truncation ───────────────── */
.filename-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

/* ─── Notifications ──────────────────────── */
.notif-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-md) 1.2rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition);
    cursor: pointer;
}
.notif-item:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}
.notif-item:last-child { border-bottom: none; }

.notif-unread {
    background: rgba(7, 143, 210, 0.04);
    border-right: 3px solid var(--accent);
}

.notif-content {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    flex: 1;
    min-width: 0;
}

.notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    margin-top: 0.45rem;
    box-shadow: 0 0 0 3px rgba(7,143,210,0.15);
}

.notif-text { flex: 1; min-width: 0; }

.notif-title {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
    line-height: 1.4;
}
.notif-unread .notif-title { font-weight: 700; }

.notif-body {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
    line-height: 1.4;
}

.notif-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.6;
}

.notif-action { flex-shrink: 0; }

.notif-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.3rem 0.7rem;
    border-radius: 8px;
    background: rgba(7, 143, 210, 0.1);
    color: var(--accent);
    font-size: 0.73rem;
    font-weight: 600;
    transition: all var(--transition);
}
.notif-item:hover .notif-open-btn {
    background: rgba(7, 143, 210, 0.18);
}

/* ─── Responsive ─────────────────────────── */
@media (max-width: 991.98px) {
    .sidebar, #sidebar {
        transform: translateX(100%);
    }
    .sidebar.show, #sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-right: 0;
    }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1035;
        display: none;
        backdrop-filter: blur(4px);
    }
    .sidebar-overlay.show {
        display: block;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 767.98px) {
    .p-4 { padding: 1rem !important; }
    .table th, .table td { padding: 0.5rem 0.6rem; font-size: 0.82rem; }
    .btn-sm { font-size: 0.78rem; padding: 0.3rem 0.6rem; }
}

/* ─── Touch Target Sizes ────────────────── */
.page-header .btn,
.card-header .btn:not(.btn-sm),
form > .btn {
    min-height: 44px;
}
.page-link {
    min-height: 36px;
    min-width: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ─── Dashboard Stat Grid ───────────────── */
.dash-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 991.98px) {
    .dash-stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575.98px) {
    .dash-stat-grid { grid-template-columns: 1fr; }
}

/* ─── Dashboard Stat Cards ────────────── */
.dash-stat {
    position: relative;
    background: var(--bg);
    border: 1px solid color-mix(in srgb, var(--clr) 25%, transparent);
    border-radius: 16px;
    padding: 1.3rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}
.dash-stat:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.15), 0 0 0 1px color-mix(in srgb, var(--clr) 35%, transparent);
}
.dash-stat::after {
    content: '';
    position: absolute;
    top: -30px; right: -30px;
    width: 100px; height: 100px;
    border-radius: 50%;
    background: var(--clr);
    opacity: 0.06;
}
.dash-stat::before {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--clr), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}
.dash-stat:hover::before { opacity: 0.6; }

.ds-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    background: var(--clr);
    display: grid; place-items: center;
    font-size: 1.35rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--clr) 40%, transparent);
}
.ds-val { font-size: 1.7rem; font-weight: 900; line-height: 1.1; color: #fff; }
.ds-lbl { font-size: 0.75rem; color: rgba(255,255,255,0.55); font-weight: 500; margin-top: 0.15rem; }
.ds-link { position: absolute; inset: 0; }

/* ── Stat card color variants ── */
.dash-stat-primary   { --clr: var(--accent);   --bg: rgba(7,143,210,0.1); }
.dash-stat-success   { --clr: var(--success);  --bg: rgba(16,185,129,0.1); }
.dash-stat-warning   { --clr: var(--warning);  --bg: rgba(245,158,11,0.1); }
.dash-stat-danger    { --clr: var(--danger);    --bg: rgba(239,68,68,0.1); }

/* ── Dashboard Cards ── */
.dash-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(12,36,97,0.12);
    border-radius: 16px;
    overflow: hidden;
    height: 100%;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.dash-card:hover {
    border-color: rgba(7,143,210,0.2);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.dash-card-head {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid rgba(12,36,97,0.1);
    display: flex; align-items: center; justify-content: space-between;
    font-size: 0.88rem; font-weight: 700;
}
.dash-card-head .head-label { display:flex;align-items:center;gap:0.5rem; color: rgba(255,255,255,0.85); }
.dash-card-head .head-label i { color: var(--accent); }
.dash-badge {
    font-size: 0.72rem; font-weight: 700;
    padding: 0.2rem 0.65rem;
    border-radius: 100px;
}
.badge-primary { background: rgba(7,143,210,0.15); color: var(--accent); }
.badge-success { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-warning { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-danger  { background: rgba(239,68,68,0.15);  color: #f87171; }

/* ── Dashboard List Items ── */
.dash-list { padding: 0; margin: 0; list-style: none; }
.dash-list-item {
    padding: 0.85rem 1.2rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.75rem;
    transition: all var(--transition);
    font-size: 0.85rem;
}
.dash-list-item:last-child { border-bottom: none; }
.dash-list-item:hover { background: rgba(7,143,210,0.05); }
.item-main { font-weight: 600; color: rgba(255,255,255,0.9); margin-bottom: 0.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.item-sub  { font-size: 0.75rem; color: rgba(255,255,255,0.4); }
.item-badge {
    font-size: 0.72rem; font-weight: 700;
    padding: 0.2rem 0.7rem;
    border-radius: 100px;
    white-space: nowrap;
    flex-shrink: 0;
}
.ib-time    { background: rgba(7,143,210,0.15); color: #7abfe6; }
.ib-late    { background: rgba(239,68,68,0.12); color: #f87171; }
.ib-urgent  { background: rgba(245,158,11,0.12); color: #fbbf24; }
.ib-date    { background: rgba(16,185,129,0.12); color: #34d399; }
.ib-expired { background: rgba(239,68,68,0.15); color: #f87171; }
.ib-expiring { background: rgba(245,158,11,0.12); color: #fbbf24; }

/* ── Dashboard Empty State ── */
.dash-empty {
    padding: 2.5rem 1rem;
    text-align: center;
    color: rgba(255,255,255,0.2);
}
.dash-empty i { font-size: 2rem; display: block; margin-bottom: 0.5rem; color: var(--accent); opacity: 0.3; }
.dash-empty p { font-size: 0.82rem; margin: 0; }

/* ── Financial Summary ── */
.fin-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 1.2rem; }
.fin-item { text-align: center; flex: 1; }
.fin-amount { font-size: 1.3rem; font-weight: 800; line-height: 1.2; }
.fin-amount-income { color: var(--success); }
.fin-amount-expense { color: #f87171; }
.fin-amount-profit { color: var(--success); }
.fin-amount-loss { color: #f87171; }
.fin-label { font-size: 0.72rem; color: rgba(255,255,255,0.45); margin-top: 0.2rem; }
.fin-divider { width: 1px; height: 50px; background: rgba(255,255,255,0.08); }
.fin-net { border-top: 1px solid rgba(255,255,255,0.06); }

/* ── Dashboard Utility Classes ── */
.dash-view-all {
    font-size: 0.75rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: all var(--transition);
}
.dash-view-all:hover { text-decoration: underline; opacity: 0.8; }
.dash-icon-danger { color: #f87171; }
.dash-notif-time {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.3);
    white-space: nowrap;
}

/* ── Dashboard Grid ── */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media(max-width: 768px) {
    .dash-grid { grid-template-columns: 1fr; }
    .dash-stat { padding: 1rem; gap: 0.75rem; border-radius: 12px; }
    .ds-icon { width: 42px; height: 42px; font-size: 1.1rem; border-radius: 10px; }
    .ds-val { font-size: 1.35rem; }
    .ds-lbl { font-size: 0.7rem; }
    .fin-row { flex-wrap: wrap; gap: 0.5rem; padding: 0.75rem 1rem; }
    .fin-divider { display: none; }
    .fin-item { min-width: 80px; }
    .fin-amount { font-size: 1.1rem; }
    .item-main { max-width: 160px; font-size: 0.82rem; }
    .item-sub { font-size: 0.7rem; }
    .dash-card-head { font-size: 0.82rem; padding: 0.75rem 1rem; }
}

/* ─── Print ──────────────────────────────── */
@media print {
    .sidebar, #sidebar { display: none !important; }
    .main-content { margin: 0 !important; }
}
