/* --- FILE: /public/css/app.css --- */
/*
=================================
 GLOBAL VARIABLES & RESET
=================================
*/
:root {
    --primary-color: #4a69bd;
    --light-gray: #f4f4f4;
    --dark-gray: #333;
    --border-radius: 5px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: var(--light-gray);
    color: var(--dark-gray);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/*
=================================
 AUTH & LOGIN PAGES
=================================
*/
.login-container {
    background-color: #ffffff;
    padding: 2rem 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
}

.login-container h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--dark-gray);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    box-sizing: border-box;
    font-size: 1rem;
}

.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    box-sizing: border-box;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 105, 189, 0.2);
}

small {
    font-size: 0.8em;
    color: #6c757d;
    margin-top: 4px;
    display: block;
}

.form-options {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
}

.form-options a, .signup-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
}

.form-options a:hover, .signup-link a:hover {
    text-decoration: underline;
}

.btn-login {
    width: 100%;
    padding: 0.85rem;
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

.btn-login:hover {
    background-color: #3b5998;
}

.signup-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

@media (max-width: 480px) {
    .login-container {
        padding: 1.5rem;
        margin: 1rem;
    }
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid #f5c6cb;
    border-radius: var(--border-radius);
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid #c3e6cb;
    border-radius: var(--border-radius);
}

fieldset {
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-color: #ddd;
}

legend {
    padding: 0 0.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.form-group label span.required {
    color: #dc3545;
    font-weight: bold;
    margin-left: 2px;
}

.address-toggle-link {
    font-size: 0.85em;
    text-align: right;
    cursor: pointer;
    color: var(--primary-color);
    margin-top: 4px;
    font-weight: 500;
}

.address-input {
    margin-bottom: 8px;
}
.address-input:last-child {
    margin-bottom: 0;
}

.is-valid {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.25) !important;
}

.is-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25) !important;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}
button:disabled:hover {
    background-color: #ccc;
}

.password-requirements {
    font-size: 0.85em;
    color: #555;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
    padding: 0.75rem;
    margin-top: -0.5rem;
    margin-bottom: 1.25rem;
}
.password-requirements ul {
    margin: 0.5rem 0 0 1.2rem;
    padding: 0;
}
.password-requirements li {
    margin-bottom: 0.25rem;
}

/*
=================================
 DASHBOARD LAYOUT
=================================
*/
body.dashboard-body {
    display: block;
    background-color: var(--light-gray);
    overflow: hidden; /* Prevents the body itself from scrolling */
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-rows: 60px 1fr;
    grid-template-areas:
        "header header"
        "sidebar main";
    height: 100vh;
}

.dashboard-header {
    grid-area: header;
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-grow: 1;
    min-width: 0;
}
.header-context {
    font-size: 1.2rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.header-company-name {
    color: var(--dark-gray);
}
.header-site-name {
    color: #6c757d;
    font-weight: 500;
}

.header-user-menu {
    position: relative;
    display: flex;
    align-items: center;
}
.user-dropdown-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: background-color 0.2s;
}
.user-dropdown-toggle:hover {
    background-color: var(--light-gray);
}
.user-dropdown-toggle svg {
    margin-left: 0.5rem;
}
.user-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    min-width: 150px;
    z-index: 1000;
}
.user-dropdown-menu.show {
    display: block;
}
.user-dropdown-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--dark-gray);
    text-decoration: none;
}
.user-dropdown-menu a:hover {
    background-color: var(--light-gray);
}

/*
=================================
 SIDEBAR NAVIGATION
=================================
*/
.dashboard-sidebar {
    grid-area: sidebar;
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 1rem 0;
    overflow-y: auto;
}
.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Level 1 Links */
.sidebar-nav a {
    display: block;
    color: #ecf0f1;
    text-decoration: none;
    padding: 0.9rem 1.5rem;
    transition: background-color 0.2s;
}
.sidebar-nav a:hover {
    background-color: #4c5d6e;
}
.sidebar-nav a.active {
    background-color: var(--primary-color);
    font-weight: bold;
}
.sidebar-nav a.active:hover {
    background-color: var(--primary-color);
}

/* Level 1 Toggle (Dropdown) */
.sidebar-nav .menu-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sidebar-nav .menu-arrow {
    transition: transform 0.2s ease-in-out;
}
.sidebar-nav .menu-toggle.open .menu-arrow {
    transform: rotate(180deg);
}

/* Level 2 Container */
.submenu {
    display: none;
    background-color: #22313f; /* Darker than main sidebar */
}

/* Level 2 Links */
.submenu a {
    font-size: 0.9em;
    padding-left: 2.5rem;
    background-color: transparent;
}
.submenu a:hover {
    background-color: #34495e;
}

/* Section Labels inside Submenus */
.menu-section-label {
    padding: 0.75rem 1.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #95a5a6;
    font-weight: bold;
    letter-spacing: 0.5px;
    margin-top: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* === NESTED SIDEBAR STYLES (Level 3) === */

/* Level 3 (Sub-Category) Toggle */
.sub-menu-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.5rem 0.8rem 2.5rem; /* Indented */
    color: #bdc3c7;
    text-decoration: none;
    font-size: 0.95em;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 500;
}

.sub-menu-toggle:hover {
    background-color: #34495e;
    color: #fff;
}

/* Level 3 (Sub-Category) Arrow */
.sub-menu-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
    opacity: 0.7;
}

.sub-menu-toggle.open .sub-menu-arrow {
    transform: rotate(180deg);
}

/* Level 3 Container */
.sub-submenu {
    display: none; /* Hidden by default */
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: #1a252f; /* Even darker */
    box-shadow: inset 0 4px 6px -4px rgba(0,0,0,0.3);
}

/* Level 3 Links (The actual pages) */
.sub-submenu a {
    padding-left: 4rem !important; /* Deep indentation */
    font-size: 0.9em;
    color: #ecf0f1;
    opacity: 0.85;
    border-left: 3px solid transparent;
}

.sub-submenu a:hover {
    opacity: 1;
    background-color: rgba(255,255,255,0.05);
}

.sub-submenu a.active {
    border-left-color: var(--primary-color);
    background-color: rgba(74, 105, 189, 0.2); /* Tint of primary color */
    color: #fff;
    opacity: 1;
}

/*
=================================
 MAIN CONTENT AREA
=================================
*/
.dashboard-main {
    grid-area: main;
    padding: 2rem;
    overflow-y: auto;
}
.page-content {
    background-color: #ffffff;
    padding: 2rem;
    border-radius: var(--border-radius);
}

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

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
}
.btn-secondary {
    background-color: #6c757d;
    color: #fff;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
}
.btn-edit {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    cursor: pointer;
}
.btn-full-width {
    width: 100%;
    max-width: 500px;
    padding: 1rem;
    font-size: 1.2rem;
}

.form-actions {
    text-align: right;
    margin-top: 1.5rem;
}

/* Badges */
.status-active { color: #28a745; font-weight: bold; }
.status-inactive { color: #6c757d; }
.status-badge {
    padding: 3px 8px;
    border-radius: 10px;
    color: white;
    font-size: 0.8em;
    text-transform: capitalize;
}
.status-open { background-color: #007bff; }
.status-partially_received { background-color: #ffc107; color: #212529; }
.status-fully_received { background-color: #28a745; }
.status-received_with_overage { background-color: #fd7e14; }
.status-closed_short, .status-cancelled { background-color: #6c757d; }

/*
=================================
 MODALS & OVERLAYS
=================================
*/
.modal {
    display: none; position: fixed; z-index: 1000; left: 0; top: 0;
    width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5);
}
.modal-content {
    background-color: #fefefe; margin: 5% auto; padding: 2rem;
    border: 1px solid #888; width: 80%; max-width: 600px; border-radius: var(--border-radius);
    position: relative;
}
.modal-close {
    color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer;
}

/* Site Switcher List */
#switch-site-link {
    cursor: pointer;
}
.switcher-list {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
    max-height: 40vh;
    overflow-y: auto;
}
.switcher-list li {
    padding: 0.75rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}
.switcher-list li:hover {
    background-color: var(--light-gray);
}
.switcher-list li:last-child {
    border-bottom: none;
}
.switcher-list .no-sites {
    cursor: default;
    color: #6c757d;
}
.switcher-list .no-sites:hover {
    background-color: transparent;
}

/* Loading Spinner */
.loading-overlay {
    display: none; position: fixed; z-index: 2000; left: 0; top: 0;
    width: 100%; height: 100%; background-color: rgba(255,255,255,0.7);
    justify-content: center; align-items: center;
}
.spinner {
    border: 8px solid #f3f3f3; border-top: 8px solid var(--primary-color);
    border-radius: 50%; width: 60px; height: 60px; animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/*
=================================
 WMS SPECIFIC STYLES
=================================
*/
#product_code {
    text-transform: uppercase;
}

.image-preview-container {
    text-align: center;
    margin-top: 1rem;
    min-height: 100px;
}
.image-preview {
    max-width: 100%;
    max-height: 150px;
    border-radius: var(--border-radius);
    border: 1px solid #ddd;
    display: none;
}

.form-group-checkbox {
    display: flex;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}
.form-group-checkbox input[type="checkbox"] {
    width: auto;
    margin-right: 0.75rem;
}
.form-group-checkbox label {
    margin-bottom: 0;
    font-weight: normal;
}

.form-group-stacked-options {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
}
.form-group-stacked-options label {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.rule-form {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid #dee2e6;
    margin-bottom: 2rem;
}
.rule-form .form-group {
    margin-bottom: 0;
}
.rule-form .form-group label {
    font-size: 0.8em;
    font-weight: normal;
}
.rules-list ul {
    list-style: none;
    padding: 0;
}
.rules-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid #eee;
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
}
.rules-list .no-rules {
    border: none;
    color: #6c757d;
}
.btn-delete-rule {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.select2-container--open {
    z-index: 1050;
}

/* Breadcrumbs */
.breadcrumbs {
    font-size: 0.9em;
    color: #6c757d;
}
.breadcrumbs a {
    color: var(--primary-color);
    text-decoration: none;
}
.breadcrumbs a:hover {
    text-decoration: underline;
}
.breadcrumbs span {
    font-weight: bold;
}

/* DataTables */
.dt-layout-row:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.dt-length {
    text-align: left;
}
.dt-search {
    text-align: right;
}
.dt-search input {
    margin-left: 0.5rem;
}

/* Compact Tables */
.compact-table { width: 100%; border-collapse: collapse; font-size: 0.9em; margin-bottom: 1.5rem; }
.compact-table th, .compact-table td { border: 1px solid #ddd; padding: 6px; text-align: left; }
.compact-table th { background-color: #f8f9fa; }
.compact-table .inactive-row { background-color: #f8f9fa; color: #6c757d; }
.compact-table .inactive-row a, .compact-table .inactive-row button { opacity: 0.6; }

.add-line-form { margin-top: 1.5rem; padding: 1rem; border: 1px solid #eee; border-radius: var(--border-radius); }

/* Label & Print */
.label-wrapper {
    display: flex;
    flex-direction: column;
}
.label-wrapper label {
    margin-bottom: 0;
}
.label-wrapper small {
    display: block;
    margin-top: 2px;
}

/* Packing Terminal */
.packing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
#packages-planned .package-card { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 5px; margin-bottom: 1rem; padding: 1rem; }
#packages-planned .package-card.active { border-left: 5px solid var(--primary-color); }
#packages-planned .package-card h4 { margin-top: 0; }
#packages-planned ul { padding-left: 20px; }
#action-instruction { padding: 1rem; background: #eaf2ff; border-radius: 5px; font-size: 1.2rem; font-weight: bold; text-align: center; margin-bottom: 1rem;}

.terminal-header { padding: 1rem; background-color: #f8f9fa; border-radius: 5px; margin-bottom: 1rem; }
#session-info { font-weight: bold; }
#session-info span { padding: 5px 10px; color: white; border-radius: 3px; }
#instruction-area { margin-top: 1rem; font-size: 1.2rem; text-align: center; }
#error-area { margin-top: 1rem; }

/* Directives */
.putaway-directive { border: 2px solid #333; border-radius: 5px; }
.directive-box { padding: 1rem; border-bottom: 1px solid #ddd; }
.directive-box:last-child { border-bottom: none; }
.directive-label { display: block; font-size: 0.8em; color: #6c757d; font-weight: bold; text-transform: uppercase; }
.directive-value { display: block; font-size: 2em; font-weight: bold; }
.directive-destination { background-color: #d4edda; }

/* Action Dropdowns in Tables */
.action-dropdown { position: relative; display: inline-block; }
.action-toggle { background: #f0f0f0; border: 1px solid #ccc; padding: 5px 10px; cursor: pointer; border-radius: 3px; }
.action-menu { display: none; position: absolute; background-color: white; min-width: 120px; box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2); z-index: 100; border: 1px solid #ddd; right: 0; }
.action-menu a { color: black; padding: 8px 12px; text-decoration: none; display: block; font-size: 0.9em; }
.action-menu a:hover { background-color: #f1f1f1; }
.action-dropdown:hover .action-menu { display: block; }

.form-control-plaintext {
    display: block;
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: .25rem;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-row { display: flex; gap: 1rem; align-items: flex-end; } .form-row .form-group { flex: 1; }

.receipt-qty-input {
    width: 100px;
    padding: 0.5rem;
    text-align: center;
    font-size: 1.1rem;
}

.table-controls { display: flex; align-items: center; gap: 0.5rem; }
.control-checkbox { width: auto; }
.control-label { display: inline; font-weight: normal; margin-right: 1rem; }

.address-display-box {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    font-family: monospace;
    white-space: pre-wrap;
    line-height: 1.5;
}

.checkbox-align-wrapper {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.checkbox-align-wrapper .control-label {
    margin-bottom: 0;
    order: 1;
    white-space: nowrap;
}
.checkbox-align-wrapper .control-checkbox {
    width: auto;
    order: 2;
}

/* Add Line Form Alignment */
.add-line-form .form-row {
    align-items: center;
}
.add-line-form .form-row .form-group {
    flex-grow: 1;
    margin-bottom: 0;
}
.add-line-form .form-row .form-group label {
    display: none;
}
.add-line-form .form-row .form-group input,
.add-line-form .form-row .form-group .select2-container .select2-selection--single,
.header-row .form-group input,
.header-row .form-group select,
.header-row .form-group .select2-container .select2-selection--single {
    height: 40px; 
    box-sizing: border-box;
}
.add-line-form .form-row .form-group .select2-container .select2-selection--single .select2-selection__rendered,
.add-line-form .form-row .form-group .select2-container .select2-selection--single .select2-selection__arrow,
.header-row .form-group .select2-container .select2-selection--single .select2-selection__rendered,
.header-row .form-group .select2-container .select2-selection--single .select2-selection__arrow {
    line-height: 38px;
    height: 38px;
}
.header-row .form-group select {
    line-height: 38px;
    padding-top: 0;
    padding-bottom: 0;
}
.add-line-form .form-row .form-group input[type="number"] {
    flex-grow: 0;
    flex-shrink: 0;
    flex-basis: 120px;
    width: 120px;
}
.add-line-form .form-row .form-group button {
    flex-shrink: 0;
    height: 40px;
    box-sizing: border-box;
    white-space: nowrap;
}
.add-line-form .form-row .form-group-product {
    flex: 3 !important;
}
.add-line-form .form-row .form-group-button {
    flex-grow: 0;
    flex-shrink: 0;
}

/* === KPI CARDS === */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.kpi-card {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    text-decoration: none;
    color: var(--dark-gray);
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.kpi-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
}

.kpi-label {
    font-size: 1rem;
    color: #6c757d;
    margin-top: 0.5rem;
}

/* === MISC STYLES === */
.info-box {
    padding: 1rem;
    background-color: #eaf2ff;
    border-left: 4px solid var(--primary-color);
    margin-bottom: 2rem;
}

.po-list {
    list-style: none;
    padding: 0;
}
.po-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid #eee;
    border-radius: 5px;
    margin-bottom: 0.5rem;
}

.admin-container { max-width: 800px; text-align: center; }
.btn-snapshot {
    display: inline-block;
    padding: 1.5rem 3rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    background-color: #28a745;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    margin-top: 2rem;
    transition: background-color 0.3s;
}
.btn-snapshot:hover { background-color: #218838; }
.admin-logout { margin-top: 3rem; }

.discrepancy-gain { color: #28a745; font-weight: bold; }
.discrepancy-loss { color: #dc3545; font-weight: bold; }
.count-history-list { list-style: none; padding-left: 0; margin: 0; font-size: 0.9em; }
.item-list { list-style: none; padding-left: 0; max-height: 200px; overflow-y: auto; }

/* Styles from dispatch-planning-terminal.php */
.lane-card { background-color: #f8f9fa; border: 1px solid #dee2e6; border-radius: 5px; margin-bottom: 1.5rem; }
.lane-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem; background-color: #e9ecef; border-bottom: 1px solid #dee2e6; }
.lane-title { font-weight: bold; font-size: 1.2em; }
.lane-address { font-family: monospace; font-size: 0.9em; color: #6c757d; }
.lane-body { padding: 1rem; }
.shipment-list { list-style: none; padding-left: 0; }
.shipment-list li { display: flex; justify-content: space-between; padding: 0.5rem; border-bottom: 1px solid #eee; }
.failure-card { border-left: 5px solid #dc3545; }
.failure-header { background-color: #f8d7da; }
.failure-error { color: #721c24; font-weight: bold; margin-top: 0.5rem; }

/* Styles from book-dispatch-lane.php */
.booking-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.scan-list li { display: flex; align-items: center; justify-content: space-between; padding: 8px; border-bottom: 1px solid #eee; }
.scan-list li.scanned { background-color: #d4edda; text-decoration: line-through; }
.scan-list .scan-status { font-weight: bold; }
#plan-summary { background: #eaf2ff; border-left: 5px solid var(--primary-color); padding: 1.5rem; margin-bottom: 2rem; }
#plan-title { font-size: 1.5rem; margin-top: 0; }

/* Styles from rebook-shipment.php */
.rebook-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }

/* === MANIFEST PLANNING TERMINAL STYLES === */
.lane-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

/* === ONBOARDING CHECKLIST WIDGET === */
.onboarding-widget {
    background-color: #eaf2ff;
    border: 1px solid #b8d4ff;
    border-radius: var(--border-radius);
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
}
.onboarding-widget h2 { margin-top: 0; color: var(--primary-color); }
.onboarding-list { list-style: none; padding: 0; margin: 1.5rem 0 0 0; }
.onboarding-list li { display: flex; align-items: center; font-size: 1.1rem; margin-bottom: 1.25rem; }
.onboarding-list .status-icon { margin-right: 1rem; width: 24px; height: 24px; }
.onboarding-list .task-text a { color: var(--primary-color); font-weight: 500; text-decoration: none; border-bottom: 1px dashed var(--primary-color); }
.onboarding-list .task-text a:hover { border-bottom-style: solid; }
.onboarding-list li.completed .task-text { text-decoration: line-through; color: #6c757d; }

/* === IN-APP HELP PANEL === */
.help-panel {
    position: fixed;
    top: 0;
    right: -900px;
    width: 900px;
    height: 100vh;
    background-color: #ffffff;
    box-shadow: -5px 0 15px rgba(0,0,0,0.15);
    z-index: 2000;
    transition: right 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}
.help-panel.open { right: 0; }
body.help-panel-open .dashboard-grid { width: calc(100% - 900px); transition: width 0.3s ease-in-out; }
.help-panel-header { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1.5rem; border-bottom: 1px solid #e0e0e0; flex-shrink: 0; }
.help-panel-header h3 { margin: 0; }
#help-panel-close { background: none; border: none; font-size: 2rem; cursor: pointer; color: #6c757d; }
.help-panel-body { display: grid; grid-template-columns: 280px 1fr; flex-grow: 1; overflow: hidden; }
.help-panel-sidebar { border-right: 1px solid #e0e0e0; padding: 1rem; overflow-y: auto; font-size: 0.9em; }
.help-panel-sidebar h4 { margin-top: 0; font-size: 0.9rem; text-transform: uppercase; color: #6c757d; }
.help-panel-sidebar ul { list-style: none; padding: 0; margin: 0 0 1rem 0; }
.help-panel-sidebar a { display: block; padding: 0.4rem; text-decoration: none; color: #333; border-radius: 4px; }
.help-panel-sidebar a:hover { background-color: #eaf2ff; }
.help-panel-sidebar a.active { background-color: var(--primary-color); color: #fff; }
.help-panel-content { padding: 1.5rem 2rem; overflow-y: auto; font-size: 0.95em; }
.help-panel-content h1, .help-panel-content h2 { border-bottom: 1px solid #eee; padding-bottom: 0.5rem; }
.help-panel-content h1 { font-size: 1.6rem; margin-top:0; }
.help-panel-content h2 { font-size: 1.3rem; margin-top: 2rem;}
.help-panel-search-container { position: relative; margin-bottom: 1rem; }
#help-panel-search-input { width: 100%; padding: 0.5rem; font-size: 0.9rem; border: 1px solid #ced4da; border-radius: 4px; }
#help-panel-search-results { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #ced4da; border-top: none; list-style: none; padding: 0.5rem 0; margin: 0; max-height: 300px; overflow-y: auto; z-index: 10; box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
#help-panel-search-results li a { padding: 0.5rem; }

/* === UPSELL WIDGET STYLES === */
.upsell-widget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}
.upsell-widget-card {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}
.upsell-widget-icon { flex-shrink: 0; color: var(--primary-color); }
.upsell-widget-icon svg { width: 48px; height: 48px; }
.upsell-widget-content h4 { margin-top: 0; margin-bottom: 0.5rem; }
.upsell-widget-content p { font-size: 0.9em; color: #6c757d; margin-top: 0; margin-bottom: 1rem; }

/* === SUBSCRIPTION MODULE LAYOUT === */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}
.module-card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}
.module-header { margin-bottom: 1.5rem; border-bottom: 1px solid #eee; padding-bottom: 1rem; }
.module-header h3 { margin: 0 0 0.5rem 0; color: var(--primary-color); display: flex; align-items: center; gap: 0.5rem; }
.module-description { color: #6c757d; font-size: 0.95rem; line-height: 1.5; min-height: 3rem; }
.plan-options-container { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: auto; }
.plan-option {
    background-color: #f8f9fa;
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: center;
    transition: all 0.2s ease;
    position: relative;
}
.plan-option:hover { border-color: #b8d4ff; background-color: #ffffff; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.plan-frequency { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; color: #6c757d; font-weight: bold; margin-bottom: 0.5rem; display: block; }
.plan-price { font-size: 1.8rem; font-weight: 700; color: #333; margin-bottom: 1rem; }
.plan-savings {
    position: absolute; top: -10px; right: -10px;
    background-color: #28a745; color: white; font-size: 0.7rem;
    padding: 2px 6px; border-radius: 4px; font-weight: bold;
}

/* === NESTED SIDEBAR STYLES === */

/* Level 2 (Main Module) Toggle - Additional specificity */
.sidebar-nav .menu-toggle {
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Level 2 Container */
.sidebar-nav .submenu {
    background-color: #22313f; /* Darker than main sidebar */
}

/* Level 3 (Sub-Category) Toggle */
.sub-menu-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.5rem 0.8rem 2.5rem; /* Indented */
    color: #bdc3c7;
    text-decoration: none;
    font-size: 0.95em;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 500;
}

.sub-menu-toggle:hover {
    background-color: #34495e;
    color: #fff;
}

/* Level 3 (Sub-Category) Arrow */
.sub-menu-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
    opacity: 0.7;
}

.sub-menu-toggle.open .sub-menu-arrow {
    transform: rotate(180deg);
}

/* Level 3 Container */
.sub-submenu {
    display: none; /* Hidden by default */
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: #1a252f; /* Even darker */
    box-shadow: inset 0 4px 6px -4px rgba(0,0,0,0.3);
}

/* Level 3 Links (The actual pages) */
.sub-submenu a {
    padding-left: 4rem !important; /* Deep indentation */
    font-size: 0.9em;
    color: #ecf0f1;
    opacity: 0.85;
    border-left: 3px solid transparent;
}

.sub-submenu a:hover {
    opacity: 1;
    background-color: rgba(255,255,255,0.05);
}

.sub-submenu a.active {
    border-left-color: var(--primary-color);
    background-color: rgba(74, 105, 189, 0.2); /* Tint of primary color */
    color: #fff;
    opacity: 1;
}

/* --- MOBILE SCANNER OPTIMIZATION (Zebra/Honeywell) --- */
@media (max-width: 768px) {
    /* Hide sidebar by default or make it a hamburger (handled by js), 
       but ensure main content uses full width */
    .dashboard-grid {
        grid-template-columns: 1fr; /* Remove sidebar column */
        grid-template-areas: 
            "header"
            "main";
    }

    .dashboard-sidebar {
        display: none; /* Use the toggle button to show it */
    }
    
    /* If the sidebar toggle is active (handled in js), this overrides */
    .dashboard-sidebar.active {
        display: block;
        position: absolute;
        z-index: 1000;
        width: 100%;
        height: calc(100vh - 60px);
        top: 60px;
    }

    /* Terminal Specifics */
    .putaway-directive, .picking-directive {
        font-size: 0.9rem;
    }
    
    .directive-value {
        font-size: 1.5rem; /* Larger text for location reading */
    }

    /* Bigger Inputs for touch/scan */
    input[type="text"], input[type="number"], select {
        font-size: 16px; /* Prevents iOS zoom */
        padding: 12px;
        height: 50px;
    }
    
    /* Bigger Buttons */
    .btn-primary, .btn-secondary, .btn-full-width {
        padding: 15px;
        font-size: 1.1rem;
        min-height: 50px;
    }
    
    .page-content {
        padding: 1rem; /* Less padding to save space */
    }
    
    /* Hide breadcrumbs on mobile to save vertical space */
    .breadcrumbs {
        display: none !important;
    }
}

/* === NESTED SIDEBAR FIXES (Level 4) === */

/* Increase indentation for Level 4 links so they look nested */
.sub-submenu .sub-submenu a {
    padding-left: 5.5rem !important; /* Deeper indentation than Level 3 */
    font-size: 0.85em; /* Slightly smaller font */
    background-color: #151e26; /* Even darker background for contrast */
}

.sub-submenu .sub-submenu a:hover {
    background-color: rgba(255,255,255,0.05);
}

.sub-submenu .sub-submenu a.active {
    background-color: rgba(74, 105, 189, 0.25);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Button Spinner (Small) */
.btn-spinner {
    display: inline-block;
    width: 1.2rem;
    height: 1.2rem;
    vertical-align: text-bottom;
    border: 0.2em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    -webkit-animation: btn-spin 0.75s linear infinite;
    animation: btn-spin 0.75s linear infinite;
    margin-right: 0.5rem;
}

@keyframes btn-spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Ensure the button content aligns correctly when spinner is present */
.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px; /* Prevent resizing when content changes */
}