@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    /* Vibrant Light Theme Variables */
    --bg-primary: #f1f5f9;
    --bg-secondary: rgba(224, 242, 254, 0.95);
    --bg-card: rgba(224, 242, 254, 0.95);
    --border-color: rgba(255, 255, 255, 0.5);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    
    /* Vibrant Gradients for Accent */
    --accent-color: #6366f1;
    --accent-hover: #4f46e5;
    --accent-gradient: linear-gradient(135deg, #6366f1, #06b6d4);
    --accent-glow: rgba(99, 102, 241, 0.25);
    
    /* Semantic Colors */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    
    --sidebar-width: 260px;
    --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    
    /* Richer Shadows */
    --shadow-sm: 0 2px 4px rgba(148, 163, 184, 0.1);
    --shadow-md: 0 8px 16px -4px rgba(148, 163, 184, 0.15), 0 4px 8px -2px rgba(148, 163, 184, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(148, 163, 184, 0.2), 0 10px 10px -5px rgba(148, 163, 184, 0.1);
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
}

html {
    font-size: clamp(14px, 0.9vw + 0.5rem, 16.5px);
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: #bae6fd; /* Sky blue 200 */
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 1rem;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
}

/* Sidebar Styling */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-right: 1px solid rgba(255,255,255,0.4); box-shadow: var(--shadow-lg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.brand-section {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.brand-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-color), #06b6d4);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 0 15px var(--accent-glow);
}

.brand-name {
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(to right, #0f172a, #475569);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    background: transparent;
    text-align: left;
    width: 100%;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
    color: white;
    background: var(--accent-color);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.nav-item svg {
    width: 18px;
    height: 18px;
}

.user-profile {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    flex: 1;
    padding: 28px 36px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 24px;
    transition: all 0.2s ease;
}

@media (max-width: 1280px) {
    .main-content {
        padding: 20px 24px;
    }
}

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

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

.header-title p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.action-bar {
    display: flex;
    gap: 12px;
}

/* Base Components & Panels */
.panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.panel.active {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Card layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.card {
    background: var(--bg-card); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,0.6);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* Grid/flex items default to a content-based minimum width, so a long
       unbroken value (e.g. a big PKR amount) forces the card wider than its
       track instead of wrapping, clipping past the card edge. Let it shrink. */
    min-width: 0;
    box-shadow: var(--shadow-md); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

.card-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
}

.card-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    overflow-wrap: break-word;
    word-break: break-word;
}
option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

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

.trend-down {
    color: var(--danger);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.3px;
    border: none;
    min-height: 38px;
}

.btn-primary {
    background: var(--accent-gradient);
    box-shadow: 0 4px 10px var(--accent-glow);
    border: none;
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5, #0891b2);
    box-shadow: 0 6px 15px var(--accent-glow);
    border: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-success {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: rgba(16, 185, 129, 0.28);
    color: #047857;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
    min-height: 30px;
    border-radius: 6px;
}

/* Tables */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 10px 14px;
    font-size: 0.92rem;
}

th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    font-weight: 700;
    border-bottom: 2px solid rgba(0,0,0,0.05);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

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

tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }

/* Forms and Inputs */
.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
}

input, select, textarea {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.95rem;
    min-height: 40px;
    transition: all 0.2s ease;
    width: 100%;
}

input[type="checkbox"], input[type="radio"] {
    width: 16px !important;
    height: 16px !important;
    min-height: 16px !important;
    max-height: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--primary, #2563eb);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 8px var(--accent-glow);
    background: white;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-overlay.active {
    display: flex !important;
    z-index: 1000000 !important;
}

#modal-login.active {
    display: flex !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 999999 !important;
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(12px) !important;
}

#modal-login:not(.active) {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
    z-index: -1 !important;
}

.modal-content {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 95%;
    max-width: 1150px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlide 0.3s ease;
    display: flex;
    flex-direction: column;
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Pulsing red highlight for Make Invoice button when shipment has sailed and invoice is missing */
@keyframes pulse-invoice {
    0%   { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.55); }
    60%  { box-shadow: 0 0 0 7px rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

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

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.5rem;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Item List Tables for Bills / Invoices */
.item-table {
    margin-top: 12px;
}

.item-table input {
    padding: 6px 8px;
    font-size: 0.95rem;
}

.table-container input[type="number"], .item-table input[type="number"], .inv-pay-input, .bill-pay-input {
    font-size: 1.05rem;
    font-weight: 600;
}

/* Print View Styles & Layout for Bill of Lading (BL) */
.bl-print-container {
    background: white;
    color: black;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    padding: 15px;
    max-width: 900px;
    margin: 20px auto;
    border: 1px solid #000;
    display: none;
}

.bl-print-container.active {
    display: block !important;
    background: #ffffff !important;
    color: #000000 !important;
    position: relative !important;
    z-index: 100 !important;
}

.bl-header-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    border-bottom: 2px solid black;
}

.bl-header-left {
    border-right: 2px solid black;
}

.bl-box {
    border-bottom: 1px solid black;
    padding: 8px;
    font-size: 9.5px;
    min-height: 80px;
}

.bl-box-title {
    font-weight: 800;
    font-size: 9px;
    text-transform: uppercase;
    margin-bottom: 4px;
    display: block;
}

.bl-box-content {
    white-space: pre-wrap;
    line-height: 1.3;
    color: black !important;
}

.bl-logo-box {
    padding: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-bottom: 2px solid black;
}

.bl-logo-box h2 {
    font-size: 24px;
    font-weight: 900;
    color: #0b2545;
    margin: 4px 0 2px 0;
    letter-spacing: 2px;
}

.bl-logo-box .sub {
    font-size: 11px;
    font-weight: 700;
    color: #134074;
    text-transform: uppercase;
}

.bl-logo-box .slogan {
    font-style: italic;
    font-weight: bold;
    color: red;
    font-size: 10px;
    margin: 2px 0;
}

.bl-logo-box .address {
    font-size: 8px;
    color: #333;
    line-height: 1.2;
}

.bl-info-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    border-bottom: 1px solid black;
    font-size: 9px;
    padding: 6px;
    background: #f0f0f0;
    color: black !important;
}

.bl-info-bar div span {
    font-weight: bold;
}

.bl-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid black;
}

.bl-grid-3 .bl-box {
    border-bottom: none;
    border-right: 1px solid black;
    min-height: 50px;
}

.bl-grid-3 .bl-box:last-child {
    border-right: none;
}

.bl-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-bottom: 2px solid black;
}

.bl-grid-4 .bl-box {
    border-bottom: none;
    border-right: 1px solid black;
    min-height: 50px;
}

.bl-grid-4 .bl-box:last-child {
    border-right: none;
}

.bl-details-header {
    display: grid;
    grid-template-columns: 1.2fr 0.6fr 2.2fr 1fr 1fr;
    border-bottom: 2px solid black;
    background: #f0f0f0;
    font-weight: bold;
    font-size: 8.5px;
    text-align: center;
    color: black !important;
}

.bl-details-header div {
    padding: 6px 4px;
    border-right: 1px solid black;
}

.bl-details-header div:last-child {
    border-right: none;
}

.bl-details-body {
    display: grid;
    grid-template-columns: 1.2fr 0.6fr 2.2fr 1fr 1fr;
    min-height: 180px;
    font-size: 9px;
    border-bottom: 2px solid black;
    color: black !important;
}

.bl-details-body > div {
    border-right: 1px solid black;
    padding: 8px;
    line-height: 1.4;
}

.bl-details-body > div:last-child {
    border-right: none;
}

.bl-details-footer {
    display: grid;
    grid-template-columns: 1.8fr 1fr 1.2fr;
    border-bottom: 2px solid black;
}

.bl-details-footer-left {
    border-right: 1px solid black;
    display: grid;
    grid-template-rows: 1fr 1fr;
}

.bl-details-footer-left .row-item {
    padding: 6px;
    font-size: 9px;
    border-bottom: 1px solid black;
    color: black !important;
}

.bl-details-footer-left .row-item:last-child {
    border-bottom: none;
}

.bl-footer-main {
    display: grid;
    grid-template-columns: 1.5fr 2.5fr;
    font-size: 8px;
    color: black !important;
}

.bl-footer-main-left {
    border-right: 1px solid black;
    display: flex;
    flex-direction: column;
}

.bl-footer-grid-table {
    display: grid;
    grid-template-columns: 1fr 0.8fr 0.8fr 0.8fr;
    text-align: center;
    border-bottom: 1px solid black;
    font-weight: bold;
    background: #f0f0f0;
    color: black !important;
}

.bl-footer-grid-table div {
    padding: 4px;
    border-right: 1px solid black;
}

.bl-footer-grid-table div:last-child {
    border-right: none;
}

.bl-footer-grid-rows {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.bl-footer-grid-row {
    display: grid;
    grid-template-columns: 1fr 0.8fr 0.8fr 0.8fr;
    border-bottom: 1px solid #ccc;
    text-align: center;
    min-height: 20px;
    align-items: center;
    color: black !important;
}

.bl-footer-grid-row div {
    border-right: 1px solid #ccc;
    padding: 4px;
}

.bl-footer-grid-row div:last-child {
    border-right: none;
}

.bl-footer-declaration {
    padding: 8px;
    line-height: 1.3;
    font-size: 7.5px;
    text-align: justify;
    color: black !important;
}

.bl-signature-block {
    border-left: 1px solid black;
    padding: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px;
    font-size: 9px;
    color: black !important;
}

.print-actions {
    max-width: 900px;
    margin: 20px auto;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Chart container styling */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    height: 300px;
    width: 100%;
}

/* User rights checklist */
.rights-checklist {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.right-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.02);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.right-checkbox-item input {
    width: auto;
}

/* Ledger header layout */
.ledger-header {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

/* Print Overrides */
@media print {
    @page {
        margin: 5mm 8mm;
        size: A4 portrait;
    }

    /* ============================================================
       CRITICAL: Reset ALL CSS custom properties to solid black/white
       This prevents dark-mode CSS variables (--text-primary: #f8fafc etc.)
       from leaking into the printed output as faded grey text.
       ============================================================ */
    :root,
    [data-theme],
    [data-theme="dark"],
    html,
    body {
        --text-primary: #000000 !important;
        --text-secondary: #000000 !important;
        --text-muted: #000000 !important;
        --bg-primary: #ffffff !important;
        --bg-secondary: #ffffff !important;
        --bg-card: #ffffff !important;
        --bg-hover: #f5f5f5 !important;
        --border-color: #000000 !important;
        --accent: #000000 !important;
        --accent-hover: #000000 !important;
    }

    html, body {
        width: 210mm !important;
        background: #ffffff !important;
        background-color: #ffffff !important;
        color: #000000 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        margin: 0 auto !important;
        padding: 0 !important;
        font-size: 10pt !important;
    }

    body.printing-doc *, body.printing-report * {
        color: #000000 !important;
        text-shadow: none !important;
        box-shadow: none !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        opacity: 1 !important;
    }
    
    /* Document Print Layout (BL, Invoices, Quotations, ISF, Bills, Receipts) */
    body.printing-doc .sidebar, 
    body.printing-doc .print-actions, 
    body.printing-doc .header-container {
        display: none !important;
    }
    
    body.printing-doc .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    body.printing-doc .panel {
        display: none !important;
    }

    body.printing-doc .panel.active {
        display: block !important;
        margin: 0 auto !important;
        padding: 5mm !important;
        width: 210mm !important;
        max-width: 210mm !important;
        box-sizing: border-box !important;
    }

    body.printing-doc #print-isf-container {
        /* No max-height or overflow:hidden — content must be fully visible */
        page-break-inside: auto !important;
        break-inside: auto !important;
        background: #ffffff !important;
        color: #000000 !important;
    }

    /* Single-page BL print rule — strictly suppress blank 2nd page when no annexure data exists */
    body.printing-doc #print-bl-container:not(.has-annexure) {
        page-break-after: avoid !important;
        break-after: avoid !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        max-height: 275mm !important;
        overflow: hidden !important;
    }

    body.printing-doc #bl-print-annexure[style*="display: none"],
    body.printing-doc #bl-print-annexure:empty {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        max-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        page-break-before: avoid !important;
        break-before: avoid !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
    }

    /* High contrast black text overrides for Invoice & Quotation printing */
    body.printing-doc #print-inv-qt-container,
    body.printing-doc #print-inv-qt-container * {
        color: #000000 !important;
        opacity: 1 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    body.printing-doc #print-inv-qt-container h1,
    body.printing-doc #print-inv-qt-container h2,
    body.printing-doc #print-inv-qt-container h3,
    body.printing-doc #print-inv-qt-container strong,
    body.printing-doc #print-inv-qt-container th {
        color: #000000 !important;
        font-weight: 900 !important;
    }

    /* Force the invoice/quotation table to fit the full printable width */
    body.printing-doc #print-inv-qt-container table {
        width: 100% !important;
        table-layout: fixed !important;
        border-collapse: collapse !important;
        font-size: 9pt !important;
    }
    body.printing-doc #print-inv-qt-container table th,
    body.printing-doc #print-inv-qt-container table td {
        word-break: break-word !important;
        overflow-wrap: break-word !important;
        padding: 5px 6px !important;
        color: #000000 !important;
        border-bottom: 1px solid #000000 !important;
    }
    /* Column widths: QTY=7%, PARTICULARS=53%, UNIT VALUE=20%, TOTAL=20% */
    body.printing-doc #print-inv-qt-container table th:nth-child(1),
    body.printing-doc #print-inv-qt-container table td:nth-child(1) { width: 7% !important; }
    body.printing-doc #print-inv-qt-container table th:nth-child(2),
    body.printing-doc #print-inv-qt-container table td:nth-child(2) { width: 53% !important; }
    body.printing-doc #print-inv-qt-container table th:nth-child(3),
    body.printing-doc #print-inv-qt-container table td:nth-child(3) { width: 20% !important; text-align: right !important; }
    body.printing-doc #print-inv-qt-container table th:nth-child(4),
    body.printing-doc #print-inv-qt-container table td:nth-child(4) { width: 20% !important; text-align: right !important; }

    /* Cargo info grid — tighter font on print */
    body.printing-doc #print-doc-cargo-section {
        font-size: 8.5pt !important;
        background: #ffffff !important;
        border: 1.5px solid #000000 !important;
        color: #000000 !important;
    }

    /* Invoice header tighter on print */
    body.printing-doc .invoice-header {
        padding-bottom: 10px !important;
        border-bottom: 2px solid #000000 !important;
    }
    body.printing-doc #print-inv-qt-container {
        padding: 8px 10px !important;
        background: #ffffff !important;
        color: #000000 !important;
    }

    /* Report Ledger Print Layout */
    body.printing-report .sidebar,
    body.printing-report .header-container,
    body.printing-report .print-actions,
    body.printing-report #panel-header,
    body.printing-report .sidebar-width,
    body.printing-report .nav-menu,
    body.printing-report .card:not(.report-card),
    body.printing-report button {
        display: none !important;
    }
    
    body.printing-report .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    body.printing-report #panel-reports {
        display: block !important;
    }
    
    body.printing-report .report-card {
        border: 1px solid #000 !important;
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        page-break-inside: avoid;
        margin-bottom: 30px !important;
        padding: 10px !important;
    }
    
    body.printing-report table {
        color: black !important;
    }
    
    body.printing-report th, body.printing-report td {
        border-color: #ddd !important;
        color: black !important;
        padding: 8px 12px !important;
    }
    
    body.printing-report .manual-closing-bal {
        border: none !important;
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        outline: none !important;
    }
}

/* Container Tracking Visual Timeline */
.track-container-box {
    border: 1px solid var(--border-color);
    background: rgba(255,255,255,0.02);
    border-radius: var(--radius-md);
    padding: 16px;
}
.track-container-header {
    font-weight: 600;
    color: var(--accent-hover);
    margin-bottom: 12px;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
}
.track-timeline {
    position: relative;
    padding-left: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.track-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background: rgba(255,255,255,0.1);
}
.track-step {
    position: relative;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.track-step-dot {
    position: absolute;
    left: -22px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--text-secondary);
    box-shadow: 0 0 0 3px var(--bg-primary);
}
.track-step.completed {
    color: var(--text-primary);
}
.track-step.completed .track-step-dot {
    background: var(--success);
    border-color: var(--success);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}
.track-step.active {
    color: white;
    font-weight: 600;
}
.track-step.active .track-step-dot {
    background: var(--accent-color);
    border-color: var(--accent-hover);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* Custom scrollbars inside dashboard card tables */
.table-responsive::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.table-responsive::-webkit-scrollbar-track {
    background: transparent;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Disposal Modal Style Fixes to prevent white-on-white text */
#modal-disposal input, #modal-disposal select {
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid #cbd5e1 !important;
}


/* Window Controls CSS */
.modal-content.maximized {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

.modal-content.minimized {
    position: fixed !important;
    bottom: 0 !important;
    right: 20px !important;
    width: 320px !important;
    min-height: auto !important;
    margin: 0 !important;
    border-radius: 8px 8px 0 0 !important;
    transform: none !important;
    top: auto !important;
    left: auto !important;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.2) !important;
}

.modal-content.minimized .modal-body,
.modal-content.minimized .modal-footer {
    display: none !important;
}

.modal-overlay.minimized-overlay {
    background: transparent !important;
    pointer-events: none !important;
    backdrop-filter: blur(0px) !important;
    -webkit-backdrop-filter: blur(0px) !important;
}

.modal-overlay.minimized-overlay .modal-content {
    pointer-events: auto !important;
}

.window-btn:hover {
    color: var(--text-primary) !important;
    background: var(--bg-hover) !important;
    border-radius: 4px;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: rgba(30, 41, 59, 0.95);
    --bg-card: rgba(30, 41, 59, 0.95);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 16px -4px rgba(0, 0, 0, 0.4), 0 4px 8px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] body {
    background: #0f172a;
}

/* =========================================
   Mobile Responsiveness
   ========================================= */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
}
.sidebar-overlay.show {
    display: block;
}

/* Tablet & Mobile Screens (<= 1024px) */
@media (max-width: 1024px) {
    .mobile-nav-toggle {
        display: block !important;
    }

    /* Sidebar transforms into a Hamburger off-canvas drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        z-index: 9999;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 6px 0 25px rgba(0,0,0,0.4);
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar .user-profile {
        margin-top: auto;
        padding-top: 15px;
        border-top: 1px solid var(--border-color);
    }

    /* Main Content takes full width */
    .main-content {
        margin-left: 0 !important;
        padding: 16px 20px !important;
        width: 100% !important;
        overflow-x: hidden;
    }

    .header-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .header-container > div {
        display: flex;
        flex-wrap: wrap !important;
        gap: 10px !important;
        width: 100% !important;
        justify-content: flex-start !important;
    }

    .header-title {
        width: 100%;
    }

    .action-bar {
        width: 100%;
        flex-wrap: wrap;
        gap: 10px !important;
    }
}

/* Mobile Screens (<= 768px) */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .main-content {
        padding: 12px !important;
    }

    .action-bar {
        flex-direction: column;
        gap: 8px !important;
    }

    .action-bar input, .action-bar select, .action-bar button {
        width: 100%;
    }

    /* Collapsing Grids dynamically on mobile (except for printable documents) */
    body:not(.printing-doc):not(.printing-report) .dashboard-grid,
    body:not(.printing-doc):not(.printing-report) [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    /* Modals - Full Screen on mobile */
    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
        display: flex;
        flex-direction: column;
    }

    .modal-body {
        flex: 1;
        overflow-y: auto;
        padding: 16px;
    }

    .modal-footer {
        padding: 16px;
        position: sticky;
        bottom: 0;
        background: var(--bg-card);
        border-top: 1px solid var(--border-color);
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .modal-footer button {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    .form-group {
        width: 100% !important;
    }

    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-actions button {
        width: 100%;
    }

    /* Data Tables */
    .table-container {
        width: 100%;
        overflow-x: auto;
        border-radius: var(--radius-sm);
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 750px;
    }

    /* Login Box */
    .login-box {
        width: 92%;
        padding: 24px;
    }
}

/* ==========================================================================
   EVERGREEN LINE STYLE GREEN GRID OVERRIDES FOR BILL OF LADING (BL)
   ========================================================================== */
.bl-print-container {
    background: #ffffff !important;
    color: #000000 !important;
    font-family: Arial, Helvetica, sans-serif !important;
    font-size: 8px !important;
    line-height: 1.2 !important;
    padding: 10px !important;
    width: 750px !important;
    max-width: 750px !important;
    margin: 0 auto !important;
    border: 2px solid #000000 !important;
    box-sizing: border-box !important;
}

.bl-print-container * {
    box-sizing: border-box !important;
    color: #000000 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

/* Header styling */
.eg-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-bottom: 2px solid #000000 !important;
    padding-bottom: 6px !important;
    margin-bottom: 0px !important;
    background: #ffffff !important;
}

.eg-logo-area {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.eg-logo-img {
    height: 50px !important;
    width: auto !important;
    object-fit: contain !important;
}

.eg-company-info {
    font-family: Arial, sans-serif !important;
}

.eg-company-name {
    font-size: 18px !important;
    font-weight: 900 !important;
    color: #000000 !important;
    letter-spacing: 0.5px !important;
    margin: 0 !important;
}

.eg-company-slogan {
    font-size: 7.5px !important;
    font-weight: 800 !important;
    color: #1e3a8a !important;
    margin: 1px 0 !important;
}

.eg-company-address {
    font-size: 7px !important;
    font-weight: 700 !important;
    color: #000000 !important;
    line-height: 1.1 !important;
}

.eg-title-area {
    text-align: right !important;
}

.eg-title {
    font-size: 20px !important;
    font-weight: 900 !important;
    color: #d97706 !important; /* High contrast bold orange title */
    margin: 0 !important;
}

/* Grid Boxes */
.eg-grid {
    display: grid !important;
    border-bottom: 2px solid #000000 !important;
    background: #ffffff !important;
}

.eg-grid-2col {
    grid-template-columns: 1.2fr 1fr !important;
}

.eg-grid-3col {
    grid-template-columns: 1fr 1fr 1fr !important;
}

.eg-col-left {
    border-right: 2px solid #000000 !important;
}

.eg-box {
    border-bottom: 1px solid #000000 !important;
    padding: 4px 6px !important;
    min-height: 45px !important;
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    background: #ffffff !important;
}

.eg-box:last-child {
    border-bottom: none !important;
}

.eg-label {
    color: #000000 !important;
    font-weight: 800 !important;
    font-size: 7.8px !important;
    display: block !important;
    margin-bottom: 2px !important;
    text-transform: uppercase !important;
    opacity: 1 !important;
}

.eg-content {
    font-size: 8.5px !important;
    font-weight: 700 !important;
    color: #000000 !important;
    white-space: pre-wrap !important;
    line-height: 1.2 !important;
    opacity: 1 !important;
}

/* Details Table style */
.eg-details-header {
    display: grid !important;
    grid-template-columns: 2.2fr 0.8fr 3fr 1.2fr 1.2fr !important;
    border-bottom: 2px solid black !important;
    background-color: rgba(0, 0, 0, 0.03) !important;
    text-align: center !important;
    font-weight: bold !important;
    border-top: 2px solid black !important;
}

.eg-details-header div {
    border-right: 1px solid black !important;
    color: black !important;
    padding: 4px !important;
    font-size: 7.5px !important;
}

.eg-details-header div:last-child {
    border-right: none !important;
}

.eg-details-body {
    display: grid !important;
    grid-template-columns: 2.2fr 0.8fr 3fr 1.2fr 1.2fr !important;
    border-bottom: 2px solid black !important;
    min-height: 235px !important;
}

.eg-details-body > div {
    border-right: 1px solid black !important;
    padding: 6px !important;
    font-size: 8.5px !important;
    font-weight: bold !important;
    white-space: pre-wrap !important;
}

.eg-details-body > div:last-child {
    border-right: none !important;
}

/* Total Box */
.eg-total-box {
    border-bottom: 2px solid black !important;
    padding: 4px 6px !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Freight charges */
.eg-freight-header {
    display: grid !important;
    grid-template-columns: 2.5fr 1fr 1.2fr 0.8fr 1fr 1fr !important;
    border-bottom: 1px solid black !important;
    background-color: rgba(0, 0, 0, 0.03) !important;
    font-weight: bold !important;
}

.eg-freight-header div {
    border-right: 1px solid black !important;
    color: black !important;
    padding: 3px !important;
    font-size: 7.5px !important;
    text-align: center !important;
}

.eg-freight-header div:last-child {
    border-right: none !important;
}

.eg-freight-body {
    display: grid !important;
    grid-template-columns: 2.5fr 1fr 1.2fr 0.8fr 1fr 1fr !important;
    border-bottom: 2px solid black !important;
    min-height: 38px !important;
}

.eg-freight-body > div {
    border-right: 1px solid black !important;
    padding: 4px !important;
    font-size: 8.5px !important;
    font-weight: bold !important;
    text-align: center !important;
}

.eg-freight-body > div:last-child {
    border-right: none !important;
}

/* Footer layout */
.eg-footer-grid {
    display: grid !important;
    grid-template-columns: 1.2fr 1fr !important;
}

.eg-footer-left-col {
    display: grid !important;
    grid-template-columns: 1fr !important;
    border-right: 2px solid black !important;
}

.eg-footer-row {
    display: grid !important;
    grid-template-columns: 1.2fr 1fr 1fr 1fr !important;
    border-bottom: 1px solid black !important;
}

.eg-footer-row div {
    border-right: 1px solid black !important;
    padding: 3px !important;
    min-height: 30px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
}

.eg-footer-row div:last-child {
    border-right: none !important;
}

.eg-footer-row-2 {
    display: grid !important;
    grid-template-columns: 1.5fr 1.5fr 1.5fr !important;
    border-bottom: 1px solid black !important;
}

.eg-footer-row-2 div {
    border-right: 1px solid black !important;
    padding: 3px !important;
    min-height: 30px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
}

.eg-footer-row-2 div:last-child {
    border-right: none !important;
}

.eg-footer-declaration {
    padding: 6px !important;
    font-size: 5.5px !important;
    color: #000000 !important;
    line-height: 1.1 !important;
    text-align: justify !important;
}

.eg-signature-block {
    padding: 6px !important;
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    min-height: 100px !important;
    border-left: 2px solid black !important;
    page-break-inside: avoid !important;
}

/* USA ISF (10+2) Single-Page Print & Export Styles */
.isf-print-container {
    width: 750px !important;
    max-width: 750px !important;
    margin: 0 auto !important;
    padding: 10px 14px !important;
    background: #ffffff !important;
    color: #000000 !important;
    font-family: Arial, Helvetica, sans-serif !important;
    font-size: 8.5px !important;
    line-height: 1.15 !important;
    border: 2px solid #000000 !important;
    box-sizing: border-box !important;
    page-break-inside: avoid !important;
    page-break-after: avoid !important;
    page-break-before: avoid !important;
    break-inside: avoid !important;
}

.isf-print-container table td,
.isf-print-container table th {
    padding: 2px 4px !important;
    font-size: 8.5px !important;
    line-height: 1.15 !important;
}

