/* WMS shipment tables — row lines, CARRIER / QC cells, and the summary under a clicked row.
   Owner 2026-10-11, mockup v10. Everything is scoped (.wsr-*, tr.wsr-exp) so no other
   WMS table, modal or theme rule changes. The page paints EVERY .wms-table td (light theme
   with !important), so the summary uses grid blocks inside ONE cell and overrides only that
   cell. Colours come from the theme variables (css/themes.css); the navy is the nav bar's. */

/* ── Row cells ─────────────────────────────────────────────────────────── */
.wms-table .brand-line.wsr-cust { font-size: 0.74rem; font-weight: 500; color: var(--text-secondary); }
[data-theme="light"] .wms-table .brand-line.wsr-cust { color: #33465a; }
/* Positions page .pos-vessel (the vessel line under the container number) */
.wms-table .wsr-sub {
    font-family: inherit; font-weight: 400; font-size: 0.6rem; color: var(--text-muted);
    margin-top: 2px; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0;
}
[data-theme="light"] .wms-table .wsr-sub { color: #64748b; }
.wms-table td.wsr-carr { font-size: 0.73rem; white-space: nowrap; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.wsr-qc {
    display: inline-block; min-width: 58px; text-align: center; font-size: 0.62rem; font-weight: 600;
    padding: 0.15rem 0.4rem; border-radius: 3px; background: rgba(10, 89, 137, 0.14); color: #38bdf8;
}
.wsr-qc.na { background: rgba(148, 163, 184, 0.12); color: var(--text-muted); box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.35); }
[data-theme="light"] .wsr-qc { background: rgba(10, 89, 137, 0.12); color: #0a5989; }
[data-theme="light"] .wsr-qc.na { background: #eef4f8; color: #536579; box-shadow: inset 0 0 0 1px #d6e2ea; }

/* ── The summary row ───────────────────────────────────────────────────── */
.wms-table tbody tr.wsr-exp { cursor: default; }
.wms-table tbody tr.wsr-exp > td,
.wms-table tbody tr.wsr-exp:hover > td,
[data-theme="light"] .wms-table tbody tr.wsr-exp > td,
[data-theme="light"] .wms-table tbody tr.wsr-exp:hover > td {
    padding: 0 0.5rem 0.75rem !important;
    background: var(--bg-tertiary) !important;
    border-bottom: 2px solid var(--accent-blue) !important;
    color: var(--text-primary) !important;
}
[data-theme="light"] .wms-table tbody tr.wsr-exp > td,
[data-theme="light"] .wms-table tbody tr.wsr-exp:hover > td { background: #eaf3fb !important; border-bottom-color: #0a5989 !important; }

.wsr-ribbon {
    display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.4fr) minmax(0, 1.05fr);
    background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border-color);
    border-radius: 10px; overflow: hidden; text-align: left; font-size: 12.5px; line-height: 1.35;
    animation: wsrDrop .2s ease-out; position: sticky; left: 0;
}
@keyframes wsrDrop { from { opacity: 0; transform: translateY(-5px); } }
.wsr-msg { grid-column: 1 / -1; padding: 14px 16px; color: var(--text-muted); font-size: 12.5px; }
.wsr-retry { margin-left: 8px; border: 1px solid var(--border-color); background: transparent; color: var(--accent-blue); border-radius: 6px; padding: 2px 10px; cursor: pointer; font: inherit; }

.wsr-sec { padding: 10px 12px; border-right: 1px solid var(--border-color); min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.wsr-sec:last-child { border-right: 0; }
.wsr-h { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.wsr-ref { font-size: 15.5px; font-weight: 700; }
.wsr-tools { margin-left: auto; display: flex; gap: 4px; }
.wsr-ib {
    border: 1px solid var(--border-color); background: var(--bg-primary); color: var(--text-muted);
    height: 24px; min-width: 24px; padding: 0 6px; border-radius: 6px; display: inline-flex; align-items: center;
    justify-content: center; gap: 4px; font-size: 11px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.wsr-ib:hover { color: var(--text-primary); }
.wsr-ib svg { width: 13px; height: 13px; }
.wsr-tl { font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.wsr-tl .cnt { font-weight: 600; letter-spacing: 0; text-transform: none; }
.wsr-ribbon .mono { font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; }

/* chips */
.wsr-chip { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 10.5px; font-weight: 700; white-space: nowrap; background: rgba(148, 163, 184, .14); color: var(--text-secondary); }
.wsr-chip.blue { background: rgba(56, 189, 248, .14); color: #38bdf8; }
.wsr-chip.ok { background: rgba(34, 197, 94, .14); color: #22c55e; }
.wsr-chip.red { background: rgba(239, 68, 68, .14); color: #f87171; }
.wsr-chip.amber { background: rgba(245, 158, 11, .14); color: #fbbf24; }
.wsr-chip.purple { background: rgba(168, 85, 247, .16); color: #c084fc; }
.wsr-chip.mut { background: rgba(148, 163, 184, .12); color: var(--text-muted); }
[data-theme="light"] .wsr-chip.blue { background: #e0f2fe; color: #0369a1; }
[data-theme="light"] .wsr-chip.ok { background: #e3f3eb; color: #15803d; }
[data-theme="light"] .wsr-chip.red { background: #fdecec; color: #b91c1c; }
[data-theme="light"] .wsr-chip.amber { background: #fff5e1; color: #b45309; }
[data-theme="light"] .wsr-chip.purple { background: #f1edfc; color: #6d28d9; }
[data-theme="light"] .wsr-chip.mut { background: #eef4f8; color: #536579; }

/* left: facts in 3 compact columns (label over value) */
.wsr-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px 14px; }
.wsr-f { min-width: 0; line-height: 1.25; }
.wsr-f > span { display: block; font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 1px; }
.wsr-f > span em { font-style: normal; font-weight: 500; letter-spacing: 0; text-transform: none; }
.wsr-v { display: flex; align-items: center; gap: 5px; min-width: 0; }
.wsr-v b { font-weight: 600; font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wsr-v b.mono { font-size: 12.5px; }
.wsr-f.empty .wsr-v b { color: var(--text-muted); font-weight: 500; }
.wsr-cp {
    flex: none; border: 0; background: transparent; width: 18px; height: 18px; padding: 0; border-radius: 4px;
    color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; opacity: .7; cursor: pointer;
}
.wsr-cp svg { width: 13px; height: 13px; }
.wsr-f:hover .wsr-cp, .wsr-cp:focus-visible { opacity: 1; }
.wsr-cp:hover { background: var(--bg-primary); color: var(--text-primary); }
.wsr-cp.done { color: #22c55e; opacity: 1; }
.wsr-mrnrow { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 26px; padding-top: 6px; border-top: 1px solid var(--border-color); }
.wsr-mrnrow > .wsr-f { min-width: 0; max-width: 100%; }
.wsr-cert-row { flex-wrap: wrap; gap: 6px 12px !important; }
.wsr-cert { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.wsr-cert i { font-style: normal; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; color: var(--text-muted); }
.wsr-cert em { font-style: normal; font-size: 11px; color: var(--text-secondary); }
.wsr-flag {
    display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 5px; font-size: 12px; font-weight: 700; white-space: nowrap;
    background: rgba(245, 158, 11, .14); color: #fbbf24; border: 1px solid #f59e0b;
}
[data-theme="light"] .wsr-flag { background: #fff5e1; color: #b45309; }

/* middle: packing list (grid rows, not a nested table — see the header note) */
.wsr-pl { display: grid; font-size: 11.5px; }
.wsr-pl-h, .wsr-pl-r { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, .8fr) minmax(0, .7fr) .5fr .6fr .95fr .95fr; gap: 6px; padding: 4px 6px; border-bottom: 1px solid var(--border-color); align-items: center; }
.wsr-pl-h { font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; padding-top: 2px; }
.wsr-pl-r span, .wsr-pl-h span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wsr-pl .n { text-align: right; font-variant-numeric: tabular-nums; }
.wsr-pl-r .mono { font-size: 11px; }
.wsr-more { align-self: flex-start; border: 1px solid var(--border-color); background: var(--bg-primary); border-radius: 6px; padding: 3px 10px; font-size: 11.5px; font-weight: 600; color: #38bdf8; cursor: pointer; font-family: inherit; }
.wsr-more span { color: var(--text-muted); font-weight: 500; margin-left: 4px; }
[data-theme="light"] .wsr-more { color: #0a5989; background: #fff; }
.wsr-tot { display: flex; gap: 6px; flex-wrap: wrap; }
.wsr-card {
    flex: 1 1 74px; text-align: left; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 7px;
    padding: 4px 8px; position: relative; cursor: copy; color: var(--text-primary); font-family: inherit; transition: border-color .12s, background .12s;
}
.wsr-card span { display: block; font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.wsr-card b { font-variant-numeric: tabular-nums; font-size: 13px; }
.wsr-card svg { position: absolute; top: 5px; right: 6px; width: 11px; height: 11px; color: var(--text-muted); opacity: 0; transition: opacity .12s; }
.wsr-card:hover { border-color: #38bdf8; }
.wsr-card:hover svg, .wsr-card:focus-visible svg { opacity: 1; }
.wsr-card.done { border-color: #22c55e; background: rgba(34, 197, 94, .12); animation: wsrPulse .6s ease-out; }
.wsr-card.done b { color: #22c55e; }
.wsr-card.done svg { color: #22c55e; opacity: 1; width: 13px; height: 13px; }
[data-theme="light"] .wsr-card { background: #fff; }
[data-theme="light"] .wsr-card:hover { border-color: #0a5989; }
[data-theme="light"] .wsr-card.done { background: #e3f3eb; border-color: #15803d; }
[data-theme="light"] .wsr-card.done b, [data-theme="light"] .wsr-card.done svg { color: #15803d; }
@keyframes wsrPulse { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .45); } 100% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); } }
/* copied: the icon pops into a check that draws itself */
@keyframes wsrOkPop { 0% { transform: scale(.3) rotate(-25deg); opacity: 0; } 60% { transform: scale(1.25); opacity: 1; } 100% { transform: scale(1); } }
@keyframes wsrOkDraw { from { stroke-dashoffset: 16; } to { stroke-dashoffset: 0; } }
.wsr-ok { animation: wsrOkPop .32s cubic-bezier(.3, 1.5, .6, 1) both; }
.wsr-ok path { stroke-dasharray: 16; stroke-dashoffset: 16; animation: wsrOkDraw .28s .1s ease-out forwards; }

/* right: notes + the work that exists (theme navy, never purple) */
.wsr-notes { font-size: 12px; padding: 7px 10px; border-radius: 7px; background: var(--bg-primary); border: 1px solid var(--border-color); white-space: pre-line; }
[data-theme="light"] .wsr-notes { background: #fff; }
.wsr-none { font-size: 12px; color: var(--text-muted); }
.wsr-task { border: 1px solid var(--nav-bg-blend, #2f4f7a); border-radius: 8px; overflow: hidden; background: var(--bg-secondary); }
.wsr-task-h { display: flex; align-items: center; gap: 7px; padding: 6px 9px; background: var(--nav-bg-blend, #16213e); color: #fff; font-size: 12px; font-weight: 700; }
/* the light theme repaints plain blocks inside .wms-table-container: keep the nav navy */
.wms-table .wsr-task-h { background: #16213e !important; color: #fff !important; }
[data-theme="light"] .wms-table .wsr-task-h { background: #0a5989 !important; }
.wsr-task-h small { margin-left: auto; font-weight: 600; color: rgba(255, 255, 255, .8); }
.wsr-task-h .wsr-chip { background: rgba(255, 255, 255, .16); color: #fff; }
.wsr-task-g { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--border-color); }
.wsr-task-g > div { background: var(--bg-secondary); padding: 4px 8px 5px; min-width: 0; }
.wsr-task-g > div.w3 { grid-column: span 3; }
.wsr-task-g > div.w2 { grid-column: span 2; }
.wsr-task-g span { display: block; font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.wsr-task-g b { font-weight: 600; font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wsr-task-g > div.w3 b { white-space: normal; }
[data-theme="light"] .wsr-task { border-color: #0a5989; }

/* top-centre toast */
.wsr-toast {
    position: fixed; top: 14px; left: 50%; transform: translate(-50%, -8px); z-index: 10050;
    background: #102033; color: #fff; padding: 7px 14px; border-radius: 999px; font-size: 12px; font-weight: 600;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .35); opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s;
}
.wsr-toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) {
    .wsr-ribbon { grid-template-columns: 1fr; }
    .wsr-sec { border-right: 0; border-bottom: 1px solid var(--border-color); }
}
@media (prefers-reduced-motion: reduce) {
    .wsr-ribbon, .wsr-ok, .wsr-ok path, .wsr-card.done { animation: none; }
    .wsr-ok path { stroke-dashoffset: 0; }
    .wsr-toast { transition: none; }
}

/* ── Round 2 (owner 2026-10-11, after go-live) ─────────────────────────────
   The WMS table is light in BOTH themes, so the summary is the mockup's WHITE panel in both
   (it was a dark slab under white rows on the dark theme): the theme variables are re-pointed
   to the light set INSIDE the summary only. The copy toast is green. The status badge on the
   shipment rows stays on one line ("IN TRANSIT" wrapped to two). */
.wms-table .status-badge-wms { white-space: nowrap; }
.wms-table .brand-line.wsr-cust { color: #33465a; }
.wms-table .wsr-sub { color: #64748b; }
.wsr-qc { background: rgba(10, 89, 137, 0.12); color: #0a5989; }
.wsr-qc.na { background: #eef4f8; color: #536579; box-shadow: inset 0 0 0 1px #d6e2ea; }
html .wms-table tbody tr.wsr-exp > td,
html .wms-table tbody tr.wsr-exp:hover > td { background: #eaf3fb !important; border-bottom-color: #0a5989 !important; color: #102033 !important; }
.wsr-ribbon {
    --bg-primary: #f6f9fc; --bg-secondary: #ffffff; --bg-tertiary: #eef4f8;
    --text-primary: #102033; --text-secondary: #33465a; --text-muted: #536579;
    --border-color: #d6e2ea; --accent-blue: #0a5989;
    background: #ffffff; color: #102033; border-color: #d6e2ea; box-shadow: 0 6px 18px rgba(16, 32, 51, .08);
}
.wsr-ribbon .wsr-chip { background: #eef4f8; color: #33465a; }
.wsr-ribbon .wsr-chip.blue { background: #e0f2fe; color: #0369a1; }
.wsr-ribbon .wsr-chip.ok { background: #e3f3eb; color: #15803d; }
.wsr-ribbon .wsr-chip.red { background: #fdecec; color: #b91c1c; }
.wsr-ribbon .wsr-chip.amber { background: #fff5e1; color: #b45309; }
.wsr-ribbon .wsr-chip.purple { background: #f1edfc; color: #6d28d9; }
.wsr-ribbon .wsr-chip.mut { background: #eef4f8; color: #536579; }
.wsr-ribbon .wsr-task-h .wsr-chip { background: rgba(255, 255, 255, .18); color: #fff; }
.wsr-ribbon .wsr-flag { background: #fff5e1; color: #b45309; border-color: #f59e0b; }
.wsr-ribbon .wsr-ib, .wsr-ribbon .wsr-card, .wsr-ribbon .wsr-more { background: #ffffff; }
.wsr-ribbon .wsr-more { color: #0a5989; }
.wsr-ribbon .wsr-card:hover { border-color: #0a5989; }
.wsr-ribbon .wsr-card.done { background: #e3f3eb; border-color: #15803d; }
.wsr-ribbon .wsr-card.done b, .wsr-ribbon .wsr-card.done svg, .wsr-ribbon .wsr-cp.done { color: #15803d; }
.wsr-ribbon .wsr-notes { background: #f6f9fc; }
.wsr-ribbon .wsr-task { border-color: #0a5989; background: #ffffff; }
.wms-table .wsr-ribbon .wsr-task-h { background: #0a5989 !important; color: #fff !important; }
.wsr-toast { background: #15803d; color: #ffffff; box-shadow: 0 10px 26px rgba(21, 128, 61, .35); }
.wsr-toast::before { content: "\2713"; font-weight: 800; margin-right: 6px; }
/* themes.css paints `[data-theme="light"] div { background-color: inherit }` (0,1,1), which beats a
   single class: the summary's own panels carry an element + html prefix so their colour wins. */
html div.wsr-ribbon { background-color: #ffffff; }
html div.wsr-toast { background-color: #15803d; }
html .wsr-ribbon div.wsr-task, html .wsr-ribbon .wsr-task-g > div { background-color: #ffffff; }
html .wsr-ribbon div.wsr-task-g { background-color: #d6e2ea; }
html .wsr-ribbon div.wsr-notes { background-color: #f6f9fc; }
