/* ═══════════════════════════════════════════════════════
   Interior Moderna — UX Polish Layer
   Premium, architectural, gallery-driven aesthetic
   ═══════════════════════════════════════════════════════ */

/* ── Enhanced Color Palette ── */
:root {
  --sidebar-bg: #fafafa;
  --sidebar-hover: rgba(166, 124, 82, 0.10);
  --sidebar-active-border: var(--accent);
  --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.15);
}

/* ── Wide Viewport Constraint ── */
#mainContent > div {
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Typography Refinements ── */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0.01em;
}

/* ── Enhanced Header ── */
.header {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
}

.logo {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text);
}

.logo-sub {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 400;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-top: 1px;
}

/* ── Enhanced Sidebar ── */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 12px 0 24px;
  transition: width 0.3s var(--transition-smooth);
}

/* Collapsible sections */
.nav-section {
  margin-bottom: 4px;
}

.nav-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 20px;
  cursor: pointer;
  user-select: none;
  border-radius: 0;
  transition: background 0.15s;
}

.nav-section-header:hover {
  background: var(--sidebar-hover);
}

.nav-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-dim);
  font-weight: 600;
  padding: 0;
  margin-bottom: 0;
  cursor: pointer;
}

.nav-section-arrow {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition: transform 0.25s var(--transition-smooth);
  font-size: 8px;
  flex-shrink: 0;
  transform: rotate(90deg);
}

.nav-section-header.collapsed .nav-section-arrow {
  transform: rotate(0deg);
}

.nav-section-items {
  overflow: hidden;
  transition: max-height 0.3s var(--transition-smooth), opacity 0.2s ease;
  max-height: 800px;
  opacity: 1;
  padding: 0 12px;
}

.nav-section-items.collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* Enhanced nav items */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s var(--transition-smooth);
  font-size: 13px;
  position: relative;
  margin: 1px 0;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--text);
  font-weight: 500;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-item .icon {
  width: 20px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item.active .icon {
  opacity: 1;
}

.nav-item .badge {
  margin-left: auto;
  background: var(--red-dim);
  color: var(--red);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Pinned section styling */
.nav-section-pinned {
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.nav-section-pinned .nav-section-title {
  color: var(--accent);
}

/* ── Enhanced Card Styling ── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
  font-weight: 600;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.5px;
  line-height: 1;
}

/* ── View Transitions ── */
.main {
  position: relative;
}

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

.main > *:not(.loading) {
  animation: viewFadeIn 0.25s var(--transition-smooth);
}

/* ── Loading Skeleton States ── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 80%;
}

.skeleton-text.short {
  width: 40%;
}

.skeleton-text.medium {
  width: 60%;
}

.skeleton-card {
  height: 80px;
  border-radius: var(--radius);
}

.skeleton-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.skeleton-row .skeleton {
  flex: 1;
  height: 80px;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── Enhanced Loading Spinner ── */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 0;
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: 0.3px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Table Enhancements ── */
table {
  border-collapse: separate;
  border-spacing: 0;
}

table th {
  position: sticky;
  top: 0;
  z-index: var(--z-raised);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ── Command Palette Styles ── */
.cp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: var(--z-overlay);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  transition: background 0.15s;
}

.cp-overlay.cp-visible {
  background: rgba(0, 0, 0, 0.5);
}

.cp-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 92%;
  max-width: 580px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transform: scale(0.98) translateY(-8px);
  opacity: 0;
  transition: transform 0.2s var(--transition-smooth), opacity 0.15s;
}

.cp-visible .cp-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.cp-input-wrap {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.cp-search-icon {
  color: var(--text-dim);
  flex-shrink: 0;
}

.cp-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  line-height: 1.4;
}

.cp-input:focus {
  box-shadow: 0 0 0 2px var(--accent);
  border-radius: 2px;
}

.cp-input::placeholder {
  color: var(--text-dim);
}

.cp-kbd {
  font-size: 10px;
  color: var(--text-dim);
  background: var(--surface-3);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  border: 1px solid var(--border);
}

.cp-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 4px 0;
}

.cp-category {
  padding: 10px 18px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 600;
}

.cp-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
  cursor: pointer;
  transition: background 0.08s;
  border-radius: 0;
}

.cp-item:hover,
.cp-item.cp-focused {
  background: var(--surface-2);
}

.cp-item.cp-focused {
  background: var(--accent-dim);
}

.cp-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.cp-icon-nav {
  background: var(--surface-3);
  color: var(--text-muted);
}

.cp-icon-action {
  background: var(--blue-dim);
  color: var(--blue);
}

.cp-icon-order {
  background: var(--green-dim);
  color: var(--green);
}

.cp-icon-customer {
  background: var(--blue-dim);
  color: var(--blue);
}

.cp-icon-product {
  background: var(--accent-dim);
  color: var(--text);
}

.cp-text {
  flex: 1;
  min-width: 0;
}

.cp-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 1px;
}

.cp-pin-btn {
  font-size: 14px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s, transform 0.15s;
  flex-shrink: 0;
  opacity: 0;
}

.cp-item:hover .cp-pin-btn,
.cp-item.cp-focused .cp-pin-btn {
  opacity: 1;
}

.cp-pin-btn:hover {
  color: var(--accent);
  transform: scale(1.15);
}

.cp-pin-btn.cp-pinned {
  color: var(--accent);
  opacity: 1;
}

.cp-enter {
  font-size: 10px;
  color: var(--text-dim);
  padding: 1px 6px;
  background: var(--surface-3);
  border-radius: 4px;
  font-family: var(--font-mono);
  flex-shrink: 0;
  opacity: 0;
}

.cp-item:hover .cp-enter,
.cp-item.cp-focused .cp-enter {
  opacity: 1;
}

.cp-empty {
  padding: 32px 18px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

.cp-loading {
  padding: 16px;
  display: flex;
  justify-content: center;
}

.cp-footer {
  padding: 8px 18px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-dim);
  display: flex;
  gap: 16px;
  background: var(--surface-2);
}

.cp-footer kbd {
  display: inline-block;
  padding: 1px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 9px;
  margin: 0 2px;
}

/* ── Enhanced Mobile Responsive ── */
@media (max-width: 900px) {
  .sidebar {
    width: 280px;
    box-shadow: 4px 0 32px rgba(0,0,0,0.3);
    padding-top: 16px;
  }

  .main {
    padding: 16px;
    padding-bottom: 80px;
  }

  .page-title {
    font-size: 18px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-value {
    font-size: 22px;
  }

  /* Tables become horizontally scrollable */
  .table-container,
  .main table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Touch-friendly buttons */
  .refresh-btn,
  .bulk-btn,
  .btn-sm {
    min-height: 44px;
    min-width: 44px;
  }

  .cp-modal {
    width: 96%;
    max-width: none;
    margin: 0 8px;
  }

  .cp-item {
    padding: 10px 16px;
  }

  /* Page header on mobile: row with wrap. Stays inline when actions fit
     (the common case — Refresh, Save, small icon buttons), only drops to
     a second line when the action area genuinely won't fit. Prior behavior
     (column-always) wasted ~50px of vertical space on every mobile screen. */
  .page-header {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    row-gap: 8px;
  }
  .page-header > :first-child { min-width: 0; flex: 1 1 60%; }
  .page-header > :not(:first-child) { flex: 0 0 auto; }
}

@media (max-width: 480px) {
  .main {
    padding: 12px;
    padding-bottom: 72px;
  }

  .page-title {
    font-size: 16px;
  }

  .cp-overlay {
    padding-top: 4vh;
  }

  .cp-results {
    max-height: 50vh;
  }

  .cp-footer {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Cards stack on smallest screens */
  .stats-row {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }

  .stat-card {
    padding: 12px;
  }
}

/* ── Warehouse Mobile (375px phones, glove-friendly) ── */
@media (max-width: 430px) {
  /* Larger touch targets for gloved hands */
  button, .btn, .btn-sm, .btn-xs,
  input[type="checkbox"], input[type="radio"],
  select, .tab-btn, .nav-tab {
    min-height: 44px;
    min-width: 44px;
  }

  /* Scan input — big and easy to read */
  .scan-input {
    font-size: 20px !important;
    padding: 14px 16px !important;
    min-height: 56px !important;
  }

  /* Modals: shrink max-height so keyboard doesn't cover inputs */
  .journey-modal,
  .modal-content,
  [class*="modal-"] {
    max-height: 65dvh;
    max-height: 65vh; /* fallback for browsers without dvh */
  }

  /* Bulk action bar: full-width strip at bottom instead of floating pill */
  .bulk-action-bar {
    left: 12px !important;
    right: 12px !important;
    bottom: calc(64px + 12px + env(safe-area-inset-bottom, 0px)) !important;
    transform: none !important;
    width: auto !important;
    box-sizing: border-box !important;
    border-radius: 12px !important;
    border-bottom: none !important;
    padding: 12px 16px !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .bulk-btn {
    min-height: 44px !important;
    padding: 10px 16px !important;
    font-size: 13px !important;
  }

  /* Warehouse pick-list table: hide non-critical columns */
  /* Table cells: more breathing room for touch */
  /* Page header at very-small widths: row with wrap. Action buttons
     (Refresh, Save, small icon buttons) sit inline and only drop when
     the action area genuinely won't fit. */
  .page-header {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
    row-gap: 6px !important;
  }
  .page-header > :first-child { min-width: 0 !important; flex: 1 1 60% !important; }
  .page-header > :not(:first-child) { flex: 0 0 auto !important; }

  /* Bigger close/action buttons in modals */
  .journey-close, [class*="modal-close"], .close-btn {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ── Smooth scrollbar in sidebar ── */
.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* ── Section divider line between nav groups ── */
.nav-section + .nav-section {
  border-top: 1px solid var(--border);
  padding-top: 4px;
  margin-top: 4px;
}

/* ── Empty state refinement ── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-dim);
}

.empty-state .icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 14px;
  line-height: 1.6;
}

/* ── Focus visible for accessibility ── */
.nav-item:focus-visible,
.cp-item:focus-visible,
.refresh-btn:focus-visible,
.btn:focus-visible,
.action-btn:focus-visible,
.tab-btn:focus-visible,
.tab:focus-visible,
.filter-btn:focus-visible,
.feed-filter-btn:focus-visible,
.segment-chip:focus-visible,
.date-preset-btn:focus-visible,
.bulk-btn:focus-visible,
.export-btn:focus-visible,
.note-save-btn:focus-visible,
.scan-mode-btn:focus-visible,
.notification-bell-btn:focus-visible,
.toggle-btn:focus-visible,
.pick-list-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ── Subtle hover lift for interactive cards ── */
.stat-card,
.wh-grid-cell {
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.stat-card:hover {
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* ── Deep Lookup Panel ──────────────────────────────────────────────────── */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* Lookup badge in command palette results */
.cp-item-lookup { border-left: 3px solid var(--accent); }
.cp-icon-lookup { color: var(--accent); font-size: 1.15rem; }
.cp-lookup-badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: rgba(var(--accent-rgb, 99,102,241), 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Overlay */
.dl-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: calc(var(--z-overlay) + 10); /* was 210 — deep-lookup panel above command-palette base overlay */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.dl-overlay.dl-visible { background: rgba(0, 0, 0, 0.55); }

/* Panel */
.dl-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 96%;
  max-width: 780px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0,0,0,0.35);
  transform: scale(0.97) translateY(-12px);
  opacity: 0;
  transition: transform 0.2s ease-out, opacity 0.15s;
}
.dl-visible .dl-panel {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.dl-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.dl-panel-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}
.dl-close-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-dim);
  padding: 4px 8px;
  border-radius: 6px;
}
.dl-close-btn {
  transition: background 0.15s, color 0.15s;
}
.dl-close-btn:hover { background: var(--hover); color: var(--text); }

.dl-panel-body {
  overflow-y: auto;
  padding: 16px 20px 24px;
  flex: 1;
  min-height: 0;
}

/* Loading / Error states */
.dl-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 0;
  color: var(--text-dim);
}
.dl-error {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}
.dl-error p:first-child { font-size: 1.1rem; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.dl-error-detail { font-size: 0.85rem; opacity: 0.7; }

/* Summary cards row */
.dl-summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.dl-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}
.dl-card-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); margin-bottom: 4px; }
.dl-card-value { font-size: 1rem; font-weight: 600; color: var(--text); }
.dl-card-link { cursor: pointer; color: var(--accent); }
.dl-card-link:hover { text-decoration: underline; }

/* Note and tags */
.dl-note {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.85rem;
  margin-bottom: 12px;
  color: var(--text-dim);
}
.dl-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.dl-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

/* Badges */
.dl-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
  text-transform: capitalize;
  white-space: nowrap;
}
/* Collapsible sections */
.dl-section { margin-bottom: 8px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.dl-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  background: var(--bg);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  user-select: none;
  transition: background 0.15s;
}
.dl-section-header:hover { background: var(--hover); }
.dl-chevron { font-size: 0.7rem; color: var(--text-dim); width: 12px; text-align: center; }
.dl-section-title { flex: 1; }
.dl-section-count { font-weight: 400; color: var(--text-dim); font-size: 0.8rem; }
.dl-section-body { padding: 12px 14px; }
.dl-empty { font-size: 0.85rem; color: var(--text-dim); font-style: italic; padding: 8px 0; }

/* Key-Value grid */
.dl-kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px 16px;
}
.dl-kv { display: flex; gap: 8px; font-size: 0.85rem; padding: 2px 0; }
.dl-k { color: var(--text-dim); min-width: 100px; flex-shrink: 0; }
.dl-v { color: var(--text); font-weight: 500; word-break: break-word; }

/* Tables */
.dl-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.dl-table th {
  text-align: left;
  padding: 6px 10px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.dl-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.dl-table tr:last-child td { border-bottom: none; }
.dl-cell-link { cursor: pointer; color: var(--accent); }
.dl-cell-link:hover { text-decoration: underline; }

/* Alerts */
.dl-alert {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 6px;
}
.dl-alert-warn { background: rgba(234,179,8,0.1); color: var(--yellow); border: 1px solid rgba(234,179,8,0.2); }
.dl-alert-danger { background: rgba(239,68,68,0.1); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }

/* Risk row */
.dl-risk-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

/* AI Summary */
.dl-ai-summary {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
}

/* Order rows (clickable) */
.dl-order-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.dl-order-row:hover { background: var(--hover); }
.dl-order-row:last-child { border-bottom: none; }
.dl-order-num { font-weight: 600; color: var(--accent); min-width: 70px; }
.dl-order-items { width: 100%; font-size: 0.78rem; color: var(--text-dim); margin-top: 2px; }

/* Ticket cards */
.dl-ticket-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.dl-ticket-card:last-child { border-bottom: none; }
.dl-ticket-link { color: var(--accent); font-weight: 500; text-decoration: none; }
.dl-ticket-link:hover { text-decoration: underline; }
.dl-ticket-subj { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-ticket-date { color: var(--text-dim); font-size: 0.78rem; }

/* Refund / Return cards */
.dl-refund-card, .dl-return-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.dl-refund-card:last-child, .dl-return-card:last-child { border-bottom: none; }
.dl-refund-note { width: 100%; font-size: 0.78rem; color: var(--text-dim); font-style: italic; }

/* Gmail cards */
.dl-gmail-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.dl-gmail-card:last-child { border-bottom: none; }
.dl-gmail-subj { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-gmail-excerpt { width: 100%; font-size: 0.78rem; color: var(--text-dim); margin-top: 2px; max-height: 40px; overflow: hidden; }

/* Product hero */
.dl-product-hero {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.dl-product-img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.dl-product-title { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.dl-product-meta { font-size: 0.82rem; color: var(--text-dim); }

/* Issues list */
.dl-issues-list { margin-top: 8px; font-size: 0.85rem; }
.dl-issues-list ul { margin: 4px 0 0 16px; padding: 0; }
.dl-issues-list li { margin-bottom: 2px; color: var(--text-dim); }

/* Fulfillment card */
.dl-fulfillment-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.dl-fulfillment-card:last-child { border-bottom: none; }

/* Timeline */
.dl-timeline { position: relative; padding-left: 20px; }
.dl-tl-item {
  position: relative;
  padding: 6px 0 12px 16px;
  border-left: 2px solid var(--border);
}
.dl-tl-item:last-child { border-left-color: transparent; }
.dl-tl-dot {
  position: absolute;
  left: -7px;
  top: 10px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--surface);
}
.dl-tl-green .dl-tl-dot { background: var(--green); }
.dl-tl-blue .dl-tl-dot { background: var(--blue); }
.dl-tl-red .dl-tl-dot { background: var(--red); }
.dl-tl-orange .dl-tl-dot { background: var(--orange); }
.dl-tl-label { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.dl-tl-detail { font-size: 0.8rem; color: var(--text-dim); margin-top: 2px; }
.dl-tl-date { font-size: 0.72rem; color: var(--text-dim); opacity: 0.7; margin-top: 2px; }

/* Mobile responsive */
@media (max-width: 640px) {
  .dl-panel {
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
  .dl-summary-row { grid-template-columns: 1fr 1fr; }
  .dl-kv-grid { grid-template-columns: 1fr; }
  .dl-product-hero { flex-direction: column; }
}

/* ═══════════════════════════════════════════════════════
   Warehouse Mobile Fixes — audit-mobile-warehouse.md
   ═══════════════════════════════════════════════════════ */

/* C1: Receiving view — stack columns on mobile */
@media (max-width: 768px) {
  .location-layout {
    grid-template-columns: 1fr;
  }
  .shelf-list {
    max-height: 50vh;
  }
}

/* C2: Pick bulk action bar — remove sidebar offset on mobile */
@media (max-width: 768px) {
  .pick-bulk-bar {
    left: 0 !important;
    right: 0 !important;
    border-radius: 0 !important;
    padding: 10px 16px;
  }
}

/* C3: Table horizontal scroll — force min-width to trigger scroll */
@media (max-width: 768px) {
  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table-scroll table {
    min-width: 620px;
  }
}

/* H1: Nav items — enforce 44px touch targets.
   Note: `display` deliberately omitted. The base `.nav-item` rule already
   declares `display: flex`, and inline `display: none` (set by
   applySidebarPermissions for views the role can't access) must win. A
   `display: flex !important` here previously beat the inline rule, leaking
   admin-only items into the warehouse-role mobile nav. */
@media (max-width: 768px) {
  .nav-item {
    padding: 12px 16px !important;
    min-height: 44px !important;
    align-items: center !important;
  }
}

/* H2: Pick list card action buttons — 3-up horizontal at 44px touch height
   on mobile. Was: flex-direction: column (3 stacked rows = 168px tall card
   actions). Each pick-list card was ~344px tall, only 1-2 fit per scroll
   page. Going horizontal halves the action row to ~52px while keeping
   44px touch targets. */
@media (max-width: 768px) {
  .pick-list-card-actions {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  .pick-list-card-actions button {
    min-height: 44px;
    font-size: 13px;
    padding: 8px 10px;
    flex: 1 1 0;
    min-width: 0;
  }
}

/* H3: Pick list grid — single column on narrow screens */
@media (max-width: 480px) {
  .pick-list-grid {
    grid-template-columns: 1fr;
  }
}

/* M1: Pick tab group — scroll instead of overflow/clip */
@media (max-width: 768px) {
  .pick-tab-group {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
  .pick-tab {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* M8: Warehouse grid cells — touch feedback */
.wh-grid-cell {
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(166, 124, 82, 0.2);
}
.wh-grid-cell:active {
  background: rgba(166, 124, 82, 0.12);
}

/* ═══════════════════════════════════════════════════════
   Enhanced Mobile & Tablet Responsiveness
   Added 2026-04-03 — U1 UX Sprint
   ═══════════════════════════════════════════════════════ */

/* ── Tablet (1024px) ── */
@media (max-width: 1024px) {
  /* Notification panel narrower on tablet */
  .jarvis-notification-panel { width: 320px !important; }

  /* Morning brief grid adjustments */
  .brief-grid { grid-template-columns: 1fr !important; }

  /* Approval queue: stat cards 2-per-row */
}

/* ── Mobile (768px) ── */
@media (max-width: 768px) {
  /* Notification panel near-full-width */
  .jarvis-notification-panel {
    position: fixed !important;
    top: 56px !important;
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    max-height: 70vh !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-xl) !important;
  }

  /* Morning brief compact */
  .brief-grid { grid-template-columns: 1fr !important; gap: 12px !important; }
  .brief-metric-value { font-size: 20px !important; }

  /* Approval queue mobile */
  .aq-category-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap !important; }
  .aq-category-tabs > * { white-space: nowrap; flex-shrink: 0; }
  .aq-filter-bar { flex-direction: column !important; }
  .aq-table { min-width: 640px; }

  /* Support inbox: stack action buttons */
  .hub-fu-row { flex-direction: column !important; }
  .hub-fu-row .hub-fu-actions { align-self: flex-end; }

  /* Customer intelligence: single column cards */

  /* Batch action bar responsive */
  #aqBatchBar { left: 0 !important; padding: 10px 12px !important; flex-direction: column !important; gap: 8px !important; }

  /* Jarvis insight cards: full width */
  .sup-jarvis-insight { margin-left: 0 !important; margin-right: 0 !important; }

  /* Data tables: scroll wrapper */
  .data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table-wrap table { min-width: 600px; }
}

/* ── Small Mobile (480px) ── */
@media (max-width: 480px) {
  /* Notification panel full width */
  .jarvis-notification-panel { left: 4px !important; right: 4px !important; }

  /* Single column everything */

  /* Support inbox buttons full width */
  .hub-fu-actions { width: 100%; }
  .hub-fu-actions button { width: 100%; }

  /* Batch bar buttons stack */
  #aqBatchBar > div:last-child { flex-direction: column !important; width: 100%; }
}

/* ═══════════════════════════════════════════════════════
   Round 4 — UX Polish Additions
   ═══════════════════════════════════════════════════════ */

/* ── Pressed / Active States ── */
.btn:active,
.action-btn:active,
.tab-btn:active,
.tab:active,
.filter-btn:active,
.feed-filter-btn:active,
.segment-chip:active,
.date-preset-btn:active,
.bulk-btn:active,
.export-btn:active,
.note-save-btn:active,
.scan-mode-btn:active,
.pick-list-card:active,
.toggle-btn:active,
.notification-bell-btn:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.nav-item:active,
.cp-item:active {
  transform: scale(0.99);
  background: var(--sidebar-hover);
}

/* ── Table Row Hover (light mode fix) ── */
tr:hover td {
  background: var(--hover, rgba(0, 0, 0, 0.03));
}

/* ── Global Smooth Scroll ── */
html {
  scroll-behavior: smooth;
}

/* ── Text Selection Styling ── */
::selection {
  background: rgba(166, 124, 82, 0.25);
  color: var(--text);
}

/* ── Panel/Modal Scrollbar Styling ── */
.dl-panel-body::-webkit-scrollbar,
.cp-results::-webkit-scrollbar,
.side-panel::-webkit-scrollbar,
.notification-panel::-webkit-scrollbar,
.jarvis-global-panel::-webkit-scrollbar {
  width: 4px;
}

.dl-panel-body::-webkit-scrollbar-thumb,
.cp-results::-webkit-scrollbar-thumb,
.side-panel::-webkit-scrollbar-thumb,
.notification-panel::-webkit-scrollbar-thumb,
.jarvis-global-panel::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.dl-panel-body::-webkit-scrollbar-thumb:hover,
.cp-results::-webkit-scrollbar-thumb:hover,
.side-panel::-webkit-scrollbar-thumb:hover,
.notification-panel::-webkit-scrollbar-thumb:hover,
.jarvis-global-panel::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* ── Missing cursor:pointer on clickable rows ── */
.pd-loc-row { cursor: pointer; }
.pd-loc-row:hover td { background: var(--hover, rgba(0, 0, 0, 0.03)); }

/* ── Reduced Motion Guards ── */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .skeleton {
    animation: none;
    background: var(--surface-2);
  }
  .spinner {
    animation: none;
    border-top-color: var(--accent);
  }
  #aqBatchBar > div:last-child button { width: 100%; }
}

/* ═══════════════════════════════════════════════════════════
   COLOR-06 — Canonical status badge utilities
   Used by refunds, support, labels, support-insights views.
   Coordination note: when R3-C's .status-badge[data-severity]
   lands, migrate these to that system and remove this block.
   ═══════════════════════════════════════════════════════════ */

/* Base badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1.4;
}

/* Semantic variants — all use design-token CSS vars */
.badge-green {
  background: var(--green-dim);
  color: var(--green);
}
.badge-red {
  background: var(--red-dim);
  color: var(--red);
}
.badge-yellow {
  background: var(--yellow-dim);
  color: var(--yellow);
}
.badge-blue {
  background: var(--blue-dim);
  color: var(--blue);
}
.badge-gray {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════
   UTIL-01 — Inline-style extraction utilities (R6-A5)
   Replace repeated inline style="…" patterns with stable classes.
   Add new entries here; never move them to a component file.
   ═══════════════════════════════════════════════════════════ */

/* font-size:11px;color:var(--text-dim) — secondary/dim metadata labels */
.u-meta-dim {
  font-size: 11px;
  color: var(--text-dim);
}

/* font-size:11px;color:var(--text-muted);margin-top:4px — sub-line helper text */
.u-muted-sm {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* font-size:10px;font-weight:600;color:var(--text-dim);text-transform:uppercase;margin-bottom:4px
   Section / field label caps (accounting, P&L, supplier cards, etc.) */
.u-label-caps {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* font-weight:600 standalone — bold value/number cells */
.u-bold {
  font-weight: 600;
}

/* text-align:right — numeric columns / right-aligned cells */
.u-text-right {
  text-align: right;
}
