/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
    /* Theme Colors (Modern Dark Tech Slate) */
    --bg-app: #0b0f19;
    --bg-content: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --border-color: #475569;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Accents */
    --color-primary: #3b82f6;      /* Vibrant Blue */
    --color-primary-hover: #2563eb;
    --color-success: #10b981;      /* Green */
    --color-success-hover: #059669;
    --color-warning: #f59e0b;      /* Yellow/Orange */
    --color-danger: #ef4444;       /* Red */
    
    /* Box Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Borders */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.2s ease;
}

input, textarea, select {
    font-family: inherit;
    color: var(--text-primary);
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    outline: none;
    transition: border-color 0.2s ease;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--color-primary);
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==========================================================================
   APP CONTAINER LAYOUT
   ========================================================================== */
#app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar styling */
.sidebar {
    width: 80px;
    background-color: var(--bg-app);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    flex-shrink: 0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.sidebar:hover {
    width: 260px;
    padding: 24px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    width: 100%;
    overflow: hidden;
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-primary), #4f46e5);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    color: white;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
    flex-shrink: 0;
}

.brand-text {
    transition: opacity 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-10px);
    pointer-events: none;
}

.sidebar:hover .brand-text {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.brand-text h1 {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

.brand-text span {
    font-size: 0.65rem;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    display: block;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
    width: 100%;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 10px;
    color: var(--text-secondary);
    background: transparent;
    border-radius: var(--radius-md);
    font-weight: 500;
    text-align: left;
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s ease, color 0.2s ease;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar:hover .nav-btn {
    padding: 12px 16px;
}

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

.nav-btn.active {
    color: white;
    background-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.nav-text {
    transition: opacity 0.2s ease, transform 0.2s ease;
    opacity: 0;
    transform: translateX(-10px);
    pointer-events: none;
}

.sidebar:hover .nav-text {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.sidebar-footer {
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    transition: opacity 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-10px);
    pointer-events: none;
    width: 100%;
}

.sidebar:hover .sidebar-footer {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.sidebar-footer p {
    margin-bottom: 4px;
}

/* Main Content styling */
.main-content {
    flex-grow: 1;
    background-color: var(--bg-content);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-title h2 {
    font-size: 1.6rem;
    font-weight: 700;
}

.header-title p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.device-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
}

.device-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.device-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.device-label-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-edit-device {
    background: transparent;
    border: none;
    color: var(--color-primary);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0;
    cursor: pointer;
    text-align: left;
    text-decoration: underline;
    transition: color 0.2s;
}

.btn-edit-device:hover {
    color: #3b82f6;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

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

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
}

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

/* General Layout helpers */
.content-view {
    display: none;
    padding: 24px;
    flex-grow: 1;
}

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

/* Common Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
}

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

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

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

/* ==========================================================================
   VIEW: DASHBOARD STYLING
   ========================================================================== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}
.stat-icon.purple { background-color: rgba(147, 51, 234, 0.15); color: #a855f7; }
.stat-icon.green { background-color: rgba(16, 185, 129, 0.15); color: #10b981; }
.stat-icon.orange { background-color: rgba(245, 158, 11, 0.15); color: #f59e0b; }

.stat-content h3 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
}
.stat-content p {
    font-size: 1.8rem;
    font-weight: 700;
}

.action-bar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    align-items: center;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding-left: 12px;
    width: 100%;
    max-width: 450px;
}

.search-box input {
    background-color: transparent;
    border: none;
    width: 100%;
    padding: 10px 8px;
}
.search-box input:focus {
    border: none;
}

/* B/L List styling */
.bl-list-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.list-header {
    display: grid;
    grid-template-columns: 1.3fr 1.6fr 2.2fr 1.5fr 1.2fr 1.2fr;
    padding: 14px 20px;
    background-color: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bl-list-items {
    min-height: 200px;
}

.bl-row-item {
    display: grid;
    grid-template-columns: 1.3fr 1.6fr 2.2fr 1.5fr 1.2fr 1.2fr;
    padding: 16px 20px;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    transition: background-color 0.2s ease;
}

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

.bl-row-item:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.bl-row-item .bl-no {
    font-weight: 600;
    color: var(--color-primary);
}

.bl-row-item .actions {
    display: flex;
    gap: 8px;
}

.action-icon-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.action-icon-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.1);
}
.action-icon-btn.btn-delete:hover {
    color: white;
    background-color: var(--color-danger);
    border-color: var(--color-danger);
}

.no-data-msg {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-muted);
}

/* ==========================================================================
   VIEW: EDITOR FORM STYLING
   ========================================================================== */
.form-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

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

.editor-actions {
    display: flex;
    gap: 12px;
}

/* Tabs Navigation */
.tabs-nav {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    gap: 4px;
    overflow-x: auto;
}

.tab-btn {
    padding: 12px 18px;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 2px solid transparent;
    flex-shrink: 0;
}
.tab-btn:hover {
    color: var(--text-primary);
}
.tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

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

/* Form Layout */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-grid.span-2 {
    grid-column: span 2;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group textarea {
    resize: vertical;
}

.btn-quick-fill {
    align-self: flex-start;
    font-size: 0.75rem;
    color: var(--color-primary);
    background: transparent;
    padding: 2px 0;
    font-weight: 500;
}
.btn-quick-fill:hover {
    text-decoration: underline;
}

/* Cargo Builder Specifics */
.cargo-builder-panel {
    background-color: rgba(0, 0, 0, 0.15);
    border: 1px dashed var(--border-color);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
}

.cargo-builder-panel h4 {
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.cargo-builder-panel .help-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.builder-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.builder-actions-inline {
    display: flex;
    justify-content: flex-end;
}

.cargo-columns-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* ==========================================================================
   VIEW: PRINT PREVIEW & DOCUMENT DISPLAY
   ========================================================================== */
.preview-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.print-options {
    display: flex;
    gap: 16px;
    align-items: center;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-container input {
    cursor: pointer;
}

.preview-scroll-container {
    display: flex;
    justify-content: center;
    overflow-x: auto;
    padding-bottom: 40px;
}

.preview-document {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ==========================================================================
   BILL OF LADING PRINT DOCUMENT DESIGN (Fidelity exact structure)
   ========================================================================== */
.bl-page {
    width: 210mm;
    min-height: 297mm;
    background-color: white;
    color: black;
    padding: 12.7mm; /* 0.5 inch margins */
    box-sizing: border-box;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5); /* Screen only shadow */
    font-family: Arial, Helvetica, sans-serif;
    position: relative;
}

.bl-outer-border {
    border: 1.5px solid black;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Grid & Rows */
.bl-row {
    width: 100%;
    display: flex;
}

.flex-row {
    display: flex;
}

.border-bottom { border-bottom: 1px solid black; }
.border-top { border-top: 1px solid black; }
.border-left { border-left: 1px solid black; }
.border-right { border-right: 1px solid black; }

.width-50 { width: 50%; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.flex-3 { flex: 3; }
.flex-4 { flex: 4; }

.text-bold { font-weight: bold; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-pre-wrap { white-space: pre-wrap; }
.font-monospace { font-family: "Courier New", Courier, monospace; }
.font-condensed { font-stretch: condensed; }

/* Box labels & Values */
.bl-box {
    padding: 3px 6px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.bl-box-tall {
    min-height: 85px;
}

.bl-box label {
    font-size: 6.5pt;
    font-weight: normal;
    text-transform: none;
    color: #000;
    margin-bottom: 3px;
    display: block;
}

.bl-box .val {
    font-size: 8.5pt;
    line-height: 1.25;
    word-break: break-word;
}

/* Title Header bar */
.bl-title-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 2px solid black;
    padding: 6px 8px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.bl-title-left h2 {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15pt;
    font-weight: 900;
    letter-spacing: 0.5px;
    margin: 0;
    line-height: 1;
}

.bl-title-left span {
    font-size: 5.5pt;
    font-weight: bold;
    display: block;
    margin-top: 2px;
}

.bl-title-right span {
    font-size: 8pt;
    font-weight: bold;
}

/* Two-column layout in main body */
.bl-grid-body {
    display: flex;
    width: 100%;
}

.bl-left-col {
    width: 53%;
    display: flex;
    flex-direction: column;
}

.bl-right-col {
    width: 47%;
    display: flex;
    flex-direction: column;
}

/* Company Header */
.bl-company-header {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    gap: 12px;
    min-height: 52px;
}

.bl-logo-img-box {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
}

/* Specific styling for PT. Putera Utama Lautan to accommodate its horizontal logo */
.bl-company-header.company-pul .bl-logo-img-box {
    width: 80px;
    height: 36px;
}

.bl-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.bl-company-name-box {
    display: flex;
    flex-direction: column;
}

.bl-company-name {
    font-size: 10.5pt;
    font-weight: 900;
    letter-spacing: 0.2px;
    line-height: 1;
    white-space: nowrap;
}

.bl-original {
    font-size: 11pt;
    font-weight: bold;
    letter-spacing: 1px;
    margin-top: 2px;
}

/* Legal text block on right */
.bl-disclaimer {
    padding: 5px 8px;
    font-size: 5pt;
    line-height: 1.25;
    text-align: justify;
}

.bl-disclaimer p {
    margin-bottom: 4px;
}
.bl-disclaimer p:last-child {
    margin-bottom: 0;
}

.bl-clause {
    margin-top: 6px;
    border: 1px solid black;
    padding: 4px 6px;
}

.bl-clause-title {
    font-weight: bold;
    font-size: 5.5pt;
    text-align: center;
    border-bottom: 1.5px solid black;
    padding-bottom: 1px;
    margin-bottom: 3px;
}

/* Main Cargo Table Layout */
.bl-table-header {
    font-size: 6.5pt;
    font-weight: bold;
    text-transform: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.col-containers { width: 33%; padding: 4px 6px; }
.col-packages { width: 15%; padding: 4px 6px; }
.col-desc { width: 37%; padding: 4px 6px; }
.col-measure { width: 15%; padding: 4px 6px; }

.bl-table-body {
    flex-grow: 1;
    min-height: 380px; /* Forces page layout scale */
    align-items: stretch;
}

.bl-table-body div {
    font-size: 8pt;
    line-height: 1.35;
    padding: 6px;
    box-sizing: border-box;
}
.bl-table-body .col-containers { font-size: 7.5pt !important; }

/* Freight Section Columns */
.col-f-charges { width: 33%; padding: 3px 6px; }
.col-f-rev { width: 15%; padding: 3px 6px; }
.col-f-rate { width: 11%; padding: 3px 6px; }
.col-f-per { width: 11%; padding: 3px 6px; }
.col-f-prepaid { width: 15%; padding: 3px 6px; }
.col-f-collect { width: 15%; padding: 3px 6px; }

.bl-freight-header {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}
.bl-freight-header label {
    font-size: 6pt;
    font-weight: normal;
    text-transform: none;
    display: block;
}

.bl-freight-body {
    min-height: 36px;
    align-items: center;
}
.bl-freight-body div {
    font-size: 8pt;
}

/* Signature & Sign-off footer */
.signature-box {
    position: relative;
    padding-bottom: 24px;
}

.signature-title {
    font-size: 7.5pt;
    font-weight: bold;
    margin-top: 4px;
}

.signature-line {
    margin-top: 14px;
    border-bottom: 1px solid black;
    width: 90%;
}

.signature-note {
    font-size: 5pt;
    position: absolute;
    bottom: 3px;
    left: 6px;
}

.signature-image {
    position: absolute;
    bottom: -75px; /* Lowered by ~1 cm from the previous position */
    right: -15px;  /* Overlaps the right border slightly, matching screenshot */
    width: 158px;  /* Enlarged another 10% (total 40% from original) */
    height: auto;
    pointer-events: none;
    mix-blend-mode: multiply;
    z-index: 10;
}

/* ==========================================================================
   PAGE 2: TERMS AND CONDITIONS DESIGN
   ========================================================================== */
.terms-container {
    border: 1px solid black;
    padding: 6px 10px;
    height: 100%;
    box-sizing: border-box;
}

.terms-title {
    font-size: 7.5pt;
    font-weight: 900;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    border-bottom: 1.5px solid black;
    padding-bottom: 3px;
}

.terms-grid {
    display: flex;
    gap: 8px;
    height: calc(100% - 20px);
}

.terms-col {
    width: 33.33%;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.terms-sec {
    font-size: 4.8pt;
    line-height: 1.15;
    text-align: justify;
}

.terms-sec-title {
    font-weight: bold;
    display: block;
    margin-bottom: 2px;
    font-size: 5pt;
    border-bottom: 0.5px solid #ccc;
}

.terms-sec p {
    margin-bottom: 2px;
    text-indent: 4px;
}


/* ==========================================================================
   AUTOCOMPLETE SEARCH & DROPDOWN RECOMMENDATIONS
   ========================================================================== */
.dropdown-container {
    position: relative;
}

.search-suggest-box {
    position: relative;
    width: 100%;
    margin-bottom: 8px;
}

.search-suggest-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.85rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.search-suggest-input:focus {
    border-color: var(--color-primary);
}

.suggest-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    margin-top: 4px;
}

.suggest-dropdown.show {
    display: block;
}

.suggest-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    transition: background-color 0.2s ease;
}

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

.suggest-item:hover {
    background-color: rgba(59, 130, 246, 0.15);
    color: white;
}

.suggest-item-name {
    font-weight: 600;
    display: block;
    margin-bottom: 2px;
}

.suggest-item-address {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.party-action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    width: 100%;
}

.btn-save-party {
    font-size: 0.75rem;
    color: var(--color-success);
    background: transparent;
    padding: 2px 0;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-save-party:hover {
    text-decoration: underline;
}

.btn-save-party.hidden {
    display: none;
}

/* Logo upload layout */
.logo-upload-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    max-height: 42px;
}

.logo-status-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.btn-danger-outline {
    border-color: rgba(239, 68, 68, 0.4) !important;
    color: var(--color-danger) !important;
}
.btn-danger-outline:hover {
    background-color: rgba(239, 68, 68, 0.1) !important;
    border-color: var(--color-danger) !important;
}

/* Mobile elements hidden by default on desktop */
.mobile-toggle-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.mobile-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
}
.mobile-toggle-btn svg {
    display: block;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ==========================================================================
   MOBILE RESPONSIVENESS STYLES
   ========================================================================== */
@media screen and (max-width: 768px) {
    /* Mobile Toggle Button */
    .mobile-toggle-btn {
        display: flex;
    }

    /* Sidebar drawer configuration */
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 260px !important;
        height: 100vh;
        z-index: 1000;
        padding: 24px !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.5);
    }

    .sidebar.sidebar-open {
        left: 0;
    }

    /* Force show all text in mobile drawer overlay */
    .sidebar .brand-text,
    .sidebar .nav-text,
    .sidebar .sidebar-footer {
        opacity: 1 !important;
        transform: translateX(0) !important;
        pointer-events: auto !important;
    }

    .sidebar .nav-btn {
        padding: 12px 16px !important;
    }

    /* Content adjustments */
    .main-content {
        height: auto;
        min-height: 100vh;
        overflow-y: visible;
    }

    .top-bar {
        padding: 16px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .top-bar .header-title h2 {
        font-size: 1.2rem;
    }

    .top-bar .header-title p {
        display: none; /* Hide subtitle to save space */
    }

    .user-profile {
        gap: 8px;
    }

    .user-details {
        display: none; /* Hide user details on mobile to fit avatar */
    }

    /* Stats Container Stacking */
    .stats-row {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }

    .stat-card {
        width: 100%;
        margin-bottom: 0;
    }

    /* Action bar stacking */
    .action-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 16px;
    }

    .search-box {
        width: 100%;
    }

    #btn-create-new {
        width: 100%;
        justify-content: center;
        padding: 12px;
    }

    /* Table Container Scrolling */
    .bl-list-container {
        margin: 16px;
        border-radius: var(--radius-sm);
        overflow-x: auto;
    }

    .list-header, .bl-row-item {
        min-width: 850px;
    }

    /* Form and Editor views */
    .form-container {
        padding: 16px;
    }

    .editor-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .editor-actions {
        width: 100%;
        display: flex;
        justify-content: space-between;
        gap: 8px;
    }

    .editor-actions .btn {
        flex: 1;
        justify-content: center;
        padding: 10px;
        font-size: 0.85rem;
    }

    .form-grid, .form-container .form-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .span-2, .form-container .span-2 {
        grid-column: span 1 !important;
    }

    /* Tabs scrollbar */
    .tabs-nav {
        gap: 4px;
        padding-bottom: 8px;
        margin-bottom: 16px;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
    }

    .tab-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        flex-shrink: 0 !important;
    }

    /* Form helper buttons stack */
    .party-action-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .btn-quick-fill, .btn-save-party {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    /* Print Preview Controls Mobile Adjustments */
    .preview-controls {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .print-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .print-options .checkbox-container {
        width: 100%;
    }

    .print-copy-type-container {
        width: 100%;
        justify-content: space-between;
    }

    .print-copy-type-container select {
        flex-grow: 1;
        max-width: 200px;
    }
}

/* Pagination Styling */
.pagination-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background-color: rgba(0, 0, 0, 0.15);
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.pagination-info {
    font-weight: 500;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination-btn.active {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

/* ==========================================================================
   PRINT MEDIA CUSTOM SHEET CONFIG (FIXED FOR NO B/L BLANK PRINT BUG)
   ========================================================================== */
@media print {
    /* Remove Chrome default print margins — we handle our own via padding */
    @page {
        size: A4;
        margin: 0;
    }

    @page landscape-page {
        size: A4 landscape;
        margin: 0;
    }

    /* Base print optimization */
    body, html {
        background-color: white !important;
        color: black !important;
        height: auto !important;
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body:not(.manifest-print-active) {
        width: 210mm !important;
        min-width: 210mm !important;
    }
    
    /* Hide dashboard controls and global no-print classes */
    .no-print,
    .preview-controls,
    .sidebar,
    .sidebar-overlay,
    .top-bar,
    button,
    .editor-header {
        display: none !important;
    }

    /* FIX PELAKU UTAMA BLANK SCREEN:
       Jangan sembunyikan #app-container karena membungkus dokumen utama.
       Kita paksa container utama ini menjadi block transparan tanpa layout flexbox.
    */
    #app-container {
        display: block !important;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Paksa juga wrapper main-content agar tumpah keluar isinya saat dicetak */
    .main-content {
        display: block !important;
        overflow: visible !important;
        height: auto !important;
        background: transparent !important;
    }

    /* Pastikan view pembungkus cetak aktif dan terlihat */
    .content-view {
        display: none;
    }
    .content-view.active {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Layout document sheets exactly */
    .preview-scroll-container {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
    }

    #preview-document,
    .preview-document {
        display: block !important;
        width: 210mm !important;
        min-width: 210mm !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .bl-page {
        box-sizing: border-box !important;
        width: 210mm !important;
        height: 292mm !important; /* UBAH: Kurangi sedikit dari 296mm ke 292mm untuk sisa aman */
        padding: 8mm 10mm !important; /* UBAH: Perkecil padding atas-bawah jadi 8mm */
        margin: 0 !important;
        box-shadow: none !important;
        overflow: hidden !important;
        page-break-inside: avoid !important;
        page-break-after: auto !important;
        page-break-before: always !important;
    }

    /* Do not add page break before the very first page */
    .bl-page:first-child {
        page-break-before: auto !important;
    }

    .bl-outer-border {
        border: 1.5px solid black !important;
        height: 270mm !important; /* UBAH: Turunkan dari 275mm ke 270mm agar pas di dalam .bl-page */
    }

    .terms-container {
        border: 1px solid black !important;
        height: 270mm !important; /* UBAH: Sesuaikan juga dengan tinggi border luar (270mm) */
    }
}

/* ==========================================================================
   INTERACTIVE PREVIEW EDITING STYLES (SCREEN ONLY)
   ========================================================================== */
@media screen {
    .editable-preview-field {
        transition: background-color 0.2s, box-shadow 0.2s;
        cursor: text !important;
        position: relative;
    }
    .editable-preview-field:hover {
        background-color: rgba(99, 102, 241, 0.15) !important;
        outline: 1.5px dashed #6366f1 !important;
        box-shadow: 0 0 5px rgba(99, 102, 241, 0.4) !important;
    }
    .editable-preview-field:focus {
        background-color: rgba(99, 102, 241, 0.2) !important;
        outline: 2px solid #6366f1 !important;
        box-shadow: 0 0 8px rgba(99, 102, 241, 0.6) !important;
    }
    
    .floating-edit-btn {
        display: flex;
        align-items: center;
        gap: 6px;
        background-color: #6366f1;
        color: white !important;
        font-family: 'Inter', sans-serif;
        font-size: 11px;
        font-weight: 600;
        padding: 5px 10px;
        border-radius: 4px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.1);
        pointer-events: auto;
        cursor: pointer;
        z-index: 9999;
        border: none;
        transition: background-color 0.2s, transform 0.1s;
    }
    .floating-edit-btn:hover {
        background-color: #4f46e5;
        transform: scale(1.05);
    }
    .floating-edit-btn svg {
        flex-shrink: 0;
        fill: none;
        stroke: currentColor;
    }
}

/* ==========================================================================
   LOGIN SCREEN SYSTEM
   ========================================================================== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-app);
    background-image: radial-gradient(circle at 50% 50%, #1e293b 0%, #0b0f19 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.login-card {
    background-color: var(--bg-content);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.login-logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--color-primary), #4f46e5);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.6rem;
    color: white;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
    margin: 0 auto 24px auto;
}

.login-card h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.login-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 32px;
}

.login-card form {
    text-align: left;
}

.login-card .form-group {
    margin-bottom: 20px;
}

.login-card label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.login-card input {
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 12px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.login-card input:focus {
    border-color: var(--color-primary);
}

.login-btn {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    margin-top: 10px;
}

.login-error-msg {
    color: var(--color-danger);
    font-size: 0.85rem;
    margin-bottom: 16px;
    text-align: center;
    background-color: rgba(239, 68, 68, 0.1);
    padding: 8px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ==========================================================================
   HISTORY LOGS (AUDIT TRAIL) STYLING
   ========================================================================== */
.history-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

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

.history-header h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.history-table-wrapper {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    text-align: left;
}

.history-table th {
    padding: 14px 16px;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.history-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.history-table tr:last-child td {
    border-bottom: none;
}

.history-table tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.loading-logs-msg {
    text-align: center;
    color: var(--text-muted);
    padding: 40px !important;
}

/* Action Badges */
.history-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.history-badge.create {
    background-color: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.history-badge.update {
    background-color: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.history-badge.delete {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.history-badge.duplicate {
    background-color: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

/* Detail Toggler */
.details-row {
    background-color: rgba(0, 0, 0, 0.15) !important;
}

.details-row td {
    padding: 16px 24px !important;
}

.history-details-content {
    border-left: 2px solid var(--color-primary);
    padding-left: 16px;
    font-family: inherit;
    font-size: 0.85rem;
}

.history-details-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-details-list li {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-details-field {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
}

.history-details-diff {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.history-details-diff .old-val {
    color: #ef4444;
    text-decoration: line-through;
    background-color: rgba(239, 68, 68, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    white-space: pre-wrap;
}

.history-details-diff .arrow {
    color: var(--text-muted);
}

.history-details-diff .new-val {
    color: #10b981;
    background-color: rgba(16, 185, 129, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    white-space: pre-wrap;
}

.btn-details-toggle {
    background: transparent;
    color: var(--color-primary);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 4px 8px;
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-details-toggle:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

/* ==========================================================================
   CARGO MANIFEST VIEW STYLES
   ========================================================================== */
.manifest-scroll-container {
    display: flex;
    justify-content: center;
    overflow-x: auto;
    padding-bottom: 40px;
}

.manifest-preview-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.manifest-page {
    width: 297mm;
    min-height: 210mm;
    background-color: white;
    color: black;
    padding: 15mm;
    box-sizing: border-box;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
    font-family: Arial, Helvetica, sans-serif;
    margin: 0 auto;
    position: relative;
    font-size: 8.5pt;
}

/* Cargo Manifest Table */
.manifest-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 8pt;
    font-family: Arial, sans-serif;
    margin-top: 10px;
}

.manifest-table thead {
    border-top: 1.5px solid black;
    border-bottom: 1.5px solid black;
}

.manifest-table th {
    font-size: 8pt;
    font-weight: bold;
    text-transform: uppercase;
    padding: 8px 6px;
    vertical-align: bottom;
    text-align: left;
    color: black;
}

.manifest-table td {
    padding: 10px 6px;
    vertical-align: top;
    line-height: 1.35;
    word-break: break-word;
    color: black;
}

.manifest-table tbody tr {
    border-bottom: 1px solid black;
}

.manifest-table tbody tr:last-child {
    border-bottom: 1.5px solid black;
}

/* Alignments */
.manifest-table .text-center { text-align: center; }
.manifest-table .text-right { text-align: right; }
.manifest-table .text-bold { font-weight: bold; }
.manifest-table .text-pre-wrap { white-space: pre-wrap; }

/* Custom columns width matching layout */
.col-m-parties { width: 28%; }
.col-m-blno { width: 14%; }
.col-m-marks { width: 20%; font-family: monospace; font-size: 7.5pt; }
.col-m-desc { width: 26%; }
.col-m-weight { width: 12%; }

/* Make editable preview fields look clear */
.manifest-page [contenteditable="true"] {
    outline: none;
    transition: background-color 0.2s;
}

.manifest-page [contenteditable="true"]:hover {
    background-color: rgba(99, 102, 241, 0.1) !important;
}

.manifest-page [contenteditable="true"]:focus {
    background-color: rgba(99, 102, 241, 0.15) !important;
    box-shadow: 0 0 0 1px #6366f1;
}

@media print {
    /* Set page orientation to landscape when printing cargo manifest */
    body.manifest-print-active {
        page: landscape-page;
        width: 297mm !important;
        min-width: 297mm !important;
    }
    
    body.manifest-print-active .no-print,
    body.manifest-print-active .sidebar,
    body.manifest-print-active .top-bar,
    body.manifest-print-active .manifest-controls {
        display: none !important;
    }
    
    body.manifest-print-active #app-container,
    body.manifest-print-active .main-content,
    body.manifest-print-active #view-manifest {
        display: block !important;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }
    
    body.manifest-print-active .manifest-scroll-container {
        display: block !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    body.manifest-print-active .manifest-page {
        page: landscape-page;
        width: 297mm !important;
        height: auto !important;
        min-height: 209mm !important;
        padding: 10mm 15mm !important;
        margin: 0 !important;
        box-shadow: none !important;
        page-break-inside: auto !important;
        page-break-after: auto !important;
        page-break-before: always !important;
        font-size: 8.5pt !important;
    }
    
    body.manifest-print-active .manifest-table tr {
        page-break-inside: avoid !important;
    }
    
    body.manifest-print-active .manifest-page:first-child {
        page-break-before: auto !important;
    }
}

.bl-watermark {
    position: absolute;
    top: 54%;
    left: 63%;
    transform: translateY(-50%);
    font-size: 21pt;
    font-weight: 500;
    color: rgba(0, 140, 255, 0.85); /* Warna biru cap basah */
    text-transform: uppercase;
    font-family: 'Noto Serif', Georgia, 'Times New Roman', serif;
    pointer-events: none;
    z-index: 5;
    letter-spacing: 1.5px;
    white-space: nowrap;
}

/* ==========================================================================
   KAS OPERASIONAL MODULE STYLES
   ========================================================================== */
.stat-icon.blue {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--color-primary);
}
.stat-icon.purple {
    background-color: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}
.stat-icon.green {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal-card {
    background-color: var(--bg-content);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    animation: modalFadeIn 0.3s ease-out;
}

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

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

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s, color 0.2s;
}

.btn-close-modal:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

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

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

/* Dropzone */
.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 40px 24px;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.01);
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--color-primary);
    background-color: rgba(59, 130, 246, 0.03);
}

.dropzone svg {
    margin-bottom: 16px;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.dropzone:hover svg, .dropzone.dragover svg {
    color: var(--color-primary);
}

.dropzone p {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.dropzone span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Progress */
.upload-progress {
    margin-top: 24px;
    text-align: center;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background-color: var(--bg-card);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    background-color: var(--color-primary);
    border-radius: var(--radius-sm);
    transition: width 0.2s ease;
}

.upload-progress p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Custom Table inputs */
#kas-editor-items-table input, #kas-editor-containers-table input {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.825rem;
    outline: none;
    transition: border-color 0.2s;
}

#kas-editor-items-table input:focus, #kas-editor-containers-table input:focus {
    border-color: var(--color-primary);
}

/* ==========================================================================
   TRUCK MONITORING SYSTEM STYLES
   ========================================================================== */
.truck-node-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    border-radius: 8px;
    padding: 20px;
    width: 220px;
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3);
    border: 2px solid #60a5fa;
    position: relative;
    z-index: 10;
}

.container-stripes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: repeating-linear-gradient(90deg, transparent, transparent 15px, rgba(255, 255, 255, 0.05) 15px, rgba(255, 255, 255, 0.05) 30px);
    border-radius: 6px;
    pointer-events: none;
}

.container-badge {
    background-color: #f59e0b;
    color: #1e293b;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.diagram-arrows-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.trucks-list-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 10;
}

.truck-card-node {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    width: 240px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.truck-card-node:hover {
    transform: translateX(4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6;
}

.truck-plate-badge {
    background-color: #1e293b;
    color: white;
    font-family: monospace;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1.5px solid #475569;
    text-align: center;
    white-space: nowrap;
    min-width: 90px;
}

.truck-driver-info {
    flex: 1;
}

.truck-driver-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.truck-driver-role {
    font-size: 0.75rem;
    color: #64748b;
    margin: 2px 0 0 0;
}

.truck-load-badge {
    background-color: #ecfdf5;
    color: #047857;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #a7f3d0;
    white-space: nowrap;
}

/* Weight Validation Status Colors */
.badge-weight-valid {
    background-color: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-weight-under {
    background-color: rgba(245, 158, 11, 0.15);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-weight-over {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Autocomplete inputs datalist suggestion override */
input[list]::-webkit-calendar-picker-indicator {
    display: inline-block !important;
}

/* Trucking Table Grid Styles */
.trucking-grid-table {
    border-collapse: collapse;
    width: 100%;
}
.trucking-grid-table thead tr {
    background: var(--bg-card);
}
.trucking-grid-table th {
    border: 1px solid rgba(255,255,255,0.08);
    padding: 10px 12px;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}
.trucking-grid-table td {
    border: 1px solid rgba(255,255,255,0.05);
    padding: 10px 12px;
    font-size: 0.875rem;
    vertical-align: middle;
}
.trucking-grid-table tbody tr {
    transition: background 0.15s ease;
}
.trucking-grid-table tbody tr:hover {
    background-color: rgba(255,255,255,0.04);
}
.trucking-grid-table tbody tr:nth-child(even) {
    background-color: rgba(255,255,255,0.015);
}

/* Icon-only action button tooltips */
[title] {
    position: relative;
}

/* Photo Paste Target Styles */
.photo-paste-zone {
    border: 2px dashed var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}
.photo-paste-zone:hover {
    border-color: var(--color-primary);
    background-color: rgba(59, 130, 246, 0.05) !important;
    color: var(--color-primary) !important;
}
.photo-paste-zone.active-target {
    border-color: var(--color-primary) !important;
    background-color: rgba(59, 130, 246, 0.1) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
    color: var(--color-primary) !important;
}

/* Print Overrides for PDF */
@media print {
    #truck-print-area {
        padding: 0 !important;
        background: white !important;
        color: black !important;
    }
}

/* ========================================
   MOBILE-FRIENDLY TRANSLOADING PREVIEW
   ======================================== */
@media (max-width: 768px) {

    /* Modal card full screen on mobile */
    #truck-preview-modal .modal-card {
        width: 100% !important;
        max-width: 100% !important;
        height: 100dvh;
        border-radius: 0 !important;
        display: flex;
        flex-direction: column;
    }
    #truck-preview-modal .modal-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px !important;
    }
    #truck-preview-modal .modal-footer {
        flex-shrink: 0;
    }

    /* Info grid: 1 column on mobile */
    #truck-print-area > div[style*="grid-template-columns: repeat(2"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        padding: 12px !important;
    }

    /* Header strip */
    #truck-print-area > div:first-child {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    /* Route banner wraps on small screen */
    #lbl-preview-route-banner {
        flex-wrap: wrap;
        gap: 6px;
    }
    #lbl-preview-route-banner > div {
        display: none; /* hide the line on very small screens */
    }
    #lbl-preview-route-origin,
    #lbl-preview-route-destination {
        font-size: 0.78rem !important;
    }

    /* Diagram: scrollable horizontally */
    #truck-illustration-diagram {
        overflow-x: auto !important;
        min-width: unset !important;
        -webkit-overflow-scrolling: touch;
        padding: 12px !important;
        min-height: 260px !important;
    }

    /* Truck nodes smaller */
    .truck-node-dump {
        width: 130px !important;
        min-height: 80px !important;
        font-size: 0.72rem !important;
        padding: 8px !important;
    }
    .truck-node-container {
        width: 110px !important;
        min-height: 100px !important;
        font-size: 0.72rem !important;
        padding: 8px !important;
    }
    .truck-node-dump .truck-plate {
        font-size: 0.65rem !important;
        padding: 3px 6px !important;
    }
    .truck-node-dump .truck-weight-badge {
        font-size: 0.68rem !important;
        padding: 2px 6px !important;
    }
}

