/* Amazon Dashboard & Auth Styles (Matching MyShipment Theme) */
:root {
    --bg-main: #F3F4F6;
    --bg-surface: #FFFFFF;
    --sidebar-bg: #111827;
    --sidebar-text: #9CA3AF;
    --sidebar-text-active: #FFFFFF;
    --sidebar-active-bg: #1F2937;
    --sidebar-width: 216px;
    --sidebar-width-min: 192px;
    --sidebar-width-max: 240px;
    --sidebar-border: rgba(255, 255, 255, 0.1);
    --shell-header-height: 56px;

    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --primary-light: #EEF2FF;
    --primary-glow: rgba(79, 70, 229, 0.15);
    --text-dark: #111827;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --border-light: #F3F4F6;
    
    --amazon-orange: #FF9900;
    --amazon-dark: #232F3E;
    
    --status-green: #D1FAE5;
    --status-green-text: #065F46;
    --status-yellow: #FEF3C7;
    --status-yellow-text: #92400E;
    --status-red: #FEE2E2;
    --status-red-text: #B91C1C;
    --status-blue: #DBEAFE;
    --status-blue-text: #1E3A8A;
    
    --radius-lg: 10px;
    --radius-md: 6px;
    --radius-sm: 4px;
    --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);
    
    --transition-fast: all 0.15s ease-in-out;
}

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

html {
    font-size: 15px;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--bg-main);
    color: var(--text-dark);
    overflow: hidden;
}

/* Application Layout with Sidebar */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width-min);
    max-width: var(--sidebar-width-max);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    height: 100vh;
    z-index: 100;
}

.sidebar .logo {
    height: var(--shell-header-height);
    min-height: var(--shell-header-height);
    padding: 0 1rem;
    display: flex;
    align-items: center;
    color: #FFFFFF;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
}

.sidebar .logo h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: -0.01em;
}

.nav-menu {
    padding: 0.625rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    padding: 0.5rem 0.625rem;
    color: var(--sidebar-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-weight: 500;
    font-size: 0.8125rem;
    line-height: 1.2;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color 0.15s, color 0.15s;
    box-sizing: border-box;
}

.nav-item i {
    width: 16px;
    text-align: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.nav-item:hover {
    color: var(--sidebar-text-active);
    background-color: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
    color: var(--sidebar-text-active);
    background-color: var(--sidebar-active-bg);
    box-shadow: inset 2px 0 0 #044cb8;
    font-weight: 600;
}

.nav-item.disabled {
    opacity: 0.45;
    cursor: not-allowed !important;
    pointer-events: none;
    user-select: none;
}

.nav-item.disabled:hover {
    color: var(--sidebar-text) !important;
    background-color: transparent !important;
}

@media (max-width: 1280px) {
    .sidebar { width: var(--sidebar-width-min); }
}

/* Main Content Wrapper */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    overflow: hidden;
}

/* Top Shell Header */
.top-header {
    height: var(--shell-header-height);
    min-height: var(--shell-header-height);
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-title-block h1 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
}

.header-title-block p {
    font-size: 11px;
    color: var(--text-muted);
}

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

.user-badge {
    font-size: 12px;
    font-weight: 600;
    background: #F3F4F6;
    padding: 5px 10px;
    border-radius: 20px;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
}

/* Scrollable Main Area */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

/* Toolbar & Filters */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
}

.toolbar-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.toolbar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.toolbar-row-main {
    justify-content: space-between;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-row-filters {
    justify-content: flex-start;
    flex-wrap: wrap;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.input-styled, .select-styled {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 10px;
    height: 32px;
    font-size: 12px;
    color: var(--text-dark);
    outline: none;
    transition: var(--transition-fast);
    box-sizing: border-box;
}

.input-styled:focus, .select-styled:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

.date-order-by-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 8px;
    height: 32px;
    box-sizing: border-box;
}

.date-order-by-wrap .order-by-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
}

.date-order-by-wrap select.select-styled {
    border: 1px solid transparent;
    background: transparent;
    height: 26px;
    padding: 0 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
}

.date-order-by-wrap select.select-styled:hover {
    border-color: var(--border);
    background: #F9FAFB;
}

.date-order-by-wrap select.select-styled:focus {
    border-color: var(--primary);
    box-shadow: none;
}

.search-box-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 420px;
    max-width: 100%;
}

.search-box {
    position: relative;
    flex: 1;
}

.search-box i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
    pointer-events: none;
}

.search-box input {
    padding-left: 30px;
    width: 100%;
    height: 32px;
}

#search-btn {
    background-color: var(--primary);
    color: #FFFFFF;
    border: none;
    padding: 0 14px;
    font-weight: 600;
    font-size: 12px;
    border-radius: var(--radius-sm);
    height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition-fast);
    box-sizing: border-box;
}

#search-btn:hover {
    background-color: var(--primary-hover);
}

/* Top Pagination Control Pill */
.pagination-top-wrap {
    display: inline-flex;
    align-items: center;
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1px;
    height: 32px;
    box-sizing: border-box;
}

.btn-page-nav {
    background: transparent;
    border: none;
    padding: 0 12px;
    height: 100%;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-page-nav:hover:not(:disabled) {
    background: #F3F4F6;
    color: var(--primary);
}

.btn-page-nav:disabled {
    color: #D1D5DB;
    cursor: not-allowed;
}

.page-indicator {
    padding: 0 10px;
    height: 100%;
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dark);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    white-space: nowrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition-fast);
    box-sizing: border-box;
    height: 32px;
}

.btn-primary {
    background-color: var(--primary);
    color: #FFFFFF;
}

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

.btn-secondary {
    background-color: #FFFFFF;
    color: var(--text-dark);
    border-color: var(--border);
}

.btn-secondary:hover {
    background-color: #F9FAFB;
    border-color: #D1D5DB;
}

.btn-amazon {
    background-color: var(--amazon-orange);
    color: var(--amazon-dark);
    font-weight: 700;
}

.btn-amazon:hover {
    background-color: #E68A00;
}

.btn-sm {
    height: 32px;
    padding: 0 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

/* Clear / Cancel Filter Button States */
.btn-clear-filter:disabled,
.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-clear-filter:not(:disabled) {
    color: #DC2626;
    border-color: #FECACA;
    background-color: #FEF2F2;
    cursor: pointer;
    font-weight: 600;
}

.btn-clear-filter:not(:disabled):hover {
    background-color: #FEE2E2;
    border-color: #FCA5A5;
    color: #B91C1C;
}

/* Reduced Spacing Crisp Professional Table Format */
.table-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 245px);
    position: relative;
    background: var(--bg-surface);
    scrollbar-gutter: stable;
}

.table-wrapper::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
.table-wrapper::-webkit-scrollbar-track {
    background: #F3F4F6;
}
.table-wrapper::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}
.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

table.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    text-align: left;
    table-layout: auto;
}

table.data-table thead {
    position: sticky;
    top: 0;
    z-index: 20;
}

table.data-table th {
    background-color: #F9FAFB;
    color: var(--text-muted);
    font-weight: 600;
    padding: 8px 12px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 20;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.5px;
    background-clip: padding-box;
    box-shadow: inset 0 -2px 0 var(--border);
}

table.data-table th .th-sub-title {
    display: block;
    font-size: 9px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-muted);
    max-width: 135px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

table.data-table th.th-sortable:hover .th-sub-title {
    color: var(--primary);
}

.th-header-top {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

/* Document Type Badge in Milestone Column Header */
.th-badge-doc {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 8.5px;
    font-weight: 800;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 3px;
    background: #EFF6FF;
    color: #1D4ED8;
    border: 1px solid #BFDBFE;
    letter-spacing: 0.3px;
    vertical-align: middle;
}

/* Automated Badge in Milestone Column Header */
.th-badge-auto {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 8.5px;
    font-weight: 800;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 3px;
    background: #DCFCE7;
    color: #15803D;
    border: 1px solid #86EFAC;
    letter-spacing: 0.5px;
    vertical-align: middle;
    cursor: help;
}

.th-badge-auto:hover {
    background: #BBF7D0;
    color: #14532D;
}

/* Sortable Table Headers */
table.data-table th.th-sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

table.data-table th.th-sortable:hover {
    background-color: #F1F5F9;
    color: var(--primary);
}

table.data-table th.th-sortable.sort-active {
    color: var(--primary);
    background-color: #EEF2FF;
    border-bottom-color: var(--primary);
    box-shadow: inset 0 -2px 0 var(--primary);
}

table.data-table th .th-sort-inner {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

table.data-table th .sort-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    opacity: 0.35;
    transition: opacity 0.15s ease, color 0.15s ease;
}

table.data-table th.th-sortable:hover .sort-icon {
    opacity: 0.75;
}

table.data-table th.th-sortable.sort-active .sort-icon {
    opacity: 1;
    color: var(--primary);
}

table.data-table td {
    padding: 7px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-dark);
    vertical-align: middle;
    white-space: nowrap;
    background-color: #FFFFFF;
}

table.data-table tr:hover td {
    background-color: #F8FAFC;
}

/* Fixed & Max Breadth Column Controls */
table.data-table th.col-amazon-id,
table.data-table td.col-amazon-id {
    width: 200px !important;
    max-width: 220px !important;
    white-space: nowrap;
}

table.data-table th.col-note-preview,
table.data-table td.col-note-preview {
    width: 400px !important;
    max-width: 450px !important;
    white-space: nowrap;
}

/* Right-aligned Action Column */
table.data-table th.col-action,
table.data-table td.col-action {
    width: 90px !important;
    max-width: 100px !important;
    text-align: right;
    white-space: nowrap;
}

.cell-route {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 12px;
}

.cell-note-preview {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #4B5563;
    background: #F9FAFB;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    box-sizing: border-box;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
}

.badge-green, .badge-success { background: var(--status-green); color: var(--status-green-text); border: 1px solid #A7F3D0; }
.badge-red { background: var(--status-red); color: var(--status-red-text); border: 1px solid #FCA5A5; }
.badge-yellow, .badge-warning { background: var(--status-yellow); color: var(--status-yellow-text); border: 1px solid #FDE68A; }
.badge-gray { background: #F3F4F6; color: var(--text-muted); border: 1px solid var(--border); }
.badge-mode { background: #EEF2FF; color: #4338CA; border: 1px solid #C7D2FE; }
.badge-fba { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }

/* Milestone Inspection Grid Styles */
.milestones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 12px;
}

.milestone-item-card {
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
}

.milestone-item-card:hover {
    border-color: var(--primary);
}

.milestone-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.milestone-code-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
}

.milestone-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
}

.milestone-dates-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: #F9FAFB;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 11px;
}

.date-label {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.date-val {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    margin-top: 2px;
}

/* Detail Pop-up / Modal Card UI */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(17, 24, 39, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-fast);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.detail-modal {
    background: var(--bg-surface);
    border-radius: 18px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 90%;
    max-width: 860px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    overflow: hidden;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    background: var(--bg-surface);
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition-fast);
}

.modal-close-btn:hover {
    color: var(--text-dark);
    background: var(--bg-main);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-card {
    background: #F9FAFB;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
}

.section-card-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 10px;
}

.field-pair {
    display: flex;
    flex-direction: column;
}

.field-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.field-value {
    font-size: 12px;
    color: var(--text-dark);
    font-weight: 600;
    margin-top: 2px;
    word-break: break-all;
}

.note-box {
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-dark);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---------- View Sections ---------- */
.view-section {
    display: none;
}
.view-section.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---------- Loading / Status ---------- */
.status-box {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 1.5rem;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--sidebar-bg);
    color: #FFFFFF;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    z-index: 10001;
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition-fast);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* ---------- Postcode Rate Engine ---------- */
.rate-engine-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
}

.rate-engine-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-top: 0.75rem;
}

@media (max-width: 1200px) {
    .rate-engine-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.form-label-styled {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    display: block;
}

.dropzone-box {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-fast);
    background: rgba(243, 244, 246, 0.5);
}

.dropzone-box:hover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.metric-tile {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow-sm);
}

.metric-tile-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-tile-val {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-top: 2px;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), #10B981);
    transition: width 0.15s ease;
}

/* Home palette - the light front door, distinct from the app shell. */
:root {
    --home-bg: #F7F8FB;
    --home-ink: #0F172A;
    --home-muted: #64748B;
    --home-line: #E8EBF1;
    --home-accent: #2563EB;
    --home-accent-hover: #1D4ED8;
    --home-accent-soft: #EFF4FF;
    /* One measure for the header and the two columns, so the logo, the
       headline and the tiles all start on the same line, and a 24" monitor
       does not fling the intro and the sign-in card to opposite edges. */
    --home-measure: 1240px;
}

/* ============================================================
   HOME
   The front door, shown by the shared gate while there is no
   session. Two columns: what the workspace covers on the left,
   the sign-in form itself on the right - the gate wires that
   form in place rather than opening a card over this screen.
   Revealed by clearing [hidden], so it costs nothing once the
   user is signed in.
   ============================================================ */
/* The [hidden] attribute alone cannot hide this: the UA rule it relies on,
   [hidden] { display: none }, loses to any author rule that sets display -
   and .app-home sets display: flex. Without this the landing page stays
   painted over the dashboard after a successful sign-in. */
.app-home[hidden] { display: none; }

.app-home {
    position: fixed;
    inset: 0;
    /* Above the app shell; below anything signin.js still injects (9999). */
    z-index: 9000;
    display: flex;
    flex-direction: column;
    background: var(--home-bg);
    color: var(--home-ink);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow: auto;
}

.app-home-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: none;
    width: 100%;
    max-width: var(--home-measure);
    margin: 0 auto;
    padding: 1.6rem 2rem 0;
    box-sizing: border-box;
}

.app-home-logo {
    display: block;
    height: 30px;
    width: auto;
}

.app-home-body {
    flex: 1;
    display: grid;
    /* The intro takes the slack and the sign-in card keeps its own width, but
       the pair is capped and centred so the gap between them never grows into
       the dead space that made everything look small and far apart. */
    grid-template-columns: minmax(0, 1fr) 400px;
    align-items: center;
    gap: 3.5rem;
    width: 100%;
    max-width: var(--home-measure);
    margin: 0 auto;
    padding: 1.5rem 2rem 3.5rem;
    box-sizing: border-box;
}

/* ---------- left: what this workspace covers ---------- */

.app-home-eyebrow {
    display: inline-block;
    margin-bottom: 1.1rem;
    padding: 0.36rem 0.9rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--home-accent);
    background: var(--home-accent-soft);
    border-radius: 999px;
}

.app-home-intro h1 {
    margin: 0 0 0.9rem;
    font-family: Georgia, 'Times New Roman', 'Iowan Old Style', serif;
    font-size: clamp(2.5rem, 3.4vw, 3.3rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.025em;
    color: var(--home-ink);
}

.app-home-lede {
    margin: 0 0 2.4rem;
    /* Wide enough to sit under the headline in two lines, so it reads as one
       block with the tiles below rather than a narrow stripe. */
    max-width: 56ch;
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--home-muted);
}

/* Four tiles, one per module in the sidebar. Two columns keeps the block
   short enough to sit level with the sign-in card. */
.app-home-features {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.app-home-feature {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 1.15rem 1.25rem;
    background: #fff;
    border: 1px solid var(--home-line);
    border-radius: 13px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.app-home-feature:hover {
    border-color: #D6DEEC;
    box-shadow: 0 10px 24px -18px rgba(15, 23, 42, 0.45);
}

.app-home-feature-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: none;
    color: var(--home-accent);
    background: var(--home-accent-soft);
    border-radius: 10px;
}

.app-home-feature-icon svg { width: 18px; height: 18px; }

.app-home-feature h3 {
    margin: 0 0 0.25rem;
    font-size: 0.94rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--home-ink);
}

.app-home-feature p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--home-muted);
}

/* ---------- right: the sign-in form ---------- */

.app-auth { justify-self: end; width: 100%; }

.app-auth-card {
    padding: 2.1rem 2rem 1.7rem;
    background: #fff;
    border: 1px solid var(--home-line);
    border-radius: 16px;
    box-shadow: 0 22px 48px -26px rgba(15, 23, 42, 0.35);
}

.app-auth-head { margin-bottom: 1.6rem; }

.app-auth-head h2 {
    margin: 0 0 0.4rem;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--home-ink);
}

.app-auth-head p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--home-muted);
}

/* signin.js reveals this by adding .show and writing the message in. */
.app-auth-error {
    display: none;
    margin: 0 0 1rem;
    padding: 0.7rem 0.85rem;
    font-size: 0.83rem;
    line-height: 1.45;
    color: #B91C1C;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: 9px;
}

.app-auth-error.show { display: block; }

.app-auth-field { margin-bottom: 1.1rem; }

.app-auth-field label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--home-ink);
}

.app-auth-input { position: relative; }

.app-auth-input-icon {
    position: absolute;
    top: 50%;
    left: 13px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    color: #94A3B8;
    pointer-events: none;
    transition: color 0.15s ease;
}

.app-auth-input-icon svg { width: 17px; height: 17px; }

.app-auth-input input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.82rem 2.7rem 0.82rem 2.55rem;
    font: inherit;
    font-size: 0.94rem;
    color: var(--home-ink);
    background: #fff;
    border: 1px solid #E2E6EE;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.app-auth-input input::placeholder { color: #9CA3AF; }

.app-auth-input input:focus {
    border-color: var(--home-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.app-auth-input:focus-within .app-auth-input-icon { color: var(--home-accent); }

.app-auth-eye {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    color: #64748B;
    background: transparent;
    border: 0;
    border-radius: 7px;
    cursor: pointer;
}

.app-auth-eye:hover { color: var(--home-ink); background: #F1F5F9; }
.app-auth-eye svg { width: 17px; height: 17px; }

.app-auth-submit {
    width: 100%;
    margin-top: 0.6rem;
    padding: 0.85rem 1rem;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background: var(--home-accent);
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.app-auth-submit:hover { background: var(--home-accent-hover); }
.app-auth-submit:active { transform: translateY(1px); }
.app-auth-submit[disabled] { opacity: 0.65; cursor: default; transform: none; }

.app-auth-foot {
    margin: 1.5rem 0 0;
    padding-top: 1.15rem;
    font-size: 0.8rem;
    line-height: 1.5;
    text-align: center;
    color: var(--home-muted);
    border-top: 1px solid var(--home-line);
}

/* Narrower than the measure: the columns tighten before they stack, and the
   tiles go single file so their text stops wrapping to three lines. */
@media (max-width: 1140px) {
    .app-home-body { gap: 2.5rem; grid-template-columns: minmax(0, 1fr) 370px; }
    .app-home-features { grid-template-columns: minmax(0, 1fr); }
    .app-home-lede { margin-bottom: 1.9rem; }
}

@media (max-width: 900px) {
    .app-home-body {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0.5rem 1.5rem 3rem;
        align-content: start;
    }
    /* Signing in comes first on a narrow screen; the tour reads underneath. */
    .app-auth { order: -1; justify-self: stretch; }
    .app-home-features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .app-home-top { padding: 1.25rem 1.5rem 0; }
    .app-home-intro h1 { font-size: clamp(2.1rem, 6vw, 2.6rem); }
}

@media (max-width: 560px) {
    .app-home-features { grid-template-columns: minmax(0, 1fr); }
    .app-auth-card { padding: 1.7rem 1.4rem 1.4rem; }
}

/* =========================================================
   PORT ARRIVALS WATCH & ACTION-ITEMS DASHBOARD STYLES
   ========================================================= */

/* Sidebar Mini Badge */
.badge-mini-count {
    background: #EF4444;
    color: #FFFFFF;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 9999px;
    margin-left: auto;
    box-shadow: 0 1px 2px rgba(239, 68, 68, 0.4);
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* KPI Summary Metric Grid */

/* Specific KPI Card Themes */

/* View Toggle Switcher */

/* Action Cards Grid */

/* Single Action Card */

/* Card Urgency Borders */

/* Card Header */

.port-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 3px 7px;
    border-radius: 4px;
}

.badge-urgency-critical {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.badge-urgency-priority {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
}

.badge-urgency-upcoming {
    background: #DBEAFE;
    color: #1E40AF;
    border: 1px solid #BFDBFE;
}

.badge-urgency-enroute {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.badge-urgency-overdue {
    background: #FEE2E2;
    color: #7F1D1D;
    border: 1px dashed #DC2626;
}

.countdown-tag {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dark);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-main);
    padding: 3px 8px;
    border-radius: 4px;
}

.countdown-tag.countdown-urgent {
    background: #FEF2F2;
    color: #B91C1C;
    font-weight: 700;
}

/* Action Directive Banner */
.port-action-banner {
    border-radius: var(--radius-md);
    padding: 0.625rem 0.75rem;
    display: flex;
    gap: 0.625rem;
    align-items: flex-start;
    border: 1px solid transparent;
}

.port-action-banner.action-urgency-critical {
    background: rgba(239, 68, 68, 0.07);
    border-color: rgba(239, 68, 68, 0.25);
}
.port-action-banner.action-urgency-critical .action-banner-icon {
    color: #DC2626;
}
.port-action-banner.action-urgency-critical .action-banner-category {
    color: #B91C1C;
}

.port-action-banner.action-urgency-priority {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.25);
}
.port-action-banner.action-urgency-priority .action-banner-icon {
    color: #D97706;
}
.port-action-banner.action-urgency-priority .action-banner-category {
    color: #B45309;
}

.port-action-banner.action-urgency-upcoming,
.port-action-banner.action-urgency-enroute,
.port-action-banner.action-urgency-en_route {
    background: rgba(79, 70, 229, 0.05);
    border-color: rgba(79, 70, 229, 0.15);
}
.port-action-banner.action-urgency-upcoming .action-banner-icon,
.port-action-banner.action-urgency-enroute .action-banner-icon {
    color: #4F46E5;
}
.port-action-banner.action-urgency-upcoming .action-banner-category,
.port-action-banner.action-urgency-enroute .action-banner-category {
    color: #4338CA;
}

.port-action-banner.action-urgency-overdue {
    background: #FFF1F2;
    border-color: #FECDD3;
}
.port-action-banner.action-urgency-overdue .action-banner-icon {
    color: #BE123C;
}
.port-action-banner.action-urgency-overdue .action-banner-category {
    color: #9F1239;
}

.action-banner-icon {
    font-size: 1rem;
    margin-top: 1px;
    flex-shrink: 0;
}

.action-banner-text {
    flex: 1;
    min-width: 0;
}

.action-banner-category {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: block;
    margin-bottom: 2px;
}

.action-banner-instruction {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.35;
    margin: 0;
}

/* Stepper Bar */

/* Card Specs Grid */

/* Card Footer */

/* Modal Wide Custom */
.detail-modal.port-modal-wide {
    max-width: 780px;
    width: 90vw;
}

.modal-detail-cell {
    background: #F8FAFC;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
}

.modal-detail-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.modal-detail-val {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dark);
    margin-top: 2px;
}

.milestone-status-box {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.625rem;
    background: #FFFFFF;
}

.milestone-status-box.status-box-done {
    border-color: #A7F3D0;
    background: #F0FDF4;
}
.milestone-status-box.status-box-done .ms-box-title {
    color: #065F46;
}

.milestone-status-box.status-box-active {
    border-color: #FECACA;
    background: #FEF2F2;
}
.milestone-status-box.status-box-active .ms-box-title {
    color: #B91C1C;
}

.milestone-status-box.status-box-pending {
    border-color: #FDE68A;
    background: #FFFBEB;
}
.milestone-status-box.status-box-pending .ms-box-title {
    color: #92400E;
}

.ms-box-title {
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ms-box-date {
    font-size: 10px;
    color: var(--text-muted);
}

/* ==========================================================================
   3-TIER VESSEL & CONTAINER OPERATIONAL HIERARCHY STYLES
   ========================================================================== */

.port-vessel-wrapper {
    margin-top: 1rem;
}

.port-vessel-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Tier 1: Vessel Group Card */
.vessel-group-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border-left: 5px solid #10B981;
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.vessel-group-card:hover {
    box-shadow: var(--shadow-md);
}

.vessel-group-card.vessel-expanded {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #CBD5E1;
}

/* Urgency Card Borders */
.vessel-group-card.vessel-urgency-critical {
    border-left-color: #EF4444;
}
.vessel-group-card.vessel-urgency-priority {
    border-left-color: #F59E0B;
}
.vessel-group-card.vessel-urgency-upcoming {
    border-left-color: #3B82F6;
}
.vessel-group-card.vessel-urgency-enroute,
.vessel-group-card.vessel-urgency-en_route {
    border-left-color: #10B981;
}
.vessel-group-card.vessel-urgency-overdue {
    border-left-color: #DC2626;
    background: linear-gradient(180deg, #FFF5F5 0%, #FFFFFF 12%);
}

/* Vessel Main Header */
.vessel-main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    cursor: pointer;
    user-select: none;
    background: #FFFFFF;
    transition: background 0.15s ease;
    gap: 1rem;
    flex-wrap: wrap;
}

.vessel-main-header:hover {
    background: #F8FAFC;
}

.vessel-header-left {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    flex-wrap: wrap;
    flex: 1;
    min-width: 320px;
}

.vessel-accordion-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.vessel-accordion-btn:hover {
    background: var(--bg-main);
    color: var(--primary);
    border-color: var(--primary);
}

.vessel-icon-badge {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #EEF2FF;
    color: #4F46E5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.vessel-title-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vessel-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.vessel-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
}

.voyage-tag {
    font-size: 11px;
    background: var(--bg-main);
    padding: 2px 7px;
    border-radius: 4px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    border: 1px solid var(--border);
}

.vessel-route-sub {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.vessel-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.vessel-header-stats {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.vessel-stat-pill {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--bg-main);
    color: var(--text-dark);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.vessel-stat-pill.fba-pill {
    background: #FEF3C7;
    color: #92400E;
    border-color: #FDE68A;
}

/* Vessel Action Banner */
.vessel-action-banner {
    margin: 0 1.25rem 0.75rem 1.25rem;
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid transparent;
}

.vessel-action-banner.action-urgency-critical {
    background: rgba(239, 68, 68, 0.07);
    border-color: rgba(239, 68, 68, 0.25);
}
.vessel-action-banner.action-urgency-critical .action-banner-icon { color: #DC2626; }
.vessel-action-banner.action-urgency-critical .action-banner-category { color: #B91C1C; }

.vessel-action-banner.action-urgency-priority {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.25);
}
.vessel-action-banner.action-urgency-priority .action-banner-icon { color: #D97706; }
.vessel-action-banner.action-urgency-priority .action-banner-category { color: #B45309; }

.vessel-action-banner.action-urgency-upcoming,
.vessel-action-banner.action-urgency-enroute,
.vessel-action-banner.action-urgency-en_route {
    background: rgba(16, 185, 129, 0.07);
    border-color: rgba(16, 185, 129, 0.25);
}
.vessel-action-banner.action-urgency-upcoming .action-banner-icon,
.vessel-action-banner.action-urgency-enroute .action-banner-icon,
.vessel-action-banner.action-urgency-en_route .action-banner-icon { color: #059669; }
.vessel-action-banner.action-urgency-upcoming .action-banner-category,
.vessel-action-banner.action-urgency-enroute .action-banner-category,
.vessel-action-banner.action-urgency-en_route .action-banner-category { color: #047857; }

.vessel-action-banner.action-urgency-overdue {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.3);
}

/* Vessel Milestone Readiness Strip */
.vessel-milestone-readiness {
    margin: 0 1.25rem 1rem 1.25rem;
    padding: 0.75rem 1rem;
    background: #F8FAFC;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.readiness-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    margin-bottom: 4px;
}

.readiness-title {
    font-size: 12px;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 6px;
}

.readiness-progress-bar {
    width: 100%;
    height: 7px;
    background: #E2E8F0;
    border-radius: 4px;
    overflow: hidden;
}

.readiness-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.readiness-stage-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.stage-pill {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    background: #FFFFFF;
    border: 1px solid var(--border);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.stage-pill.pill-stage-done {
    background: #F0FDF4;
    border-color: #A7F3D0;
    color: #065F46;
}

.stage-pill.pill-stage-urgent {
    background: #FEF2F2;
    border-color: #FECACA;
    color: #DC2626;
    animation: pulse 1.8s infinite;
}

.stage-pill.pill-stage-progress {
    background: #FEF3C7;
    border-color: #FDE68A;
    color: #92400E;
}

.stage-pill.pill-stage-pending {
    background: #F8FAFC;
    color: var(--text-muted);
}

/* Tier 2: Containers List */
.vessel-collapsible-body {
    border-top: 1px solid var(--border);
    padding: 1.125rem 1.25rem;
    background: #F8FAFC;
}

.vessel-containers-list {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

/* Container Sub Card */
.container-sub-card {
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: border-color 0.15s ease;
}

.container-sub-card:hover {
    border-color: #CBD5E1;
}

.container-sub-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0.875rem;
    cursor: pointer;
    user-select: none;
    background: #FFFFFF;
    transition: background 0.15s ease;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.container-sub-header:hover {
    background: #F8FAFC;
}

.container-expanded .container-sub-header {
    border-bottom: 1px solid var(--border);
    background: #F8FAFC;
}

.container-header-left {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: wrap;
}

.container-accordion-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 10px;
    transition: all 0.15s ease;
}

.container-accordion-btn:hover {
    background: #FFFFFF;
    color: var(--primary);
}

.container-number-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    color: #1E293B;
    background: #F1F5F9;
    border: 1px solid #CBD5E1;
    padding: 2px 7px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.container-type-tag {
    font-size: 10px;
    font-weight: 700;
    background: #E0E7FF;
    color: #4338CA;
    padding: 2px 6px;
    border-radius: 3px;
}

.container-consol-tag,
.container-mbl-tag {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-main);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.container-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.container-stats-text {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.container-action-hint {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dark);
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Tier 3: Nested Shipments Table */
.container-sub-body {
    padding: 0;
    background: #FFFFFF;
}

.nested-shipments-table-wrapper {
    overflow-x: auto;
}

.nested-shipments-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    table-layout: auto;
}

.nested-shipments-table th {
    background: #F8FAFC;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.nested-shipments-table td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

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

.nested-shipments-table tr:hover td {
    background: #F8FAFC;
}

/* Mini Milestone Stepper Strip */
.mini-stepper-strip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.step-dot {
    width: 19px;
    height: 19px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    cursor: help;
    transition: transform 0.1s ease;
}

.step-dot:hover {
    transform: scale(1.15);
}

.step-dot.dot-done {
    background: #10B981;
    color: #FFFFFF;
}

.step-dot.dot-pending {
    background: #E2E8F0;
    color: #94A3B8;
}

.step-dot.dot-imminent {
    background: #EF4444;
    color: #FFFFFF;
    animation: pulse 1.5s infinite;
}

.step-connector {
    width: 8px;
    height: 2px;
    background: #E2E8F0;
}

.step-connector.conn-done {
    background: #10B981;
}

.table-shipper-cell {
    max-width: 170px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    color: var(--text-dark);
}

.shipment-action-cell {
    display: flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dark);
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fba-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: #D97706;
    background: #FFFBEB;
    padding: 2px 5px;
    border-radius: 3px;
    border: 1px solid #FDE68A;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Invoice Mismatch Highlighting & Reconciliation */
.row-mismatch {
    background-color: #FEF2F2 !important;
    transition: background-color 0.15s ease-in-out;
}

.row-mismatch:hover {
    background-color: #FEE2E2 !important;
}

.row-mismatch td:first-child {
    border-left: 3px solid #EF4444 !important;
}

.diff-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    margin-top: 3px;
    font-family: 'JetBrains Mono', monospace;
}

.diff-pill.diff-error {
    background: #FEE2E2;
    color: #B91C1C;
    border: 1px solid #FCA5A5;
}

.diff-pill.diff-sheet-only {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FCD34D;
}

/* ==========================================================================
   ARRIVED / DESTINATION DASHBOARD
   ========================================================================== */

.arrived-warning-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
    border-radius: 8px;
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    color: #92400E;
    font-size: 12px;
    font-weight: 600;
}

/* ---- KPI row ---- */

.arrived-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.arrived-kpi-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-left: 3px solid #94A3B8;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.arrived-kpi-card.kpi-clickable {
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.arrived-kpi-card.kpi-clickable:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

.arrived-kpi-card .kpi-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
    background: #F1F5F9;
    color: #475569;
}

.arrived-kpi-card .kpi-value {
    font-size: 21px;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text);
}

.arrived-kpi-card .kpi-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    margin-top: 2px;
}

.arrived-kpi-card .kpi-sub {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 1px;
}

.arrived-kpi-card.kpi-tone-danger { border-left-color: #EF4444; }
.arrived-kpi-card.kpi-tone-danger .kpi-icon { background: #FEE2E2; color: #DC2626; }
.arrived-kpi-card.kpi-tone-danger .kpi-value { color: #DC2626; }

.arrived-kpi-card.kpi-tone-warn { border-left-color: #F59E0B; }
.arrived-kpi-card.kpi-tone-warn .kpi-icon { background: #FEF3C7; color: #B45309; }

.arrived-kpi-card.kpi-tone-info { border-left-color: #6366F1; }
.arrived-kpi-card.kpi-tone-info .kpi-icon { background: #EEF2FF; color: #4F46E5; }

.arrived-kpi-card.kpi-tone-neutral { border-left-color: #10B981; }
.arrived-kpi-card.kpi-tone-neutral .kpi-icon { background: #D1FAE5; color: #059669; }

/* ---- Panels ---- */

.arrived-panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.arrived-panel {
    padding: 16px;
}

.arrived-panel-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.arrived-panel-title i {
    color: var(--primary);
    margin-right: 5px;
}

/* ---- Funnel ---- */

.funnel-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.funnel-row {
    display: grid;
    grid-template-columns: 110px 1fr 38px 34px;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}

.funnel-label {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.funnel-track {
    position: relative;
    height: 18px;
    background: #F1F5F9;
    border-radius: 4px;
    overflow: hidden;
}

.funnel-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366F1, #818CF8);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.funnel-count {
    position: absolute;
    top: 0;
    left: 6px;
    line-height: 18px;
    font-size: 10px;
    font-weight: 700;
    color: #1E293B;
}

.funnel-pct {
    text-align: right;
    font-weight: 700;
    color: var(--text-muted);
}

.funnel-drop {
    text-align: right;
    font-size: 10px;
    font-weight: 600;
    color: #EF4444;
}

/* ---- Status chips ---- */

.status-chip-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-chip-row {
    display: grid;
    grid-template-columns: 10px 1fr auto auto;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 12px;
    transition: background 0.12s ease;
}

.status-chip-row.kpi-clickable {
    cursor: pointer;
}

.status-chip-row.kpi-clickable:hover {
    background: #F8FAFC;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.status-chip-label {
    font-weight: 600;
    color: var(--text);
}

.status-chip-count {
    font-weight: 800;
    color: var(--text);
}

.status-chip-pct {
    font-size: 10px;
    color: var(--text-muted);
    min-width: 30px;
    text-align: right;
}

/* ---- Dwell chart ---- */

.dwell-chart {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    align-items: end;
    min-height: 130px;
}

.dwell-bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.dwell-bar-col.kpi-clickable {
    cursor: pointer;
}

.dwell-bar-wrap {
    width: 100%;
    height: 90px;
    display: flex;
    align-items: flex-end;
    background: #F8FAFC;
    border-radius: 4px;
    padding: 3px;
}

.dwell-bar {
    width: 100%;
    background: linear-gradient(180deg, #F59E0B, #FBBF24);
    border-radius: 3px;
    transition: height 0.3s ease;
}

.dwell-bar-col:last-child .dwell-bar {
    background: linear-gradient(180deg, #EF4444, #F87171);
}

.dwell-bar-count {
    font-size: 13px;
    font-weight: 800;
    color: var(--text);
}

.dwell-bar-label {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
}

/* ---- Port performance table ---- */

.table-scroll-wrap {
    overflow-x: auto;
}

.arrived-port-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.arrived-port-table thead th {
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    background: #F8FAFC;
    white-space: nowrap;
}

.arrived-port-table tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid #F1F5F9;
    color: var(--text);
    white-space: nowrap;
}

.arrived-port-table tbody tr:hover {
    background: #F8FAFC;
}

.cell-flag {
    display: inline-block;
    min-width: 22px;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.cell-flag-danger { background: #FEE2E2; color: #DC2626; }
.cell-flag-warn { background: #FEF3C7; color: #B45309; }

.mini-progress {
    display: inline-block;
    width: 52px;
    height: 5px;
    background: #E2E8F0;
    border-radius: 3px;
    overflow: hidden;
    vertical-align: middle;
    margin-right: 5px;
}

.mini-progress-fill {
    height: 100%;
    background: #10B981;
    border-radius: 3px;
}

/* ---- Delivery completion ---- */

.delivery-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.delivery-stat {
    padding: 10px 12px;
    background: #F8FAFC;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: center;
}

.delivery-stat-value {
    font-size: 19px;
    font-weight: 800;
    color: var(--text);
}

.delivery-stat-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    margin-top: 2px;
}

.delivery-progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.delivery-progress-bar {
    flex: 1;
    height: 8px;
    background: #E2E8F0;
    border-radius: 4px;
    overflow: hidden;
}

.delivery-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10B981, #34D399);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.delivery-progress-text {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.coverage-note {
    margin: 10px 0 0 0;
    padding: 8px 10px;
    background: #EEF2FF;
    border-left: 3px solid #6366F1;
    border-radius: 4px;
    font-size: 11px;
    color: #3730A3;
}

.coverage-note i {
    margin-right: 4px;
}

/* ---- Vessel call cards ---- */

.vessel-group-card.arrived-card-critical { border-left: 4px solid #EF4444; }
.vessel-group-card.arrived-card-warning { border-left: 4px solid #F59E0B; }
.vessel-group-card.arrived-card-active { border-left: 4px solid #6366F1; }
.vessel-group-card.arrived-card-done { border-left: 4px solid #10B981; }

.vessel-action-banner.arrived-banner-critical { background: #FEF2F2; border-color: #FECACA; }
.vessel-action-banner.arrived-banner-warning { background: #FFFBEB; border-color: #FDE68A; }
.vessel-action-banner.arrived-banner-active { background: #EEF2FF; border-color: #C7D2FE; }
.vessel-action-banner.arrived-banner-done { background: #ECFDF5; border-color: #A7F3D0; }

.port-badge.badge-arrived-port {
    background: #ECFDF5;
    color: #059669;
    border: 1px solid #A7F3D0;
}

.countdown-tag.countdown-done {
    background: #ECFDF5;
    color: #059669;
    border: 1px solid #A7F3D0;
}

.status-pill.pill-danger {
    background: #FEE2E2;
    color: #DC2626;
    border: 1px solid #FECACA;
}

/* ---- Dwell pills in shipment rows ---- */

.dwell-pill {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.dwell-pill.dwell-ok { background: #D1FAE5; color: #059669; }
.dwell-pill.dwell-warn { background: #FEF3C7; color: #B45309; }
.dwell-pill.dwell-critical { background: #FEE2E2; color: #DC2626; }

.arrived-status-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .funnel-row {
        grid-template-columns: 90px 1fr 34px 30px;
    }

    .arrived-kpi-row {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

/* ---- Port Arrivals sub-mode switch (In Transit / Arrived) ---- */

.port-mode-switch {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 14px;
    background: #F1F5F9;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.port-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.port-mode-btn:hover {
    color: var(--text);
}

.port-mode-btn.active {
    background: #FFFFFF;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

.port-mode-btn i {
    font-size: 12px;
}

.port-mode-count {
    display: inline-block;
    min-width: 18px;
    padding: 1px 6px;
    border-radius: 9px;
    background: #E2E8F0;
    color: #475569;
    font-size: 10px;
    font-weight: 800;
    text-align: center;
}

.port-mode-count:empty {
    display: none;
}

.port-mode-count.count-danger {
    background: #FEE2E2;
    color: #DC2626;
}

/* ---------- Change Password Modal Styles ---------- */
.modal-form-error {
    display: none;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.4;
    color: #B91C1C;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: 6px;
}

.modal-form-error.show {
    display: block;
}

.modal-form-success {
    display: none;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.4;
    color: #065F46;
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
    border-radius: 6px;
}

.modal-form-success.show {
    display: block;
}

.input-eye-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    border-radius: 4px;
    transition: var(--transition-fast);
}

.input-eye-btn:hover {
    color: var(--text-dark);
}

/* ---- FBA transit times: transit-leg columns are tinted apart from milestone dates ---- */

table.fbt-table th.fbt-leg,
table.fbt-table td.fbt-leg {
    background: #EEF2FF;
    text-align: center;
    white-space: nowrap;
}

table.fbt-table tbody tr:hover td.fbt-leg {
    background: #E0E7FF;
}
