/* ══════════════════════════════════════
   LiveOrder — Unified Feed Styles
   Spreadsheet-first, keyboard-first
   ══════════════════════════════════════ */

:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #12122a;
  --bg-card: rgba(255,255,255,0.04);
  --bg-hover: rgba(255,255,255,0.06);
  --bg-active: rgba(99,102,241,0.12);
  --bg-order: rgba(99,102,241,0.06);
  --border: rgba(255,255,255,0.08);
  --border-focus: #6366f1;
  --text-primary: #e8e8f0;
  --text-secondary: #8888a8;
  --text-muted: #55557a;
  --accent: #6366f1;
  --accent-glow: rgba(99,102,241,0.3);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --red-live: #ff4444;
  --new-badge: #10b981;
  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
  --radius: 8px;
  --radius-lg: 12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

/* ── TOPBAR ── */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: 44px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  z-index: 100; flex-shrink: 0;
}
.topbar-left, .topbar-center, .topbar-right { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 17px; font-weight: 800; letter-spacing: -0.5px; }
.logo .accent { color: var(--red-live); }
.session-name {
  font-size: 13px; color: var(--text-secondary);
  max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.session-status {
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  font-weight: 600; text-transform: uppercase;
}
.session-status.active { background: rgba(34,197,94,0.15); color: var(--success); }
.session-status.closed { background: rgba(255,255,255,0.08); color: var(--text-muted); }

.stat-pill {
  font-size: 12px; padding: 3px 8px; border-radius: 5px;
  background: var(--bg-card); border: 1px solid var(--border);
  font-weight: 500; white-space: nowrap;
}
.btn-icon {
  width: 32px; height: 32px; border-radius: 6px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-primary); cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.btn-icon:hover { background: var(--bg-hover); }
.btn-text { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 12px; }
.btn-text:hover { color: var(--text-primary); }
.user-info { font-size: 12px; color: var(--text-secondary); }

/* ── TOOLBAR ── */
#toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 16px; height: 40px;
  background: rgba(18,18,42,0.9);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; gap: 8px;
}
.toolbar-group { display: flex; align-items: center; gap: 8px; }
.toolbar-select {
  padding: 4px 8px; font-size: 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 5px; color: var(--text-primary);
  font-family: var(--font-sans);
}
.toolbar-input {
  padding: 4px 10px; font-size: 12px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: 5px; color: var(--text-primary); width: 200px;
  font-family: var(--font-sans);
}
.toolbar-input:focus { outline: none; border-color: var(--accent); }
.toolbar-input-sm { font-family: var(--font-mono); font-weight: 600; }
.toolbar-check {
  font-size: 12px; color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; gap: 4px;
}
.toolbar-check input { cursor: pointer; }
.toolbar-bulk { display: flex; gap: 4px; align-items: center; }

/* ── FILTER CODE WRAPPER (inline clear button) ── */
.filter-code-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.btn-clear-filter {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px;
  background: rgba(239, 68, 68, 0.25); border: none; border-radius: 50%;
  color: #f87171; font-size: 11px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
  padding: 0; line-height: 1;
}
.btn-clear-filter:hover {
  background: rgba(239, 68, 68, 0.5); color: #fff;
}

/* ── RESET FILTERS BUTTON ── */
.btn-reset-filters {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #f59e0b !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
  font-weight: 600 !important;
  animation: pulse-reset 1.5s ease-in-out infinite;
}
.btn-reset-filters:hover {
  background: rgba(245, 158, 11, 0.3) !important;
  color: #fbbf24 !important;
}
@keyframes pulse-reset {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.75; }
}

/* ── MAIN FEED ── */
#mainFeed {
  flex: 1; overflow: hidden;
  display: flex; flex-direction: column;
}
body {
  display: flex; flex-direction: column;
}
.unified-feed {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  outline: none;
}

/* ── FEED ROW (comment + inline orders) ── */
.feed-row {
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  position: relative;
}
/* Zebra striping for better cross-row readability on wide screens */
.feed-row:nth-child(even) { background: rgba(255,255,255,0.015); }
.feed-row:nth-child(odd) { background: transparent; }

/* Hover: vivid green bg + neon pink border (12px = 4× default 3px) + glow */
.feed-row:hover {
  background: rgba(34, 197, 94, 0.13) !important;
  border-left: 12px solid #ff00c8 !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 0, 200, 0.25),
    0 0 18px rgba(255, 0, 200, 0.18),
    0 0 6px rgba(34, 197, 94, 0.15);
  outline: 1px solid rgba(255, 0, 200, 0.3);
  outline-offset: -1px;
}
/* Focus-within: when any input inside the row has focus (editing order lines) */
.feed-row:focus-within {
  background: rgba(99,102,241,0.08) !important;
  border-left-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(99,102,241,0.12), 0 2px 8px rgba(99,102,241,0.1);
}
/* Selected row (keyboard navigation) — NEON highlight */
.feed-row.selected {
  background: rgba(255, 0, 200, 0.10) !important;
  border-left: 6px solid #00ffe5 !important;
  box-shadow:
    inset 0 0 0 1px rgba(0, 255, 229, 0.35),
    0 0 20px rgba(0, 255, 229, 0.25),
    0 0 8px rgba(255, 0, 200, 0.12);
  outline: 2px solid rgba(0, 255, 229, 0.45);
  outline-offset: -2px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
/* Has order: prominent highlight — easy to spot in feed */
.feed-row.has-order {
  background: rgba(34, 197, 94, 0.07);
  border-left: 3px solid #22c55e;
  border-top: 1px solid rgba(34, 197, 94, 0.15);
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.06);
  position: relative;
}
.feed-row.has-order::after {
  content: '';
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 3px;
  background: rgba(34, 197, 94, 0.25);
  border-radius: 0 2px 2px 0;
}
.feed-row.has-order:nth-child(even) {
  background: rgba(34, 197, 94, 0.10);
}
.feed-row.has-order:hover {
  background: rgba(34, 197, 94, 0.18) !important;
  border-left: 12px solid #ff00c8 !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 0, 200, 0.25),
    0 0 18px rgba(255, 0, 200, 0.18),
    0 0 6px rgba(34, 197, 94, 0.2);
  outline: 1px solid rgba(255, 0, 200, 0.3);
  outline-offset: -1px;
}
/* Hidden row */
.feed-row.hidden-row { opacity: 0.35; }

/* Priority row (from Streamer dashboard) */
.feed-row.is-priority {
  border-left: 3px solid #fbbf24 !important;
  background: rgba(251,191,36,0.06);
}
.feed-row.is-priority:hover {
  background: rgba(34, 197, 94, 0.13) !important;
  border-left: 12px solid #ff00c8 !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 0, 200, 0.25),
    0 0 18px rgba(255, 0, 200, 0.18),
    0 0 6px rgba(251, 191, 36, 0.15);
}
.feed-priority-badge {
  font-size: 12px; margin-left: 2px;
  filter: drop-shadow(0 0 3px rgba(251,191,36,0.6));
}
.feed-streamer-note {
  font-size: 11px; color: #fbbf24; margin-top: 3px;
  background: rgba(251,191,36,0.08); padding: 2px 8px;
  border-radius: 4px; display: inline-block;
  border-left: 2px solid #fbbf24;
}

/* Comment header line */
.feed-comment {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 16px; min-height: 44px;
  cursor: pointer;
}
.feed-select {
  flex-shrink: 0; margin-top: 10px;
  width: 15px; height: 15px; cursor: pointer;
  accent-color: var(--accent);
}
.select-count {
  font-size: 11px; font-weight: 700; color: var(--accent);
  font-family: var(--font-mono);
}
.feed-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  flex-shrink: 0; object-fit: cover;
  border: 2px solid var(--border);
  margin-top: 2px;
}
.feed-body { flex: 1; min-width: 0; }
.feed-meta {
  display: flex; gap: 6px; align-items: center;
  font-size: 12px; color: var(--text-secondary);
  margin-bottom: 1px;
  flex-wrap: wrap;
}
.feed-name { font-weight: 600; color: var(--text-primary); font-size: 13px; }
.feed-phone { color: var(--accent); font-family: var(--font-mono); font-size: 11px; }
.feed-phone.copyable {
  cursor: pointer; padding: 1px 4px; border-radius: 3px;
  transition: background 0.15s, color 0.15s;
}
.feed-phone.copyable:hover {
  background: rgba(99,102,241,0.2); color: #a5b4fc;
  text-decoration: underline;
}
.feed-phone-input-wrap {
  display: inline-flex; align-items: center; gap: 2px;
}
.feed-phone-input {
  width: 100px; padding: 1px 5px; font-size: 11px;
  font-family: var(--font-mono); color: var(--text-primary);
  background: rgba(255,255,255,0.06); border: 1px dashed rgba(99,102,241,0.4);
  border-radius: 3px; outline: none;
}
.feed-phone-input:focus { border-color: var(--accent); border-style: solid; }
.feed-phone-input::placeholder { color: var(--text-muted); font-style: italic; font-size: 10px; }
.btn-save-phone {
  padding: 1px 4px; font-size: 11px; cursor: pointer;
  background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.25);
  border-radius: 3px; color: var(--accent); transition: background 0.15s;
}
.btn-save-phone:hover { background: rgba(99,102,241,0.3); }
.feed-source {
  font-size: 10px; padding: 1px 5px; border-radius: 3px;
  font-weight: 500; white-space: nowrap;
  background: rgba(255,255,255,0.06); color: var(--text-muted);
}
.feed-text { font-size: 13px; word-break: break-word; color: var(--text-secondary); }
.feed-text .code-match {
  background: rgba(99,102,241,0.25); color: #a5b4fc;
  padding: 0 3px; border-radius: 2px; font-weight: 600;
  font-family: var(--font-mono);
}

/* Classification tags */
.feed-tag {
  display: inline-block; font-size: 10px; padding: 1px 6px;
  border-radius: 4px; font-weight: 600; white-space: nowrap;
}
.tag-order { background: rgba(99,102,241,0.2); color: #818cf8; }
.tag-question { background: rgba(245,158,11,0.2); color: #fbbf24; }
.tag-complaint { background: rgba(239,68,68,0.2); color: #f87171; }
.tag-spam { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.tag-pending { background: rgba(255,255,255,0.05); color: var(--text-muted); font-weight: 400; }

/* Right side: Order checkbox + count + actions */
.feed-actions {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0; margin-left: auto; padding-left: 8px;
}
.feed-order-toggle {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text-secondary);
  cursor: pointer; user-select: none;
  padding: 3px 8px; border-radius: 5px;
  border: 1px solid var(--border); background: transparent;
  transition: all 0.15s;
}
.feed-order-toggle:hover { background: var(--bg-hover); }
.feed-order-toggle.active {
  background: rgba(99,102,241,0.15); border-color: var(--accent);
  color: var(--accent);
}
.feed-order-toggle input[type="checkbox"] { cursor: pointer; accent-color: var(--accent); }
.feed-order-count {
  font-family: var(--font-mono); font-weight: 700; font-size: 12px;
  min-width: 20px; text-align: center;
  padding: 2px 6px; border-radius: 4px;
  background: rgba(99,102,241,0.15); color: var(--accent);
}
.btn-hide {
  background: none; border: none; cursor: pointer; font-size: 13px;
  color: var(--text-muted); padding: 2px;
  opacity: 0; transition: opacity 0.15s;
}
.feed-row:hover .btn-hide { opacity: 1; }
.btn-hide:hover { color: var(--danger); }

/* ── INLINE ORDER TABLE ── */
.feed-order-lines {
  padding: 0 16px 8px 73px; /* align with text after checkbox+avatar */
}
.order-inline-table {
  width: auto; border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}
.order-inline-table td {
  padding: 2px 3px; vertical-align: middle;
}
/* Row-level tracking within order lines — connect code ↔ quantity on wide screens */
.order-inline-table tr {
  transition: background 0.1s;
}
.order-inline-table tr:hover {
  background: rgba(99,102,241,0.06);
}
.order-inline-table tr:focus-within {
  background: rgba(99,102,241,0.1);
}
.order-inline-table input {
  background: transparent; border: 1px solid transparent;
  color: var(--text-primary); padding: 3px 6px;
  border-radius: 3px; font-size: 12px;
  font-family: var(--font-mono); width: 100%;
  transition: border-color 0.15s, background 0.15s;
}
.order-inline-table input:focus {
  outline: none; border-color: var(--accent);
  background: rgba(99,102,241,0.08);
}
.order-inline-table input.saved {
  border-color: var(--success);
  animation: save-flash 0.5s ease-out;
}
@keyframes save-flash {
  0% { background: rgba(34,197,94,0.15); }
  100% { background: transparent; }
}
.order-inline-table input.input-code {
  font-weight: 700; color: var(--accent); text-transform: uppercase;
  width: 80px;
}
.order-inline-table input.input-name { width: 100%; min-width: 120px; max-width: 480px; }
.order-inline-table input.input-qty { width: 50px; text-align: center; }
.order-inline-table input.input-note { width: 100%; color: var(--text-secondary); }

.col-code-w { width: 90px; }
.col-name-w { width: 410px; }
.col-price-w { width: 65px; }
.col-qty-w { width: 55px; }
.col-size-w { width: 65px; }
.col-note-w { width: 150px; }
.col-act-w { width: 72px; white-space: nowrap; }
.order-inline-table input.input-size { width: 60px; text-align: center; color: var(--text-secondary); }

/* Price input: readonly by default, double-click to edit */
.order-inline-table input.input-price {
  width: 55px; text-align: right; font-family: var(--font-mono);
  color: var(--text-secondary); font-size: 12px;
}
.order-inline-table input.input-price[readonly] {
  cursor: default; opacity: 0.65;
  border-color: transparent; background: transparent;
}
.order-inline-table input.input-price[readonly]:hover {
  opacity: 0.85; border-color: rgba(255,255,255,0.1);
}
.order-inline-table input.input-price:not([readonly]) {
  opacity: 1; border-color: #3b82f6; background: rgba(59,130,246,0.08);
}
.price-suffix { font-size: 10px; color: var(--text-muted); margin-left: 1px; }

/* Inline new product row */
.new-product-inline-row td {
  padding: 4px 3px !important;
  background: rgba(245,158,11,0.06) !important;
  border-top: 1px dashed rgba(245,158,11,0.25);
}
.new-product-inline-row .npi-label {
  font-size: 10px; color: #fbbf24; font-weight: 600; margin-right: 4px;
}
.new-product-inline-row input {
  font-size: 11px !important; padding: 3px 6px !important;
}
.btn-npi-search {
  background: rgba(52,211,153,0.15); color: #6ee7b7; border: 1px solid rgba(52,211,153,0.3);
  border-radius: 4px; cursor: pointer; padding: 2px 6px; font-size: 12px;
  transition: all 0.15s;
}
.btn-npi-search:hover { background: rgba(52,211,153,0.3); }
.btn-npi-save {
  background: rgba(59,130,246,0.2); color: #93c5fd; border: 1px solid rgba(59,130,246,0.3);
  border-radius: 4px; cursor: pointer; padding: 2px 8px; font-size: 11px; font-weight: 600;
  transition: all 0.15s;
}
.btn-npi-save:hover { background: rgba(59,130,246,0.35); }
.btn-npi-cancel {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  font-size: 13px; padding: 2px; transition: color 0.15s;
}
.btn-npi-cancel:hover { color: #ef4444; }
.btn-new-product {
  background: rgba(52,211,153,0.15); color: #6ee7b7; border: 1px solid rgba(52,211,153,0.3);
  border-radius: 4px; cursor: pointer; padding: 1px 5px; font-size: 11px;
  transition: all 0.15s;
}
.btn-new-product:hover { background: rgba(52,211,153,0.3); }

.btn-del-line {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 14px; padding: 2px;
}
.btn-del-line:hover { color: var(--danger); }

.btn-add-catalog {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 14px; padding: 2px;
  transition: color 0.15s;
}
.btn-add-catalog:hover, .btn-new-product:hover { color: var(--accent); }
.btn-add-catalog.hidden, .btn-new-product.hidden { display: none; }

.btn-reload-name {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 13px; padding: 2px;
  transition: color 0.15s;
}
.btn-reload-name:hover { color: var(--success); }
.btn-reload-name.hidden { display: none; }

.btn-add-line {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 11px;
  padding: 2px 6px; margin-top: 2px;
  display: inline-flex; align-items: center; gap: 2px;
}
.btn-add-line:hover { color: var(--accent); }

/* ── STATS POPOVER ── */
.popover {
  display: none; position: fixed;
  top: 50px; right: 16px; z-index: 500;
  background: #1a1a2e; border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 360px; max-height: 60vh;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  overflow: hidden;
}
.popover.open { display: block; }
.popover-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.popover-header h3 { font-size: 14px; font-weight: 600; }
.popover-body {
  padding: 12px; overflow-y: auto; max-height: calc(60vh - 50px);
}
.stat-card {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; margin-bottom: 6px;
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border);
}
.stat-card .stat-label { font-size: 13px; font-weight: 500; }
.stat-card .stat-value {
  font-size: 18px; font-weight: 700;
  font-family: var(--font-mono); color: var(--accent);
}
.stat-card .stat-sub { font-size: 11px; color: var(--text-muted); }

/* ── PRODUCT SHEET (spreadsheet table in modal) ── */
.product-sheet-wrap { overflow: auto; max-height: 50vh; }
.product-sheet {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.product-sheet thead { position: sticky; top: 0; z-index: 5; }
.product-sheet th {
  background: var(--bg-secondary);
  padding: 8px 6px; text-align: left;
  font-weight: 600; font-size: 12px;
  color: var(--text-secondary); border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.product-sheet td {
  padding: 3px 4px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.product-sheet tr:hover { background: var(--bg-hover); }
.product-sheet input {
  background: transparent; border: 1px solid transparent;
  color: var(--text-primary); padding: 5px 6px;
  border-radius: 3px; width: 100%; font-size: 13px;
  font-family: var(--font-mono);
  transition: border-color 0.15s;
}
.product-sheet input:focus {
  outline: none; border-color: var(--accent);
  background: rgba(99,102,241,0.08);
}
.product-sheet input.saved { border-color: var(--success); }
.product-sheet .new-row input { color: var(--text-muted); }
.product-sheet .sold-count {
  font-weight: 700; color: var(--accent);
  text-align: center; font-size: 12px;
}
.td-goodman { position: relative; display: flex !important; align-items: center; gap: 2px; padding: 3px 4px !important; }
.td-goodman input { flex: 1; min-width: 0; }
.btn-gm-lookup {
  flex-shrink: 0; width: 26px; height: 26px;
  background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.25);
  border-radius: 4px; cursor: pointer; font-size: 13px; line-height: 1;
  color: var(--accent); display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s; padding: 0;
}
.btn-gm-lookup:hover { background: rgba(99,102,241,0.3); }
.btn-gm-lookup:disabled { opacity: 0.4; cursor: wait; }

/* ── MODALS ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  z-index: 1000; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #1a1a2e; border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 460px;
  max-height: 85vh; overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}
.modal-lg { width: 600px; }
.modal-xl { width: 800px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-close {
  background: none; border: none; color: var(--text-secondary);
  font-size: 18px; cursor: pointer;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 18px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; font-weight: 500; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary);
  font-size: 14px; font-family: var(--font-sans);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none; border-color: var(--accent);
}

/* ── BUTTONS ── */
.btn-primary {
  padding: 10px 20px;
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  color: #fff; border: none; border-radius: var(--radius);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm { font-size: 11px; padding: 4px 10px; border-radius: 5px; cursor: pointer; }
.btn-accent {
  background: rgba(99,102,241,0.2); color: var(--accent);
  border: 1px solid rgba(99,102,241,0.3);
  font-weight: 600;
}
.btn-accent:hover { background: rgba(99,102,241,0.3); }
.btn-outline {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border); font-weight: 500;
}
.btn-outline:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-danger {
  background: rgba(239,68,68,0.15); color: var(--danger);
  border: 1px solid rgba(239,68,68,0.3); cursor: pointer;
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-danger:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── AUTO-MERGE SPINNER ── */
.auto-merge-spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid rgba(99,102,241,0.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin-merge 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}
@keyframes spin-merge {
  to { transform: rotate(360deg); }
}
#btnAutoMerge:disabled {
  opacity: 0.6; cursor: wait;
  background: rgba(99,102,241,0.1);
}

/* ── SESSION HISTORY ── */
.session-history { max-height: 200px; overflow-y: auto; }
.session-hist-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; margin-bottom: 4px;
  background: var(--bg-card); border-radius: 6px;
  border: 1px solid var(--border); font-size: 13px;
  transition: background 0.15s, border-color 0.15s;
}
.session-hist-item:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}
.session-hist-item.current {
  background: rgba(99,102,241,0.12);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(99,102,241,0.15);
}
.session-hist-item .sh-name { flex: 1; }
.session-hist-item .sh-stats { color: var(--text-muted); font-size: 11px; }

/* ── SESSION PICKER (topbar dropdown) ── */
.session-picker {
  padding: 4px 28px 4px 10px;
  font-size: 12px; font-weight: 600;
  font-family: var(--font-sans);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  cursor: pointer;
  max-width: 300px;
  min-width: 180px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238888a8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
  transition: border-color 0.15s, background 0.15s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-picker:hover {
  background-color: rgba(255,255,255,0.1);
  border-color: var(--accent);
}
.session-picker:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.2);
}
.session-picker option {
  background: #1a1a2e;
  color: var(--text-primary);
  padding: 8px;
  font-size: 13px;
}

/* ── CLOSED SESSION BANNER ── */
.closed-session-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  background: linear-gradient(90deg, rgba(245,158,11,0.12), rgba(245,158,11,0.06));
  border-bottom: 1px solid rgba(245,158,11,0.2);
  font-size: 12px;
  color: #fbbf24;
  flex-shrink: 0;
  animation: csb-slideIn 0.3s ease-out;
}
@keyframes csb-slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.csb-icon { font-size: 14px; }
.csb-text { flex: 1; font-weight: 500; }
.csb-btn {
  padding: 3px 12px;
  font-size: 11px; font-weight: 700;
  background: rgba(255,68,68,0.15);
  border: 1px solid rgba(255,68,68,0.3);
  border-radius: 5px;
  color: #ff4444;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.csb-btn:hover {
  background: rgba(255,68,68,0.3);
}

/* ── EMPTY STATE ── */
.empty-state {
  padding: 40px 20px; text-align: center;
  color: var(--text-muted); font-size: 13px;
}

/* ── POLL BUTTON ── */
.btn-poll {
  padding: 3px 10px; border-radius: 5px;
  font-size: 11px; font-weight: 600; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.15);
  transition: all 0.2s;
}
.btn-poll.polling {
  background: rgba(34,197,94,0.15); color: var(--success);
  border-color: rgba(34,197,94,0.3);
  animation: pulse-poll 2s infinite;
}
.btn-poll.stopped {
  background: rgba(239,68,68,0.15); color: var(--danger);
  border-color: rgba(239,68,68,0.3);
}
@keyframes pulse-poll {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ── NEW BADGE ── */
.badge-new {
  display: inline-block; font-size: 10px; padding: 1px 5px;
  border-radius: 3px; font-weight: 700;
  background: rgba(16,185,129,0.2); color: var(--new-badge);
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }
.unified-feed { scrollbar-width: auto; scrollbar-color: rgba(255,255,255,0.18) rgba(255,255,255,0.03); }

/* ── KBD HINTS ── */
.kbd {
  display: inline-block; font-size: 10px; padding: 1px 5px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px; font-family: var(--font-mono);
  color: var(--text-muted); vertical-align: middle;
}

/* ── DUPLICATE WARNING BADGE ── */
.dup-warn {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 10px; padding: 1px 6px; border-radius: 3px;
  background: rgba(245,158,11,0.2); color: #f59e0b;
  cursor: pointer; font-weight: 700; white-space: nowrap;
  margin-left: 4px; vertical-align: middle;
}
.dup-warn:hover { background: rgba(245,158,11,0.35); }

/* ── CLICKABLE CUSTOMER NAME ── */
.feed-name.clickable {
  cursor: pointer; text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.2);
  text-underline-offset: 2px;
}
.feed-name.clickable:hover {
  text-decoration-color: var(--accent);
  color: var(--accent);
}

/* ── CUSTOMER ORDER MODAL ── */
.cust-header-info {
  display: flex; align-items: center; gap: 12px;
}
.cust-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
}
.cust-phone-row {
  display: flex; gap: 8px; align-items: center;
  margin-top: 2px;
}
.cust-uid {
  font-size: 10px; color: var(--text-muted);
  font-family: var(--font-mono);
}
.cust-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.cust-summary {
  margin-left: auto;
  display: flex; gap: 10px; font-size: 12px; font-weight: 600;
}
.cust-summary-item {
  background: rgba(255,255,255,0.06); padding: 3px 8px;
  border-radius: var(--radius); font-family: var(--font-mono);
}
.cust-summary-item.warn { background: rgba(245,158,11,0.15); color: #f59e0b; }
.cust-body {
  padding: 12px 20px !important; overflow-y: auto;
  max-height: 60vh;
}
.cust-comment-block {
  margin-bottom: 12px; padding: 10px 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.cust-comment-text {
  font-size: 13px; color: var(--text-secondary);
  margin-bottom: 6px; line-height: 1.5;
}
.cust-comment-time {
  font-size: 10px; color: var(--text-muted);
  font-family: var(--font-mono);
}
.cust-no-order {
  font-size: 12px; color: var(--text-muted);
  font-style: italic; padding: 4px 0;
}
.cust-loading {
  text-align: center; padding: 40px;
  color: var(--text-muted); font-size: 14px;
}
.phone-warn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 2px 8px; border-radius: 3px;
  background: rgba(239,68,68,0.15); color: #ef4444;
  margin-left: 8px;
}

/* ── VOIDED ORDER LINES ── */
/* Duplicate code highlight in Customer Modal */
.cust-dup-line {
  border-left: 3px solid #ff9800 !important;
  background: rgba(255, 152, 0, 0.08) !important;
}
.cust-dup-line .input-code {
  color: #ff9800 !important;
  font-weight: 700 !important;
}
.voided-line {
  opacity: 0.4;
}
.voided-line td {
  position: relative;
}
.voided-text {
  display: inline-block;
  text-decoration: line-through;
  text-decoration-color: rgba(255,255,255,0.4);
  font-size: 12px; font-family: var(--font-mono);
  color: var(--text-muted);
  padding: 4px 6px;
}
.voided-label {
  font-style: italic; font-family: var(--font-main);
  text-decoration: none; font-size: 10px;
  color: rgba(245,158,11,0.6);
}
.btn-undo-void {
  background: none; border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-muted); font-size: 13px;
  border-radius: var(--radius); padding: 2px 6px;
  cursor: pointer; transition: all 0.2s;
}
.btn-undo-void:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
  border-color: var(--accent);
}

/* ── VOIDED LINES IN MAIN FEED ── */
.feed-voided-line {
  opacity: 0.35;
}
.feed-voided-text {
  display: inline-block;
  font-style: italic;
  text-decoration: line-through;
  text-decoration-color: rgba(255,255,255,0.35);
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 6px;
  font-family: var(--font-mono);
}
.feed-voided-label {
  font-family: var(--font-main);
  text-decoration: none;
  font-size: 10px;
  color: rgba(255,255,255,0.25);
}

/* ── ZALO MESSAGE BUTTON ── */
.btn-zalo-msg {
  background: none; border: none; cursor: pointer;
  font-size: 14px; padding: 2px 4px;
  color: var(--text-muted);
  opacity: 0; transition: opacity 0.15s, color 0.15s;
  flex-shrink: 0;
}
.feed-row:hover .btn-zalo-msg { opacity: 1; }
.btn-zalo-msg:hover { color: #22c55e; }

/* ── COMPLAINT QUICK-REPLY BUTTON ── */
.btn-complaint-msg {
  background: none; border: none; cursor: pointer;
  font-size: 14px; padding: 2px 4px;
  color: var(--text-muted);
  opacity: 0; transition: opacity 0.15s, color 0.15s;
  flex-shrink: 0;
}
.feed-row:hover .btn-complaint-msg { opacity: 1; }
.btn-complaint-msg:hover { color: #f59e0b; }
.btn-complaint-msg:disabled { opacity: 0.4; cursor: wait; }

/* ── SEND MESSAGE POPUP ── */
.msg-popup-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(3px);
  z-index: 2000; align-items: center; justify-content: center;
}
.msg-popup-overlay.open { display: flex; }
.msg-popup {
  background: #1a1a2e; border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: popup-in 0.15s ease-out;
}
@keyframes popup-in {
  0% { opacity: 0; transform: scale(0.95) translateY(-10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.msg-popup-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.msg-popup-header h3 { font-size: 14px; font-weight: 600; }
.msg-popup-header .popup-phone {
  font-family: var(--font-mono); color: var(--accent);
  font-size: 13px; font-weight: 600;
}
.msg-popup-body { padding: 16px 18px; }
.msg-popup-body textarea {
  width: 100%; min-height: 100px; padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary);
  font-size: 14px; font-family: var(--font-sans);
  resize: vertical; line-height: 1.5;
}
.msg-popup-body textarea:focus {
  outline: none; border-color: var(--accent);
}
.msg-popup-footer {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; padding: 12px 18px;
  border-top: 1px solid var(--border);
}
.msg-popup-footer .btn-send-zalo {
  padding: 8px 20px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff; border: none; border-radius: var(--radius);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: opacity 0.15s;
}
.msg-popup-footer .btn-send-zalo:hover { opacity: 0.9; }
.msg-popup-footer .btn-send-zalo:disabled { opacity: 0.4; cursor: not-allowed; }
.msg-popup-footer .btn-cancel-msg {
  padding: 8px 16px; background: transparent;
  color: var(--text-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13px; cursor: pointer;
}
.msg-popup-footer .btn-cancel-msg:hover { background: var(--bg-hover); }

/* ── FILL DROPDOWN PANEL ── */
.toolbar-fill-wrapper {
  position: relative;
  display: inline-block;
}

.fill-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 380px;
  background: rgba(15, 23, 35, 0.97);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(139,92,246,0.1);
  backdrop-filter: blur(16px);
  z-index: 1000;
  animation: fillPanelIn 0.15s ease-out;
}
.fill-panel.open { display: block; }

@keyframes fillPanelIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.fill-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.fill-panel-title {
  font-weight: 700; font-size: 14px;
  color: var(--text-primary);
}
.fill-panel-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 16px;
  padding: 2px 6px; border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.fill-panel-close:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }

.fill-panel-body { padding: 12px 16px 16px; }

.fill-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 5px;
}
.fill-hint { font-weight: 400; color: var(--text-muted); }

.fill-textarea {
  width: 100%; box-sizing: border-box;
  padding: 8px 10px; font-size: 13px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--text-primary); font-family: var(--font-sans);
  resize: vertical; min-height: 60px; max-height: 140px;
  line-height: 1.5;
  transition: border-color 0.15s;
}
.fill-textarea:focus { outline: none; border-color: var(--accent); }
.fill-textarea::placeholder { color: var(--text-muted); font-size: 12px; }

.fill-filter-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 8px;
}
.fill-match-count {
  font-size: 13px; font-weight: 600;
  color: #4ade80; /* green */
}
.fill-match-count.empty { color: var(--text-muted); }

.fill-code-input {
  width: 100%; box-sizing: border-box;
  padding: 10px 12px; font-size: 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--accent); font-family: var(--font-mono);
  font-weight: 800; text-transform: uppercase;
  text-align: center; letter-spacing: 2px;
  transition: border-color 0.15s;
}
.fill-code-input:focus { outline: none; border-color: var(--accent); }
.fill-code-input::placeholder {
  font-size: 14px; font-weight: 400;
  color: var(--text-muted); letter-spacing: 0;
  text-transform: none;
}

.btn-fill-action {
  width: 100%; margin-top: 12px;
  padding: 10px; font-size: 14px; font-weight: 700;
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px; cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-fill-action:hover { background: #7c3aed; transform: translateY(-1px); }
.btn-fill-action:active { transform: translateY(0); }
.btn-fill-action:disabled { opacity: 0.5; cursor: wait; transform: none; }

/* ── DEEPFILL PANEL (extends .fill-panel) ── */
.deepfill-panel { width: 420px; }

/* ── CONSULTATION QUICK-REPLY BUTTON ── */
.btn-consult-msg {
  background: none; border: none; cursor: pointer;
  font-size: 14px; padding: 2px 4px;
  color: var(--text-muted);
  opacity: 0; transition: opacity 0.15s, color 0.15s;
  flex-shrink: 0;
}
.feed-row:hover .btn-consult-msg { opacity: 1; }
.btn-consult-msg:hover { color: #60a5fa; }
.btn-consult-msg:disabled { opacity: 0.4; cursor: wait; }

/* ── PRODUCT KEYWORDS INPUT ── */
.prod-kw-input {
  color: var(--text-secondary) !important;
  font-size: 12px !important;
  font-family: var(--font-sans) !important;
}
.prod-kw-input::placeholder { color: var(--text-muted); font-style: italic; }

/* ══════════════════════════════════════
   VOID CODE MODAL
   ══════════════════════════════════════ */
.void-codes-bar {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 10px;
}
.void-code-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 5px;
  background: rgba(239, 68, 68, 0.15); color: #f87171;
  font-family: var(--font-mono); font-weight: 700; font-size: 13px;
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.void-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0; margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.void-selected-count {
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  font-family: var(--font-mono);
}
.void-preview-list {
  max-height: 45vh; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.void-preview-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.void-preview-row:last-child { border-bottom: none; }
.void-preview-row:hover { background: rgba(255,255,255,0.03); }
.void-preview-row.unchecked { opacity: 0.4; }
.void-preview-check {
  flex-shrink: 0; margin-top: 2px;
  width: 16px; height: 16px;
  accent-color: var(--danger);
  cursor: pointer;
}
.void-preview-body { flex: 1; min-width: 0; }
.void-preview-name {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
}
.void-preview-phone {
  font-size: 11px; color: var(--accent);
  font-family: var(--font-mono); margin-left: 6px;
}
.void-preview-msg {
  font-size: 12px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 450px; margin-top: 2px;
}
.void-preview-lines {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px;
}
.void-line-tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px; border-radius: 4px; font-size: 11px;
  font-family: var(--font-mono); font-weight: 600;
}
.void-line-tag.will-void {
  background: rgba(239, 68, 68, 0.15); color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
  text-decoration: line-through;
}
.void-line-tag.keep {
  background: rgba(255,255,255,0.05); color: var(--text-muted);
  border: 1px solid var(--border);
}
.void-preview-qty {
  font-size: 10px; opacity: 0.7;
}

/* ══════════════════════════════════════
   GOOGLE SHEET SYNC BAR
   ══════════════════════════════════════ */
.sheet-sync-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; margin-bottom: 10px;
  background: rgba(99,102,241,0.06);
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: var(--radius); flex-wrap: wrap;
}
.sheet-sync-label {
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary); white-space: nowrap;
}
.sheet-input {
  padding: 4px 8px; font-size: 11px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-primary); font-family: var(--font-mono);
  width: 180px;
}
.sheet-input:focus { outline: none; border-color: var(--accent); }
.sheet-input-lg { flex: 1; min-width: 200px; }
.sheet-sync-result {
  font-size: 11px; font-weight: 600;
  font-family: var(--font-mono);
}
.sheet-sync-result.success { color: var(--success); }
.sheet-sync-result.error { color: var(--danger); }

/* ══════════════════════════════════════
   CODE SUGGESTION DROPDOWN
   ══════════════════════════════════════ */
.code-suggestion-dropdown {
  display: none; position: fixed;
  z-index: 2000; min-width: 220px; max-width: 360px;
  background: rgba(15, 23, 35, 0.97);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(99,102,241,0.1);
  backdrop-filter: blur(16px);
  overflow-y: auto;
  animation: fillPanelIn 0.1s ease-out;
}
.code-suggestion-dropdown.open { display: block; }
.code-sug-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; cursor: pointer;
  transition: background 0.1s;
  font-size: 12px;
}
.code-sug-item:hover, .code-sug-item.active {
  background: rgba(99,102,241,0.15);
}
.code-sug-code {
  font-family: var(--font-mono); font-weight: 700;
  color: var(--accent); min-width: 50px;
  text-transform: uppercase;
}
.code-sug-name {
  color: var(--text-secondary); flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.code-sug-price {
  color: var(--text-muted); font-family: var(--font-mono);
  font-size: 11px;
}

/* ══════════════════════════════════════
   CUSTOMER MODAL ORDER TOGGLE
   ══════════════════════════════════════ */
.cust-comment-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 8px;
  margin-bottom: 6px;
}
.cust-comment-header .feed-order-toggle {
  flex-shrink: 0; font-size: 11px;
  padding: 2px 6px;
}
.cust-comment-actions {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
}
.btn-hide-cust {
  background: none; border: none; cursor: pointer;
  font-size: 14px; padding: 2px 4px;
  color: var(--text-muted); opacity: 0.5;
  transition: opacity 0.15s, color 0.15s;
}
.cust-comment-block:hover .btn-hide-cust { opacity: 1; }
.btn-hide-cust:hover { color: var(--danger); opacity: 1; }
.cust-hidden-comment {
  opacity: 0.35;
  border-left: 3px solid rgba(239, 68, 68, 0.3);
}

/* ══════════════════════════════════════
   SPAM LIST MODAL
   ══════════════════════════════════════ */
.spam-list-container {
  display: flex; flex-direction: column; gap: 2px;
}
.spam-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 6px; transition: background 0.15s;
}
.spam-item:hover {
  background: var(--bg-hover);
}
.spam-text {
  font-size: 13px; color: var(--text-primary);
  flex: 1; min-width: 0;
  word-break: break-word;
}
.spam-actions {
  display: flex; gap: 4px; flex-shrink: 0; margin-left: 8px;
}
.btn-spam-edit, .btn-spam-delete {
  background: none; border: 1px solid transparent;
  cursor: pointer; font-size: 14px; padding: 2px 6px;
  border-radius: 4px; transition: all 0.15s;
  color: var(--text-muted);
}
.btn-spam-edit:hover { color: var(--accent); border-color: rgba(99,102,241,0.3); background: rgba(99,102,241,0.1); }
.btn-spam-delete:hover { color: var(--danger); border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.1); }

/* ══════════════════════════════════════
   CUSTOMER LIST VIEW
   ══════════════════════════════════════ */

#btnCustomerList.active {
  background: rgba(0, 255, 136, 0.15);
  border-bottom: 2px solid #00ff88;
  color: #00ff88;
}

.customer-list-view {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 48px);
  padding: 12px 16px;
  overflow: hidden;
}

.cl-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.cl-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: #e0e0e0;
  margin: 0;
  white-space: nowrap;
}

.cl-stats {
  display: flex;
  gap: 12px;
}

.cl-stats span {
  font-size: 12px;
  color: #888;
  background: rgba(255,255,255,0.05);
  padding: 3px 10px;
  border-radius: 12px;
}

.cl-search {
  margin-left: auto;
  width: 240px;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  color: #e0e0e0;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.cl-search:focus {
  border-color: rgba(0, 255, 136, 0.4);
}

.cl-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
}

.cl-loading {
  text-align: center;
  color: #888;
  padding: 40px;
  font-size: 14px;
}

.cl-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  gap: 12px;
}

.cl-card:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(0, 255, 136, 0.2);
  transform: translateX(3px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

.cl-rank {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #666;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}

.cl-card:nth-child(1) .cl-rank { background: rgba(255,215,0,0.15); color: #ffd700; }
.cl-card:nth-child(2) .cl-rank { background: rgba(192,192,192,0.12); color: #c0c0c0; }
.cl-card:nth-child(3) .cl-rank { background: rgba(205,127,50,0.12); color: #cd7f32; }

.cl-card-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.cl-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.08);
}

.cl-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  font-size: 16px;
}

.cl-info {
  min-width: 0;
}

.cl-name {
  font-size: 13px;
  font-weight: 500;
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.cl-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 1px;
}

.cl-phone {
  font-size: 11px;
  color: #888;
  font-family: var(--font-mono);
}

.cl-source {
  font-size: 10px;
  color: #666;
  background: rgba(255,255,255,0.04);
  padding: 1px 6px;
  border-radius: 4px;
}

.cl-badge {
  font-size: 11px;
  margin-left: 4px;
}

.cl-card-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.cl-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 40px;
}

.cl-stat-val {
  font-size: 15px;
  font-weight: 700;
  color: #00ff88;
  font-family: var(--font-mono);
}

.cl-stat-order {
  color: var(--accent) !important;
}

.cl-stat-label {
  font-size: 9px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cl-revenue {
  font-size: 12px;
  font-weight: 600;
  color: #ffd700;
  background: rgba(255, 215, 0, 0.08);
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  font-family: var(--font-mono);
}

.cl-new {
  color: #00bfff;
}

/* ══════════════════════════════════════
   ADVANCED FILTER PANEL
   ══════════════════════════════════════ */
.adv-filter-panel {
  width: 370px;
}
.adv-filter-text-group {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 6px;
}
.adv-filter-text-group .fill-code-input {
  font-size: 13px; font-weight: 500;
  text-transform: none; text-align: left;
  letter-spacing: 0; padding: 8px 10px;
  color: var(--text-primary);
}
.adv-filter-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; border-radius: 8px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; padding: 0 4px;
  margin-left: 2px; margin-right: 2px;
  font-family: var(--font-mono);
  line-height: 1;
}
.adv-filter-checks {
  display: flex; flex-direction: column; gap: 2px;
  margin: 10px 0;
}
.adv-filter-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 6px;
  cursor: pointer; font-size: 13px;
  transition: background 0.15s;
  user-select: none;
}
.adv-filter-item:hover {
  background: rgba(255,255,255,0.06);
}
.adv-filter-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px; height: 16px; cursor: pointer;
  flex-shrink: 0;
}
.adv-filter-item span:first-of-type {
  flex: 1;
}
.adv-filter-count {
  font-size: 11px; font-family: var(--font-mono);
  color: var(--text-muted); font-weight: 600;
  min-width: 24px; text-align: right;
}
.adv-filter-actions {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.adv-filter-result {
  font-size: 12px; font-weight: 600;
  color: var(--success); font-family: var(--font-mono);
  margin-left: auto;
}

/* ── OPTIMISTIC ORDER TOGGLE ── */
.feed-row.optimistic-pending .feed-order-toggle {
  opacity: 0.6;
  pointer-events: none;
}
.feed-row.optimistic-pending .feed-order-lines {
  opacity: 0.5;
  animation: optimistic-pulse 0.8s ease-in-out infinite;
}
@keyframes optimistic-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.8; }
}

/* ── CUSTOMER PROFILE INLINE EDIT ── */
.cust-name-display, .cust-phone-display {
  cursor: pointer;
  transition: color 0.15s, text-decoration 0.15s;
}
.cust-name-display:hover, .cust-phone-display:hover {
  color: var(--accent);
  text-decoration: underline dashed var(--accent);
  text-underline-offset: 3px;
}
.cust-name-input {
  font-family: var(--font-sans);
  font-size: 15px; font-weight: 600;
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 2px 8px;
  outline: none;
  min-width: 120px; max-width: 280px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.cust-name-input:focus {
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.cust-phone-input-modal {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
  border: 1px dashed var(--accent);
  border-radius: 4px;
  padding: 2px 6px;
  outline: none;
  width: 130px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.cust-phone-input-modal:focus {
  border-style: solid;
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.btn-edit-inline {
  width: 22px !important; height: 22px !important;
  font-size: 11px !important;
  border: none !important;
  background: transparent !important;
  opacity: 0.4;
  transition: opacity 0.15s;
  cursor: pointer;
  padding: 0 !important;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-edit-inline:hover {
  opacity: 1;
}

/* ══════════════════════════════════════
   AUDIT MODAL (LO-38)
   ══════════════════════════════════════ */

/* Audit button on toolbar */
.btn-audit {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: #fff !important;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}
.btn-audit:hover {
  background: linear-gradient(135deg, #d97706, #b45309) !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(245,158,11,0.3);
}

/* Audit toolbar inside modal */
.audit-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
}
.audit-total {
  font-size: 13px;
  color: #f59e0b;
}
.audit-total strong { color: #fbbf24; }

/* Audit pills */
.audit-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.audit-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.audit-pill:hover { transform: translateY(-1px); }
.audit-pill-error {
  background: rgba(239,68,68,0.15);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.3);
}
.audit-pill-warning {
  background: rgba(245,158,11,0.15);
  color: #fbbf24;
  border: 1px solid rgba(245,158,11,0.3);
}
.audit-pill-count {
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}

/* Audit body */
.audit-body {
  max-height: 65vh;
  overflow-y: auto;
  padding: 12px 16px !important;
}

/* Audit groups */
.audit-group {
  margin-bottom: 12px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.audit-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
  user-select: none;
}
.audit-group-header:hover { filter: brightness(1.15); }
.audit-group-header-error {
  background: rgba(239,68,68,0.1);
  color: #f87171;
}
.audit-group-header-warning {
  background: rgba(245,158,11,0.1);
  color: #fbbf24;
}
.audit-group-toggle {
  font-size: 10px;
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}
.audit-group-label { flex: 1; }
.audit-group-count {
  background: rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}
.audit-group-body {
  padding: 4px 8px 8px;
}

/* Audit items */
.audit-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  margin: 4px 0;
  border-radius: 6px;
  border-left: 3px solid transparent;
  background: rgba(255,255,255,0.03);
  transition: background 0.15s;
}
.audit-item:hover { background: rgba(255,255,255,0.06); }
.audit-item-error { border-left-color: #ef4444; }
.audit-item-warning { border-left-color: #f59e0b; }

.audit-item-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.audit-item-customer {
  font-weight: 600;
  font-size: 13px;
  color: #e2e8f0;
}
.audit-item-phone {
  font-size: 12px;
  color: #94a3b8;
  font-family: var(--font-mono);
  background: rgba(255,255,255,0.06);
  padding: 1px 6px;
  border-radius: 4px;
}
.audit-item-detail {
  font-size: 12px;
  color: #94a3b8;
  flex-basis: 100%;
}

/* Audit field row (inline edits) */
.audit-field-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 4px;
}
.audit-field-row label {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
  white-space: nowrap;
}
.audit-field-val {
  font-size: 12px;
  font-weight: 600;
  color: #e2e8f0;
  font-family: var(--font-mono);
}
.audit-field-catalog {
  color: #34d399;
}
.audit-field-hint {
  font-size: 11px;
  color: #64748b;
}

.audit-input {
  width: 80px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: #e2e8f0;
  font-size: 12px;
  font-family: var(--font-mono);
  outline: none;
  transition: all 0.2s;
}
.audit-input:focus {
  border-color: #3b82f6;
  background: rgba(59,130,246,0.08);
}
.audit-input-wide { width: 180px; }

.audit-input.saved {
  border-color: #34d399 !important;
  background: rgba(52,211,153,0.15) !important;
  animation: auditSaveFlash 0.3s ease;
}
.audit-input.error {
  border-color: #ef4444 !important;
  background: rgba(239,68,68,0.15) !important;
}

@keyframes auditSaveFlash {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.btn-audit-save {
  padding: 3px 8px !important;
  font-size: 11px !important;
  background: rgba(59,130,246,0.2) !important;
  color: #93c5fd !important;
  border: 1px solid rgba(59,130,246,0.3) !important;
  border-radius: 4px !important;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-audit-save:hover {
  background: rgba(59,130,246,0.35) !important;
}

.btn-audit-fix {
  padding: 3px 8px !important;
  font-size: 11px !important;
  background: rgba(52,211,153,0.15) !important;
  color: #6ee7b7 !important;
  border: 1px solid rgba(52,211,153,0.3) !important;
  border-radius: 4px !important;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-audit-fix:hover {
  background: rgba(52,211,153,0.3) !important;
}

/* Clean state */
.audit-clean {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}
.audit-clean-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.audit-clean-title {
  font-size: 18px;
  font-weight: 700;
  color: #34d399;
  margin-bottom: 6px;
}
.audit-clean-sub {
  font-size: 13px;
  color: #94a3b8;
}

/* Price inconsistency badges */
.audit-prices-row {
  margin-top: 4px;
  gap: 6px;
  flex-wrap: wrap;
}
.audit-price-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.3);
}
.audit-price-badge.audit-price-current {
  background: rgba(59,130,246,0.2);
  color: #93c5fd;
  border-color: rgba(59,130,246,0.4);
}

/* High quantity breakdown */
.audit-hq-breakdown {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(245,158,11,0.06);
  border: 1px solid rgba(245,158,11,0.15);
}
.audit-hq-header {
  font-size: 11px;
  font-weight: 600;
  color: #fbbf24;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(245,158,11,0.15);
}
.audit-hq-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 6px;
  margin: 2px 0;
  border-radius: 4px;
  background: rgba(255,255,255,0.02);
  transition: background 0.15s;
}
.audit-hq-line:hover {
  background: rgba(255,255,255,0.06);
}
.audit-hq-current {
  background: rgba(59,130,246,0.08) !important;
  border-left: 2px solid #3b82f6;
  padding-left: 8px;
}
.audit-hq-comment {
  font-size: 11px;
  color: #cbd5e1;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audit-hq-qty-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.audit-hq-qty-group label {
  font-size: 10px;
  color: #94a3b8;
}
.audit-hq-qty-input {
  width: 50px !important;
  padding: 3px 6px !important;
  font-size: 11px !important;
}
