/* ============================================================
   Modern Law Group — Client Portal & CRM
   Clean, modern CSS — 2026 aesthetic
   Colors: Navy #1B365D, Blue #4A90D9, Gold #D4A843, White
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --navy: #1B365D;
    --navy-light: #254a7a;
    --navy-dark: #0f2440;
    --blue: #4A90D9;
    --blue-light: #6ba3e0;
    --blue-pale: #e8f0fb;
    --gold: #D4A843;
    --gold-light: #f0ddb3;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --red: #ef4444;
    --red-light: #fef2f2;
    --green: #22c55e;
    --green-light: #f0fdf4;
    --amber: #f59e0b;
    --amber-light: #fffbeb;
    --purple: #8b5cf6;
    --purple-light: #f5f3ff;

    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);

    --sidebar-width: 260px;
    --topbar-height: 64px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--navy); }

img { max-width: 100%; height: auto; }

/* --- Login Page --- */
.login-page {
    display: flex;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 50%, var(--navy-light) 100%);
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-container {
    width: 100%;
    max-width: 440px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 3rem 2.5rem;
    box-shadow: var(--shadow-xl);
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: var(--navy);
    color: var(--gold);
    font-weight: 800;
    font-size: 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    letter-spacing: 1px;
}

.login-brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 0.25rem;
}

.login-brand p {
    color: var(--gray-500);
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.4rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--gray-800);
    transition: border-color var(--transition), box-shadow var(--transition);
    background: var(--white);
}

.form-input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

.form-input::placeholder { color: var(--gray-400); }

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

textarea.form-input {
    min-height: 100px;
    resize: vertical;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--navy);
    color: var(--white);
}
.btn-primary:hover { background: var(--navy-light); color: var(--white); }

.btn-blue {
    background: var(--blue);
    color: var(--white);
}
.btn-blue:hover { background: var(--blue-light); color: var(--white); }

.btn-gold {
    background: var(--gold);
    color: var(--navy);
}
.btn-gold:hover { background: #c49a38; color: var(--navy); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--gray-300);
    color: var(--gray-700);
}
.btn-outline:hover { border-color: var(--navy); color: var(--navy); }

.btn-danger {
    background: var(--red);
    color: var(--white);
}
.btn-danger:hover { background: #dc2626; color: var(--white); }

.btn-success {
    background: var(--green);
    color: var(--white);
}
.btn-success:hover { background: #16a34a; color: var(--white); }

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 1.75rem; font-size: 1rem; }
.btn-full { width: 100%; }
.btn-icon { padding: 0.5rem; min-width: 36px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Alert / Flash --- */
.alert {
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.alert-danger { background: var(--red-light); color: var(--red); border-left: 3px solid var(--red); }
.alert-success { background: var(--green-light); color: #15803d; border-left: 3px solid var(--green); }
.alert-warning { background: var(--amber-light); color: #b45309; border-left: 3px solid var(--amber); }
.alert-info { background: var(--blue-pale); color: var(--navy); border-left: 3px solid var(--blue); }

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

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--navy);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition);
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    position: absolute;
    top: 1rem;
    right: 1rem;
}

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

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--gold);
    color: var(--navy);
    font-weight: 800;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; }
.brand-name { font-weight: 700; font-size: 0.9rem; line-height: 1.2; }
.brand-sub { font-size: 0.7rem; opacity: 0.6; }

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    color: rgba(255,255,255,0.7);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
}
.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: var(--white);
}
.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: var(--white);
    font-weight: 600;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.25rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--gold);
    color: var(--navy);
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-name { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.7rem; opacity: 0.6; }

.logout-link { color: rgba(255,255,255,0.5); font-size: 0.85rem; }
.logout-link:hover { color: var(--red); background: rgba(239,68,68,0.1); }

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-bar {
    height: var(--topbar-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-600);
    padding: 0.25rem;
}

.page-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--navy);
}

.top-bar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-bar-time {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.content-area {
    flex: 1;
    padding: 1.5rem;
    max-width: 1400px;
    width: 100%;
}

/* --- Cards --- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--navy);
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
}

/* --- Stat Cards / Dashboard --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; }

.stat-icon.blue { background: var(--blue-pale); color: var(--blue); }
.stat-icon.gold { background: var(--gold-light); color: var(--gold); }
.stat-icon.green { background: var(--green-light); color: var(--green); }
.stat-icon.purple { background: var(--purple-light); color: var(--purple); }
.stat-icon.red { background: var(--red-light); color: var(--red); }
.stat-icon.navy { background: rgba(27,54,93,0.1); color: var(--navy); }

.stat-content {}
.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--navy);
    line-height: 1.2;
}
.stat-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 500;
}

/* --- Grid Layout --- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-sidebar { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }

/* --- Tables --- */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: var(--gray-50);
}

.data-table .client-name {
    font-weight: 600;
    color: var(--navy);
}

.data-table .client-email {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-blue { background: var(--blue-pale); color: var(--blue); }
.badge-navy { background: rgba(27,54,93,0.1); color: var(--navy); }
.badge-green { background: var(--green-light); color: #15803d; }
.badge-gold { background: var(--gold-light); color: #92600e; }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-amber { background: var(--amber-light); color: #b45309; }

/* --- Search / Filter Bar --- */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-bar .form-input,
.filter-bar .form-select {
    max-width: 220px;
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
}

.search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.search-input-wrap .form-input {
    padding-left: 2.5rem;
    max-width: 100%;
}

.search-input-wrap svg {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--gray-400);
}

/* --- Status Progress Bar (Client Portal) --- */
.progress-tracker {
    display: flex;
    gap: 0;
    margin: 1.5rem 0;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 80px;
    position: relative;
}

.progress-step::before {
    content: '';
    position: absolute;
    top: 16px;
    left: -50%;
    width: 100%;
    height: 3px;
    background: var(--gray-200);
    z-index: 0;
}

.progress-step:first-child::before { display: none; }

.progress-step.completed::before { background: var(--green); }
.progress-step.active::before { background: var(--blue); }

.progress-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-500);
}

.progress-step.completed .progress-dot {
    background: var(--green);
    color: var(--white);
}

.progress-step.active .progress-dot {
    background: var(--blue);
    color: var(--white);
    box-shadow: 0 0 0 4px rgba(74,144,217,0.2);
}

.progress-label {
    font-size: 0.7rem;
    color: var(--gray-500);
    text-align: center;
    margin-top: 0.5rem;
    line-height: 1.2;
}

.progress-step.completed .progress-label { color: var(--green); font-weight: 600; }
.progress-step.active .progress-label { color: var(--blue); font-weight: 700; }

/* --- Detail Page Layout --- */
.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.detail-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.detail-avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    background: var(--navy);
    color: var(--gold);
    font-weight: 800;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.detail-name { font-size: 1.5rem; font-weight: 800; color: var(--navy); line-height: 1.2; }
.detail-sub { font-size: 0.85rem; color: var(--gray-500); display: flex; align-items: center; gap: 0.5rem; }

.detail-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* --- Info Grid --- */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.info-item {}
.info-label { font-size: 0.75rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.15rem; }
.info-value { font-size: 0.95rem; color: var(--gray-800); font-weight: 500; }

/* --- Notes / Timeline --- */
.note-list { }
.note-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--gray-100);
}
.note-item:last-child { border-bottom: none; }

.note-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.note-author {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--navy);
}

.note-date {
    font-size: 0.75rem;
    color: var(--gray-400);
}

.note-content {
    font-size: 0.9rem;
    color: var(--gray-700);
    line-height: 1.5;
}

.note-form {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}
.note-form .form-input { flex: 1; min-height: 60px; }

/* --- Upload List --- */
.upload-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--gray-100);
}
.upload-item:last-child { border-bottom: none; }

.upload-icon {
    width: 36px;
    height: 36px;
    background: var(--blue-pale);
    color: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
}

.upload-name { font-size: 0.85rem; font-weight: 500; }
.upload-date { font-size: 0.75rem; color: var(--gray-400); }

/* --- Message Thread --- */
.message-item {
    padding: 0.85rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-sm);
    background: var(--gray-50);
}

.message-item.from-staff {
    background: var(--blue-pale);
    margin-left: 2rem;
}

.message-item.from-client {
    margin-right: 2rem;
}

.message-from { font-weight: 600; font-size: 0.85rem; }
.message-subject { font-weight: 600; font-size: 0.85rem; color: var(--navy); margin-bottom: 0.25rem; }
.message-body { font-size: 0.85rem; color: var(--gray-700); line-height: 1.5; }
.message-date { font-size: 0.7rem; color: var(--gray-400); margin-top: 0.25rem; }

/* --- Lead Pipeline / Kanban --- */
.pipeline-view {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.pipeline-column {
    min-width: 280px;
    flex: 1;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.pipeline-header {
    padding: 0.85rem 1rem;
    font-weight: 700;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pipeline-count {
    background: var(--gray-200);
    color: var(--gray-600);
    font-size: 0.75rem;
    padding: 0.1rem 0.5rem;
    border-radius: 9999px;
}

.pipeline-cards {
    padding: 0.5rem;
    min-height: 200px;
}

.pipeline-card {
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all var(--transition);
}
.pipeline-card:hover { box-shadow: var(--shadow-md); border-color: var(--blue); }

.pipeline-card-name { font-weight: 600; font-size: 0.9rem; color: var(--navy); margin-bottom: 0.25rem; }
.pipeline-card-detail { font-size: 0.8rem; color: var(--gray-500); }
.pipeline-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 0.5rem; }

/* --- Tabs --- */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 1.25rem;
    overflow-x: auto;
}

.tab-item {
    padding: 0.65rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-500);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    font-family: inherit;
}

.tab-item:hover { color: var(--navy); }
.tab-item.active { color: var(--navy); border-bottom-color: var(--navy); }

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

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}
.modal-overlay.show { opacity: 1; visibility: visible; }

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s;
}
.modal-overlay.show .modal { transform: translateY(0); }

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--gray-400); }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 0.5rem; }

/* --- Sort Links --- */
.sort-link {
    color: var(--navy);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}
.sort-link:hover { color: var(--gold); }
.sort-icon { font-size: 0.8rem; opacity: 0.35; }
.sort-icon.active { opacity: 1; color: var(--gold); }

/* --- Form Group inside Modals --- */
.form-group { margin-bottom: 0.85rem; }
.form-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--gray-700); margin-bottom: 0.3rem; }

/* --- Pagination --- */
.pagination {
    display: flex;
    gap: 0.25rem;
    margin-top: 1.25rem;
    justify-content: center;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition);
}

.pagination a { color: var(--gray-600); background: var(--white); border: 1px solid var(--gray-200); }
.pagination a:hover { background: var(--gray-100); color: var(--navy); }
.pagination .current { background: var(--navy); color: var(--white); border: none; }

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-400);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 1rem; opacity: 0.5; }
.empty-state p { font-size: 0.95rem; }

/* --- Utility --- */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.text-navy { color: var(--navy); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-gold { color: var(--gold); }
.text-blue { color: var(--blue); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-sm { gap: 0.25rem; }
.nowrap { white-space: nowrap; }

/* --- Footer --- */
.site-footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.75rem;
    color: var(--gray-400);
    border-top: 1px solid var(--gray-100);
}

/* --- Financial Bar Chart (simple CSS) --- */
.bar-chart { display: flex; flex-direction: column; gap: 0.5rem; }
.bar-row { display: flex; align-items: center; gap: 0.75rem; }
.bar-label { font-size: 0.8rem; color: var(--gray-600); width: 120px; flex-shrink: 0; text-align: right; }
.bar-track { flex: 1; height: 24px; background: var(--gray-100); border-radius: var(--radius-sm); overflow: hidden; position: relative; }
.bar-fill { height: 100%; border-radius: var(--radius-sm); display: flex; align-items: center; padding-left: 0.5rem; font-size: 0.75rem; font-weight: 600; color: var(--white); min-width: 30px; }
.bar-fill.blue { background: var(--blue); }
.bar-fill.green { background: var(--green); }
.bar-fill.gold { background: var(--gold); color: var(--navy); }
.bar-fill.red { background: var(--red); }
.bar-fill.navy { background: var(--navy); }

/* --- Workload --- */
.workload-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--gray-100);
}
.workload-item:last-child { border-bottom: none; }
.workload-name { font-weight: 600; font-size: 0.9rem; flex: 1; }
.workload-count { font-size: 1.1rem; font-weight: 800; color: var(--navy); }

/* --- Responsive --- */
@media (max-width: 1024px) {
    .grid-2, .grid-3, .grid-sidebar {
        grid-template-columns: 1fr;
    }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-close { display: block; }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .content-area { padding: 1rem; }
    .stats-grid { grid-template-columns: 1fr; }
    .filter-bar .form-input,
    .filter-bar .form-select {
        max-width: 100%;
    }
    .search-input-wrap { max-width: 100%; }
    .pipeline-view { flex-direction: column; }
    .pipeline-column { min-width: 100%; }
    .data-table { font-size: 0.8rem; }
    .data-table th, .data-table td { padding: 0.5rem 0.65rem; }
    .detail-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    html { font-size: 14px; }
    .login-card { padding: 2rem 1.5rem; }
    .progress-tracker { flex-wrap: wrap; }
}

/* Form grid for add-lead */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
@media (max-width: 768px) {
    .form-grid-2 { grid-template-columns: 1fr; }
}
.text-danger { color: var(--red); }
.text-amber { color: #d97706; }
.lead-form .card { margin-bottom: 1.5rem; }
.lead-form .form-group { margin-bottom: 0.75rem; }
