:root {
    /* Light Mode - Teal & Warm */
    --primary-color: #115e59;
    --secondary-color: #0d9488;
    --accent-color: #14b8a6;
    --bg-color: #e2e8f0;
    /* Cool Grey 100 - Better contrast with white cards */
    --sidebar-bg: #0c4a6e;
    --card-bg: #ffffff;
    --text-primary: #1c1917;
    --text-secondary: #57534e;
    --white: #ffffff;
    --border-color: #e7e5e4;
    --input-bg: #fafaf9;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.6);
    --item-bg: #f5f5f4;
    --secondary-btn-bg: #f5f5f4;
    --secondary-btn-text: #292524;
    --upload-border: #a8a29e;
    --upload-hover: #ecfdf5;
}

body.dark-mode {
    /* Dark Mode - Premium Midnight */
    --primary-color: #38bdf8;
    /* Sky 400 - Glowing Blue */
    --secondary-color: #0ea5e9;
    /* Sky 500 */
    --accent-color: #7dd3fc;
    /* Sky 300 */
    --bg-color: #0f172a;
    /* Slate 900 - Deep Rich Background */
    --sidebar-bg: #020617;
    /* Slate 950 - Almost Black */
    --card-bg: #1e293b;
    /* Slate 800 - Lighter Blue-Grey */
    --text-primary: #f8fafc;
    /* Slate 50 - Soft White */
    --text-secondary: #94a3b8;
    /* Slate 400 - Muted Text */
    --white: #1e293b;
    /* Re-map 'white' to card bg for consistency */
    --border-color: #334155;
    /* Slate 700 */
    --input-bg: #020617;
    --success-color: #4ade80;
    /* Green 400 */
    --warning-color: #facc15;
    /* Yellow 400 */
    --error-color: #f87171;
    /* Red 400 */
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);
    --item-bg: #334155;
    --secondary-btn-bg: #334155;
    --secondary-btn-text: #f1f5f9;
    --upload-border: #475569;
    --upload-hover: #1e293b;
}

/* Fix for stark white dashboard buttons in dark mode */
body.dark-mode .btn-card {
    background-color: rgba(56, 189, 248, 0.1);
    /* Transparent Blue */
    color: #38bdf8;
    /* Glowing Text */
    border-color: #1e40af;
    /* Dark Blue Border */
    transition: all 0.3s ease;
}

body.dark-mode .btn-card:hover {
    background-color: #38bdf8;
    color: #0f172a;
    /* Dark text on hover */
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.btn-card {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--secondary-btn-bg);
    color: var(--secondary-btn-text);
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 600;
    margin-top: 1.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.btn-card:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--item-bg) 25%, var(--border-color) 50%, var(--item-bg) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    display: inline-block;
    height: 1em;
    width: 100%;
}

.skeleton-text {
    height: 0.8rem;
    width: 70%;
}

.skeleton-badge {
    height: 1.5rem;
    width: 60px;
    border-radius: 1rem;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.file-item-new {
    animation: slideInRight 0.3s ease-out forwards;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    /* Reduced from 280px */
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, #0d1117 100%);
    color: var(--white);
    display: flex;
    flex-direction: column;
    padding: 1rem 0.5rem;
    z-index: 100;
    transition: width 0.3s ease;
    position: relative;
    /* For absolute toggle */
}

#sidebar-toggle {
    position: absolute;
    top: 1rem;
    right: -15px;
    /* Hang outside */
    background: var(--sidebar-bg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--white);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 9999;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
}

#sidebar-toggle:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

.sidebar.collapsed {
    width: 70px;
    padding: 1rem 0.5rem;
}

.sidebar.collapsed .logo-container,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .sidebar-footer {
    display: none;
}

.sidebar.collapsed .sidebar-nav a {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .sidebar-nav a i {
    margin-right: 0;
    font-size: 1.2rem;
}

.sidebar.collapsed #sidebar-toggle i {
    transform: rotate(180deg);
}

.logo-container {
    padding-bottom: 1rem;
    text-align: center;
}

.sidebar-logo {
    width: 140px;
    /* Reduced */
    height: auto;
    margin-bottom: 0.5rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.logo-text {
    font-size: 1.4rem;
    /* Reduced */
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #ffffff 0%, #a0aec0 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
    /* Compact */
    color: #a0aec0;
    text-decoration: none;
    border-radius: 0.5rem;
    margin-bottom: 0.25rem;
    /* Compact */
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
    /* Prevent line breaks */
    overflow: hidden;
}

.sidebar-nav a i {
    margin-right: 0.75rem;
    font-size: 1rem;
    min-width: 20px;
    text-align: center;
}

/* ... existing hover styles ... */
.sidebar-nav a:hover,
.sidebar-nav a.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.sidebar-nav a.active {
    background: linear-gradient(90deg, var(--secondary-color) 0%, var(--accent-color) 100%);
    box-shadow: 0 4px 15px rgba(43, 108, 176, 0.4);
}

.sidebar-footer {
    padding-top: 1rem;
    font-size: 0.75rem;
    color: #4a5568;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
}

.top-header {
    padding: 2rem 3rem;
    background-color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid var(--border-color);
}

/* --- Neon Theme Toggle (Premium Pill Design) --- */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    margin-right: 1.5rem;
}

.theme-switch {
    display: inline-block;
    height: 38px;
    position: relative;
    width: 80px;
}

.theme-switch input {
    display: none;
}

.switch-slider {
    background-color: var(--card-bg);
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
    border-radius: 34px;
    border: 2px solid var(--border-color);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.switch-slider:before {
    background-color: white;
    bottom: 4px;
    content: "";
    height: 30px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 30px;
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
}

/* Icons for the slider handle */
.switch-handle-icons {
    position: absolute;
    top: 50%;
    left: 4px;
    width: 30px;
    height: 30px;
    transform: translateY(-50%);
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: .4s;
    pointer-events: none;
}

.switch-handle-icons i {
    font-size: 16px;
    color: #4a5568;
}

/* "ON" Text */
.switch-text-on {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    font-weight: 800;
    color: transparent;
    transition: .4s;
    text-transform: uppercase;
    pointer-events: none;
}

/* "OFF" Text - not shown in original but good for UX */
.switch-text-off {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    font-weight: 800;
    color: var(--text-secondary);
    transition: .4s;
    text-transform: uppercase;
    pointer-events: none;
    opacity: 0.5;
}

/* --- Dark Mode Active State --- */
input:checked+.switch-slider {
    background-color: #1a1f35;
    border: 2px solid #00d2ff;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.3), inset 0 0 10px rgba(0, 210, 255, 0.2);
}

input:checked+.switch-slider:before {
    transform: translateX(42px);
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.6);
}

input:checked+.switch-slider .switch-handle-icons {
    transform: translate(42px, -50%);
}

input:checked+.switch-slider .switch-handle-icons i {
    color: white;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

input:checked+.switch-slider .switch-text-on {
    color: #00d2ff;
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.8);
}

input:checked+.switch-slider .switch-text-off {
    opacity: 0;
}

/* Hover effects */
.theme-switch:hover .switch-slider {
    border-color: var(--secondary-color);
}

body.dark-mode .theme-switch:hover .switch-slider {
    border-color: #00d2ff;
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.5), inset 0 0 15px rgba(0, 210, 255, 0.3);
}


.header-info h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
}

.header-info p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.avatar {
    width: 45px;
    height: 45px;
    background-color: #edf2f7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    border: 2px solid var(--white);
    box-shadow: 0 0 0 2px var(--accent-color);
}

.content-wrapper {
    padding: 1.5rem;
    /* Reduced padding for better space usage */
    width: 100%;
    /* Full width */
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: 0.75rem;
    /* Reduced radius */
    padding: 1rem;
    /* Reduced padding */
    box-shadow: var(--card-shadow);
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

.card h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
}

.card h3 i {
    margin-right: 0.75rem;
    color: var(--secondary-color);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.stat-card {
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* --- PREMIUM UI COMPONENTS --- */

/* Dashboard Grid */
.summary-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric-card {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    position: relative;
    overflow: hidden;
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: var(--secondary-color);
}

.department-dashboard {
    animation: fadeIn 0.5s ease-out;
}

.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin: 0.25rem 0;
}

.metric-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.metric-trend {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-secondary);
}

.metric-trend.up { color: var(--success-color); }
.metric-trend.down { color: var(--error-color); }

.dashboard-main-grid {
    display: grid;
    gap: 1rem;
}

.metric-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.metric-card:hover::after {
    transform: translateX(100%);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-up {
    animation: fadeInUp 0.5s ease-out forwards;
}

/* Circular Chart */
.circular-chart {
    width: 64px;
    /* Reduced from 80px */
    height: 64px;
    border-radius: 50%;
    background: conic-gradient(var(--secondary-color) 0%, #e2e8f0 0%);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    /* transition: background 0.5s ease; works but not for gradients */
    margin-left: auto;
    /* Push to right if in flex container */
}

/* Inner white circle to make it a donut */
.circular-chart::before {
    content: '';
    position: absolute;
    width: 50px;
    /* Reduced from 64px */
    height: 50px;
    background: var(--card-bg);
    border-radius: 50%;
}

/* Text inside */
.circular-chart span {
    position: relative;
    z-index: 1;
    font-size: 0.9rem !important;
    /* Reduced from 1.1rem */
    /* Override .metric-card span size if needed */
    font-weight: 700;
    color: var(--text-primary);
}

.metric-card h4 {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-card span {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Icon Boxes */
.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-box-blue {
    background: #e0f2fe;
    color: #0284c7;
}

.icon-box-green {
    background: #dcfce7;
    color: #166534;
}

.icon-box-yellow {
    background: #fef9c3;
    color: #854d0e;
}

/* Dark Mode Table Overrides */
body.dark-mode th {
    background-color: rgba(15, 23, 42, 0.4);
    /* Darker, semi-transparent */
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

body.dark-mode td {
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

body.dark-mode tr:hover td {
    background-color: var(--item-bg);
}

/* Adjust button shadow in dark mode for cleaner look */
body.dark-mode .btn.primary {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* Dark Mode Icon Box Overrides */
body.dark-mode .icon-box-blue {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
}

body.dark-mode .icon-box-green {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
}

body.dark-mode .icon-box-yellow {
    background: rgba(250, 204, 21, 0.2);
    color: #facc15;
}

/* Split Layout */
.upload-grid-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 1rem;
    align-items: start;
}

.hero-drop-zone {
    border: 2px dashed var(--secondary-color);
    background: #f0fdfa;
    /* Light mode default */
    padding: 1rem;
    border-radius: 12px;
    transition: all 0.2s;
    cursor: pointer;
    text-align: center;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

body.dark-mode .hero-drop-zone {
    background: rgba(15, 23, 42, 0.5);
    /* Dark mode bg */
    border-color: var(--border-color);
}

.hero-drop-zone:hover {
    border-color: var(--primary-color);
    background: rgba(13, 148, 136, 0.05);
}

.icon-circle-floating {
    background: var(--white);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

body.dark-mode .icon-circle-floating {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

.icon-circle-floating i {
    color: var(--primary-color);
}

.hero-drop-zone h4 {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.hero-drop-zone p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

/* File List Column */
.file-list-column {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.section-title {
    margin: 0 0 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.file-list-container {
    flex: 1;
    min-height: 80px;
    max-height: 180px;
    overflow-y: auto;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    margin-bottom: 1rem;
}

body.dark-mode .file-list-container {
    background: var(--input-bg);
}

.empty-state-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 1.5rem;
}

.drop-zone-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.drop-zone-actions button {
    font-size: 0.8rem;
    padding: 4px 8px;
}




.card-icon {
    font-size: 2rem;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e0f2ff 0%, #bae3ff 100%);
    color: #2b6cb0;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(66, 153, 225, 0.2), 0 4px 6px -2px rgba(66, 153, 225, 0.1);
    transition: transform 0.3s ease;
}

body.dark-mode .card-icon {
    background: linear-gradient(135deg, #2c5282 0%, #2b6cb0 100%);
    color: #bee3f8;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.stat-card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
}

.btn-card {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: #f7fafc;
    color: var(--secondary-color);
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 600;
    margin-top: 1.5rem;
    border: 1px solid #edf2f7;
}

.badge {
    /* Default relative for tables/lists */
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.stat-card .badge {
    /* Absolute for dashboard cards */
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
}

.badge.orange {
    background-color: #fffaf0;
    color: #dd6b20;
    border: 1px solid #fbd38d;
}

/* --- MODERN DASHBOARD LAYOUT --- */
.dashboard-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 0.75rem;
    width: 100%;
    padding: 0.5rem;
    height: calc(100vh - 70px);
    overflow: hidden;
}

.dashboard-main {
    overflow-y: auto;
    padding-right: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dashboard-sidebar {
    background: var(--card-bg);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.02);
}

/* Sidebar Sections */
.sidebar-section {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.sidebar-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

/* --- Bid Writer & Chat Module --- */

/* Module Switcher Buttons */
.module-switcher {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.module-btn {
    border-radius: 20px;
    padding: 0.5rem 2rem;
    font-weight: 600;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.module-btn:hover {
    background: var(--item-bg);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.module-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.module-btn.active:hover {
    background: var(--secondary-color);
    color: white;
}

body.dark-mode .module-btn {
    background: var(--card-bg);
    /* Dark slate */
    border-color: var(--border-color);
    color: var(--text-secondary);
}

body.dark-mode .module-btn:hover {
    background: var(--item-bg);
    color: var(--white);
}

body.dark-mode .module-btn.active {
    background: var(--primary-color);
    /* Bright Blue */
    color: #0f172a;
    /* Dark text for contrast on bright blue */
    border-color: var(--primary-color);
}



/* Document List Items */
.doc-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    transition: all 0.2s;
}

.doc-item:hover {
    border-color: var(--secondary-color);
    transform: translateX(2px);
}

.doc-icon {
    font-size: 1.25rem;
    margin-right: 0.75rem;
    color: var(--secondary-color);
    width: 32px;
    height: 32px;
    background: rgba(13, 148, 136, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.doc-info {
    flex: 1;
    overflow: hidden;
}

.doc-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Updated Stats Cards */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.modern-stat-card {
    background: var(--card-bg);
    padding: 0.75rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    max-height: 120px;
}

/* Make the content more compact */
.stat-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-subtext {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Visualization Placeholders */
.circular-chart {
    width: 60px;
    height: 60px;
    background: conic-gradient(var(--secondary-color) 0% 82%, #e2e8f0 82% 100%);
    border-radius: 50%;
    margin-left: auto;
    position: relative;
}

.circular-chart::before {
    content: "";
    /* Removed hardcoded 82% */
    position: absolute;
    inset: 6px;
    background: var(--card-bg);
    border-radius: 50%;
}

.circular-chart span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 1;
}

.bar-chart-mini {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 40px;
    margin-top: auto;
}

.bar {
    flex: 1;
    background: var(--secondary-color);
    opacity: 0.3;
    border-radius: 2px 2px 0 0;
}

.bar.active {
    opacity: 1;
}

.recommendation-banner {
    background: #ecfdf5;
    border: 1px solid #10b981;
    color: #065f46;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

body.dark-mode .recommendation-banner {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
}

/* Tenders Page overrides */
.tenders-layout {
    display: block;
    /* Override flex */
    max-width: none;
    margin: 0;
}

.upload-area {
    border: 2px dashed var(--upload-border);
    border-radius: 1rem;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 1rem 0;
}

.upload-area:hover {
    border-color: var(--accent-color);
    background-color: var(--upload-hover);
}

.upload-placeholder i {
    font-size: 2rem;
    color: #a0aec0;
    margin-bottom: 0.75rem;
}

.upload-placeholder p {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.upload-placeholder span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn i {
    margin-right: 0.5rem;
}

.btn.primary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--accent-color) 100%);
    color: var(--white);
    box-shadow: 0 4px 10px rgba(43, 108, 176, 0.2);
}

.btn.primary:disabled {
    background: #cbd5e0;
    box-shadow: none;
    cursor: not-allowed;
}

.btn.secondary {
    background-color: var(--secondary-btn-bg);
    color: var(--secondary-btn-text);
    border: 1px solid var(--border-color);
}

.btn:not(:disabled):hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.btn-icon {
    background: transparent;
    border: 1px solid transparent;
    /* Cleaner look */
    cursor: pointer;
    padding: 0;
    border-radius: 0.375rem;
    transition: all 0.2s;
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 0 2px;
}

.btn-icon i {
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", sans-serif !important;
    font-weight: 900;
}

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

.btn-icon.danger {
    color: #e53e3e;
}

.btn-icon.danger:hover {
    background-color: #fff5f5;
    color: #c53030;
    border-color: #fed7d7;
}

.btn-icon.secondary {
    color: var(--secondary-color);
}

.btn-icon.secondary:hover {
    background-color: #ebf8ff;
    color: #3182ce;
    border-color: #bee3f8;
}

.btn.history {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    box-shadow: none;
    font-weight: 600;
}

.btn.history:hover {
    background-color: var(--primary-color);
    color: var(--white);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(17, 94, 89, 0.2);
}

body.dark-mode .btn.history {
    color: #38bdf8;
    border-color: #38bdf8;
}

body.dark-mode .btn.history:hover {
    background-color: #38bdf8;
    color: #0f172a;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
}

.file-list {
    margin: 1rem 0;
    max-height: 200px;
    overflow-y: auto;
    text-align: left;
}

.file-item {
    padding: 0.5rem;
    background: var(--item-bg);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-color);
}

.fields-list {
    list-style: none;
}

.fields-list li {
    padding: 0.5rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid #f7fafc;
}

/* Table */
.table-container {
    overflow-x: auto;
    margin-top: 1.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    background-color: #f7fafc;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.95rem;
}

.confidence-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.legend {
    margin-top: 2rem;
    display: flex;
    gap: 2rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Loading Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(26, 32, 44, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: var(--white);
}

.loader-content {
    text-align: center;
    width: 400px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.1);
    border-top: 5px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

/* Editable Cell Styles */
.editable-cell {
    cursor: text;
    transition: background-color 0.2s ease;
    border-radius: 4px;
    padding: 4px 8px;
    /* Slightly adjust padding for the "input" feel */
}

.editable-cell:hover {
    background-color: var(--input-bg);
    border: 1px dashed var(--border-color);
}

.editable-cell:focus {
    outline: 2px solid var(--accent-color);
    background-color: var(--input-bg);
    border: none;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.progress-container {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-top: 1.5rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent-color);
    width: 0%;
    transition: width 0.3s ease;
}

.placeholder-card {
    text-align: center;
    padding: 5rem;
}

.status-badge {
    background-color: #ebf8ff;
    color: #3182ce;
    padding: 0.5rem 1.5rem;
    border-radius: 2rem;
    display: inline-block;
    font-weight: 700;
    margin-bottom: 2rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h3 {
    margin-bottom: 0;
}

/* Tenders UI Enhancements */
.summary-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-pill {
    background: var(--white);
    padding: 1.25rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    box-shadow: var(--card-shadow);
    border: 1px solid #edf2f7;
}

.stat-pill i {
    width: 40px;
    height: 40px;
    background: #ebf8ff;
    color: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1.2rem;
}

.stat-pill .stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
}

.stat-pill .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.source-pill {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: #edf2f7;
    color: var(--text-secondary);
    border-radius: 4px;
    font-size: 0.75rem;
    margin-right: 0.4rem;
    margin-bottom: 0.4rem;
    border: 1px solid #e2e8f0;

    /* Text wrapping instead of truncation */
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    vertical-align: middle;
}

.source-container {
    max-width: 300px;
    line-height: 1.4;
}

.confidence-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
}

.confidence-badge i {
    font-size: 10px;
    margin-right: 0.4rem;
}

.badge-high {
    background: #f0fff4;
    color: #22543d;
    border: 1px solid #c6f6d5;
}

.badge-medium {
    background: #fffaf0;
    color: #744210;
    border: 1px solid #feebc8;
}

.badge-low {
    background: #fff5f5;
    color: #742a2a;
    border: 1px solid #fed7d7;
}

/* --- Premium Status Badges --- */
.status-badge-kb {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.85rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: rgba(20, 184, 166, 0.1);
    color: #0d9488;
    border: 1px solid rgba(20, 184, 166, 0.3);
    transition: all 0.3s ease;
    cursor: default;
    box-shadow: 0 0 10px rgba(20, 184, 166, 0.05);
}

.status-badge-kb i {
    font-size: 14px;
    animation: kb-pulse 2s infinite ease-in-out;
}

body.dark-mode .status-badge-kb {
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.15);
}

@keyframes kb-pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.15);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}


.table-row-val {
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.5;
    white-space: pre-wrap;
    min-width: 300px;
}

/* --- Tab Navigation --- */
.tabs-container {
    width: 100%;
}

.tab-header {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    /* To prevent jump on active */
    margin-bottom: -2px;
    /* Pull down to overlap border */
}

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

.tab-btn.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    background-color: transparent;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

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

/* --- Evaluation Form --- */
.evaluation-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.evaluation-section h4 {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.question-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    margin-bottom: 0.5rem;
}

.question-text {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
    margin-right: 1.5rem;
}

.question-options {
    display: flex;
    gap: 0.5rem;
    min-width: 250px;
    justify-content: flex-end;
}

/* Radio Button Group Styling */
.radio-group {
    display: inline-flex;
    background: var(--item-bg);
    border-radius: 0.5rem;
    padding: 0.25rem;
    border: 1px solid var(--border-color);
}

.radio-option {
    position: relative;
}

.radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-option label {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 0.35rem;
    margin: 0;
    color: var(--text-secondary);
    transition: all 0.2s;
}

/* Checked States */
.radio-option input[type="radio"]:checked+label {
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.radio-option.yes input[type="radio"]:checked+label {
    background-color: var(--success-color);
    color: white;
}

.radio-option.no input[type="radio"]:checked+label {
    background-color: var(--error-color);
    color: white;
}

.radio-option.discuss input[type="radio"]:checked+label {
    background-color: var(--warning-color);
    color: white;
    /* or dark depending on contrast */
}

/* Final Decision Area */
.final-decision-area {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: var(--item-bg);
    border-radius: 1rem;
    text-align: center;
}

/* --- Results Dashboard --- */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.result-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 0.75rem;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.result-value {
    font-size: 2rem;
    font-weight: 800;
    margin: 0.5rem 0;
}

.result-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.result-proceed {
    color: var(--success-color);
}

.result-no-go {
    color: var(--error-color);
}

.result-discuss {
    color: var(--warning-color);
}

/* Attention Row for Estimator to Confirm */
.row-attention {
    background-color: #fffaf0 !important;
    /* Light Orange/Yellow */
}

/* Force background on cells to override striping if needed */
.row-attention td {
    background-color: #fffaf0 !important;
    border-bottom: 1px solid #fbd38d !important;
}

.row-attention .table-row-val {
    color: #c05621;
    font-weight: 600;
}

/* --- FORCE CHAT STYLES (Fix for invisible input) --- */
.chat-input-wrapper {
    display: flex !important;
    gap: 1rem !important;
    width: 100% !important;
    align-items: center !important;
}

.chat-input {
    flex: 1 !important;
    width: auto !important;
    /* Allow flex to control width */
    height: 60px !important;
    padding: 0.75rem !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    background: var(--input-bg) !important;
    color: var(--text-primary) !important;
    resize: none !important;
}

.chat-send-btn {
    width: 60px !important;
    height: 60px !important;
    flex: 0 0 60px !important;
    /* Do not shrink or grow */
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    border-radius: 8px !important;
    margin: 0 !important;
}

/* --- Compact Module Switcher --- */
.module-switcher {
    text-align: center;
    margin-bottom: 0.5rem !important;
    /* Force reduction */
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.module-btn {
    padding: 0.4rem 1.2rem;
    border-radius: 20px;
    background: var(--white);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

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

.module-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* --- Compact Chat Card --- */
.chat-card {
    height: calc(100vh - 260px);
    /* Increased offset to 260px */
    min-height: 400px;
    /* Maximize height, reduce empty space above */
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    /* Remove generic card padding */
    overflow: hidden;
    margin-bottom: 0 !important;
}

.chat-card .card-header {
    padding: 0.5rem 1rem;
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-card h3 {
    margin: 0;
    font-size: 1.1rem;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f8fafc;
    /* Slight contrast */
}

.chat-footer {
    padding: 0.75rem;
    background: var(--white);
    border-top: 1px solid var(--border-color);
}

body.dark-mode .chat-history {
    background: var(--bg-color);
}

body.dark-mode .module-switcher .module-btn {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

body.dark-mode .module-switcher .module-btn.active {
    background: var(--primary-color);
    color: var(--bg-color);
}

/* ============================================================
   LOCHLIE UI IMPROVEMENTS — All Phases
   Safe additions only — zero existing rules modified
   ============================================================ */

/* --- Phase 1: Design Token Extensions --- */
:root {
    /* Typography scale */
    --text-xs:   0.70rem;
    --text-sm:   0.82rem;
    --text-base: 0.95rem;
    --text-lg:   1.10rem;
    --text-xl:   1.35rem;
    --text-2xl:  1.75rem;

    /* Shadow tier system */
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
    --shadow-lg:  0 10px 30px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
    --shadow-xl:  0 20px 50px rgba(0,0,0,0.18);

    /* Focus ring */
    --focus-ring: 0 0 0 3px rgba(13, 148, 136, 0.25);
    --focus-ring-error: 0 0 0 3px rgba(239, 68, 68, 0.22);

    /* Button easing */
    --ease-btn: cubic-bezier(0.4, 0, 0.2, 1);

    /* Stagger delays for cascading card reveals */
    --stagger-1: 0ms;
    --stagger-2: 60ms;
    --stagger-3: 120ms;
    --stagger-4: 180ms;
}

body.dark-mode {
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.3);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg:  0 10px 30px rgba(0,0,0,0.5);
    --focus-ring: 0 0 0 3px rgba(56, 189, 248, 0.28);
}

/* --- Phase 1: Focus ring applied globally --- */
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* --- Phase 1: Consistent button transition --- */
.btn, button, .action-btn, .widget-link {
    transition: all 0.18s var(--ease-btn) !important;
}

/* --- Phase 1: Upgraded card hover shadow --- */
.card:hover {
    box-shadow: var(--shadow-md);
}

/* --- Phase 1: Sidebar active indicator bar --- */
.sidebar-nav a {
    position: relative;
}
.sidebar-nav a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 3px;
    background: #ffffff;
    border-radius: 0 3px 3px 0;
    opacity: 0.9;
}
.sidebar-nav a:hover::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 3px;
    background: rgba(255,255,255,0.4);
    border-radius: 0 3px 3px 0;
}

/* --- Phase 3: Staggered card animation helpers --- */
@keyframes cardReveal {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
.stagger-1 { animation: cardReveal 0.42s var(--ease-btn) var(--stagger-1) both; }
.stagger-2 { animation: cardReveal 0.42s var(--ease-btn) var(--stagger-2) both; }
.stagger-3 { animation: cardReveal 0.42s var(--ease-btn) var(--stagger-3) both; }
.stagger-4 { animation: cardReveal 0.42s var(--ease-btn) var(--stagger-4) both; }

/* KPI tiles stagger (applied via JS) */
.kpi-tile { animation: cardReveal 0.4s var(--ease-btn) both; }
.kpi-tile:nth-child(1) { animation-delay: 0ms; }
.kpi-tile:nth-child(2) { animation-delay: 55ms; }
.kpi-tile:nth-child(3) { animation-delay: 110ms; }
.kpi-tile:nth-child(4) { animation-delay: 165ms; }

/* Widget cards stagger */
.widget-card { animation: cardReveal 0.45s var(--ease-btn) both; }
.widget-card:nth-child(1) { animation-delay: 80ms; }
.widget-card:nth-child(2) { animation-delay: 140ms; }
.widget-card:nth-child(3) { animation-delay: 200ms; }
.widget-card:nth-child(4) { animation-delay: 260ms; }

/* --- Phase 3: Pulse notification bell --- */
@keyframes bellPulse {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.15) rotate(-8deg); }
    50%  { transform: scale(1.1)  rotate(6deg); }
    70%  { transform: scale(1.12) rotate(-4deg); }
    100% { transform: scale(1); }
}
.notif-bell.has-unread i {
    animation: bellPulse 1.2s ease both;
    color: var(--warning-color) !important;
}
@keyframes badgePop {
    0%   { transform: scale(0.6); }
    70%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}
.notif-badge { animation: badgePop 0.35s var(--ease-btn) both; }

/* --- Phase 3: Flash message slide-down & auto fade --- */
@keyframes flashSlideDown {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes flashFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; transform: translateY(-8px); }
}
.alert, .flash-message {
    animation: flashSlideDown 0.3s var(--ease-btn) both;
}
.flash-message.dismissing {
    animation: flashFadeOut 0.4s var(--ease-btn) forwards;
}

/* --- Phase 4: Table improvements --- */
table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}
th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--card-bg);
    border-bottom: 2px solid var(--border-color);
    font-size: var(--text-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 0.65rem 1rem;
    white-space: nowrap;
}
td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: var(--text-sm);
    vertical-align: middle;
    transition: background 0.15s;
}
tbody tr:hover td { background: var(--item-bg); }
tbody tr:nth-child(even) td { background: rgba(0,0,0,0.015); }
body.dark-mode tbody tr:nth-child(even) td { background: rgba(255,255,255,0.025); }
tbody tr:last-child td { border-bottom: none; }

/* --- Phase 4: Unified status badge pills --- */
.badge, .status-badge, [class*="badge-"] {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25em 0.75em;
    border-radius: 999px;
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1.4;
}
.badge-success, .badge-approved { background: rgba(34,197,94,0.12);  color: #16a34a; }
.badge-warning, .badge-pending  { background: rgba(245,158,11,0.12); color: #b45309; }
.badge-danger,  .badge-rejected { background: rgba(239,68,68,0.12);  color: #dc2626; }
.badge-info,    .badge-proceed  { background: rgba(14,165,233,0.12); color: #0369a1; }
.badge-neutral                  { background: var(--item-bg);        color: var(--text-secondary); }

body.dark-mode .badge-success, body.dark-mode .badge-approved { background: rgba(74,222,128,0.15);  color: #4ade80; }
body.dark-mode .badge-warning, body.dark-mode .badge-pending  { background: rgba(250,204,21,0.15);  color: #facc15; }
body.dark-mode .badge-danger,  body.dark-mode .badge-rejected { background: rgba(248,113,113,0.15); color: #f87171; }
body.dark-mode .badge-info,    body.dark-mode .badge-proceed  { background: rgba(56,189,248,0.15);  color: #38bdf8; }

/* --- Phase 4: Form input improvements --- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
    transition: border-color 0.18s var(--ease-btn), box-shadow 0.18s var(--ease-btn) !important;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--secondary-color) !important;
    box-shadow: var(--focus-ring) !important;
}
/* Error state */
input.input-error, select.input-error, textarea.input-error {
    border-color: var(--error-color) !important;
    box-shadow: var(--focus-ring-error) !important;
    animation: inputShake 0.4s var(--ease-btn);
}
@keyframes inputShake {
    0%,100% { transform: translateX(0); }
    20%     { transform: translateX(-5px); }
    40%     { transform: translateX(5px); }
    60%     { transform: translateX(-3px); }
    80%     { transform: translateX(3px); }
}

/* --- Phase 5: Insurance/expiry row colour highlights --- */
tr.row-expired td  { background: rgba(239, 68, 68,  0.06) !important; }
tr.row-expiring td { background: rgba(245, 158, 11, 0.06) !important; }
tr.row-expired td:first-child  { border-left: 3px solid var(--error-color); }
tr.row-expiring td:first-child { border-left: 3px solid var(--warning-color); }
body.dark-mode tr.row-expired td  { background: rgba(248,113,113,0.08) !important; }
body.dark-mode tr.row-expiring td { background: rgba(250,204,21,0.08)  !important; }

/* --- Phase 5: Empty state component --- */
.empty-state-full {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    text-align: center;
    gap: 0.75rem;
}
.empty-state-full i {
    font-size: 2.5rem;
    opacity: 0.25;
}
.empty-state-full p { font-size: var(--text-sm); max-width: 280px; }

/* --- Phase 6: Responsive fixes --- */
@media (max-width: 1024px) {
    .kpi-strip { grid-template-columns: repeat(2, 1fr) !important; }
    .dashboard-body-grid { grid-template-columns: 1fr !important; }
    .widgets-area { grid-template-columns: 1fr !important; }
    .top-header { padding: 1rem 1.5rem !important; }
}
@media (max-width: 768px) {
    .kpi-strip { grid-template-columns: 1fr 1fr !important; }
    .widgets-area { grid-template-columns: 1fr !important; }
    .quick-actions-grid { grid-template-columns: 1fr !important; }
    .mini-modules-grid { grid-template-columns: repeat(3, 1fr) !important; }
    canvas { max-width: 100% !important; }
    .top-header {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 1rem !important;
    }
}
@media (max-width: 480px) {
    .kpi-strip { grid-template-columns: 1fr !important; }
    .content-wrapper { padding: 0.75rem !important; }
}
/* ============================================================
   END LOCHLIE UI IMPROVEMENTS
   ============================================================ */


/* ============================================================
   Tender Intelligence Redesign — Space Compaction Rules
   ============================================================ */

/* Tab header spacing */
.tab-header {
    margin-bottom: 1rem !important;
}

.tab-btn {
    padding: 0.75rem 1.5rem !important;
}

/* Table compaction */
.results-table th {
    padding: 0.75rem !important;
}

.results-table td {
    padding: 0.75rem !important;
    min-height: 44px;
}

/* Sidebar compaction */
#tender-sidebar {
    max-width: 280px;
    padding: 1rem !important;
}

#tender-sidebar h3 {
    margin: 1rem 0 0.75rem 0 !important;
    font-size: 1rem;
}

#tender-sidebar h3:first-child {
    margin-top: 0 !important;
}

/* Dashboard chart grid responsive */
@media (max-width: 1024px) {
    .dashboard-main-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Analysis view responsive — sidebar hides, results expand */
@media (max-width: 1280px) {
    #results-wrapper {
        grid-template-columns: 1fr !important;
    }
    #tender-sidebar {
        display: none !important;
    }
}

/* Stats row responsive */
@media (max-width: 768px) {
    .stats-row {
        grid-template-columns: 1fr !important;
    }
    .modern-stat-card {
        max-height: none !important;
    }
}
