* { box-sizing: border-box; }

html { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f0f2f5;
    color: #1a1a1a;
    height: 100%;
    overflow: hidden;
}

/* ── App shell ── */
.app-shell {
    display: flex;
    height: 100%;
}

/* ── Sidebar ── */
.sidebar {
    width: 224px;
    flex-shrink: 0;
    background: #1e293b;
    color: white;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-right: 1px solid rgba(0,0,0,0.15);
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 1rem 1rem 0.75rem;
    color: white;
    flex-shrink: 0;
}

.sidebar-logo {
    width: 130px;
    max-width: 100%;
    object-fit: contain;
    filter: brightness(0) invert(1);
    opacity: 0.82;
}

.sidebar-brand-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: rgba(255,255,255,0.55);
}

/* ── Sidebar nav ── */
.sidebar-nav {
    padding: 0 0.5rem;
    flex-shrink: 0;
}

.nav-section-label {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: rgba(255,255,255,0.3);
    padding: 0.8rem 0.6rem 0.3rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.7rem;
    font-size: 0.84rem;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    border-radius: 6px;
    margin-bottom: 1px;
    transition: background 0.12s, color 0.12s;
    cursor: pointer;
    user-select: none;
}

.nav-item svg { flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
.nav-item.active {
    background: rgba(255,255,255,0.12);
    color: white;
    font-weight: 500;
}

.nav-item--soon {
    opacity: 0.5;
    cursor: default;
}
.nav-item--soon:hover {
    background: none;
    opacity: 0.65;
    color: rgba(255,255,255,0.6);
}

.nav-soon-badge {
    margin-left: auto;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.45);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* ── Sidebar currencies ── */
.sidebar-currencies {
    padding: 0 0.5rem 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.07);
    margin-top: 0.75rem;
    flex-shrink: 0;
}

.sidebar-currencies #header-currencies { padding: 0 0.1rem; }

.sidebar-currencies .currency-date {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.3);
    margin-bottom: 0.4rem;
    padding: 0 0.5rem;
}

.sidebar-currencies .currency-pairs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
}

.sidebar-currencies .currency-pair {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 0.35rem 0.5rem;
    min-width: 0;
    text-align: center;
}

.sidebar-currencies .currency-code {
    font-size: 0.6rem;
    font-weight: 700;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.05em;
}

.sidebar-currencies .currency-rate {
    font-size: 0.82rem;
    font-weight: 600;
    color: white;
}

.sidebar-currencies .sparkline { display: none; }
.sidebar-currencies .currency-loading {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.35);
    font-style: italic;
    padding: 0.25rem 0.5rem;
    display: block;
}

/* ── Sidebar admin ── */
.sidebar-version {
    font-size: 0.62rem; color: rgba(255,255,255,0.2);
    padding: 0 1rem 0.35rem; letter-spacing: 0.04em;
    margin-top: auto; flex-shrink: 0;
}
.sidebar-admin {
    padding: 0 0.5rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}

.sidebar-btn {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.48rem 0.7rem;
    background: none;
    border: none;
    color: rgba(255,255,255,0.55);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    border-radius: 6px;
    text-align: left;
    transition: background 0.12s, color 0.12s;
    margin-bottom: 1px;
}

.sidebar-btn svg { flex-shrink: 0; }
.sidebar-btn:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
.sidebar-btn.edit-active { color: #60a5fa; }
.sidebar-btn.edit-active:hover { background: rgba(96,165,250,0.15); }
.sidebar-btn--danger { color: rgba(252,165,165,0.65); }
.sidebar-btn--danger:hover { background: rgba(239,68,68,0.15); color: #fca5a5; }

/* ── Main wrap ── */
.main-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* ── Topbar ── */
.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: white;
    border-bottom: 1px solid #e8ecf0;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}

#search {
    flex: 1;
    max-width: 520px;
    padding: 0.52rem 0.9rem;
    font-size: 0.9rem;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    outline: none;
    background: #f8fafc;
    color: #1a1a1a;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

#search:focus {
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

#search::placeholder { color: #94a3b8; }

#last-updated {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Dashboard widgets ── */
#db-widgets { padding: 1rem 1.5rem 0; }
.db-quick-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.db-quick-card {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-decoration: none;
    color: #1e293b;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.db-quick-card:hover { border-color: #1d4ed8; box-shadow: 0 0 0 3px rgba(29,78,216,0.08); color: #1d4ed8; }
.db-quick-card svg { flex-shrink: 0; opacity: 0.7; }
.db-forex-bar { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; margin-bottom: 0.5rem; font-size: 0.8rem; }
.db-fx-label { font-weight: 700; color: #475569; font-size: 0.72rem; letter-spacing: 0.04em; }
.db-fx-pair { display: inline-flex; align-items: center; gap: 0.25rem; }
.db-fx-code { font-size: 0.7rem; font-weight: 600; color: #94a3b8; }
.db-fx-rate { font-weight: 600; color: #1e293b; font-variant-numeric: tabular-nums; }
.db-fx-date { margin-left: auto; font-size: 0.7rem; color: #94a3b8; }
.db-charts-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.db-chart-card {
    flex: 1;
    min-width: 240px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    min-height: 100px;
}
.db-chart-loading { font-size: 0.8rem; color: #94a3b8; }
.db-chart-inner { display: flex; flex-direction: column; gap: 0.25rem; }
.db-chart-title { font-size: 0.75rem; font-weight: 600; color: #64748b; }

/* ── Pinned section ── */
.pinned-section {
    padding: 1rem 1.5rem 0.25rem;
    flex-shrink: 0;
}

.pinned-heading {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #94a3b8;
    margin: 0 0 0.5rem 0;
    font-weight: 700;
}

.pinned-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.pinned-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: white;
    border: 1px solid #e8ecf0;
    border-radius: 7px;
    padding: 0.42rem 0.8rem;
    font-size: 0.84rem;
    color: #334155;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.pinned-item:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(0,0,0,0.07);
}

.pinned-item .favicon { width: 14px; height: 14px; }

/* ── Dashboard grid ── */
#dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    padding: 1rem 1.5rem 2rem;
    align-content: start;
}

/* Shortcuts launchpad is now a footer section below the live modules.
   The pseudo-element gives it a visible (but quiet) header. */
#dashboard:not(:empty)::before {
    content: 'Shortcuts';
    grid-column: 1 / -1;
    display: block;
    margin: 0.5rem 0 0;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    font-weight: 700;
}

/* ── Group widget cards ── */
.group {
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    overflow: hidden;
    border-left: 4px solid var(--group-colour, #e2e8f0);
    transition: box-shadow 0.15s;
}

.group:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,0.09), 0 1px 4px rgba(0,0,0,0.05);
}

.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0.9rem 0.8rem 1rem;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.12s;
}

.group-header:hover { background: #fafbfc; }

.group-header h2 {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.group-header .accent-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.group-header .collapse-icon {
    font-size: 0.65rem;
    color: #94a3b8;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.group.collapsed .collapse-icon { transform: rotate(-90deg); }
.group.collapsed .group-body { display: none; }

.group-body { padding: 0.2rem 0; }

.group ul { list-style: none; padding: 0; margin: 0; }

.group li { display: flex; align-items: center; }

.group li a {
    text-decoration: none;
    color: #334155;
    padding: 0.46rem 1rem 0.46rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    font-size: 0.855rem;
    transition: background 0.1s;
    min-width: 0;
}

.group li a:hover { background: #f8fafc; }

/* ── Type icons ── */
.type-icon { flex-shrink: 0; width: 15px; height: 15px; opacity: 0.5; }
.type-icon.favicon { opacity: 1; border-radius: 2px; }

.type-icon-svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    fill: none;
    stroke: #64748b;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Tags ── */
.tag {
    background: #fef3c7;
    color: #92400e;
    padding: 0.13rem 0.4rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    margin-left: auto;
    flex-shrink: 0;
    letter-spacing: 0.01em;
}

.tag.season-active { background: #dcfce7; color: #166534; }
.tag.season-inactive { background: #f1f5f9; color: #94a3b8; }

/* ── Copy path button ── */
.copy-path-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.72rem;
    padding: 0.3rem 0.6rem;
    margin-left: auto;
    flex-shrink: 0;
    border-radius: 4px;
    font-family: inherit;
    transition: background 0.12s, color 0.12s;
}
.copy-path-btn:hover { background: #f1f5f9; color: #475569; }

/* ── Off-season ── */
li.off-season a { opacity: 0.45; }
li.off-season:hover a { opacity: 0.75; }

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    background: #1e293b;
    color: white;
    padding: 0.55rem 1.1rem;
    border-radius: 8px;
    font-size: 0.84rem;
    opacity: 0;
    transition: transform 0.22s, opacity 0.22s;
    pointer-events: none;
    z-index: 500;
    white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Edit mode — drag handles ── */
.drag-handle {
    cursor: grab;
    color: #94a3b8;
    font-size: 1rem;
    padding: 0 0.4rem 0 0;
    flex-shrink: 0;
    user-select: none;
    line-height: 1;
}
.drag-handle:active { cursor: grabbing; }
.item-drag-handle { padding: 0 0.35rem; color: #cbd5e1; font-size: 0.9rem; }

/* ── Drag feedback ── */
.group.edit-mode .group-header { cursor: default; }
.group.dragging { opacity: 0.35; }
.group.drag-over { outline: 2px dashed #3b82f6; outline-offset: 2px; }
li.dragging { opacity: 0.35; }
li.drag-over { background: #eff6ff; }

/* ── Group name & colour editing ── */
.group-name-input {
    background: transparent;
    border: none;
    border-bottom: 1px dashed #94a3b8;
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
    padding: 0;
    min-width: 80px;
    max-width: 180px;
    outline: none;
    font-family: inherit;
}
.group-name-input:focus { border-bottom-color: #3b82f6; }

.group-colour-picker {
    width: 22px;
    height: 22px;
    border: none;
    padding: 0;
    cursor: pointer;
    background: none;
    border-radius: 4px;
    flex-shrink: 0;
}

/* ── Edit action buttons (pencil, ×) ── */
.edit-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 0.85rem;
    padding: 0.2rem 0.3rem;
    border-radius: 4px;
    flex-shrink: 0;
    line-height: 1;
    transition: background 0.12s, color 0.12s;
}
.edit-action-btn:hover { background: #f1f5f9; color: #475569; }
.edit-action-btn.delete-btn:hover { background: #fee2e2; color: #ef4444; }

/* ── Add item / group buttons ── */
.add-item-btn {
    display: block;
    width: calc(100% - 2rem);
    margin: 0.35rem 1rem;
    padding: 0.32rem;
    background: none;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    color: #94a3b8;
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.add-item-btn:hover { background: #f8fafc; border-color: #3b82f6; color: #2563eb; }

.add-group-btn {
    background: white;
    border: 2px dashed #e2e8f0;
    border-radius: 10px;
    color: #94a3b8;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    padding: 1.5rem;
    width: 100%;
    text-align: center;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.add-group-btn:hover { background: #f8fafc; border-color: #3b82f6; color: #2563eb; }

/* ── Pinned edit mode ── */
.pinned-edit-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    padding: 0.2rem 0.3rem 0.2rem 0.7rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.pinned-edit-wrapper .pinned-item {
    border: none;
    background: none;
    padding: 0;
    box-shadow: none;
    pointer-events: none;
}
.add-pinned-btn {
    border-style: dashed !important;
    color: #94a3b8 !important;
}
.add-pinned-btn:hover { border-color: #3b82f6 !important; color: #2563eb !important; }

/* ── Item edit modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1rem;
}
.modal-box {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal-title {
    margin: 0 0 1.1rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
}
.modal-field { margin-bottom: 0.85rem; }
.modal-field label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.modal-hint {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: #94a3b8;
    margin-left: 0.2rem;
}
.modal-field input, .modal-field select {
    width: 100%;
    padding: 0.52rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.88rem;
    color: #1a1a1a;
    background: white;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.modal-field input:focus, .modal-field select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.modal-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.1rem;
    justify-content: flex-end;
}
.btn-primary {
    background: #2563eb;
    color: white;
    border: none;
    padding: 0.52rem 1.1rem;
    border-radius: 6px;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary {
    background: white;
    color: #475569;
    border: 1px solid #e2e8f0;
    padding: 0.52rem 1.1rem;
    border-radius: 6px;
    font-size: 0.86rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.btn-secondary:hover { background: #f8fafc; }
.btn-danger {
    background: white;
    color: #dc2626;
    border: 1px solid #fca5a5;
    padding: 0.52rem 1.1rem;
    border-radius: 6px;
    font-size: 0.86rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
}
.btn-danger:hover { background: #fef2f2; border-color: #dc2626; }

/* ── btn-ghost (kept for potential reuse) ── */
.btn-ghost {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 0.78rem;
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}
.btn-ghost:hover { background: rgba(255,255,255,0.2); }

/* ── Currency sparklines (main area, not used in sidebar) ── */
.sparkline {
    display: block;
    width: 100%;
    height: 20px;
    margin-top: 0.25rem;
    overflow: visible;
}
.sparkline-up polyline { stroke: rgba(134,239,172,0.9); }
.sparkline-down polyline { stroke: rgba(252,165,165,0.85); }

/* ── Responsive ── */
@media (max-width: 640px) {
    body { overflow: auto; }
    .app-shell { flex-direction: column; height: auto; }
    .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; overflow: visible; }
    .sidebar-brand { padding: 0.75rem 1rem; }
    .sidebar-nav { display: flex; flex-wrap: wrap; padding: 0.5rem; gap: 0.25rem; order: 2; width: 100%; }
    .nav-section-label { display: none; }
    .sidebar-currencies { display: none; }
    .sidebar-admin {
        display: flex; flex-direction: row; flex-wrap: wrap; gap: 0.25rem;
        padding: 0.5rem; margin-top: 0; border-top: none; border-left: 1px solid rgba(255,255,255,0.07);
        margin-left: auto; align-items: center;
    }
    .sidebar-admin .nav-section-label { display: none; }
    .sidebar-btn { width: auto; padding: 0.4rem 0.6rem; }

    /* Mobile header slim: Edit Layout is dashboard-only chrome that has
       no purpose on the orders flow. Version stamp shrinks to a tiny
       corner badge so the brand row stays tight. */
    .sidebar-admin #edit-btn { display: none; }
    .sidebar-version {
        position: absolute; top: 0.4rem; right: 0.6rem;
        margin: 0; padding: 0; font-size: 0.62rem; opacity: 0.5;
    }
    .sidebar-brand { padding: 0.55rem 0.85rem; }
    .main-wrap { overflow: visible; }
    #dashboard { grid-template-columns: 1fr; padding: 0.75rem; }
    .pinned-section { padding: 0.75rem; }

    /* ── Mobile nav: keep only Orders + Calendar visible ── */
    .sidebar-nav .nav-item:not(#nav-orders):not(#nav-calendar):not(#nav-admin) { display: none; }
    .sidebar-nav .nav-soon-badge { display: none; }

    /* ── Orders list: table → cards ── */
    .orders-view-inner { padding: 0.75rem; }
    .orders-table-wrap { overflow: visible; border: none; }
    .orders-table, .orders-table tbody { display: block; width: 100%; }
    .orders-table thead { display: none; }
    .orders-table tr.order-row {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "id       status"
            "customer customer"
            "shipto   shipto"
            "date     total"
            "actions  actions";
        gap: 0.25rem 0.5rem;
        padding: 0.7rem 0.85rem;
        margin-bottom: 0.55rem;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        background: white;
        cursor: pointer;
    }
    .orders-table tr.order-row > td { display: block; padding: 0; border: none; }
    .orders-table tr.order-row > td.order-po,
    .orders-table tr.order-row > td.order-xero { display: none; }
    .orders-table tr.order-row > td.order-id { grid-area: id; font-weight: 700; font-size: 0.92rem; }
    .orders-table tr.order-row > td:nth-child(2) { grid-area: customer; color: #1e293b; font-size: 0.88rem; }
    .orders-table tr.order-row > td.order-ship-to { grid-area: shipto; color: #64748b; font-size: 0.8rem; }
    .orders-table tr.order-row > td.order-date  { grid-area: date;   color: #94a3b8; font-size: 0.78rem; }
    .orders-table tr.order-row > td.order-total { grid-area: total;  font-weight: 600; font-size: 0.88rem; text-align: right; }
    .orders-table tr.order-row > td:nth-child(7) { grid-area: status; text-align: right; }
    /* The desktop rule on .order-actions-col sets `width: 1px` to shrink the
       table cell to its content — on mobile (display: block in a grid) that
       1px collapses the flex container and forces every icon to wrap onto
       its own line. Reset width + white-space here. */
    .orders-table tr.order-row > td.order-actions-col {
        grid-area: actions;
        margin-top: 0.35rem;
        width: auto;
        white-space: normal;
        padding-right: 0 !important;
    }
    /* Force a horizontal row — without `display: flex` and explicit row
       direction the inline-flex inheritance was rendering the SVG-only
       anchors/buttons as block siblings on iOS, stacking the icons. */
    .orders-table tr.order-row .row-actions {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: flex-start;
        gap: 0.4rem;
        width: 100%;
    }
    .orders-table tr.order-row .row-action-btn,
    .orders-table tr.order-row .overflow-menu {
        flex: 0 0 auto;
        min-width: 36px;
        min-height: 36px;
    }
    .orders-table tr.order-row .overflow-trigger { width: 36px; height: 36px; }

    /* ── Order form: single column + room to tap ── */
    .order-form { max-width: 100%; }
    .form-section { padding: 1rem; }
    .form-row { flex-direction: column; gap: 0.6rem; }
    .form-field { width: 100%; }
    .line-items-wrap { overflow-x: auto; }
    .line-items-table { min-width: 560px; }

    /* ── Order detail action bar: stack, full-width primary ── */
    .order-actions { flex-direction: column; align-items: stretch; gap: 0.5rem; }
    .order-actions-left, .order-actions-right { width: 100%; display: flex; flex-wrap: wrap; gap: 0.4rem; }
    .order-actions-right .btn-primary,
    .order-actions-right .btn-secondary { flex: 1 1 auto; }

    /* Slip is 794px wide — let mobile users scroll horizontally to see it
       rather than centering it off-screen. */
    .orders-view-inner.slip-view { padding: 0.5rem; align-items: stretch; overflow-x: auto; }

    /* Filter disclosure: collapsed by default on mobile. The Filters button
       appears, the bar is hidden until expanded. Both desktop-only "New
       Order" header link and the new FAB are present in markup; CSS
       decides which is visible per viewport. */
    .orders-filters-toggle {
        display: inline-flex; align-items: center; gap: 0.4rem;
        padding: 0.5rem 0.85rem;
        background: white; border: 1px solid #e2e8f0; border-radius: 8px;
        font-size: 0.85rem; font-weight: 500; color: #1e293b;
        margin-bottom: 0.5rem; cursor: pointer;
    }
    .orders-filters-toggle:active { background: #f1f5f9; }
    .orders-filter-bar { display: none; flex-direction: column; gap: 0.5rem; padding: 0.75rem; }
    .orders-filter-bar.orders-filter-bar--open { display: flex; }
    .orders-filter-bar .orders-filter-input,
    .orders-filter-bar .orders-filter-select { width: 100%; }

    /* Hide the inline header New-Order button; the FAB takes over. */
    .view-header .orders-new-btn { display: none; }
    .orders-new-fab {
        position: fixed;
        bottom: 1rem; right: 1rem;
        width: 56px; height: 56px;
        border-radius: 50%;
        background: #2563eb; color: white;
        display: flex; align-items: center; justify-content: center;
        font-size: 1.75rem; font-weight: 400; line-height: 1;
        text-decoration: none;
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35), 0 2px 4px rgba(0, 0, 0, 0.12);
        z-index: 100;
    }
    .orders-new-fab:active { transform: scale(0.96); }

    /* Keep the last card out from under the FAB. */
    #orders-list-body { padding-bottom: 5rem; }
}

/* Desktop: hide mobile-only affordances. */
@media (min-width: 641px) {
    .orders-filters-toggle { display: none; }
    .orders-new-fab { display: none; }
}

/* ═══════════════════════════════════════════════
   Orders views
   ═══════════════════════════════════════════════ */

.app-view { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.orders-view-inner {
    padding: 1.5rem;
    max-width: 1600px;
    width: 100%;
    flex: 1;
}

#view-imports .orders-view-inner { max-width: none; }

/* Detail view: grey "desk" so the slip looks like a document */
.orders-view-inner.slip-view {
    background: #dde1e7;
    max-width: 100%;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
}
.orders-view-inner.slip-view .view-header { display: none; }
.orders-view-inner.slip-view .order-actions {
    width: 100%;
    max-width: 794px;
    margin-bottom: 1rem;
}

/* ── View header (title + action button row) ── */
.view-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
}
.view-title {
    margin: 0 0 0.2rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.02em;
}
.view-subtitle { margin: 0; font-size: 0.85rem; color: #64748b; }

/* ── Xero connection banner ── */
.xero-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.87rem;
    color: #1e40af;
}
.xero-banner-text { flex: 1; }
.xero-connect-btn { white-space: nowrap; text-decoration: none; }

/* Prominent "Send to Xero" prompt on the order detail page. Sits between
   the action bar and the slip so it can't be missed on first review. */
.xero-push-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    padding: 0.85rem 1.1rem;
    margin: 0 auto 1rem;
    max-width: 794px;
    width: 100%;
    box-sizing: border-box;
}
.xero-push-banner-text { display: flex; flex-direction: column; gap: 0.1rem; }
.xero-push-banner-text strong { color: #9a3412; font-size: 0.92rem; }
.xero-push-banner-text span { font-size: 0.78rem; color: #b45309; }
.xero-push-banner .btn-primary { flex-shrink: 0; }

/* ── Orders table ── */
.orders-table-wrap { overflow-x: auto; }
.orders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.orders-table th {
    text-align: left;
    padding: 0.55rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    border-bottom: 2px solid #e8ecf0;
    white-space: nowrap;
}
.orders-table td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}
.order-row { cursor: pointer; transition: background 0.1s; }
.order-row:hover td { background: #f8fafc; }
.order-id { font-family: ui-monospace, monospace; font-weight: 600; color: #1e293b; white-space: nowrap; }
.order-ship-to { color: #64748b; }
.order-po { color: #94a3b8; font-size: 0.8125rem; white-space: nowrap; }
.order-date { color: #64748b; white-space: nowrap; }
.order-total { font-weight: 600; white-space: nowrap; }
.order-xero { white-space: nowrap; }

.order-status-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.xero-inv-num {
    font-family: ui-monospace, monospace;
    font-size: 0.78rem;
    color: #059669;
    font-weight: 600;
}
.xero-pending { color: #cbd5e1; }
.order-actions-col { width: 1px; white-space: nowrap; padding-right: 0.5rem !important; }
.row-actions { display: inline-flex; align-items: center; gap: 0.15rem; }
.row-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: #64748b;
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
    cursor: pointer;
    border: none;
    background: none;
}
.row-action-btn:hover { background: #f1f5f9; color: #1e293b; }
.row-action-btn--dim { opacity: 0.3; cursor: default; pointer-events: none; }
/* When the overflow trigger is used inside a row, drop its default min-width
   so it lines up with the surrounding 28×28 row-action-btn icons. */
.row-actions .overflow-trigger { min-width: 0; padding: 0; font-size: 0.95rem; line-height: 1; }
/* The Xero badge is its own coloured surface, so the icon-button hover bg
   would muddy it. Keep the slot clean. */
.row-action-btn--xero { padding: 0; }
.row-action-btn--xero:hover { background: transparent; }

/* ── Overflow / context menu ── */
.overflow-menu { position: relative; display: inline-flex; }
.overflow-trigger {
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    min-width: 2.25rem;
    justify-content: center;
}
.overflow-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 300;
    min-width: 190px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.13);
    padding: 4px 0;
}
.overflow-menu.open .overflow-dropdown { display: block; }
.overflow-item {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    padding: 8px 16px;
    background: none;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.82rem;
    font-family: inherit;
    color: #1e293b;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}
.overflow-item:hover { background: #f1f5f9; color: #1e293b; }
.overflow-item.overflow-danger { color: #dc2626; }
.overflow-item.overflow-danger:hover { background: #fef2f2; color: #dc2626; }
.overflow-item.overflow-dim { color: #94a3b8; cursor: default; }
.overflow-item.overflow-dim:hover { background: none; }
.overflow-item.overflow-indent { padding-left: 28px; }
.overflow-section {
    font-size: 0.65rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 8px 16px 4px;
    user-select: none;
}
.overflow-divider {
    margin: 4px 0;
    border: 0;
    border-top: 1px solid #e2e8f0;
}

/* ── Orders filter bar ── */
.orders-filter-bar {
    display: flex; gap: 0.5rem; align-items: center;
    padding: 0.6rem 1.5rem; background: #f8fafc;
    border-bottom: 1px solid #e2e8f0; flex-wrap: wrap;
}
.orders-filter-input {
    padding: 0.35rem 0.6rem; border: 1px solid #e2e8f0; border-radius: 6px;
    font-size: 0.8125rem; color: #1e293b; background: white; min-width: 140px;
    font-family: inherit;
}
.orders-filter-input:focus { outline: none; border-color: #3b82f6; }
.orders-filter-select {
    padding: 0.35rem 0.6rem; border: 1px solid #e2e8f0; border-radius: 6px;
    font-size: 0.8125rem; color: #1e293b; background: white;
    font-family: inherit; cursor: pointer;
}

/* ── Paid badge ── */
.paid-badge {
    display: inline-block; margin-left: 0.4rem;
    font-size: 0.68rem; font-weight: 700; color: #10b981;
    background: #d1fae5; border-radius: 10px; padding: 0.1rem 0.4rem;
    white-space: nowrap;
}

/* ── Loading / error / empty states ── */
.orders-loading { padding: 2rem; color: #94a3b8; font-size: 0.9rem; }
.orders-error { padding: 2rem; color: #ef4444; font-size: 0.9rem; }
.orders-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4rem 2rem;
    color: #94a3b8;
    text-align: center;
    gap: 0.75rem;
}
.orders-empty p { margin: 0; font-size: 0.9rem; }
.orders-empty a { color: #3b82f6; text-decoration: none; }
.orders-empty a:hover { text-decoration: underline; }

/* ── Order form ── */
.order-form { max-width: 780px; }

/* Edit Order side-by-side preview. Reflects the *saved* order, not live
   edits — the page navigates away on Save, so a re-render isn't needed. */
.edit-with-preview {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}
.edit-form-col { flex: 0 1 780px; min-width: 0; }
.edit-preview {
    position: sticky;
    top: 0;
    flex: 0 0 auto;
}
.edit-preview-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    margin: 0 0 0.5rem 4px;
}
.edit-preview-scaler {
    --preview-scale: 0.65;
    width: calc(794px * var(--preview-scale));
    height: calc(1123px * var(--preview-scale));
    overflow: hidden;
    border-radius: 4px;
}
.edit-preview-scaler .packing-slip {
    transform: scale(var(--preview-scale));
    transform-origin: top left;
    box-shadow: 0 4px 18px rgba(0,0,0,0.14);
}
@media (max-width: 1280px) {
    .edit-preview { display: none; }
    .edit-form-col { flex-basis: 100%; }
}

.form-section {
    background: white;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.form-section-title {
    margin: 0 0 1rem;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #64748b;
}
.form-row { display: flex; gap: 0.75rem; margin-bottom: 0.75rem; }
.form-row:last-child { margin-bottom: 0; }
.form-checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #475569;
    cursor: pointer;
}
.form-checkbox-row input[type="checkbox"] { margin: 0; cursor: pointer; }
.form-field { display: flex; flex-direction: column; flex: 1; gap: 0.3rem; }
.form-field label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
}
.form-hint { font-weight: 400; color: #94a3b8; margin-left: 0.25rem; }
.form-field input, .form-field textarea, .form-field select {
    width: 100%;
    box-sizing: border-box;
    padding: 0.52rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.88rem;
    color: #1a1a1a;
    font-family: inherit;
    outline: none;
    background: white;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-field input:focus, .form-field textarea:focus, .form-field select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.form-field textarea { resize: vertical; }
.required { color: #ef4444; }

/* Customer typeahead */
.customer-search-wrap { position: relative; width: 100%; }
.customer-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 50;
    max-height: 200px;
    overflow-y: auto;
}
.customer-option {
    padding: 0.55rem 0.75rem;
    font-size: 0.87rem;
    color: #334155;
    cursor: pointer;
}
.customer-option:hover { background: #f1f5f9; }

/* On phones the line-items table scrolls horizontally inside
   .line-items-wrap, which has overflow-x: auto. That clips the SKU /
   description autocomplete dropdown down to a thin slice. Pin the
   dropdown to the viewport bottom on mobile so it escapes the clip
   and the user has a real-sized list with finger-tappable rows. */
@media (max-width: 640px) {
    .line-item-row .customer-dropdown {
        position: fixed;
        left: 0.75rem;
        right: 0.75rem;
        top: auto;
        bottom: 0.75rem;
        max-height: 60vh;
        font-size: 1rem;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
        border-radius: 10px;
    }
    .line-item-row .customer-option {
        padding: 0.9rem 1rem;
        font-size: 0.95rem;
        border-bottom: 1px solid #f1f5f9;
    }
    .line-item-row .customer-option:last-child { border-bottom: none; }
    .line-item-row .customer-option strong {
        display: inline-block;
        margin-right: 0.5rem;
        color: #1e293b;
    }
    .line-item-row .customer-option .store-city {
        color: #64748b;
        font-size: 0.85rem;
    }
}

/* Line items */
.line-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.5rem;
}
.line-items-table thead tr {
    display: flex;
    gap: 0.5rem;
    padding: 0 0 0.4rem;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 0.25rem;
}
.line-items-table thead th {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    text-align: left;
}
.line-item-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.35rem;
}
.line-item-row td { display: flex; align-items: center; }
.line-item-row input {
    width: 100%;
    padding: 0.42rem 0.6rem;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    font-size: 0.87rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.12s;
}
.line-item-row input:focus { border-color: #3b82f6; }
.line-item-row .line-qty, .line-item-row .line-price { text-align: right; }
.line-total { font-size: 0.87rem; font-weight: 500; color: #334155; padding: 0 0.25rem; white-space: nowrap; }
.line-remove-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    line-height: 1;
    transition: background 0.1s, color 0.1s;
}
.line-remove-btn:hover { background: #fee2e2; color: #ef4444; }
.add-line-btn {
    background: none;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    color: #64748b;
    font-size: 0.82rem;
    font-family: inherit;
    padding: 0.38rem 0.75rem;
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s;
}
.add-line-btn:hover { border-color: #3b82f6; color: #2563eb; }

/* Totals */
.order-totals { margin-top: 0.75rem; display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; }
.totals-row {
    display: flex;
    gap: 2rem;
    font-size: 0.87rem;
    color: #64748b;
}
.totals-grand { font-weight: 700; font-size: 0.95rem; color: #1e293b; }
.totals-gst-border { margin-top: 0.2rem; padding-top: 0.35rem; border-top: 1px solid #e2e8f0; }
.totals-row span:last-child { min-width: 80px; text-align: right; font-variant-numeric: tabular-nums; }

/* Form actions */
.form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
}
.form-error {
    flex: 1;
    color: #ef4444;
    font-size: 0.85rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
}
.btn-lg { padding: 0.65rem 1.5rem; font-size: 0.92rem; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }

/* ── Order detail action bar ── */
.order-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: white;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    flex-wrap: wrap;
}
.order-actions-left, .order-actions-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.xero-inv-linked {
    font-family: ui-monospace, monospace;
    font-size: 0.82rem;
    color: #059669;
    font-weight: 600;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    padding: 0.25rem 0.6rem;
    border-radius: 5px;
    text-decoration: none;
    transition: background 0.12s, border-color 0.12s;
}
a.xero-inv-linked:hover { background: #d1fae5; border-color: #6ee7b7; }
.xero-not-connected { font-size: 0.8rem; color: #94a3b8; }
.status-dispatched-tag {
    font-size: 0.82rem;
    color: #047857;
    font-weight: 600;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    padding: 0.25rem 0.6rem;
    border-radius: 5px;
}
.status-printed-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: #1e40af;
    font-weight: 600;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 0.25rem 0.55rem;
    border-radius: 5px;
    cursor: help;
}
.status-update-wrap { display: flex; align-items: center; gap: 0.5rem; }
.status-label { font-size: 0.78rem; color: #64748b; white-space: nowrap; }
.status-select {
    padding: 0.3rem 0.6rem;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    background: white;
}

/* ═══════════════════════════════════════════════
   Packing slip
   ═══════════════════════════════════════════════ */

.packing-slip {
    background: white;
    border-radius: 2px;
    padding: 14mm 18mm;
    box-shadow: 0 4px 24px rgba(0,0,0,0.18), 0 1px 4px rgba(0,0,0,0.08);
    width: 794px;   /* A4 at 96dpi */
    /* A4 is 1123.4px at 96dpi. Sitting at exactly 1123px caused subpixel
       rounding to push the printed/PDF height past 297mm, producing a
       blank second page. 1118px gives a ~1.3mm buffer without affecting
       layout — content longer than 1118px still grows the slip naturally. */
    min-height: 1118px;
    box-sizing: border-box;
    /* Flex column lets .slip-footer use margin-top:auto to sit at the very
       bottom of the page even when content is short — keeps the slip on a
       single A4 sheet. */
    display: flex;
    flex-direction: column;
    font-size: 0.88rem;
    color: #1e293b;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Top bar: logo left, title right */
.slip-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}
.slip-logo {
    height: 56px;
    width: auto;
}
.slip-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #1e293b;
    align-self: center;
}

.slip-rule {
    border: none;
    border-top: 1px solid #cbd5e1;
    margin: 0 0 1.25rem 0;
}

/* FROM / SHIP TO two-column */
.slip-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 1.25rem;
}

.slip-col-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #94a3b8;
    margin-bottom: 0.4rem;
}
.slip-from-name { font-weight: 700; font-size: 0.9rem; margin-bottom: 0.25rem; }
.slip-from-addr { font-size: 0.82rem; color: #475569; line-height: 1.6; }

.slip-inv-details { margin-top: 1rem; }
.slip-inv-row {
    display: flex;
    gap: 0.75rem;
    font-size: 0.82rem;
    margin-bottom: 0.2rem;
}
.slip-inv-row span { color: #64748b; min-width: 70px; font-weight: 600; }
.slip-inv-row strong { color: #1e293b; }

.slip-shipto-name {
    font-weight: 800;
    font-size: 1.25rem;
    line-height: 1.2;
    margin-bottom: 0.4rem;
    color: #0f172a;
}
.slip-shipto-addr { font-size: 1rem; color: #334155; line-height: 1.6; }

/* Line items table */
.slip-lines {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}
.slip-lines th {
    padding: 0.45rem 0.6rem;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    color: #64748b;
    border-bottom: 1px solid #1e293b;
    border-top: 1px solid #1e293b;
}
.slip-lines td {
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.86rem;
    color: #334155;
    vertical-align: top;
}
.sl-qty { width: 50px; }
.sl-sku { width: 90px; white-space: nowrap; }
.sl-desc { }
.sl-num { text-align: right; white-space: nowrap; width: 100px; }

.slip-notes {
    background: #f8fafc;
    border-left: 3px solid #e2e8f0;
    padding: 0.75rem 1rem;
    border-radius: 0 6px 6px 0;
    margin-bottom: 1.5rem;
}
.slip-notes-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    margin-bottom: 0.3rem;
}
.slip-notes-text { font-size: 0.85rem; color: #475569; line-height: 1.5; }

.slip-footer {
    border-top: 1px solid #cbd5e1;
    padding-top: 0.75rem;
    margin-top: auto;  /* push to bottom of slip */
    font-size: 0.75rem;
    color: #94a3b8;
    text-align: center;
}

/* ═══════════════════════════════════════════════
   Print styles
   ═══════════════════════════════════════════════ */

@media print {
    @page { margin: 0; size: A4; }
    .no-print, .sidebar, .topbar, .view-header, .order-actions { display: none !important; }
    /* height: auto so the screen-only `height: 100%` doesn't resolve against
       the print viewport and push the page past A4 (which produced a blank
       second page on browser print). */
    body { overflow: visible; background: white; margin: 0; padding: 0; height: auto; }
    html { height: auto; }
    .app-shell { display: block; height: auto; }
    .main-wrap { overflow: visible; }
    .orders-view-inner, .orders-view-inner.slip-view {
        padding: 0; max-width: 100%; background: white;
        display: block; align-items: unset;
    }
    .packing-slip {
        box-shadow: none;
        border-radius: 0;
        padding: 14mm 18mm;
        width: 100%;
        min-height: auto;
        box-sizing: border-box;
    }
    .slip-lines td, .slip-lines th { padding: 0.4rem 0.5rem; }

    /* On the merged edit view, the slip lives inside a sidebar scaler.
       At print time we hide the form column, drop the scaler's clipping
       and the scale transform, and let the slip render full-width. */
    .edit-with-preview { display: block !important; }
    .edit-form-col, .event-log, .xero-push-banner, .edit-preview-label,
    .form-warn { display: none !important; }
    .edit-preview { position: static !important; display: block !important; }
    .edit-preview-scaler {
        width: auto !important; height: auto !important;
        overflow: visible !important;
    }
    .edit-preview-scaler .packing-slip {
        transform: none !important;
        box-shadow: none !important;
    }
}

/* ═══════════════════════════════════════════════
   Catalogue / Admin panel
   ═══════════════════════════════════════════════ */

.cat-section {
    background: var(--card-bg, white);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}
.cat-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}
.cat-title { font-size: 1rem; font-weight: 700; color: #1e293b; margin: 0 0 0.2rem 0; }
.cat-sub { font-size: 0.8rem; color: #94a3b8; margin: 0; }
.cat-actions { display: flex; gap: 0.5rem; align-items: center; }

.cat-upload-lbl {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.cat-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
    margin-bottom: 0.75rem;
}
.cat-table th {
    text-align: left;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid #e2e8f0;
}
.cat-table td {
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}
.cat-num { text-align: right; }
.cat-more { text-align: center; color: #94a3b8; font-style: italic; }

.cat-save-row { display: flex; justify-content: flex-end; }

.cat-format {
    font-size: 0.75rem;
    color: #94a3b8;
    margin: 0.75rem 0 0 0;
}
.cat-format code {
    background: #f1f5f9;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.73rem;
    color: #475569;
}

/* ── Price matrix ── */
.matrix-wrap { overflow-x: auto; margin-top: 0.75rem; }
.matrix-table {
    width: 100%; border-collapse: collapse;
    font-size: 0.8125rem;
}
.matrix-table thead th {
    text-align: left; font-size: 0.67rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: #64748b; padding: 0.4rem 0.5rem;
    border-bottom: 2px solid #e2e8f0; white-space: nowrap;
}
.matrix-th-id { width: 100px; }
.matrix-th-name { min-width: 200px; }
.matrix-th-center { width: 52px; text-align: center !important; }
.matrix-th-price { width: 100px; text-align: right !important; }
.matrix-row td { padding: 2px 3px; border-bottom: 1px solid #f8fafc; }
.matrix-cell-input {
    width: 100%; padding: 0.3rem 0.45rem; border: 1px solid transparent;
    border-radius: 4px; font-size: 0.8125rem; font-family: inherit;
    background: transparent; color: #1e293b;
    transition: border-color 0.12s, background 0.12s;
}
.matrix-cell-input:hover { border-color: #e2e8f0; background: white; }
.matrix-cell-input:focus { border-color: #3b82f6; background: white; outline: none; }
.matrix-price-input { text-align: right; font-variant-numeric: tabular-nums; }
.matrix-td-center { text-align: center; }
.matrix-del {
    background: none; border: none; cursor: pointer;
    color: #cbd5e1; font-size: 1rem; padding: 0.2rem 0.4rem; border-radius: 3px;
}
.matrix-del:hover { color: #ef4444; background: #fef2f2; }

/* Mobile: the read-only pricing matrix is 6 columns wide and is unusable
   on a phone. Stack each product into a label-value card so it's readable
   without horizontal scrolling. Editable variants still scroll. */
@media (max-width: 640px) {
    .matrix-wrap:has(> .matrix-table--readonly) { overflow-x: visible; }
    .matrix-table--readonly,
    .matrix-table--readonly tbody { display: block; width: 100%; }
    .matrix-table--readonly thead { display: none; }
    .matrix-table--readonly tr {
        display: block;
        padding: 0.75rem 0.9rem;
        background: white;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        margin-bottom: 0.55rem;
    }
    .matrix-table--readonly td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        padding: 0.3rem 0;
        border: none !important;
        gap: 0.75rem;
        font-size: 0.9rem;
    }
    .matrix-table--readonly td::before {
        content: attr(data-label);
        color: #94a3b8;
        font-size: 0.7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
    }
    .matrix-table--readonly td:nth-child(1) { font-weight: 700; color: #0f172a; font-size: 0.95rem; padding-bottom: 0.5rem; border-bottom: 1px solid #f1f5f9 !important; margin-bottom: 0.25rem; }
    .matrix-table--readonly td:nth-child(1)::before { content: 'SKU'; }
    .matrix-table--readonly td:nth-child(2)::before { content: 'Product'; }
    .matrix-table--readonly td:nth-child(3)::before { content: 'Unit price'; }
    .matrix-table--readonly td:nth-child(4)::before { content: '150+ kg'; }
    .matrix-table--readonly td:nth-child(5)::before { content: '500+ kg'; }
    .matrix-table--readonly td:nth-child(6)::before { content: '2,000+ kg'; }
    .matrix-table--readonly td.cat-num { font-variant-numeric: tabular-nums; }
}

/* ── Order number field ── */
.order-num-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}
.order-num-wrap:focus-within { border-color: #3b82f6; }
.order-num-prefix {
    padding: 0.5rem 0.6rem;
    background: #f8fafc;
    border-right: 1.5px solid #e2e8f0;
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 600;
    white-space: nowrap;
}
.order-num-wrap input {
    border: none !important;
    border-radius: 0 !important;
    flex: 1;
    min-width: 0;
}

/* ── Customer preset radio buttons ── */
.customer-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}
.customer-preset-opt {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    color: #334155;
    background: #fff;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    user-select: none;
}
.customer-preset-opt input[type="radio"] { display: none; }
.customer-preset-opt:hover { border-color: #94a3b8; }
.customer-preset-opt.selected,
.customer-preset-opt:has(input:checked) {
    border-color: #3b82f6;
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 600;
}

/* ── Order error banner ── */
.order-error-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 0.75rem 1.5rem 0;
    color: #dc2626;
    font-size: 0.875rem;
}
.order-error-banner button {
    background: none;
    border: none;
    cursor: pointer;
    color: #dc2626;
    font-size: 1rem;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

/* ── Edit order warning ── */
.form-warn {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #92400e;
    margin-bottom: 1.25rem;
}

/* ── Activity log ── */
.event-log {
    max-width: 794px;
    margin: 1rem auto 2rem;
    padding: 0 18mm;
}
.event-log-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    margin: 0 0 0.6rem;
}
.event-log-empty {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 0;
}
.event-list { display: flex; flex-direction: column; gap: 0.35rem; }
.event-item {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #475569;
    padding: 0.3rem 0;
    border-bottom: 1px solid #f1f5f9;
}
.event-who { font-weight: 600; color: #1e293b; }
.event-action { flex: 1; }
.event-detail { color: #8b5cf6; font-family: monospace; font-size: 0.75rem; }
.event-time { font-size: 0.73rem; color: #94a3b8; white-space: nowrap; }

.store-city {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-left: 0.5rem;
}

/* ═══════════════════════════════════════════════
   Warehouse / Stocktake
   ═══════════════════════════════════════════════ */

.wh-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 1.5rem;
}
.wh-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.12s, border-color 0.12s;
}
.wh-tab:hover { color: #334155; }
.wh-tab.active { color: #2563eb; border-bottom-color: #2563eb; }

.wh-empty { color: #94a3b8; font-size: 0.875rem; padding: 1rem 0; }

/* Sales tab table */
.sales-table-wrap {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.sales-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.sales-table thead th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    padding: 0.45rem 0.75rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}
.sales-table tbody td {
    padding: 0.38rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    white-space: nowrap;
}
.sales-table tbody tr:last-child td { border-bottom: none; }
.sales-table tbody tr:hover td { background: #f8fafc; }

.stk-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.25rem;
    align-items: start;
}
@media (max-width: 900px) {
    .stk-layout { grid-template-columns: 1fr; }
}

/* Stocktake editor controls */
.stk-date-input, .stk-label-input {
    padding: 0.38rem 0.65rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.83rem;
    font-family: inherit;
    color: #1a1a1a;
    outline: none;
    transition: border-color 0.15s;
}
.stk-date-input { width: 140px; }
.stk-label-input { width: 200px; }
.stk-date-input:focus, .stk-label-input:focus { border-color: #3b82f6; }

/* Stocktake table */
.stk-table-wrap { overflow-x: auto; margin-top: 0.5rem; }
.stk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
}
.stk-table th {
    text-align: left;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    padding: 0.35rem 0.5rem;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}
.stk-table td {
    padding: 0.2rem 0.25rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.stk-table input[type="text"],
.stk-table input[type="number"] {
    width: 100%;
    padding: 0.3rem 0.45rem;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.83rem;
    font-family: inherit;
    background: transparent;
    outline: none;
    transition: border-color 0.12s, background 0.12s;
}
.stk-table input[type="text"]:hover,
.stk-table input[type="number"]:hover { background: #f8fafc; border-color: #e2e8f0; }
.stk-table input[type="text"]:focus,
.stk-table input[type="number"]:focus { background: white; border-color: #3b82f6; }
.stk-inactive td { opacity: 0.4; }
.stk-inactive .stk-active { opacity: 1; }
.stk-net { font-weight: 600; color: #1e293b; }

.stk-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.5rem;
    margin-top: 0.5rem;
    border-top: 2px solid #e2e8f0;
    font-size: 0.9rem;
    color: #475569;
}
.stk-total-row strong { font-size: 1.1rem; color: #1e293b; }

/* Stocktake history panel */
.stk-right { display: flex; flex-direction: column; gap: 1rem; }
.stk-history { background: white; border-radius: 10px; padding: 1.25rem 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.stk-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #94a3b8;
    margin: 0 0 0.75rem;
}
.stk-chart {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 1rem;
}
.stk-hist-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
}
.stk-hist-table th {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    text-align: left;
    padding: 0.3rem 0.4rem;
    border-bottom: 1px solid #e2e8f0;
}
.stk-hist-table td {
    padding: 0.45rem 0.4rem;
    border-bottom: 1px solid #f8fafc;
    font-size: 0.82rem;
}
.stk-hist-link { color: #2563eb; text-decoration: none; font-weight: 500; }
.stk-hist-link:hover { text-decoration: underline; }
.stk-del-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #cbd5e1;
    font-size: 1rem;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    line-height: 1;
    transition: color 0.1s, background 0.1s;
}
.stk-del-btn:hover { color: #ef4444; background: #fee2e2; }

/* Catalogue header actions row (top-right group of export/admin links). */
.cat-header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* Bulk Edit tab — step-by-step flow + diff/error tables. */
.bulk-step {
    display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
    margin: 0.85rem 0;
}
.bulk-step strong { color: #64748b; font-weight: 600; min-width: 1.2rem; }
.bulk-step-hint  { font-size: 0.8rem; color: #94a3b8; }
.bulk-loading    { color: #64748b; font-size: 0.9rem; }
.bulk-error      { color: #b91c1c; font-size: 0.9rem; background: #fef2f2; border: 1px solid #fecaca; border-radius: 6px; padding: 0.6rem 0.85rem; }
.bulk-empty      { color: #94a3b8; font-size: 0.9rem; margin-top: 0.75rem; }
.bulk-summary {
    margin-top: 1rem; padding: 0.7rem 0.9rem;
    background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px;
    font-size: 0.88rem; color: #9a3412;
}
.bulk-summary--applied { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.bulk-backup { font-size: 0.78rem; }
.bulk-backup code { background: rgba(0,0,0,0.05); padding: 1px 4px; border-radius: 3px; }
.bulk-table-title { margin: 1rem 0 0.4rem; font-size: 0.95rem; font-weight: 600; color: #1e293b; }
.bulk-errors-title { color: #b91c1c; }
.bulk-table-wrap { max-height: 360px; overflow: auto; border: 1px solid #e2e8f0; border-radius: 6px; }
.bulk-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.bulk-table th, .bulk-table td { padding: 0.4rem 0.6rem; text-align: left; border-bottom: 1px solid #f1f5f9; }
.bulk-table th { background: #f8fafc; position: sticky; top: 0; font-weight: 600; color: #64748b; }
.bulk-fields { color: #475569; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; }
.bulk-err-row td { color: #b91c1c; }
.bulk-csvrow { color: #94a3b8; font-size: 0.75rem; }
.bulk-apply-bar { display: flex; align-items: center; gap: 0.75rem; margin-top: 1rem; }
.bulk-apply-hint { font-size: 0.78rem; color: #94a3b8; }
.bulk-num { text-align: right; font-variant-numeric: tabular-nums; }
.bulk-skip-list { margin: 0.4rem 0 0; padding-left: 1.25rem; font-size: 0.85rem; color: #64748b; }

/* Sales Data tab — two-card grid + collapsible admin section. */
.sd-download-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}
.sd-download-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.1rem 1.2rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    text-decoration: none;
    color: inherit;
    transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.sd-download-card:hover {
    transform: translateY(-2px);
    border-color: #2563eb;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
}
.sd-download-title { font-size: 1rem; font-weight: 700; color: #1e293b; }
.sd-download-desc  { font-size: 0.82rem; color: #64748b; line-height: 1.4; }
.sd-admin { margin-top: 0.5rem; padding: 0 1rem; }
.sd-admin > summary {
    list-style: none; cursor: pointer; padding: 0.75rem 0;
    display: flex; gap: 0.5rem; align-items: center;
}
.sd-admin > summary::-webkit-details-marker { display: none; }
.sd-admin > summary::before {
    content: '▸'; color: #94a3b8; transition: transform 0.15s; display: inline-block;
}
.sd-admin[open] > summary::before { transform: rotate(90deg); }
.sd-admin-body { padding: 0.5rem 0 1rem; }

/* ── Stores (Catalogue) editable table ── */
.store-table-wrap { overflow-x: auto; }
.store-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.store-table th {
    background: #f8fafc; text-align: left; padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #e2e8f0; font-weight: 600; color: #64748b; font-size: 0.75rem;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.store-table td { padding: 0.25rem 0.35rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.store-row--archived td { opacity: 0.5; background: #f8fafc; }
.store-cell {
    width: 100%; box-sizing: border-box;
    padding: 0.35rem 0.5rem; border: 1px solid transparent; border-radius: 4px;
    background: transparent; font-size: 0.85rem; color: #1e293b;
    transition: border-color 0.12s, background 0.12s;
}
.store-cell:hover  { background: #f8fafc; border-color: #e2e8f0; }
.store-cell:focus  { outline: none; background: white; border-color: #3b82f6; box-shadow: 0 0 0 2px #3b82f622; }
.store-cell:disabled { opacity: 0.5; }
.store-id-cell { white-space: nowrap; }
.store-src {
    display: inline-block; margin-left: 0.35rem; padding: 0 0.35rem;
    font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em;
    background: #f1f5f9; color: #64748b; border-radius: 3px;
}
.store-src--hub { background: #ddd6fe; color: #5b21b6; }
.store-actions-cell { white-space: nowrap; text-align: right; }
.store-toggle-archived {
    display: inline-flex; align-items: center; gap: 0.3rem;
    font-size: 0.8rem; color: #64748b; cursor: pointer;
}
.store-toggle-archived input { margin: 0; }

/* Catalogue section dim tag */
.cat-dim { color: #cbd5e1 !important; }

/* ═══════════════════════════════════════════════
   Imports tab
   ═══════════════════════════════════════════════ */

/* Imports tab bar */
.imp-tabs { display: flex; gap: 0.4rem; margin-bottom: 1.25rem; }

/* Chart */
.imp-chart-card { margin-bottom: 1.25rem; }
.imp-chart { width: 100%; height: auto; display: block; margin-top: 0.5rem; overflow: visible; }

/* Scenario toggle */
.imp-scenario-wrap { display: flex; gap: 2px; background: #f1f5f9; border-radius: 6px; padding: 2px; }
.imp-scenario-btn {
    background: none; border: none; border-radius: 5px;
    padding: 0.3rem 0.7rem; font-size: 0.78rem; font-weight: 500;
    color: #64748b; cursor: pointer; font-family: inherit;
    transition: background 0.12s, color 0.12s;
}
.imp-scenario-btn:hover { color: #334155; }
.imp-scenario-btn.active { background: white; color: #2563eb; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

/* ── Forecast row status highlighting ── */
.imp-row--low td { background: #fffbeb; }
.imp-row--critical td { background: #fef2f2; }
.imp-row--low .imp-td-month { color: #92400e; }
.imp-row--critical .imp-td-month { color: #991b1b; font-weight: 700; }

/* ── Upcoming import event cards (details/summary) ──
   Single column, full-width stacked vertically — gives each card room to
   show the shipment journey timeline. */
.imp-events-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.25rem;
}
.imp-events-grid > .imp-event-card { width: 100%; }
.imp-events-grid--past { opacity: 0.8; }

.imp-event-card {
    background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px;
}
.imp-event-card--past { background: #f8fafc; border-color: #e2e8f0; }
.imp-event-card summary { list-style: none; }
.imp-event-card summary::-webkit-details-marker { display: none; }

.imp-event-card-summary {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 0.7rem 0.85rem; cursor: pointer; gap: 0.5rem; border-radius: 8px;
}
.imp-event-card-summary:hover { background: rgba(0,0,0,0.02); }
.imp-event-card[open] .imp-event-card-summary { border-bottom: 1px solid #bfdbfe; border-radius: 8px 8px 0 0; }
.imp-event-card--past[open] .imp-event-card-summary { border-bottom-color: #e2e8f0; }

.imp-event-title { font-size: 0.95rem; font-weight: 700; color: #1e293b; margin-bottom: 1px; }
.imp-event-card--past .imp-event-title { color: #475569; }
.imp-event-month { font-size: 0.72rem; font-weight: 600; color: #64748b; margin-bottom: 2px; }
.imp-event-card--past .imp-event-month { color: #94a3b8; }
.imp-event-qty { font-size: 1rem; font-weight: 700; color: #1e293b; margin-bottom: 2px; }
.imp-event-note { font-size: 0.75rem; color: #64748b; margin-top: 1px; }

.imp-year-divider td {
    padding: 0.35rem 0.5rem; font-size: 0.72rem; font-weight: 700; color: #94a3b8;
    text-transform: uppercase; letter-spacing: 0.06em; background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}
.imp-incoming-link {
    background: none; border: none; padding: 0; margin: 0; cursor: pointer;
    font: inherit; font-weight: 700; color: #2563eb; font-size: inherit;
    text-decoration: underline; text-decoration-style: dotted;
    text-underline-offset: 2px;
}
.imp-incoming-link:hover { color: #1d4ed8; text-decoration-style: solid; }

.imp-card-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.imp-milestone-progress {
    font-size: 0.7rem; font-weight: 700; color: #64748b;
    background: #f1f5f9; border-radius: 10px; padding: 0.1rem 0.4rem;
}
.imp-price-badge {
    font-size: 0.7rem; font-weight: 700; color: #1e40af;
    background: #dbeafe; border-radius: 10px; padding: 0.1rem 0.4rem;
}

.imp-event-card-detail {
    padding: 0.75rem 0.85rem; display: flex; flex-direction: column; gap: 0.65rem;
}

/* Add-shipment form grid */
.imp-add-form-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 0.75rem;
}

/* Shipment pricing fields */
.imp-pricing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 0.75rem; }
.imp-pricing-field { display: flex; flex-direction: column; gap: 3px; }
.imp-field-label { font-size: 0.72rem; font-weight: 600; color: #64748b; }
.imp-total-cost { font-size: 0.78rem; color: #1e40af; margin: 0; }

.imp-ship-del {
    background: none; border: 1px solid #fecaca; color: #ef4444;
    border-radius: 4px; padding: 0.25rem 0.6rem; cursor: pointer;
    font-size: 0.75rem; font-family: inherit; align-self: flex-start;
}
.imp-ship-del:hover { background: #fef2f2; }

.imp-acct-tag {
    display: inline-block; background: #dbeafe; color: #1e40af;
    font-size: 0.72rem; font-weight: 600; border-radius: 4px;
    padding: 0.1rem 0.4rem; margin-right: 4px;
}
.imp-event-fy {
    font-size: 0.68rem; font-weight: 700; color: #93c5fd;
    text-transform: uppercase; letter-spacing: 0.05em;
}

/* Monthly schedule table */
.imp-table-wrap { overflow-x: auto; max-height: 480px; overflow-y: auto; }
.imp-table {
    width: 100%; border-collapse: collapse;
    font-size: 0.8rem; min-width: 560px;
}
.imp-table th { position: sticky; top: 0; background: white; z-index: 1; }
.imp-th-month, .imp-table th {
    text-align: left; font-size: 0.67rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: #64748b; padding: 0.4rem 0.5rem;
    border-bottom: 2px solid #e2e8f0; white-space: nowrap;
}
.imp-th-num { text-align: right !important; }
.imp-th-incoming { color: #2563eb !important; }

.imp-row td { padding: 0.28rem 0.5rem; border-bottom: 1px solid #f8fafc; }
.imp-td-period { white-space: nowrap; }
.imp-td-month { font-weight: 500; white-space: nowrap; }
.imp-td-num { text-align: right; font-variant-numeric: tabular-nums; }
.imp-past td { color: #94a3b8; }
.imp-past .imp-td-month { color: #cbd5e1; }
.imp-today { background: #fefce8; }
.imp-today .imp-td-month { font-weight: 700; color: #92400e; }
.imp-has-import { background: #eff6ff; }
.imp-has-import .imp-td-month { font-weight: 700; }
.imp-incoming-val { color: #2563eb; font-weight: 700; }
.imp-acct-val { color: #7c3aed; font-weight: 600; }
.imp-stock { font-weight: 600; color: #1e293b; }
.imp-stocktake { color: #059669; font-weight: 700; }
.imp-fy-badge {
    display: inline-block; font-size: 0.65rem; font-weight: 700;
    background: #f1f5f9; color: #64748b; border-radius: 3px;
    padding: 0.1rem 0.35rem; white-space: nowrap;
}

/* Shipment Analytics */
.sa-block { display: flex; flex-direction: column; gap: 1rem; }
.sa-hd { display: flex; flex-direction: column; gap: 0.15rem; margin-bottom: 0.25rem; }
.sa-card {
    border: 1px solid #e2e8f0; border-radius: 8px;
    background: white; overflow: hidden;
}
.sa-card-hd {
    display: flex; align-items: baseline; justify-content: space-between;
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid #eef2f7; background: #f8fafc;
    gap: 0.75rem; flex-wrap: wrap;
}
.sa-card-title {
    font-size: 0.78rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: #475569; margin: 0;
}
.sa-card-sub { font-size: 0.72rem; color: #94a3b8; }
.sa-card-body { padding: 0.6rem 0.85rem; }
.sa-card-body--wide { padding: 0; overflow-x: auto; }
.sa-card-body--wide .sa-table { min-width: 720px; }

/* Analytics tables */
.sa-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.sa-table thead th {
    text-align: left; font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: #64748b; padding: 0.4rem 0.6rem;
    border-bottom: 1px solid #e2e8f0; white-space: nowrap;
}
.sa-th-num { text-align: right !important; }
.sa-table tbody td, .sa-table tfoot td {
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
}
.sa-table tbody tr:last-child td { border-bottom: none; }
.sa-td-num { text-align: right; font-variant-numeric: tabular-nums; color: #334155; }
.sa-td-emph { color: #0f172a; font-weight: 600; }
.sa-td-na { color: #cbd5e1; }
.sa-td-default { color: #94a3b8; }
.sa-td-ship { font-weight: 600; color: #1e293b; }
.sa-tag-hist {
    display: inline-block; margin-left: 0.4rem;
    padding: 0.05rem 0.4rem; border-radius: 999px;
    background: #f1f5f9; color: #94a3b8;
    font-size: 0.62rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.sa-tr-foot td {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    font-weight: 500;
}
.sa-tr-default td { font-style: italic; }

/* % of Total stacked rows */
.sa-pct-rows { display: flex; flex-direction: column; gap: 0.4rem; }
.sa-pct-row {
    display: grid;
    grid-template-columns: 56px 1fr 100px;
    align-items: center;
    column-gap: 0.7rem;
    font-size: 0.78rem;
}
.sa-pct-label { font-weight: 600; color: #1e293b; }
.sa-pct-bar {
    display: flex; height: 16px;
    border-radius: 4px; overflow: hidden;
    background: #f1f5f9;
}
.sa-pct-seg { height: 100%; transition: filter 0.12s; }
.sa-pct-seg:hover { filter: brightness(0.92); }
.sa-pct-row--empty .sa-pct-bar {
    background: transparent; padding: 0 0.5rem; align-items: center;
}
.sa-pct-total {
    font-variant-numeric: tabular-nums;
    text-align: right; color: #475569;
}
.sa-pct-legend {
    display: flex; flex-wrap: wrap;
    gap: 0.4rem 0.85rem;
    margin-top: 0.7rem;
    font-size: 0.74rem; color: #64748b;
}
.sa-pct-leg-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.sa-pct-leg-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* Imports tabs */
.imp-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 1rem;
}
.imp-tab-btn {
    background: none;
    border: none;
    padding: 0.55rem 0.95rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.imp-tab-btn:hover { color: #1e293b; }
.imp-tab-btn--active { color: #1e293b; border-bottom-color: #3b82f6; }
.imp-tab-pane--hidden { display: none; }

/* Show more / less in analytics cards */
.sa-row-extra { display: none !important; }
.sa-card--expanded .sa-row-extra { display: revert !important; }
.sa-card-foot {
    padding: 0.5rem 0 0.25rem;
    text-align: center;
    border-top: 1px solid #f1f5f9;
    margin-top: 0.4rem;
}

/* Monthly forecast — title row with annual Est. Sales chip */
.imp-table-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.75rem; margin-bottom: 0.75rem; flex-wrap: wrap;
}
.imp-annual-chip {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.3rem 0.65rem;
    border: 1px solid #e2e8f0; border-radius: 999px;
    background: #f8fafc;
    font-size: 0.78rem;
}
.imp-annual-chip-lbl { color: #64748b; }
.imp-annual-chip-val {
    color: #0f172a; font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Live connection status */
.imp-connect-status {
    display: flex; align-items: center; gap: 0.4rem;
    font-size: 0.75rem; color: #059669; margin: 0.25rem 0 0.75rem;
}
.imp-connect-status svg { color: #059669; flex-shrink: 0; }
.imp-connect-error { color: #dc2626; }
.imp-connect-error svg { color: #dc2626; }

/* Connect panel */
.imp-connect-panel {
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px;
    padding: 1.1rem 1.25rem; margin: 1rem 0 0;
}
.imp-connect-title {
    font-size: 0.82rem; font-weight: 700; color: #1e293b; margin: 0 0 0.6rem;
}
.imp-connect-steps {
    font-size: 0.82rem; color: #475569; padding-left: 1.25rem;
    margin: 0 0 0.85rem; line-height: 1.8;
}
.imp-connect-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.imp-url-input {
    flex: 1; min-width: 260px;
    padding: 0.42rem 0.7rem; border: 1px solid #e2e8f0; border-radius: 6px;
    font-size: 0.83rem; font-family: monospace; color: #1a1a1a;
    outline: none; background: white;
    transition: border-color 0.15s;
}
.imp-url-input:focus { border-color: #3b82f6; }
.imp-connect-note {
    font-size: 0.75rem; color: #94a3b8; margin: 0.6rem 0 0;
    display: flex; gap: 0.35rem; align-items: flex-start;
}

/* ── Forecast status dots ── */
.fcst-dot {
    display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle;
}
.fcst-dot--ok       { background: #10b981; }
.fcst-dot--low      { background: #f59e0b; }
.fcst-dot--critical { background: #ef4444; }
.fcst-negative { color: #ef4444; font-weight: 700; }

/* ── Monthly Sales Averages matrix ── */
.fcst-matrix-wrap {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.fcst-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.fcst-matrix th,
.fcst-matrix td {
    padding: 0.5rem 0.85rem;
    text-align: right;
    border-bottom: 1px solid #f1f5f9;
    font-variant-numeric: tabular-nums;
}
.fcst-matrix thead th {
    background: #f8fafc;
    font-weight: 600;
    color: #64748b;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
}
.fcst-matrix .fcst-matrix-mo {
    text-align: left;
    color: #1e293b;
    font-weight: 600;
}
.fcst-matrix thead .fcst-matrix-mo { color: #64748b; }
.fcst-matrix .fcst-matrix-num--edit {
    background: #fefce8;
}
.fcst-matrix thead .fcst-matrix-num--edit { background: #fef9c3; }
.fcst-matrix .fcst-matrix-num--accent {
    color: #047857;
    font-weight: 600;
}
.fcst-matrix .fcst-matrix-mult {
    font-size: 0.7rem;
    font-weight: 500;
    color: #94a3b8;
    margin-left: 0.25rem;
    text-transform: none;
    letter-spacing: 0;
}
.fcst-matrix .fcst-avg-input {
    width: 100%;
    max-width: 110px;
    padding: 0.25rem 0.4rem;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background: white;
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.fcst-matrix .fcst-avg-input:focus { outline: none; border-color: #3b82f6; }
.fcst-matrix tfoot .fcst-matrix-totals td {
    background: #f1f5f9;
    border-top: 2px solid #cbd5e1;
    border-bottom: none;
    font-weight: 700;
    font-size: 0.92rem;
    color: #0f172a;
}
.fcst-matrix tfoot .fcst-matrix-num--accent { color: #047857; }

/* ── Shipment card extras ── */
.imp-event-note { font-size: 0.75rem; color: #64748b; margin-top: 2px; }
.imp-ship-del {
    position: absolute; top: 0.45rem; right: 0.5rem;
    background: none; border: none; cursor: pointer;
    color: #94a3b8; font-size: 1rem; line-height: 1; padding: 0;
}
.imp-ship-del:hover { color: #ef4444; }

/* ── Inline link button ── */
.btn-link {
    background: none; border: none; cursor: pointer;
    color: #3b82f6; font-size: 0.8125rem; font-family: inherit;
    padding: 0 0.25rem; text-decoration: underline; text-underline-offset: 2px;
}
.btn-link:hover { color: #2563eb; }

/* ── FX rates panel (Imports page, light background) ── */
.fx-rates-panel .currency-date {
    font-size: 0.75rem; color: #94a3b8; margin-bottom: 0.75rem;
}
.fx-rates-panel .currency-pairs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}
.fx-rates-panel .currency-pair {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    display: flex; flex-direction: column; gap: 0.2rem;
}
.fx-rates-panel .currency-code {
    font-size: 0.75rem; font-weight: 700; color: #64748b;
    letter-spacing: 0.06em; text-transform: uppercase;
}
.fx-rates-panel .currency-rate {
    font-size: 1.25rem; font-weight: 600; color: #1e293b;
}
.fx-rates-panel .sparkline { display: block; margin-top: 0.5rem; width: 100%; height: 28px; overflow: visible; }
.fx-rates-panel .sparkline-up polyline { stroke: #10b981; }
.fx-rates-panel .sparkline-down polyline { stroke: #ef4444; }
.fx-rates-panel .currency-loading {
    font-size: 0.8rem; color: #94a3b8; font-style: italic;
}

/* Chart.js sparkline wrapper — needs overflow:visible so the external
   tooltip can extend above the 38px canvas without being clipped.
   width:100% + min-width:0 stop the canvas's default 300px intrinsic
   width from forcing the parent grid track wider than its container. */
.fx-spark-wrap {
    position: relative;
    width: 100%;
    min-width: 0;
    height: 38px;
    margin-top: 6px;
    overflow: visible;
}
.fx-spark-tt {
    position: absolute;
    transform: translate(-50%, -100%);
    margin-top: -10px;
    padding: 4px 7px;
    background: #0f172a;
    color: white;
    border-radius: 4px;
    font-size: 0.7rem;
    line-height: 1.3;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s;
    z-index: 5;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}
.fx-spark-tt-label { color: #94a3b8; font-size: 0.62rem; letter-spacing: 0.02em; }
.fx-spark-tt-val { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Sales charts grid ── */
.sales-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}
.sales-chart-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem 1.1rem;
}
.sales-chart-placeholder {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    min-height: 140px;
    border: 1.5px dashed #e2e8f0;
    border-radius: 6px;
    background: white;
}

/* Milestone tracker in shipment cards */
.imp-milestones { margin-top: 0.6rem; border-top: 1px solid #e2e8f0; padding-top: 0.5rem; display: flex; flex-direction: column; gap: 0.3rem; }
.imp-milestone { display: flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; color: #475569; cursor: pointer; line-height: 1.4; }
.imp-milestone--done .imp-milestone-label { text-decoration: line-through; color: #94a3b8; }
.imp-milestone-check { cursor: pointer; flex-shrink: 0; accent-color: #10b981; }
.imp-milestone-label { flex: 1; }
.imp-milestone-date { font-size: 0.7rem; color: #94a3b8; white-space: nowrap; }

/* Actual sales column in forecast table */
.imp-actual-val { color: #0f172a; font-weight: 600; }

/* Version badge */
.fcst-version { font-size: 0.72rem; font-weight: 500; color: #94a3b8; background: #f1f5f9; border-radius: 4px; padding: 1px 6px; margin-left: 6px; vertical-align: middle; }

/* Shipment view toggle (Cards / Matrix) */
.imp-view-btn { background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 5px; padding: 0.2rem 0.6rem; font-size: 0.78rem; cursor: pointer; color: #64748b; }
.imp-view-btn.active { background: #1e40af; color: white; border-color: #1e40af; }

/* Milestone matrix table */
.imp-matrix-wrap { overflow-x: auto; margin-top: 0.25rem; }
.imp-matrix-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.imp-matrix-table th { background: #f8fafc; font-weight: 600; color: #475569; padding: 0.4rem 0.5rem; border-bottom: 2px solid #e2e8f0; text-align: left; white-space: nowrap; }
.imp-matrix-table td { padding: 0.35rem 0.5rem; border-bottom: 1px solid #f1f5f9; color: #1e293b; }
.imp-matrix-stage { color: #64748b; font-size: 0.75rem; white-space: nowrap; }
.imp-matrix-row--arrive td { background: #eff6ff; font-weight: 600; border-top: 1px solid #bfdbfe; }

/* ── Imports overview 2-column layout ──
   minmax(0, 1fr) on the main column prevents min-content children
   (charts, tables) from blowing out the grid and pushing the side
   panel past the page edge. The side column is widened so FX values
   like "0.5234" and "72.4500" fit without clipping. */
.imp-overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 1.25rem;
    align-items: start;
}
.imp-overview-main { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.imp-overview-main .imp-chart-card { margin-bottom: 0; }
.imp-overview-side { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.imp-overview-side .cat-section { min-width: 0; max-width: 100%; box-sizing: border-box; }

/* ── Forex rate tiles ── */
.imp-fx-panel { padding: 1rem 1.1rem !important; }
.imp-fx-header {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 0.9rem;
}
.imp-fx-base-tag {
    font-size: 0.75rem; color: #94a3b8; font-style: italic;
}
.imp-fx-grid {
    display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.45rem;
}
.imp-fx-tile {
    background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 8px; padding: 0.6rem 0.85rem 0.5rem;
    min-width: 0;
}
.imp-fx-tile > * { min-width: 0; }
.fx-spark-wrap canvas { max-width: 100%; }
.imp-fx-tile-header {
    display: flex; justify-content: space-between; align-items: baseline;
}
.imp-fx-tile-code {
    font-size: 0.72rem; font-weight: 800; color: #1e293b;
    text-transform: uppercase; letter-spacing: 0.07em;
}
.imp-fx-tile-rate {
    font-size: 1.05rem; font-weight: 700; color: #1e293b;
    letter-spacing: -0.02em;
}
.imp-fx-tile-name {
    font-size: 0.61rem; color: #94a3b8; margin-top: 1px;
}
.imp-fx-date {
    font-size: 0.68rem; color: #cbd5e1; margin: 0.75rem 0 0;
    text-align: right;
}

@media (max-width: 900px) {
    .imp-overview-grid { grid-template-columns: 1fr; }
}

/* ── Sales History filter bar ── */
.sales-filter-bar {
    display: flex; flex-wrap: wrap; gap: 0.4rem;
    margin-bottom: 1.25rem; align-items: center;
}
.sales-filter-sel {
    padding: 0.35rem 0.55rem; border: 1px solid #e2e8f0;
    border-radius: 6px; font-size: 0.8125rem; font-family: inherit;
    color: #1e293b; background: white; cursor: pointer;
    outline: none; transition: border-color 0.15s;
}
.sales-filter-sel:focus { border-color: #3b82f6; }

/* ── Sales annual data table ── */
.sales-data-tbl { min-width: 300px; }
.sales-tbl-month {
    font-weight: 500; color: #475569; white-space: nowrap;
    padding: 0.3rem 0.5rem;
}
.sales-tbl-num {
    text-align: right; font-variant-numeric: tabular-nums;
    padding: 0.3rem 0.5rem; color: #1e293b;
}
.sales-tbl-total {
    font-weight: 700; border-top: 2px solid #e2e8f0;
    color: #1e293b;
}

/* ── Shipment cost breakdown ── */
.imp-cost-section {
    border-top: 1px solid #e2e8f0; padding-top: 0.65rem; margin-top: 0.1rem;
}
.imp-cost-header {
    font-size: 0.72rem; font-weight: 700; color: #64748b;
    margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.4rem;
}
.imp-cost-currency {
    font-size: 0.65rem; font-weight: 500; color: #94a3b8;
    background: #f1f5f9; border-radius: 3px; padding: 1px 5px;
}
.imp-cost-grid {
    display: grid; grid-template-columns: auto 1fr;
    gap: 0.3rem 0.5rem; align-items: center; margin-bottom: 0.5rem;
}
.imp-cost-label {
    font-size: 0.75rem; color: #64748b; white-space: nowrap;
}
.imp-cost-input {
    min-width: 0 !important; padding: 0.3rem 0.45rem !important;
    font-size: 0.8rem !important; text-align: right;
}
.imp-cost-total {
    font-size: 0.78rem; color: #1e40af; margin: 0;
}
.imp-cost-total--empty {
    color: #94a3b8; font-style: italic; font-weight: 400;
}

/* ── Shipment cost breakdown v2 (line-item tracker) ── */
.imp-cost-v2 {
    border-top: 1px solid #e2e8f0; padding-top: 0.75rem; margin-top: 0.1rem;
    display: flex; flex-direction: column; gap: 0.5rem;
}
.imp-cost-v2-hdr {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
    margin-bottom: 0.25rem;
}
.imp-cost-v2-title {
    font-size: 0.72rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em;
}
.imp-cost-v2-fxbar {
    display: flex; gap: 0.5rem; font-size: 0.65rem; color: #94a3b8; flex-wrap: wrap; flex: 1;
}
.imp-cost-v2-fxbar span { white-space: nowrap; }
.imp-cost-v2-fxbar strong { color: #475569; }

.imp-cl-cat { margin-bottom: 0.5rem; }
.imp-cl-cat-hd {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.2rem 0; margin-bottom: 0.2rem;
}
.imp-cl-cat-name {
    font-size: 0.72rem; font-weight: 700; color: #334155;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.imp-cl-cat-sum {
    font-size: 0.7rem; color: #64748b; font-weight: 600; margin-left: 0.25rem;
}
.imp-cl-cat-os { color: #d97706; }

.imp-cl-table {
    width: 100%; border-collapse: collapse; font-size: 0.75rem;
    margin-bottom: 0.1rem;
}
.imp-cl-table thead th {
    font-size: 0.6rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: #94a3b8; padding: 0.2rem 0.3rem;
    border-bottom: 1px solid #f1f5f9; text-align: left;
}
.imp-cl-th-amt  { width: 160px; }
.imp-cl-th-nzd  { width: 80px; text-align: right !important; }
.imp-cl-th-paidvia { width: 110px; }
.imp-cl-th-chk  { width: 24px; text-align: center !important; }

.imp-cl-row td { padding: 0.2rem 0.3rem; border-bottom: 1px solid #f8fafc; vertical-align: middle; }
.imp-cl-paid-row td { background: #f0fdf4; }
.imp-cl-paid-row .imp-cl-inp { color: #64748b; }

.imp-cl-inp {
    width: 100%; padding: 0.2rem 0.35rem; border: 1px solid transparent;
    border-radius: 4px; font-size: 0.75rem; font-family: inherit;
    background: transparent; outline: none; color: #1e293b;
    transition: border-color 0.12s, background 0.12s;
}
.imp-cl-inp:hover { border-color: #e2e8f0; background: white; }
.imp-cl-inp:focus { border-color: #3b82f6; background: white; }

.imp-cl-td-amt { display: flex; align-items: center; gap: 3px; }
.imp-cl-num {
    width: 72px; padding: 0.2rem 0.3rem; border: 1px solid transparent;
    border-radius: 4px; font-size: 0.75rem; font-family: inherit; text-align: right;
    background: transparent; outline: none; color: #1e293b;
    transition: border-color 0.12s, background 0.12s;
}
.imp-cl-num:hover { border-color: #e2e8f0; background: white; }
.imp-cl-num:focus { border-color: #3b82f6; background: white; }
.imp-cl-ccy {
    border: 1px solid transparent; border-radius: 4px; font-size: 0.7rem;
    background: transparent; color: #64748b; padding: 0.15rem 0.1rem;
    outline: none; cursor: pointer; width: 52px;
    transition: border-color 0.12s;
}
.imp-cl-ccy:hover, .imp-cl-ccy:focus { border-color: #e2e8f0; background: white; }

.imp-cl-paidvia { font-size: 0.72rem; color: #64748b; }

.imp-cl-td-nzd { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.imp-cl-td-nzd span { font-size: 0.75rem; color: #1e293b; font-weight: 600; }
.imp-cl-nil { color: #e2e8f0 !important; font-weight: 400 !important; }
.imp-cl-fxtag {
    display: block; font-size: 0.58rem; color: #94a3b8;
}

.imp-cl-td-chk { text-align: center; }
.imp-cl-paid { accent-color: #10b981; cursor: pointer; }

.imp-cl-del {
    background: none; border: none; color: #cbd5e1;
    cursor: pointer; font-size: 0.85rem; padding: 0 2px; line-height: 1;
}
.imp-cl-del:hover { color: #ef4444; }

.imp-cost-v2-totals {
    border-top: 2px solid #e2e8f0; padding-top: 0.45rem; margin-top: 0.25rem;
    display: flex; flex-direction: column; gap: 0.15rem;
}
.imp-cv2-row {
    display: flex; align-items: baseline; gap: 0.5rem;
    font-size: 0.75rem; color: #64748b;
}
.imp-cv2-total { font-size: 0.82rem; color: #1e293b; }
.imp-cv2-total strong { font-size: 1rem; color: #1e293b; }
.imp-cv2-paid-row { color: #10b981; }
.imp-cv2-os-row { color: #d97706; font-weight: 600; }
.imp-cv2-done-row { color: #10b981; font-size: 0.72rem; }
.imp-cost-ppkg {
    font-size: 0.7rem; color: #64748b; background: #f1f5f9;
    border-radius: 4px; padding: 1px 5px; margin-left: 4px;
}

.imp-cost-v2-empty {
    display: flex; flex-direction: column; gap: 0.5rem;
    align-items: flex-start; padding: 0.35rem 0;
}
.imp-cost-v2-empty > span { font-size: 0.75rem; color: #94a3b8; }
.imp-cost-v2-defaults { display: flex; gap: 0.3rem; flex-wrap: wrap; }

/* ── Nav badge (pending order count) ── */
.nav-badge {
    background: #ef4444; color: white;
    font-size: 0.62rem; font-weight: 700;
    border-radius: 10px; padding: 1px 6px;
    margin-left: auto; line-height: 1.6;
    min-width: 18px; text-align: center;
    flex-shrink: 0;
}

/* ── Dashboard alerts panel ── */
.db-alerts {
    background: white; border: 1px solid #fecaca;
    border-radius: 10px; padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}
.db-alerts-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.6rem;
}
.db-alerts-title {
    font-size: 0.72rem; font-weight: 800; color: #dc2626;
    text-transform: uppercase; letter-spacing: 0.06em;
}
.db-alerts-count { font-size: 0.75rem; color: #ef4444; font-weight: 600; }
.db-alerts-list { display: flex; flex-direction: column; gap: 0.3rem; }
.db-alert-item {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.42rem 0.6rem; border-radius: 6px;
    text-decoration: none; color: inherit;
    background: #fef2f2; transition: background 0.1s;
}
.db-alert-item:hover { background: #fee2e2; }
.db-alert-label { flex: 1; font-size: 0.8rem; font-weight: 500; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-alert-status {
    font-size: 0.67rem; font-weight: 700; border-radius: 4px;
    padding: 1px 6px; white-space: nowrap;
}
.db-alert-status--new      { background: #dbeafe; color: #1e40af; }
.db-alert-status--reviewed { background: #fef9c3; color: #92400e; }
.db-alert-meta { font-size: 0.72rem; color: #94a3b8; white-space: nowrap; }
.db-alert-more { font-size: 0.75rem; color: #94a3b8; padding: 0.25rem 0.5rem; }
.db-alert-more a { color: #3b82f6; }

/* ── FX tile sparklines ── */
.imp-fx-tile .sparkline {
    display: block; width: 100%; height: 34px; margin-top: 0.35rem; overflow: visible;
}
.imp-fx-tile .sparkline-up polyline   { stroke: #10b981; }
.imp-fx-tile .sparkline-down polyline { stroke: #ef4444; }

/* ── Sparkline hover dots ── */
.sparkline-pt .sparkline-dot { opacity: 0; transition: opacity 0.1s; }
.sparkline-pt:hover .sparkline-dot { opacity: 1; }
.sparkline-up .sparkline-dot   { fill: #10b981; }
.sparkline-down .sparkline-dot { fill: #ef4444; }

/* ── SVG chart hover interactions ── */
.chart-bar { cursor: pointer; transition: opacity 0.08s, filter 0.08s; }
.chart-bar:hover { opacity: 1 !important; filter: brightness(1.14); }
.chart-dot { opacity: 0.15; transition: opacity 0.15s; }
.chart-pt:hover .chart-dot { opacity: 1; }

/* ── Order status dropdown ── */
.order-status-sel {
    padding: 0.28rem 0.6rem; border: 1px solid #e2e8f0;
    border-radius: 6px; font-size: 0.8rem; font-family: inherit;
    color: #1e293b; background: white; cursor: pointer;
    outline: none; transition: border-color 0.15s;
}
.order-status-sel:focus { border-color: #3b82f6; }

/* ── Calendar: two-pane layout ── */
.cal-gcal-status--on { font-size: 0.75rem; color: #10b981; font-weight: 600; }

.cal-layout {
    display: flex; gap: 1.25rem; align-items: flex-start;
}
.cal-detail-pane { flex: 0 0 62%; min-width: 0; }
.cal-sidebar-pane {
    flex: 1; min-width: 0;
    max-height: calc(100vh - 180px); overflow-y: auto;
    display: flex; flex-direction: column; gap: 0.3rem;
    position: sticky; top: 0;
}

/* Detail header */
.cal-detail-head { display: flex; flex-direction: column; gap: 0.65rem; margin-bottom: 0.85rem; }
.cal-detail-nav  { display: flex; align-items: center; gap: 0.6rem; }
.cal-detail-title {
    flex: 1; text-align: center;
    font-size: 1.15rem; font-weight: 700; color: #1e293b; margin: 0;
}
.cal-nav-btn {
    background: white; border: 1px solid #e2e8f0; border-radius: 6px;
    width: 28px; height: 28px; cursor: pointer; font-size: 1.15rem; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    color: #64748b; flex-shrink: 0; transition: border-color 0.12s;
}
.cal-nav-btn:hover { border-color: #3b82f6; color: #2563eb; }

.cal-controls-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.5rem; flex-wrap: wrap;
}
.cal-toggles { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.cal-toggle-btn {
    display: flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 12px;
    border: 1px solid #e2e8f0; background: white;
    cursor: pointer; font-size: 0.68rem; font-weight: 600; color: #94a3b8;
    transition: all 0.12s; font-family: inherit;
}
.cal-toggle-btn.active { background: #f8fafc; color: #1e293b; border-color: #cbd5e1; }
.cal-td { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cal-td--holiday  { background: #3b82f6; }
.cal-td--tax      { background: #f97316; }
.cal-td--shipment { background: #22c55e; }
.cal-td--gcal     { background: #8b5cf6; }

/* Day grid */
.cal-day-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden;
}
.cal-day-hdr {
    text-align: center; padding: 0.3rem 0.2rem;
    font-size: 0.63rem; font-weight: 700; color: #94a3b8;
    text-transform: uppercase; background: #f8fafc;
    border-bottom: 1px solid #e2e8f0; border-right: 1px solid #f1f5f9;
}
.cal-day-hdr:last-child { border-right: none; }
.cal-day {
    min-height: 68px; padding: 4px 4px 3px; background: white;
    border-right: 1px solid #f1f5f9; border-bottom: 1px solid #f1f5f9; overflow: hidden;
}
.cal-day:nth-child(7n) { border-right: none; }
.cal-day--empty   { background: #fafafa; }
.cal-day--today   { background: #f0f7ff; }
.cal-day--past    { background: #fafafa; }
.cal-day-num {
    font-size: 0.68rem; font-weight: 600; color: #475569;
    display: block; margin-bottom: 2px; line-height: 1.2;
}
.cal-day-num--today {
    background: #2563eb; color: white; border-radius: 50%;
    width: 17px; height: 17px; display: flex; align-items: center; justify-content: center;
    font-size: 0.63rem;
}
.cal-day--past .cal-day-num { color: #d1d5db; }
.cal-day-ev {
    font-size: 0.58rem; font-weight: 500; padding: 1px 4px; border-radius: 3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 1px; line-height: 1.4; display: block;
}
.cal-day-ev--holiday  { background: #eff6ff; color: #1d4ed8; }
.cal-day-ev--tax      { background: #fff7ed; color: #c2410c; }
.cal-day-ev--shipment { background: #f0fdf4; color: #15803d; }
.cal-day-ev--gcal     { background: #f5f3ff; color: #6d28d9; }
.cal-day-more {
    font-size: 0.58rem; color: #94a3b8; padding: 0 2px;
}

/* Month event list under grid */
.cal-month-ev-list {
    display: flex; flex-direction: column; gap: 3px;
    margin-top: 0.75rem; max-height: 220px; overflow-y: auto;
    padding-right: 2px;
}
.cal-ev {
    display: flex; align-items: baseline; gap: 5px;
    padding: 2px 6px; border-radius: 4px; line-height: 1.35;
}
.cal-ev-day {
    font-size: 0.65rem; font-weight: 700; min-width: 18px;
    flex-shrink: 0; font-variant-numeric: tabular-nums; text-align: right;
}
.cal-ev-label {
    font-size: 0.68rem; font-weight: 500; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.cal-ev--holiday  { background: #eff6ff; color: #1d4ed8; }
.cal-ev--tax      { background: #fff7ed; color: #c2410c; }
.cal-ev--shipment { background: #f0fdf4; color: #15803d; }
.cal-ev--gcal     { background: #f5f3ff; color: #6d28d9; }
.cal-ev--link {
    text-decoration: none;
    cursor: pointer;
    transition: filter 0.12s, transform 0.08s;
}
.cal-ev--link:hover { filter: brightness(0.95); }
.cal-ev--link:active { transform: translateY(1px); }
.cal-ev-ext {
    margin-left: auto;
    font-size: 0.75rem;
    opacity: 0.7;
}
.cal-no-events    { font-size: 0.72rem; color: #cbd5e1; font-style: italic; padding: 0.5rem 0; }

/* Sidebar month list */
.cal-sidebar-yr {
    font-size: 0.65rem; font-weight: 700; color: #94a3b8;
    text-transform: uppercase; letter-spacing: 0.07em;
    padding: 0.1rem 0.5rem 0.4rem; flex-shrink: 0;
}
.cal-sidebar-mo {
    display: flex; align-items: center; gap: 0.55rem;
    padding: 0.5rem 0.75rem; border-radius: 8px;
    border: 1px solid transparent; background: transparent;
    cursor: pointer; text-align: left; width: 100%;
    font-family: inherit; transition: all 0.1s; flex-shrink: 0;
}
.cal-sidebar-mo:hover  { background: #f8fafc; border-color: #e2e8f0; }
.cal-sidebar-mo.selected { background: #eff6ff; border-color: #bfdbfe; }
.cal-sd-name {
    font-size: 0.82rem; font-weight: 600; color: #1e293b; min-width: 28px;
}
.cal-sidebar-mo.is-now .cal-sd-name { color: #2563eb; font-weight: 800; }
.cal-sd-dots { display: flex; gap: 3px; align-items: center; }
.cal-sd-dot  { width: 7px; height: 7px; border-radius: 50%; }
.cal-sd-dot--holiday  { background: #3b82f6; }
.cal-sd-dot--tax      { background: #f97316; }
.cal-sd-dot--shipment { background: #22c55e; }
.cal-sd-dot--gcal     { background: #8b5cf6; }
.cal-sd-now {
    font-size: 0.6rem; font-weight: 700; color: #2563eb;
    background: #dbeafe; border-radius: 8px; padding: 1px 5px; margin-left: auto;
}

@media (max-width: 860px) {
    .cal-layout { flex-direction: column; }
    .cal-detail-pane { flex: none; width: 100%; }
    .cal-sidebar-pane {
        flex-direction: row; flex-wrap: wrap; max-height: none;
        overflow-y: visible; position: static;
    }
    .cal-sidebar-mo { width: auto; flex: 0 0 auto; }
}

/* ── Shipment card: clickable nav style ── */
.imp-event-card--nav {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: box-shadow 0.12s, border-color 0.12s;
}
.imp-event-card--nav:hover { box-shadow: 0 2px 12px rgba(59,130,246,0.12); border-color: #93c5fd; }
.imp-card-chevron { flex-shrink: 0; margin-left: auto; }

.imp-ship-status-badge {
    font-size: 0.7rem; font-weight: 600; padding: 2px 7px;
    border-radius: 10px; border: 1px solid; white-space: nowrap;
}
.imp-ship-cost-pill {
    font-size: 0.75rem; color: #64748b; margin-top: 3px;
}
.imp-ship-os  { color: #f59e0b; font-weight: 600; }
.imp-ship-paid-ok { color: #10b981; font-weight: 600; }

/* ── Shipment full-window detail ── */
.ship-detail-view {
    padding: 0 0 3rem;
    max-width: 860px;
}
.ship-detail-view--new,
.ship-detail-view--v3 { max-width: none; }
.ship-detail-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0 1rem;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 1.25rem;
}
.ship-detail-back {
    background: none; border: none; cursor: pointer;
    color: #3b82f6; font-size: 0.875rem; font-weight: 500;
    padding: 0.25rem 0;
    display: flex; align-items: center; gap: 0.25rem;
}
.ship-detail-back:hover { color: #1d4ed8; }
.ship-status-wrap {
    display: flex; align-items: center; gap: 0.5rem;
}
.ship-status-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
    transition: background 0.2s;
}
.ship-status-sel {
    border: 1px solid #e2e8f0; border-radius: 6px;
    padding: 0.3rem 0.6rem; font-size: 0.8125rem;
    background: white; cursor: pointer;
}
.ship-status-badge {
    font-size: 0.8125rem; font-weight: 600; color: #1e293b;
    padding: 0.3rem 0.6rem;
    border: 1px solid #e2e8f0; border-radius: 6px;
    background: white;
    cursor: help;
}
.ship-detail-hdr { margin-bottom: 1.25rem; }
.ship-detail-title {
    font-size: 1.5rem; font-weight: 700; color: #0f172a;
    margin: 0 0 0.25rem;
}
.ship-detail-meta { font-size: 0.875rem; color: #64748b; margin: 0; }

/* ── Summary cards row ── */
.ship-sum-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}
@media (max-width: 700px) { .ship-sum-row { grid-template-columns: repeat(2, 1fr); } }
.ship-sum-card {
    background: white; border: 1px solid #e2e8f0;
    border-radius: 8px; padding: 1rem;
}
.ship-sum-card--paid  { border-color: #bbf7d0; background: #f0fdf4; }
.ship-sum-card--os    { border-color: #fde68a; background: #fffbeb; }
.ship-sum-card--clear { border-color: #bbf7d0; background: #f0fdf4; }
.ship-sum-val {
    font-size: 1.375rem; font-weight: 700; color: #0f172a; line-height: 1.1;
}
.ship-sum-lbl {
    font-size: 0.7rem; color: #94a3b8; text-transform: uppercase;
    letter-spacing: 0.05em; margin-top: 0.25rem;
}

/* ── Detail sections ── */
.ship-det-section {
    background: white; border: 1px solid #e2e8f0;
    border-radius: 8px; padding: 1.25rem;
    margin-bottom: 0.75rem;
}
.ship-det-hd {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.75rem;
}
.ship-det-title {
    font-size: 0.8125rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: #475569; margin: 0;
}

/* ── Quick-add cost shortcuts ── */
.ship-quick-costs {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 0.4rem; margin-top: 1rem; padding-top: 0.75rem;
    border-top: 1px solid #f1f5f9;
}
.ship-qc-label {
    font-size: 0.7rem; color: #94a3b8; text-transform: uppercase;
    letter-spacing: 0.05em; flex-basis: 100%; margin-bottom: 0.15rem;
}

/* ── Notes textarea ── */
.ship-notes-ta {
    width: 100%; box-sizing: border-box;
    border: 1px solid #e2e8f0; border-radius: 6px;
    padding: 0.6rem 0.75rem; font-size: 0.8125rem;
    font-family: inherit; resize: vertical;
    color: #1e293b; background: #f8fafc;
    transition: border-color 0.15s;
}
.ship-notes-ta:focus { outline: none; border-color: #3b82f6; background: white; }

/* ── Danger zone ── */
.ship-det-danger { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #fee2e2; }
.ship-det-danger .imp-ship-del {
    background: none; border: 1px solid #fca5a5; color: #dc2626;
    border-radius: 6px; padding: 0.4rem 0.9rem; font-size: 0.8125rem;
    cursor: pointer;
}
.ship-det-danger .imp-ship-del:hover { background: #fee2e2; }

/* ── Sales: two-chart row ── */
.sales-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.sales-chart-block {
    margin-bottom: 0 !important;
}
.sales-chart-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.sales-mode-toggle {
    display: inline-flex;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 2px;
    flex-shrink: 0;
}
.sales-mode-btn {
    background: transparent;
    border: 0;
    padding: 0.25rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    border-radius: 4px;
    line-height: 1.4;
}
.sales-mode-btn:hover { color: #1e293b; }
.sales-mode-btn.active {
    background: white;
    color: #1e293b;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
@media (max-width: 900px) {
    .sales-charts-row { grid-template-columns: 1fr; }
}

/* ── Sales: LY% badge ── */
.sales-ytd-pct {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
}
.sales-ytd-up { background: #dcfce7; color: #15803d; }
.sales-ytd-dn { background: #fee2e2; color: #dc2626; }

/* ────────────────────────────────────────────────────────────────
   Worker mode — share #worker with warehouse staff for an
   orders-only view. Sticky via localStorage; #worker-exit clears.
   This is a UI restriction, not a security boundary; Cloudflare
   Access still gates the site by email.
   ──────────────────────────────────────────────────────────────── */

body.body--worker .sidebar { display: none; }
body.body--worker .main-wrap { width: 100%; }
body.body--worker #dashboard-topbar { display: none; }
body.body--worker .app-shell { padding: 0; }

/* Warehouse role — hide admin-only nav items + the dashboard topbar */
body.role-warehouse .nav-item--admin-only { display: none !important; }
body.role-warehouse #dashboard-topbar { display: none; }

/* Warehouse role — hide every Xero-flavoured UI inside the orders view */
body.role-warehouse .xero-banner,
body.role-warehouse .xero-only,
body.role-warehouse .row-action-btn--xero,
body.role-warehouse .order-xero,
body.role-warehouse .xero-not-connected,
body.role-warehouse #push-xero-btn,
body.role-warehouse #link-xero-btn { display: none !important; }

/* Warehouse role — hide PrintNode (admin-only) items + the redundant
   Print-Address overflow item (the row-level truck icon covers it). */
body.role-warehouse [data-print-doc],
body.role-warehouse #print-address-btn {
    display: none !important;
}

/* Dispatch Log table — right-align numeric columns. */
.dl-table .dl-num { text-align: right; font-variant-numeric: tabular-nums; }
.dl-table .dl-total { font-weight: 600; }
.dl-table tfoot td { font-weight: 600; background: #f8fafc; }
.dl-order-link { color: #1e40af; text-decoration: none; }
.dl-order-link:hover { text-decoration: underline; }

/* Payslip group header — subtotal-style row introducing each run of
   dispatches assigned to the same payslip period (or the open
   "Unassigned" group). Sits in the tbody between the group and the
   one before it. */
.dl-table .dl-group-header td {
    background: #f8fafc;
    border-top: 2px solid #cbd5e1;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
    color: #475569;
    font-weight: 600;
}
.dl-payslip-label {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.dl-payslip-label--open {
    background: #fef3c7;
    color: #92400e;
}
.dl-group-subtotal {
    color: #0f172a;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.dl-action-cell { width: 1px; white-space: nowrap; }
.dl-assign-btn {
    border: 1px solid #cbd5e1;
    background: white;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.55rem;
    border-radius: 5px;
    cursor: pointer;
    line-height: 1;
    white-space: nowrap;
}
.dl-assign-btn:hover {
    border-color: #2563eb;
    color: #1d4ed8;
    background: #eff6ff;
}
.dl-assign-btn:disabled { opacity: 0.6; cursor: default; }

.dl-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.dl-tab-count {
    display: inline-block; margin-left: 0.35rem; padding: 0 0.4rem;
    border-radius: 10px; background: rgba(255,255,255,0.25);
    font-size: 0.72rem; font-weight: 600;
}
.imp-view-btn:not(.active) .dl-tab-count { background: #e2e8f0; color: #64748b; }
.dl-pane { display: none; }
.dl-pane.active { display: block; }

/* Dispatcher dropdown next to "Mark as Dispatched". */
.dispatch-by-sel {
    height: 32px;
    padding: 0 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: white;
    font-size: 0.85rem;
    color: #1e293b;
    margin-right: 0.4rem;
}

/* In worker mode the only routes that should appear are orders/*.
   Direct hash entry to #admin etc. still loads the view (we don't
   block that here), but every visible link points at orders. */
body.body--worker .orders-view-inner { padding-top: 1rem; }

/* ────────────────────────────────────────────────────────────────
   Shipment detail — rigid schema (Shipment #42 onwards)
   Two-column layout with a sticky % of Total chart on the right.
   ──────────────────────────────────────────────────────────────── */

.ship-detail-view--new .ship-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 1.5rem;
    align-items: start;
}
.ship-detail-view--new .ship-detail-main { min-width: 0; }

.ship-detail-side {
    position: sticky;
    top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}
.ship-detail-side .ship-pct-chart { position: static; top: auto; }
.ship-side-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.ship-side-hd {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

.ship-pct-chart {
    position: sticky;
    top: 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.ship-pct-title {
    margin: 0;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    font-weight: 600;
}
.ship-pct-row { display: flex; flex-direction: column; gap: 0.25rem; }
.ship-pct-row-hd {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}
.ship-pct-row-name { font-size: 0.85rem; font-weight: 600; }
.ship-pct-row-pct {
    font-size: 0.8rem;
    color: #475569;
    font-variant-numeric: tabular-nums;
}
.ship-pct-bar {
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}
.ship-pct-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.25s ease;
}
.ship-pct-row-val {
    font-size: 0.78rem;
    color: #64748b;
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.ship-pct-total {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.9rem;
    color: #0f172a;
}
.ship-pct-total strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }

/* Section blocks within the cost breakdown */
.ship-fix-section { margin-bottom: 1.25rem; }
.ship-fix-section-hd {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}
.ship-fix-section-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ship-fix-section-name { font-size: 0.95rem; font-weight: 600; color: #0f172a; }
.ship-fix-section-sum {
    margin-left: auto;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    color: #475569;
}
.ship-add-cost-form {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.75rem;
}
.ship-add-cost-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}
.ship-add-cost-fields select,
.ship-add-cost-fields input {
    font-size: 0.82rem;
    padding: 0.25rem 0.4rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    color: #0f172a;
}
.ship-add-cost-label { flex: 1; min-width: 140px; }
.ship-extra-del {
    color: #94a3b8;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.2rem;
    margin-left: 0.25rem;
    vertical-align: middle;
}
.ship-extra-del:hover { color: #ef4444; }
.ship-fix-td-actual { min-width: 90px; }
.ship-fix-td-actual input { width: 80px; }
.ship-fix-th-actual { min-width: 90px; color: #64748b; }
.ship-fix-td-var,
.ship-fix-th-var { min-width: 72px; text-align: right; }
.ship-var { font-variant-numeric: tabular-nums; font-size: 0.82rem; }
.ship-var--over  { color: #dc2626; }
.ship-var--under { color: #16a34a; }
.ship-sec-actual-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.1rem 0.1rem;
    font-size: 0.82rem;
}
.ship-sec-actual-lbl { color: #64748b; white-space: nowrap; }
.ship-sec-actual-row input {
    width: 110px;
    font-size: 0.82rem;
    padding: 0.2rem 0.35rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
}

/* Rigid line table */
.ship-fix-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.4rem;
    overflow: hidden;
}
.ship-fix-table thead th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    text-align: left;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid #e2e8f0;
}
.ship-fix-th-amt     { width: 200px; }
.ship-fix-th-mult    { width: 200px; }
.ship-fix-th-nzd     { width: 110px; text-align: right !important; }
.ship-fix-th-paidvia { width: 130px; }
.ship-fix-th-chk     { width: 28px;  text-align: center !important; }

/* V3 cost table — separated columns with subtle vertical dividers */
.ship-fix-table--v3 thead th,
.ship-fix-table--v3 tbody td {
    border-right: 1px solid #eef2f7;
}
.ship-fix-table--v3 thead th:last-child,
.ship-fix-table--v3 tbody td:last-child { border-right: none; }
.ship-fix-th-line   { width: auto; }
.ship-fix-th-units  { width: 110px; text-align: right !important; }
.ship-fix-th-cost   { width: 160px; }
.ship-fix-th-ccy    { width: 70px;  text-align: center !important; }
.ship-fix-th-sub    { width: 120px; text-align: right !important; }

.ship-fix-row td {
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 0.88rem;
}
.ship-fix-row:last-child td { border-bottom: none; }
.ship-fix-row--paid td { background: #f0fdf4; }
.ship-fix-row--paid .ship-fix-num,
.ship-fix-row--paid .ship-fix-paidvia { color: #475569; }

.ship-fix-td-label  { font-weight: 500; color: #1e293b; }
.ship-fix-label-inp {
    width: 100%;
    padding: 0.25rem 0.4rem;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.88rem;
    font-weight: 500;
    background: transparent;
    color: #1e293b;
}
.ship-fix-label-inp:hover { border-color: #e2e8f0; background: white; }
.ship-fix-label-inp:focus { border-color: #3b82f6; background: white; outline: none; }
.ship-fix-td-amt    { display: flex; align-items: center; gap: 4px; }
.ship-fix-td-nzd    { text-align: right; font-variant-numeric: tabular-nums; color: #0f172a; }
.ship-fix-td-mult   { color: #64748b; font-size: 0.8rem; }
.ship-fix-td-chk    { text-align: center; }

.ship-fix-td-units  { text-align: right; font-variant-numeric: tabular-nums; color: #475569; white-space: nowrap; }
.ship-fix-td-cost   { white-space: nowrap; }
.ship-fix-td-ccy    { text-align: center; }
.ship-fix-td-sub    { text-align: right; font-variant-numeric: tabular-nums; color: #334155; }
.ship-fix-units      { color: #1e293b; font-weight: 500; }
.ship-fix-units-unit { margin-left: 4px; color: #94a3b8; font-size: 0.78rem; }

.ship-fix-num {
    width: 90px;
    padding: 0.25rem 0.4rem;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
    background: transparent;
}
.ship-fix-num:hover { border-color: #e2e8f0; background: white; }
.ship-fix-num:focus { border-color: #3b82f6; background: white; outline: none; }
.ship-fix-unit { color: #64748b; font-size: 0.78rem; margin-right: 4px; }
.ship-fix-ccy {
    padding: 0.18rem 0.45rem;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #334155;
    background: #f8fafc;
    text-transform: uppercase;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    text-align: center;
    text-align-last: center;
}
.ship-fix-ccy:hover { border-color: #94a3b8; background: white; }
.ship-fix-ccy:focus { outline: none; border-color: #3b82f6; background: white; }
.ship-fix-paidvia {
    width: 100%;
    padding: 0.25rem 0.4rem;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.85rem;
    background: transparent;
}
.ship-fix-paidvia:hover { border-color: #e2e8f0; background: white; }
.ship-fix-paidvia:focus { border-color: #3b82f6; background: white; outline: none; }
.ship-fix-mult { display: inline-block; }
.ship-fix-localtotal { display: inline-block; margin-left: 0.5rem; color: #475569; }
.ship-fix-nil { color: #cbd5e1; }
.ship-fix-fxtag {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 1px 4px;
    background: #f1f5f9;
    border-radius: 3px;
    font-size: 0.7rem;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}
.ship-fix-other-empty {
    margin: 0.25rem 0 0;
    color: #94a3b8;
    font-size: 0.85rem;
    font-style: italic;
}

/* Raw Product split inputs */
.ship-raw-split {
    display: flex;
    align-items: end;
    gap: 1rem;
    flex-wrap: wrap;
}
.ship-raw-split-field { display: flex; flex-direction: column; gap: 0.2rem; }
.ship-raw-split-field input { width: 130px; }
.ship-raw-split-status {
    margin-left: auto;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}
.ship-raw-split-ok  { color: #16a34a; }
.ship-raw-split-bad { color: #d97706; }

/* ── V3 schema — yield-driven inputs (netKg / white% / waste%) ──── */
.ship-yield-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
@media (max-width: 700px) {
    .ship-yield-grid { grid-template-columns: 1fr; }
}
.ship-yield-field { display: flex; flex-direction: column; gap: 3px; }
.ship-yield-input {
    padding: 0.4rem 0.55rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    background: white;
}
.ship-yield-input:focus { border-color: #3b82f6; outline: none; }

.ship-yield-derived {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    padding: 0.6rem 0.85rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}
.ship-yield-stat { display: flex; flex-direction: column; gap: 1px; }
.ship-yield-stat-lbl {
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.ship-yield-stat-val {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}
.ship-yield-stat-sub {
    font-weight: 400;
    color: #94a3b8;
    font-size: 0.78rem;
}

/* V3 add-form live yield preview */
.imp-add-yield-preview {
    margin: 0.5rem 0 0;
    min-height: 1.1rem;
    font-size: 0.8rem;
    color: #475569;
    font-variant-numeric: tabular-nums;
}

/* V3 detail — derived ETA hint shown under start date */
.imp-startdate-eta {
    margin: 0.5rem 0 0;
    font-size: 0.78rem;
    color: #64748b;
}
.imp-startdate-eta strong { color: #1e293b; font-weight: 600; }

/* V3 cost lines — negative amounts (LC Refund) and allocation input */
.ship-fix-neg { color: #b91c1c; }
.ship-fix-num--alloc { width: 60px; }

/* V3 cost lines — editable label input (matches v2 styling) */
.ship-fix-label-inp {
    width: 100%;
    padding: 0.25rem 0.4rem;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.88rem;
    font-weight: 500;
    background: transparent;
    color: #1e293b;
    font-family: inherit;
}
.ship-fix-label-inp:hover { border-color: #e2e8f0; background: white; }
.ship-fix-label-inp:focus { border-color: #3b82f6; background: white; outline: none; }

/* V3 doughnut % chart — canvas wrap with overlaid total */
.ship-pct-canvas-wrap {
    position: relative;
    width: 100%;
    height: 200px;
}
.ship-pct-canvas-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.ship-pct-canvas-total {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}
.ship-pct-canvas-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
}
.ship-pct-legend {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.4rem;
}
.ship-pct-legend-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
}
.ship-pct-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ship-pct-legend-name { color: #475569; flex: 1; }
.ship-pct-legend-pct  { color: #1e293b; font-weight: 600; font-variant-numeric: tabular-nums; }

/* V3 detail — Stage timeline (minimalist line chart + numbered rows) */
.ship-tl-section { display: flex; flex-direction: column; gap: 0.85rem; }
.ship-tl-track {
    position: relative;
    height: 44px;
    display: flex;
    align-items: center;
}
.ship-tl-svg {
    position: absolute;
    left: 0; right: 0;
    width: 100%;
    height: 4px;
    overflow: visible;
}
.ship-tl-icons-row {
    position: absolute;
    left: 0; right: 0;
    top: 0; bottom: 0;
}
.ship-tl-icon {
    position: absolute;
    transform: translateX(-50%);
    top: 50%;
    margin-top: -12px;
    font-size: 22px;
    line-height: 1;
    opacity: 0.32;
    transition: opacity 0.15s, transform 0.12s;
    cursor: default;
    user-select: none;
}
.ship-tl-icon--done {
    opacity: 1;
}
.ship-tl-icon:hover { transform: translateX(-50%) scale(1.25); }
.ship-tl-rows {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.4rem;
}
.ship-tl-row {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.1rem 0;
}
.ship-tl-toggle {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
}
.ship-tl-icon-badge {
    font-size: 16px;
    line-height: 1;
    opacity: 0.35;
    transition: opacity 0.15s;
    flex-shrink: 0;
}
.ship-tl-toggle--done .ship-tl-icon-badge { opacity: 1; }
.ship-tl-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: #475569;
    line-height: 1.2;
}
.ship-tl-toggle--done .ship-tl-label { color: #0f172a; }
.ship-tl-date {
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 0.25rem 0.4rem;
    font-size: 0.78rem;
    font-family: inherit;
    color: #475569;
    background: white;
    width: 100%;
    box-sizing: border-box;
}
.ship-tl-date:hover { border-color: #94a3b8; }
.ship-tl-date:focus { outline: none; border-color: #3b82f6; color: #1e293b; }

/* Stage defaults inline panel */
.ship-tl-cfg {
    margin-top: 0.6rem;
    padding: 0.75rem 0.9rem;
    max-width: 460px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.ship-tl-cfg[hidden] { display: none; }
.ship-tl-cfg-hd { display: flex; flex-direction: column; gap: 0.1rem; }
.ship-tl-cfg-hd strong { font-size: 0.82rem; color: #1e293b; }
.ship-tl-cfg-hint { font-size: 0.72rem; color: #64748b; }
.ship-tl-cfg-list {
    display: flex; flex-direction: column;
    border-top: 1px solid #e2e8f0;
}
.ship-tl-cfg-row {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 0.55rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid #eef2f7;
    font-size: 0.8rem;
    white-space: nowrap;
}
.ship-tl-cfg-row:last-child { border-bottom: none; }
.ship-tl-cfg-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 17px;
    border: 1px solid #cbd5e1; border-radius: 3px;
    background: white; color: #64748b;
    font-size: 0.62rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.ship-tl-cfg-label {
    color: #334155;
    overflow: hidden; text-overflow: ellipsis;
}
.ship-tl-cfg-anchor {
    font-size: 0.66rem; color: #94a3b8;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.ship-tl-cfg-rule {
    display: inline-flex; align-items: center; gap: 0.4rem;
    color: #64748b; font-size: 0.74rem;
}
.ship-tl-cfg-gap {
    width: 52px;
    padding: 0.18rem 0.3rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
    background: white;
    color: #1e293b;
}
.ship-tl-cfg-gap:focus { outline: none; border-color: #3b82f6; }
.ship-tl-cfg-unit { color: #94a3b8; }
.ship-tl-cfg-actions {
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.6rem;
}
.ship-tl-cfg-saved { font-size: 0.72rem; color: #10b981; }

/* Section header secondary actions cluster */
.ship-det-hd-actions { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }
.ship-start-date-lbl {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
}
.ship-start-date-lbl input[type="date"] {
    font-size: 0.82rem;
    padding: 0.2rem 0.4rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    color: #0f172a;
    font-weight: 500;
}
.ship-start-date-lbl input[type="date"]:not([value=""]):not([value]) {
    border-color: #7c3aed;
    background: #faf5ff;
}
.ship-start-eta {
    font-size: 0.8rem;
    color: #7c3aed;
    font-weight: 500;
    white-space: nowrap;
}

/* ── V3 detail — Shipment Stage track ────────────────────────────── */
.ship-stage-track {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.25rem 0;
}
.ship-stage-step {
    flex: 1 1 0;
    min-width: 96px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.6rem 0.5rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    text-align: center;
    transition: transform 0.12s, border-color 0.12s, background 0.12s;
    position: relative;
}
.ship-stage-step:hover { transform: translateY(-1px); border-color: #94a3b8; }
.ship-stage-step--done {
    background: #ecfdf5;
    border-color: #10b981;
}
.ship-stage-step--done::after {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 6px;
    color: #10b981;
    font-size: 0.7rem;
    font-weight: 700;
}
.ship-stage-icon {
    font-size: 1.4rem;
    line-height: 1;
}
.ship-stage-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #475569;
    line-height: 1.15;
}
.ship-stage-step--done .ship-stage-label { color: #065f46; }
.ship-stage-date {
    font-size: 0.68rem;
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
}
.ship-stage-step--done .ship-stage-date { color: #10b981; }

/* ── V3 detail — Net Weight Breakdown bar ─────────────────────────── */
.ship-yield-bar {
    display: flex;
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    background: #f1f5f9;
    margin-bottom: 0.5rem;
}
.ship-yield-seg {
    height: 100%;
    transition: filter 0.12s;
    cursor: help;
}
.ship-yield-seg:hover { filter: brightness(0.92); }
.ship-yield-seg--white         { background: #cbd5e1; }
.ship-yield-seg--colour        { background: #7c3aed; }
.ship-yield-seg--waste         { background: repeating-linear-gradient(45deg, #94a3b8, #94a3b8 4px, #cbd5e1 4px, #cbd5e1 8px); }

.ship-yield-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1rem;
    align-items: center;
    margin: 0.4rem 0 0.9rem;
    font-size: 0.78rem;
    color: #475569;
}
.ship-yield-leg-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-variant-numeric: tabular-nums;
}
.ship-yield-leg-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
}
.ship-yield-leg-dot--white  { background: #cbd5e1; }
.ship-yield-leg-dot--colour { background: #7c3aed; }
.ship-yield-leg-dot--waste  { background: repeating-linear-gradient(45deg, #94a3b8, #94a3b8 3px, #e2e8f0 3px, #e2e8f0 6px); }
.ship-yield-leg-formula {
    margin-left: auto;
    font-size: 0.72rem;
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
}

/* ── Imports overview — Upcoming Shipments cards ──────────────────── */
.imp-upcoming-card-section { margin-bottom: 1.25rem; }
.imp-upcoming-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
}
.imp-upcoming-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.85rem 1rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.imp-upcoming-card:hover {
    transform: translateY(-2px);
    border-color: #94a3b8;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}
/* New shipment card layout (mirrors the dashboard card): #N + status,
   arrival line, % paid / outstanding, 7-segment green milestone bar. */
.imp-upcoming-row1 {
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.imp-upcoming-num {
    font-size: 1rem; font-weight: 700; color: #0f172a;
    font-variant-numeric: tabular-nums;
}
.imp-upcoming-arrival { font-size: 0.9rem; color: #0f172a; font-weight: 600; }
.imp-upcoming-arrival-label { color: #94a3b8; font-weight: 500; }
.imp-upcoming-arrival strong { font-weight: 600; color: #0f172a; }
.imp-upcoming-cost { font-size: 0.82rem; color: #475569; font-variant-numeric: tabular-nums; }

/* Small ℹ glyph next to chart titles. Uses the browser's native title
   tooltip — no JS, no popover library, just a cursor:help affordance. */
.chart-info {
    display: inline-block;
    margin-left: 0.4rem;
    color: #cbd5e1;
    cursor: help;
    font-size: 0.95em;
    line-height: 1;
    vertical-align: middle;
    user-select: none;
}
.chart-info:hover { color: #64748b; }

/* Paid / outstanding progress bar on shipment cards. The bar stretches
   to the full card width; the labels sit beneath with a touch of
   horizontal padding so the dollar figures don't crowd the card edges. */
.imp-pay-progress {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin: 0.4rem 0 0.2rem;
}
.imp-pay-bar {
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
}
.imp-pay-bar-paid {
    height: 100%;
    background: #10b981;
    border-radius: 5px;
    transition: width 0.2s;
}
.imp-pay-labels {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0 0.25rem;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
}
.imp-pay-paid { color: #047857; font-weight: 700; }
.imp-pay-os   { color: #64748b; }
.imp-pay-empty {
    font-size: 0.78rem;
    color: #94a3b8;
    font-style: italic;
}
.imp-upcoming-card-hd {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}
.imp-upcoming-card-num {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
}
.imp-upcoming-card-eta {
    font-size: 0.75rem;
    color: #64748b;
}
.imp-upcoming-card-kg {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1e293b;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.imp-upcoming-card-money {
    font-size: 0.8rem;
    color: #475569;
    font-variant-numeric: tabular-nums;
}
.imp-upcoming-card-paid    { font-weight: 700; color: #0f172a; }
.imp-upcoming-card-sep     { margin: 0 0.3rem; color: #cbd5e1; }
.imp-upcoming-card-total   { color: #94a3b8; }
.imp-upcoming-card-stage {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.1rem;
    padding: 0.3rem 0.55rem;
    background: #f1f5f9;
    border-radius: 999px;
    font-size: 0.74rem;
    color: #475569;
    font-weight: 500;
    width: fit-content;
}
.imp-upcoming-card-stage-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 16px;
    padding: 0 4px;
    border-radius: 3px;
    background: white;
    border: 1px solid #cbd5e1;
    color: #64748b;
    font-size: 0.62rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
}

/* Below ~1100px — drop the chart under the main column instead of beside it */
@media (max-width: 1100px) {
    .ship-detail-view--new .ship-detail-layout,
    .ship-detail-view--v3  .ship-detail-layout { grid-template-columns: minmax(0, 1fr); }
    .ship-pct-chart { position: static; }
    .ship-detail-side { position: static; max-height: none; overflow: visible; }
}

/* ────────────────────────────────────────────────────────────────
   Dashboard module grid
   Replaces the old "quick actions on top, links below" layout with
   live data modules. Quick actions get demoted to a slim footer row.
   ──────────────────────────────────────────────────────────────── */

.db-grid {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.db-grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.db-grid-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); }

@media (max-width: 980px) {
    .db-grid-2, .db-grid-3 { grid-template-columns: minmax(0, 1fr); }
}

.db-mod {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.85rem 0.95rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-width: 0;
}
.db-mod-hd {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}
.db-mod-title {
    margin: 0;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #475569;
    font-weight: 700;
}
.db-mod-link {
    font-size: 0.75rem;
    color: #3b82f6;
    text-decoration: none;
}
.db-mod-link:hover { text-decoration: underline; }
.db-mod-body { display: flex; flex-direction: column; gap: 0.35rem; min-height: 1.5rem; }
.db-mod-loading,
.db-mod-empty {
    font-size: 0.82rem;
    color: #94a3b8;
    margin: 0.25rem 0;
    font-style: italic;
}
.db-mod--strip { padding: 0.6rem 0.95rem; }
.db-mod--chart { padding: 0.6rem 0.85rem; }
.db-mod--chart .db-chart-inner { padding: 0; }

/* Generic row content used by Latest Orders & Incoming Shipments */
.db-rows { display: flex; flex-direction: column; gap: 0.25rem; }
.db-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.32rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #1e293b;
    text-decoration: none;
    border: 1px solid transparent;
}
a.db-row:hover { background: #f8fafc; border-color: #e2e8f0; }
.db-row-main {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.db-row-sub  { font-weight: 400; color: #64748b; }
.db-row-meta { font-size: 0.78rem; color: #64748b; font-variant-numeric: tabular-nums; }
.db-row-date { font-size: 0.75rem; color: #94a3b8; font-variant-numeric: tabular-nums; }
.db-row-tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    border: 1px solid;
    white-space: nowrap;
}

/* ── Incoming Shipments card (dashboard) ── */
.db-ship-card {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid #f1f5f9;
    border-radius: 6px;
    background: #fafbfc;
}
.db-ship-card + .db-ship-card { margin-top: 0.25rem; }
.db-ship-row1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.db-ship-num {
    font-weight: 700;
    font-size: 0.92rem;
    color: #1e293b;
    font-variant-numeric: tabular-nums;
}
.db-ship-arrival {
    font-size: 0.8rem;
    color: #334155;
}
.db-ship-arrival-label { color: #94a3b8; font-weight: 500; }
.db-ship-arrival strong { font-weight: 600; }
.db-ship-cost {
    font-size: 0.78rem;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}
/* Seven milestone segments laid edge-to-edge. Done = full saturation
   (background colour from the inline style); pending = dimmed. */
.db-ship-ms {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    height: 6px;
    margin-top: 0.15rem;
}
.db-ms-seg {
    border-radius: 2px;
    opacity: 0.25;
    transition: opacity 0.15s;
}
.db-ms-seg--done { opacity: 1; }
.db-ms-seg:first-child { border-top-left-radius: 4px; border-bottom-left-radius: 4px; }
.db-ms-seg:last-child  { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }

/* Calendar 14-day list */
.db-cal-day { display: flex; flex-direction: column; gap: 0.15rem; }
.db-cal-day-hd {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    font-weight: 700;
    margin-top: 0.25rem;
}
.db-cal-event {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: baseline;
    gap: 0.45rem;
    padding: 0.18rem 0.35rem;
    font-size: 0.83rem;
    border-left: 2px solid transparent;
}
.db-cal-event--gcal     { border-left-color: #3b82f6; }
.db-cal-event--shipment { border-left-color: #f59e0b; background: #fef3c7; border-radius: 0 3px 3px 0; }
.db-cal-time {
    font-size: 0.78rem;
    color: #475569;
    font-variant-numeric: tabular-nums;
}
.db-cal-time--all { color: #94a3b8; }
.db-cal-title {
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.db-cal-more {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #94a3b8;
    font-style: italic;
}

/* Calendar 28-day strip */
/* Demoted quick-actions footer — slimmer, lower-key than the original headline cards */
.db-quick-actions--footer {
    margin: 0.5rem 0 0;
    padding-top: 0.75rem;
    border-top: 1px solid #f1f5f9;
    gap: 0.4rem;
}
.db-quick-actions--footer .db-quick-card {
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
    border-color: #f1f5f9;
    color: #64748b;
}
.db-quick-actions--footer .db-quick-card svg { width: 14px; height: 14px; }

/* Payroll tab — rates form, side-by-side CSV cards, payslip preview/PDF. */
.payroll-rates-row {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.75rem 0.9rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin: 0.5rem 0;
}
.payroll-rates-row label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
}
.payroll-rates-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    align-self: center;
    min-width: 4rem;
    padding-right: 0.5rem;
    border-right: 1px solid #e2e8f0;
    margin-right: 0.25rem;
}
.payroll-rate-input {
    width: 6rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.88rem;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background: #fff;
    font-variant-numeric: tabular-nums;
}
.payroll-rates-save { align-self: center; margin-left: auto; }

.payroll-csv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 0.85rem;
    margin: 0.5rem 0 1rem;
}
.payroll-csv-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.9rem 1rem;
    background: #fff;
}
.payroll-csv-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.2rem;
}

.payroll-period-bar {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0.4rem 0 0.85rem;
}
.payroll-period-bar label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
}
.payroll-period-bar select,
.payroll-period-bar input[type="date"] {
    padding: 0.35rem 0.5rem;
    font-size: 0.88rem;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background: #fff;
}

/* Payslip preview — also the element captured by html2pdf. */
.payslip {
    margin-top: 1rem;
    padding: 1.25rem 1.5rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    max-width: 720px;
}
.payslip-hd {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}
.payslip-title { margin: 0 0 0.2rem; font-size: 1.15rem; color: #1e293b; }
.payslip-meta  { margin: 0; font-size: 0.85rem; color: #64748b; }
.payslip-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.payslip-table th,
.payslip-table td {
    padding: 0.55rem 0.7rem;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}
.payslip-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #64748b;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.payslip-table tfoot td {
    border-top: 2px solid #1e293b;
    border-bottom: none;
    padding-top: 0.75rem;
    font-weight: 700;
    color: #1e293b;
}
.payslip-note {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-left: 0.4rem;
}
.payslip-total-label { text-align: right; }
.payslip-total { font-size: 1.05rem; }

/* ═══════════════════════════════════════════════
   New Dashboard (May 2026): top button row, two priority
   charts, and a unified calendar module. Replaces the
   old groups/pinned/quick-actions/mini-charts layout.
   ═══════════════════════════════════════════════ */

.db-top-bar {
    display: flex;
    align-items: stretch;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

/* Xero alerts banner — slim, sits above the top button row. Amber when
   any unpaid AR exists; bumps to red when any are overdue. */
.db-xero-alerts {
    margin-bottom: 0.85rem;
}
.db-xero-alerts-inner {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.12s, border-color 0.12s;
}
.db-xero-alerts-inner:hover { background: #fef3c7; border-color: #fbbf24; }
.db-xero-alerts:has(.db-xero-alerts-overdue) .db-xero-alerts-inner {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}
.db-xero-alerts:has(.db-xero-alerts-overdue) .db-xero-alerts-inner:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}
.db-xero-alerts-main { flex: 1; }
.db-xero-alerts-main strong { font-weight: 700; }
.db-xero-alerts-gst {
    font-size: 0.72rem;
    opacity: 0.7;
    margin-left: 0.15rem;
    font-weight: 500;
}
.db-xero-alerts-overdue {
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    background: rgba(220, 38, 38, 0.12);
    border-radius: 999px;
    font-size: 0.78rem;
    white-space: nowrap;
}
.db-xero-alerts-link {
    font-size: 0.82rem;
    font-weight: 600;
    opacity: 0.85;
    white-space: nowrap;
}
@media (max-width: 640px) {
    .db-xero-alerts-inner { flex-wrap: wrap; }
    .db-xero-alerts-link { margin-left: auto; }
}
.db-top-buttons {
    display: flex;
    flex: 1;
    gap: 0.85rem;
    flex-wrap: wrap;
}
.db-top-btn {
    flex: 1 1 0;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0.85rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    color: #1e293b;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    transition: border-color 0.12s, box-shadow 0.12s, transform 0.08s, color 0.12s;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.db-top-btn:hover {
    border-color: #1d4ed8;
    color: #1d4ed8;
    box-shadow: 0 4px 14px rgba(29, 78, 216, 0.12);
}
.db-top-btn:active { transform: translateY(1px); }
.db-top-btn svg { color: #64748b; }
.db-top-btn:hover svg { color: #1d4ed8; }
.db-top-btn--primary {
    flex: 0 0 auto;
    min-width: 170px;
    background: #2563eb;
    border-color: #2563eb;
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.db-top-btn--primary svg { color: white; }
.db-top-btn--primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: white;
    box-shadow: 0 6px 18px rgba(29, 78, 216, 0.32);
}
.db-top-btn--primary:hover svg { color: white; }

.db-mod-sub {
    font-size: 0.72rem;
    font-weight: 400;
    color: #94a3b8;
    margin-left: 0.5rem;
}

/* ── Charts row (Stock Trajectory + Cumulative Sales side-by-side) ── */
.db-charts-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}
@media (max-width: 980px) {
    .db-charts-row { grid-template-columns: 1fr; }
}

/* ── Calendar module: compact "next 30 days" timeline ── */
#db-calendar-module .db-mod-body {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
/* Category-toggle row above the 30-day strip (matches /calendar). */
.db-cal-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.db-cal-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid #e2e8f0;
    background: white;
    color: #94a3b8;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.db-cal-toggle--on { color: #1e293b; border-color: #cbd5e1; background: #f8fafc; }
.db-cal-toggle:hover { border-color: #94a3b8; }
.db-cal-toggle-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
}
.db-cal-toggle--on .db-cal-toggle-dot--holiday  { background: #ef4444; }
.db-cal-toggle--on .db-cal-toggle-dot--tax      { background: #f59e0b; }
.db-cal-toggle--on .db-cal-toggle-dot--shipment { background: #10b981; }
.db-cal-toggle--on .db-cal-toggle-dot--gcal     { background: #3b82f6; }
.db-strip-scroller {
    display: grid;
    grid-template-columns: repeat(30, minmax(38px, 1fr));
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.db-strip-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.15rem;
    padding: 0.4rem 0.2rem 0.35rem;
    background: #f8fafc;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-variant-numeric: tabular-nums;
    min-height: 64px;
    transition: background 0.1s, border-color 0.1s, box-shadow 0.1s;
}
.db-strip-cell:hover { background: #e2e8f0; }
.db-strip-cell--weekend { background: #f1f5f9; }
.db-strip-cell--has     { background: #eff6ff; }
.db-strip-cell--has.db-strip-cell--weekend { background: #e0e7ff; }
.db-strip-cell--today {
    background: #dbeafe;
    border-color: #3b82f6;
}
.db-strip-cell--selected {
    box-shadow: 0 0 0 2px #2563eb;
    background: #dbeafe;
}
.db-strip-dow {
    font-size: 0.62rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.db-strip-dom {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.1;
}
.db-strip-dots {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    align-items: center;
    justify-content: center;
    margin-top: 0.1rem;
    min-height: 8px;
}
.db-strip-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #94a3b8;
}
.db-strip-dot--holiday  { background: #ef4444; }
.db-strip-dot--tax      { background: #f59e0b; }
.db-strip-dot--shipment { background: #10b981; }
.db-strip-dot--gcal     { background: #3b82f6; }
.db-strip-more {
    font-size: 0.6rem;
    color: #64748b;
    margin-left: 1px;
}

/* Events panels under the strip — selected-day events (left) and a
   chronological "next 10 events" list (right). Stack on narrow screens. */
.db-cal-panels {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.75rem;
}
@media (max-width: 720px) {
    .db-cal-panels { grid-template-columns: 1fr; }
}
.db-cal-events {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
}
.db-cal-events-hd {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.55rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid #e2e8f0;
}
/* Date pill on the "Next 10 events" list — the per-day panel doesn't
   need it because the header already names the day. */
.db-cal-ev-date {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    color: #475569;
    background: #e2e8f0;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    margin-bottom: 0.2rem;
    width: fit-content;
}
/* Linked event rows: subtle affordance so the user knows it'll click
   through to the shipment detail (or the GCal event). */
.db-cal-ev--link { padding: 0; }
.db-cal-ev--link > a {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.5rem 0.6rem;
    color: inherit;
    text-decoration: none;
    border-radius: 0 5px 5px 0;
}
.db-cal-ev--link > a:hover { background: rgba(15, 23, 42, 0.04); }
.db-cal-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.db-cal-ev {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.5rem 0.6rem;
    border-left: 3px solid #cbd5e1;
    background: white;
    border-radius: 0 5px 5px 0;
    font-size: 0.82rem;
}
.db-cal-ev--holiday  { border-left-color: #ef4444; }
.db-cal-ev--tax      { border-left-color: #f59e0b; background: #fffbeb; }
.db-cal-ev--shipment { border-left-color: #10b981; background: #ecfdf5; }
.db-cal-ev--gcal     { border-left-color: #3b82f6; }
.db-cal-ev--empty {
    color: #94a3b8;
    font-style: italic;
    border-left: none;
    background: transparent;
    padding-left: 0;
}
.db-cal-ev-type {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}
.db-cal-ev-label { color: #1e293b; }

/* Mobile: stack the calendar grid and sidebar. */
@media (max-width: 900px) {
    .db-top-btn { min-width: 110px; padding: 0.85rem 0.6rem; font-size: 0.85rem; }
    .db-top-btn--primary { width: 100%; }
    .db-top-bar { flex-direction: column; }
    #db-calendar-module .db-mod-body {
        grid-template-columns: 1fr;
    }
    .db-cal-side { max-height: none; }
}
