/* ============================================
   CARGO COMPLIANCE MODAL — Shared Styles
   Used by: index.html, pages/positions.html
   ============================================ */

/* ── Modal Panel ── */
.compliance-modal-panel {
    width: min(1040px, 96vw);
    max-height: 90vh;
    overflow: auto;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.compliance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 2;
}

.compliance-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    margin: 0;
}

.compliance-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.compliance-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ── Summary Bar ── */
.compliance-summary {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 0.75rem;
}

.compliance-summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.compliance-summary-item .label {
    font-size: 0.6rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.compliance-summary-item .value {
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-primary);
}

.compliance-seals-value {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.compliance-seal-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    border: 1px solid rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    line-height: 1.3;
}

/* ── Modules ── */
.compliance-module {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.compliance-module-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.compliance-module-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.compliance-sub-module {
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.compliance-sub-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* ── Radio & Checkbox Groups ── */
.radio-group, .checkbox-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.radio-option, .checkbox-option {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-primary);
}

.radio-option input, .checkbox-option input {
    accent-color: var(--accent-orange);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.radio-label, .checkbox-label {
    font-weight: 500;
}

.nvwa-compliant { color: #22c55e; }
.nvwa-not-compliant { color: #ef4444; }

/* ── Form Fields ── */
.compliance-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

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

.compliance-field input[type="text"] {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    outline: none;
}

.compliance-field input[type="text"]:focus {
    border-color: var(--accent-blue);
}

.compliance-field .required {
    color: #ef4444;
}

.field-hint {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* ══════════════════════════════════════════
   MRN Badge Flow (Lifecycle)
   ══════════════════════════════════════════ */

.badge-chain {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.badge-chain-arrow {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.badge-chain-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
}

.badge-chain-item.done {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.badge-chain-item.active-step {
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.4);
    color: var(--accent-orange);
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0%, 100% { border-color: rgba(249, 115, 22, 0.4); }
    50% { border-color: rgba(249, 115, 22, 0.8); }
}

/* ── Current MRN Bar ── */
.current-mrn-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
}

.current-mrn-bar.resolved {
    border-color: rgba(34, 197, 94, 0.3);
}

.current-mrn-bar.history-item {
    opacity: 0.5;
}

.current-mrn-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.current-mrn-left .label-text {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.current-mrn-left .mono-text {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 0.8rem;
}

.current-mrn-left .date-text {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

/* ── MRN Labels & Separators ── */
.mrn-section-label {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    letter-spacing: 0.4px;
}

.mrn-separator {
    height: 1px;
    background: var(--border-color);
    margin: 0.75rem 0;
}

.mrn-storage-exit-rule {
    font-size: 0.7rem;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

/* ── MRN Inline Badges ── */
.mrn-badge-inline {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.mrn-badge-inline.t1 { background: #8b3fd6; color: #ffffff; }
.mrn-badge-inline.clearance { background: rgba(34,197,94,0.15); color: #22c55e; }
.mrn-badge-inline.f4c { background: rgba(6,182,212,0.15); color: #06b6d4; }
.mrn-badge-inline.reexport { background: rgba(249,115,22,0.15); color: #f97316; }
.mrn-badge-inline.storage { background: rgba(59,130,246,0.15); color: #3b82f6; }
.mrn-badge-inline.open { background: rgba(234,179,8,0.15); color: #eab308; }
.mrn-badge-inline.closed { background: rgba(100,116,139,0.15); color: #94a3b8; }

/* ── MRN Initial Radio Styling ── */
.mrn-initial-radio .radio-option {
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}

.mrn-initial-radio .radio-option:hover {
    border-color: var(--accent-orange);
}

.next-procedure-option {
    position: relative;
}

.next-procedure-option .procedure-tooltip {
    display: none;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    width: max-content;
    max-width: 260px;
    padding: 0.45rem 0.55rem;
    border-radius: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.68rem;
    line-height: 1.35;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
    z-index: 20;
    pointer-events: none;
    white-space: normal;
}

.next-procedure-option:hover .procedure-tooltip {
    display: block;
}

/* ── MRN Form Fields ── */
/* Next procedure table */
.next-procedure-table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    font-size: 0.72rem;
}

.next-procedure-table th,
.next-procedure-table td {
    padding: 0.48rem 0.55rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: middle;
}

.next-procedure-table th {
    color: var(--text-muted);
    background: rgba(148, 163, 184, 0.08);
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.next-procedure-table tbody tr:last-child td {
    border-bottom: 0;
}

.next-procedure-row {
    cursor: pointer;
    transition: background 0.15s, outline-color 0.15s;
}

.next-procedure-row:hover {
    background: rgba(249, 115, 22, 0.08);
}

.next-procedure-row.selected {
    background: rgba(249, 115, 22, 0.12);
    outline: 1px solid rgba(249, 115, 22, 0.45);
    outline-offset: -1px;
}

.next-procedure-check {
    width: 2.1rem;
    text-align: center;
}

.next-procedure-check input {
    width: 0.95rem;
    height: 0.95rem;
    accent-color: var(--accent-orange);
    cursor: pointer;
}

.procedure-code {
    display: inline-block;
    min-width: 3.3rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: rgba(249, 115, 22, 0.14);
    color: var(--accent-orange);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    font-weight: 700;
    text-align: center;
}

.procedure-life {
    color: var(--text-secondary);
    font-size: 0.68rem;
}

.mrn-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.mrn-form-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.mrn-form-field label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.4px;
}

.mrn-form-field input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    outline: none;
}

.mrn-form-field input:focus {
    border-color: var(--accent-blue);
}

/* ── v0.41 MRN rework: section save, re-export type toggle, dual dates ── */
.compliance-module-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.mrn-section-save {
    font-family: inherit;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    background: var(--accent-blue, #3b82f6);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
}
.mrn-section-save:hover { filter: brightness(1.1); }

.reexport-toggle-wrap { margin-top: 0.75rem; }
.reexport-toggle-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.4px;
    margin-bottom: 0.35rem;
}
.reexport-toggle {
    display: inline-flex;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.reexport-toggle-btn {
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.4rem 0.95rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: none;
    border-right: 1px solid var(--border-color);
    cursor: pointer;
}
.reexport-toggle-btn:last-child { border-right: none; }
.reexport-toggle-btn.active { background: var(--accent-blue, #3b82f6); color: #fff; }
.reexport-toggle-btn:hover:not(.active) { background: var(--bg-secondary); }

.valid-until-text {
    margin-left: 0.5rem;
    font-size: 0.68rem;
    color: var(--accent-yellow, #f59e0b);
    font-weight: 600;
}
.mrn-registered-input { opacity: 0.65; cursor: not-allowed; }
.mrn-resolved-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.mrn-continue-btn {
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.35rem 0.7rem;
    background: var(--accent-blue, #3b82f6);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.mrn-continue-btn:hover { filter: brightness(1.1); }
.mrn-form-row:has(.mrn-registered-input) { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 560px) {
    .mrn-form-row:has(.mrn-registered-input) { grid-template-columns: 1fr; }
}

/* ── MRN Reset & Edit Links ── */
.mrn-reset-link {
    font-size: 0.65rem;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: underline;
    margin-top: 0.5rem;
    display: inline-block;
}

.mrn-reset-link:hover {
    color: #ef4444;
}

.mrn-edit-link {
    font-size: 0.65rem;
    color: var(--accent-orange);
    cursor: pointer;
    font-weight: 600;
    margin-left: 0.5rem;
}

.mrn-edit-link:hover {
    text-decoration: underline;
}

/* ── MRN Timeline ── */
.mrn-timeline {
    display: flex;
    flex-direction: column;
    margin-top: 0.75rem;
}

.mrn-timeline-step {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
}

.mrn-timeline-connector {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 20px;
    flex-shrink: 0;
    padding-top: 1rem;
}

.mrn-timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mrn-timeline-dot.previous {
    background: #a855f7;
    box-shadow: 0 0 6px rgba(168, 85, 247, 0.4);
}

.mrn-timeline-dot.current {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.mrn-timeline-line {
    width: 2px;
    height: 16px;
    background: var(--border-color);
    margin-left: 9px;
    flex-shrink: 0;
}

/* ── NVWA Control ── */
.nvwa-declared { color: #3b82f6; font-weight: 600; }
.nvwa-selected { color: #f59e0b; font-weight: 600; }
.nvwa-released { color: #22c55e; font-weight: 600; }
.nvwa-blocked { color: #ef4444; font-weight: 600; }

/* ════════════════════════════════════════════════════════════════════
   LIGHT THEME — Harbor palette (matches dossiers / positions / stock /
   master-data). The dark rules above are correct for dark mode; this
   block re-skins the modal for light mode ONLY and never affects dark.

   Why this block is needed (and why most rules carry !important):
   themes.css ships three very broad light-theme rules that this modal
   was never adapted to —
     • [data-theme="light"] div  { background-color: inherit }
         → collapses every layered panel/module surface; the panel even
           inherits the dim modal overlay and goes semi-dark.
     • [data-theme="light"] span { color: inherit !important }
         → strips every coloured badge / code / chip / status label.
     • [data-theme="light"] button { background/color/border !important }
         → flattens the marine "Save MRN status" + re-export toggle.
   These overrides win by higher specificity (containers) and by
   matching the !important + higher specificity (spans / buttons), and
   swap the dark-theme orange accent for the Harbor marine blue (#0a5989)
   used as the primary accent on dossiers.html.
   ════════════════════════════════════════════════════════════════════ */

/* ── Surfaces — restore the layered panel the `div { bg: inherit }`
      rule collapses (without this the panel renders over the dim
      overlay and looks dark). ── */
[data-theme="light"] .compliance-modal-panel {
    background: #ffffff !important;
    border-color: #d6e2ea !important;
    box-shadow: 0 14px 38px rgba(23, 45, 64, 0.14);
}
[data-theme="light"] .compliance-header {
    background: #ffffff !important;
    border-bottom-color: #d6e2ea !important;
}
[data-theme="light"] .compliance-summary {
    background: #eef4f8 !important;
    border-color: #d6e2ea !important;
}
[data-theme="light"] .compliance-module {
    background: #f6f9fc !important;
    border-color: #d6e2ea !important;
}
[data-theme="light"] .compliance-module-title {
    background: #eef4f8 !important;
    border-bottom-color: #d6e2ea !important;
    color: #102033 !important;
}
[data-theme="light"] .compliance-sub-module {
    background: #ffffff !important;
    border-color: #d6e2ea !important;
}

/* ── Muted / secondary text that `div|span { color: inherit }` would
      flatten to full black, losing the visual hierarchy. ── */
[data-theme="light"] .compliance-meta,
[data-theme="light"] .compliance-summary-item .label,
[data-theme="light"] .mrn-section-label,
[data-theme="light"] .current-mrn-left .label-text,
[data-theme="light"] .current-mrn-left .date-text,
[data-theme="light"] .field-hint,
[data-theme="light"] .compliance-field label,
[data-theme="light"] .mrn-form-field label {
    color: #536579 !important;
}
[data-theme="light"] .compliance-sub-title { color: #33465a !important; }
[data-theme="light"] .compliance-summary-item .value,
[data-theme="light"] .current-mrn-left .mono-text { color: #102033 !important; }

/* ── Seal chip — softened Harbor amber instead of bright dark orange ── */
[data-theme="light"] .compliance-seal-chip {
    border-color: rgba(196, 122, 20, 0.32) !important;
    background: rgba(196, 122, 20, 0.10) !important;
    color: #9a5d10 !important;
}

/* ── Interactive accent → marine blue (radios, checkboxes) ── */
[data-theme="light"] .radio-option input,
[data-theme="light"] .checkbox-option input,
[data-theme="light"] .next-procedure-check input {
    accent-color: #0a5989;
}
/* Text inputs read var(--bg-tertiary)/var(--text-primary), which main.css
   pins to DARK at :root (it wins over the light theme by source order), so
   without these they render as dark fields on the white modal. */
[data-theme="light"] .compliance-field input[type="text"],
[data-theme="light"] .mrn-form-field input {
    background: #ffffff !important;
    color: #102033 !important;
    border-color: #b9cedb !important;
}
[data-theme="light"] .compliance-field input[type="text"]:focus,
[data-theme="light"] .mrn-form-field input:focus {
    border-color: #0a5989 !important;
    box-shadow: 0 0 0 3px rgba(10, 89, 137, 0.12) !important;
}
[data-theme="light"] .mrn-registered-input {
    background: #eef4f8 !important;
    color: #536579 !important;
}

/* ── Cargo-type / NVWA verdict colours, tuned for contrast on white ── */
[data-theme="light"] .nvwa-compliant { color: #2c8c62 !important; }
[data-theme="light"] .nvwa-not-compliant { color: #c2362c !important; }
[data-theme="light"] .compliance-field .required { color: #c2362c !important; }
[data-theme="light"] .nvwa-declared { color: #0a5989 !important; }
[data-theme="light"] .nvwa-selected { color: #a16207 !important; }
[data-theme="light"] .nvwa-released { color: #2c8c62 !important; }
[data-theme="light"] .nvwa-blocked  { color: #c2362c !important; }

/* ── MRN badge chain — done (green) / active (marine, not orange) ── */
[data-theme="light"] .badge-chain-arrow { color: #536579 !important; }
[data-theme="light"] .badge-chain-item.done {
    background: rgba(44, 140, 98, 0.12);
    border-color: rgba(44, 140, 98, 0.35);
    color: #2c8c62 !important;
}
[data-theme="light"] .badge-chain-item.active-step {
    background: rgba(10, 89, 137, 0.10);
    border-color: rgba(10, 89, 137, 0.45);
    color: #0a5989 !important;
    animation: pulse-border-light 2s infinite;
}
@keyframes pulse-border-light {
    0%, 100% { border-color: rgba(10, 89, 137, 0.45); }
    50%      { border-color: rgba(10, 89, 137, 0.85); }
}

/* ── Current-MRN bar + separators (the 1px dividers use the border
      colour as a *background*, which `div { bg: inherit }` erases) ── */
[data-theme="light"] .current-mrn-bar {
    background: #eef4f8 !important;
    border-color: #d6e2ea !important;
}
[data-theme="light"] .current-mrn-bar.resolved {
    border-color: rgba(44, 140, 98, 0.40) !important;
}
[data-theme="light"] .mrn-separator,
[data-theme="light"] .mrn-timeline-line { background: #d6e2ea !important; }

/* ── Storage-exit rule note — Harbor amber ── */
[data-theme="light"] .mrn-storage-exit-rule {
    color: #9a5d10 !important;
    background: rgba(196, 122, 20, 0.10);
    border-color: rgba(196, 122, 20, 0.30);
}

/* ── MRN inline badges — keep the semantic hue, darken for white bg ── */
[data-theme="light"] .mrn-badge-inline.t1        { background: rgba(117, 102, 177, 0.16); color: #5b4a96 !important; }
[data-theme="light"] .mrn-badge-inline.clearance { background: rgba(44, 140, 98, 0.16);   color: #2c8c62 !important; }
[data-theme="light"] .mrn-badge-inline.f4c       { background: rgba(15, 126, 162, 0.16);  color: #0f7ea2 !important; }
[data-theme="light"] .mrn-badge-inline.reexport  { background: rgba(194, 65, 12, 0.14);   color: #c2410c !important; }
[data-theme="light"] .mrn-badge-inline.storage   { background: rgba(10, 89, 137, 0.14);   color: #0a5989 !important; }
[data-theme="light"] .mrn-badge-inline.open      { background: rgba(161, 98, 7, 0.14);    color: #a16207 !important; }
[data-theme="light"] .mrn-badge-inline.closed    { background: rgba(83, 101, 121, 0.14);  color: #536579 !important; }

/* ── Next-procedure picker — marine selection instead of orange. The
      global `table td { background:#fff }` paints over a <tr> background,
      so hover/selected tints must be applied to the cells. ── */
/* The table element bg reads var(--bg-tertiary) (dark via main.css), which
   would show through the translucent hover/selected cell tints — pin it
   white so the marine selection reads light. */
[data-theme="light"] .next-procedure-table {
    background: #ffffff !important;
    border-color: #d6e2ea !important;
}
/* Opaque light-marine selection (translucent tints would composite over
   the dark-theme orange tr background + dark table surface and read muddy).
   Neutralise the orange tr fill first, then paint the cells solid. */
[data-theme="light"] .next-procedure-row:hover,
[data-theme="light"] .next-procedure-row.selected { background: transparent !important; }
[data-theme="light"] .next-procedure-row:hover td { background: #eaf1f7 !important; }
[data-theme="light"] .next-procedure-row.selected td { background: #dbe8f1 !important; }
[data-theme="light"] .next-procedure-row.selected { outline-color: rgba(10, 89, 137, 0.45); }
[data-theme="light"] .procedure-code {
    background: rgba(10, 89, 137, 0.12);
    color: #0a5989 !important;
}
[data-theme="light"] .procedure-life { color: #536579 !important; }
[data-theme="light"] .next-procedure-option .procedure-tooltip {
    background: #ffffff !important;
    color: #102033 !important;
    border-color: #d6e2ea !important;
    box-shadow: 0 8px 20px rgba(23, 45, 64, 0.18);
}
/* Initial-MRN radio chips read var(--bg-tertiary) (dark) for their fill. */
[data-theme="light"] .mrn-initial-radio .radio-option {
    background: #ffffff !important;
    border-color: #d6e2ea !important;
}
[data-theme="light"] .mrn-initial-radio .radio-option:hover { border-color: #0a5989 !important; }

/* ── Section "Save MRN status" button — beat global `button {…!important}` ── */
[data-theme="light"] .mrn-section-save {
    background: #0a5989 !important;
    color: #ffffff !important;
    border: 1px solid #0a5989 !important;
}
[data-theme="light"] .mrn-section-save:hover {
    background: #084a73 !important;
    border-color: #084a73 !important;
}

/* ── Re-export type toggle (segmented control) — keep the segmented look
      that the global full-border `button` rule would otherwise break ── */
[data-theme="light"] .reexport-toggle { border-color: #d6e2ea; }
[data-theme="light"] .reexport-toggle-btn {
    background: #ffffff !important;
    color: #33465a !important;
    border: none !important;
    border-right: 1px solid #d6e2ea !important;
}
[data-theme="light"] .reexport-toggle-btn:last-child { border-right: none !important; }
[data-theme="light"] .reexport-toggle-btn.active {
    background: #0a5989 !important;
    color: #ffffff !important;
}
[data-theme="light"] .reexport-toggle-btn:hover:not(.active) {
    background: #e6f3f8 !important;
    color: #0a5989 !important;
}

/* ── Inline links + valid-until note ── */
[data-theme="light"] .valid-until-text { color: #a16207 !important; }
[data-theme="light"] .mrn-edit-link    { color: #0a5989 !important; }
[data-theme="light"] .mrn-reset-link   { color: #536579 !important; }
[data-theme="light"] .mrn-reset-link:hover { color: #c2362c !important; }

/* ── MRN journey timeline dots — softened on white ── */
[data-theme="light"] .mrn-timeline-dot.previous {
    background: #7566b1;
    box-shadow: 0 0 6px rgba(117, 102, 177, 0.35);
}
[data-theme="light"] .mrn-timeline-dot.current {
    background: #2c8c62;
    box-shadow: 0 0 6px rgba(44, 140, 98, 0.35);
}

/* ── v0.42 Cargo Certificates (checkbox → status dropdown + reference) ── */
.cargo-cert-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
}
.cargo-cert-common { background: var(--bg-secondary); }
.cargo-cert-chk {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    min-width: 132px;
}
.cargo-cert-chk input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--accent-orange, #f97316); }
.cargo-cert-name { font-size: 0.75rem; font-weight: 700; color: var(--text-primary); letter-spacing: 0.3px; }
.cargo-cert-na {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.12rem 0.5rem;
}
.cargo-cert-opts { display: flex; align-items: center; gap: 0.5rem; flex: 1 1 auto; min-width: 0; }
.cargo-cert-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    outline: none;
}
.cargo-cert-ref {
    flex: 1 1 auto;
    min-width: 90px;
    font-size: 0.75rem;
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    outline: none;
}
.cargo-cert-status:focus, .cargo-cert-ref:focus { border-color: var(--accent-blue, #3b82f6); }
.cargo-cert-val {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.12rem 0.6rem;
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    margin-left: auto;
}
.cargo-cert-val.ok { background: rgba(34, 197, 94, 0.14); color: #4ade80; border-color: rgba(34, 197, 94, 0.4); }

/* ── v0.42 Compliance modal TABS (MRN ↔ Cargo Certificates) ── */
.compliance-tabs {
    display: flex;
    gap: 0.4rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.25rem;
}
.compliance-tab {
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.55rem 1.1rem;
    background: transparent;
    color: var(--text-muted);
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    margin-bottom: -1px;
}
.compliance-tab:hover { color: var(--text-primary); }
.compliance-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-orange, #f97316);
}
.compliance-tab-panel { display: flex; flex-direction: column; gap: 1.25rem; }

/* ── v0.42 Light theme — NAVY badges / N/A / certs / next-procedure (were black) ── */
[data-theme="light"] .cargo-cert-row { background: #ffffff !important; border-color: #d6e2ea !important; }
[data-theme="light"] .cargo-cert-common { background: #eef4f8 !important; }
[data-theme="light"] .cargo-cert-name { color: #1e3a8a !important; }
[data-theme="light"] .cargo-cert-na {
    color: #1e3a8a !important;
    background: #eef2fb !important;
    border-color: #c7d2f0 !important;
}
[data-theme="light"] .cargo-cert-status,
[data-theme="light"] .cargo-cert-ref {
    background: #ffffff !important;
    color: #102033 !important;
    border-color: #d6e2ea !important;
}
[data-theme="light"] .cargo-cert-val {
    color: #1e3a8a !important;
    background: #eef2fb !important;
    border-color: #c7d2f0 !important;
}
[data-theme="light"] .cargo-cert-val.ok {
    color: #2c8c62 !important;
    background: rgba(44, 140, 98, 0.14) !important;
    border-color: rgba(44, 140, 98, 0.4) !important;
}

/* Next customs procedure → navy (overrides the earlier marine tone) */
[data-theme="light"] .procedure-code {
    background: rgba(30, 58, 138, 0.10) !important;
    color: #1e3a8a !important;
}
[data-theme="light"] .next-procedure-row.selected td { background: #e6ecfb !important; }
[data-theme="light"] .next-procedure-row.selected { outline-color: rgba(30, 58, 138, 0.45) !important; }

/* Tabs in light theme — navy active underline (beat global button !important) */
[data-theme="light"] .compliance-tabs { border-bottom-color: #d6e2ea !important; }
[data-theme="light"] .compliance-tab {
    color: #536579 !important;
    background: transparent !important;
    border: none !important;
    border-bottom: 2px solid transparent !important;
}
[data-theme="light"] .compliance-tab.active {
    color: #1e3a8a !important;
    border-bottom-color: #1e3a8a !important;
}

/* ── v0.42 Header: position status chip + cargo-cert summary strip ── */
.status-chip {
    display: inline-block;
    padding: 0.16rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.status-chip.status-instock,
.status-chip.status-released  { background: rgba(34,197,94,0.15);  color: #22c55e; border-color: rgba(34,197,94,0.4); }
.status-chip.status-checkedin { background: rgba(59,130,246,0.15); color: #3b82f6; border-color: rgba(59,130,246,0.4); }
.status-chip.status-transit   { background: rgba(234,179,8,0.15);  color: #eab308; border-color: rgba(234,179,8,0.4); }
.status-chip.status-arrived   { background: rgba(6,182,212,0.15);  color: #06b6d4; border-color: rgba(6,182,212,0.4); }
.status-chip.status-unload    { background: rgba(168,85,247,0.15); color: #a855f7; border-color: rgba(168,85,247,0.4); }
.status-chip.status-blocked   { background: rgba(239,68,68,0.15);  color: #ef4444; border-color: rgba(239,68,68,0.4); }
.status-chip.status-new,
.status-chip.status-archived,
.status-chip.status-default   { background: rgba(100,116,139,0.15); color: #94a3b8; border-color: rgba(100,116,139,0.4); }

.compliance-cert-summary { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0 0.1rem; }
.cert-sum {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    font-size: 0.68rem;
    line-height: 1.3;
}
.cert-sum-k { font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-muted); }
.cert-sum-v { font-weight: 700; color: var(--text-primary); font-family: 'JetBrains Mono', monospace; }
.cert-sum-empty .cert-sum-v { color: var(--text-muted); font-family: inherit; font-weight: 600; }

/* ── v0.42 Light theme — refine header Save/Close (kill orange shadow) + chips ── */
[data-theme="light"] .compliance-header .btn-primary {
    background: #1e3a8a !important;
    border: 1px solid #1e3a8a !important;
    color: #ffffff !important;
    box-shadow: none !important;
}
[data-theme="light"] .compliance-header .btn-primary:hover {
    background: #172e6e !important;
    border-color: #172e6e !important;
    box-shadow: none !important;
}
[data-theme="light"] .compliance-header .btn:not(.btn-primary) {
    background: #ffffff !important;
    border: 1px solid #d6e2ea !important;
    color: #33465a !important;
    box-shadow: none !important;
}
[data-theme="light"] .compliance-header .btn:not(.btn-primary):hover {
    background: #eef4f8 !important;
    border-color: #1e3a8a !important;
    color: #1e3a8a !important;
}
[data-theme="light"] .cert-sum { background: #ffffff !important; border-color: #d6e2ea !important; }
[data-theme="light"] .cert-sum-k { color: #536579 !important; }
[data-theme="light"] .cert-sum-v { color: #1e3a8a !important; }
[data-theme="light"] .cert-sum-empty .cert-sum-v { color: #536579 !important; }

/* ── Multi-MRN journeys, seals on re-export, inbound badge, pre-approval ───── */
/* Inbound arrival MRN tag (origin T1, first customs doc). Dark theme: solid
   marine with WHITE text (the translucent-blue-on-dark read too dark). */
.mrn-badge-inline.inbound { background: #0d6ea6; color: #ffffff; }
/* Per-leg "registered by <user>" attribution. */
.mrn-registered-by { color: #94a3b8; font-size: 0.82em; margin-left: 0.4rem; }
/* Repeatable MRN number rows (one T1 closed by N importer MRNs). */
.mrn-multi-field { display: flex; flex-direction: column; }
.mrn-multi-row { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.35rem; }
.mrn-multi-row .mrn-multi-number { flex: 1 1 auto; }
.mrn-remove-number { cursor: pointer; color: #ef4444; font-weight: 700; padding: 0 0.4rem; line-height: 1; user-select: none; }
.mrn-remove-number:hover { color: #dc2626; }
.mrn-add-number-btn {
    align-self: flex-start; margin-top: 0.15rem; padding: 0.25rem 0.6rem;
    background: rgba(13,110,166,0.12); color: #0d6ea6; border: 1px dashed #0d6ea6;
    border-radius: 6px; font-size: 0.82rem; cursor: pointer;
}
.mrn-add-number-btn:hover { background: rgba(13,110,166,0.2); }
.mrn-field-hint { color: #94a3b8; font-weight: 400; font-size: 0.78em; }
/* Inbound-T1 "Unload permission approved" pre-approval checkbox. */
.mrn-preapprove-row {
    display: flex; align-items: center; gap: 0.5rem; margin: 0.5rem 0 0.75rem;
    padding: 0.5rem 0.7rem; border-radius: 8px;
    background: rgba(34,197,94,0.10); border: 1px solid rgba(34,197,94,0.35);
    font-size: 0.9rem; cursor: pointer;
}
.mrn-preapprove-row input { width: 16px; height: 16px; cursor: pointer; }
/* Per-leg edit/delete controls in the resolved/history timeline. */
.mrn-leg-actions { margin-left: 0.5rem; display: inline-flex; gap: 0.5rem; }
.mrn-leg-edit, .mrn-leg-delete { cursor: pointer; font-size: 0.82em; }
.mrn-leg-edit { color: #0d6ea6; }
.mrn-leg-delete { color: #ef4444; }

/* Light theme. */
[data-theme="light"] .mrn-badge-inline.inbound { background: #0a5989 !important; color: #ffffff !important; }

/* Floating Save (keep modal open) on the footer. */
.mrn-floating-save {
    display: flex;
    position: sticky; bottom: 0; justify-content: flex-end;
    padding: 0.6rem 0; margin-top: 0.5rem; gap: 0.5rem;
}
.mrn-floating-save .btn-save-journey {
    padding: 0.5rem 1.1rem; background: #0d6ea6; color: #fff; border: none;
    border-radius: 8px; font-weight: 600; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.mrn-floating-save .btn-save-journey:hover { background: #0a5989; }
/* Pre-approval attribution line. */
.mrn-preapprove-stamp { font-size: 0.78rem; color: #22c55e; margin: -0.25rem 0 0.5rem 0.3rem; }

[data-theme="light"] .mrn-preapprove-stamp { color: #15803d !important; }
[data-theme="light"] .mrn-registered-by { color: #536579 !important; }
[data-theme="light"] .mrn-add-number-btn { background: #e1eef6 !important; color: #0a5989 !important; border-color: #0a5989 !important; }
[data-theme="light"] .mrn-field-hint { color: #536579 !important; }
[data-theme="light"] .mrn-preapprove-row { background: #e9f7ee !important; border-color: #86c8a0 !important; color: #1e3a8a !important; }
[data-theme="light"] .mrn-leg-edit { color: #0a5989 !important; }

/* Edit panel action row (Save leg + Delete inside the editor). */
.mrn-edit-actions { display: flex; align-items: center; gap: 1rem; margin-top: 0.4rem; }
.mrn-edit-actions .mrn-leg-delete { font-size: 0.85rem; }

/* Dedicated cert reference fields (NVWA GGB/CHED, Phyto Phyto-no/P2/CHEDD). */
/* Dedicated cert reference fields (NVWA GGB/CHED, Phyto Phyto-no/P2/CHEDD) — a
   labelled, consistently-styled group that wraps neatly within the cert row. */
.cargo-cert-row .cargo-cert-opts { flex-wrap: wrap; row-gap: 0.4rem; }
.cargo-cert-extra { display: inline-flex; flex-direction: column; gap: 0.2rem; }
.cargo-cert-extra label {
    font-size: 0.58rem; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase;
    color: var(--text-muted);
}
.cargo-cert-extra-input {
    height: 34px; padding: 0 0.55rem; box-sizing: border-box; min-width: 120px; width: 130px;
    font-size: 0.75rem; font-family: 'JetBrains Mono', ui-monospace, monospace;
    background: var(--bg-tertiary); color: var(--text-primary);
    border: 1px solid var(--border-color); border-radius: var(--radius-sm); outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.cargo-cert-extra-input:focus { border-color: #0d6ea6; box-shadow: 0 0 0 2px rgba(13,110,166,0.22); }
[data-theme="light"] .cargo-cert-extra label { color: #536579 !important; }
[data-theme="light"] .cargo-cert-extra-input { background: #ffffff !important; color: #1e3a8a !important; border-color: #d6e2ea !important; }
[data-theme="light"] .cargo-cert-extra-input:focus { border-color: #0a5989 !important; box-shadow: 0 0 0 2px rgba(10,89,137,0.2) !important; }

/* Available seals shown under the inbound-T1 MRN. */
.mrn-seals-under-mrn { margin: -0.4rem 0 0.6rem 0.3rem; font-size: 0.72rem; display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.mrn-seals-under-mrn .mrn-seals-label { color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; font-weight: 600; font-size: 0.62rem; }

/* ── Refine the list-choose next-procedure inputs (#mrnCloseFields / storage exit) ── */
#mrnCloseFields, #mrnStorageExitFields { margin-top: 0.6rem; display: flex; flex-direction: column; gap: 0.6rem; }
#mrnCloseFields .mrn-form-row,
#mrnStorageExitFields .mrn-form-row {
    display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem;
    padding: 0.7rem 0.85rem; border: 1px solid var(--border-color); border-left: 3px solid #0d6ea6;
    border-radius: 10px; background: linear-gradient(180deg, rgba(13,110,166,0.05), rgba(148,163,184,0.03));
}
#mrnCloseFields .mrn-form-field,
#mrnStorageExitFields .mrn-form-field { display: flex; flex-direction: column; gap: 0.28rem; flex: 1 1 180px; }
#mrnCloseFields .mrn-form-field > label,
#mrnStorageExitFields .mrn-form-field > label {
    font-size: 0.62rem; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-muted);
}
#mrnCloseFields .mrn-form-field input,
#mrnStorageExitFields .mrn-form-field input {
    height: 38px; padding: 0 0.6rem; box-sizing: border-box; width: 100%;
    background: var(--bg-tertiary); color: var(--text-primary);
    border: 1px solid var(--border-color); border-radius: 8px; font-size: 0.82rem; outline: none;
    font-family: 'JetBrains Mono', ui-monospace, monospace; transition: border-color .15s, box-shadow .15s;
}
#mrnCloseFields .mrn-form-field input:focus,
#mrnStorageExitFields .mrn-form-field input:focus { border-color: #0d6ea6; box-shadow: 0 0 0 2px rgba(13,110,166,0.25); }
#mrnCloseFields .mrn-multi-row { margin-bottom: 0.35rem; }

[data-theme="light"] .mrn-seals-under-mrn .mrn-seals-label { color: #536579 !important; }
[data-theme="light"] #mrnCloseFields .mrn-form-row,
[data-theme="light"] #mrnStorageExitFields .mrn-form-row { background: linear-gradient(180deg, #eef5fa, #f7fafc) !important; border-color: #d6e2ea !important; border-left-color: #0a5989 !important; }
[data-theme="light"] #mrnCloseFields .mrn-form-field input,
[data-theme="light"] #mrnStorageExitFields .mrn-form-field input { background: #ffffff !important; color: #1e3a8a !important; border-color: #d6e2ea !important; }
[data-theme="light"] #mrnCloseFields .mrn-form-field input:focus,
[data-theme="light"] #mrnStorageExitFields .mrn-form-field input:focus { border-color: #0a5989 !important; box-shadow: 0 0 0 2px rgba(10,89,137,0.2) !important; }

/* ── Re-export multi-MRN builder ─────────────────────────────────────────── */
/* "+" button appended after the EXA/T1/T2 toggle tabs. */
.mrn-toggle-add {
    margin-left: 0.5rem; width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
    background: rgba(13,110,166,0.16); color: #2b9fe0; border: 1px solid rgba(13,110,166,0.7);
    font-size: 1.1rem; font-weight: 700; line-height: 1; vertical-align: middle;
}
.mrn-toggle-add:hover { background: rgba(13,110,166,0.3); border-color: #2b9fe0; }
/* Per-row Save button at the end of the add row. */
.mrn-row-save-btn {
    align-self: flex-end; height: 38px; padding: 0 0.9rem; cursor: pointer; white-space: nowrap;
    background: #0d6ea6; color: #fff; border: none; border-radius: 8px; font-weight: 600; font-size: 0.82rem;
}
.mrn-row-save-btn:hover { background: #0a5989; }
/* Added MRNs list (chips on top of the add row). */
.mrn-added-list { margin-bottom: 0.5rem; }
.mrn-added-label { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); font-weight: 600; margin-bottom: 0.35rem; }
.mrn-added-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.mrn-added-chip {
    display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.55rem;
    background: rgba(13,110,166,0.12); border: 1px solid rgba(13,110,166,0.45); border-radius: 999px;
    font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.74rem; color: var(--text-primary);
}
.mrn-added-chip .mrn-added-type {
    background: #0d6ea6; color: #fff; border-radius: 4px; padding: 0 0.3rem; font-size: 0.62rem; font-weight: 700;
}
.mrn-added-chip .mrn-added-remove { cursor: pointer; color: #ef4444; font-weight: 700; }
.mrn-reexport-add-row { align-items: flex-end; }

[data-theme="light"] .mrn-added-label { color: #536579 !important; }
[data-theme="light"] .mrn-added-chip { background: #e1eef6 !important; border-color: #9cc3da !important; color: #1e3a8a !important; }
[data-theme="light"] .mrn-toggle-add { background: #e1eef6 !important; color: #0a5989 !important; border-color: #0a5989 !important; }

/* Seals shown UNDER a leg's MRN in the journey (wraps to its own line). */
.current-mrn-left { flex-wrap: wrap; }
.mrn-leg-seals { flex-basis: 100%; margin-top: 0.25rem; display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; font-size: 0.72rem; }
.mrn-leg-seals .mrn-seals-label { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-muted); font-weight: 600; }
/* Seal value shown on a builder chip. */
.mrn-added-seal { color: #f59e0b; font-size: 0.7rem; }
