/* =====================================================
   CONTRACT TRACKER - Premium UI Theme
   Modern glassmorphism + gradient design system
   Admin-customizable colors via CSS variables
   ===================================================== */

:root {
    /* === ALL COLORS ARE OVERRIDDEN BY color_vars.php === */
    /* Fallback defaults (navy blue + off-white) */
    --bg-primary: #0a1628;
    --bg-secondary: #0d1b2a;
    --bg-card: #112240;
    --bg-card-hover: #162d4d;
    --bg-input: #0d1f35;

    --accent-indigo: #1e3a5f;
    --accent-indigo-light: #2a4f7a;
    --accent-indigo-dark: #1e40af;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --btn-gradient-start: #1e3a5f;
    --btn-gradient-end: #2a5a8f;
    --accent-light: #60a5fa;
    --accent-green: #10b981;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-orange: #f97316;
    --accent-red: #ef4444;
    --accent-rose: #f43f5e;
    --accent-purple: #a855f7;
    --accent-pink: #ec4899;

    --text-primary: #f0f4f8;
    --text-secondary: #b0c4de;
    --text-heading: #f0f4f8;
    --text-muted: #7a9cc6;

    --glass-bg: rgba(13, 27, 42, 0.75);
    --glass-border: rgba(59, 130, 246, 0.10);
    --border-color: rgba(59, 130, 246, 0.12);
    --border-glow: rgba(30, 58, 95, 0.3);

    --shadow-glow: 0 0 40px rgba(59, 130, 246, 0.15);
    --shadow-glow-color: rgba(59, 130, 246, 0.15);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-elevated: 0 20px 60px -15px rgba(0, 0, 0, 0.5);

    --sidebar-bg: #0d1b2a;
    --sidebar-text: #b0c4de;
    --sidebar-active-bg: #1e3a5f;
    --sidebar-active-text: #f0f4f8;
    --topbar-bg: #0d1b2a;
    --table-hover: rgba(59, 130, 246, 0.06);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --sidebar-width: 260px;
    --header-height: 70px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- RESET & BASE ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 20%, rgba(30, 58, 95, 0.05) 0%, transparent 50%),
                radial-gradient(ellipse at 40% 80%, rgba(6, 182, 212, 0.04) 0%, transparent 50%);
    z-index: -1;
    animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(2%, -2%) rotate(1deg); }
    66% { transform: translate(-1%, 1%) rotate(-0.5deg); }
}

a { color: var(--accent-blue); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-indigo-light); }

/* ---- LAYOUT ---- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition);
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--accent-indigo-dark); border-radius: 4px; }

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-blue));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 4px 15px var(--border-glow);
}

.sidebar-brand {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-heading), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 20px 12px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    cursor: pointer;
    border: 1px solid transparent;
    width: 100%;
    background: none;
    text-align: left;
}

.nav-item:hover {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    border-color: var(--border-color);
}

.nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    border-color: var(--border-color);
    box-shadow: 0 2px 10px var(--border-glow);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--accent-indigo);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    line-height: 1.4;
}

.nav-item .nav-badge.danger { background: var(--accent-red); }
.nav-item .nav-badge.warning { background: var(--accent-amber); }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--glass-border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--sidebar-active-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* ---- MAIN CONTENT ---- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- TOP HEADER ---- */
.top-header {
    height: var(--header-height);
    background: var(--topbar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-search {
    position: relative;
    width: 320px;
}

.header-search input {
    width: 100%;
    padding: 10px 16px 10px 42px;
    background: var(--bg-input);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    font-size: 13px;
    transition: all var(--transition);
    outline: none;
}

.header-search input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--border-glow);
}

.header-search input::placeholder { color: var(--text-muted); }

.header-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 16px;
    position: relative;
}

.header-btn:hover {
    background: var(--sidebar-active-bg);
    color: var(--text-primary);
    border-color: var(--border-glow);
}

.header-btn .dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--accent-red);
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
}

/* ---- PAGE CONTENT ---- */
.page-content {
    flex: 1;
    padding: 32px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--text-heading), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ---- STAT CARDS ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
    border-color: var(--border-glow);
}

.stat-card:nth-child(1)::before { background: linear-gradient(90deg, var(--accent-indigo), var(--accent-blue)); }
.stat-card:nth-child(2)::before { background: linear-gradient(90deg, var(--accent-green), var(--accent-emerald)); }
.stat-card:nth-child(3)::before { background: linear-gradient(90deg, var(--accent-orange), var(--accent-amber)); }
.stat-card:nth-child(4)::before { background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink)); }

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-card:nth-child(1) .stat-icon { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.stat-card:nth-child(2) .stat-icon { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.stat-card:nth-child(3) .stat-icon { background: rgba(249, 115, 22, 0.15); color: var(--accent-orange); }
.stat-card:nth-child(4) .stat-icon { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }

.stat-info h3 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.stat-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ---- CARDS ---- */
.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 24px;
    transition: all var(--transition);
}

.card:hover {
    border-color: var(--border-glow);
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.card-header h5 {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h5 i {
    color: var(--accent-blue);
}

.card-body { padding: 24px; }
.card-body.p-0 { padding: 0; }

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* ---- TABLES ---- */
.table-responsive { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: rgba(255, 255, 255, 0.03);
}

table thead th {
    padding: 14px 18px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
}

table tbody td {
    padding: 14px 18px;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background var(--transition);
}

table tbody tr:hover td {
    background: var(--table-hover);
    color: var(--text-primary);
}

table tbody tr:last-child td { border-bottom: none; }

/* ---- BADGES ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-primary { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.badge-info { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.badge-purple { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.5;
}

.btn-primary {
    background: linear-gradient(135deg, var(--btn-gradient-start), var(--btn-gradient-end));
    color: #fff;
    box-shadow: 0 4px 15px var(--border-glow);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-indigo-light), var(--btn-gradient-start));
    box-shadow: 0 6px 25px var(--border-glow);
    color: #fff;
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-green), #059669);
    color: #fff;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}
.btn-success:hover { color: #fff; transform: translateY(-1px); }

.btn-danger {
    background: linear-gradient(135deg, var(--accent-red), #dc2626);
    color: #fff;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { color: #fff; }

.btn-warning {
    background: linear-gradient(135deg, var(--accent-amber), #d97706);
    color: #fff;
}
.btn-warning:hover { color: #fff; }

.btn-outline {
    background: transparent;
    border-color: var(--glass-border);
    color: var(--text-secondary);
}
.btn-outline:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.05);
}

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; }

/* ---- FORMS ---- */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 11px 16px;
    background: var(--bg-input);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition);
    outline: none;
    font-family: inherit;
}

.form-control:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--border-glow);
}

.form-control::placeholder { color: var(--text-muted); }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%237a9cc6' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 100px; }

/* ---- ALERTS ---- */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success { background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.2); color: var(--accent-emerald); }
.alert-danger { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.2); color: var(--accent-red); }
.alert-warning { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.2); color: var(--accent-amber); }
.alert-info { background: rgba(6, 182, 212, 0.1); border-color: rgba(6, 182, 212, 0.2); color: var(--accent-cyan); }

/* ---- EMPTY STATE ---- */
.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
    opacity: 0.4;
}

.empty-state p { font-size: 14px; }

/* ---- PAGINATION ---- */
.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 16px 24px;
}

.pagination a, .pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    transition: all var(--transition);
}

.pagination a:hover { border-color: var(--accent-blue); color: var(--accent-blue); }
.pagination .active { background: var(--accent-indigo); border-color: var(--accent-indigo); color: #fff; }

/* ---- MODAL ---- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-elevated);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 { font-size: 18px; font-weight: 600; }

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.modal-close:hover { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

.modal-body { padding: 24px; }

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ---- PROGRESS BAR ---- */
.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar .fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s ease;
}

/* ---- LOGIN PAGE ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.login-wrapper::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 30% 40%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 60%, rgba(30, 58, 95, 0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 50% 80%, rgba(6, 182, 212, 0.04) 0%, transparent 50%);
    z-index: -1;
}

.login-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-elevated);
    animation: modalIn 0.5s ease;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-blue));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    margin: 0 auto 20px;
    box-shadow: 0 8px 30px var(--border-glow);
}

.login-title {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 32px;
}

.login-card .form-group { margin-bottom: 16px; }

.login-card .form-label { font-size: 12px; }

.login-card .btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 14px;
    margin-top: 8px;
}

/* ---- REPORT / ANALYTICS ---- */
.chart-container {
    height: 300px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 20px 0;
}

.chart-bar {
    flex: 1;
    border-radius: 6px 6px 0 0;
    min-height: 4px;
    position: relative;
    transition: all var(--transition);
}

.chart-bar:hover {
    filter: brightness(1.3);
    transform: scaleY(1.02);
    transform-origin: bottom;
}

.chart-labels {
    display: flex;
    gap: 12px;
    justify-content: space-around;
    padding: 0 0 8px;
    border-bottom: 1px solid var(--glass-border);
}

.chart-labels span {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    flex: 1;
}

/* ---- FILTER BAR ---- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.filter-bar .form-control {
    width: auto;
    min-width: 180px;
}

/* ---- ACTIONS CELL ---- */
.actions { display: flex; gap: 6px; }

/* ---- TOAST ---- */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.4s ease;
    backdrop-filter: blur(10px);
    border: 1px solid;
    min-width: 300px;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast-success { background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.25); color: var(--accent-emerald); }
.toast-error { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.25); color: var(--accent-red); }

/* ---- SEARCH RESULTS BAR ---- */
.search-results-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    margin-bottom: 16px;
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    flex-wrap: wrap;
    gap: 8px;
}

.search-results-bar .search-count {
    font-weight: 600;
    color: var(--accent-blue);
}

.search-results-bar .search-query {
    font-weight: 600;
    color: var(--text-primary);
}

/* ---- MOBILE SEARCH OVERLAY ---- */
.mobile-search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 150;
    padding: 16px;
    flex-direction: column;
    gap: 16px;
}

.mobile-search-overlay.active {
    display: flex;
}

.mobile-search-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-search-header .form-control {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px; /* Prevents iOS zoom */
}

.mobile-search-close {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    flex-shrink: 0;
}

.mobile-search-results {
    flex: 1;
    overflow-y: auto;
}

.mobile-search-results .search-result-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-primary);
    text-decoration: none;
    transition: background var(--transition);
    border-radius: var(--radius-sm);
}

.mobile-search-results .search-result-item:hover,
.mobile-search-results .search-result-item:active {
    background: var(--table-hover);
}

.mobile-search-results .search-result-item .result-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: rgba(59, 130, 246, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-blue);
    flex-shrink: 0;
}

.mobile-search-results .search-result-item .result-info {
    flex: 1;
    min-width: 0;
}

.mobile-search-results .search-result-item .result-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-search-results .search-result-item .result-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- CONTRACT CARDS (Mobile) ---- */
.contract-cards {
    display: none;
}

.contract-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    transition: all var(--transition);
}

.contract-card:active {
    transform: scale(0.98);
}

.contract-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 10px;
}

.contract-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.contract-card-id {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.contract-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.contract-card-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.contract-card-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.contract-card-value {
    font-size: 13px;
    color: var(--text-secondary);
}

.contract-card-value.amount {
    color: var(--accent-emerald);
    font-weight: 600;
}

.contract-card-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--glass-border);
}

.contract-card-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 10px 12px;
    min-height: 40px;
}

/* ---- SKELETON LOADING ---- */
.skeleton {
    background: linear-gradient(90deg, var(--glass-bg) 25%, var(--bg-card-hover) 50%, var(--glass-bg) 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeletonPulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-card {
    height: 120px;
    margin-bottom: 12px;
}

/* ---- IMPROVED FILTER BAR ---- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
}

.filter-bar .form-control {
    width: auto;
    min-width: 180px;
}

.filter-bar-search {
    display: flex;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.filter-bar-search .form-control {
    flex: 1;
    min-width: 0;
}

.filter-bar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---- MOBILE RESPONSIVE ---- */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-elevated); }
    .main-content { margin-left: 0; }
    .header-search { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .two-col { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .page-content { padding: 20px; }
    .mobile-toggle { display: flex !important; }
    body.sidebar-open::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }

    /* Show mobile search button */
    .mobile-search-btn { display: flex !important; }

    /* Contract cards instead of table */
    .table-responsive { display: none; }
    .contract-cards { display: block; }

    /* Filter bar stacks */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
    }
    .filter-bar-search {
        min-width: 0;
    }
    .filter-bar-actions {
        justify-content: stretch;
    }
    .filter-bar-actions .btn {
        flex: 1;
        justify-content: center;
    }
    .filter-bar .form-control {
        width: 100%;
        min-width: 0;
    }

    /* Search results bar full width */
    .search-results-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}

.mobile-toggle {
    display: none !important;
}

.mobile-search-btn {
    display: none !important;
}

@media (max-width: 576px) {
    .stats-grid { grid-template-columns: 1fr; }
    .page-content { padding: 12px; }
    .top-header { padding: 0 16px; }
    .contract-card-body { grid-template-columns: 1fr; }
    .filter-bar-actions {
        flex-direction: column;
    }
    .filter-bar-actions .btn {
        width: 100%;
    }
    .stat-card { padding: 18px; }
    .stat-info h3 { font-size: 22px; }
    .stat-icon { width: 44px; height: 44px; font-size: 18px; }
}

/* ---- TOUCH-FRIENDLY IMPROVEMENTS ---- */
@media (hover: none) and (pointer: coarse) {
    .btn { min-height: 44px; }
    .btn-sm { min-height: 36px; padding: 8px 16px; }
    .nav-item { padding: 14px 14px; min-height: 48px; }
    .form-control { min-height: 44px; font-size: 16px; }
    .header-btn { width: 44px; height: 44px; }
}

/* ---- LIVE SEARCH LOADING STATE ---- */
.search-loading {
    position: relative;
    pointer-events: none;
}
.search-loading::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 22, 40, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

/* ---- NO RESULTS ILLUSTRATION ---- */
.no-results {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}
.no-results .no-results-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
    display: block;
}
.no-results h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.no-results p {
    font-size: 14px;
    color: var(--text-muted);
    max-width: 320px;
    margin: 0 auto 20px;
}

/* ---- STAT CARD EXTRA INFO ---- */
.stat-card .stat-trend {
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.stat-card .stat-trend.up { color: var(--accent-emerald); }
.stat-card .stat-trend.down { color: var(--accent-red); }
.stat-card .stat-trend.neutral { color: var(--text-muted); }

/* ---- FILTER BAR COLLAPSIBLE ---- */
.filter-bar-toggle {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}
.filter-bar-toggle:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

@media (max-width: 768px) {
    .filter-bar-toggle { display: inline-flex; }
    .filter-bar .filter-bar-search,
    .filter-bar .filter-bar-actions {
        display: none;
    }
    .filter-bar.expanded .filter-bar-search,
    .filter-bar.expanded .filter-bar-actions {
        display: flex;
    }
    .filter-bar.expanded {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ---- DASHBOARD SEARCH DROPDOWN ---- */
.dashboard-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-elevated);
    z-index: 60;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}
.dashboard-search-results.active {
    display: block;
}
.dashboard-search-results .dsr-header {
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
}
.dashboard-search-results .dsr-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background var(--transition);
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.dashboard-search-results .dsr-item:hover {
    background: var(--table-hover);
}
.dashboard-search-results .dsr-item .dsr-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: rgba(59, 130, 246, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-blue);
    font-size: 14px;
    flex-shrink: 0;
}
.dashboard-search-results .dsr-item .dsr-info {
    flex: 1;
    min-width: 0;
}
.dashboard-search-results .dsr-item .dsr-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dashboard-search-results .dsr-item .dsr-sub {
    font-size: 11px;
    color: var(--text-muted);
}
.dashboard-search-results .dsr-item .dsr-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    flex-shrink: 0;
}
.dashboard-search-results .dsr-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}
.dashboard-search-results .dsr-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--glass-border);
    text-align: center;
}
.dashboard-search-results .dsr-footer a {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-blue);
}

/* ---- MOBILE BOTTOM NAV ---- */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--topbar-bg);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    z-index: 80;
    padding: 8px 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
}
.mobile-bottom-nav .mbn-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
}
.mobile-bottom-nav .mbn-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    transition: color var(--transition);
    min-width: 56px;
}
.mobile-bottom-nav .mbn-item i {
    font-size: 20px;
}
.mobile-bottom-nav .mbn-item.active {
    color: var(--accent-blue);
}
.mobile-bottom-nav .mbn-item:active {
    transform: scale(0.92);
}

@media (max-width: 992px) {
    .mobile-bottom-nav { display: block; }
    .main-content { padding-bottom: 70px; }
}

/* ---- SMOOTH SCROLL ---- */
html { scroll-behavior: smooth; }

/* ---- FADE IN ANIMATION ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in-up {
    animation: fadeInUp 0.4s ease forwards;
}

/* ---- PULSE DOT (notification) ---- */
@keyframes pulseDot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}
.header-btn .dot {
    animation: pulseDot 2s ease-in-out infinite;
}

/* =====================================================
   GMAIL OAUTH LOGIN STYLES
   ===================================================== */

/* Login page container */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-primary);
    position: relative;
}

.login-container::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 20%, rgba(30, 58, 95, 0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 40% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 50%);
    z-index: 0;
    animation: bgFloat 20s ease-in-out infinite;
}

.login-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    padding: 40px 36px;
    box-shadow: var(--shadow-elevated);
    position: relative;
    z-index: 1;
    animation: modalIn 0.4s ease;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-blue));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin: 0 auto 20px;
    box-shadow: 0 8px 30px var(--border-glow);
}

.login-title {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 6px;
}

.login-subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Divider: "or" between password login and Google */
.login-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

/* Gmail login button */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px 20px;
    background: #fff;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
}

.btn-google:hover {
    background: #f7f8f8;
    border-color: #d2e3fc;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.15);
    color: #3c4043;
    transform: translateY(-1px);
}

.btn-google:active {
    transform: translateY(0);
}

.google-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Login footer */
.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
    font-size: 12px;
    color: var(--text-muted);
}
