/* =================================================================== */
/*        A4-OPTIMIZED PRINT STYLES (Must be at the top)               */
/* =================================================================== */
@media print {
    @page { size: A4; margin: 0.75in; }
    body { background-color: #ffffff !important; font-family: Arial, sans-serif; font-size: 10pt; }
    #appRoot, .print-btn, .sidebar__collapse-btn, .toggle-history-btn, .history-popover, .btn-export-csv, .report-item-toggle-icon { display: none !important; }
    .report-container { position: static; width: 100%; box-shadow: none !important; border: none !important; margin: 0 !important; padding: 0 !important; }
    .report-item-body { display: block !important; max-height: none !important; overflow: visible !important; }
    .table tfoot { display: table-row-group; }
    /* Hide History column in print */
    .table thead tr th:last-child, .table tbody tr td:last-child { display: none !important; }
    /* Hide non-approved badges in print */
    .table .badge:not(.badge-success) { display: none !important; }
    .table .badge.badge-success { border: 1px solid #999 !important; color: #000 !important; background-color: #fff !important; padding: 3px 6px; font-weight: bold; }
    .report-item-card, .card { box-shadow: none !important; border: 1px solid #ccc !important; page-break-inside: avoid; margin-bottom: 20px; }
    .report-header h1 { font-size: 18pt; }
    .table thead { display: table-header-group; }
    .table th, .table td { padding: 8px; font-size: 9pt; }
    .rank-badge { border: none !important; font-weight: bold; background-color: transparent !important; color: #000 !important; }
    .financial-summary { background-color: #f0f0f0 !important; border: 1px solid #ddd !important; }
    .report-charts-container { grid-template-columns: 1fr; page-break-inside: avoid; }
    .chart-card { page-break-inside: avoid; border: 1px solid #ccc; }
}

/* =================================================================== */
/*             CORE VARIABLES & RESET                                  */
/* =================================================================== */
:root {
    --color-primary: #F97316;
    --color-primary-dark: #EA580C;
    --color-success: #059669;
    --color-danger: #DC2626;
    --color-dark: #1F2937;
    --color-light: #F3F4F6;
    --color-text: #374151;
    --color-border: #D1D5DB;
    --color-background: #F9FAFB;
    --color-white: #ffffff;
    --font-family-base: 'Roboto', sans-serif;
    --header-height: 60px;
    --sidebar-width: 280px;
    --sidebar-width-collapsed: 80px;
    --border-radius: 8px;
    --transition-speed: 0.3s;
    --shadow-soft: 0 4px 12px rgba(44, 62, 80, 0.1);
}




/* =================================================================== */
/*             DARK THEME OVERRIDES                                    */
/* =================================================================== */

[data-theme="dark"] {
    --color-background: #0f172a; /* Very Dark Slate */
    --color-white: #1e293b;      /* Dark Slate (Card Bg) */
    --color-text: #f1f5f9;       /* Light Text */
    --color-border: #334155;     /* Dark Border */
    --color-light: #334155;      /* Secondary Dark Bg */
    --color-dark: #f8fafc;       /* Inverted Dark (for headings) */
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

/* Specific Dark Mode Tweaks */
[data-theme="dark"] .table thead th {
    background-color: #0f172a; /* Darker header for tables */
    color: #e2e8f0;
}

[data-theme="dark"] .form-control-static,
[data-theme="dark"] input, 
[data-theme="dark"] textarea, 
[data-theme="dark"] select,
[data-theme="dark"] .search-input {
    background-color: #0f172a;
    color: #f1f5f9;
    border-color: #EA580C;
}

[data-theme="dark"] .search-input:focus,
[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus {
    background-color: #0f172a;
    border-color: #FB923C;
}

/* Fix Modal Backgrounds */
[data-theme="dark"] .modal__footer {
    background-color: #0f172a;
    border-top-color: #334155;
}

/* Fix Document Cards in Dark Mode */
[data-theme="dark"] .doc-card,
[data-theme="dark"] .app-card,
[data-theme="dark"] .chart-card {
    background-color: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .doc-column {
    background-color: #1e293b;
}
[data-theme="dark"] .doc-column--company {
    background-color: #14532d; /* Dark Green bg for company col */
    border-color: #166534;
}

[data-theme="dark"] .btn-secondary {
    background-color: #334155;
    color: #f1f5f9;
    border-color: #EA580C;
}
[data-theme="dark"] .btn-secondary:hover {
    background-color: #EA580C;
}

/* Input Suffix Dark Fix */
[data-theme="dark"] .input-suffix {
    background-color: #334155;
    color: #cbd5e1;
    border-color: #EA580C;
}

/* Links in Dark Mode */
[data-theme="dark"] .link-view-details, 
[data-theme="dark"] .vendor-link {
    background-color: #7C2D12; /* Dark Blue Chip */
    color: #FED7AA; /* Light Blue Text */
}


/* =================================================================== */
/*             DARK THEME DEBIT NOTE & SEARCH FIXES                    */
/* =================================================================== */

/* Fix the Search Result Container in Create Debit Note Modal */
[data-theme="dark"] #dnFormDetails {
    background-color: #270b0b !important; /* Dark reddish background */
    border-color: #7f1d1d !important;
}

[data-theme="dark"] #dnFormDetails small {
    color: #cbd5e1 !important; /* Light grey for labels */
}

[data-theme="dark"] #dnFormDetails div {
    color: #f8fafc !important; /* White for the values (Vendor Name, Amount) */
}

/* Fix the Warning Banners in Modals (Danger & Warning) */
[data-theme="dark"] .modal-banner--danger {
    background-color: #450a0a;
    border-color: #7f1d1d;
    color: #fca5a5;
}

[data-theme="dark"] .modal-banner--warning {
    background-color: #451a03;
    border-color: #78350f;
    color: #fdba74;
}




*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-family-base); line-height: 1.6; color: var(--color-text); background-color: var(--color-background); }
body.app-loading { visibility: hidden; }

/* =================================================================== */
/*             MAIN LAYOUT GRID                                        */
/* =================================================================== */
.app-grid-container {
    display: grid;
    height: 100vh;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-areas: "sidebar header" "sidebar main";
    transition: grid-template-columns var(--transition-speed) ease;
}
.app-grid-container.sidebar-collapsed { grid-template-columns: var(--sidebar-width-collapsed) 1fr; }
.header { grid-area: header; }
.main-content { grid-area: main; overflow-y: auto; }

/* =================================================================== */
/*             MODERN SIDEBAR STYLES (FIXED)                           */
/* =================================================================== */
.sidebar {
    grid-area: sidebar;
    background-color: #1e293b; /* Rich dark blue-grey */
    background-image: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 4px 0 24px rgba(0,0,0,0.1);
    z-index: 100;
}

/* Header & Logo */
.sidebar__header {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 70px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 10px;
}
.sidebar__logo {
    display: flex;
    align-items: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    letter-spacing: 0.5px;
}
.sidebar__logo i {
    margin-right: 12px;
    color: #FB923C; /* Cyan Accent */
    font-size: 1.4rem;
    filter: drop-shadow(0 0 5px rgba(251, 146, 60, 0.3));
}
.sidebar__logo-text { opacity: 1; transition: opacity 0.2s ease; }

/* Navigation List */
.sidebar__nav {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 12px;
    gap: 4px;
}
.sidebar__nav::-webkit-scrollbar { width: 4px; }
.sidebar__nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }

/* Links */
.sidebar__link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #94a3b8;
    text-decoration: none;
    white-space: nowrap;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
    font-weight: 500;
}
.sidebar__link:hover { background-color: rgba(255, 255, 255, 0.08); color: #f1f5f9; transform: translateX(3px); }
.sidebar__link.active {
    background: linear-gradient(90deg, #F97316 0%, #EA580C 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.sidebar__icon { width: 24px; margin-right: 14px; font-size: 1.1rem; text-align: center; flex-shrink: 0; transition: color 0.2s; }
.sidebar__link.active .sidebar__icon { color: #fff; }
.sidebar__link-text { opacity: 1; transition: opacity 0.2s ease; }

/* Bottom Alignment */
.sidebar__link.bottom-align {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 28px;
}
.sidebar__link.logout {
    margin-top: 0;
    color: #fca5a5;
    margin-bottom: 20px;
}
.sidebar__link.logout:hover { background-color: rgba(239, 68, 68, 0.1); color: #ef4444; }

/* Notification Dot */
.notification-dot {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%) scale(0);
    width: 8px;
    height: 8px;
    background-color: #ef4444;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #1e293b;
    transition: transform 0.2s ease;
}
.notification-dot.show { transform: translateY(-50%) scale(1); }

/* Collapse Button */
.sidebar__collapse-btn {
    position: absolute;
    top: 35px;
    left: 100%;
    transform: translate(-50%, -50%);
    z-index: 101;
    background-color: #334155;
    color: #e2e8f0;
    border: 4px solid var(--color-background);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.2s;
}
.sidebar__collapse-btn:hover { background-color: #F97316; color: white; }

/* Collapsed State */
.sidebar-collapsed .sidebar__logo-text, .sidebar-collapsed .sidebar__link-text { opacity: 0; width: 0; display: none; }
.sidebar-collapsed .sidebar__logo i { margin-right: 0; font-size: 1.5rem; }
.sidebar-collapsed .sidebar__link { justify-content: center; padding: 12px 0; }
.sidebar-collapsed .sidebar__icon { margin-right: 0; }
.sidebar-collapsed .sidebar__collapse-btn { left: 50%; top: 98%; transform: translate(-50%, 0) rotate(180deg); }
.sidebar-collapsed .sidebar__link.bottom-align { padding-left: 0; margin-left: 0; margin-right: 0; border-radius: 8px; }
.sidebar-collapsed .notification-dot { top: 10px; right: 5px; }

/* =================================================================== */
/*             MODERN HEADER (Capsules & Global Actions)               */
/* =================================================================== */

.header {
    background-color: var(--color-white);
    box-shadow: 0 4px 12px rgba(0,0,0,0.03); /* Softer shadow */
    display: flex;
    align-items: center;
    padding: 0 30px;
    z-index: 10;
    height: 80px; /* Taller header for capsules */
}

.header__content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* 1. Page Title Capsule */
.header__title-capsule {
    background-color: #f1f5f9;
    padding: 10px 20px;
    border-radius: 50px; /* Pill shape */
    display: flex;
    align-items: center;
}

.header__page-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 2. Right Side Group (Search + Refresh + User) */
.header__right-group {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Global Actions Capsule (Search & Refresh) */
.header__actions-capsule {
    display: flex;
    align-items: center;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 50px;
    padding: 5px 5px 5px 20px; /* Padding for search text */
    gap: 10px;
    transition: all 0.2s ease;
}

.header__actions-capsule:focus-within {
    border-color: #F97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
    background-color: #fff;
}

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

.header__search i {
    color: #94a3b8;
}

#globalSearchInput {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.9rem;
    color: var(--color-text);
    width: 200px; /* Fixed width */
}

.header__refresh-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background-color: #e2e8f0;
    color: var(--color-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.header__refresh-btn:hover {
    background-color: #F97316;
    color: white;
    transform: rotate(180deg);
}

/* 3. User Profile Capsule */
.header__user-capsule {
    display: flex;
    align-items: center;
    background-color: #f1f5f9;
    padding: 6px 6px 6px 20px; /* Left padding for text */
    border-radius: 50px;
    gap: 15px;
    cursor: default;
    transition: background-color 0.2s;
}

.header__user-capsule:hover {
    background-color: #e2e8f0;
}

.header__username {
    font-weight: 600;
    color: var(--color-dark);
    font-size: 0.9rem;
}

.header__user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Dark Mode Adjustments for Header */
[data-theme="dark"] .header {
    background-color: #1e293b;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
[data-theme="dark"] .header__title-capsule,
[data-theme="dark"] .header__user-capsule {
    background-color: #0f172a;
}
[data-theme="dark"] .header__actions-capsule {
    background-color: #0f172a;
    border-color: #334155;
}
[data-theme="dark"] .header__actions-capsule:focus-within {
    background-color: #1e293b;
}
[data-theme="dark"] .header__refresh-btn {
    background-color: #334155;
    color: #e2e8f0;
}
[data-theme="dark"] .header__refresh-btn:hover {
    background-color: #FB923C;
    color: #0f172a;
}.container { padding: 25px; }
.page-content { display: none; }
.page-content.active { display: block; }

/* =================================================================== */
/*             CARDS & TABLES                                          */
/* =================================================================== */
.card { background-color: var(--color-white); border-radius: var(--border-radius); box-shadow: var(--shadow-soft); margin-bottom: 25px; }
.card__header { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid var(--color-border); }
.card__title { font-size: 1.2rem; font-weight: 500; color: var(--color-dark); margin: 0; }
.card__body { padding: 20px; }
.card__footer { padding: 15px 20px; background-color: #f8f9fa; border-top: 1px solid var(--color-border); border-radius: 0 0 var(--border-radius) var(--border-radius); }

.table-container { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--color-border); }
.table thead th { background-color: #f8f9fa; font-weight: 500; color: var(--color-dark); font-size: 0.9rem; }

/* =================================================================== */
/*             COMPONENTS (Buttons, Badges, Inputs)                    */
/* =================================================================== */
.badge { display: inline-block; padding: .3em .65em; font-size: 75%; font-weight: 700; line-height: 1; text-align: center; border-radius: .25rem; color: var(--color-white); }
.badge-success { background-color: var(--color-success); }
.badge-secondary { background-color: #888; }
.badge-primary { background-color: var(--color-primary); }
.badge-danger { background-color: var(--color-danger); }
@keyframes pulse-glow {
  0% { box-shadow: 0 0 0 0 rgba(100, 116, 139, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(100, 116, 139, 0); }
  100% { box-shadow: 0 0 0 0 rgba(100, 116, 139, 0); }
}
.badge.is-actionable { font-weight: 500; animation: pulse-glow 2s infinite; }
@keyframes pulse-glow-green {
  0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(5, 150, 105, 0); }
  100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}
.badge-ongoing { background-color: var(--color-success); color: var(--color-white); animation: pulse-glow-green 2s infinite; font-weight: 500; }

.btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 15px; font-size: 0.9rem; font-weight: 500; border: none; border-radius: 6px; cursor: pointer; transition: all 0.2s ease; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background-color: var(--color-primary); color: var(--color-white); box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.btn-primary:hover { background-color: var(--color-primary-dark); }
.btn-secondary { background-color: var(--color-light); color: var(--color-dark); border: 1px solid var(--color-border); }
.btn-secondary:hover { background-color: #e2e6ea; }
.btn-danger { background-color: var(--color-danger); color: var(--color-white); }
.btn-danger:hover { background-color: #c0392b; }
.btn-success { background-color: var(--color-success); color: var(--color-white); }
.btn-success:hover { background-color: #047857; }
.btn-reject-all { margin-left: 15px; background-color: #a42222; color: #fff; border: 1px solid #911e1e; padding: 8px 12px; border-radius: 4px; cursor: pointer; transition: background-color 0.2s ease, border-color 0.2s ease; font-weight: 500; }
.btn-reject-all:hover { background-color: #8b1c1c; border-color: #7a1818; }
.btn-reject-all:disabled { background-color: #d17878; border-color: #d17878; cursor: not-allowed; }
.btn.is-loading { cursor: wait; color: transparent !important; position: relative; }
.btn.is-loading .btn-loader { display: inline-block; }
.btn-loader { display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 20px; height: 20px; border: 3px solid rgba(255, 255, 255, 0.4); border-top-color: var(--color-white); border-radius: 50%; animation: btn-spin 0.8s linear infinite; }
@keyframes btn-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* Info/Review Icon Button */
.btn-view-details-icon { margin-left: 10px; padding: 2px 8px; font-size: 0.8rem; background-color: #FFF7ED; color: var(--color-primary); border: 1px solid var(--color-primary); border-radius: 4px; cursor: pointer; transition: all 0.2s; }
.btn-view-details-icon:hover { background-color: var(--color-primary); color: #fff; }

.search-container { position: relative; width: 100%; max-width: 300px; }
.search-input { width: 100%; padding: 8px 15px 8px 40px; border: 1px solid var(--color-border); border-radius: 20px; font-size: 0.9rem; background-color: #f8f9fa; transition: border-color 0.2s, box-shadow 0.2s; }
.search-input:focus { outline: none; background-color: var(--color-white); border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2); }
.search-container .search-icon { position: absolute; top: 50%; left: 15px; transform: translateY(-50%); color: #90a4ae; z-index: 2; }

/* --- Forms --- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 5px; }
.form-group input { width: 100%; padding: 12px; border: 1px solid var(--color-border); border-radius: 6px; }
.form-group textarea { width: 100%; padding: 12px; border: 1px solid var(--color-border); border-radius: 6px; font-family: inherit; resize: vertical; }
.form-group--full-width { grid-column: 1 / -1; }
.form-group--status { display: flex; flex-direction: column; align-items: flex-start; }
.form-control-static { padding: 12px; background-color: #e9ecef; border: 1px solid #ced4da; border-radius: 6px; font-family: inherit; font-size: 1rem; min-height: 47px; word-break: break-all; color: var(--color-text); cursor: not-allowed; }
input[type="text"]:disabled { background-color: #e9ecef; color: #495057; cursor: not-allowed; border: 1px solid #ced4da; }
.native-datetime-input { width: 100%; padding: 12px; border: 1px solid var(--color-border); border-radius: 6px; font-family: inherit; font-size: 0.9rem; }

/* Switch Toggle */
.switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; }
.slider.round { border-radius: 28px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--color-success); }
input:checked + .slider:before { transform: translateX(22px); }

/* Radio Group */
.radio-group { display: flex; gap: 15px; margin-top: 10px; }
.radio-label { display: flex; align-items: center; gap: 10px; padding: 12px 15px; border: 2px solid var(--color-border); border-radius: 8px; cursor: pointer; transition: all 0.2s ease; flex-grow: 1; justify-content: center; background-color: #f9fafb; }
.radio-label:hover { border-color: var(--color-primary-dark); }
.radio-label input[type="radio"] { display: none; }
.radio-label input[type="radio"]:checked + i { color: var(--color-primary); }
.radio-label input[type="radio"]:checked + i + span { font-weight: 700; color: var(--color-dark); }
.radio-group > .radio-label:has(input:checked) { background-color: #FFF7ED; border-color: var(--color-primary); }

/* Input Suffix (City Group) */
.input-group-suffix { display: flex; align-items: stretch; width: 100%; }

.input-group-suffix input { 
    border-top-right-radius: 0 !important; 
    border-bottom-right-radius: 0 !important; 
    border-right: none !important; 
    flex-grow: 1; 
    min-width: 50px; /* Ensures the input field keeps at least a small clickable area */
}

.input-suffix { 
    background-color: #e2e8f0; 
    color: #F97316; 
    border: 1px solid var(--color-border); 
    border-left: 1px dashed #cbd5e1; 
    border-radius: 0 6px 6px 0; 
    padding: 0 15px; 
    display: flex; 
    align-items: center; 
    font-size: 0.9rem; 
    font-weight: 500; 
    white-space: nowrap; 
    
    /* FIX: Prevent text from being cut off */
    flex-shrink: 0; 
    overflow: visible; 
    max-width: none; 
}


/* =================================================================== */
/*             MODALS                                                  */
/* =================================================================== */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); z-index: 1000; display: flex; justify-content: center; align-items: center; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease; }
.modal-overlay:not(.hidden) { opacity: 1; visibility: visible; }
.modal { background-color: var(--color-white); border-radius: var(--border-radius); box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2); width: 90%; max-width: 700px; max-height: 90vh; display: flex; flex-direction: column; transform: translateY(-20px); transition: transform 0.3s ease; }
.modal-overlay:not(.hidden) .modal { transform: translateY(0); }
.modal__header { display: flex; justify-content: space-between; align-items: center; padding: 15px 25px; border-bottom: 1px solid var(--color-border); }
.modal__title { margin: 0; font-size: 1.3rem; font-weight: 500; color: var(--color-dark); }
.link-view-details, .vendor-link {
    color: #EA580C; /* Bright Link Blue */
    font-weight: 600; /* Slightly bolder */
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.link-view-details:hover, .vendor-link:hover {
    color: #9A3412; /* Darker Blue on Hover */
    text-decoration: underline;
}

/* Also update the link inside Modal Titles to match */
.modal__title a.link-view-details {
    color: #EA580C;
    border-bottom: 2px dotted #EA580C;
}

.modal__title a.link-view-details:hover {
    color: #9A3412;
    border-bottom-color: #9A3412;
}.modal__close-btn { background: none; border: none; font-size: 2rem; line-height: 1; color: #888; cursor: pointer; }
.modal__body { padding: 25px; overflow-y: auto; }
.modal__footer { display: flex; justify-content: flex-end; padding: 15px 25px; border-top: 1px solid var(--color-border); background-color: #f8f9fa; }
.modal__footer .btn { margin-left: 10px; }
.modal-form-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }
.modal-form-column { display: flex; flex-direction: column; gap: 25px; }
fieldset { border: 1px solid var(--color-border); border-radius: var(--border-radius); padding: 20px 25px 25px 25px; margin: 0; height: 100%; }
legend { font-weight: 500; color: var(--color-primary); padding: 0 10px; margin-left: 10px; font-size: 1.1rem; }
.fieldset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 20px; margin-top: 15px; }
.fieldset-grid--single-col { grid-template-columns: 1fr; }
.fieldset-grid .form-group--full-width { grid-column: 1 / -1; }
#viewDetailsModalOverlay { z-index: 1010; }

/* Details Grid inside View Modal */
.details-grid { display: grid; grid-template-columns: max-content 1fr; gap: 16px 20px; align-items: center; }
.details-grid__label { background-color: var(--color-light); padding: 10px 15px; border-radius: 6px; font-weight: 500; color: var(--color-dark); text-align: right; white-space: nowrap; }
.details-grid__value { background-color: var(--color-white); padding: 10px 15px; border-radius: 6px; border: 1px solid var(--color-border); font-size: 0.9rem; word-break: break-all; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }

/* =================================================================== */
/*             TABS (In-Page)                                          */
/* =================================================================== */
.tab-nav { display: flex; border-bottom: 1px solid var(--color-border); margin-bottom: 25px; }
.tab-nav__link { padding: 10px 20px; border: none; background: none; cursor: pointer; font-size: 1rem; font-weight: 500; color: var(--color-text); border-bottom: 3px solid transparent; margin-bottom: -1px; transition: color 0.2s, border-color 0.2s; position: relative; }
.tab-nav__link:hover { color: var(--color-primary); }
.tab-nav__link.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-nav__link .notification-dot { top: 8px; right: 8px; width: 9px; height: 9px; z-index: 2; }

/* Table Row Unread Indicator */
tr.has-unread-messages { font-weight: 500; background-color: #fcf6e6; }
tr.has-unread-messages td:first-child { position: relative; padding-left: 30px; }
tr.has-unread-messages td:first-child::before { content: ''; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 8px; height: 8px; background-color: var(--color-danger); border-radius: 50%; box-shadow: 0 0 6px rgba(220, 38, 38, 0.7); }

/* =================================================================== */
/*             DASHBOARD & REPORTS LISTS                               */
/* =================================================================== */
/* =================================================================== */
/*             DASHBOARD GRID (4 Columns)                              */
/* =================================================================== */
.dashboard-grid { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); /* 4 Equal Columns */
    gap: 20px; 
    align-items: start;
}

/* Make cards stretch to match height if needed */
.dashboard-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dashboard-card .card__body {
    flex-grow: 1;
    overflow-y: auto;
    max-height: 400px; /* Prevent infinite scrolling lists */
}

/* Responsive: 2 Columns on Laptop/Tablet */
@media (max-width: 1400px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive: 1 Column on Mobile */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-top-row {
        grid-template-columns: 1fr;
    }
}
.dashboard-main-column, .dashboard-side-column { display: flex; flex-direction: column; gap: 25px; }
.btn-create-bid-large { width: 100%; padding: 20px; font-size: 1.2rem; font-weight: 500; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; text-align: center; }
.stat-item { 
    background-color: var(--color-light); 
    padding: 15px; 
    border-radius: var(--border-radius); 
    cursor: pointer; /* Makes it clickable */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    background-color: #e2e8f0; /* Slightly darker on hover */
}
/* Specific dark mode hover fix */
[data-theme="dark"] .stat-item:hover {
    background-color: #334155;
}.stat-item__value { font-size: 2rem; font-weight: 700; color: var(--color-primary); line-height: 1.1; }
.stat-item__label { font-size: 0.9rem; color: var(--color-text); margin-top: 5px; }
.dashboard-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 15px; }
.dashboard-list__item { display: flex; justify-content: space-between; align-items: center; padding-bottom: 15px; border-bottom: 1px solid var(--color-border); }
.dashboard-list__item:last-child { border-bottom: none; padding-bottom: 0; }
.dashboard-list__item-main { flex-grow: 1; }
.dashboard-list__item-route { font-size: 1.05rem; font-weight: 500; color: var(--color-dark); margin-bottom: 4px; }
.dashboard-list__item-details { font-size: 0.9rem; color: #555; display: flex; align-items: center; gap: 15px; }
.dashboard-list__item-details .vendor-link { font-weight: 500; color: var(--color-primary); text-decoration: none; }
.dashboard-list__item-details .vendor-link:hover { text-decoration: underline; }
.dashboard-list__item-details .bid-amount { font-weight: 500; color: var(--color-success); }
.time-badge { display: inline-block; padding: 3px 8px; font-size: 0.8rem; font-weight: 500; border-radius: 12px; color: var(--color-white); white-space: nowrap; }
.time-badge--urgent { background-color: var(--color-danger); }
.time-badge--soon { background-color: #F59E0B; }
.time-badge--later { background-color: var(--color-primary); }

/* =================================================================== */
/*             COMMAND CENTER (REVIEW MODAL)                           */
/* =================================================================== */
.command-center-modal { max-width: 1100px; width: 95%; max-height: 95vh; }
.command-center-body { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.mission-briefing { padding: 20px 25px; background-color: var(--color-light); border-bottom: 1px solid var(--color-border); display: flex; justify-content: space-around; align-items: center; gap: 20px; flex-wrap: wrap; text-align: center; }
.briefing-item { display: flex; align-items: center; gap: 10px; font-size: 1rem; }
.briefing-item i { font-size: 1.2rem; color: var(--color-primary); }
.briefing-item span { font-weight: 500; color: var(--color-dark); }
.command-center-main { display: flex; flex-direction: column; gap: 0; padding: 0 25px 25px 25px; overflow-y: auto; }
.vendor-tabs-nav { display: flex; border-bottom: 1px solid var(--color-border); flex-shrink: 0; }
.vendor-tab-link { padding: 12px 20px; cursor: pointer; font-size: 1.1rem; font-weight: 500; color: var(--color-text); border: none; background: none; border-bottom: 3px solid transparent; margin-bottom: -1px; transition: color 0.2s, border-color 0.2s; position: relative; }
.vendor-tab-link:hover { background-color: var(--color-light); }
.vendor-tab-link.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.vendor-tab-link .status-icon { margin-left: 8px; font-size: 0.9rem; }
.vendor-tab-link .status-icon.is-approved { color: var(--color-success); }
.vendor-tab-link .status-icon.is-rejected { color: var(--color-danger); }
.vendor-tab-content-container { padding-top: 25px; flex-grow: 1; position: relative; }
.vendor-tab-pane { display: none; }
.vendor-tab-pane.active { display: block; }
.dossier-card { background-color: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--border-radius); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); width: 100%; height: auto; min-height: 300px; display: flex; flex-direction: column; position: static; transition: transform 0.4s ease, opacity 0.4s ease; }
.dossier-card.is-locked { background-color: #f9fafb; }
.dossier-card__header { padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--color-border); }
.dossier-card__vendor-name { font-size: 1.5rem; font-weight: 500; color: var(--color-dark); }
.dossier-card__level-badge { font-size: 1.1rem; font-weight: 500; padding: 5px 12px; }
.dossier-card__body { padding: 25px 20px; flex-grow: 1; display: flex; flex-direction: column; justify-content: center; }
.dossier-card__details-grid { display: grid; grid-template-columns: 1fr 1.5fr 1.2fr; gap: 20px; }
.details-column { display: flex; flex-direction: column; gap: 20px; padding: 0 20px; border-left: 1px solid #e5e7eb; }
.details-column:first-child { padding-left: 0; border-left: none; }
.details-item .label { font-size: 0.8rem; color: #888; text-transform: uppercase; margin-bottom: 4px; font-weight: 500; white-space: nowrap; }
.details-item .value { font-size: 1.1rem; font-weight: 500; color: var(--color-dark); }
.details-item .value.amount { font-size: 1.75rem; color: var(--color-success); font-weight: 700; }
.decision-history { border-left: 1px solid var(--color-border); padding-left: 30px; display: flex; flex-direction: column; gap: 15px; }
.decision-history h4 { margin-bottom: 10px; font-weight: 500; color: var(--color-dark); border-bottom: 1px solid var(--color-border); padding-bottom: 10px; margin-bottom: 15px; }
.history-entry { padding-bottom: 15px; margin-bottom: 15px; border-bottom: 1px solid #FFF7ED; }
.history-entry:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.history-item { display: flex; align-items: flex-start; gap: 12px; font-size: 0.95rem; }
.history-item .icon { font-size: 1.2rem; margin-top: 2px; }
.history-item.is-approved { color: var(--color-success); }
.history-item.is-rejected { color: var(--color-danger); }
.history-meta { font-size: 0.8rem; color: #6b7280; margin-top: 3px; }
.history-reason { font-size: 0.9rem; color: #4b5563; margin-top: 8px; padding-left: 28px; font-style: italic; background-color: #f8f9fa; border-left: 3px solid var(--color-danger); padding: 8px 12px 8px 25px; border-radius: 0 6px 6px 0; }
.action-bar { justify-content: space-between; align-items: center; }
.action-bar-status { width: 100%; text-align: center; font-size: 1.2rem; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 10px; }
.action-bar-status.is-approved { color: var(--color-success); }
.action-bar-status.is-rejected { color: var(--color-danger); }
.vendor-bids-table { width: 100%; border-collapse: collapse; }
.vendor-bids-table th, .vendor-bids-table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--color-border); }
.vendor-bids-table thead th { background-color: #f8f9fa; font-weight: 500; color: var(--color-dark); font-size: 0.9rem; position: sticky; top: 0; }
.rank-badge { font-weight: 700; padding: 4px 10px; border-radius: 12px; font-size: 0.85rem; color: var(--color-dark); text-align: center; min-width: 40px; display: inline-block; }
.rank-badge.rank-1 { background-color: #FFD700; color: #413300; }
.rank-badge.rank-2 { background-color: #C0C0C0; color: #363636; }
.rank-badge.rank-3 { background-color: #CD7F32; color: #4a2d0c; }
.rank-badge.rank-other { background-color: #e9ecef; }
@keyframes highlight-row { 0% { background-color: #FFF7ED; } 100% { background-color: transparent; } }
.vendor-row.is-updated { animation: highlight-row 2s ease-out; }
.btn.btn-negotiate { position: relative; overflow: visible; }
.btn .notification-dot { position: absolute; top: -5px; right: -5px; width: 10px; height: 10px; border: 2px solid var(--color-white); }

/* =================================================================== */
/*             CHAT MODAL                                              */
/* =================================================================== */
.negotiation-modal { max-width: 600px; height: 70vh; max-height: 700px; }
.chat-modal-body { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.chat-messages { flex-grow: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; }
.message-bubble { padding: 10px 15px; border-radius: 18px; max-width: 80%; line-height: 1.4; font-size: 0.95rem; display: flex; flex-direction: column; }
.message-bubble .sender { font-weight: 700; font-size: 0.8rem; margin-bottom: 4px; display: block; }
.message-bubble.sent { background-color: var(--color-primary); color: var(--color-white); border-bottom-right-radius: 4px; align-self: flex-end; }
.message-bubble.received { background-color: var(--color-light); color: var(--color-text); border-bottom-left-radius: 4px; align-self: flex-start; }
.message-content { display: flex; align-items: flex-end; gap: 8px; word-break: break-word; }
.message-text { flex-grow: 1; }
.message-time { font-size: 0.75rem; color: rgba(255, 255, 255, 0.7); white-space: nowrap; align-self: flex-end; }
.message-bubble.received .message-time { color: #888; }
.chat-form { display: flex; padding: 15px; border-top: 1px solid var(--color-border); background-color: #f8f9fa; }
#chatMessageInput { flex-grow: 1; padding: 12px 15px; border: 1px solid var(--color-border); border-radius: 20px; margin-right: 10px; }
#chatMessageInput:focus { outline: none; border-color: var(--color-primary); }
#chatSendBtn { border-radius: 50%; width: 45px; height: 45px; flex-shrink: 0; }

/* =================================================================== */
/*             REPORT & ANALYTICS UI                                   */
/* =================================================================== */
.reports-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 25px; }
.report-card { background-color: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--border-radius); box-shadow: var(--shadow-soft); display: flex; flex-direction: column; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.report-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(44, 62, 80, 0.15); }
.report-card__body { padding: 25px; flex-grow: 1; }
.report-card__title { font-size: 1.3rem; font-weight: 500; color: var(--color-dark); margin-bottom: 10px; }
.report-card__description { font-size: 0.95rem; color: var(--color-text); line-height: 1.5; margin-bottom: 20px; }
.report-card__footer { padding: 20px 25px; background-color: #f8f9fa; border-top: 1px solid var(--color-border); text-align: right; display: flex; flex-direction: column; gap: 15px; align-items: stretch; }
.report-date-container { display: flex; flex-direction: column; gap: 8px; }
.report-date-label { font-size: 0.85rem; font-weight: 500; color: var(--color-primary); }
.report-date-inputs { display: flex; align-items: center; gap: 10px; }
.report-date-input { flex: 1; padding: 8px 10px; border: 1px solid var(--color-border); border-radius: 4px; font-family: inherit; font-size: 0.9rem; color: var(--color-text); }
.report-date-separator { color: #888; font-size: 0.9rem; }
.run-report-btn { width: 100%; justify-content: center; }
.report-container { padding: 30px; background-color: var(--color-white); max-width: 1200px; margin: 30px auto; border-radius: var(--border-radius); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.report-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--color-primary); padding-bottom: 15px; margin-bottom: 25px; }
.report-header h1 { font-size: 1.8rem; color: var(--color-dark); margin: 0; }
.report-header-actions { display: flex; gap: 10px; align-items: center; }
.print-btn { padding: 8px 15px; background-color: var(--color-primary); color: var(--color-white); border: none; border-radius: 6px; cursor: pointer; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; transition: background-color 0.2s; }
.print-btn:hover { background-color: var(--color-primary-dark); }
.btn-export-csv { background-color: #28a745; color: white; border: none; padding: 8px 15px; border-radius: 6px; cursor: pointer; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; transition: background-color 0.2s; }
.btn-export-csv:hover { background-color: #218838; }
.report-items-container { display: flex; flex-direction: column; gap: 20px; }
.report-item-card { border: 1px solid var(--color-border); border-radius: var(--border-radius); background-color: var(--color-white); box-shadow: var(--shadow-soft); transition: box-shadow 0.2s ease-in-out; }
.report-item-card:hover { box-shadow: 0 8px 20px rgba(44, 62, 80, 0.1); }
.report-item-header { padding: 20px; cursor: pointer; user-select: none; display: flex; flex-direction: column; gap: 15px; }
.report-item-header-top { display: flex; justify-content: space-between; align-items: center; }
.bid-id { font-size: 1.4rem; font-weight: 500; color: var(--color-dark); margin: 0; }
.status-and-toggle { display: flex; align-items: center; gap: 15px; }
.report-item-toggle-icon { font-size: 1rem; color: var(--color-primary); transition: transform 0.3s ease; }
.report-item-toggle-icon.rotated { transform: rotate(180deg); }
.report-item-header-bottom { display: flex; justify-content: space-between; align-items: stretch; gap: 20px; }
.route-info { flex-grow: 1; }
.route-path { display: flex; align-items: center; gap: 15px; }
.route-arrow { font-size: 1.5rem; color: #90a4ae; }
.location { flex-basis: 50%; }
.location span { font-size: 0.8rem; color: #6c757d; text-transform: uppercase; }
.location p { font-size: 1rem; font-weight: 500; color: var(--color-text); margin: 2px 0 0 0; line-height: 1.3; }
.item-description { font-size: 0.9rem; color: #555; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--color-border); }
.financial-summary { display: flex; gap: 15px; align-items: stretch; flex-shrink: 0; }
.report-item-body { max-height: 0; overflow: hidden; transition: max-height 0.4s ease-out; border-top: 1px solid var(--color-border); }
.report-item-body.show { max-height: 500px; transition: max-height 0.5s ease-in; }
.toggle-history-btn { background: none; border: 1px solid var(--color-border); border-radius: 15px; padding: 4px 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--color-text); transition: all 0.2s ease; }
.toggle-history-btn:hover { background-color: #e9ecef; border-color: #adb5bd; }
.toggle-history-btn.active { background-color: var(--color-primary); color: var(--color-white); border-color: var(--color-primary); }
.toggle-history-btn .fa-history { transition: transform 0.3s ease; }
.toggle-history-btn.active .fa-history { transform: rotate(360deg); }
.toggle-history-btn span { font-weight: 500; font-size: 0.8rem; }
.history-popover { position: absolute; z-index: 1050; background-color: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--border-radius); box-shadow: 0 5px 15px rgba(0,0,0,0.15); width: 280px; padding: 12px; transform-origin: top left; animation: fadeIn 0.2s ease-out; }
.history-popover h6 { margin: 0 0 8px 0; font-weight: 500; color: var(--color-dark); border-bottom: 1px solid var(--color-border); padding-bottom: 6px; font-size: 0.95rem; }
.history-popover .bid-history-list { list-style: none; padding-left: 0; margin: 0; max-height: 220px; overflow-y: auto; }
.history-popover .bid-history-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 4px; font-size: 0.85rem; border-bottom: 1px solid #f0f2f5; }
.history-popover .bid-history-item:last-child { border-bottom: none; padding-bottom: 2px; }
.history-popover .bid-history-item .amount { font-weight: 500; }
.history-popover .bid-history-item .timestamp { color: #6c757d; font-size: 0.8rem; }
@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.report-charts-container { display: grid; grid-template-columns: repeat(2, 1fr); gap: 25px; margin-bottom: 30px; }
.chart-card { background: #fff; border: 1px solid var(--color-border); border-radius: var(--border-radius); padding: 20px; box-shadow: var(--shadow-soft); display: flex; flex-direction: column; align-items: center; min-height: 350px; max-height: 400px; }
.chart-card h4 { margin-bottom: 15px; color: var(--color-dark); font-weight: 500; width: 100%; text-align: left; border-bottom: 1px solid #eee; padding-bottom: 10px; }
.chart-wrapper { position: relative; width: 100%; height: 100%; flex-grow: 1; }

/* =================================================================== */
/*             DOCUMENT CENTER V2 STYLES                               */
/* =================================================================== */
.transport-summary-bar { display: flex; justify-content: space-between; align-items: center; background-color: #f8f9fa; padding: 15px 20px; border-radius: 8px; border: 1px solid var(--color-border); margin-bottom: 25px; }
.transport-summary-bar .summary-item { display: flex; align-items: center; gap: 10px; }
.transport-summary-bar .label { font-weight: 500; color: #666; text-transform: uppercase; font-size: 0.85rem; }
.transport-summary-bar .value { font-size: 1.2rem; font-weight: 700; color: var(--color-dark); }
.doc-grid-container { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; min-height: 300px; }
@media (max-width: 900px) { .doc-grid-container { grid-template-columns: 1fr 1fr; } }
.doc-column { background-color: #fff; border: 1px solid var(--color-border); border-radius: 8px; display: flex; flex-direction: column; }
.doc-column--company { background-color: #f0fdf4; border-color: #bbf7d0; }
.doc-column-header { padding: 12px 15px; border-bottom: 1px solid var(--color-border); font-weight: 600; color: var(--color-dark); display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; }
.doc-column-header i { margin-right: 5px; color: var(--color-primary); }
.doc-list { flex-grow: 1; padding: 15px; display: flex; flex-direction: column; gap: 10px; }
.doc-card { background-color: #fff; border: 1px solid #e5e7eb; border-radius: 6px; padding: 10px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); transition: transform 0.2s; font-size: 0.9rem; position: relative; }
.doc-card:hover { transform: translateY(-2px); box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.doc-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; overflow: hidden; }
.doc-icon { font-size: 1.2rem; color: #ef4444; }
.doc-icon.img { color: #F97316; }
.doc-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.doc-meta { font-size: 0.75rem; color: #888; margin-bottom: 8px; }
.doc-actions { display: flex; gap: 5px; }
.btn-doc-action { flex: 1; padding: 4px; font-size: 0.8rem; border-radius: 4px; border: 1px solid #ddd; background: #f9fafb; cursor: pointer; text-align: center; color: var(--color-text); text-decoration: none; }
.btn-doc-action:hover { background-color: #e5e7eb; }
.btn-doc-action.delete { color: var(--color-danger); border-color: #fca5a5; background-color: #fef2f2; }
.btn-upload-doc { margin: 10px; padding: 10px; border: 2px dashed #cbd5e1; background-color: transparent; color: #F97316; font-weight: 500; border-radius: 6px; cursor: pointer; transition: all 0.2s; }
.btn-upload-doc:hover { border-color: var(--color-primary); color: var(--color-primary); background-color: #f1f5f9; }
.doc-card.archived { background-color: #f9fafb; border: 1px dashed #cbd5e1; opacity: 0.85; }
.doc-card.archived .doc-name { color: #F97316; text-decoration: line-through; }
.doc-card.archived .doc-icon { filter: grayscale(100%); opacity: 0.6; }
.badge-archived { font-size: 0.65rem; background-color: #94a3b8; color: white; padding: 2px 6px; border-radius: 4px; margin-left: 6px; vertical-align: middle; display: inline-block; }
.btn-copy { background: none; border: none; color: var(--color-primary); cursor: pointer; margin-left: 10px; font-size: 1rem; transition: color 0.2s; padding: 0; }
.btn-copy:hover { color: var(--color-primary-dark); transform: scale(1.1); }
.badge-latest { font-size: 0.65rem; background-color: var(--color-success); color: white; padding: 2px 6px; border-radius: 4px; margin-left: 6px; vertical-align: middle; display: inline-block; font-weight: 600; }
.doc-source-chip { font-size: 0.7rem; padding: 2px 8px; border-radius: 12px; margin-right: 6px; font-weight: 600; text-transform: uppercase; display: inline-block; }
.doc-source-chip.vendor { background-color: #e2e8f0; color: #EA580C; }
.doc-source-chip.company { background-color: #dcfce7; color: #166534; }

/* =================================================================== */
/*             APP CENTER STYLES                                       */
/* =================================================================== */
.app-cards-container { display: flex; justify-content: center; gap: 30px; flex-wrap: wrap; padding: 20px; }
.app-card { background: #fff; border: 1px solid var(--color-border); border-radius: 12px; padding: 30px; width: 300px; text-align: center; box-shadow: var(--shadow-soft); transition: transform 0.2s; display: flex; flex-direction: column; align-items: center; }
.app-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
.app-card-icon { font-size: 3rem; color: var(--color-primary); margin-bottom: 15px; }
.app-card h4 { margin: 0 0 5px 0; color: var(--color-dark); font-size: 1.3rem; }
.app-card p { color: #666; margin-bottom: 20px; font-size: 0.9rem; }
.app-qr { width: 150px; height: 150px; margin-bottom: 20px; border: 1px solid #eee; padding: 5px; border-radius: 4px; }

/* =================================================================== */
/*             DEBIT NOTES & WARNING STYLES                            */
/* =================================================================== */
.modal-banner { padding: 15px; margin-top: 15px; border-radius: 8px; display: flex; align-items: flex-start; gap: 15px; font-size: 0.95rem; margin-bottom: 20px; }
.modal-banner--danger { background-color: #fff5f5; border: 1px solid #fc8181; color: #c53030; }
.modal-banner--warning { background-color: #fffaf0; border: 1px solid #fbd38d; color: #c05621; }
.modal-banner__icon { font-size: 1.5rem; margin-top: 2px; }
.badge-issued { background-color: #fff5f5; color: #c53030; border: 1px solid #fc8181; }
.badge-fulfilled { background-color: #f0fff4; color: #2f855a; border: 1px solid #68d391; }
.vendor-debt-warning { margin-bottom: 20px; border-left: 4px solid #c53030; }

/* Loading Overlay */
.loading-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(255, 255, 255, 0.9); display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 9999; }
.spinner { border: 5px solid rgba(0, 0, 0, 0.1); border-top-color: var(--color-primary); border-radius: 50%; width: 50px; height: 50px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.notification { position: fixed; bottom: 20px; right: 20px; background-color: var(--color-success); color: var(--color-white); padding: 15px 20px; border-radius: 6px; box-shadow: var(--shadow-soft); z-index: 10000; opacity: 0; transform: translateY(20px); transition: all 0.3s ease; }
.notification.active { opacity: 1; transform: translateY(0); }
.notification.error { background-color: var(--color-danger); }
.error-message { color: var(--color-danger); font-size: 0.8rem; margin-top: 5px; display: block; }
.hidden { display: none !important; }

/* =================================================================== */
/*             MODERN UI UPGRADES (ROUNDED & CHIPS)                    */
/* =================================================================== */

/* 1. Global Rounding override */
:root {
    --border-radius: 16px; /* Soft, modern rounding */
}

/* 2. Hyperlinks as "Pill/Chip" Buttons */
.link-view-details, .vendor-link {
    display: inline-block;
    background-color: #eff6ff; /* Light Blue Bg */
    color: #EA580C; /* Strong Blue Text */
    padding: 4px 12px;
    border-radius: 50px; /* Full capsule roundness */
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.link-view-details:hover, .vendor-link:hover {
    background-color: #EA580C;
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(37, 99, 235, 0.3);
}

/* 3. Quick Actions Grid */
.quick-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.btn-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    color: #EA580C;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-action-card:hover {
    background: #fff;
    border-color: var(--color-primary);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    color: var(--color-primary);
}

.btn-action-card i {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.btn-action-card.primary {
    background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
    color: white;
    border: none;
}
.btn-action-card.primary:hover {
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.btn-action-card.danger {
    color: #ef4444;
    background: #fef2f2;
    border-color: #fecaca;
}
.btn-action-card.danger:hover {
    background: #ef4444;
    color: white;
}

/* 4. Live Countdown Timer */
.countdown-timer {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: #d97706; /* Amber */
    background: #fffbeb;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #fcd34d;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}



/* --- New Dashboard Layout Styles --- */
.dashboard-top-row {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Equal width for Actions and Stats */
    gap: 25px;
    margin-bottom: 25px;
}

@media (max-width: 900px) {
    .dashboard-top-row {
        grid-template-columns: 1fr; /* Stack on smaller screens */
    }
}






/* =================================================================== */
/*             LOGIN PAGE STYLES (RESTORED)                            */
/* =================================================================== */

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--color-background);
}

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

.login-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.8em;
    font-weight: 700;
    color: var(--color-dark);
}

.login-title i {
    color: var(--color-primary);
    margin-right: 10px;
}

.btn-login {
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    margin-top: 10px;
}





/* =================================================================== */
/*             DARK THEME FIXES FOR MODALS & REVIEW CENTER             */
/* =================================================================== */

/* --- Review Modal: Mission Briefing --- */
[data-theme="dark"] .mission-briefing {
    background-color: #0f172a; /* Darker background */
    border-bottom-color: #334155;
}
[data-theme="dark"] .briefing-item span {
    color: #e2e8f0;
}
[data-theme="dark"] .briefing-item i {
    color: #FB923C; /* Cyan Icon */
}

/* --- Review Modal: Tabs --- */
[data-theme="dark"] .vendor-tabs-nav {
    border-bottom-color: #334155;
}
[data-theme="dark"] .vendor-tab-link {
    color: #94a3b8;
}
[data-theme="dark"] .vendor-tab-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
}
[data-theme="dark"] .vendor-tab-link.active {
    color: #FB923C;
    border-bottom-color: #FB923C;
}

/* --- Review Modal: Dossier Cards --- */
[data-theme="dark"] .dossier-card {
    background-color: #1e293b; /* Dark Card Bg */
    border-color: #334155;
}
[data-theme="dark"] .dossier-card.is-locked {
    background-color: #0f172a; /* Even darker for locked */
    opacity: 0.8;
}
[data-theme="dark"] .dossier-card__header {
    border-bottom-color: #334155;
}
[data-theme="dark"] .dossier-card__vendor-name {
    color: #f1f5f9;
}
[data-theme="dark"] .details-column {
    border-left-color: #334155;
}
[data-theme="dark"] .details-item .label {
    color: #94a3b8;
}
[data-theme="dark"] .details-item .value {
    color: #f1f5f9;
}

/* --- Review Modal: History Log --- */
[data-theme="dark"] .decision-history {
    border-left-color: #334155;
}
[data-theme="dark"] .decision-history h4 {
    color: #f1f5f9;
    border-bottom-color: #334155;
}
[data-theme="dark"] .history-entry {
    border-bottom-color: #334155;
}
[data-theme="dark"] .history-reason {
    background-color: #0f172a;
    color: #cbd5e1;
    border-left-color: #ef4444;
}
[data-theme="dark"] .history-meta {
    color: #F97316;
}

/* --- General View Details Modal (Fieldsets) --- */
[data-theme="dark"] fieldset {
    border-color: #334155;
}
[data-theme="dark"] legend {
    color: #FB923C;
}
[data-theme="dark"] .details-grid__label {
    background-color: #0f172a; /* Dark background for label box */
    color: #cbd5e1;
}
[data-theme="dark"] .details-grid__value {
    background-color: #1e293b; /* Slightly lighter for value box */
    border-color: #334155;
    color: #f1f5f9;
    box-shadow: none;
}

/* --- Transport Details Modal (Summary Bar) --- */
[data-theme="dark"] .transport-summary-bar {
    background-color: #0f172a;
    border-color: #334155;
}
[data-theme="dark"] .transport-summary-bar .label {
    color: #94a3b8;
}
[data-theme="dark"] .transport-summary-bar .value {
    color: #f1f5f9;
}
[data-theme="dark"] .doc-column-header {
    color: #e2e8f0;
    border-bottom-color: #334155;
}
[data-theme="dark"] .doc-meta {
    color: #94a3b8;
}
[data-theme="dark"] .btn-doc-action {
    background-color: #0f172a;
    border-color: #334155;
    color: #cbd5e1;
}
[data-theme="dark"] .btn-doc-action:hover {
    background-color: #334155;
}


/* =================================================================== */
/*             DARK THEME FIXES FOR RADIO BUTTONS                      */
/* =================================================================== */

[data-theme="dark"] .radio-label {
    background-color: #0f172a; /* Dark background matching inputs */
    border-color: #334155;     /* Dark border */
    color: #94a3b8;            /* Muted text */
}

[data-theme="dark"] .radio-label:hover {
    background-color: #1e293b;
    border-color: #FB923C;     /* Cyan highlight on hover */
    color: #f1f5f9;
}

/* Selected State in Dark Mode */
[data-theme="dark"] .radio-group > .radio-label:has(input:checked) {
    background-color: #172554; /* Deep Blue background */
    border-color: #F97316;     /* Bright Blue border */
    color: #ffffff;            /* White text */
    box-shadow: 0 0 0 1px #F97316;
}

[data-theme="dark"] .radio-label input[type="radio"]:checked + i {
    color: #FB923C; /* Light Blue Icon */
}

[data-theme="dark"] .radio-label input[type="radio"]:checked + i + span {
    color: #ffffff;
}




/* Clickable Warning Link */
.btn-link-warning {
    background: none;
    border: none;
    color: #9b2c2c; /* Dark Red Text */
    text-decoration: underline;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    font-size: 0.9rem;
}

.btn-link-warning:hover {
    color: #c53030; /* Lighter Red on hover */
}






/* =================================================================== */
/*             DARK THEME REPORT FIXES                                 */
/* =================================================================== */

/* 1. Report List Page */
[data-theme="dark"] .report-card__footer {
    background-color: #0f172a;
    border-top-color: #334155;
}

[data-theme="dark"] .report-date-input {
    background-color: #1e293b;
    border-color: #EA580C;
    color: #f1f5f9;
}

/* 2. Generated Report View (The Paper Sheet) */
[data-theme="dark"] .report-container {
    background-color: #1e293b;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    border: 1px solid #334155;
}

[data-theme="dark"] .report-header {
    border-bottom-color: #FB923C; /* Cyan accent for separation */
}

[data-theme="dark"] .report-header h1 {
    color: #f1f5f9;
}

/* 3. Report Items (Rows inside the report) */
[data-theme="dark"] .report-item-card {
    background-color: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .report-item-header:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .report-item-description {
    color: #cbd5e1; /* Lighter grey for description text */
    border-top-color: #334155;
}

[data-theme="dark"] .location span {
    color: #94a3b8; /* Muted label text */
}

[data-theme="dark"] .route-arrow {
    color: #F97316;
}

[data-theme="dark"] .bid-id {
    color: #f1f5f9;
}

/* 4. Charts */
[data-theme="dark"] .chart-card {
    background-color: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .chart-card h4 {
    color: #f1f5f9;
    border-bottom-color: #334155;
}

/* Smart Chart Fix: Invert colors so black text becomes white */
[data-theme="dark"] canvas {
    filter: invert(1) hue-rotate(180deg);
}

/* 5. History Popovers */
[data-theme="dark"] .history-popover {
    background-color: #1e293b;
    border-color: #EA580C;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

[data-theme="dark"] .history-popover h6 {
    color: #f1f5f9;
    border-bottom-color: #334155;
}

[data-theme="dark"] .history-popover .bid-history-item {
    border-bottom-color: #334155;
}

[data-theme="dark"] .history-popover .bid-history-item .timestamp {
    color: #94a3b8;
}

[data-theme="dark"] .toggle-history-btn {
    border-color: #EA580C;
    color: #e2e8f0;
}

[data-theme="dark"] .toggle-history-btn:hover {
    background-color: #334155;
}











/* =================================================================== */
/*             NUMBER STEPPER (Truck Quantity)                         */
/* =================================================================== */
.number-stepper {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
    height: 45px; /* Fixed height for consistency */
}

.number-stepper input {
    border: none !important;
    border-radius: 0 !important;
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    -moz-appearance: textfield; /* Remove default arrows Firefox */
    width: 100%;
}

/* Remove default arrows Chrome/Safari */
.number-stepper input::-webkit-outer-spin-button,
.number-stepper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.step-btn {
    background-color: #f8fafc;
    border: none;
    width: 50px;
    cursor: pointer;
    color: var(--color-primary);
    font-size: 1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-btn.minus { border-right: 1px solid var(--color-border); }
.step-btn.plus { border-left: 1px solid var(--color-border); }

.step-btn:hover { background-color: #e2e8f0; color: var(--color-primary-dark); }
.step-btn:active { background-color: #cbd5e1; }

/* Dark Mode Support */
[data-theme="dark"] .number-stepper { border-color: #EA580C; }
[data-theme="dark"] .step-btn { background-color: #1e293b; color: #cbd5e1; }
[data-theme="dark"] .step-btn.minus { border-right-color: #EA580C; }
[data-theme="dark"] .step-btn.plus { border-left-color: #EA580C; }
[data-theme="dark"] .step-btn:hover { background-color: #334155; color: #fff; }



/* =================================================================== */
/*             INVOICE GATING UI                                       */
/* =================================================================== */
.invoice-section {
    background-color: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 25px;
}

.invoice-section h4 {
    margin: 0 0 15px 0;
    font-size: 1rem;
    color: var(--color-dark);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 8px;
}

.invoice-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.invoice-input-group input {
    flex-grow: 1;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
}

.invoice-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.invoice-chip {
    display: inline-flex;
    align-items: center;
    background-color: #FFEDD5; /* Light Blue */
    color: #EA580C; /* Dark Blue */
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid #bae6fd;
}

.invoice-chip .remove-btn {
    margin-left: 8px;
    cursor: pointer;
    color: #C2410C;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.invoice-chip .remove-btn:hover {
    background-color: rgba(0,0,0,0.1);
    color: #ef4444;
}

/* Disabled Approve Button Styles */
.btn-approve-vendor:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #94a3b8; /* Greyed out */
    border-color: #cbd5e1;
}

/* Dark Mode Support */
[data-theme="dark"] .invoice-section {
    background-color: #1e293b;
    border-color: #334155;
}
[data-theme="dark"] .invoice-section h4 {
    color: #f1f5f9;
    border-bottom-color: #334155;
}
[data-theme="dark"] .invoice-input-group input {
    background-color: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}
[data-theme="dark"] .invoice-chip {
    background-color: #172554;
    color: #93c5fd;
    border-color: #7C2D12;
}
[data-theme="dark"] .invoice-chip .remove-btn {
    color: #FB923C;
}





/* =================================================================== */
/*             DOC CENTER HISTORY TOGGLE                               */
/* =================================================================== */

/* Hide archived cards when the container has this class */
.doc-list.hide-archived .doc-card.archived {
    display: none;
}

/* Style for the Show/Hide History Button */
.btn-toggle-history {
    display: block;
    width: 100%;
    padding: 10px;
    background-color: #f8fafc;
    border: none;
    border-top: 1px solid var(--color-border);
    color: var(--color-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 0 0 8px 8px; /* Rounded bottom to match column */
}

.btn-toggle-history:hover {
    background-color: #e2e8f0;
    color: var(--color-primary-dark);
}

[data-theme="dark"] .btn-toggle-history {
    background-color: #1e293b;
    border-top-color: #334155;
    color: #94a3b8;
}

[data-theme="dark"] .btn-toggle-history:hover {
    background-color: #334155;
    color: #f1f5f9;
}

/* Helper to hide extra items in the "Others" column */
.doc-card.hidden-item {
    display: none !important;
}


/* =================================================================== */
/*             DARK THEME POLISH (New Features)                        */
/* =================================================================== */

/* 1. Address Suffix (City - Pincode Box) */
[data-theme="dark"] .input-suffix {
    background-color: #1e293b;
    border-color: #334155;
    color: #94a3b8; /* Muted text */
    border-left-color: #EA580C;
}

/* 2. Number Stepper (Truck Quantity) */
[data-theme="dark"] .number-stepper {
    border-color: #334155;
    background-color: #0f172a;
}

[data-theme="dark"] .number-stepper input {
    background-color: #0f172a;
    color: #f1f5f9;
}

[data-theme="dark"] .step-btn {
    background-color: #1e293b;
    color: #cbd5e1;
    border-color: #334155;
}

[data-theme="dark"] .step-btn:hover {
    background-color: #334155;
    color: #fff;
}

/* 3. Transport & Document Center (Summary Bar) */
[data-theme="dark"] .transport-summary-bar {
    background-color: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .transport-summary-bar .label {
    color: #94a3b8; /* Muted Label */
}

[data-theme="dark"] .transport-summary-bar .value {
    color: #f1f5f9; /* Bright Value */
}

/* Specific fix for the Phone Icon in Driver Details */
[data-theme="dark"] #displayDriverDetails .fa-phone {
    color: #FB923C !important; /* Bright Cyan */
}

/* 4. Invoice Management (Chips & Inputs) */
[data-theme="dark"] .invoice-section {
    background-color: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .invoice-input-group input {
    background-color: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

[data-theme="dark"] .invoice-chip {
    background-color: #172554; /* Deep Blue */
    color: #FED7AA; /* Light Blue Text */
    border-color: #7C2D12;
}

[data-theme="dark"] .invoice-chip .remove-btn {
    color: #FB923C;
}

[data-theme="dark"] .invoice-chip .remove-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #f87171; /* Red hover */
}


/* =================================================================== */
/*             DARK THEME GAPS (Driver, Chips, Session Modal)          */
/* =================================================================== */

/* 1. Fix Driver Details Text (Overriding inline #555) */
[data-theme="dark"] #displayDriverDetails div[style*="color: #555"] {
    color: #94a3b8 !important;
}

/* 2. Document Source Chips */
[data-theme="dark"] .doc-source-chip.vendor {
    background-color: #334155;
    color: #cbd5e1;
    border: 1px solid #EA580C;
}

[data-theme="dark"] .doc-source-chip.company {
    background-color: #064e3b; /* Dark Green */
    color: #6ee7b7; /* Light Green text */
    border: 1px solid #065f46;
}

/* 3. Session Expiry Modal (Overriding inline styles) */
[data-theme="dark"] #sessionExpiryModalOverlay .modal {
    background-color: #1e293b !important;
    border-color: #991b1b !important; /* Dark Red Border */
}

[data-theme="dark"] #sessionExpiryModalOverlay .modal__header {
    background-color: #450a0a !important; /* Very Dark Red */
    border-bottom-color: #7f1d1d !important;
}

[data-theme="dark"] #sessionExpiryModalOverlay .modal__title {
    color: #fca5a5 !important; /* Light Red Text */
}

[data-theme="dark"] #sessionExpiryModalOverlay p {
    color: #cbd5e1 !important; /* Light Grey Paragraph */
}

[data-theme="dark"] #reloginUsername {
    background-color: #0f172a !important;
    color: #94a3b8;
    border-color: #334155;
}

[data-theme="dark"] #reloginPassword {
    background-color: #0f172a !important;
    color: #f1f5f9;
    border-color: #334155 !important;
}


/* =================================================================== */
/*             CHALLAN & PAYMENT UI POLISH                             */
/* =================================================================== */

/* 1. Search Bar Container */
.payment-tools-container {
    background-color: var(--color-light);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.search-group-modern {
    position: relative;
    flex-grow: 1;
    max-width: 400px;
}

.search-group-modern input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border-radius: 50px;
    border: 1px solid var(--color-border);
    background-color: var(--color-white);
    transition: all 0.2s;
}

.search-group-modern input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
    outline: none;
}

.search-group-modern i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

/* 2. Summary Card Design */
.challan-summary-card {
    background-color: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 15px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid transparent;
    position: relative;
}

.challan-summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    border-color: var(--color-primary-light); /* Slight tint */
    border-left-color: var(--color-primary);
}

.challan-card-header h5 {
    margin: 0 0 8px 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-dark);
}

.challan-stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background-color: #f1f5f9;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #EA580C;
    font-weight: 500;
}

.stat-pill i {
    margin-right: 6px;
    color: #F97316;
}

.stat-pill.money { background-color: #ecfdf5; color: #065f46; }
.stat-pill.money i { color: #10b981; }

.stat-pill.files { background-color: #eff6ff; color: #9A3412; }
.stat-pill.files i { color: #F97316; }

.challan-card-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
}

.challan-pending-badge {
    background-color: #fff7ed;
    color: #c2410c;
    border: 1px solid #ffedd5;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.challan-pending-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background-color: #f97316;
    border-radius: 50%;
    display: inline-block;
}

/* 3. Detail View Header */
.detail-view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f8fafc;
    padding: 15px 20px;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    margin-bottom: 20px;
}

.btn-back-pill {
    background: white;
    border: 1px solid var(--color-border);
    padding: 6px 15px;
    border-radius: 20px;
    color: var(--color-text);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-back-pill:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* Dark Mode Overrides */
[data-theme="dark"] .payment-tools-container,
[data-theme="dark"] .challan-summary-card,
[data-theme="dark"] .detail-view-header {
    background-color: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .search-group-modern input {
    background-color: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

[data-theme="dark"] .challan-card-header h5 { color: #f1f5f9; }

[data-theme="dark"] .stat-pill {
    background-color: #0f172a;
    color: #94a3b8;
}
[data-theme="dark"] .stat-pill.money { background-color: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .stat-pill.files { background-color: #172554; color: #93c5fd; }

[data-theme="dark"] .challan-pending-badge {
    background-color: #431407;
    color: #fdba74;
    border-color: #78350f;
}

[data-theme="dark"] .btn-back-pill {
    background-color: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}
[data-theme="dark"] .btn-back-pill:hover {
    border-color: #FB923C;
    color: #FB923C;
}


/* =================================================================== */
/*             SUPPORT PAGE STYLES                                     */
/* =================================================================== */

.file-upload-box {
    border: 2px dashed var(--color-border);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    background-color: #f8fafc;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #F97316;
}

.file-upload-box:hover {
    border-color: var(--color-primary);
    background-color: #f1f5f9;
    color: var(--color-primary);
}

.file-upload-box i {
    font-size: 2rem;
    margin-bottom: 10px;
}

.file-upload-box p {
    margin: 0;
    font-weight: 500;
}

.file-upload-box .file-info {
    display: block;
    font-size: 0.8rem;
    margin-top: 5px;
    color: #94a3b8;
}

#selectedFileDisplay {
    margin-top: 10px;
    padding: 10px;
    background-color: #FFEDD5;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #EA580C;
    font-weight: 500;
}

.progress-bar-wrapper {
    width: 100%;
    height: 8px;
    background-color: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 15px;
    margin-bottom: 5px;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--color-success);
    transition: width 0.2s ease;
}

/* Dark Mode Support */
[data-theme="dark"] .file-upload-box {
    background-color: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}
[data-theme="dark"] .file-upload-box:hover {
    background-color: #334155;
    border-color: #FB923C;
    color: #f1f5f9;
}
[data-theme="dark"] #selectedFileDisplay {
    background-color: #172554;
    border-color: #7C2D12;
    color: #FED7AA;
}
[data-theme="dark"] .progress-bar-wrapper {
    background-color: #334155;
}






/* =================================================================== */
/*             PROFILE DROPDOWN MENU                                   */
/* =================================================================== */

.header__user-capsule {
    position: relative; /* Anchor for the dropdown */
    cursor: pointer;
    user-select: none;
}

.profile-dropdown {
    position: absolute;
    top: 120%; /* Below the capsule */
    right: 0;
    width: 220px;
    background-color: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Active State */
.profile-dropdown.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    display: flex; /* Ensure display is flex when active */
}

/* Hidden Utility */
.profile-dropdown.hidden {
    display: none; /* Hard hide for logic */
}

.profile-dropdown__header {
    padding: 12px 15px;
    background-color: #f8fafc;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-dropdown__item {
    padding: 12px 20px;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color 0.1s;
}

.profile-dropdown__item i {
    color: var(--color-primary);
    width: 20px;
    text-align: center;
}

.profile-dropdown__item:hover {
    background-color: #f1f5f9;
    color: var(--color-primary);
}

.profile-dropdown__item.logout-item {
    color: var(--color-danger);
}

.profile-dropdown__item.logout-item i {
    color: var(--color-danger);
}

.profile-dropdown__item.logout-item:hover {
    background-color: #fef2f2;
}

.profile-dropdown__divider {
    height: 1px;
    background-color: var(--color-border);
    margin: 4px 0;
}

/* Dark Mode Support for Dropdown */
[data-theme="dark"] .profile-dropdown {
    background-color: #1e293b;
    border-color: #334155;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

[data-theme="dark"] .profile-dropdown__header {
    background-color: #0f172a;
    border-bottom-color: #334155;
    color: #F97316;
}

[data-theme="dark"] .profile-dropdown__item:hover {
    background-color: #334155;
    color: #f1f5f9;
}

[data-theme="dark"] .profile-dropdown__item.logout-item:hover {
    background-color: #450a0a;
}

[data-theme="dark"] .profile-dropdown__divider {
    background-color: #334155;
}





/* =================================================================== */
/*             INPUT WITH APPENDED BUTTON (Time Picker)                */
/* =================================================================== */
.input-with-btn {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.input-with-btn input {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    flex-grow: 1;
}

.btn-input-append {
    background-color: #e2e8f0;
    color: var(--color-primary);
    border: 1px solid var(--color-border);
    border-left: none; /* Merge with input */
    border-radius: 0 6px 6px 0;
    padding: 0 15px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-input-append:hover {
    background-color: #cbd5e1;
    color: var(--color-primary-dark);
}

.btn-input-append:active {
    background-color: #94a3b8;
}

/* Dark Mode */
[data-theme="dark"] .btn-input-append {
    background-color: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

[data-theme="dark"] .btn-input-append:hover {
    background-color: #334155;
    color: #f1f5f9;
}



/* =================================================================== */
/*             TIME PICKER CHIPS                                       */
/* =================================================================== */
.quick-time-container {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.time-chip {
    background-color: #fff;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.time-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-1px);
}

.time-chip.active {
    background-color: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Dark Mode */
[data-theme="dark"] .time-chip {
    background-color: #1e293b;
    border-color: #EA580C;
    color: #cbd5e1;
}

[data-theme="dark"] .time-chip:hover {
    border-color: #FB923C;
    color: #f1f5f9;
}

[data-theme="dark"] .time-chip.active {
    background-color: #FB923C; /* Cyan */
    color: #0f172a; /* Dark Text */
    border-color: #FB923C;
}

[data-theme="dark"] #timeCalculationDisplay {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}



/* =================================================================== */
/*             QUICK TIME SELECTOR                              */
/* =================================================================== */
.quick-time-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.time-chip {
    background-color: #FFFBEB;
    border: 1px solid #bae6fd;
    color: #EA580C;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.time-chip:hover {
    background-color: #EA580C;
    color: #ffffff;
    border-color: #EA580C;
}

/* Dark Mode */
[data-theme="dark"] .time-chip {
    background-color: #172554;
    border-color: #9A3412;
    color: #FED7AA;
}

[data-theme="dark"] .time-chip:hover {
    background-color: #F97316;
    color: white;
}




/* =================================================================== */
/*             LOGIN PASSWORD TOGGLE                                   */
/* =================================================================== */
.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper input {
    width: 100%;
    padding-right: 40px; /* Space for the icon */
}

.password-toggle-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 5px;
    font-size: 0.9rem;
    z-index: 2;
    transition: color 0.2s;
}

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

.password-toggle-btn:focus {
    outline: none;
    color: var(--color-primary);
}




/* =================================================================== */
/*             IMAGE SCANNER STYLES                                    */
/* =================================================================== */
.btn-link-action:hover {
    text-decoration: underline;
    color: var(--color-primary-dark);
}

/* Image Preview in Dark Mode */
[data-theme="dark"] #destImagePreviewContainer {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

[data-theme="dark"] #destImagePreviewContainer span {
    color: #cbd5e1 !important;
}

[data-theme="dark"] #destImagePreviewContainer span[style*="color: var(--color-success)"] {
    color: #4ade80 !important;
}



/* =================================================================== */
/*             IMAGE PREVIEW & ADDRESS FIXES                           */
/* =================================================================== */

/* 1. Image Preview Box */
.image-preview-box {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f0fdf4; /* Light Green Bg */
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 10px 15px;
    transition: all 0.2s;
}

.preview-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.preview-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
}

.preview-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.success-text {
    color: #16a34a;
    font-size: 0.9rem;
    font-weight: 600;
}

.view-link {
    font-size: 0.85rem;
    color: var(--color-primary);
    text-decoration: underline;
    cursor: pointer;
}

.remove-icon {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
}

.remove-icon:hover {
    color: #b91c1c;
    transform: scale(1.1);
}

/* Dark Mode Overrides */
[data-theme="dark"] .image-preview-box {
    background-color: #064e3b;
    border-color: #065f46;
}
[data-theme="dark"] .success-text { color: #4ade80; }
[data-theme="dark"] .view-link { color: #FED7AA; }



/* =================================================================== */
/*             NEW: BID REVIEW & ADDRESS DROPDOWN STYLES               */
/* =================================================================== */

/* 1. Address Dropdown styling */
.address-select-wrapper {
    position: relative;
    margin-bottom: 10px;
}
.address-select-wrapper select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background-color: #FFFBEB; /* Light blue tint to indicate helper */
    color: var(--color-primary-dark);
    font-weight: 500;
}

/* 2. Review Mode Grid */
.review-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    background-color: #f8fafc;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.review-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.review-label {
    font-size: 0.8rem;
    color: #F97316;
    text-transform: uppercase;
    font-weight: 600;
}

.review-value {
    font-size: 1rem;
    color: var(--color-dark);
    font-weight: 500;
    word-break: break-word;
}

.review-full-width {
    grid-column: 1 / -1;
    border-top: 1px dashed var(--color-border);
    padding-top: 15px;
    margin-top: 5px;
}

/* 3. Confirmation Checkbox Area */
.confirmation-box {
    margin-top: 25px;
    padding: 15px;
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid var(--color-primary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.confirmation-box input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.confirmation-box label {
    font-weight: 600;
    color: var(--color-dark);
    cursor: pointer;
    user-select: none;
}

/* Dark Mode support for new elements */
[data-theme="dark"] .review-grid {
    background-color: #1e293b;
    border-color: #334155;
}
[data-theme="dark"] .review-label { color: #94a3b8; }
[data-theme="dark"] .review-value { color: #f1f5f9; }
[data-theme="dark"] .address-select-wrapper select {
    background-color: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}
[data-theme="dark"] .confirmation-box {
    background-color: #0f172a;
    border-color: #334155;
    border-left-color: #FB923C;
}
[data-theme="dark"] .confirmation-box label { color: #f1f5f9; }


/* =================================================================== */
/*             PASTE TIP STYLING                                       */
/* =================================================================== */
.paste-tip {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 0.8rem;
    color: #F97316; /* Indigo color for "Tip" */
    background-color: #FFF7ED;
    padding: 4px 10px;
    border-radius: 4px;
    width: fit-content;
    border: 1px dashed #c7d2fe;
}

.paste-tip i {
    color: #EA580C;
}

/* Dark Mode Support */
[data-theme="dark"] .paste-tip {
    background-color: #1e1b4b; /* Dark Indigo */
    color: #a5b4fc;
    border-color: #C2410C;
}
[data-theme="dark"] .paste-tip i {
    color: #FB923C;
}






/* =================================================================== */

/* =================================================================== */
/*             ROUTE ANALYSIS REPORT STYLES                            */
/* =================================================================== */
.route-analysis-card {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    overflow: hidden;
}

.route-header {
    background-color: #f8fafc;
    padding: 15px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.route-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.route-stats-badges {
    display: flex;
    gap: 10px;
}

.stat-badge {
    font-size: 0.85rem;
    padding: 4px 10px;
    background: #FFF7ED;
    color: #EA580C;
    border-radius: 20px;
    border: 1px solid #c7d2fe;
    font-weight: 500;
}

.vehicle-group-row {
    background-color: #fff !important;
    border-bottom: 2px solid #f1f5f9;
}

.vehicle-group-header {
    font-weight: 600;
    color: var(--color-primary-dark);
    background-color: #f1f5f9;
    padding: 8px 15px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 5px;
}

.sub-table {
    width: 100%;
    font-size: 0.9rem;
    border-collapse: collapse;
    margin-top: 5px;
}

.sub-table th {
    background-color: #fff;
    color: #F97316;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
    padding: 6px 10px;
    text-align: left;
}

.sub-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

[data-theme="dark"] .route-analysis-card {
    background-color: #1e293b;
    border-color: #334155;
}
[data-theme="dark"] .route-header {
    background-color: #0f172a;
    border-bottom-color: #334155;
}
[data-theme="dark"] .route-title { color: #f1f5f9; }
[data-theme="dark"] .stat-badge {
    background-color: #1e1b4b;
    color: #a5b4fc;
    border-color: #7C2D12;
}
[data-theme="dark"] .vehicle-group-row { background-color: #1e293b !important; }
[data-theme="dark"] .vehicle-group-header {
    background-color: #334155;
    color: #f1f5f9;
}
[data-theme="dark"] .sub-table th {
    background-color: #1e293b;
    color: #94a3b8;
    border-bottom-color: #334155;
}
[data-theme="dark"] .sub-table td {
    border-bottom-color: #334155;
    color: #cbd5e1;
}




/* =================================================================== */
/*             NEW REPORTS: STATEMENT & PRICE ESTIMATOR                */
/* =================================================================== */

/* --- Financial Summary Cards (Statement of Account) --- */
.fin-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.fin-card {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.fin-card.highlight {
    background-color: #f0fdf4; /* Light Green */
    border-color: #bbf7d0;
}

.fin-card .label {
    display: block;
    font-size: 0.85rem;
    color: #F97316;
    margin-bottom: 5px;
    text-transform: uppercase;
    font-weight: 600;
}

.fin-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-dark);
}

.fin-card.highlight .value {
    color: #15803d; /* Green Text */
}

/* --- Ledger Table Styling --- */
.ledger-table th {
    background-color: #f1f5f9;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.amount-credit { color: #16a34a; font-weight: 600; }
.amount-debit { color: #dc2626; font-weight: 600; }

/* --- Price Estimator Layout --- */
.estimator-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

@media (max-width: 1000px) {
    .estimator-layout { grid-template-columns: 1fr; }
}

.price-stat-box {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 20px;
}

.price-stat-item {
    text-align: center;
}

.price-stat-item small {
    display: block;
    color: #F97316;
    margin-bottom: 4px;
}

.price-stat-item strong {
    font-size: 1.4rem;
    color: var(--color-primary);
}

/* Dark Mode Overrides */
[data-theme="dark"] .fin-card { background-color: #1e293b; border-color: #334155; }
[data-theme="dark"] .fin-card.highlight { background-color: #064e3b; border-color: #065f46; }
[data-theme="dark"] .fin-card.highlight .value { color: #86efac; }
[data-theme="dark"] .price-stat-box { background-color: #1e293b; border-color: #334155; }
[data-theme="dark"] .fin-card .value { color: #f1f5f9; }




/* =================================================================== */
/*             NEW REPORTS: STATEMENT & PRICE ESTIMATOR                */
/* =================================================================== */

/* --- Financial Summary Cards (Statement of Account) --- */
.fin-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.fin-card {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.fin-card.highlight {
    background-color: #f0fdf4; /* Light Green */
    border-color: #bbf7d0;
}

.fin-card .label {
    display: block;
    font-size: 0.85rem;
    color: #F97316;
    margin-bottom: 5px;
    text-transform: uppercase;
    font-weight: 600;
}

.fin-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-dark);
}

.fin-card.highlight .value {
    color: #15803d; /* Green Text */
}

/* --- Ledger Table Styling --- */
.ledger-table th {
    background-color: #f1f5f9;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.amount-credit { color: #16a34a; font-weight: 600; }
.amount-debit { color: #dc2626; font-weight: 600; }

/* --- Price Estimator Layout --- */
.estimator-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

@media (max-width: 1000px) {
    .estimator-layout { grid-template-columns: 1fr; }
}

.price-stat-box {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 20px;
}

.price-stat-item {
    text-align: center;
}

.price-stat-item small {
    display: block;
    color: #F97316;
    margin-bottom: 4px;
}

.price-stat-item strong {
    font-size: 1.4rem;
    color: var(--color-primary);
}

/* Dark Mode Overrides */
[data-theme="dark"] .fin-card { background-color: #1e293b; border-color: #334155; }
[data-theme="dark"] .fin-card.highlight { background-color: #064e3b; border-color: #065f46; }
[data-theme="dark"] .fin-card.highlight .value { color: #86efac; }
[data-theme="dark"] .price-stat-box { background-color: #1e293b; border-color: #334155; }
[data-theme="dark"] .fin-card .value { color: #f1f5f9; }





/* =================================================================== */
/*             REPORT CARD FORM LAYOUT (FINAL RESPONSIVE)              */
/* =================================================================== */

.report-card__footer {
    background-color: #f8fafc;
    border-top: 1px solid var(--color-border);
}

.report-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: flex;
    flex-wrap: wrap; /* This is key for responsiveness */
    gap: 15px 20px;
}

.form-col {
    flex-grow: 1;
    flex-basis: 0; /* Allows columns to grow and shrink evenly */
    min-width: 150px; /* Forces columns to stack when they get too small */
}

/* Label Positioning */
.label-row {
    width: 100%;
    margin-bottom: 4px;
}
.label-row label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #F97316;
    display: block;
}
.label-right { text-align: right; }
.label-center { text-align: center; }


/* Specific Input Groups */
.route-select-group,
.date-inputs-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.report-input { /* A common class for all inputs in the form */
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--color-text);
    background-color: var(--color-white);
}

.route-arrow-icon { color: #94a3b8; }
.date-inputs-group span { color: #94a3b8; }

.date-shortcuts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.date-shortcuts-grid .btn-date-shortcut {
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #EA580C;
    padding-top: 6px;
    padding-bottom: 6px;
}

.date-shortcuts-grid .btn-date-shortcut:hover {
    background-color: #e2e8f0;
    border-color: #cbd5e1;
}

/* Dark Mode Adjustments */
[data-theme="dark"] .report-card__footer {
    background-color: #0f172a;
    border-top-color: #334155;
}
[data-theme="dark"] .label-row label {
    color: #94a3b8;
}
[data-theme="dark"] .report-input {
    background-color: #1e293b;
    border-color: #EA580C;
    color: #f1f5f9;
}
[data-theme="dark"] .route-arrow-icon,
[data-theme="dark"] .date-inputs-group span {
    color: #F97316;
}
[data-theme="dark"] .date-shortcuts-grid .btn-date-shortcut {
    background-color: #334155;
    border-color: #EA580C;
    color: #cbd5e1;
}
[data-theme="dark"] .date-shortcuts-grid .btn-date-shortcut:hover {
    background-color: #EA580C;
    border-color: #F97316;
}



/* =================================================================== */
/*             NEW REPORTS UI: STAT BOXES & UTILITIES                  */
/* =================================================================== */

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-box {
    padding: 15px 20px;
    border-radius: 8px;
    border-left: 4px solid #ccc;
    background: #f9fafb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: transform 0.2s ease;
}

.stat-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.stat-box h4 {
    margin: 0 0 5px 0;
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-box .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-dark);
}

/* Text Utilities for Reports */
.text-right { text-align: right !important; }
.text-green { color: #059669 !important; }
.text-red { color: #dc2626 !important; }
.text-blue { color: #EA580C !important; }

/* Table adjustments for detailed nested views */
.table td small {
    display: block;
    margin-top: 3px;
    font-size: 0.85em;
}

/* Dark Mode Overrides for New Elements */ .stat-box {
    background: #1e293b;
    border-color: #334155;
} .stat-box { background: #451a03 !important; } .stat-box { background: #064e3b !important; } .stat-box h4 { color: #94a3b8; } .stat-box .value { color: #f1f5f9; } .text-blue { color: #FB923C !important; } .text-green { color: #34d399 !important; } .text-red { color: #f87171 !important; }












/* =================================================================== */
/*             PRINT FIXES                                             */
/* =================================================================== */
@media print {
    /* Force all badges to show, not just success ones */
    .table .badge { 
        display: inline-block !important; 
        border: 1px solid #ccc !important; 
        color: #000 !important; 
        background-color: transparent !important;
        padding: 2px 5px;
    }
    
    /* Ensure colors print for money */
    .amount-credit { color: #000 !important; }
    .amount-debit { color: #000 !important; }
    
    /* Fix Grid layout for summary cards in print */
    .fin-summary-grid {
        display: flex !important;
        justify-content: space-between;
        margin-bottom: 20px;
    }
    .fin-card {
        border: 1px solid #000 !important;
        flex: 1;
        margin: 0 5px;
    }
}




/* =================================================================== */
/*             PRINT FIX FOR STATEMENT REPORT                          */
/* =================================================================== */
@media print {
    /* Force ALL badges (Success, Danger, Secondary) to show */
    .table .badge,
    .table .badge:not(.badge-success) { 
        display: inline-block !important;
        visibility: visible !important;
        
        /* Make them look like simple text labels in print */
        background-color: transparent !important;
        color: #000 !important;
        border: 1px solid #666 !important;
        padding: 1px 4px;
        font-weight: bold;
    }

    /* Ensure specific colors for Debit/Credit numbers print correctly */
    .amount-credit { color: #000 !important; font-weight: bold; }
    .amount-debit { color: #000 !important; font-weight: bold; }
    
    /* Ensure the summary cards (Freight, Challan, Net Payable) show up */
    .fin-summary-grid {
        display: flex !important;
        flex-direction: row;
        gap: 10px;
        margin-bottom: 20px;
        width: 100%;
    }
    
    .fin-card {
        flex: 1;
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
}

/* =================================================================== */
/*             PRINT FIX: SHOW BALANCE COLUMN                          */
/* =================================================================== */
@media print {
    /* Override the default rule that hides the last column */
    .ledger-table thead tr th:last-child,
    .ledger-table tbody tr td:last-child {
        display: table-cell !important;
    }
}

/* =================================================================== */
/*        FINAL PRINT FIX: FORCE BALANCE COLUMN VISIBILITY             */
/* =================================================================== */
@media print {
    /* 
       We use ".table.ledger-table" to be more specific than just ".table".
       This forces the browser to ignore the "Hide Last Child" rule 
       specifically for the Statement of Account table.
    */
    .table.ledger-table th:last-child,
    .table.ledger-table td:last-child {
        display: table-cell !important;
        visibility: visible !important;
        width: auto !important;
        background-color: transparent !important;
        color: #000 !important; 
        border-bottom: 1px solid #ccc !important;
    }
}



/* =================================================================== */
/*             PRINT FIXES FOR REPORTS                                 */
/* =================================================================== */
@media print {
    /* 1. Force background colors to print (Chrome/Safari) */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* 2. Make sure Badges are visible */
    .badge {
        border: 1px solid #000 !important;
        color: #000 !important;
        font-weight: bold !important;
        padding: 2px 6px !important;
    }
    
    /* Specific badge colors for print to ensure contrast if color ink is low */
    .badge-primary, .badge-success { border-color: #059669 !important; } /* Green border */
    .badge-danger { border-color: #DC2626 !important; } /* Red border */

    /* 3. Ensure Summary Cards Grid prints horizontally */
    .fin-summary-grid {
        display: flex !important;
        flex-direction: row !important;
        gap: 10px !important;
        page-break-inside: avoid;
    }
    
    .fin-card {
        flex: 1 !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }

    /* 4. Ensure Table headers match requested names */
    .ledger-table th {
        background-color: #eee !important;
        color: #000 !important;
    }
}

/* =================================================================== */
/*        FINAL PRINT FIX: SHOW LAST COLUMNS IN REPORTS                */
/* =================================================================== */
@media print {
    /* Force show last column in ALL report tables */
    #reportContent .table thead tr th:last-child, 
    #reportContent .table tbody tr td:last-child,
    #reportContent .table tfoot tr td:last-child,
    #reportContent .table th:last-child,
    #reportContent .table td:last-child { 
        display: table-cell !important; 
        visibility: visible !important;
        width: auto !important;
    }
}


/* =================================================================== */
/*             UNIFIED REPORT PRINT FIXES                              */
/* =================================================================== */
@media print {
    /* 1. Force background colors to print (Chrome/Safari) */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* 2. Fix the Table Container so it doesn't cut off the right side */
    .table-container {
        overflow: visible !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    .table {
        width: 100% !important;
        max-width: 100% !important;
        word-wrap: break-word !important;
    }

    /* 3. Force show last column in ALL report tables (Overrides top CSS) */
    #reportContent .table thead tr th:last-child, 
    #reportContent .table tbody tr td:last-child,
    #reportContent .table tfoot tr td:last-child,
    #reportContent .table th:last-child,
    #reportContent .table td:last-child,
    .ledger-table th:last-child,
    .ledger-table td:last-child { 
        display: table-cell !important; 
        visibility: visible !important;
        width: auto !important;
        color: #000 !important;
    }

    /* 4. Ensure Summary Cards Grid prints side-by-side */
    .fin-summary-grid {
        display: flex !important;
        flex-direction: row !important;
        gap: 10px !important;
        page-break-inside: avoid;
        width: 100% !important;
    }
    .fin-card {
        flex: 1 !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        padding: 10px !important;
    }

    /* 5. Make sure Badges are visible */
    .table .badge,
    .table .badge:not(.badge-success) {
        display: inline-block !important;
        visibility: visible !important;
        border: 1px solid #666 !important;
        color: #000 !important;
        background-color: transparent !important;
        font-weight: bold !important;
        padding: 2px 6px !important;
    }
    
    /* Ensure specific colors for Debit/Credit numbers print correctly */
    .amount-credit { color: #000 !important; font-weight: bold !important; }
    .amount-debit { color: #000 !important; font-weight: bold !important; }
    .ledger-table th { background-color: #eee !important; color: #000 !important; }
}



/* =================================================================== */
/*             STATEMENT GROUPING FIX                                  */
/* =================================================================== */
/* Remove border between rows of the same Bid ID */
.table.ledger-table tr.grouped-row td {
    border-top: none !important;
    border-bottom: none !important;
}

/* Add a slightly thicker border at the end of a group */
.table.ledger-table tr.group-end td {
    border-bottom: 2px solid #cbd5e1 !important;
}

[data-theme="dark"] .table.ledger-table tr.group-end td {
    border-bottom: 2px solid #EA580C !important;
}

/* =================================================================== */
/*             STATEMENT GROUPING FIX (ENHANCED)                       */
/* =================================================================== */
/* Remove standard borders inside the ledger body */
.table.ledger-table tbody tr td {
    border-top: none !important;
    border-bottom: none !important;
}

/* Only draw a border at the end of a Bid ID group */
.table.ledger-table tbody tr.group-end td {
    border-bottom: 2px solid var(--color-border) !important;
}

[data-theme="dark"] .table.ledger-table tbody tr.group-end td {
    border-bottom: 2px solid #EA580C !important;
}


/* =================================================================== */
/*        DENSE REPORT TABLE & PRINT FIXES (LANDSCAPE)                 */
/* =================================================================== */

/* 1. Make the ledger table more compact on screen */
.ledger-table {
    font-size: 0.85rem;
    width: 100%;
    table-layout: auto;
}

.ledger-table th, .ledger-table td {
    padding: 8px 10px;
    white-space: nowrap; /* Keep dates, numbers, IDs on one line */
}

/* 2. Force the Description column to wrap so it doesn't push others off screen */
.ledger-table .col-desc {
    white-space: normal; 
    min-width: 180px;
    max-width: 350px;
    word-wrap: break-word;
}

/* 3. Ensure number columns have enough space */
.ledger-table .col-amount {
    min-width: 90px;
}

/* 4. PRINT OVERRIDES */
@media print {
    /* FORCE LANDSCAPE ORIENTATION FOR WIDE TABLES */
    @page { 
        size: A4 landscape; 
        margin: 0.5in; 
    }
    
    .table-container {
        overflow: visible !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .ledger-table {
        font-size: 8pt !important; /* Smaller font for print */
        width: 100% !important;
    }
    
    .ledger-table th, .ledger-table td {
        padding: 4px 6px !important;
        white-space: normal !important; /* Allow wrapping in print to save space */
        word-wrap: break-word !important;
    }

    /* Force show last column (Balance) */
    .ledger-table th:last-child,
    .ledger-table td:last-child {
        display: table-cell !important;
        visibility: visible !important;
    }
}

/* ====================================================================== */
/*  Notifications Inbox (bell button in header + dropdown panel)          */
/* ====================================================================== */

.notif-bell-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background-color: #e2e8f0;
    color: var(--color-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
    margin-right: 8px;
}

.notif-bell-btn:hover {
    background-color: #F97316;
    color: white;
}

.notif-bell-btn.has-unread {
    color: var(--color-danger);
}

.notif-bell-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background-color: var(--color-danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--color-white);
}

.notif-panel {
    position: fixed;
    top: 70px;
    right: 24px;
    width: 380px;
    max-height: 520px;
    background-color: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    z-index: 9000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.notif-panel__title {
    font-weight: 600;
    color: var(--color-dark);
    font-size: 14px;
}

.notif-panel__mark-all {
    background: none;
    border: none;
    color: #F97316;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.notif-panel__mark-all:hover {
    text-decoration: underline;
}

.notif-panel__list {
    flex: 1;
    overflow-y: auto;
    max-height: 420px;
}

.notif-panel__empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--color-text);
    opacity: 0.6;
    font-size: 13px;
}

.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: background-color 0.15s;
    position: relative;
}

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

.notif-item:hover {
    background-color: var(--color-light);
}

.notif-item.unread {
    background-color: rgba(249, 115, 22, 0.05);
}

.notif-item.unread::before {
    content: '';
    position: absolute;
    top: 18px;
    left: 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #F97316;
}

.notif-item__title {
    font-weight: 600;
    color: var(--color-dark);
    font-size: 13px;
    margin-bottom: 4px;
    padding-left: 12px;
}

.notif-item__body {
    color: var(--color-text);
    font-size: 12px;
    line-height: 1.4;
    padding-left: 12px;
    opacity: 0.85;
}

.notif-item__time {
    color: var(--color-text);
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
    padding-left: 12px;
}

.notif-panel__footer {
    padding: 8px 16px;
    border-top: 1px solid var(--color-border);
    text-align: center;
}

.notif-panel__reload {
    background: none;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    font-size: 12px;
    opacity: 0.7;
}

.notif-panel__reload:hover { opacity: 1; }

/* ====================================================================== */
/*  Non-BEM modal aliases (used by rfq.js — keeps existing markup working) */
/*  rfq.js's create/edit RFQ modal uses .modal-container/.modal-header/etc.*/
/*  instead of the BEM .modal/.modal__header. Without these styles, the    */
/*  modal renders without background (transparent). Aliasing here so we    */
/*  don't have to rewrite every modal markup in rfq.js.                    */
/* ====================================================================== */

.modal-container {
    background-color: var(--color-white);
    border-radius: var(--border-radius);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-container.modal-lg {
    max-width: 1100px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--color-dark);
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    background-color: var(--color-white);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 15px 25px;
    border-top: 1px solid var(--color-border);
    background-color: var(--color-light);
}

.modal-footer .btn {
    margin-left: 10px;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--color-text);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background-color 0.15s;
}

.modal-close-btn:hover {
    background-color: var(--color-light);
}