/* ═══════════════════════════════════════════════════════════════
   WEXFORD TRACKER - Enterprise Design System
   Consolidated stylesheet for consistent UI across all pages
   ═══════════════════════════════════════════════════════════════ */

/* ── Layout ─────────────────────────────────────────────────── */
.page-container {
    max-width: 1400px;
    margin: 0 auto;
}

.page-container-wide {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.page-container-narrow {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── Page Header ────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--wex-border);
}

.page-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ── Enterprise Header (gradient banner) ─────────────────── */
.enterprise-header--blue {
    background: rgba(30, 30, 46, 0.8);
}
.enterprise-header--blue::before {
    background: radial-gradient(circle at 25% 0%, rgba(99,102,241,0.5), transparent 50%),
                radial-gradient(circle at 75% 100%, rgba(139,92,246,0.4), transparent 50%);
}
.enterprise-header--green {
    background: rgba(30, 30, 46, 0.8);
}
.enterprise-header--green::before {
    background: radial-gradient(circle at 25% 0%, rgba(34,197,94,0.4), transparent 50%),
                radial-gradient(circle at 75% 100%, rgba(99,102,241,0.3), transparent 50%);
}
.enterprise-header--red {
    background: rgba(30, 30, 46, 0.8);
}
.enterprise-header--red::before {
    background: radial-gradient(circle at 25% 0%, rgba(239,68,68,0.4), transparent 50%),
                radial-gradient(circle at 75% 100%, rgba(251,146,60,0.3), transparent 50%);
}
.enterprise-header--amber {
    background: rgba(30, 30, 46, 0.8);
}
.enterprise-header--amber::before {
    background: radial-gradient(circle at 25% 0%, rgba(245,158,11,0.4), transparent 50%),
                radial-gradient(circle at 75% 100%, rgba(234,179,8,0.3), transparent 50%);
}
.enterprise-header--purple {
    background: rgba(30, 30, 46, 0.8);
}
.enterprise-header--purple::before {
    background: radial-gradient(circle at 25% 0%, rgba(139,92,246,0.5), transparent 50%),
                radial-gradient(circle at 75% 100%, rgba(99,102,241,0.4), transparent 50%);
}

/* ── Stats Row ──────────────────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.enterprise-card {
    background: rgba(30, 30, 46, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: 12px;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.enterprise-card:hover {
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.stat-card {
    padding: 1.25rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--wex-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.stat-card.success .stat-value,
.stat-card.stat-success .stat-value { color: var(--wex-success); }
.stat-card.success .stat-icon { background: color-mix(in srgb, var(--wex-success) 15%, transparent); color: var(--wex-success); }

.stat-card.warning .stat-value,
.stat-card.stat-warning .stat-value { color: var(--wex-warning, var(--wex-accent)); }
.stat-card.warning .stat-icon { background: color-mix(in srgb, var(--wex-warning, var(--wex-accent)) 15%, transparent); color: var(--wex-warning, var(--wex-accent)); }

.stat-card.danger .stat-value,
.stat-card.stat-danger .stat-value { color: var(--wex-danger); }
.stat-card.danger .stat-icon { background: color-mix(in srgb, var(--wex-danger) 15%, transparent); color: var(--wex-danger); }

.stat-card.primary .stat-value,
.stat-card.stat-primary .stat-value { color: var(--wex-primary); }
.stat-card.primary .stat-icon { background: color-mix(in srgb, var(--wex-primary) 15%, transparent); color: var(--wex-primary); }

/* ── Section Card (content sections) ───────────────────────── */
.section-card {
    background: rgba(30, 30, 46, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: 16px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.section-card:hover {
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.08);
}

.section-header {
    background: rgba(45, 45, 65, 0.5);
    backdrop-filter: blur(8px);
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(99, 102, 241, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.section-header h2,
.section-header h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-header h2 i,
.section-header h3 i {
    color: var(--wex-primary);
}

.section-body {
    padding: 1.25rem;
}

.section-body-flush {
    padding: 0;
}

/* ── Filters Bar ────────────────────────────────────────────── */
.filters-bar {
    background: rgba(30, 30, 46, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    align-items: end;
}

/* ── Actions Bar ────────────────────────────────────────────── */
.actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    padding: 1rem;
    background: rgba(10, 10, 15, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(99, 102, 241, 0.08);
    border-radius: 10px;
    margin-bottom: 1rem;
}

/* ── Session/Item Cards ─────────────────────────────────────── */
.session-card {
    background: rgba(30, 30, 46, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    height: 100%;
}

.session-card:hover {
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.session-card .merchant-name {
    font-size: 1.1rem;
    font-weight: 700;
}

.session-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-top: 0.25rem;
}

.session-card .progress {
    height: 8px;
    background: var(--wex-surface-highlight);
    border-radius: 4px;
}

.session-card .progress-bar {
    background: var(--wex-success);
    border-radius: 4px;
}

.session-card .stats {
    /* 2026-05-12 — switched from flex to a 4-column grid so each box
       gets equal width regardless of value length, and an OOS box now
       fits cleanly next to Pending / Picked / Total. */
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.session-card .stats .stat { text-align: center; }
.session-card .stats .stat .value { font-size: 1.5rem; font-weight: 700; }
.session-card .stats .stat .label {
    font-size: 0.7rem;
    color: var(--wex-muted);
    text-transform: uppercase;
}

/* ── Status Badges (unified) ────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.status-badge-success,
.status-badge-removed,
.status-badge-completed { background: color-mix(in srgb, var(--wex-success) 15%, transparent); color: #4ade80; border: 1px solid color-mix(in srgb, var(--wex-success) 25%, transparent); }
.status-badge-warning,
.status-badge-pending { background: color-mix(in srgb, var(--wex-warning, var(--wex-accent)) 15%, transparent); color: #fbbf24; border: 1px solid color-mix(in srgb, var(--wex-warning, var(--wex-accent)) 25%, transparent); }
.status-badge-danger,
.status-badge-cancelled { background: color-mix(in srgb, var(--wex-danger) 15%, transparent); color: #f87171; border: 1px solid color-mix(in srgb, var(--wex-danger) 25%, transparent); }
.status-badge-info,
.status-badge-primary { background: color-mix(in srgb, var(--wex-primary) 15%, transparent); color: #60a5fa; border: 1px solid color-mix(in srgb, var(--wex-primary) 25%, transparent); }
.status-badge-muted { background: color-mix(in srgb, var(--wex-muted) 10%, transparent); color: var(--wex-muted); border: 1px solid color-mix(in srgb, var(--wex-muted) 20%, transparent); }

/* ── Enterprise Table ───────────────────────────────────────── */
.enterprise-table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: 12px;
}

.enterprise-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.enterprise-table thead th {
    padding: 0.85rem 1rem;
    font-family: var(--font-heading);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--wex-muted);
    /* Jun 11 2026: solid bg, NO backdrop-filter. The blur(8px) on a sticky
     * header repainted every scroll frame = the "flickers while scrolling"
     * report; the translucent bg also let tinted rows ghost through. */
    background: #1e1e2e;
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
    text-align: left;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.enterprise-table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(99, 102, 241, 0.06);
    font-size: 0.875rem;
    vertical-align: middle;
}

/* Jun 11 2026: hover keeps its tint but with NO transition — animating
 * background-color made every row flash for 200ms as the cursor swept over
 * it during scroll (the second half of the "flickers while scrolling"
 * report, amplified by the Phase-2.5 status-tinted rows). */
.enterprise-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.06);
}

.enterprise-table tbody tr:last-child td {
    border-bottom: none;
}

/* Compact table variant */
.enterprise-table-sm thead th { padding: 0.6rem 0.75rem; }
.enterprise-table-sm tbody td { padding: 0.5rem 0.75rem; font-size: 0.8rem; }

/* Striped table variant */
.enterprise-table-striped tbody tr:nth-child(even) {
    background: rgba(30, 30, 46, 0.3);
}

/* ── Data Cells ─────────────────────────────────────────────── */
.cell-mono {
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.cell-id {
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--wex-primary);
}

.cell-sku {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--wex-text);
}

.cell-qty {
    font-family: var(--font-mono);
    font-weight: 600;
    text-align: center;
}

.cell-muted {
    color: var(--wex-muted);
    font-size: 0.8rem;
}

.cell-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Inline Edit ────────────────────────────────────────────── */
.inline-edit {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.inline-edit input {
    width: 80px;
    text-align: center;
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
    background: var(--wex-bg);
    border: 1px solid var(--wex-border);
    border-radius: 4px;
    color: var(--wex-text);
}

.inline-edit input:focus {
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.1);
    outline: none;
}

/* ── Quick Add Section ──────────────────────────────────────── */
.quick-add-section {
    background: rgba(30, 30, 46, 0.5);
    backdrop-filter: blur(8px);
    border: 1px dashed rgba(99, 102, 241, 0.25);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

/* ── Credits Value Pill ─────────────────────────────────────── */
.credits-pill {
    background: linear-gradient(135deg, var(--wex-success), #059669);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 1rem;
    display: inline-block;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.25);
}

/* ── Panel (Station view legacy) ────────────────────────────── */
.panel {
    background: rgba(30, 30, 46, 0.7);
    backdrop-filter: blur(12px);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(99, 102, 241, 0.1);
    margin-bottom: 1.5rem;
}

/* ── Batch Header (Production scanning) ─────────────────────── */
.batch-header {
    display: none;
    background: rgba(30, 30, 46, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.15);
    animation: batchSlideIn 0.3s ease-out;
}

.batch-header.visible { display: block; }

@keyframes batchSlideIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.batch-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.batch-header-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.batch-header-icon {
    width: 48px;
    height: 48px;
    background: var(--wex-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.batch-header-info h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--wex-primary);
    font-family: var(--font-mono);
}

.batch-header-info p {
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
    color: var(--wex-muted);
}

.batch-header-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.batch-stat {
    text-align: center;
    padding: 0.5rem 1rem;
    background: color-mix(in srgb, var(--wex-primary) 15%, transparent);
    border-radius: 8px;
    min-width: 80px;
}

.batch-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--wex-primary);
    font-family: var(--font-mono);
}

.batch-stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--wex-muted);
    letter-spacing: 0.05em;
}

/* ── InStock Row Styling ────────────────────────────────────── */
tr.instock-row {
    border-left: 4px solid #0dcaf0;
    background-color: rgba(13,202,240,0.06);
}

tr.instock-row:hover {
    background-color: rgba(13,202,240,0.12);
}

/* ── Reprint Badge ──────────────────────────────────────────── */
.reprint-badge {
    display: inline-block;
    margin-left: 0.5em;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    background: var(--wex-danger);
    color: #fff;
    vertical-align: middle;
}

.reprint-badge.reprint-badge-done {
    background: var(--wex-success);
}

/* ── Reprint Modal ──────────────────────────────────────────── */
.reprint-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1.25rem;
}

.reprint-modal-backdrop.open { display: flex; }

.reprint-modal {
    width: min(1200px, 96vw);
    max-height: 90vh;
    background: rgba(30, 30, 46, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px rgba(99, 102, 241, 0.08);
    display: flex;
    flex-direction: column;
}

.reprint-modal-header,
.reprint-modal-footer {
    padding: 0.9rem 1.1rem;
    background: rgba(45, 45, 65, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.reprint-modal-header {
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

.reprint-modal-footer {
    border-top: 1px solid rgba(99, 102, 241, 0.1);
}

.reprint-preview-container {
    padding: 1rem 1.1rem;
    overflow: auto;
    flex: 1;
}

/* ── Item Processed State ───────────────────────────────────── */
tr.item-processed {
    opacity: 0.6;
    background-color: rgba(39,39,42,0.5);
}

.previous-area-cell,
.previous-action-cell {
    color: var(--wex-accent);
    font-style: italic;
}

/* ── Form Styling Helpers ───────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 768px) {
    .form-grid-2,
    .form-grid-3 { grid-template-columns: 1fr; }
}

.form-card {
    background: rgba(30, 30, 46, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
}

/* ── Breadcrumb ─────────────────────────────────────────────── */
.breadcrumb-enterprise {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--wex-muted);
    margin-bottom: 1rem;
}

.breadcrumb-enterprise a {
    color: var(--wex-primary);
    text-decoration: none;
}

.breadcrumb-enterprise a:hover {
    text-decoration: underline;
}

.breadcrumb-enterprise .separator {
    color: var(--wex-border);
}

/* ── No Data / Muted Text ───────────────────────────────────── */
.no-data {
    color: var(--wex-muted);
    font-style: italic;
    font-size: 0.85rem;
}

/* ── Responsive Utilities ───────────────────────────────────── */
@media (max-width: 576px) {
    .page-container { padding: 0 0.75rem; }
    .enterprise-header { padding: 1.25rem; border-radius: 12px; }
    .stats-row { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .stat-card { padding: 0.75rem; }
    .stat-card .stat-value { font-size: 1.5rem; }
    .section-body { padding: 1rem; }
    .filters-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .enterprise-section { padding: 1rem; border-radius: 12px; }
}

@media (max-width: 768px) {
    .enterprise-table-wrap { border-radius: 8px; }
    .session-card .stats { gap: 0.4rem; }
    .session-card .stats .stat .value { font-size: 1.25rem; }
    .batch-header-inner { flex-direction: column; }
}

@media (min-width: 992px) {
    .page-container-wide { padding: 0 2rem; }
}

/* ── Animation Utilities ────────────────────────────────────── */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes upload-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ── Print Styles ───────────────────────────────────────────── */
@media print {
    .navbar, .filters-bar, .actions-bar, .page-header-actions { display: none !important; }
    .enterprise-header { border: none; background: none; padding: 0; }
    .section-card { border: 1px solid #ccc; }
    body { background: white; color: black; }
}

/* ── Error Pages ─────────────────────────────────── */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--wex-bg);
    padding: 2rem;
}

.error-code {
    font-size: 8rem;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, #818cf8, #6366f1, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.error-content {
    text-align: center;
    max-width: 500px;
}

.error-message {
    font-size: 1.5rem;
    color: var(--wex-text);
    margin-bottom: 0.5rem;
}

.error-detail {
    color: var(--wex-muted);
    margin-bottom: 2rem;
}

.error-action .btn {
    padding: 0.75rem 2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

/* ────────────────────────────────────────────────────────────────────────
 * Data Table — UX#12 unified table styling.
 *
 * Designed to be applied ALONGSIDE .enterprise-table (additive, non-breaking).
 * Provides consistent borders, striping, padding, hover, sticky header, and
 * a compact (.data-table-sm) variant.
 *
 * Usage:
 *   <table class="enterprise-table data-table">…</table>
 *   <table class="enterprise-table data-table data-table-sm">…</table>
 * ──────────────────────────────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--wex-text);
}

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

.data-table thead th {
    padding: 12px;
    /* Jun 11 2026: solid bg, no backdrop-filter (same scroll-shimmer fix as
     * .enterprise-table thead th above). */
    background: #1e1e2e;
    border-bottom: 1px solid var(--wex-border);
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--wex-muted);
}

.data-table tbody td {
    padding: 12px;
    border-bottom: 1px solid var(--wex-border);
    vertical-align: middle;
    font-size: 0.875rem;
}

/* Striped alternating rows */
.data-table tbody tr:nth-child(odd) {
    background: var(--wex-surface);
}
.data-table tbody tr:nth-child(even) {
    background: var(--wex-surface-highlight);
}

/* Smooth hover state with subtle highlight + 4px row border-radius */
.data-table tbody tr {
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.data-table tbody tr:hover {
    background: color-mix(in srgb, var(--wex-primary) 10%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--wex-primary) 25%, transparent);
}
.data-table tbody tr:hover td:first-child {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}
.data-table tbody tr:hover td:last-child {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Compact variant: tighter padding + smaller font */
.data-table.data-table-sm thead th,
.data-table.data-table-sm tbody td {
    padding: 6px;
    font-size: 0.85em;
}

/* Wrapper for horizontal scroll on narrow viewports */
.data-table-wrap {
    overflow-x: auto;
    overflow-y: visible;
    border-radius: 8px;
    border: 1px solid var(--wex-border);
}

/* Sortable header link styling within data-table */
.data-table .sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.5rem !important;
}
.data-table .sortable-header::after {
    content: "\2195";
    position: absolute;
    right: 0.5rem;
    opacity: 0.3;
    font-size: 0.8rem;
}
.data-table .sortable-header.asc::after { content: "\2191"; opacity: 0.8; }
.data-table .sortable-header.desc::after { content: "\2193"; opacity: 0.8; }

.data-table .data-table-sort-link {
    color: inherit;
    text-decoration: none;
}
.data-table .data-table-sort-link:hover {
    color: var(--wex-primary);
}

/* ────────────────────────────────────────────────────────────────────────
 * Inline Edit UX Polish — UX#13.
 *
 * Layered on top of inventory_unified.html's existing .qty-inline-* and
 * .field-inline-* classes. We avoid touching the existing rules by adding
 * dedicated additive selectors.
 * ──────────────────────────────────────────────────────────────────────── */

/* Pencil icon: appears on hover next to editable cells */
.qty-inline-wrap,
.field-inline-wrap {
    position: relative;
}
.qty-inline-wrap::before,
.field-inline-wrap::before {
    content: "\f4ca"; /* bi-pencil-square */
    font-family: "bootstrap-icons";
    position: absolute;
    left: -1.1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    color: var(--wex-primary);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}
tr:hover .qty-inline-wrap::before,
tr:hover .field-inline-wrap::before,
.qty-inline-wrap:hover::before,
.field-inline-wrap:hover::before {
    opacity: 0.85;
}

/* Edit-mode (focused) input: 2px left border in primary color */
.qty-inline-input:focus,
.field-inline-input:focus,
.field-inline-select:focus,
.field-inline-textarea:focus {
    outline: none;
    border-left: 2px solid var(--wex-primary) !important;
    border-color: var(--wex-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--wex-primary) 15%, transparent);
}

/* Inline error popup tooltip (shown when save fails) */
.qty-feedback.error,
.field-feedback.error {
    position: relative;
    display: inline-block;
    background: color-mix(in srgb, var(--wex-danger) 18%, transparent);
    border: 1px solid color-mix(in srgb, var(--wex-danger) 50%, transparent);
    color: #f87171;
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    animation: data-table-fade-in 0.2s ease;
}
.qty-feedback.error::before,
.field-feedback.error::before {
    content: "";
    position: absolute;
    top: -5px;
    left: 12px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid color-mix(in srgb, var(--wex-danger) 50%, transparent);
}

@keyframes data-table-fade-in {
    from { opacity: 0; transform: translateY(-2px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Undo button — appears for 5s after a successful inline save */
.qty-undo-btn {
    display: none;
    margin-left: 0.4rem;
    padding: 2px 6px;
    background: transparent;
    border: 1px solid var(--wex-border);
    border-radius: 4px;
    color: var(--wex-text-muted, var(--wex-muted));
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.15s ease;
    vertical-align: middle;
}
.qty-undo-btn:hover {
    background: var(--wex-surface-highlight);
    color: var(--wex-primary);
    border-color: var(--wex-primary);
}
.qty-undo-btn.show {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    animation: data-table-fade-in 0.2s ease;
}
.qty-undo-btn i {
    font-size: 0.85rem;
}

/* ===========================================================================
 * Inventory Phase 2.5 — shared section shell (accent identity + stat strip +
 * status-tinted rows + table-in-accent-card). Reuses the existing dark
 * enterprise kit; the per-section accent comes in as --wr-accent (set inline
 * on .inv-section by the template, from the landing palette).
 * =========================================================================== */

/* --- Status pills: PROMOTED from inventory_category.html's inline <style> so
 * the template-rendered rows and the JS-appended rows (inventory_lazy_load.js)
 * share ONE source of truth. Colors are the design's convention:
 * ok #16a34a · low #d97706 · critical #dc2626 · out/empty #6b7280. */
.stock-badge { display:inline-block; padding:.15rem .5rem; border-radius:4px; font-size:.72rem; font-weight:600; background:#334155; color:#e2e8f0; }
.stock-badge.stock-ok { background:#16a34a; color:#fff; }
.stock-badge.stock-low { background:#d97706; color:#fff; }
.stock-badge.stock-critical { background:#dc2626; color:#fff; }
.stock-badge.stock-out { background:#6b7280; color:#fff; }

/* --- Row status tint: the ONLY genuinely new rule. A 3px left border + a
 * faint status-colored wash so the operator reads health down the table even
 * after columns collapse on mobile. One class per status; the mapping
 * (status -> row-status-<status>) is shared by template + JS. */
tr.row-status-ok       { border-left:3px solid #16a34a; background:color-mix(in srgb, #16a34a 6%, transparent); }
tr.row-status-low      { border-left:3px solid #d97706; background:color-mix(in srgb, #d97706 6%, transparent); }
tr.row-status-critical { border-left:3px solid #dc2626; background:color-mix(in srgb, #dc2626 6%, transparent); }
tr.row-status-out      { border-left:3px solid #6b7280; background:color-mix(in srgb, #6b7280 6%, transparent); }

/* --- Section accent header chip + one-line purpose (above the stat strip). */
.inv-section-id { display:flex; align-items:flex-start; gap:.75rem; }
.inv-section-id .stat-card-icon {
    width: 42px; height: 42px; border-radius: 10px; flex: 0 0 auto;
    background: color-mix(in srgb, var(--wr-accent, var(--wex-primary)) 15%, transparent);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; color: var(--wr-accent, var(--wex-primary));
}

/* --- Stat strip: cheap color-coded chips (total/low/critical/out). Reuses the
 * enterprise-card border-left idiom; collapses to one column under 820px. */
.inv-stat-strip {
    display: grid; gap: .75rem; margin: 0 0 1rem;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.inv-stat-chip {
    display: flex; flex-direction: column; gap: .15rem;
    padding: .65rem .85rem; border-radius: 10px;
    background: var(--wex-surface, #1a2027);
    border: 1px solid var(--wex-border, #2d3b47);
    border-left: 4px solid var(--chip-color, var(--wex-muted, #6b7280));
}
.inv-stat-chip .inv-stat-value {
    font-family: var(--font-heading); font-size: 1.4rem; font-weight: 700;
    color: var(--wex-text, #e2e8f0); line-height: 1.1;
}
.inv-stat-chip .inv-stat-label {
    font-size: .72rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .04em; color: var(--wex-muted, #94a3b8);
}
.inv-stat-chip.chip-total    { --chip-color: var(--wr-accent, var(--wex-primary)); }
.inv-stat-chip.chip-low      { --chip-color: #d97706; }
.inv-stat-chip.chip-critical { --chip-color: #dc2626; }
.inv-stat-chip.chip-out      { --chip-color: #6b7280; }
.inv-stat-chip.chip-context  { --chip-color: var(--wr-accent, var(--wex-primary)); }

/* --- Table-in-accent-card: dark-theme equivalent of the wood-review wr-card.
 * NB: do NOT reuse _wood_review_tab.html's wr-card (it is themed with light
 * --bs-* vars and would render transparent/white on these dark pages). */
.inv-card-accent {
    display: flex; flex-direction: column;
    background: var(--wex-surface, #1a2027);
    border: 1px solid var(--wex-border, #2d3b47);
    border-top: 4px solid var(--wr-accent, var(--wex-primary));
    border-radius: 12px; overflow: hidden;
}
.inv-card-accent-head {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: .5rem; padding: .7rem 1rem;
    background: color-mix(in srgb, var(--wr-accent, var(--wex-primary)) 9%, transparent);
    border-bottom: 1px solid var(--wex-border, #2d3b47);
}
.inv-card-accent-head .inv-card-accent-title {
    display: flex; align-items: center; gap: .5rem;
    margin: 0; font-size: 1rem; font-weight: 600; color: var(--wex-text, #e2e8f0);
}
.inv-card-accent-head .inv-card-accent-title .inv-dot {
    width: .8rem; height: .8rem; border-radius: 50%;
    background: var(--wr-accent, var(--wex-primary)); display: inline-block;
}
.inv-card-accent-head .inv-card-accent-total {
    font-size: .85rem; font-weight: 600; color: var(--wex-muted, #94a3b8);
}
.inv-card-accent-body { padding: 0; overflow-x: auto; }
.inv-card-accent-tools {
    display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
    padding: .65rem 1rem; border-top: 1px solid var(--wex-border, #2d3b47);
    font-size: .82rem; color: var(--wex-muted, #94a3b8);
}

/* ===========================================================================
 * Inventory Phase 2.6 — bespoke per-section redesigns. Reuses the same dark
 * --wex-* kit, the --wr-accent var and the established status colors
 * (ok #16a34a · low #d97706 · critical #dc2626 · out/empty #6b7280) plus a new
 * "unlinked" slate/indigo (#6366f1) for mouldings with no backing material.
 * =========================================================================== */

/* --- D4: Moulding "unlinked" state — DISTINCT from gray "out". A moulding with
 * no linked RawMaterial gets a slate/indigo tint + badge so "no material linked
 * yet" no longer reads the same as "depleted". */
.stock-badge.stock-unlinked { background:#6366f1; color:#fff; }
tr.row-status-unlinked { border-left:3px solid #6366f1; background:color-mix(in srgb, #6366f1 6%, transparent); }

/* --- D1: Pre-cortados (PRE_MADE_FRAME) as a responsive TILE GRID. The ~30-40
 * bins read better as cards than as a table; status is conveyed by a colored
 * top border + the existing status pill. */
.inv-tile-grid {
    display: grid; gap: .75rem; padding: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.inv-tile {
    display: flex; flex-direction: column; gap: .4rem;
    padding: .7rem .8rem; border-radius: 10px;
    background: var(--wex-surface, #1a2027);
    border: 1px solid var(--wex-border, #2d3b47);
    border-top: 4px solid var(--tile-color, #6b7280);
}
.inv-tile .inv-tile-top {
    display: flex; align-items: center; justify-content: space-between; gap: .4rem;
}
.inv-tile .inv-tile-bin { font-size: 1rem; font-weight: 700; }
.inv-tile .inv-tile-meta {
    display: flex; flex-wrap: wrap; gap: .35rem; align-items: center;
    font-size: .76rem; color: var(--wex-muted, #94a3b8);
}
.inv-tile .inv-tile-cat {
    font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
    color: var(--wex-text, #e2e8f0);
}
.inv-tile .inv-tile-qty {
    font-family: var(--font-heading); font-size: 2rem; font-weight: 700;
    line-height: 1; color: var(--wex-text, #e2e8f0);
}
.inv-tile .inv-tile-foot {
    display: flex; align-items: center; justify-content: space-between; gap: .4rem;
    margin-top: auto; padding-top: .3rem; font-size: .74rem;
    color: var(--wex-muted, #94a3b8);
    border-top: 1px solid var(--wex-border, #2d3b47);
}
/* Tile status accent (top border) reuses the row-tint palette. */
.inv-tile.tile-status-ok       { --tile-color:#16a34a; }
.inv-tile.tile-status-low      { --tile-color:#d97706; }
.inv-tile.tile-status-critical { --tile-color:#dc2626; }
.inv-tile.tile-status-out      { --tile-color:#6b7280; }

/* --- D1 rev2: full-width category divider inside the tile grid (WC / Inner /
 * …). Carries the category color via --tile-color, same var the tiles use. */
.inv-tile-divider {
    grid-column: 1 / -1;
    display: flex; align-items: center; gap: .5rem;
    margin-top: .35rem; padding: .3rem 0 .15rem;
    font-size: .8rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .05em; color: var(--wex-text, #e2e8f0);
    border-bottom: 1px solid var(--wex-border, #2d3b47);
}
.inv-tile-divider .inv-dot {
    width: .7rem; height: .7rem; border-radius: 50%; display: inline-block;
    background: var(--tile-color, var(--wex-muted, #6b7280));
}

/* --- D2 rev2: In Stock SKU group rows — ONE table, a clickable summary row
 * per SKU followed by its lot rows (collapsed by default on the full
 * listing). Replaces the per-location <details> design, which exploded under
 * prod cardinality (~416 locations → ~200 stacked tables/sticky theads). */
.inv-sku-group-row { cursor: pointer; user-select: none; }
/* rev3: the summary row spans the SAME 12 columns as the lot rows (the
 * full-width colspan version left the thead floating over nothing). Cells
 * keep the table's natural padding so they line up under the thead. */
.inv-sku-group-row > td {
    font-size: .85rem; font-weight: 600;
    color: var(--wex-text, #e2e8f0);
    background: color-mix(in srgb, var(--wr-accent, var(--wex-primary)) 7%, transparent);
    border-top: 1px solid var(--wex-border, #2d3b47);
}
.inv-sku-group-row:hover > td {
    background: color-mix(in srgb, var(--wr-accent, var(--wex-primary)) 13%, transparent);
}
.inv-sku-group-row .inv-chevron {
    display: inline-block;
    color: var(--wex-muted, #94a3b8);
    transition: transform .15s ease;
}
.inv-sku-group-row.expanded .inv-chevron { transform: rotate(90deg); }
.inv-sku-group-row .inv-group-name {
    font-weight: 400; color: var(--wex-muted, #94a3b8);
}
.inv-sku-group-row .inv-group-chips {
    font-size: .76rem; font-weight: 600; white-space: nowrap;
    color: var(--wex-muted, #94a3b8);
}

/* --- D3: the scanned-as SKU chip reads as a muted variant of .sku-code so it's
 * visually subordinate to the canonical SKU it mapped to. */
.sku-scanned { opacity: .85; }

/* ═══════════════════════════════════════════════════════════════════════════
 * Phase 2.7 (2026-06-11) — Moulding PHOTO CARD GRID
 * (/inventory/?section=moulding — inventory_category.html MOULDING branch).
 * APPEND-ONLY block: do not fold into earlier rules. Status accent rides the
 * card's top border via --mcard-color (same palette as the tile grid / row
 * tints, plus indigo for "unlinked" = no backing raw material). */
.inv-mcard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: .75rem;
    padding: .9rem;
}
.inv-mcard {
    display: flex; flex-direction: column;
    background: var(--wex-surface, #1e1e2e);
    border: 1px solid var(--wex-border, rgba(99, 102, 241, 0.15));
    border-top: 3px solid var(--mcard-color, var(--wex-muted, #6b7280));
    border-radius: .55rem;
    overflow: hidden;
    transition: transform .15s ease, border-color .15s ease;
}
.inv-mcard:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--mcard-color, var(--wex-primary, #6366f1)) 40%, transparent);
    border-top-color: var(--mcard-color, var(--wex-muted, #6b7280));
}
.inv-mcard.mstatus-ok       { --mcard-color: #16a34a; }
.inv-mcard.mstatus-low      { --mcard-color: #d97706; }
.inv-mcard.mstatus-critical { --mcard-color: #dc2626; }
.inv-mcard.mstatus-out      { --mcard-color: #6b7280; }
.inv-mcard.mstatus-unlinked { --mcard-color: #6366f1; }
/* Photo area: ~4:3 at ~150px tall; uploads object-fit cover, the no-photo
 * placeholder centers a muted icon + label on a subtle surface tint. */
.inv-mcard-img {
    height: 150px; width: 100%;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    background: var(--wex-surface-highlight, #2d2d41);
    border-bottom: 1px solid var(--wex-border, rgba(99, 102, 241, 0.15));
}
.inv-mcard-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inv-mcard-noimg {
    display: flex; flex-direction: column; align-items: center; gap: .25rem;
    color: var(--wex-muted, #94a3b8); font-size: .76rem;
}
.inv-mcard-noimg .bi { font-size: 1.7rem; opacity: .5; }
.inv-mcard-body {
    display: flex; flex-direction: column; gap: .28rem;
    padding: .6rem .7rem .45rem;
    flex: 1;
}
.inv-mcard-code { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.inv-mcard-code .sku-code { font-size: .95rem; font-weight: 700; }
.inv-mcard-inactive {
    font-size: .66rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .05em; padding: 0 .32rem; border-radius: .35rem;
    color: var(--wex-muted, #94a3b8);
    border: 1px solid var(--wex-border, rgba(99, 102, 241, 0.15));
}
.inv-mcard-name {
    font-size: .84rem; color: var(--wex-text, #e2e8f0);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.inv-mcard-meta { font-size: .76rem; color: var(--wex-muted, #94a3b8); }
.inv-mcard-meta span + span::before { content: " · "; }
.inv-mcard-stock {
    display: flex; align-items: center; justify-content: space-between;
    gap: .4rem; margin-top: auto; padding-top: .3rem;
}
.inv-mcard-stock strong { font-size: 1.05rem; color: var(--wex-text, #e2e8f0); }
.inv-mcard-foot {
    display: flex; align-items: center; justify-content: space-between;
    gap: .5rem; padding: .45rem .7rem;
    border-top: 1px solid var(--wex-border, rgba(99, 102, 241, 0.15));
}
/* Card checkboxes live OUTSIDE .enterprise-table — restate the dark-theme
 * visibility fix the table got (native ~13px boxes were invisible). */
.inv-mcard-foot .row-select-cb { width: 18px; height: 18px; cursor: pointer; accent-color: #2563EB; }


/* ── Moulding box tracking (2026-06-12) ──────────────────────────────────────
 * Compact shipment-math line under the card's stock number
 * ("12 cajas × 25 pzs × 96.00 in = 28,800 in");
 * .inv-mcard-boxes-empty mutes the "no box data yet" state. */
.inv-mcard-boxes { font-size: .72rem; color: var(--text-muted, #8b93a7); margin-top: 2px; }
.inv-mcard-boxes.inv-mcard-boxes-empty { opacity: .55; }


/* ══ Pre-Made Frame Stock manage page (2026-06-12 redesign) ══════════════════
 * Replaces the page's pre-kit inline <style> (hardcoded-hex pills / category
 * stripes). Reuses the established kit: inv-stat-chip strip, stock-badge
 * status colors (ok #16a34a · low #d97706 · out #6b7280), section-card. */

/* Stat chips are now <button>s (clickable filters) — reset button chrome. */
button.inv-stat-chip.pms-chip {
    appearance: none; text-align: left; cursor: pointer; width: 100%;
    transition: border-color .15s ease, transform .15s ease;
}
button.inv-stat-chip.pms-chip:hover {
    border-color: var(--chip-color, var(--wex-primary, #2563eb));
    transform: translateY(-1px);
}

/* Filter pills — kit-tokened replacement for the old hardcoded-hex pills. */
.pms-filter-bar { display: flex; flex-direction: column; gap: .5rem; }
.pms-pill-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.pms-pill {
    appearance: none;
    border: 1px solid var(--wex-border, #2d3b47);
    background: transparent;
    color: var(--wex-text, #e2e8f0);
    border-radius: 999px;
    padding: .35rem .85rem;
    font-size: .85rem;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}
.pms-pill:hover { background: color-mix(in srgb, var(--wex-text, #e2e8f0) 5%, transparent); }
.pms-pill.active {
    background: color-mix(in srgb, var(--wex-primary, #2563eb) 18%, transparent);
    border-color: var(--wex-primary, #2563eb);
    color: var(--wex-text, #fff);
}
.pms-pill .pms-pill-count {
    background: color-mix(in srgb, var(--wex-text, #e2e8f0) 8%, transparent);
    padding: .05rem .45rem;
    border-radius: 10px;
    font-size: .72rem;
    font-weight: 600;
}
.pms-pill.active .pms-pill-count {
    background: color-mix(in srgb, var(--wex-primary, #2563eb) 40%, transparent);
}
.pms-pill-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: #6b7280; }

/* One accent per category — shared by the pill dots, the row stripes and the
 * category badges (single mapping, three selectors each). */
.pms-pill-dot[data-dot="Inner"]      { background: #3b82f6; }
.pms-pill-dot[data-dot="Inner FL"]   { background: #6366f1; }
.pms-pill-dot[data-dot="Inner 4FL"]  { background: #8b5cf6; }
.pms-pill-dot[data-dot="WC"]         { background: #10b981; }
.pms-pill-dot[data-dot="WCGDF"]      { background: #14b8a6; }
.pms-pill-dot[data-dot="Moulding"]   { background: #f59e0b; }

#premade-stock-table tr[data-category="Inner"]      { border-left: 4px solid #3b82f6; }
#premade-stock-table tr[data-category="Inner FL"]   { border-left: 4px solid #6366f1; }
#premade-stock-table tr[data-category="Inner 4FL"]  { border-left: 4px solid #8b5cf6; }
#premade-stock-table tr[data-category="WC"]         { border-left: 4px solid #10b981; }
#premade-stock-table tr[data-category="WCGDF"]      { border-left: 4px solid #14b8a6; }
#premade-stock-table tr[data-category="Moulding"]   { border-left: 4px solid #f59e0b; }

.pms-cat-badge { font-size: .72rem; padding: .25rem .5rem; border-radius: 4px; font-weight: 600; white-space: nowrap; }
.pms-cat-badge[data-cat-badge="Inner"]      { background: rgba(59,130,246,.15);  color: #93c5fd; }
.pms-cat-badge[data-cat-badge="Inner FL"]   { background: rgba(99,102,241,.15);  color: #a5b4fc; }
.pms-cat-badge[data-cat-badge="Inner 4FL"]  { background: rgba(139,92,246,.15);  color: #c4b5fd; }
.pms-cat-badge[data-cat-badge="WC"]         { background: rgba(16,185,129,.15);  color: #6ee7b7; }
.pms-cat-badge[data-cat-badge="WCGDF"]      { background: rgba(20,184,166,.15);  color: #5eead4; }
.pms-cat-badge[data-cat-badge="Moulding"]   { background: rgba(245,158,11,.15);  color: #fcd34d; }

/* Manage table: sticky header inside a scrollable card body; on narrow
 * viewports it scrolls horizontally with the Bin column pinned. */
.pms-table-wrap { overflow: auto; max-height: 72vh; }
.pms-table { width: 100%; }
.pms-table thead th {
    position: sticky; top: 0; z-index: 3;
    background: var(--wex-surface, #1a2027);
}
.pms-table .pms-input { width: 92px; }
.pms-table .pms-input.pms-input-notes { width: 160px; }
.pms-table .pms-col-save { white-space: nowrap; }
.pms-table .pms-save-status { font-size: .8em; }
.pms-table tr.hidden-by-filter { display: none; }
.pms-table tr.pms-dirty td { background: color-mix(in srgb, #d97706 7%, transparent); }

@media (max-width: 768px) {
    .pms-table th:first-child,
    .pms-table td.pms-col-bin {
        position: sticky; left: 0; z-index: 2;
        background: var(--wex-surface, #1a2027);
    }
    .pms-table thead th:first-child { z-index: 4; }
    .pms-table .pms-input { width: 76px; }
    .pms-table .pms-input.pms-input-notes { width: 120px; }
}

/* Honest empty state — the add-bins path is the bulk upload. */
.pms-empty { text-align: center; padding: 2.5rem 1rem; color: var(--wex-muted, #94a3b8); }
.pms-empty i { font-size: 2rem; display: block; margin-bottom: .5rem; opacity: .6; }
.pms-empty p { margin-bottom: 1rem; }


/* ============================================================
   wx-design system (2026-07-09 UI redesign) — folded in here so
   it ships with an already-collected stylesheet (no new manifest
   entry needed). Additive: only :root tokens + .wx-* classes.
   ============================================================ */
/* ==========================================================================
   Wexford UI Redesign — Shared Design System
   Canonical spec: docs/superpowers/ui-redesign/00-design-system.md
   Loaded APP-WIDE from base.html — must stay purely additive:
     - only :root token blocks
     - only .wx-*  prefixed component classes
   No bare element selectors, no un-prefixed classes.
   ========================================================================== */

/* ======================= WX DESIGN TOKENS ======================= */
:root{
  /* Surfaces */
  --wx-paper:#F1F4F2;        /* page background */
  --wx-surface:#FFFFFF;      /* cards, table body */
  --wx-surface-2:#F8FAF9;    /* inputs, thead, insets, hover rows */
  --wx-raise:#FFFFFF;        /* popovers / elements above cards */
  /* Text */
  --wx-ink:#131B17;          /* primary text */
  --wx-muted:#5B6A62;        /* secondary text */
  --wx-faint:#8A978F;        /* hints, timestamps, placeholders */
  /* Borders */
  --wx-line:#E3E8E4;         /* card & input borders */
  --wx-line-2:#EDF1EE;       /* row dividers, subtle inner borders */
  /* Brand accent (teal) */
  --wx-accent:#0F766E;
  --wx-accent-ink:#0B5A54;   /* accent hover / accent text on wash */
  --wx-accent-wash:#E6F2F0;  /* accent tinted background */
  --wx-on-accent:#FFFFFF;    /* text on solid accent */
  /* Status */
  --wx-ok:#15803D;      --wx-ok-wash:#E7F4EC;
  --wx-warn:#B45309;    --wx-warn-wash:#FBEEE0;
  --wx-danger:#B91C1C;  --wx-danger-wash:#FBEAEA;
  /* Elevation */
  --wx-shadow:0 1px 2px rgba(19,27,23,.04), 0 8px 24px -12px rgba(19,27,23,.18);
  --wx-shadow-sm:0 1px 2px rgba(19,27,23,.05);
  /* Radii */
  --wx-r:14px;    /* cards, table wrapper */
  --wx-r-sm:9px;  /* buttons, inputs, insets */
  --wx-r-xs:6px;  /* icon buttons, tiny elements */
  /* Type */
  --wx-sans:system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  --wx-mono:ui-monospace,"SF Mono","JetBrains Mono",Menlo,Consolas,monospace;
  /* Native widget scheme (date pickers, scrollbars) */
  --wx-scheme:light;
}

/* OS dark preference (only when no explicit data-theme is set) */
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --wx-paper:#0C120F; --wx-surface:#141C18; --wx-surface-2:#111814; --wx-raise:#18211C;
    --wx-ink:#E9EFEB; --wx-muted:#9EACA3; --wx-faint:#71807780;
    --wx-line:#22302A; --wx-line-2:#1B2620;
    --wx-accent:#2DD4BF; --wx-accent-ink:#5EEAD4; --wx-accent-wash:#12241F;
    --wx-on-accent:#08110E;
    --wx-ok:#4ADE80; --wx-ok-wash:#12241A;
    --wx-warn:#FBBF24; --wx-warn-wash:#241C0F;
    --wx-danger:#F87171; --wx-danger-wash:#251312;
    --wx-shadow:0 1px 2px rgba(0,0,0,.4), 0 12px 32px -14px rgba(0,0,0,.7);
    --wx-shadow-sm:0 1px 2px rgba(0,0,0,.35);
    --wx-scheme:dark;
  }
}

/* Explicit user choice always wins (theme toggle stamps data-theme on <html>) */
:root[data-theme="light"]{
  --wx-paper:#F1F4F2; --wx-surface:#FFFFFF; --wx-surface-2:#F8FAF9; --wx-raise:#FFFFFF;
  --wx-ink:#131B17; --wx-muted:#5B6A62; --wx-faint:#8A978F;
  --wx-line:#E3E8E4; --wx-line-2:#EDF1EE;
  --wx-accent:#0F766E; --wx-accent-ink:#0B5A54; --wx-accent-wash:#E6F2F0;
  --wx-on-accent:#FFFFFF;
  --wx-ok:#15803D; --wx-ok-wash:#E7F4EC;
  --wx-warn:#B45309; --wx-warn-wash:#FBEEE0;
  --wx-danger:#B91C1C; --wx-danger-wash:#FBEAEA;
  --wx-shadow:0 1px 2px rgba(19,27,23,.04), 0 8px 24px -12px rgba(19,27,23,.18);
  --wx-shadow-sm:0 1px 2px rgba(19,27,23,.05);
  --wx-scheme:light;
}
:root[data-theme="dark"]{
  --wx-paper:#0C120F; --wx-surface:#141C18; --wx-surface-2:#111814; --wx-raise:#18211C;
  --wx-ink:#E9EFEB; --wx-muted:#9EACA3; --wx-faint:#71807780;
  --wx-line:#22302A; --wx-line-2:#1B2620;
  --wx-accent:#2DD4BF; --wx-accent-ink:#5EEAD4; --wx-accent-wash:#12241F;
  --wx-on-accent:#08110E;
  --wx-ok:#4ADE80; --wx-ok-wash:#12241A;
  --wx-warn:#FBBF24; --wx-warn-wash:#241C0F;
  --wx-danger:#F87171; --wx-danger-wash:#251312;
  --wx-shadow:0 1px 2px rgba(0,0,0,.4), 0 12px 32px -14px rgba(0,0,0,.7);
  --wx-shadow-sm:0 1px 2px rgba(0,0,0,.35);
  --wx-scheme:dark;
}

/* ======================= TYPE HELPERS ======================= */
.wx-page{font-family:var(--wx-sans);font-size:15px;line-height:1.5;
         color:var(--wx-ink);-webkit-font-smoothing:antialiased}
.wx-page h1,.wx-page h2,.wx-page h3{margin:0;text-wrap:balance;letter-spacing:-.02em}
.wx-mono{font-family:var(--wx-mono);font-variant-numeric:tabular-nums}
.wx-num{font-variant-numeric:tabular-nums}
.wx-visually-hidden{position:absolute!important;width:1px;height:1px;margin:-1px;
  padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

/* ======================= PAGE SHELL ======================= */
/* Page shell — escapes .container-fluid's gutters (.75rem) and main's py-4
   (1.5rem) so --wx-paper runs edge-to-edge under the dark navbar. */
.wx-page{
  margin:-1.5rem calc(-1 * var(--bs-gutter-x,1.5rem)/2);
  background:var(--wx-paper);
  min-height:calc(100vh - 58px);   /* 58px ≈ sticky navbar height */
  color-scheme:var(--wx-scheme);   /* native date pickers/scrollbars follow theme */
}
.wx-page *{box-sizing:border-box}
.wx-wrap{max-width:1240px;margin:0 auto;padding:28px 24px 80px}

/* Title bar */
.wx-topbar{display:flex;align-items:flex-end;justify-content:space-between;
           gap:20px;flex-wrap:wrap;margin-bottom:26px}
.wx-eyebrow{font-size:11px;font-weight:600;letter-spacing:.14em;
            text-transform:uppercase;color:var(--wx-accent);margin-bottom:8px}
.wx-page h1{font-size:30px;font-weight:800}
.wx-sub{color:var(--wx-muted);margin:6px 0 0;font-size:14.5px;max-width:52ch}
.wx-topbar-actions{display:flex;gap:10px;align-items:center}

/* Two-column card grid (stacks on narrow screens) */
.wx-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px;align-items:start}
@media (max-width:880px){.wx-grid{grid-template-columns:1fr}}

/* Section divider */
.wx-divider{display:flex;align-items:center;gap:14px;margin:34px 0 20px}
.wx-divider h3{font-size:13px;font-weight:700;letter-spacing:.08em;
               text-transform:uppercase;color:var(--wx-muted);white-space:nowrap}
.wx-divider .wx-ln{height:1px;background:var(--wx-line);flex:1}

/* ======================= 5.1 CARDS ======================= */
.wx-card{background:var(--wx-surface);border:1px solid var(--wx-line);
         border-radius:var(--wx-r);box-shadow:var(--wx-shadow)}
.wx-card-head{display:flex;align-items:center;gap:11px;padding:16px 20px;
              border-bottom:1px solid var(--wx-line-2)}
.wx-card-head .wx-ic{width:34px;height:34px;flex:none;border-radius:9px;
              display:grid;place-items:center;background:var(--wx-accent-wash);
              color:var(--wx-accent);font-size:17px}
.wx-card-head.warn .wx-ic{background:var(--wx-warn-wash);color:var(--wx-warn)}
.wx-card-head.neutral .wx-ic{background:var(--wx-surface-2);color:var(--wx-muted);
              border:1px solid var(--wx-line)}
.wx-card-head h2{font-size:16px;font-weight:700}
.wx-card-head .wx-cap{font-size:12.5px;color:var(--wx-muted);margin-top:1px}
.wx-card-body{padding:20px}
.wx-lead{color:var(--wx-muted);font-size:13.5px;margin:0 0 16px;line-height:1.5}

/* ======================= 5.2 BUTTONS ======================= */
.wx-btn{display:inline-flex;align-items:center;gap:8px;font-family:inherit;
  font-size:14px;font-weight:600;border-radius:var(--wx-r-sm);
  border:1px solid transparent;padding:9px 15px;cursor:pointer;
  text-decoration:none;white-space:nowrap;
  transition:transform .04s ease, box-shadow .15s ease,
             background .15s ease, border-color .15s ease}
.wx-btn:active{transform:translateY(1px)}
.wx-btn:focus-visible{outline:2px solid var(--wx-accent);outline-offset:2px}
.wx-btn[disabled],.wx-btn.disabled{opacity:.5;cursor:not-allowed;pointer-events:none}

.wx-btn-primary{background:var(--wx-accent);color:var(--wx-on-accent);
                box-shadow:var(--wx-shadow-sm)}
.wx-btn-primary:hover{background:var(--wx-accent-ink);color:var(--wx-on-accent)}

.wx-btn-ghost{background:transparent;color:var(--wx-ink);border-color:var(--wx-line)}
.wx-btn-ghost:hover{background:var(--wx-surface-2);border-color:var(--wx-muted);color:var(--wx-ink)}

.wx-btn-soft{background:var(--wx-accent-wash);color:var(--wx-accent-ink)}
.wx-btn-soft:hover{filter:brightness(.97);color:var(--wx-accent-ink)}

.wx-btn-lg{width:100%;justify-content:center;padding:14px 18px;font-size:15px;font-weight:700}
.wx-btn-sm{padding:6px 11px;font-size:13px}

.wx-btn-icon{display:inline-flex;align-items:center;justify-content:center;
  width:34px;height:34px;padding:7px;border-radius:var(--wx-r-xs);cursor:pointer;
  border:1px solid var(--wx-line);background:var(--wx-surface);color:var(--wx-muted);
  transition:color .15s,border-color .15s,background .15s}
.wx-btn-icon:hover{color:var(--wx-ink);border-color:var(--wx-muted);background:var(--wx-surface-2)}
.wx-btn-icon.danger:hover{color:var(--wx-danger);border-color:var(--wx-danger)}
.wx-btn-icon:focus-visible{outline:2px solid var(--wx-accent);outline-offset:2px}

/* ======================= 5.3 INPUTS, LABELS, HINTS ======================= */
label.wx-fld{display:block;font-size:11.5px;font-weight:600;letter-spacing:.06em;
             text-transform:uppercase;color:var(--wx-muted);margin-bottom:7px}
.wx-input{width:100%;font-family:inherit;font-size:14.5px;color:var(--wx-ink);
  background:var(--wx-surface-2);border:1px solid var(--wx-line);
  border-radius:var(--wx-r-sm);padding:10px 12px;
  transition:border-color .15s,box-shadow .15s}
.wx-input:focus{outline:none;border-color:var(--wx-accent);
  box-shadow:0 0 0 3px var(--wx-accent-wash);background:var(--wx-surface)}
.wx-input::placeholder{color:var(--wx-faint)}
.wx-input[disabled]{opacity:.55;cursor:not-allowed}
.wx-input.is-invalid{border-color:var(--wx-danger);
  box-shadow:0 0 0 3px var(--wx-danger-wash)}
.wx-hint{font-size:12px;color:var(--wx-faint);margin-top:6px}
.wx-error{font-size:12px;color:var(--wx-danger);margin-top:6px}
/* selects get the same skin */
select.wx-input{appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238A978F' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 10px center;padding-right:32px}
/* field grids */
.wx-stack{display:grid;gap:16px}
.wx-row2{display:grid;grid-template-columns:1fr 150px;gap:12px}
@media (max-width:460px){.wx-row2{grid-template-columns:1fr}}

/* ======================= 5.4 MANIFEST / CHECKLIST INSET ======================= */
.wx-manifest{margin-top:16px;padding:14px 16px;background:var(--wx-surface-2);
             border:1px solid var(--wx-line-2);border-radius:var(--wx-r-sm)}
.wx-manifest .wx-t{font-size:11.5px;font-weight:600;letter-spacing:.06em;
             text-transform:uppercase;color:var(--wx-accent);margin-bottom:9px}
.wx-manifest ul{margin:0;padding:0;list-style:none;display:grid;gap:7px}
.wx-manifest li{display:flex;gap:9px;align-items:flex-start;font-size:13.5px;color:var(--wx-ink)}
.wx-manifest li svg{flex:none;margin-top:3px;color:var(--wx-accent)}

/* ======================= 5.5 DROPZONE (file upload) ======================= */
.wx-drop{border:1.5px dashed var(--wx-line);border-radius:var(--wx-r-sm);
  padding:20px;text-align:center;background:var(--wx-surface-2);cursor:pointer;
  transition:border-color .15s,background .15s}
.wx-drop:hover,.wx-drop.dragover{border-color:var(--wx-accent);background:var(--wx-accent-wash)}
.wx-drop:focus-within{outline:2px solid var(--wx-accent);outline-offset:2px}
.wx-drop .wx-ic{font-size:24px;color:var(--wx-accent)}
.wx-drop .wx-m{font-weight:600;margin-top:6px;font-size:14px}
.wx-drop .wx-s{font-size:12.5px;color:var(--wx-faint);margin-top:2px}

/* ======================= 5.6 PREVIEW / RESULT PANEL ======================= */
.wx-preview{margin-top:16px;border:1px solid var(--wx-line);
            border-radius:var(--wx-r-sm);overflow:hidden}
.wx-preview .wx-ph{display:flex;align-items:center;justify-content:space-between;
  gap:10px;padding:11px 14px;background:var(--wx-surface-2);
  border-bottom:1px solid var(--wx-line-2)}
.wx-preview .wx-ph .wx-l{font-size:13px;font-weight:600}
.wx-preview .wx-pb{padding:12px 14px;font-size:13px;color:var(--wx-muted)}
.wx-preview .wx-pb b{color:var(--wx-ink)}

/* ======================= 5.7 CHIPS & SWITCH TOGGLES ======================= */
.wx-chips{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
.wx-chip{font-size:12px;font-weight:600;padding:6px 11px;border-radius:999px;
  border:1px solid var(--wx-line);background:var(--wx-surface);
  color:var(--wx-muted);cursor:pointer;font-family:inherit}
.wx-chip:hover{border-color:var(--wx-accent);color:var(--wx-accent-ink)}
.wx-chip.on{background:var(--wx-accent);color:var(--wx-on-accent);border-color:var(--wx-accent)}
.wx-chip:focus-visible{outline:2px solid var(--wx-accent);outline-offset:2px}

.wx-toggle{position:relative;width:38px;height:22px;border-radius:999px;
  background:var(--wx-line);border:none;cursor:pointer;transition:background .15s}
.wx-toggle::after{content:"";position:absolute;top:2px;left:2px;width:18px;height:18px;
  border-radius:50%;background:#fff;transition:left .15s;box-shadow:var(--wx-shadow-sm)}
.wx-toggle.on{background:var(--wx-ok)}
.wx-toggle.on::after{left:18px}
.wx-toggle:focus-visible{outline:2px solid var(--wx-accent);outline-offset:2px}

/* ======================= 5.8 STATUS CHIPS / BADGES ======================= */
.wx-badge{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:600;
  padding:4px 10px;border-radius:999px;background:var(--wx-surface-2);
  color:var(--wx-muted);border:1px solid var(--wx-line);white-space:nowrap}
.wx-badge.accent{background:var(--wx-accent-wash);color:var(--wx-accent-ink);border-color:transparent}
.wx-badge.ok{background:var(--wx-ok-wash);color:var(--wx-ok);border-color:transparent}
.wx-badge.warn{background:var(--wx-warn-wash);color:var(--wx-warn);border-color:transparent}
.wx-badge.danger{background:var(--wx-danger-wash);color:var(--wx-danger);border-color:transparent}
.wx-badge.dot::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor}

/* ======================= 5.9 DATA TABLE ======================= */
.wx-table-scroll{overflow-x:auto;border:1px solid var(--wx-line);
  border-radius:var(--wx-r);background:var(--wx-surface);box-shadow:var(--wx-shadow)}
/* Optional: give it max-height + overflow-y:auto to make thead truly sticky
   while the page itself scrolls. Without a max-height the sticky header only
   engages when the wrapper itself scrolls. */
.wx-table-scroll.tall{max-height:70vh;overflow-y:auto}

table.wx-table{width:100%;border-collapse:collapse;min-width:720px}
table.wx-table thead th{position:sticky;top:0;z-index:1;background:var(--wx-surface-2);
  text-align:left;font-size:11px;letter-spacing:.07em;text-transform:uppercase;
  color:var(--wx-muted);font-weight:600;padding:13px 16px;
  border-bottom:1px solid var(--wx-line);white-space:nowrap}
table.wx-table thead th.c{text-align:center}
table.wx-table tbody td{padding:14px 16px;border-bottom:1px solid var(--wx-line-2);
  vertical-align:middle;font-size:14px}
table.wx-table tbody td.c{text-align:center}
table.wx-table tbody tr:last-child td{border-bottom:none}
table.wx-table tbody tr{transition:background .12s}
table.wx-table tbody tr:hover{background:var(--wx-surface-2)}

.wx-date-cell{font-weight:700;font-size:14.5px;font-variant-numeric:tabular-nums}
.wx-date-sub{font-size:12px;color:var(--wx-faint);font-weight:400}
.wx-actions{display:flex;gap:6px;justify-content:center;flex-wrap:wrap}

/* Compact "mini" table for inside cards (SKU lists etc.) */
.wx-mini{width:100%;border-collapse:collapse;font-size:13px;margin-top:6px}
.wx-mini th{text-align:left;font-size:10.5px;letter-spacing:.06em;text-transform:uppercase;
  color:var(--wx-faint);font-weight:600;padding:7px 10px;border-bottom:1px solid var(--wx-line-2)}
.wx-mini td{padding:8px 10px;border-bottom:1px solid var(--wx-line-2);vertical-align:middle}
.wx-mini tr:last-child td{border-bottom:none}

/* ======================= 5.10 TOOLBAR + SEARCH ======================= */
.wx-toolbar{display:flex;justify-content:space-between;align-items:center;
            gap:12px;flex-wrap:wrap;margin-bottom:12px}
.wx-search{display:flex;align-items:center;gap:8px;background:var(--wx-surface);
  border:1px solid var(--wx-line);border-radius:var(--wx-r-sm);
  padding:7px 11px;min-width:200px}
.wx-search:focus-within{border-color:var(--wx-accent);box-shadow:0 0 0 3px var(--wx-accent-wash)}
.wx-search svg{color:var(--wx-faint);flex:none}
.wx-search input{border:none;background:none;outline:none;font-family:inherit;
  font-size:13.5px;color:var(--wx-ink);width:100%}
.wx-search input::placeholder{color:var(--wx-faint)}

/* ======================= 5.11 THEME TOGGLE ======================= */
.wx-theme-toggle{display:inline-flex;border:1px solid var(--wx-line);
  border-radius:999px;overflow:hidden;background:var(--wx-surface)}
.wx-theme-toggle button{border:none;background:none;padding:6px 10px;cursor:pointer;
  color:var(--wx-muted);font-size:13px;font-family:inherit}
.wx-theme-toggle button.on{background:var(--wx-accent);color:var(--wx-on-accent)}

/* ======================= 5.12 EMPTY STATE ======================= */
.wx-empty{display:grid;place-items:center;text-align:center;padding:48px 24px;color:var(--wx-muted)}
.wx-empty .wx-ic{width:44px;height:44px;border-radius:12px;display:grid;place-items:center;
  background:var(--wx-surface-2);border:1px solid var(--wx-line);color:var(--wx-faint);margin-bottom:12px}
.wx-empty .wx-m{font-weight:700;color:var(--wx-ink);font-size:15px}
.wx-empty .wx-s{font-size:13px;margin-top:4px;max-width:42ch}
.wx-empty .wx-btn{margin-top:14px}

/* ======================= 5.13 LOADING STATES ======================= */
.wx-spin{width:16px;height:16px;flex:none;border-radius:50%;
  border:2px solid var(--wx-accent-wash);border-top-color:var(--wx-accent);
  animation:wx-rot .7s linear infinite}
@keyframes wx-rot{to{transform:rotate(360deg)}}

.wx-skel{position:relative;overflow:hidden;background:var(--wx-line-2);
  border-radius:6px;min-height:14px}
.wx-skel::after{content:"";position:absolute;inset:0;transform:translateX(-100%);
  background:linear-gradient(90deg,transparent,var(--wx-surface-2),transparent);
  animation:wx-shimmer 1.4s infinite}
@keyframes wx-shimmer{to{transform:translateX(100%)}}
@media (prefers-reduced-motion:reduce){
  .wx-skel::after,.wx-spin{animation:none}
}
