/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --secondary: #64748b;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --info: #0891b2;
    --info-light: #ecfeff;
    --orange: #ea580c;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --border-dark: #cbd5e1;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-hover: #1e293b;
    --sidebar-active: #2563eb;
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 5px;
    --radius-lg: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== LAYOUT ===== */
.app-layout { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: width 0.3s ease;
    overflow-x: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

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

.brand-icon {
    width: 50px; height: 50px;
    padding: 5px;
    background: var(--primary);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 16px;
    flex-shrink: 0;
}


.brand-icon img {
    height: auto;
    width: 100%;
}

.brand-logo { width: 36px; height: 36px; object-fit: contain; border-radius: var(--radius); }

.brand-name {
    color: white;
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
}
.brand-name_builder { font-weight: 500; font-size: 8px; color:var(--text-muted); text-transform: uppercase;
    letter-spacing: 1px;}

.sidebar-toggle {
    background: none; border: none; color: var(--sidebar-text);
    cursor: pointer; padding: 4px; font-size: 16px;
    display: none;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.nav-section { margin-bottom: 4px; }

.nav-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.3);
    padding: 12px 20px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    font-size: 13.5px;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: white;
    text-decoration: none;
}

.nav-item.active {
    background: rgba(37,99,235,0.15);
    color: #add2ff;
    border-left-color: var(--primary);
}

.nav-item i { width: 18px; text-align: center; font-size: 14px; }

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

.user-info { display: flex; align-items: center; gap: 10px; }

.user-avatar {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 600; font-size: 12px;
    flex-shrink: 0;
}
.user-avatar-name {
    font-size: 13px;
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (max-width: 480px) {
   .user-avatar-name { display: none; }
}

.user-details { flex: 1; min-width: 0; }
.user-name { color: white; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: var(--sidebar-text); font-size: 11px; }

.logout-btn { color: var(--sidebar-text); transition: color 0.15s; }
.logout-btn:hover { color: var(--danger); text-decoration: none; }

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.top-header {
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky; top: 0; z-index: 50;
    box-shadow: var(--shadow);
}

.header-left { display: flex; align-items: center; gap: 16px; }
.page-title { font-size: 18px; font-weight: 600; color: var(--text); }

.mobile-toggle {
    display: none;
    background: none; border: none; cursor: pointer;
    color: var(--text); font-size: 18px; padding: 4px;
}

.header-right { display: flex; align-items: center; gap: 16px; }
.header-user { font-size: 13px; color: var(--text-secondary); }

.content-area { padding: 24px; flex: 1; }

/* ===== FLASH MESSAGES ===== */
.flash-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin: 12px 24px 0;
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 500;
}

.flash-success { background: var(--success-light); color: var(--success); border: 1px solid #bbf7d0; }
.flash-error   { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }
.flash-info    { background: var(--info-light); color: var(--info); border: 1px solid #a5f3fc; }
.flash-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #fde68a; }

.flash-close {
    margin-left: auto; background: none; border: none;
    cursor: pointer; color: inherit; opacity: 0.6;
    padding: 0 4px;
}
.flash-close:hover { opacity: 1; }

/* ===== CARDS ===== */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i { color: var(--primary); }
.card-body { padding: 20px; }

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stats-flex {
    display: flex;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    width: 100%;
    min-width: min-content;
}

.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    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: #fff7ed; color: var(--orange); }
.stat-icon.red    { background: var(--danger-light); color: var(--danger); }
.stat-icon.teal   { background: var(--info-light); color: var(--info); }

.stat-value { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
    text-decoration: none;
}

.btn:hover { text-decoration: none; opacity: 0.9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary   { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface); color: var(--text-secondary); border-color: var(--border-dark); }
.btn-secondary:hover { background: var(--bg); }
.btn-success   { background: var(--success); color: white; }
.btn-danger    { background: var(--danger); color: white; }
.btn-warning   { background: var(--warning); color: white; }
.btn-ghost     { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 15px 20px; font-size: 16px; }
.btn-icon { padding: 7px; min-width: 32px; justify-content: center; }

.btn-center {justify-content: center;}

/* ===== TABLES ===== */
.table-container { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table th {
    background: var(--bg);
    padding: 11px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

.table tbody tr:hover { background: var(--primary-light); }
.table tbody tr:last-child td { border-bottom: none; }

.table .actions { display: flex; gap: 4px; }

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}

.badge-success   { background: var(--success-light); color: var(--success); }
.badge-danger    { background: var(--danger-light); color: var(--danger); }
.badge-warning   { background: var(--warning-light); color: var(--warning); }
.badge-info      { background: var(--info-light); color: var(--info); }
.badge-primary   { background: var(--primary-light); color: var(--primary); }
.badge-secondary { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-orange    { background: #fff7ed; color: var(--orange); }

/* ===== FORMS ===== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 500; color: var(--text); }
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
    padding: 9px 12px;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius);
    font-size: 13.5px;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-control[readonly] { background: var(--bg); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: 12px; color: var(--text-muted); }
.form-error { font-size: 12px; color: var(--danger); }

/* ===== FILTERS BAR ===== */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filters-bar .form-control { width: auto; }
.search-input { min-width: 220px; }

/* ===== BULK ACTIONS ===== */
.bulk-actions-bar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--primary-light);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    margin-bottom: 12px;
    font-size: 13.5px;
}

.bulk-actions-bar.visible { display: flex; }
.bulk-count { font-weight: 600; color: var(--primary); }

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    padding: 16px 0 4px;
}

.page-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 13px;
    transition: all 0.15s;
}

.page-btn:hover { background: var(--bg); text-decoration: none; }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header h3 i { color: var(--danger); }

.modal-body { padding: 20px 24px; color: var(--text-secondary); line-height: 1.6; }
.modal-footer {
    padding: 16px 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-lg { max-width: 700px; }
.modal-xl { max-width: 900px; }

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 18px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== DETAIL VIEW ===== */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.detail-item { }
.detail-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 4px; font-weight: 600; }
.detail-value { font-size: 14px; color: var(--text); font-weight: 500; }
.detail-value a { color: var(--primary); }

/* ===== UPDATE CARDS ===== */
.update-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.update-card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.update-card-title { font-weight: 600; font-size: 15px; color: var(--text); }
.update-card-meta { font-size: 12px; color: var(--text-muted); }

.update-card-body { padding: 16px 18px; }
.update-card-image { width: 100%; max-height: 300px; object-fit: cover; border-bottom: 1px solid var(--border); }

.comment-thread { border-top: 1px solid var(--border); padding: 14px 18px; }
.comment-thread-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 12px; }

.comment {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.comment-avatar {
    width: 30px; height: 30px;
    background: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 11px; font-weight: 600;
    flex-shrink: 0;
}

.comment-content { flex: 1; }
.comment-author { font-weight: 600; font-size: 13px; }
.comment-time { font-size: 11px; color: var(--text-muted); margin-left: 8px; }
.comment-text { font-size: 13.5px; color: var(--text-secondary); margin-top: 4px; }

.comment-input-area { display: flex; gap: 10px; margin-top: 12px; }
.comment-input-area textarea { resize: none; min-height: 60px; }

.comment-delete-btn {
    opacity:0.85;
    padding:2px 6px;
    font-size:12px;
    flex-shrink:0"
}

/* ===== ATTACHMENT CARD ===== */
.attachment-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    transition: background 0.15s;
}

.attachment-item:hover { background: var(--bg); }
.attachment-icon { font-size: 22px; color: var(--primary); flex-shrink: 0; }
.attachment-info { flex: 1; min-width: 0; }
.attachment-name { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-meta { font-size: 11px; color: var(--text-muted); }

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-header-left h2 { font-size: 20px; font-weight: 700; color: var(--text); }
.page-header-left p { color: var(--text-secondary); font-size: 13.5px; margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.page-bannercover { margin-bottom:16px;border-radius:var(--radius-lg);overflow:hidden; border:1px solid var(--border);box-shadow:var(--shadow); }
.page-bannercover img { width: 100%; height: auto; object-fit: contain; display: block; }

.client-logo {
    height: 75px;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    background: white;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); text-decoration: none; }
.breadcrumb i { font-size: 10px; }
.breadcrumb .current { color: var(--text-secondary); }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state i { font-size: 40px; margin-bottom: 0; opacity: 0.3; }
.empty-state p { font-size: 15px; margin-bottom: 16px; }

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    padding: 20px;
    flex-direction: column;
    gap: 10px;
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .brand-icon {
    width: 52px; height: 52px;
    font-size: 22px;
    margin: 0 auto 12px;
}

.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.login-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.login-built_by {color: #ccc;font-size: 8px;text-transform: uppercase;letter-spacing: 2px;font-weight: 600;}

/* ===== CHECKBOX ===== */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13.5px;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; }

/* ===== SECTION DIVIDER ===== */
.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* ===== PRIORITY & STATUS DOTS ===== */
.priority-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}
.dot-low    { background: var(--text-muted); }
.dot-medium { background: var(--info); }
.dot-high   { background: var(--warning); }
.dot-urgent { background: var(--danger); }

/* ===== INVOICE ITEMS ===== */
.invoice-items-table th, .invoice-items-table td { padding: 8px 12px; }
.invoice-totals { max-width: 320px; margin-left: auto; }
.invoice-total-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13.5px; }
.invoice-total-row.grand { font-weight: 700; font-size: 16px; border-top: 2px solid var(--border); padding-top: 10px; margin-top: 6px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; width:100%; }
    .mobile-toggle { display: block; }
    .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .content-area { padding: 16px; }
    .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: 1fr 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .filters-bar { flex-direction: column; align-items: stretch; }
    .search-input { min-width: 0; width: 100%; }
    .table th, .table td { padding: 8px 10px; }
}

/* ===== UTILITIES ===== */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--text-muted); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.fw-bold      { font-weight: 700; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.hide { display: none !important; }

/* ===== DASHBOARD SPECIFIC ===== */
.recent-table th { font-size: 11px; }
.welcome-banner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    color: white;
    margin-bottom: 24px;
}
.welcome-banner h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.welcome-banner p { opacity: 0.85; font-size: 14px; }

/* ===== SETTINGS ===== */
.settings-tabs { display: flex; gap: 0; flex-direction: row; min-width: 200px; }
.settings-tab { padding: 10px 16px; border-radius: var(--radius); cursor: pointer; font-size: 13.5px; color: var(--text-secondary); display: flex; align-items: center; gap: 8px;}
.settings-tab:hover { background: var(--bg); color: var(--text); }
.settings-tab.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }
.settings-layout { display: grid; grid-template-columns: 1fr; gap: 20px; }

@media (max-width: 768px) {
    .settings-layout { grid-template-columns: 1fr; }
    .settings-tabs { flex-direction: row; overflow-x: auto; }
}

/* ===== BRAND COLORS UPDATE ===== */
:root {
    --primary: #243474;
    --primary-dark: #10267D;
    --primary-light: #eef1fb;
    --primary-mid: #3a4f9e;
}

/* ===== NOTIFICATIONS ===== */
.notif-dropdown {
    position: relative;
    display: inline-flex;
}

.notif-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 18px;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notif-btn:hover { background: var(--bg); color: var(--primary); }

.notif-badge {
    position: absolute;
    top: 2px; right: 2px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    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;
}

.notif-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 500;
    overflow: hidden;
}

.notif-panel.open { display: block; }

.notif-panel-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notif-panel-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.notif-list { max-height: 380px; overflow-y: auto; }

.notif-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.notif-item:hover { background: var(--bg); text-decoration: none; }
.notif-item.unread { background: var(--primary-light); }
.notif-item.unread:hover { background: #dde5f8; }

.notif-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    color: white;
}

.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.3; }
.notif-msg { font-size: 12px; color: var(--text-secondary); margin-top: 2px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.notif-unread-dot { width: 8px; height: 8px; background: var(--primary); border-radius: 50%; flex-shrink: 0; margin-top: 6px; }

.notif-panel-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notif-empty {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-muted);
}

.notif-empty i { font-size: 32px; margin-bottom: 10px; opacity: 0.3; }
.notif-empty p { font-size: 13px; }

/* ===== USER DROPDOWN ===== */
.user-dropdown {
    position: relative;
}

.user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px 6px 8px;
    cursor: pointer;
    transition: background 0.15s;
    color: var(--text);
}

.user-dropdown-btn:hover { background: var(--bg); }

.user-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 500;
    overflow: hidden;
}

.user-dropdown-menu.open { display: block; }

.user-dropdown-info {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.user-dropdown-name { font-weight: 600; font-size: 14px; color: var(--text); }
.user-dropdown-email { font-size: 12px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-dropdown-role { display: inline-block; margin-top: 6px; }

.dropdown-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 13.5px;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dropdown-menu-item:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.dropdown-menu-item i { width: 16px; text-align: center; }
.dropdown-menu-item.danger { color: var(--danger); }
.dropdown-menu-item.danger:hover { background: var(--danger-light); }
.dropdown-menu-divider { border-top: 1px solid var(--border); margin: 4px 0; }

/* ===== PROJECT PHASE ===== */
.phase-timeline {
    display: flex;
    gap: 0;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 20px;
}

.phase-step {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.phase-dot {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--border);
    border: 2px solid var(--border-dark);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    color: var(--text-muted);
    transition: all 0.2s;
    position: relative;
    z-index: 1;
}

.phase-step.active .phase-dot {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.phase-step.done .phase-dot {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.phase-line {
    height: 2px;
    width: 32px;
    background: var(--border);
    flex-shrink: 0;
}

.phase-step.done + .phase-step .phase-line,
.phase-step.done .phase-line { background: var(--success); }

.phase-label {
    font-size: 10px;
    text-align: center;
    color: var(--text-muted);
    margin-top: 4px;
    white-space: nowrap;
}

.phase-step.active .phase-label { color: var(--primary); font-weight: 600; }
.phase-step.done .phase-label { color: var(--success); }

/* ===== CHAT / MESSAGES ===== */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 425px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg);
}

.chat-bubble-wrap {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-bubble-wrap.mine { flex-direction: row-reverse; }

.chat-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 11px; font-weight: 600;
    flex-shrink: 0;
}

.chat-bubble {
    max-width: 100%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    position: relative;
}

.chat-bubble.theirs {
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
    color: var(--text);
}

.chat-bubble.mine {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: center;
}

.chat-sender { font-size: 11px; font-weight: 600; margin-bottom: 4px; }
.chat-bubble.theirs .chat-sender { color: var(--primary); }
.chat-bubble.mine .chat-sender { color: rgba(255,255,255,0.8); }

.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: flex-end;
    background: var(--surface);
}

.chat-input {
    flex: 1;
    resize: none;
    min-height: 42px;
    max-height: 120px;
    overflow-y: auto;
}

.chat-attachment-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px 0;
}

/* ===== ACTIVITY LOG ===== */
.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    color: white;
}

.activity-content { flex: 1; }
.activity-text { font-size: 13.5px; color: var(--text); line-height: 1.4; }
.activity-text strong { color: var(--primary); }
.activity-time { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.activity-module { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-top: 2px; }

/* ===== PROJECT MINI DASHBOARD ===== */
.project-stats-mini {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.project-stat-mini {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    border: 1px solid var(--border);
}

.project-stat-mini .value {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

.project-stat-mini .label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ===== PASSWORD RESET / ACCOUNT ===== */
.show-password-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    font-size: 14px;
}

.show-password-btn:hover { color: var(--primary); }

.password-field-wrap {
    position: relative;
}

.password-field-wrap .form-control {
    padding-right: 38px;
}

/* ===== INVOICE PAYMENTS ===== */
.payment-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    background: var(--success-light);
}

.payment-icon { font-size: 20px; color: var(--success); flex-shrink: 0; }
.payment-info { flex: 1; }
.payment-amount { font-weight: 700; font-size: 15px; color: var(--success); }
.payment-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== INVOICE STATS ===== */
.invoice-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.invoice-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    box-shadow: var(--shadow);
}

.invoice-stat-label {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 6px;
}

.invoice-stat-value {
    font-size: 22px;
    font-weight: 700;
}

/* ===== CLIENT PORTAL DASHBOARD ===== */
.portal-welcome {
    background: linear-gradient(135deg, #243474 0%, #10267D 100%);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    color: white;
    margin-bottom: 20px;
}

.portal-welcome h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.portal-welcome p  { opacity: 0.8; font-size: 13.5px; }

/* ===== IMPROVED SIDEBAR ===== */
.sidebar { background: #0d1b3e; }

.nav-item.active {
    background: rgba(36,52,116,0.5);
    color: #7b9ef8;
    border-left-color: #243474;
}

.nav-item:hover {
    background: rgba(255,255,255,0.06);
}

/* ===== HEADER IMPROVEMENTS ===== */
.top-header {
    background: white;
    border-bottom: 2px solid var(--primary-light);
}

/* ===== MISC ===== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 7px;
}

.section-title i { color: var(--primary); }

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; background: var(--primary-light); color: var(--primary); }

@media (max-width: 640px) {
    .notif-panel { width: 320px; right: -60px; }
    .project-stats-mini { grid-template-columns: repeat(2, 1fr); }
    .invoice-stats-grid { grid-template-columns: 1fr 1fr; }
}

.notif-item[data-notif-id] {
    cursor: pointer;
    user-select: none;
}

.notif-item[data-notif-id]:hover {
    background: var(--bg);
}

.notif-item[data-notif-id].unread:hover {
    background: #dde5f8;
}

/* ===== TOAST ===== */
.toast-msg {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 9999;
    box-shadow: var(--shadow-lg);
    transition: opacity 0.4s ease;
    opacity: 1;
    max-width: 360px;
}

.toast-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid #bbf7d0;
}

.toast-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.toast-info {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid #bfdbfe;
}

.msg-delete-btn {
    background:none;
    border:none;
    cursor:pointer;
    font-size:12px;
    font-weight: 500;
    color:var(--danger);
    margin-top:4px;padding:2px 6px;
    display:flex;align-items:center;gap:4px;
    opacity:1 !important;
    align-self:flex-end;
}

/* ===== QUILL RICH TEXT CONTENT ===== */
.ql-content p { margin-bottom: 8px; }
.ql-content h1, .ql-content h2, .ql-content h3 {
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}
.ql-content h1 { font-size: 20px; }
.ql-content h2 { font-size: 17px; }
.ql-content h3 { font-size: 15px; }
.ql-content ul, .ql-content ol {
    padding-left: 20px;
    margin-bottom: 8px;
}
.ql-content li { margin-bottom: 4px; }
.ql-content a {
    color: var(--primary);
    text-decoration: underline;
}
.ql-content strong { font-weight: 700; }
.ql-content em { font-style: italic; }
.ql-content blockquote {
    border-left: 3px solid var(--border-dark);
    padding-left: 12px;
    color: var(--text-secondary);
    margin: 8px 0;
}
.ql-content pre {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 12.5px;
    overflow-x: auto;
}
.ql-content code {
    background: var(--bg);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12.5px;
}

/* Quill toolbar styling to match app */
.ql-toolbar.ql-snow {
    border-color: var(--border-dark) !important;
    border-radius: var(--radius) var(--radius) 0 0 !important;
    background: var(--bg) !important;
}

.ql-container.ql-snow {
    border-color: var(--border-dark) !important;
    border-radius: 0 0 var(--radius) var(--radius) !important;
}

.ql-editor {
    min-height: 120px !important;
    font-family: var(--font) !important;
    font-size: 13.5px !important;
    color: var(--text) !important;
}

.ql-editor.ql-blank::before {
    color: var(--text-muted) !important;
    font-style: normal !important;
}

/* ===== COMPREHENSIVE RESPONSIVE OVERHAUL ===== */

/* ── Tablet (max 1024px) ─────────────────────── */
@media (max-width: 1024px) {

    /* Sidebar */
    .sidebar {
        transform: translateX(-100%);
        z-index: 200;
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; width: 100%; }
    .mobile-toggle { display: block; }

    /* Stats */
    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    /* Settings */
    .settings-layout { grid-template-columns: 1fr; }
    .settings-tabs {
        flex-direction: row;
        overflow-x: auto;
        gap: 4px;
        padding-bottom: 4px;
    }
    .settings-tab { white-space: nowrap; }

    /* Forms */
    .form-grid-3 { grid-template-columns: repeat(2, 1fr); }

    /* Invoice totals */
    .invoice-totals { max-width: 100%; }

    /* Tables — allow horizontal scroll */
    .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ── Mobile (max 768px) ──────────────────────── */
@media (max-width: 768px) {
    
    .main-content { width: 100% !important; }

    /* Content padding */
    .content-area { padding: 14px; }

    /* Page header */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .page-header-left h2 { font-size: 18px; }
    .page-actions { width: 100%; flex-wrap: wrap; }
    .page-actions .btn { flex: 1; justify-content: center; min-width: 120px; }
    
    .page-bannercover { margin-bottom:16px;border-radius:var(--radius-lg);overflow:hidden; border:1px solid var(--border);box-shadow:var(--shadow); }
    .page-bannercover img { width: 100%; height: auto; object-fit: contain; display: block; }

    /* Breadcrumb */
    .breadcrumb { flex-wrap: wrap; }

    /* Cards */
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .card-header .btn { align-self: flex-start; }

    /* Stats grid */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px; gap: 10px; }
    .stat-value { font-size: 20px; }
    .stat-icon { width: 40px; height: 40px; font-size: 16px; }

    /* Forms */
    .form-grid { grid-template-columns: 1fr; }
    .form-grid-3 { grid-template-columns: 1fr; }
    .form-full { grid-column: 1; }
    .filters-bar { flex-direction: column; align-items: stretch; }
    .search-input { min-width: 0; width: 100%; }
    .filters-bar .form-control { width: 100%; }
    .filters-bar .btn { width: 100%; justify-content: center; }

    /* Tables */
    .table th, .table td { padding: 8px 10px; font-size: 12.5px; }
    .table th { font-size: 10.5px; }

    /* Hide less important columns on mobile */
    .table .hide-mobile { display: none; }

    /* Tabs */
    .tabs { overflow-x: auto; gap: 0; padding-bottom: 0; flex-wrap: nowrap; }
    .tab-btn { padding: 8px 12px; font-size: 12.5px; white-space: nowrap; }

    /* Detail grid */
    .detail-grid { grid-template-columns: 1fr 1fr; gap: 12px; }

    /* Project stats mini */
    .project-stats-mini { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .project-stat-mini .value { font-size: 18px; }

    /* Chat */
    .chat-container { height: 420px; }

    /* Invoice */
    .invoice-totals { max-width: 100%; }
    .invoice-total-row { font-size: 13px; }
    .invoice-total-row.grand { font-size: 15px; }
    .invoice-items-table th,
    .invoice-items-table td { padding: 6px 8px; font-size: 12.5px; }

    /* Notifications panel */
    .notif-panel { width: 300px; right: -10px; }

    /* Modal */
    .modal { margin: 10px; }
    .modal-footer { flex-direction: column-reverse; }
    .modal-footer .btn { width: 100%; justify-content: center; }

    /* Settings */
    .settings-layout { grid-template-columns: 1fr; }
    .settings-tabs {
        flex-direction: row;
        overflow-x: auto;
        flex-wrap: nowrap;
        gap: 4px;
    }
    .settings-tab { flex-shrink: 0; font-size: 12.5px; padding: 8px 12px; }

    /* Activity */
    .activity-item { gap: 8px; }
    .activity-icon { width: 28px; height: 28px; font-size: 11px; }

    /* Welcome banner */
    .welcome-banner { padding: 18px 20px; }
    .welcome-banner h2 { font-size: 18px; }

    /* Bulk actions */
    .bulk-actions-bar {
        flex-wrap: wrap;
        gap: 6px;
    }
    .bulk-actions-bar .btn { font-size: 12px; }

    /* Buttons in action columns */
    .actions { gap: 2px; }
    .btn-icon { padding: 5px; min-width: 28px; }

    /* Top header */
    .top-header { padding: 0 14px; }
    .page-title { font-size: 15px; }
    .header-right { gap: 8px; }

    /* Login */
    .login-card { padding: 28px 20px; }

    /* Two column grids → single column */
    div[style*="grid-template-columns:1fr 1fr"],
    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

/* ── Small mobile (max 480px) ────────────────── */
@media (max-width: 480px) {

    /* Stats grid */
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-card { padding: 12px; gap: 8px; }
    .stats-label {font-size:10px;}
    .stat-value { font-size: 16px; }
    .stat-icon { width: 25px; height: 25px; font-size: 13px; }
    .stats-flex { display: grid !important;grid-template-columns: repeat(2, 1fr); }

    /* Detail grid → single col */
    .detail-grid { grid-template-columns: 1fr; }

    /* Project stats → 2 col */
    .project-stats-mini { grid-template-columns: repeat(2, 1fr); }

    /* Notif panel full width */
    .notif-panel {
        width: calc(100vw - 20px);
        right: -50px;
    }

    /* User dropdown */
    .user-dropdown-menu { width: 200px; }

    /* Hide username in header */
    .header-user { display: none; }

    /* Full width buttons */
    .page-actions .btn { min-width: 100px; }

    /* Table font size */
    .table th, .table td { font-size: 12px; padding: 6px 8px; }

    /* Chat */
    .chat-container { height: 360px; }
    .chat-bubble { font-size: 13px; padding: 8px 10px; }

    /* Invoice items table — stack on small screens */
    .invoice-items-table thead { display: none; }
    .invoice-items-table tbody tr {
        display: block;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        margin-bottom: 10px;
        padding: 10px;
    }
    .invoice-items-table tbody td {
        display: block;
        border: none;
        padding: 4px 0;
        font-size: 13px;
    }
    .invoice-items-table tbody td::before {
        content: attr(data-label);
        font-size: 10px;
        font-weight: 600;
        text-transform: uppercase;
        color: var(--text-muted);
        display: block;
        margin-bottom: 2px;
    }

    /* Phase timeline scroll */
    .phase-timeline { overflow-x: auto; padding-bottom: 8px; }

    /* Sidebar footer user details */
    .user-details { display: none; }

    /* Toast */
    .toast-msg {
        bottom: 12px;
        right: 12px;
        left: 12px;
        max-width: 100%;
    }
}

/* ── Overlay when sidebar is open on mobile ──── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.visible { display: block; }


/* ===== PROJECT CARDS ===== */
.project-card {
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04);
    border: 1px solid var(--border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.project-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.project-card-checkbox {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: rgba(255,255,255,0.95);
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.project-card-checkbox input {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Banner */
.project-card-banner {
    height: 160px;
    position: relative;
    overflow: hidden;
    background-size:cover;
    background-position: center;
    
}

.project-card-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.project-card-banner:hover img {
    transform: scale(1.03);
}

.project-card-banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0) 30%, rgba(0,0,0,0.65) 100%);
}

/* No banner gradient header */
.project-card-header {
    height: 100px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.project-card-header-circle-lg {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
}

.project-card-header-circle-sm {
    position: absolute;
    bottom: -30px;
    right: 40px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
}

/* Status pill */
.project-card-status {
    position: absolute;
    bottom: 12px;
    left: 12px;
}

.project-card-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: white;
}

.project-card-status-pill .dot {
    width: 5px;
    height: 5px;
    background: white;
    border-radius: 50%;
    opacity: 0.8;
}

.project-card-status-pill.solid {
    /* used on banner images */
}

.project-card-status-pill.glass {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.3);
}

/* Action buttons on card header */
.project-card-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 6px;
}

.project-card-action-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: opacity 0.15s;
}

.project-card-action-btn:hover { opacity: 0.85; text-decoration: none; }

.project-card-action-btn.light {
    background: rgba(255,255,255,0.95);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.project-card-action-btn.glass {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(8px);
    color: white;
}

.project-card-action-btn.edit   { color: var(--primary); }
.project-card-action-btn.trash  { color: var(--danger); }
.project-card-action-btn.restore { color: var(--success); }
.project-card-action-btn.delete { color: var(--danger); }

/* Card body */
.project-card-body {
    padding: 16px 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.project-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    display: block;
    line-height: 1.4;
    margin-bottom: 4px;
    text-decoration: none;
    transition: color 0.15s;
}

.project-card-title:hover {
    color: var(--primary);
    text-decoration: none;
}

.project-card-client {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.project-card-client-logo {
    width: 16px;
    height: 16px;
    object-fit: contain;
    border-radius: 3px;
    border: 1px solid var(--border);
}

.project-card-client-initial {
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 8px;
    font-weight: 700;
}

.project-card-tags {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.project-card-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.project-card-tag.phase {
    background: var(--primary-light);
    color: var(--primary);
}

/* ── Phase Tag Color Palettes ── */
.project-card-tag.phase[data-phase="contract_signed"] {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}
.project-card-tag.phase[data-phase="onboarding"] {
    background: #ecfeff;
    color: #0891b2;
    border: 1px solid #a5f3fc;
}
.project-card-tag.phase[data-phase="implementation"] {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}
.project-card-tag.phase[data-phase="review_testing"] {
    background: #f5f3ff;
    color: #7c3aed;
    border: 1px solid #ddd6fe;
}
.project-card-tag.phase[data-phase="deployment"] {
    background: #f0fdf4;
    color: #059669;
    border: 1px solid #a7f3d0;
}
.project-card-tag.phase[data-phase="support"] {
    background: #f0f9ff;
    color: #0284c7;
    border: 1px solid #bae6fd;
}
.project-card-tag.phase[data-phase="retainer"] {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}
.project-card-tag.phase[data-phase="on_hold"] {
    background: #f9fafb;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}
.project-card-tag.phase[data-phase="completed"] {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #86efac;
}

.project-card-dates {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11.5px;
    color: var(--text-muted);
}

.project-card-dates .overdue {
    color: var(--danger);
    font-weight: 600;
}

.project-card-budget {
    font-size: 12px;
    color: var(--text-muted);
}

.project-card-budget strong {
    color: var(--text);
}

/* Card footer */
.project-card-footer {
    padding: 10px 18px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.project-card-stats {
    display: flex;
    gap: 14px;
}

.project-card-stat {
    font-size: 11.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.project-card-stat i {
    font-size: 10px;
    color: var(--primary);
}

.project-card-open {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    transition: gap 0.15s;
}

.project-card-open:hover {
    gap: 8px;
    text-decoration: none;
}

.project-card-open i { font-size: 10px; }

/* Card grid */
.project-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 24px;
}

@media (max-width: 768px) {
    .project-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 16px;
    }
}

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

/* View toggle */
.view-toggle {
    display: flex;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius);
    overflow: hidden;
}

.view-toggle-btn {
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s, color 0.15s;
}

.view-toggle-btn.active {
    background: var(--primary);
    color: white;
}

.view-toggle-btn:not(.active) {
    background: var(--surface);
    color: var(--text-secondary);
}

.view-toggle-btn:not(.active):hover {
    background: var(--bg);
}