:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --border: #2a2d3a;
    --text: #e1e4ed;
    --text-dim: #8b8fa3;
    --accent: #6c7ee1;
    --accent-hover: #8090f0;
    --group-bg: #161922;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
}
a { color: inherit; text-decoration: none; }

.shell-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.9rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}
.shell-header .brand { display: flex; align-items: center; gap: 0.55rem; font-size: 1.05rem; font-weight: 600; }
.shell-header .brand .logo { flex: 0 0 auto; display: block; }
.shell-header .brand .brand-mark { color: var(--accent); }
.shell-header .signout { color: var(--text-dim); font-size: 0.85rem; }
.shell-header .signout:hover { color: var(--text); }
.shell-header .shell-user { display: flex; align-items: center; gap: 0.7rem; }
.shell-header .user-name { color: var(--text); font-size: 0.85rem; font-weight: 500; }
.shell-header .user-name.muted { color: var(--text-dim); font-weight: 400; font-style: italic; }
.shell-header .user-avatar {
    width: 1.7rem; height: 1.7rem; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.78rem; font-weight: 600; line-height: 1;
}

.shell-layout {
    display: flex;
    min-height: calc(100vh - 56px);
}
.shell-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--group-bg);
    border-right: 1px solid var(--border);
    padding: 1rem 0;
}
.nav-group { margin-bottom: 1.25rem; }
.nav-group-title {
    padding: 0 1rem 0.4rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
}
.nav-item {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: var(--text);
    border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--surface); }
.nav-item.active {
    background: var(--surface);
    border-left-color: var(--accent);
    color: var(--accent);
    font-weight: 500;
}

.shell-content {
    flex: 1;
    padding: 1.25rem 2rem 2rem;   /* tighter top padding to compensate for the loader bar */
    min-width: 0;
}
.shell-content h1 { font-size: 1.4rem; margin-bottom: 1.25rem; }
.shell-content h2 { font-size: 1.1rem; margin: 1.5rem 0 0.75rem; color: var(--text-dim); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
}

/* Module page header — title block + outside search box */
.crud-page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1rem;
}
.crud-page-head h1 { font-size: 1.5rem; font-weight: 600; }
.crud-page-head .crud-search {
    flex: 0 1 320px;
    padding: 0.5rem 0.75rem 0.5rem 2rem;
    background: var(--bg) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b8fa3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='M21 21l-4.35-4.35'/></svg>") no-repeat 0.55rem 50%;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.85rem;
}

/* Tabs above the list card */
.crud-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}
.crud-tab {
    padding: 0.55rem 0.9rem;
    color: var(--text-dim);
    font-size: 0.85rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    display: inline-flex; align-items: center; gap: 0.4rem;
    text-decoration: none;
}
.crud-tab:hover { color: var(--text); }
.crud-tab.active {
    color: var(--text);
    font-weight: 500;
    border-bottom-color: var(--accent);
}
/* Reserve the bold-weight width so toggling weight on active doesn't shift the layout. */
.crud-tab .tab-label { display: inline-block; }
.crud-tab .tab-label::after {
    content: attr(data-text);
    display: block; height: 0; overflow: hidden;
    font-weight: 500;
    visibility: hidden;
}
.crud-tab .tab-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.3rem; padding: 0 0.4rem; height: 1.2rem;
    border-radius: 999px;
    background: var(--group-bg); color: var(--text-dim);
    font-size: 0.7rem; font-weight: 600; line-height: 1;
    border: 1px solid var(--border);
    box-sizing: border-box;
}
.crud-tab.active .tab-count {
    background: var(--accent); color: #fff; border-color: var(--accent);
}

/* List card — bordered container around rows + pagination */
.crud-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

/* Page header bar — title block left, search box right (above tabs).
   A subtle line under the header separates the page identity from the controls below. */
.crud-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}
.crud-header-row .title-block { min-width: 0; flex: 1; }
.crud-search-wrap { flex: 0 1 360px; }
.crud-search {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.85rem;
}
.crud-search:focus { outline: none; border-color: var(--accent); }

/* Filter row — sticky inline dropdowns, +, sort, view toggle, clear all (icon).
   Single horizontal line; wraps if it has to. */
.crud-filter-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    min-height: 2rem;
}

/* Sticky filter dropdown — `<details>` styled as a button */
.crud-fd { position: relative; }
.crud-fd > summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-dim);
    user-select: none;
}
.crud-fd > summary::-webkit-details-marker { display: none; }
.crud-fd > summary:hover { color: var(--text); border-color: var(--text-dim); }
.crud-fd > summary .caret { font-size: 0.65rem; opacity: 0.7; }
.crud-fd > summary .selected { color: var(--text); }
.crud-fd.has-active > summary {
    color: var(--text);
    border-color: var(--accent);
    background: rgba(108, 126, 225, 0.08);
}
.crud-fd[open] > summary { color: var(--text); }

.crud-fd-panel {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    z-index: 30;
    min-width: 200px;
    max-width: 320px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    padding: 0.4rem 0;
    max-height: 60vh;
    overflow-y: auto;
}
.crud-fd-panel .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem 0.85rem 0.4rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.25rem;
}
.crud-fd-panel .panel-header .title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
}
.crud-fd-panel .panel-header a {
    font-size: 0.72rem;
    color: var(--text-dim);
    text-decoration: none;
}
.crud-fd-panel .panel-header a:hover { color: var(--text); }
.crud-fd-option {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem 0.85rem;
    font-size: 0.82rem;
    color: var(--text);
    cursor: pointer;
}
.crud-fd-option:hover { background: rgba(255, 255, 255, 0.03); }
.crud-fd-option input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }

/* "+" button at the end of the filter row (placeholder for adding more filters) */
.crud-add-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: 6px;
    color: var(--text-dim);
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
}
.crud-add-more:hover { color: var(--text); border-color: var(--text-dim); }

/* Sort dropdown — GitHub-style combined field + direction picker */
.crud-sort { position: relative; margin-left: auto; }
.crud-sort > summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text);
    user-select: none;
}
.crud-sort > summary::-webkit-details-marker { display: none; }
.crud-sort > summary .label { color: var(--text-dim); }
.crud-sort > summary .dir { color: var(--text-dim); }
.crud-sort > summary .caret { font-size: 0.65rem; opacity: 0.7; }
.crud-sort > summary:hover { border-color: var(--text-dim); }
.crud-sort-panel {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    z-index: 30;
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    padding: 0.4rem 0;
}
.crud-sort-panel a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    color: var(--text);
    text-decoration: none;
}
.crud-sort-panel a:hover { background: rgba(255, 255, 255, 0.03); }
.crud-sort-panel a .check { width: 0.85rem; color: var(--accent); }
.crud-sort-panel hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0.25rem 0;
}

/* Icon-only buttons for view toggle and clear all */
.crud-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-dim);
    font-size: 0.95rem;
    text-decoration: none;
    line-height: 1;
}
.crud-icon-btn:hover { color: var(--text); border-color: var(--text-dim); }
.crud-icon-btn.active { color: var(--text); background: rgba(108, 126, 225, 0.12); border-color: var(--accent); }
.crud-view-toggle-icons { display: inline-flex; gap: 0.25rem; }

/* Subtle hint badge under the page title (e.g. "Searching across all" / "12 rows · Fulfillment") */
.crud-meta-hint {
    color: var(--text-dim);
    font-size: 0.82rem;
    margin-top: 0.25rem;
}

/* Row — flex with leading icon, title block, badges, meta */
.crud-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: background 80ms ease-out;
}
.crud-row:last-child { border-bottom: none; }
.crud-row:hover { background: rgba(255, 255, 255, 0.02); }
.crud-row .lead {
    width: 24px; height: 24px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; font-size: 0.85rem; font-weight: 600;
}
.crud-row .lead.on  { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.crud-row .lead.off { background: rgba(139, 143, 163, 0.15); color: #8b8fa3; }
.crud-row .text { flex: 1; min-width: 0; }
.crud-row .title { font-weight: 500; color: var(--text); font-size: 0.95rem; }
.crud-row .title a { color: inherit; text-decoration: none; }
.crud-row .title a:hover { color: var(--accent); }
.crud-row .subtitle { color: var(--text-dim); font-size: 0.8rem; margin-top: 0.15rem; }
.crud-row .badges { display: flex; gap: 0.35rem; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; max-width: 40%; }
.crud-row .badge {
    padding: 0.15rem 0.55rem;
    background: var(--group-bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.72rem;
    color: var(--text-dim);
    white-space: nowrap;
}
/* Semantic badge colors — apply via .badge.green / .badge.yellow / .badge.red etc. */
.badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.72rem; white-space: nowrap; border: 1px solid; }
.badge.green  { color: #4ade80; background: rgba(74, 222, 128, 0.10); border-color: rgba(74, 222, 128, 0.35); }
.badge.yellow { color: #fbbf24; background: rgba(251, 191, 36, 0.10); border-color: rgba(251, 191, 36, 0.35); }
.badge.red    { color: #f87171; background: rgba(248, 113, 113, 0.10); border-color: rgba(248, 113, 113, 0.35); }
.badge.blue   { color: #6c7ee1; background: rgba(108, 126, 225, 0.10); border-color: rgba(108, 126, 225, 0.35); }
.badge.gray   { color: var(--text-dim); background: var(--group-bg); border-color: var(--border); }

/* Reorder row v2 — three-line card with stats strip + per-size pills */
.reorder-row-v2 {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
}
.reorder-row-v2:last-child { border-bottom: none; }
.reorder-row-v2:hover { background: rgba(255, 255, 255, 0.02); }
.reorder-row-head {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
}
.reorder-row-head > .thumb { flex: 0 0 auto; }
.reorder-row-head > .identity { flex: 1 1 240px; min-width: 0; padding-top: 0.15rem; }
.reorder-row-head > .country-chip,
.reorder-row-head > .row-country-stats,
.reorder-row-head > .badge,
.reorder-row-head > .qty-block,
.reorder-row-head > .row-flag-side,
.reorder-row-head > .row-actions { flex: 0 0 auto; align-self: center; }
.reorder-row-head .thumb {
    width: 56px; height: 56px; border-radius: 6px;
    background: var(--group-bg); border: 1px solid var(--border); object-fit: cover;
}
.reorder-row-head .thumb.placeholder {
    display: flex; align-items: center; justify-content: center; color: var(--text-dim);
}
.reorder-row-head .identity { min-width: 0; padding-top: 0.15rem; }
.reorder-row-head .name {
    font-weight: 500; font-size: 0.95rem; color: var(--text);
}
.reorder-row-head .name a { color: inherit; text-decoration: none; }
.reorder-row-head .name a:hover { color: var(--accent); }
.reorder-row-head .sub { color: var(--text-dim); font-size: 0.8rem; margin-top: 0.15rem; }
.reorder-row-head .qty-block {
    text-align: center; font-family: 'SF Mono', monospace; min-width: 3.25rem;
    align-self: center;
}
/* Right-side cells (decision badge, qty, action group) vertically center
   even though the row grid is top-aligned for the identity column. */
.reorder-row-head > .badge,
.reorder-row-head > .decision-badge,
.reorder-row-head > .qty-block,
.reorder-row-head > .row-actions,
.reorder-row-head > .row-action-btn {
    align-self: center;
}
.reorder-row-head .qty-num { font-size: 1.05rem; font-weight: 600; color: var(--text); display: block; }
.reorder-row-head .qty-lbl { color: var(--text-dim); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em; }
.row-action {
    width: 1.85rem; height: 1.85rem;
    background: transparent; border: 1px solid transparent; border-radius: 6px;
    color: var(--text-dim); font-size: 1rem; cursor: pointer; line-height: 1;
}
.row-action:hover { color: var(--text); border-color: var(--border); background: rgba(255,255,255,0.03); }

/* Row workflow action group */
.row-actions { display: inline-flex; gap: 0.3rem; }
.row-action-btn {
    padding: 0.3rem 0.65rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-dim);
    font-size: 0.75rem;
    cursor: pointer;
    line-height: 1.2;
    white-space: nowrap;
}
.row-action-btn:hover { color: var(--text); border-color: var(--text-dim); }
.row-action-btn.primary {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}
.row-action-btn.primary:hover { opacity: 0.9; }

/* Stats strip — destination · stock · FDS · DOC */
.stats-strip {
    display: flex; flex-wrap: wrap; gap: 1.25rem;
    padding-left: calc(56px + 1rem);
    font-size: 0.78rem;
}
.stats-strip .stat { display: inline-flex; align-items: baseline; gap: 0.4rem; }
.stats-strip .stat-label { color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.68rem; }
.stats-strip .stat-val { color: var(--text); font-family: 'SF Mono', monospace; }

/* Per-size pills */
.size-strip {
    display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center;
    padding-left: calc(56px + 1rem);
}
/* When the size pills live inside the identity column (under the SKU line),
   they should sit left-aligned with a bit of breathing room above. */
.reorder-row-head .identity .size-strip {
    padding-left: 0;
    margin-top: 0.45rem;
}
.size-strip .strip-label {
    color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em;
    font-size: 0.65rem; margin-right: 0.25rem;
}
.size-pill {
    padding: 0.15rem 0.5rem;
    background: var(--group-bg); border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.72rem; font-family: 'SF Mono', monospace; color: var(--text);
}
.size-pill.empty {
    color: var(--text-dim); font-style: italic; font-family: inherit;
    border-style: dashed;
}

/* Page-level action buttons (placebo) — sit in the header row, right of search */
.crud-page-actions {
    display: flex; gap: 0.4rem; flex-wrap: wrap;
}
.crud-action-btn {
    padding: 0.5rem 0.85rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.85rem;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
}
.crud-action-btn:hover { border-color: var(--text-dim); }
.crud-action-btn.primary {
    background: var(--accent); color: white; border-color: var(--accent);
}
.crud-action-btn.primary:hover { opacity: 0.92; }

/* Reorder-specific row styling — overrides generic .crud-row layout for cards with image lead */
.reorder-row {
    display: grid;
    grid-template-columns: 56px 1fr auto auto auto;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}
.reorder-row:last-child { border-bottom: none; }
.reorder-row:hover { background: rgba(255, 255, 255, 0.02); }
.reorder-row .thumb {
    width: 56px; height: 56px;
    background: var(--group-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    object-fit: cover;
}
.reorder-row .thumb.placeholder {
    display: flex; align-items: center; justify-content: center;
    color: var(--text-dim); font-size: 0.7rem;
}
.reorder-row .text { min-width: 0; }
.reorder-row .text .name { font-weight: 500; font-size: 0.95rem; }
.reorder-row .text .name a { color: var(--text); text-decoration: none; }
.reorder-row .text .name a:hover { color: var(--accent); }
.reorder-row .text .meta { color: var(--text-dim); font-size: 0.78rem; margin-top: 0.2rem; }
.reorder-row .meta-cell { color: var(--text-dim); font-size: 0.85rem; text-align: right; min-width: 5rem; font-family: 'SF Mono', monospace; }
.reorder-row .meta-cell .label { font-size: 0.7rem; color: var(--text-dim); display: block; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.7; margin-bottom: 0.15rem; }
.reorder-row .meta-cell .val { color: var(--text); font-weight: 500; }

/* Reorder detail page */
.reorder-hero {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 1.5rem;
    align-items: start;
    padding: 0.75rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1rem;
}
.reorder-hero .thumb-lg {
    width: 120px; height: 120px;
    border-radius: 8px;
    background: var(--group-bg);
    border: 1px solid var(--border);
    object-fit: cover;
}
.reorder-hero h2 { font-size: 1.25rem; margin: 0.25rem 0 0.4rem; }
.reorder-hero .hero-title-row {
    display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
}
.reorder-hero .hero-destination {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    background: var(--group-bg); border: 1px solid var(--border); border-radius: 6px;
    font-size: 0.85rem; white-space: nowrap;
}
.reorder-hero .hero-destination .flag { font-size: 1rem; line-height: 1; }
.reorder-hero .hero-destination strong { letter-spacing: 0.04em; }

/* Section flag — flag emoji prefix in matrix section headers. */
.reorder-section h3 { display: inline-flex; align-items: center; gap: 0.4rem; }
.reorder-section h3 .section-flag { font-size: 1.15rem; line-height: 1; display: inline-block; }
.reorder-hero .sub { color: var(--text-dim); font-size: 0.85rem; line-height: 1.5; }
.reorder-hero .right { text-align: right; }
.reorder-hero .qty-big { font-size: 2rem; font-weight: 600; color: var(--text); }
.reorder-hero .qty-label { color: var(--text-dim); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
.reorder-hero .hero-flags { display: flex; flex-direction: column; gap: 0.3rem; align-items: flex-end; margin-top: 0.4rem; }

.reorder-section { margin-bottom: 1rem; }
.reorder-section h3 {
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-dim); margin-bottom: 0.5rem;
}
.reorder-allocation {
    display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.reorder-allocation .alloc {
    padding: 0.5rem 0.85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
}
.reorder-allocation .alloc .wh { color: var(--text-dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.reorder-allocation .alloc .qty { font-weight: 600; font-family: 'SF Mono', monospace; }

.reorder-sizes-table {
    width: 100%; border-collapse: collapse; font-size: 0.85rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.reorder-sizes-table thead th {
    text-align: left; padding: 0.55rem 0.85rem;
    background: var(--group-bg); color: var(--text-dim);
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500;
    border-bottom: 1px solid var(--border);
}
.reorder-sizes-table tbody td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.reorder-sizes-table tbody tr:last-child td { border-bottom: none; }
.reorder-sizes-table .why { color: var(--text-dim); font-size: 0.78rem; max-width: 28rem; }
.crud-row .meta {
    flex-shrink: 0;
    text-align: right;
    color: var(--text-dim);
    font-size: 0.78rem;
    font-family: 'SF Mono', monospace;
    min-width: 4rem;
}

.crud-card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--group-bg);
    font-size: 0.85rem;
}
.crud-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-dim);
    font-style: italic;
}

/* Small total-results label above the grid, right-aligned */
.crud-results-count {
    text-align: right;
    color: var(--text-dim);
    font-size: 0.75rem;
    margin-bottom: 0.4rem;
    padding-right: 0.25rem;
}

/* View-mode toggle (Rows / Table) — pill-style segmented control in the card header */
.crud-view-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.crud-view-toggle a {
    padding: 0.25rem 0.55rem;
    color: var(--text-dim);
    font-size: 0.78rem;
    text-decoration: none;
    border-right: 1px solid var(--border);
    line-height: 1;
}
.crud-view-toggle a:last-child { border-right: none; }
.crud-view-toggle a:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.crud-view-toggle a.active {
    color: var(--text);
    background: rgba(108, 126, 225, 0.18);
}

/* Compact table view — alternative dense grid */
.crud-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.crud-grid thead tr { color: var(--text-dim); text-align: left; }
.crud-grid th {
    padding: 0.55rem 1rem;
    border-bottom: 1px solid var(--border);
    font-weight: 500;
    background: var(--group-bg);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.crud-grid td {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border);
}
.crud-grid tbody tr:last-child td { border-bottom: none; }
.crud-grid tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.crud-grid a { color: var(--accent); text-decoration: none; }

/* htmx loading indicator — thin animated bar pinned above the page content.
   Always occupies 2px so showing/hiding doesn't shift the layout below it.
   Currently pinned visible+animated for visual verification; flip back to
   opacity:0 + remove animation once happy with placement. */
.crud-loading {
    height: 2px;
    margin-bottom: 0.5rem;
    border-radius: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%);
    background-size: 200% 100%;
    opacity: 1; /* TEMP: pinned visible — change to 0 to restore on-request only */
    animation: crud-loading-shimmer 1.2s linear infinite; /* TEMP: always animating */
    transition: opacity 120ms ease-out;
}
.htmx-request .crud-loading,
.crud-loading.htmx-request {
    opacity: 1;
    animation: crud-loading-shimmer 1.2s linear infinite;
}
@keyframes crud-loading-shimmer {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* Dim the table area while a tab/filter swap is in flight so the click feels
   acknowledged even before the response lands. */
.crud-tab.htmx-request ~ * #crud-table-area,
.crud-tabs .htmx-request,
#crud-table-area.htmx-request { opacity: 0.55; transition: opacity 120ms ease-out; }

/* Error fragment shown when the search request throws */
.crud-error {
    padding: 1.25rem;
    border: 1px solid #f87171;
    background: rgba(248, 113, 113, 0.08);
    border-radius: 8px;
    color: #fca5a5;
    font-size: 0.85rem;
}
.crud-error h3 { margin-bottom: 0.5rem; color: #f87171; font-size: 0.95rem; }
.crud-error code { font-family: 'SF Mono', monospace; background: rgba(0,0,0,0.25); padding: 0.1rem 0.35rem; border-radius: 3px; }

/* ============================================================
   Reorder DETAIL page — extends the .reorder-* classes above
   ============================================================ */

.detail-back {
    color: var(--text-dim); font-size: 0.85rem; cursor: pointer; text-decoration: none;
}
.detail-back:hover { color: var(--text); }

/* Top bar: back link on the left, action buttons on the right. */
.detail-top-bar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.75rem; gap: 0.6rem;
}
.detail-actions { display: flex; gap: 0.4rem; margin-left: auto; }

/* Square-edge action buttons (chips) with soft tints.
   "reorder" is the happy primary on the far right; others are muted. */
.action-chip {
    padding: 0.45rem 0.95rem; border-radius: 6px; font-size: 0.82rem;
    line-height: 1.2; white-space: nowrap; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text); transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.action-chip:hover { border-color: var(--text-dim); }

.action-chip.reorder {
    background: rgba(46, 160, 67, 0.18);
    border-color: rgba(46, 160, 67, 0.55);
    color: #56d364; font-weight: 600;
}
.action-chip.reorder:hover {
    background: rgba(46, 160, 67, 0.28);
    border-color: rgba(46, 160, 67, 0.85);
}

.action-chip.snooze {
    background: rgba(209, 154, 102, 0.10);
    color: #d1aa66;
}
.action-chip.snooze:hover { background: rgba(209, 154, 102, 0.20); border-color: rgba(209, 154, 102, 0.55); }

.action-chip.delist {
    background: rgba(248, 81, 73, 0.08);
    color: #f87171;
}
.action-chip.delist:hover { background: rgba(248, 81, 73, 0.16); border-color: rgba(248, 81, 73, 0.55); }

.action-chip.nfr {
    background: rgba(148, 148, 158, 0.10);
    color: var(--text-dim);
}
.action-chip.nfr:hover { background: rgba(148, 148, 158, 0.20); border-color: var(--text-dim); }

/* Popover-style dialog anchored to the top-right, near the action buttons. */
.action-dialog[open] {
    position: fixed; top: 4.5rem; right: 1.5rem; left: auto; bottom: auto;
    margin: 0; inset: auto 1.5rem auto auto;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface); color: var(--text);
    padding: 1.1rem 1.25rem; min-width: 320px; max-width: 420px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}
.action-dialog::backdrop { background: rgba(0,0,0,0.35); }
.action-dialog h3 { margin: 0 0 0.9rem; font-size: 1rem; }
.action-dialog form { display: flex; flex-direction: column; gap: 0.7rem; }
.action-dialog label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.78rem; color: var(--text-dim); }
.action-dialog input, .action-dialog select, .action-dialog textarea {
    padding: 0.45rem 0.6rem; background: var(--bg);
    border: 1px solid var(--border); border-radius: 6px; color: var(--text);
    font-size: 0.85rem;
}
.action-dialog textarea { resize: vertical; min-height: 3rem; }
.action-dialog .dialog-actions {
    margin: 0.4rem 0 0;
    display: flex; justify-content: flex-end; gap: 0.4rem;
}

/* Quick-pick chips under a date input — clicking sets the input to today + offset. */
.action-dialog .preset-chips {
    display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: -0.25rem;
}
.preset-chip {
    padding: 0.25rem 0.55rem;
    background: transparent; border: 1px solid var(--border); border-radius: 4px;
    color: var(--text-dim); font-size: 0.72rem; cursor: pointer; line-height: 1.2;
}
.preset-chip:hover { color: var(--text); border-color: var(--text-dim); background: rgba(255,255,255,0.03); }

/* ============================================================
   Country chip — flag + country code, used in row destination col + dialog title.
   ============================================================ */
/* Inline country flag positioned next to the qty block (right side of the row). */
.reorder-row-head .row-flag-side {
    font-size: 1.4rem; line-height: 1; align-self: center; margin-right: 0.15rem;
}

.country-chip {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.25rem 0.55rem;
    background: var(--group-bg); border: 1px solid var(--border); border-radius: 6px;
    font-size: 0.78rem; font-weight: 500; color: var(--text);
}
.country-chip .flag { font-size: 0.95rem; line-height: 1; }
.country-chip .cc { letter-spacing: 0.04em; }
.country-chip.inline { vertical-align: middle; margin-left: 0.35rem; }

/* Country-scoped stat strip inside a row — sits under the sizes in the identity column. */
.reorder-row-head .identity .row-country-stats {
    display: flex; gap: 0.85rem; align-items: center;
    margin-top: 0.45rem;
    font-size: 0.78rem;
}
.row-country-stats {
    display: flex; gap: 0.85rem; align-items: center;
    font-size: 0.78rem;
}
.row-country-stats .stat { display: inline-flex; align-items: baseline; gap: 0.35rem; }
.row-country-stats .stat-label { color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.66rem; }
.row-country-stats .stat-val { color: var(--text); font-family: 'SF Mono', monospace; font-weight: 500; }

/* ============================================================
   Per-row single-country reorder modal (list page).
   ============================================================ */
/* Slide-in panel from the right — full height, fixed width. */
.row-reorder-dialog[open] {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: auto;
    margin: 0; inset: 0 0 0 auto;
    width: min(680px, 92vw); height: 100vh; max-height: 100vh;
    border: none; border-left: 1px solid var(--border); border-radius: 0;
    background: var(--surface); color: var(--text);
    padding: 1.25rem 1.5rem; max-width: none;
    overflow-y: auto;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.35);
    animation: rowDlgSlideIn 0.2s ease-out;
}
.row-reorder-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
@keyframes rowDlgSlideIn {
    from { transform: translateX(40px); opacity: 0.4; }
    to   { transform: translateX(0); opacity: 1; }
}
.row-reorder-dialog::backdrop { background: rgba(0,0,0,0.45); }
.row-dlg-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; margin-bottom: 0.85rem;
}
.row-dlg-head h3 { margin: 0; font-size: 1rem; font-weight: 500; }
.row-dlg-head .muted { font-size: 0.78rem; margin-top: 0.2rem; }
.dlg-hint { font-size: 0.78rem; margin: 0 0 0.85rem; line-height: 1.45; }

.row-dlg-table { width: 100%; border-collapse: collapse; }
.row-dlg-table th, .row-dlg-table td {
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: right;
}
.row-dlg-table th:first-child, .row-dlg-table td:first-child { text-align: left; }
.row-dlg-table th {
    font-size: 0.65rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-dim); background: var(--group-bg);
}
.row-dlg-table .num { font-family: 'SF Mono', monospace; font-size: 0.85rem; }
.row-dlg-table .num.muted { color: var(--text-dim); }
.row-dlg-table .delta { color: var(--text-dim); }
.row-dlg-table .delta.up { color: #56d364; }
.row-dlg-table .delta.down { color: #f87171; }
.row-dlg-qty {
    width: 4rem; padding: 0.3rem 0.45rem;
    background: var(--bg); border: 1px solid var(--border); border-radius: 5px;
    color: var(--accent); font-weight: 600; font-family: 'SF Mono', monospace;
    text-align: right; font-size: 0.88rem;
    -moz-appearance: textfield;
}
.row-dlg-qty::-webkit-outer-spin-button,
.row-dlg-qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.row-dlg-qty:focus { outline: none; border-color: var(--accent); }
.row-dlg-table .total-row td { background: var(--group-bg); font-weight: 600; }
.row-dlg-actions {
    display: flex; justify-content: flex-end; gap: 0.4rem; margin-top: 0.85rem;
}

/* Submit-with-spinner: shows a tiny rotating ring while the request is in flight.
   htmx automatically applies `.htmx-request` to the originating element + the form. */
.row-action-btn.with-spinner {
    position: relative; min-width: 9rem;
    display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
}
.row-action-btn.with-spinner .btn-spinner {
    display: none; width: 0.85rem; height: 0.85rem; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent;
    animation: btnSpin 0.65s linear infinite;
}
.row-action-btn.with-spinner.htmx-request,
.htmx-request .row-action-btn.with-spinner {
    pointer-events: none; opacity: 0.85;
}
.row-action-btn.with-spinner.htmx-request .btn-spinner,
.htmx-request .row-action-btn.with-spinner .btn-spinner { display: inline-block; }
@keyframes btnSpin { to { transform: rotate(360deg); } }

/* While the form is submitting, dim the whole dialog body so users can't tweak it. */
.row-reorder-dialog form.htmx-request .row-dlg-table { opacity: 0.6; pointer-events: none; }

/* ============================================================
   Approval drawer — slide-in panel from the right for multi-country
   reorder approval. Hidden by default, .open class slides it in.
   ============================================================ */

.approval-drawer {
    position: fixed; inset: 0;
    z-index: 200;
    display: none;
}
.approval-drawer.open { display: block; }

.approval-backdrop {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, 0.55);
    animation: approvalFadeIn 0.18s ease-out;
}

.approval-panel {
    position: absolute; top: 0; right: 0; bottom: 0;
    width: min(960px, 92vw);
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.35);
    display: flex; flex-direction: column;
    animation: approvalSlideIn 0.22s ease-out;
}

@keyframes approvalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes approvalSlideIn { from { transform: translateX(40px); opacity: 0.4; } to { transform: translateX(0); opacity: 1; } }

.approval-header {
    padding: 1.1rem 1.5rem 0.85rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem;
}
.approval-header h2 { margin: 0; font-size: 1.1rem; }
.approval-sub { font-size: 0.82rem; margin-top: 0.2rem; }

.approval-close {
    background: transparent; border: 1px solid transparent;
    width: 2rem; height: 2rem; border-radius: 6px;
    color: var(--text-dim); font-size: 1rem; cursor: pointer; line-height: 1;
}
.approval-close:hover { color: var(--text); border-color: var(--border); background: rgba(255,255,255,0.04); }

.approval-po {
    padding: 0.85rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--group-bg);
}
.approval-po label {
    display: flex; align-items: center; gap: 0.6rem;
    font-size: 0.82rem; color: var(--text-dim);
}
.approval-po input {
    margin-left: auto; flex: 0 1 220px;
    padding: 0.4rem 0.6rem; background: var(--bg);
    border: 1px solid var(--border); border-radius: 6px;
    color: var(--text); font-size: 0.85rem;
}

.approval-body {
    flex: 1; overflow-y: auto; padding: 1.25rem 1.5rem;
    display: flex; flex-direction: column; gap: 1.25rem;
}

/* Matrix view — rows = sizes, columns = countries. Compact, scannable. */
.approval-matrix {
    width: 100%; border-collapse: separate; border-spacing: 0;
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
    overflow: hidden;
}
.approval-matrix th, .approval-matrix td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border);
}
.approval-matrix tbody tr:last-child td { border-bottom: none; }

.approval-matrix .approval-mx-size {
    text-align: left; font-weight: 500;
    width: 4rem;
    background: var(--surface);
}
.approval-matrix thead .approval-mx-size {
    font-size: 0.65rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-dim); background: var(--group-bg);
}

.approval-matrix .approval-mx-country {
    text-align: center;
    background: var(--group-bg);
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.mx-country-h { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; }
.mx-country-h > strong { font-size: 0.9rem; }
.mx-country-h > .muted { font-size: 0.65rem; }
.mx-country-meta {
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    margin-top: 0.4rem; font-size: 0.7rem;
}
.approval-reset-mini {
    padding: 0.15rem 0.45rem;
    background: transparent; border: 1px solid var(--border); border-radius: 4px;
    color: var(--text-dim); font-size: 0.65rem; cursor: pointer; line-height: 1.2;
}
.approval-reset-mini:hover { border-color: var(--text-dim); color: var(--text); }

.approval-matrix tbody td.approval-mx-cell {
    background: var(--bg); text-align: center; vertical-align: middle;
    padding: 0.55rem 0.55rem;
}
.mx-cell {
    display: flex; align-items: center; justify-content: center; gap: 0.3rem;
}
.mx-rec {
    font-size: 0.62rem; text-align: center; margin-top: 0.2rem;
    color: var(--text-dim); letter-spacing: 0.02em;
}

.approval-qty {
    width: 3.25rem; padding: 0.3rem 0.4rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: 5px;
    color: var(--accent); font-weight: 600; font-family: 'SF Mono', monospace;
    text-align: center; font-size: 0.88rem;
    -moz-appearance: textfield;
}
.approval-qty::-webkit-outer-spin-button,
.approval-qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.approval-qty:focus { outline: none; border-color: var(--accent); }

.approval-mx-cell.has-qty .approval-qty { border-color: rgba(46, 160, 67, 0.55); background: rgba(46, 160, 67, 0.08); }

.mx-delta { font-family: 'SF Mono', monospace; font-size: 0.72rem; min-width: 1.5rem; text-align: left; }
.mx-delta.up   { color: #56d364; }
.mx-delta.down { color: #f87171; }

.approval-mx-total {
    text-align: center; font-family: 'SF Mono', monospace; font-weight: 500;
    background: var(--surface); width: 4rem;
}
.approval-matrix thead .approval-mx-total {
    font-size: 0.65rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-dim); background: var(--group-bg); font-family: inherit;
}
.mx-row-total.has-qty { color: var(--accent); font-weight: 600; }
.mx-grand-total { font-weight: 700; font-size: 0.95rem; }

.approval-total-row td {
    background: var(--group-bg) !important; font-weight: 600; font-family: 'SF Mono', monospace;
    border-top: 1px solid var(--border);
}
.approval-total-row .approval-mx-size { font-family: inherit; }
.approval-total-row .approval-mx-country.has-qty { color: var(--accent); }

.approval-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem;
}
.approval-total-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.approval-total-num { font-size: 1.15rem; font-weight: 600; font-family: 'SF Mono', monospace; }
.approval-total-num .muted { font-weight: 400; font-size: 0.85rem; }
.approval-actions { display: flex; gap: 0.4rem; }

/* Click-to-copy helper — applied to SKU prefix pills, etc. */
.copyable { cursor: copy; user-select: none; transition: background 0.12s; }
.copyable:hover { filter: brightness(1.12); }

/* Plain-text SKU prefix with a faint tint to hint it's clickable/copyable. */
.sku-text {
    color: #f0b97a;
    font-family: 'SF Mono', monospace;
    font-size: 0.78rem;
}
.sku-text:hover { color: #ffd1a3; }
/* Floating checkmark dropped at the click position; fades after ~0.9s. */
.copy-flash {
    position: fixed; z-index: 9999; pointer-events: none;
    width: 1rem; height: 1rem; border-radius: 50%;
    background: #2ea043; color: #fff; font-size: 0.7rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
    animation: copyPop 0.9s ease-out forwards;
}
@keyframes copyPop {
    0%   { transform: scale(0.5) translateY(0); opacity: 0; }
    20%  { transform: scale(1.15) translateY(-2px); opacity: 1; }
    60%  { transform: scale(1) translateY(-4px); opacity: 1; }
    100% { transform: scale(1) translateY(-10px); opacity: 0; }
}

/* Pill row in identity card — inherits .badge-style padding */
.pill-row { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.5rem 0 0.75rem; }
.pill-sku {
    padding: 0.18rem 0.55rem; border-radius: 4px;
    font-size: 0.72rem; font-family: 'SF Mono', monospace;
    background: var(--group-bg); color: var(--text); border: 1px solid var(--border);
}
.pill-sku.peach    { background: rgba(255, 178, 122, 0.12); color: #ffc599; border-color: rgba(255, 178, 122, 0.30); }
.pill-sku.lavender { background: rgba(180, 165, 245, 0.12); color: #c5b8fc; border-color: rgba(180, 165, 245, 0.30); }
.pill-sku.muted    { color: var(--text-dim); }

.meta-grid {
    display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem;
    margin-top: 0.4rem;
}
.meta-grid .meta-cell { flex: 0 0 auto; }
.meta-grid .meta-cell { font-size: 0.85rem; }
.meta-grid .meta-cell .label {
    color: var(--text-dim); font-size: 0.65rem; text-transform: uppercase;
    letter-spacing: 0.05em; margin-bottom: 0.15rem; display: block;
}
.meta-grid .meta-cell .val { color: var(--text); }
.reorder-hero .qty-aside { color: var(--text-dim); font-size: 0.78rem; margin-top: 0.4rem; }

/* Stat tiles row */
.stat-tiles {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.85rem; margin-bottom: 1rem;
}
.stat-tile {
    padding: 0.85rem 1rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.stat-tile.accent { border-color: var(--accent); background: rgba(108, 126, 225, 0.08); }
/* Reorder tile — same accent as other tiles but with the decision badge as a foot strip. */
.stat-tile.reorder-tile { display: flex; flex-direction: column; gap: 0.25rem; }
.stat-tile.reorder-tile .num { font-size: 1.7rem; line-height: 1.1; }
.stat-tile.reorder-tile .tile-foot {
    display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.35rem;
}
.stat-tile .label {
    color: var(--text-dim); font-size: 0.65rem; text-transform: uppercase;
    letter-spacing: 0.05em; display: block; margin-bottom: 0.35rem;
}
.stat-tile .num { font-size: 1.4rem; font-weight: 600; color: var(--text); font-family: 'SF Mono', monospace; }
.stat-tile .sub { font-size: 0.72rem; color: var(--text-dim); margin-top: 0.25rem; }

/* Status banner (snoozed / delisted / reordered / rejected) */
.status-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: 6px;
    margin-bottom: 1rem; font-size: 0.85rem;
}
.status-banner.snoozed   { background: rgba(251, 191, 36, 0.08); border-color: rgba(251, 191, 36, 0.30); }
.status-banner.delisted  { background: rgba(248, 113, 113, 0.08); border-color: rgba(248, 113, 113, 0.30); }
.status-banner.reordered { background: rgba(74, 222, 128, 0.08); border-color: rgba(74, 222, 128, 0.30); }
.status-banner.rejected  { background: var(--group-bg); }
.status-banner .notes { color: var(--text-dim); font-size: 0.8rem; margin-top: 0.3rem; }
.status-banner form { margin: 0; }

/* Country breakdown grid */
.country-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; }
.country-card {
    padding: 0.85rem 1rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
    display: flex; flex-direction: column; gap: 0.5rem;
}
.country-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.country-code { font-weight: 600; font-size: 1.1rem; color: var(--text); }
.country-whs { font-size: 0.7rem; color: var(--text-dim); font-family: 'SF Mono', monospace; }
.country-stats { display: flex; flex-wrap: wrap; gap: 0.85rem; font-size: 0.78rem; }
.country-stats .stat { display: inline-flex; align-items: baseline; gap: 0.35rem; }
.country-stats .stat-label { color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.65rem; }
.country-stats .stat-val { font-family: 'SF Mono', monospace; color: var(--text); }
.country-card .size-strip { padding-left: 0; }

/* Reorder approval form */
.order-form {
    background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
    padding: 0.85rem 1rem; margin-bottom: 0.85rem;
}
.order-form-head {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    margin-bottom: 0.65rem; font-size: 0.9rem;
}
.order-form-head label { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; color: var(--text-dim); }
.order-form-head input { padding: 0.25rem 0.5rem; background: var(--bg); border: 1px solid var(--border); border-radius: 3px; color: var(--text); font-size: 0.82rem; }
.qty-grid {
    width: 100%; border-collapse: collapse; font-size: 0.85rem;
    background: var(--bg);
}
.qty-grid th, .qty-grid td { padding: 0.45rem 0.65rem; text-align: left; border-bottom: 1px solid var(--border); }
.qty-grid th { color: var(--text-dim); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500; }
.qty-grid .num { text-align: right; font-family: 'SF Mono', monospace; }
.qty-grid .sz { font-weight: 500; }
.qty-grid .muted { color: var(--text-dim); }
.qty-grid tfoot td { border-top: 1px solid var(--border); font-weight: 600; }
.qty-grid tbody tr:last-child td { border-bottom: none; }
.qty-grid input.qty-input {
    width: 5rem; padding: 0.2rem 0.4rem; background: var(--bg); border: 1px solid var(--border);
    border-radius: 3px; color: var(--text); font-family: 'SF Mono', monospace; font-size: 0.85rem; text-align: right;
}
.form-actions { display: flex; justify-content: flex-end; margin-top: 0.65rem; }

/* Matrix table — size × country */
.matrix-table {
    width: 100%; border-collapse: collapse; font-size: 0.82rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.matrix-table thead th {
    text-align: left; padding: 0.5rem 0.75rem;
    background: var(--group-bg); color: var(--text-dim);
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500;
    border-bottom: 1px solid var(--border);
}
.matrix-table th:not(:first-child), .matrix-table td:not(:first-child) { text-align: right; }
.matrix-table tbody td { padding: 0.4rem 0.75rem; border-bottom: 1px solid var(--border); font-family: 'SF Mono', monospace; }
.matrix-table tbody tr:last-child td { border-bottom: none; }
.matrix-table .sz { font-weight: 500; font-family: inherit; }
.matrix-table .cell-2line { line-height: 1.1; }
.matrix-table .cell-2line .sub-pct {
    color: var(--text-dim); font-size: 0.65rem; margin-top: 0.15rem; font-weight: 400;
    letter-spacing: 0.02em;
}
.matrix-table .num { font-family: 'SF Mono', monospace; color: var(--text); font-weight: 400; }
.matrix-table .tot { font-weight: 400; }
.matrix-table .total-row td { background: var(--group-bg); font-weight: 400; border-top: 1px solid var(--border); }
.matrix-table .total-row .sz { font-weight: 500; }

/* Action toolbar at bottom of detail */
.action-toolbar h3 { margin-bottom: 0.65rem; }
.action-cards {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
}
.action-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
    padding: 0.85rem 1rem; display: flex; flex-direction: column; gap: 0.5rem;
}
.action-card h4 { font-size: 0.85rem; margin-bottom: 0.25rem; color: var(--text); }
.action-card label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.72rem; color: var(--text-dim); }
.action-card input, .action-card select, .action-card textarea {
    padding: 0.35rem 0.5rem; background: var(--bg); border: 1px solid var(--border);
    border-radius: 3px; color: var(--text); font-size: 0.85rem; font-family: inherit;
}
.action-card textarea { resize: vertical; min-height: 2.2rem; }
.action-card button { align-self: flex-start; }
