:root {
    --bg-deep: #060b14;
    --bg-main: #0a1120;
    --bg-card: #0f1a2e;
    --bg-card-hover: #142240;
    --border: #1a2744;
    --border-light: #243352;
    --text-primary: #e8ecf4;
    --text-secondary: #7a8ba8;
    --text-muted: #4a5a78;
    --accent: #00d4aa;
    --accent-dim: rgba(0,212,170,0.15);
    --accent-glow: rgba(0,212,170,0.3);
    --warning: #f0a030;
    --danger: #ef4444;
    --info: #38bdf8;
    --success: #22c55e;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    font-size: 14px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: #00e6b8; }

/* Mesh background */
.bg-mesh {
    position: fixed; inset: 0; z-index: 0;
    background:
        radial-gradient(ellipse 600px 400px at 10% 20%, rgba(0,212,170,0.06) 0%, transparent 70%),
        radial-gradient(ellipse 500px 500px at 90% 80%, rgba(56,189,248,0.04) 0%, transparent 70%),
        radial-gradient(ellipse 400px 300px at 50% 50%, rgba(240,160,48,0.03) 0%, transparent 70%);
    animation: meshFloat 20s ease-in-out infinite;
    pointer-events: none;
}
@keyframes meshFloat { 0%,100% { opacity: 1; } 50% { opacity: 0.7; } }

/* ===== Sidebar ===== */
.sidebar {
    position: fixed; right: 0; top: 0; width: 260px; height: 100vh;
    background: linear-gradient(180deg, #0d1526 0%, #0a1120 100%);
    border-left: 1px solid var(--border); z-index: 50;
    display: flex; flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
}
.sidebar-logo {
    padding: 24px 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}
.logo-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--accent), var(--info));
    border-radius: 12px; display: flex; align-items: center;
    justify-content: center; font-size: 18px; color: #060b14;
    font-weight: 800; box-shadow: 0 4px 20px var(--accent-glow);
}
.nav-section { padding: 16px 12px; flex: 1; overflow-y: auto; }
.nav-label {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1.5px; color: var(--text-muted);
    padding: 8px 12px; margin-top: 8px;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-radius: 10px;
    color: var(--text-secondary); text-decoration: none;
    cursor: pointer; transition: all 0.25s ease;
    font-size: 14px; font-weight: 500;
    position: relative;
}
.nav-item:hover { background: var(--accent-dim); color: var(--text-primary); }
.nav-item.active {
    background: var(--accent-dim); color: var(--accent); font-weight: 600;
}
.nav-item.active::before {
    content: ''; position: absolute; right: -12px; top: 50%;
    transform: translateY(-50%); width: 3px; height: 24px;
    background: var(--accent); border-radius: 3px;
}
.nav-item i { width: 20px; text-align: center; font-size: 15px; }
.nav-badge {
    margin-right: auto; margin-left: 0;
    background: var(--danger); color: #fff;
    font-size: 10px; padding: 2px 7px; border-radius: 10px; font-weight: 700;
}

/* ===== Main Content ===== */
.main-wrapper {
    margin-right: 260px;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
}

/* ===== Top Header ===== */
.top-header {
    padding: 16px 32px; display: flex; align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: rgba(10,17,32,0.8); backdrop-filter: blur(20px);
    position: sticky; top: 0; z-index: 40;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 8px; }
.search-box {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 10px; padding: 8px 16px; width: 320px;
    transition: border-color 0.3s;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.search-box input {
    background: none; border: none; outline: none;
    color: var(--text-primary); font-family: 'Cairo'; font-size: 13px; width: 100%;
}
.search-box input::placeholder { color: var(--text-muted); }
.header-btn {
    width: 38px; height: 38px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--bg-card);
    color: var(--text-secondary); display: inline-flex; align-items: center;
    justify-content: center; cursor: pointer; transition: all 0.25s;
}
.header-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.user-avatar {
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--info));
    display: flex; align-items: center; justify-content: center;
    color: #060b14; font-weight: 800; font-size: 14px; cursor: pointer;
    gap: 6px; padding: 0 10px; width: auto;
}
.user-name-nav { font-size: 13px; font-weight: 700; white-space: nowrap; }
.user-dropdown { position: relative; }
.user-dropdown .dropdown-menu {
    display: none; position: absolute; top: calc(100% + 8px); left: 0;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; min-width: 180px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4); z-index: 100;
    overflow: hidden;
}
.user-dropdown .dropdown-menu.show { display: block; }
.user-dropdown .dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; font-size: 13px; font-weight: 600;
    color: var(--text-secondary); text-decoration: none;
    transition: all 0.2s;
}
.user-dropdown .dropdown-item:hover {
    background: var(--accent-dim); color: var(--text-primary);
}
.user-dropdown .dropdown-divider {
    height: 1px; background: var(--border); margin: 0;
}

/* Global dropdown (for export menu) */
.dropdown-menu {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; min-width: 180px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4); z-index: 100;
    overflow: hidden;
}
.dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; font-size: 13px; font-weight: 600;
    color: var(--text-secondary); text-decoration: none;
    transition: all 0.2s;
}
.dropdown-item:hover {
    background: var(--accent-dim); color: var(--text-primary);
}
.dropdown-divider {
    height: 1px; background: var(--border); margin: 4px 0;
}

/* ===== Page Content ===== */
.page-content { padding: 28px 32px; flex: 1; }
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.page-title { font-size: 22px; font-weight: 800; }
.page-subtitle { color: var(--text-secondary); font-size: 13px; }
.text-gradient {
    background: linear-gradient(135deg, var(--accent), var(--info));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 16px; transition: border-color 0.3s;
    overflow: hidden;
}
.card:hover { border-color: var(--border-light); }
.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-weight: 700; font-size: 14px;
    display: flex; align-items: center; justify-content: space-between;
    color: #00cca3;
}
.card-body { padding: 18px; }
.card-body.p-0 { padding: 0; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 18px; border-radius: 10px; font-size: 13px; font-weight: 600;
    font-family: 'Cairo'; border: 1px solid transparent;
    cursor: pointer; transition: all 0.25s ease; text-decoration: none;
    line-height: 1; white-space: nowrap;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent), #00b894);
    color: #060b14; border: none;
}
.btn-primary:hover { box-shadow: 0 4px 16px var(--accent-glow); transform: translateY(-1px); color: #060b14; }
.btn-outline {
    background: transparent; border-color: var(--border); color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.btn-success { background: var(--success); color: #fff; border: none; }
.btn-success:hover { background: #16a34a; color: #fff; }
.btn-warning { background: var(--warning); color: #060b14; border: none; }
.btn-warning:hover { background: #d97706; color: #060b14; }
.btn-danger { background: var(--danger); color: #fff; border: none; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-info { background: var(--info); color: #060b14; border: none; }
.btn-info:hover { background: #0ea5e9; color: #060b14; }
.btn-sm { padding: 6px 12px; font-size: 11px; border-radius: 8px; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: none; }
.btn-ghost:hover { background: var(--accent-dim); color: var(--accent); }
.btn-xs { padding: 4px 8px; font-size: 10px; border-radius: 6px; }
.btn-group { display: flex; gap: 6px; align-items: center; }

/* ===== Forms ===== */
.form-label {
    display: block; font-size: 12px; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 6px;
}
.form-input {
    width: 100%; padding: 9px 14px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--bg-main);
    color: var(--text-primary); font-family: 'Cairo'; font-size: 13px;
    transition: border-color 0.3s; outline: none;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.form-input::placeholder { color: var(--text-muted); }
textarea.form-input { resize: vertical; min-height: 80px; }
select.form-input { cursor: pointer; }
select.form-input option { background: var(--bg-card); color: var(--text-primary); }
.form-input-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.form-error { color: var(--danger); font-size: 11px; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-row-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px; }
.form-group { margin-bottom: 12px; }
.mb-3 { margin-bottom: 16px; }
.py-3 { padding-top: 16px; padding-bottom: 16px; }
.p-0 { padding: 0; }

/* ===== Settings Tabs ===== */
.settings-wrap { max-width: 720px; }
.settings-tabs {
    display: flex; gap: 4px; margin-bottom: 20px;
    border-bottom: 2px solid var(--border); padding-bottom: 0;
    overflow-x: auto;
}
.settings-tab {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 18px; border: none; background: none;
    font-family: 'Cairo'; font-size: 13px; font-weight: 600;
    color: var(--text-muted); cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: all 0.2s; white-space: nowrap;
}
.settings-tab:hover { color: var(--accent); }
.settings-tab.active {
    color: var(--accent); border-bottom-color: var(--accent);
}
.settings-panel { display: none; }
.settings-panel.active { display: block; }
.checkbox-label {
    display: inline-flex; align-items: center; gap: 8px;
    cursor: pointer; font-size: 13px; color: var(--text);
}
.checkbox-label input[type="checkbox"] {
    width: 18px; height: 18px; accent-color: var(--accent);
}

/* ===== Notes Timeline ===== */
.notes-timeline { max-height: 400px; overflow-y: auto; }
.note-item {
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
}
.note-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 6px; font-size: 11px;
}
.note-user { color: var(--accent); font-weight: bold; }
.note-date { color: var(--text-muted); margin-left: auto; }
.note-body {
    font-size: 13px; color: var(--text);
    line-height: 1.7; white-space: pre-wrap;
}
.note-delete {
    color: var(--danger); opacity: 0.5; border: none;
    background: none; cursor: pointer; padding: 2px 6px;
}
.note-delete:hover { opacity: 1; }

/* ===== Tables ===== */
.table-wrapper { overflow-x: auto; }
.table {
    width: 100%; border-collapse: collapse;
}
.table th {
    text-align: right; padding: 10px 14px; font-size: 11px; font-weight: 700;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    background: transparent;
}
.table td {
    padding: 11px 14px; font-size: 13px;
    border-bottom: 1px solid rgba(26,39,68,0.5); vertical-align: middle;
}
.table tr:hover td { background: rgba(0,212,170,0.03); }
.table-sm td, .table-sm th { padding: 8px 10px; font-size: 12px; }
.table-bordered th, .table-bordered td { border: 1px solid var(--border); }
.table-tight td { padding: 8px 10px; }

/* ===== Status Badges ===== */
.badge {
    padding: 4px 10px; border-radius: 6px; font-size: 11px;
    font-weight: 700; display: inline-block; white-space: nowrap;
}
.badge-success { background: rgba(34,197,94,0.12); color: var(--success); }
.badge-warning { background: rgba(240,160,48,0.12); color: var(--warning); }
.badge-danger { background: rgba(239,68,68,0.12); color: var(--danger); }
.badge-info { background: rgba(56,189,248,0.12); color: var(--info); }
.badge-secondary { background: rgba(100,116,139,0.12); color: #94a3b8; }
.badge-primary { background: var(--accent-dim); color: var(--accent); }

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px; border-radius: 10px; font-size: 13px;
    font-weight: 500; display: flex; align-items: center; gap: 8px;
    margin-bottom: 16px; border: 1px solid transparent;
}
.alert-success { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.2); color: var(--success); }
.alert-danger { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.2); color: var(--danger); }
.alert-info { background: rgba(56,189,248,0.1); border-color: rgba(56,189,248,0.2); color: var(--info); }
.alert-warning { background: rgba(240,160,48,0.1); border-color: rgba(240,160,48,0.2); color: var(--warning); }
.alert ul { margin: 4px 0 0 20px; padding: 0; }
.alert li { margin-bottom: 2px; }

/* ===== Pagination ===== */
.pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 4px; margin-top: 20px; padding: 10px 0;
}
.page-item { list-style: none; }
.page-link {
    display: flex; align-items: center; justify-content: center;
    padding: 7px 13px; border-radius: 8px; font-size: 12px; font-weight: 600;
    border: 1px solid var(--border); color: var(--text-secondary);
    background: var(--bg-card); text-decoration: none; transition: all 0.2s;
}
.page-link:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.page-item.active .page-link { background: var(--accent); color: #060b14; border-color: var(--accent); }
.page-item.disabled .page-link { opacity: 0.4; pointer-events: none; }

/* ===== Tabs ===== */
.tabs {
    display: flex; gap: 0; border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.tab {
    padding: 10px 18px; font-size: 13px; font-weight: 600;
    color: var(--text-secondary); cursor: pointer; transition: all 0.2s;
    border-bottom: 2px solid transparent; text-decoration: none;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== Grid Helpers ===== */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* ===== Utilities ===== */
.text-center { text-align: center; }
.text-start { text-align: start; }
.text-end { text-align: end; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }
.font-medium { font-weight: 500; }
.font-normal { font-weight: 400; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 20px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; margin-top: 10px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mr-1 { margin-left: 4px; }
.mr-2 { margin-left: 8px; }
.ml-1 { margin-right: 4px; }
.ml-2 { margin-right: 8px; }
.p-0 { padding: 0; }
.p-2 { padding: 8px; }
.p-3 { padding: 16px; }
.p-4 { padding: 24px; }
.py-1 { padding-top: 4px; padding-bottom: 4px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 16px; padding-bottom: 16px; }
.px-2 { padding-right: 8px; padding-left: 8px; }
.px-3 { padding-right: 16px; padding-left: 16px; }
.w-full { width: 100%; }
.d-flex { display: flex; }
.d-inline { display: inline; }
.d-inline-flex { display: inline-flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.border-bottom { border-bottom: 1px solid var(--border); }
.rounded { border-radius: 10px; }

/* ===== Card Variations ===== */
.card-sm { max-width: 600px; }
.card-md { max-width: 700px; }
.stat-card { padding: 14px; }

/* ===== Search ===== */
.search-flex { flex: 1; max-width: 400px; }

/* ===== Section Title ===== */
.section-title { font-size: 16px; font-weight: 700; }

/* ===== Chip Filter ===== */
.chip {
    padding: 5px 12px; border-radius: 8px; font-size: 11px; font-weight: 600;
    cursor: pointer; border: 1px solid var(--border);
    background: transparent; color: var(--text-secondary);
    font-family: 'Cairo'; transition: all 0.2s;
}
.chip.active { background: var(--accent-dim); color: var(--accent); }

/* ===== Invoice Total Input ===== */
.invoice-input-total {
    background: transparent !important;
    border: none !important;
    color: var(--text-primary);
    font-weight: 700;
}

/* ===== Activity List Padded ===== */
.activity-list-padded { padding: 0 14px; }

/* ===== Sidebar Brand ===== */
.sidebar-text-brand { font-size: 16px; font-weight: 800; }
.sidebar-text-tagline { font-size: 10px; color: var(--text-muted); font-weight: 600; }

/* ===== Quick Stats ===== */
.quick-stat-box {
    background: var(--bg-deep); border-radius: 10px;
    padding: 16px; text-align: center;
}
.quick-stat-value { font-size: 24px; font-weight: 900; }
.quick-stat-label {
    font-size: 11px; color: var(--text-secondary);
    font-weight: 600; margin-top: 4px;
}

/* ===== Customer Name Link ===== */
.customer-name a { color: var(--text-primary); }
.customer-name a:hover { color: var(--accent); }

/* ===== Separator ===== */
.separator { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* ===== Invoice text alignment ===== */
.invoice-total-label { text-align: left; }
.invoice-total-value { text-align: right; }
.invoice-paid { color: var(--success); }

/* ===== Empty State ===== */
.empty-state {
    padding: 32px; text-align: center; color: var(--text-muted);
}
.empty-state i { font-size: 32px; margin-bottom: 8px; opacity: 0.5; }

/* ===== Notifications Bell ===== */
.notif-bell {
    position: relative; cursor: pointer; padding: 8px 12px;
    border-radius: 10px; transition: background 0.2s;
    font-size: 18px; color: var(--text-secondary);
}
.notif-bell:hover { background: var(--accent-dim); color: var(--accent); }
.notif-badge {
    position: absolute; top: 2px; right: 4px;
    background: var(--danger); color: #fff; font-size: 10px;
    font-weight: 800; padding: 1px 6px; border-radius: 10px;
    min-width: 18px; text-align: center; line-height: 1.4;
}
.notif-dropdown {
    display: none; position: absolute; top: calc(100% + 8px); left: 0;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; width: 360px; max-height: 420px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4); z-index: 100;
    overflow: hidden;
}
.notif-dropdown.show { display: block; }
.notif-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    font-weight: 700; font-size: 13px;
}
.notif-mark-all {
    background: none; border: none; color: var(--accent);
    font-family: 'Cairo'; font-size: 11px; font-weight: 600;
    cursor: pointer; padding: 0;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-list { overflow-y: auto; max-height: 360px; }
.notif-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px; border-bottom: 1px solid rgba(26,39,68,0.4);
    text-decoration: none; color: var(--text-primary);
    transition: background 0.2s; cursor: pointer;
}
.notif-item:hover { background: var(--accent-dim); }
.notif-item i { margin-top: 2px; font-size: 16px; }
.notif-title { font-size: 13px; font-weight: 700; }
.notif-msg { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.notif-empty {
    padding: 24px; text-align: center; color: var(--text-muted);
    font-size: 13px;
}

/* ===== Toast ===== */
#toastContainer,
.toast-container {
    position: fixed; top: 20px; left: 20px; z-index: 9999;
    display: flex; flex-direction: column; gap: 8px;
}
.toast-item {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; padding: 14px 20px;
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; font-weight: 600;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    animation: toastIn 0.4s cubic-bezier(0.4,0,0.2,1);
    min-width: 280px;
}
.toast-item.success { border-color: var(--success); }
.toast-item.error { border-color: var(--danger); }
.toast-item.info { border-color: var(--info); }
@keyframes toastIn {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(50px); }
}

/* ===== Fade Up ===== */
.fade-up {
    opacity: 0; transform: translateY(20px);
    animation: fadeUp 0.6s cubic-bezier(0.4,0,0.2,1) forwards;
}
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; margin-top: 15px; }
.delay-3 { animation-delay: 0.3s; margin-top: 15px; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* ===== Kanban / Task Board ===== */
.kanban-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.kanban-column {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border); border-radius: 12px;
    min-height: 200px;
}
.kanban-header {
    padding: 12px 14px; border-bottom: 1px solid var(--border);
    font-weight: 700; font-size: 13px;
    display: flex; align-items: center; justify-content: space-between;
}
.kanban-body { padding: 8px; min-height: 150px; }
.task-card-kanban {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 10px; padding: 12px; margin-bottom: 8px;
    transition: all 0.25s; cursor: pointer;
}
.task-card-kanban:hover { border-color: var(--border-light); background: var(--bg-card-hover); }
.task-card-kanban.dragging { opacity: 0.4; }
.kanban-column.drag-over { border-color: var(--accent); background: rgba(0,212,170,0.05); }
.kanban-column.drag-over .kanban-body { min-height: 200px; }
.task-title { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.task-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 6px; flex-wrap: wrap; }

/* ===== Task Modal ===== */
.modal-overlay {
    display: none; position: fixed; z-index: 9999; inset: 0;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    align-items: center; justify-content: center; padding: 20px;
}
.modal-content {
    background: var(--bg-main); border: 1px solid var(--border);
    border-radius: 16px; width: 100%; max-width: 520px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: modalIn 0.2s ease;
}
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.align-items-center { align-items: center; }

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 15px; font-weight: 700; }
.modal-close {
    background: none; border: none; color: var(--text-muted); font-size: 24px;
    cursor: pointer; line-height: 1; padding: 0 4px;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 16px 20px; }
.modal-footer {
    display: flex; gap: 8px; justify-content: flex-end;
    padding: 12px 20px; border-top: 1px solid var(--border);
}

/* ===== Invoice Items Table ===== */
.invoice-items th {
    font-size: 11px; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
    padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: right;
}
.invoice-items td { padding: 10px 14px; border-bottom: 1px solid rgba(26,39,68,0.5); vertical-align: middle; }
.invoice-total-row td { border: none; font-weight: 700; padding: 6px 14px; }
.invoice-grand td { font-size: 16px; color: var(--danger); }

/* ===== Login Page ===== */
.auth-container {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 20px; position: relative; z-index: 1;
}
.auth-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 20px; padding: 40px; width: 100%; max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.auth-logo {
    text-align: center; margin-bottom: 32px;
}
.auth-logo .logo-icon {
    width: 56px; height: 56px; font-size: 22px; margin: 0 auto 12px;
}
.auth-logo h1 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.auth-logo p { font-size: 13px; color: var(--text-secondary); }
.auth-logo .logo-icon-img { display: block; margin: 0 auto 8px; object-fit: contain; }
/* ===== Customer Avatar ===== */
.customer-cell { display: flex; align-items: center; gap: 10px; }
.customer-avatar {
    width: 34px; height: 34px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.customer-name { font-weight: 600; font-size: 13px; }
.customer-email { font-size: 11px; color: var(--text-muted); }

/* ===== Report Tabs ===== */
.report-tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 4px; }
.report-tab {
    flex: 1; padding: 10px 16px; border: none; border-radius: 8px; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all 0.25s; text-align: center;
    background: transparent; color: var(--text-secondary); display: flex; align-items: center; justify-content: center; gap: 8px;
}
.report-tab:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.report-tab.active { background: var(--accent); color: #fff; box-shadow: 0 4px 14px var(--accent-glow); }
.report-tab i { font-size: 14px; }
.report-panel { display: none; }
.report-panel.active { display: block; }

/* ===== KPI Cards ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 28px; }
.kpi-card {
    background: linear-gradient(135deg, var(--bg-card), rgba(15,26,46,0.6));
    border: 1px solid var(--border); border-radius: 16px;
    padding: 24px 22px; position: relative; overflow: hidden;
    transition: all 0.35s cubic-bezier(0.4,0,0.2,1); cursor: default;
    display: flex; flex-direction: column; justify-content: space-between;
    min-height: 160px;
}
.kpi-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0;
    height: 3px; border-radius: 16px 16px 0 0;
}
.kpi-card::after {
    content: ''; position: absolute; top: -50%; right: -50%;
    width: 100%; height: 100%; border-radius: 50%;
    opacity: 0.03; pointer-events: none;
    transition: all 0.5s ease;
}
.kpi-card:nth-child(1)::before { background: linear-gradient(90deg,var(--accent),#00ffcc); }
.kpi-card:nth-child(1)::after { background: radial-gradient(circle,var(--accent),transparent); }
.kpi-card:nth-child(2)::before { background: linear-gradient(90deg,var(--info),#7dd3fc); }
.kpi-card:nth-child(2)::after { background: radial-gradient(circle,var(--info),transparent); }
.kpi-card:nth-child(3)::before { background: linear-gradient(90deg,var(--warning),#fbbf24); }
.kpi-card:nth-child(3)::after { background: radial-gradient(circle,var(--warning),transparent); }
.kpi-card:nth-child(4)::before { background: linear-gradient(90deg,var(--success),#4ade80); }
.kpi-card:nth-child(4)::after { background: radial-gradient(circle,var(--success),transparent); }
.kpi-card:hover {
    border-color: var(--border-light); transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.kpi-card:hover::after { opacity: 0.06; transform: scale(1.2); }
.kpi-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.kpi-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; color: #fff; position: relative; z-index: 1;
}
.kpi-card:nth-child(1) .kpi-icon { background: linear-gradient(135deg,var(--accent),rgba(0,212,170,0.5)); box-shadow: 0 4px 12px rgba(0,212,170,0.25); }
.kpi-card:nth-child(2) .kpi-icon { background: linear-gradient(135deg,var(--info),rgba(56,189,248,0.5)); box-shadow: 0 4px 12px rgba(56,189,248,0.25); }
.kpi-card:nth-child(3) .kpi-icon { background: linear-gradient(135deg,var(--warning),rgba(240,160,48,0.5)); box-shadow: 0 4px 12px rgba(240,160,48,0.25); }
.kpi-card:nth-child(4) .kpi-icon { background: linear-gradient(135deg,var(--success),rgba(34,197,94,0.5)); box-shadow: 0 4px 12px rgba(34,197,94,0.25); }
.kpi-value { font-size: 32px; font-weight: 900; line-height: 1; margin-bottom: 6px; letter-spacing: -0.5px; }
.kpi-label { font-size: 13px; color: var(--text-secondary); font-weight: 600; letter-spacing: 0.3px; }
.kpi-trend {
    font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 6px;
    display: flex; align-items: center; gap: 4px; position: relative; z-index: 1;
}
.kpi-trend.up { background: rgba(34,197,94,0.15); color: var(--success); }
.kpi-trend.down { background: rgba(239,68,68,0.15); color: var(--danger); }

/* ===== Charts ===== */
.charts-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 28px; }

/* ===== Pipeline ===== */
.pipeline { display: flex; gap: 10px; align-items: stretch; }
.pipeline-stage {
    flex: 1; background: rgba(255,255,255,0.02);
    border: 1px solid var(--border); border-radius: 12px;
    padding: 14px; transition: all 0.3s; cursor: pointer;
}
.pipeline-stage:hover {
    border-color: var(--border-light);
    background: rgba(255,255,255,0.04);
    transform: translateY(-2px);
}
.stage-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.stage-dot { width: 8px; height: 8px; border-radius: 50%; }
.stage-count { font-size: 10px; color: var(--text-muted); font-weight: 600; }
.stage-value { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.stage-label { font-size: 11px; color: var(--text-secondary); font-weight: 600; }

/* ===== Activity List ===== */
.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-item {
    display: flex; gap: 12px; padding: 12px 0;
    border-bottom: 1px solid rgba(26,39,68,0.4);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
    width: 34px; height: 34px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; flex-shrink: 0;
}
.activity-text { font-size: 13px; line-height: 1.6; }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== Chart Containers ===== */
.chart-container { position: relative; }
.chart-container-h260 { height: 260px; }
.chart-container-h220 { height: 220px; }
.chart-container-h200 { height: 200px; }

/* ===== Font Weights ===== */
.font-medium { font-weight: 500; }

/* ===== Activity Icon Variants ===== */
.activity-icon-empty { background: var(--accent-dim); color: var(--accent); }
.activity-icon-0 { background: var(--accent-dim); color: var(--accent); }
.activity-icon-1 { background: rgba(56,189,248,0.12); color: var(--info); }
.activity-icon-2 { background: rgba(239,68,68,0.12); color: var(--danger); }
.activity-icon-3 { background: rgba(34,197,94,0.12); color: var(--success); }
.activity-icon-4 { background: rgba(240,160,48,0.12); color: var(--warning); }

/* ===== Pipeline Stage Dot Variants ===== */
.stage-dot-draft { background: #6c757d; box-shadow: 0 0 8px rgba(108,117,125,0.3); }
.stage-dot-sent { background: #38bdf8; box-shadow: 0 0 8px rgba(56,189,248,0.3); }
.stage-dot-overdue { background: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,0.3); }
.stage-dot-paid { background: #22c55e; box-shadow: 0 0 8px rgba(34,197,94,0.3); }
.stage-dot-cancelled { background: #94a3b8; box-shadow: 0 0 8px rgba(148,163,184,0.3); }

/* ===== Mobile ===== */
@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(2,1fr); }
    .charts-grid { grid-template-columns: 1fr; }
    .grid-2, .form-row, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: repeat(2,1fr); }
    .pipeline { flex-direction: column; }
    .kanban-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(100%); }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-right: 0; }
    .top-header { padding: 12px 16px; }
    .page-content { padding: 20px 16px; }
    .search-box { width: 200px; }
    .kpi-grid { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: 1fr; }
    .mobile-toggle { display: flex !important; }
}

/* ===== LTR Overrides ===== */
[dir="ltr"] .sidebar { right: auto; left: 0; border-left: none; border-right: 1px solid var(--border); }
[dir="ltr"] .nav-item.active::before { right: auto; left: -12px; }
[dir="ltr"] .main-wrapper { margin-right: 0; margin-left: 260px; }
[dir="ltr"] .notif-dropdown,
[dir="ltr"] .dropdown-menu { left: auto; right: 0; }
[dir="ltr"] .slider-thumb { left: auto; right: 0; }
[dir="ltr"] .mr-1 { margin-left: auto; margin-right: 4px; }
[dir="ltr"] .mr-2 { margin-left: auto; margin-right: 8px; }
[dir="ltr"] .ml-1 { margin-right: auto; margin-left: 4px; }
[dir="ltr"] .ml-2 { margin-right: auto; margin-left: 8px; }
[dir="ltr"] .note-date { margin-left: 0; margin-right: auto; }
[dir="ltr"] .invoice-total-label { text-align: left; }
[dir="ltr"] .invoice-total-value { text-align: right; }
[dir="ltr"] .table th { text-align: left; }

@media (max-width: 768px) {
    [dir="ltr"] .sidebar { transform: translateX(-100%); }
    [dir="ltr"] .sidebar.open { transform: translateX(0); }
    [dir="ltr"] .main-wrapper { margin-left: 0; }
}
