/* ═══════════════════════════════════════════════════════════════
   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 {
    display: flex;
    gap: 1.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);
    background: rgba(30, 30, 46, 0.95);
    backdrop-filter: blur(8px);
    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;
}

.enterprise-table tbody tr {
    transition: background-color 0.2s ease;
}

.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: 1rem; }
    .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;
    background: var(--wex-surface-highlight, rgba(30, 30, 46, 0.95));
    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);
    backdrop-filter: blur(8px);
}

.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;
}

