/* ==========================================================================
   SyncSale Hub — design system
   Tokens → base → layout (nav, topbar, sheet) → components → screens → responsive
   ========================================================================== */

:root {
  /* Surfaces & text */
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-alt: #f7f9fc;
  --surface-sunken: #eef1f6;
  --border: #e2e7ef;
  --border-strong: #cfd6e2;
  --text: #13233a;
  --muted: #64748b;
  --subtle: #94a3b8;
  --ink: #021d35;

  /* Brand — Syncthesys logo: navy wordmark, blue → sky → green mark */
  --primary: #0a55e0;
  --primary-hover: #0844b4;
  --primary-soft: #eef4ff;
  --primary-border: #c7dafd;
  --primary-deep: #063a9e;
  --primary-ring: rgba(10, 85, 224, 0.18);
  --primary-shadow: rgba(10, 85, 224, 0.28);
  --brand-sky: #00a0f0;
  --brand-green: #00c890;
  --brand-gradient: linear-gradient(135deg, #0a55e0 0%, #00a0f0 55%, #00c890 100%);

  /* Semantic */
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --info: #2563eb;
  --info-soft: #eff6ff;
  --violet: #7c3aed;
  --violet-soft: #f5f3ff;

  /* Channels */
  --fb: #1877f2;
  --viber: #7360f2;
  --tg: #0ea5e9;
  --tiktok: #111827;

  /* Shape & depth */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(2, 29, 53, 0.05);
  --shadow-md: 0 8px 28px rgba(2, 29, 53, 0.08);
  --shadow-lg: 0 20px 50px rgba(2, 29, 53, 0.18);

  --nav-width: 228px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Myanmar", "Myanmar Text", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.subtitle { margin: 4px 0 0; font-size: 13px; color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); }
small { color: var(--muted); }
code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  background: var(--surface-sunken);
  padding: 1px 6px;
  border-radius: 5px;
}

/* Keyboard focus is always visible; mouse clicks stay clean */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
button:focus:not(:focus-visible) { outline: none; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #94a3b8; }

/* ==========================================================================
   App shell
   ========================================================================== */
.app-shell { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

.left-nav {
  width: var(--nav-width);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.2s var(--ease), transform 0.25s var(--ease);
  z-index: 40;
  padding: 6px 0;
}
.left-nav.collapsed { width: 70px; }
.left-nav.collapsed .nav-label,
.left-nav.collapsed .brand-title,
.left-nav.collapsed .nav-count { display: none; }
.left-nav.collapsed .left-nav-header { justify-content: center; padding: 0 10px; flex-direction: column; gap: 8px; height: auto; padding-top: 10px; }
.left-nav.collapsed .nav-collapse-btn svg { transform: rotate(180deg); }
.left-nav.collapsed .nav-tab { justify-content: center; padding: 4px; }

.left-nav-header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 16px;
}
.brand { display: flex; align-items: center; gap: 10px; overflow: hidden; }
.brand-logo {
  width: 32px; height: 32px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.brand-logo img { height: 30px; width: auto; display: block; }
.brand-title { font-size: 15px; font-weight: 700; color: var(--ink); white-space: nowrap; letter-spacing: -0.02em; }

.nav-collapse-btn {
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; box-shadow: var(--shadow-sm);
  transition: color 0.15s, border-color 0.15s;
}
.nav-collapse-btn:hover { color: var(--ink); border-color: var(--border-strong); }
.nav-collapse-btn svg { transition: transform 0.2s var(--ease); }

.nav-section-title { font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; color: var(--subtle); padding: 14px 20px 4px; }

.nav-tabs { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; flex: 1; overflow-y: auto; }
.nav-tab {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: transparent; border: none; padding: 4px 8px; border-radius: 12px;
  cursor: pointer; font: inherit; font-weight: 500; font-size: 13.5px; color: #475569;
  text-align: left; white-space: nowrap; transition: background 0.15s, color 0.15s;
}
.nav-icon-wrap {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: #334155; transition: all 0.15s;
}
.nav-tab:hover { color: var(--ink); background: rgba(255, 255, 255, 0.6); }
.nav-tab:hover .nav-icon-wrap { border-color: var(--border-strong); color: var(--ink); }
.nav-tab.active { color: var(--primary); font-weight: 600; background: var(--surface); box-shadow: var(--shadow-sm); }
.nav-tab.active .nav-icon-wrap {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 3px 10px var(--primary-shadow);
}
.nav-count {
  margin-left: auto; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
}
.nav-icon { flex-shrink: 0; }
.left-nav-footer { padding: 10px; }
.nav-logout:hover { color: var(--primary); }
.nav-logout:hover .nav-icon-wrap { border-color: var(--primary-border); background: var(--primary-soft); color: var(--primary); }

.nav-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(2, 29, 53, 0.4); z-index: 35;
}

.main-workspace {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
  height: 100vh; height: 100dvh; overflow: hidden; padding: 10px 14px 14px 4px;
}

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 8px 10px; min-height: 50px; flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.page-title { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); white-space: nowrap; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.topbar .btn-mobile-nav { display: none; }

.user-menu { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 12px 4px 4px; font: inherit; font-size: 12.5px; color: var(--ink);
  transition: border-color 0.15s;
}
.user-chip:hover { border-color: var(--border-strong); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
}
.user-chip-text { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.user-chip-text strong { font-size: 12.5px; }
.user-chip-text span { font-size: 11px; color: var(--muted); }
.menu-popover {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px;
}
.menu-item {
  display: flex; width: 100%; align-items: center; gap: 8px; padding: 8px 10px; border: none;
  background: none; border-radius: 8px; font: inherit; font-size: 13px; color: var(--text); cursor: pointer; text-align: left;
}
.menu-item:hover { background: var(--surface-alt); }
.menu-item.danger { color: var(--danger); }

.workspace-sheet {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: 22px; box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; overflow: hidden; min-height: 0;
}
/* Before the first screen is chosen (no hash, session still loading): a quiet placeholder, not a wrong page */
.workspace-sheet:not(:has(.tab-panel.active))::before {
  content: "Loading…"; margin: auto; color: var(--subtle); font-size: 13px;
}

/* ==========================================================================
   Buttons & form controls
   ========================================================================== */
.btn {
  padding: 8px 14px; border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 13px; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-busy="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #fff; border-radius: 999px; padding: 8px 18px; }
.btn-primary:hover { background: #0b2a4a; }
.btn-brand { background: var(--primary); color: #fff; border-radius: 999px; padding: 8px 18px; }
.btn-brand:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--surface-alt); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }
.btn-danger { background: var(--surface); border-color: #fecaca; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-danger-solid { background: var(--danger); color: #fff; border-radius: 999px; padding: 8px 18px; }
.btn-danger-solid:hover { background: #b91c1c; }
.btn-xs { padding: 4px 10px; font-size: 12px; border-radius: 8px; font-weight: 500; }
.btn-icon {
  background: none; border: none; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1;
  width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon:hover { color: var(--text); background: var(--surface-alt); }
.btn-icon-sq {
  width: 34px; height: 34px; padding: 0; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
}

input, select, textarea { font: inherit; color: var(--text); transition: border-color 0.15s, box-shadow 0.15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
input[type="checkbox"] { accent-color: var(--primary); width: 15px; height: 15px; }
input::placeholder, textarea::placeholder { color: var(--subtle); }

.stack-form input, .stack-form select, .stack-form textarea,
.inline-form input, .inline-form select, .select-sm, .field-input {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; background: var(--surface); min-width: 0;
}
.select-sm { padding: 7px 28px 7px 10px; }
.stack-form { display: flex; flex-direction: column; gap: 12px; }
.stack-form label, .field {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12px; font-weight: 600; color: #334155;
}
.stack-form textarea { resize: vertical; min-height: 60px; }
.field-hint { font-size: 11.5px; font-weight: 400; color: var(--muted); }

.form-card { padding: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; align-items: end; }
.form-grid .field input, .form-grid .field select { width: 100%; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.inline-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; cursor: pointer; }

/* Toggle switch (checkbox with .switch) */
input[type="checkbox"].switch {
  appearance: none; -webkit-appearance: none; margin: 0; width: 34px; height: 20px; border-radius: 999px;
  background: #d4d4d8; position: relative; cursor: pointer; transition: background 0.15s; flex-shrink: 0; vertical-align: middle;
}
input[type="checkbox"].switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform 0.15s var(--ease); }
input[type="checkbox"].switch:checked { background: var(--success); }
input[type="checkbox"].switch:checked::after { transform: translateX(14px); }
input[type="checkbox"].switch:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==========================================================================
   Page panels, sections, cards, tables
   ========================================================================== */
.tab-panel { display: none; flex: 1; overflow: hidden; min-height: 0; }
.tab-panel.active { display: flex; }
.tab-panel.page-pad.active { display: block; padding: 24px; overflow-y: auto; width: 100%; }
.page-pad > * { max-width: 1400px; margin-left: auto; margin-right: auto; }

.section-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-header h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.section-gap { margin-top: 28px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.card h3 { margin: 0 0 12px 0; font-size: 14px; font-weight: 700; }
.card-header-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-header-row h3 { margin: 0; }
.meta-row { font-size: 13px; margin: 4px 0; }

.table-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow-x: auto; box-shadow: var(--shadow-sm);
}
.table-wrap.flush { border: none; box-shadow: none; border-radius: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table th {
  background: var(--surface-alt); font-weight: 600; color: var(--muted); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; position: sticky; top: 0;
}
.data-table tbody tr { transition: background 0.1s; }
.data-table tbody tr:hover { background: #fafafb; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-stack { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.cell-stack code { white-space: nowrap; }
.cell-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.nowrap { white-space: nowrap; }

.empty-state { padding: 40px 24px; text-align: center; color: var(--muted); font-size: 13.5px; }
.empty-state .empty-icon {
  width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 12px; background: var(--surface-sunken);
  display: flex; align-items: center; justify-content: center; color: var(--subtle);
}
.empty-state strong { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }
.table-empty td { text-align: center; color: var(--muted); padding: 32px 16px; }

/* Skeleton loading rows */
.skeleton { position: relative; overflow: hidden; background: var(--surface-sunken); border-radius: 6px; height: 12px; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ==========================================================================
   Badges & pills
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 6px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #fff; white-space: nowrap;
}
.badge-facebook { background: var(--fb); }
.badge-viber { background: var(--viber); }
.badge-telegram { background: var(--tg); }
.badge-tiktok { background: var(--tiktok); }
.badge-website { background: #0d9488; }
.badge-api { background: #4f46e5; }
.badge-phone { background: #0f766e; }
.badge-other { background: #64748b; }
.badge-all { background: #475569; }

.status-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; border: 1px solid transparent;
}
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-pending, .st-pending_payment, .st-unpaid, .st-pending_verification, .st-cod_pending, .st-waiting_handover { background: var(--warning-soft); color: var(--warning); border-color: #fde68a; }
.st-paid, .st-packing, .st-packed { background: var(--info-soft); color: var(--info); border-color: #bfdbfe; }
.st-shipped { background: var(--violet-soft); color: var(--violet); border-color: #ddd6fe; }
.st-delivered, .st-open, .st-active, .st-confirmed, .st-completed, .st-verified, .st-cod_collected, .st-dispatched { background: var(--success-soft); color: var(--success); border-color: #a7f3d0; }
.st-cancelled, .st-resolved, .st-paused { background: var(--surface-sunken); color: var(--muted); border-color: var(--border); }
.st-snoozed { background: #f0f9ff; color: #0369a1; border-color: #bae6fd; }
.st-failed, .st-returned, .st-refunded { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }

.unread-dot {
  background: var(--primary); color: #fff; border-radius: 999px; min-width: 18px; height: 18px;
  padding: 0 5px; font-size: 10.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.tag-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11px; color: #fff; font-weight: 600; }
.tag-pill .tag-x { background: none; border: none; color: inherit; cursor: pointer; padding: 0; font-size: 13px; line-height: 1; opacity: 0.8; }
.tag-pill .tag-x:hover { opacity: 1; }
.role-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; background: var(--surface-sunken); color: var(--muted); margin-left: 6px; font-weight: 500; }
.risk-badge {
  display: inline-flex; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
}
.risk-vip { background: #fef3c7; color: #92400e; }
.risk-cod_risk { background: #ffedd5; color: #9a3412; }
.risk-blacklisted { background: #fee2e2; color: #991b1b; }

/* Segmented filter chips */
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filter-pill {
  border: 1px solid var(--border); background: var(--surface); padding: 5px 12px; border-radius: 999px;
  font: inherit; font-size: 12.5px; font-weight: 500; color: var(--muted); cursor: pointer;
  transition: all 0.15s; display: inline-flex; align-items: center; gap: 6px;
}
.filter-pill:hover { border-color: var(--border-strong); color: var(--text); }
.filter-pill.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.filter-pill .pill-count { font-size: 11px; opacity: 0.75; }

/* ==========================================================================
   Inbox
   ========================================================================== */
.inbox-layout.active { display: grid; grid-template-columns: 200px 310px minmax(0, 1fr) 340px; height: 100%; }

/* Inbox views sidebar: All / Mine / Unassigned / Needs reply, teams, tags, each with a count */
.inbox-nav { background: var(--surface-alt); border-right: 1px solid var(--border); overflow-y: auto; padding: 10px 8px 16px; min-width: 0; }
.inbox-nav-title { display: flex; align-items: center; justify-content: space-between; font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--subtle); padding: 12px 10px 4px; }
.inbox-nav-title:first-child { padding-top: 2px; }
.inbox-view {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; font: inherit; font-size: 13px;
  color: #334155; padding: 6px 10px; border-radius: 8px; cursor: pointer; text-align: left;
}
.inbox-view:hover { background: var(--surface); color: var(--ink); }
.inbox-view.active { background: var(--primary-soft); color: var(--primary-deep); font-weight: 600; }
.inbox-view .iv-icon { width: 18px; text-align: center; flex: none; font-size: 13px; }
.inbox-view .iv-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-view .iv-count { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.inbox-view.active .iv-count { color: var(--primary-deep); }
.inbox-view .iv-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin: 0 5px; }
.inbox-view.waiting .iv-count { background: var(--danger-soft); color: var(--danger); border-radius: 999px; padding: 0 6px; font-weight: 700; }
.inbox-view.waiting .iv-count:empty, .inbox-view.waiting .iv-count.zero { background: none; color: var(--muted); font-weight: 400; }
.view-select { display: none; }

/* Who wrote last: ↙ the customer, ↗ us */
.conv-dir { display: inline-flex; vertical-align: -1px; margin-right: 4px; }
.conv-dir.in { color: var(--danger); }
.conv-dir.out { color: var(--subtle); }
/* Chat header: Resolve, ⋯ menu */
.btn-resolve.is-resolved { color: var(--success); border-color: #a7f3d0; background: var(--success-soft); }
.menu-wrap { position: relative; }
.pop-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 200px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md); padding: 6px; display: grid;
}
.pop-menu button { border: 0; background: none; font: inherit; font-size: 13px; text-align: left; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text); }
.pop-menu button:hover, .pop-menu button:focus-visible { background: var(--surface-sunken); }
.pop-menu button:disabled { color: var(--subtle); cursor: default; background: none; }

/* Order detail drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(2, 29, 53, 0.35); z-index: 75; }
.side-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(540px, 100vw); z-index: 80; background: var(--surface);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); border-left: 1px solid var(--border);
  animation: drawerIn 0.22s var(--ease);
}
@keyframes drawerIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--border); }
.drawer-head h3 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.od-sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 18px 20px; display: grid; gap: 14px; align-content: start; }
.drawer-foot { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-alt); }
.drawer-foot:empty { display: none; }
.od-section { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.od-section h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.od-kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 10px; font-size: 13px; margin: 0; }
.od-kv dt { color: var(--muted); }
.od-kv dd { margin: 0; word-break: break-word; }
.od-items { width: 100%; border-collapse: collapse; font-size: 13px; }
.od-items td, .od-items th { padding: 6px 0; border-bottom: 1px solid var(--border); text-align: left; }
.od-items th { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.od-items .num { text-align: right; font-variant-numeric: tabular-nums; }
.od-totals { display: grid; gap: 4px; margin-top: 8px; font-size: 13px; }
.od-totals div { display: flex; justify-content: space-between; }
.od-totals .grand { font-size: 15px; font-weight: 800; color: var(--ink); border-top: 1px solid var(--border); padding-top: 6px; margin-top: 2px; }
.od-slip { display: block; margin-top: 8px; max-width: 100%; max-height: 260px; border-radius: 10px; border: 1px solid var(--border); object-fit: contain; background: var(--surface-alt); }
.od-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 12.5px; }
.od-history li { display: grid; grid-template-columns: 10px 1fr; gap: 8px; }
.od-history li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 5px; }
.od-history small { color: var(--muted); }
#orders-tbody tr[data-order] { cursor: pointer; }
.order-code-link { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--primary-deep); cursor: pointer; text-align: left; }
.order-code-link:hover { text-decoration: underline; }
.mini-order { cursor: pointer; }
@media (max-width: 600px) {
  .side-drawer { width: 100vw; border-left: 0; }
  .od-kv { grid-template-columns: 96px minmax(0, 1fr); }
}

/* Quick replies list (Automation page) */
.quick-shortcut { font-size: 11.5px; color: var(--primary-deep); background: var(--primary-soft); padding: 1px 6px; border-radius: 6px; width: fit-content; }
.quick-body { white-space: pre-wrap; color: #334155; max-width: 560px; }
#ui-dialog-fields textarea { width: 100%; font: inherit; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; resize: vertical; }

/* Under the customer's last message: "✓ Mark as seen" / "✓ Seen · no reply needed · Undo" */
.seen-row { align-self: flex-start; display: flex; align-items: center; gap: 8px; margin: -2px 0 4px 4px; font-size: 11.5px; }
.seen-action, .seen-undo { border: 0; background: none; font: inherit; padding: 2px 4px; cursor: pointer; border-radius: 6px; }
.seen-action { color: var(--primary); font-weight: 600; }
.seen-action:hover, .seen-undo:hover { background: var(--primary-soft); }
.seen-done { color: var(--success); font-weight: 600; }
.seen-undo { color: var(--muted); text-decoration: underline; }

/* Things that happened in the chat (assigned, status, order…) between the messages */
.timeline-event { align-self: center; max-width: 80%; text-align: center; font-size: 11.5px; color: var(--muted); padding: 2px 10px; margin: 2px 0; }
.timeline-event strong { color: #334155; font-weight: 600; }

/* Narrower screens: the views move from the sidebar into a dropdown above the list */
@media (max-width: 1100px) {
  .inbox-nav { display: none; }
  .view-select { display: block; flex: 1 1 100%; }
}

.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.sidebar-search { padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 8px; }
.search-field { position: relative; }
.search-field svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--subtle); pointer-events: none; }
.search-field input {
  width: 100%; padding: 9px 12px 9px 32px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 13px; background: var(--surface-alt);
}
.search-field input:focus { background: var(--surface); }
.sidebar-subfilters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sidebar-subfilters .select-sm { flex: 1 1 110px; min-width: 0; }
.mine-toggle, .note-toggle { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--muted); cursor: pointer; white-space: nowrap; }

.inbox-tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--border); }
.inbox-tab {
  border: none; background: none; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted);
  padding: 8px 10px; border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px;
}
.inbox-tab:hover { color: var(--text); }
.inbox-tab.active { color: var(--ink); border-bottom-color: var(--primary); }

/* Tabs inside a page (Users & Teams) */
.page-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.page-tab {
  border: none; background: none; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted);
  padding: 10px 14px; border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px;
}
.page-tab:hover { color: var(--text); }
.page-tab.active { color: var(--ink); border-bottom-color: var(--primary); }

.channel-filters { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.channel-filters::-webkit-scrollbar { display: none; }

.conversation-list { overflow-y: auto; flex: 1; }
.conv-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.12s;
  position: relative; width: 100%; text-align: left; background: none; border-left: 3px solid transparent; font: inherit; color: inherit;
}
.conv-item:hover { background: var(--surface-alt); }
.conv-item.active { background: var(--primary-soft); border-left-color: var(--primary); }
.conv-item.unread .conv-name { font-weight: 700; }
.conv-item.unread .conv-preview { color: var(--text); }

.conv-avatar {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; position: relative;
}
.conv-avatar .avatar-channel {
  position: absolute; right: -2px; bottom: -2px; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--surface); display: block;
}
.avatar-facebook { background: var(--fb); }
.avatar-viber { background: var(--viber); }
.avatar-telegram { background: var(--tg); }
.avatar-tiktok { background: var(--tiktok); }
.avatar-neutral { background: #475569; }

.conv-body { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; gap: 6px; }
.conv-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: 11px; color: var(--subtle); white-space: nowrap; flex-shrink: 0; }
.conv-preview { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { display: flex; gap: 6px; align-items: center; margin-top: 6px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.conv-meta .assignee { display: inline-flex; align-items: center; gap: 4px; }

/* Chat pane */
.chat-pane { display: flex; flex-direction: column; background: #fafafb; overflow: hidden; min-width: 0; }
.chat-active { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
/* Row 1: who (left) and what to do with the chat (right), always on one line */
.chat-title-row { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: nowrap; }
.chat-title { flex: 1 1 auto; min-width: 0; }
.chat-title h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title-row > .conv-avatar { flex-shrink: 0; }
.chat-title h2 { margin: 0; font-size: 15.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-subline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 3px; font-size: 12px; color: var(--muted); }
.chat-title-actions { display: flex; align-items: center; gap: 6px; flex: none; flex-wrap: nowrap; margin-left: auto; }
.chat-title-actions .select-sm { height: 34px; padding-top: 0; padding-bottom: 0; min-width: 130px; }
.chat-title-actions .btn { height: 34px; }
/* Row 2: assignee, team, tag and search as equal boxes, each with its label inside */
.chat-pane { container-type: inline-size; container-name: chatpane; }
.chat-toolbar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; align-items: center; }
.toolbar-field {
  display: flex; align-items: center; gap: 2px; min-width: 0; height: 36px; padding: 0 2px 0 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  font-size: 11.5px; color: var(--muted); font-weight: 600; white-space: nowrap;
}
.toolbar-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.toolbar-field .select-sm {
  flex: 1; min-width: 0; max-width: none; height: 34px; border: 0; background-color: transparent; box-shadow: none;
  padding: 0 26px 0 6px; font-size: 13px; color: var(--text); text-overflow: ellipsis;
}
.toolbar-field .select-sm:focus { outline: none; box-shadow: none; }
.chat-toolbar .search-field { margin-left: 0; min-width: 0; }
.chat-toolbar .search-field input { width: 100%; height: 36px; padding-top: 0; padding-bottom: 0; }
/* Narrow chat pane (customer panel open on a laptop): two columns */
@container chatpane (max-width: 780px) {
  .chat-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-title-actions .select-sm { min-width: 0; max-width: 130px; }
}
.tags-bar { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.chat-toolbar .mobile-only { display: none; }
.chat-header .btn-back, .chat-header .btn-context-toggle, .chat-header .btn-chat-tools { display: none; }

.message-list { flex: 1; padding: 20px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.day-divider { align-self: center; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; margin: 10px 0 6px; }

.msg {
  max-width: min(72%, 560px); padding: 9px 13px; border-radius: 16px; font-size: 13.5px; line-height: 1.5;
  box-shadow: var(--shadow-sm); overflow-wrap: anywhere;
}
.msg-body { white-space: pre-wrap; }
.msg-inbound { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.msg-outbound { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 5px; }
.msg-system { align-self: flex-end; background: var(--surface-sunken); color: #334155; border: 1px dashed var(--border-strong); border-bottom-right-radius: 5px; box-shadow: none; }
.msg-internal { align-self: center; background: #fefce8; color: #713f12; border: 1px dashed #facc15; max-width: min(85%, 620px); border-radius: 12px; }
.msg-failed { border: 1px solid #fca5a5 !important; }
.msg-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.7; margin-bottom: 2px; }
.msg-meta { font-size: 10.5px; opacity: 0.65; margin-top: 4px; display: flex; gap: 6px; align-items: center; }
.msg-outbound .msg-meta { justify-content: flex-end; }
.msg-attachment { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 12px; color: inherit; text-decoration: underline; }
.msg-image-link { display: block; margin: -3px -7px 6px; }
.msg-image { display: block; max-width: 100%; max-height: 280px; border-radius: 12px; object-fit: cover; background: var(--surface-sunken); }
.msg-status-failed { color: #fca5a5; font-weight: 700; }
.msg-system .msg-status-failed, .msg-inbound .msg-status-failed { color: var(--danger); }
.msg-highlight { background: #fef08a; color: inherit; border-radius: 3px; }

/* Composer */
.composer-wrap { background: var(--surface); border-top: 1px solid var(--border); padding: 0 12px 12px; transition: background 0.15s; }
.composer-wrap.note-mode { background: #fefce8; border-top-color: #fde047; }
.composer-tabs { display: flex; align-items: center; gap: 2px; padding: 6px 4px 0; }
.composer-tab {
  background: transparent; border: none; border-bottom: 2px solid transparent; padding: 6px 10px;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.composer-tab.active { color: var(--ink); border-bottom-color: var(--primary); }
.composer-wrap.note-mode .composer-tab.active { color: #854d0e; border-bottom-color: #eab308; }
.composer-tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
/* Attachments: hidden while writing a private note (notes can't carry files) */
.composer-wrap { position: relative; }
.composer-wrap.note-mode .reply-only, .composer-wrap.note-mode .attach-preview, .composer-wrap.note-mode .media-url-row { display: none; }
.attach-preview { padding: 8px 0 0; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%; padding: 6px 6px 6px 6px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface-sunken);
}
.attach-chip img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface); }
.attach-chip.is-uploading img, .attach-chip.is-uploading .attach-icon { opacity: 0.5; }
.attach-icon { width: 48px; height: 48px; display: grid; place-items: center; font-size: 22px; border-radius: 8px; background: var(--surface); flex: none; }
.attach-text { display: flex; flex-direction: column; min-width: 0; }
.attach-name { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.attach-size { font-size: 11.5px; color: var(--muted); }
.attach-remove {
  flex: none; width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 13px;
}
.attach-remove:hover { background: var(--surface); color: var(--danger); }
.drop-hint {
  display: none; position: absolute; inset: 4px; z-index: 5; place-items: center; border: 2px dashed var(--primary);
  border-radius: 14px; background: rgba(10, 85, 224, 0.08); color: var(--primary); font-weight: 700; font-size: 13px; pointer-events: none;
}
.composer-wrap.is-dragging:not(.note-mode) .drop-hint { display: grid; }
.media-url-row { padding: 8px 0 0; }
.media-url-row input { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12.5px; }
.composer-box {
  margin-top: 8px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 12px; transition: border-color 0.15s, box-shadow 0.15s;
}
.composer-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.composer-wrap.note-mode .composer-box:focus-within { border-color: #eab308; box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.2); }
.composer-box textarea {
  flex: 1; border: none; resize: none; font-size: 13.5px; line-height: 1.45; padding: 6px 0;
  max-height: 160px; min-height: 22px; background: transparent;
}
.composer-box textarea:focus { box-shadow: none; }
.composer-hint { font-size: 11px; color: var(--subtle); margin-top: 6px; padding-left: 4px; }
.reply-form { display: block; }

/* Context pane */
.context-pane { background: var(--surface); border-left: 1px solid var(--border); padding: 16px; overflow-y: auto; min-width: 0; }
.context-header { display: none; }
.customer-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.customer-head .conv-avatar { width: 44px; height: 44px; font-size: 15px; }
.customer-head h3 { margin: 0; font-size: 15px; }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 6px 10px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.linked-channels { display: flex; gap: 6px; flex-wrap: wrap; }
.history-list { display: flex; flex-direction: column; gap: 6px; }
.history-item {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%;
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  font: inherit; font-size: 12px; cursor: pointer; text-align: left;
}
.history-item:hover { border-color: var(--border-strong); background: var(--surface-alt); }
.history-item .preview { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.mini-orders { display: flex; flex-direction: column; gap: 6px; }
.mini-order { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.mini-order:last-child { border-bottom: none; }

.cart-add-row { display: grid; grid-template-columns: minmax(0, 1fr) 84px 58px auto; gap: 6px; align-items: center; }
.cart-add-row input { width: 100%; }
.cart-items-list { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.cart-item-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--surface-alt); padding: 7px 8px 7px 10px; border-radius: 10px; border: 1px solid var(--border);
}
.cart-item-row .btn-icon { width: 24px; height: 24px; font-size: 16px; }
.cart-fees-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cart-fees-row input { width: 100%; }
.cart-summary { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; font-size: 12.5px; display: grid; gap: 4px; }
.cart-summary .row { display: flex; justify-content: space-between; color: var(--muted); }
.cart-summary .row.total { color: var(--ink); font-weight: 700; font-size: 14px; padding-top: 6px; margin-top: 2px; border-top: 1px solid var(--border); }
.cart-empty { font-size: 12px; color: var(--subtle); text-align: center; padding: 8px; border: 1px dashed var(--border); border-radius: 10px; }

/* ==========================================================================
   Dashboard & analytics
   ========================================================================== */
.kpi-grid, .dash-hero-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-card, .dash-hero-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px; box-shadow: var(--shadow-sm);
}
.kpi-card:first-child, .dash-hero-card.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.kpi-card:first-child .kpi-label, .dash-hero-card.dark .kpi-label { color: #94a3b8; }
.kpi-card:nth-child(2), .dash-hero-card.rose { background: var(--brand-gradient); color: #fff; border-color: var(--primary); }
.kpi-card:nth-child(2) .kpi-label, .dash-hero-card.rose .kpi-label { color: #e0ecff; }
.kpi-label { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.kpi-value { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dash-big-num { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.dash-big-num small { font-size: 13px; font-weight: 600; opacity: 0.7; }
.dash-sub { font-size: 12px; opacity: 0.8; }

.share-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-sunken); margin: 10px 0; gap: 2px; }
.share-seg { height: 100%; transition: width 0.3s var(--ease); }
.share-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }

.dash-two-col, .analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 16px; }
.dash-two-col .card, .analytics-grid .card { overflow-x: auto; }

/* ==========================================================================
   Channels
   ========================================================================== */
.channel-cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 20px; }
.channel-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px;
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px;
}
.channel-card-head { display: flex; justify-content: space-between; align-items: center; }
.channel-card-title { font-weight: 700; font-size: 14.5px; }
.channel-card .subtitle { margin: 0; flex: 1; }
.channel-count-pill {
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-alt); border: 1px solid var(--border); color: var(--muted);
}
.channel-count-pill.connected { background: var(--success-soft); border-color: #a7f3d0; color: #047857; }
.webhook-box {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; padding: 6px 6px 6px 10px;
  font-size: 11px; color: var(--muted);
}
.webhook-box code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; padding: 0; }
/* Roles */
.role-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.role-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px;
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px;
}
.role-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.role-card-name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.role-card .subtitle { margin: 0; flex: 1; font-size: 12.5px; }
.role-card-stats { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.role-card-stats strong { color: var(--ink); font-size: 13px; }
.role-perm-bar { height: 6px; border-radius: 99px; background: var(--surface-alt); overflow: hidden; }
.role-perm-bar span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.role-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; }
.role-card-foot .inline-check { font-size: 12px; }
.modal-card.role-editor { width: 760px; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.role-editor .modal-header { padding: 20px 22px 0; }
.role-editor-body { padding: 0 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.role-editor .modal-footer { padding: 14px 22px 18px; border-top: 1px solid var(--border); margin-top: 0; }
.role-editor-fields { margin: 0; }
.role-perm-toolbar {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  border-top: 1px solid var(--border); padding-top: 14px;
}
.role-perm-toolbar .field-hint { margin-left: 6px; }
.role-perm-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.role-perm-actions select { height: 32px; padding: 0 10px; font-size: 12.5px; width: auto; }
.role-perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; padding-bottom: 16px; }
.perm-group { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.perm-group-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.perm-group-head strong { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.perm-item { display: flex !important; gap: 10px; align-items: flex-start; padding: 6px 4px; border-radius: 8px; cursor: pointer; font-weight: 500; font-size: 13px; }
.perm-item:hover { background: var(--surface-alt); }
.perm-item input { margin-top: 2px; }
.perm-item small { display: block; color: var(--muted); font-weight: 400; font-family: monospace; font-size: 11px; }
.perm-item.locked { opacity: .55; cursor: not-allowed; }
.role-editor-error { color: var(--danger); font-size: 13px; min-height: 0; margin: 0 22px; }
.role-editor-error:not(:empty) { margin-top: 8px; }
.channel-how { margin: 0; font-size: 12.5px; color: #475569; line-height: 1.45; }
.webhook-label { font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: -4px; }
.channel-card-actions { display: flex; margin-top: auto; }
.channel-card-actions .btn { flex: 1; justify-content: center; }
.btn.btn-fb { background: #1877f2; border-color: #1877f2; color: #fff; gap: 8px; }
.btn.btn-fb:hover { background: #166fe5; }
.fb-glyph {
  display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; color: #1877f2; font: 800 13px/1 Arial, sans-serif; padding-top: 3px;
}
/* Token boxes: text inputs drawn as dots, so password managers never autofill logins into them */
.secret-input { -webkit-text-security: disc; text-security: disc; font-family: monospace; }
.manual-connect { padding: 0; }
.manual-connect > summary {
  cursor: pointer; padding: 16px 20px; font-weight: 600; font-size: 13.5px; color: #334155; list-style: none;
}
.manual-connect > summary::-webkit-details-marker { display: none; }
.manual-connect > summary::before { content: '▸'; display: inline-block; margin-right: 8px; transition: transform .15s; }
.manual-connect[open] > summary::before { transform: rotate(90deg); }
.manual-connect > form { padding: 0 20px 20px; }
.check-list { display: grid; gap: 6px; max-height: 300px; overflow: auto; margin-top: 6px; }
.check-row {
  display: flex !important; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 10px; font-weight: 500; cursor: pointer;
}
.check-row:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }

/* Broadcasts */
.broadcast-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.broadcast-preview { position: sticky; top: 0; }
.status-fieldset { border: none; padding: 0; margin: 14px 0 0; display: flex; gap: 16px; flex-wrap: wrap; }
.status-fieldset legend { font-size: 12px; font-weight: 600; color: #334155; margin-bottom: 8px; padding: 0; }
.audience-box { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface-alt); }
.audience-big { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.audience-lines { display: grid; gap: 3px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.preview-bubble { max-width: 100%; margin-left: auto; }
.preview-img { display: block; max-width: 100%; max-height: 220px; border-radius: 10px; margin-bottom: 6px; object-fit: cover; }

/* Campaigns: list, editor, report */
.camp-filter { margin: 4px 0 12px; }
.camp-back { font-size: 12.5px; margin-bottom: 4px; }
.camp-actions { flex-wrap: wrap; gap: 8px; }
.camp-row { cursor: pointer; }
.camp-row:hover td { background: var(--surface-alt); }
.camp-sub { color: var(--muted); font-size: 12px; }
.st-draft { background: var(--surface-sunken); color: #334155; border-color: var(--border); }
.st-scheduled { background: var(--primary-soft); color: var(--primary-deep); border-color: var(--primary-border); }
.st-sending { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.st-sent { background: var(--success-soft); color: var(--success); border-color: #a7f3d0; }
.st-skipped { background: var(--surface-sunken); color: var(--muted); border-color: var(--border); }
.camp-report-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.camp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.camp-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.camp-stat .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.camp-stat .value { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); margin-top: 4px; }
.camp-stat .hint { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.camp-stat.hero { background: var(--brand-gradient); border-color: transparent; }
.camp-stat.hero .label, .camp-stat.hero .hint { color: rgba(255, 255, 255, 0.85); }
.camp-stat.hero .value { color: #fff; }
.camp-progress { height: 6px; border-radius: 6px; background: var(--surface-sunken); overflow: hidden; margin-top: 8px; }
.camp-progress span { display: block; height: 100%; background: var(--brand-gradient); }
.camp-report-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.camp-report-grid > .card { padding: 16px; }
.camp-recipient-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.camp-recipient-head h3 { margin: 0; }
.camp-report-meta { display: grid; gap: 6px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.camp-report-meta strong { color: var(--text); font-weight: 600; }
.camp-err { display: block; color: var(--danger); font-size: 11.5px; max-width: 260px; }
@media (max-width: 900px) {
  .camp-report-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .broadcast-layout { grid-template-columns: 1fr; }
  .broadcast-preview { position: static; }
}

/* Automation */
.rule-advanced { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 12px; }
.rule-advanced summary { cursor: pointer; font-size: 13px; font-weight: 600; color: #334155; }
.kw-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.kw-chip { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--surface-sunken); border: 1px solid var(--border); color: var(--text); }
.rule-meta { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.rule-test-result { margin-top: 12px; padding: 12px 14px; border-radius: 12px; font-size: 13px; }
.rule-test-result.hit { background: var(--success-soft); border: 1px solid #a7f3d0; }
.rule-test-result.miss { background: var(--surface-alt); border: 1px solid var(--border); color: var(--muted); }
@media (max-width: 900px) { #rule-test-form { grid-template-columns: 1fr !important; } }

.perm-group-row td { background: var(--surface-alt); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding-top: 8px; padding-bottom: 8px; }
.perm-label { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ==========================================================================
   Dialogs, drawers, toasts
   ========================================================================== */
.modal {
  position: fixed; inset: 0; background: rgba(2, 29, 53, 0.45); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 90; padding: 16px; /* above the order panel */
  animation: fadeIn 0.15s ease;
}
.modal-card {
  background: var(--surface); width: 460px; max-width: 100%; max-height: calc(100dvh - 32px); overflow-y: auto;
  border-radius: 18px; padding: 22px; box-shadow: var(--shadow-lg); animation: popIn 0.18s var(--ease);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; }
.modal-header h3 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-message { margin: 0 0 14px; font-size: 13.5px; color: #334155; white-space: pre-line; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.toast-container {
  position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100;
  max-width: min(380px, calc(100vw - 40px));
}
.toast {
  background: var(--ink); color: #fff; padding: 11px 14px 11px 16px; border-radius: 12px; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg); animation: toastIn 0.2s var(--ease); display: flex; align-items: center; gap: 10px;
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; flex-shrink: 0; }
.toast-success::before { background: #34d399; }
.toast-error { background: #7f1d1d; }
.toast-error::before { background: #fca5a5; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: all 0.2s; }

@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Laptop: customer panel becomes a slide-over drawer (views sidebar + list + chat) */
@media (max-width: 1440px) {
  .inbox-layout.active { grid-template-columns: 184px 300px minmax(0, 1fr); }
  .chat-header .btn-context-toggle { display: inline-flex; }
  .context-pane {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 92vw); z-index: 70;
    transform: translateX(105%); transition: transform 0.25s var(--ease); box-shadow: var(--shadow-lg);
    border-left: 1px solid var(--border);
  }
  .inbox-layout.show-context .context-pane { transform: none; }
  .inbox-layout.show-context .context-backdrop { display: block; }
  .context-header { display: flex; justify-content: space-between; align-items: center; margin: -4px 0 10px; }
  .context-header h3 { margin: 0; font-size: 15px; }
}
.context-backdrop { display: none; position: fixed; inset: 0; background: rgba(2, 29, 53, 0.35); z-index: 65; }
/* Phones: every data table shows each row as a card ("Column   value" lines); the first cell is the title */
@media (max-width: 600px) {
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr { display: block; width: 100%; }
  .data-table tr { padding: 10px 12px; border-bottom: 1px solid var(--border); }
  .data-table tbody tr:last-child { border-bottom: none; }
  .data-table td, .data-table.compact td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 3px 0; border: 0; text-align: right; min-width: 0; max-width: none !important; white-space: normal;
  }
  .data-table td::before { content: attr(data-label); flex: none; max-width: 45%; font-size: 11.5px; font-weight: 600; color: var(--muted); text-align: left; }
  .data-table td[data-label=""]::before { display: none; }
  .data-table td[data-label=""] { justify-content: flex-end; }
  .data-table td:first-child { display: block; text-align: left; padding: 0 0 6px; }
  .data-table td:first-child::before { display: none; }
  .data-table td[colspan] { display: block; text-align: center; }
  .data-table td[colspan]::before { display: none; }
  .data-table td > .cell-stack { align-items: flex-end; }
  .data-table td:first-child > .cell-stack { align-items: flex-start; }
  .data-table td .cell-actions { flex-wrap: wrap; justify-content: flex-end; }
  .data-table tbody tr:hover { background: none; }
  .table-wrap { overflow: hidden; }
}
/* Small laptop / tablet landscape: no views sidebar (they're in the dropdown), list + chat */
@media (max-width: 1100px) {
  .inbox-layout.active { grid-template-columns: 300px minmax(0, 1fr); }
}

/* Tablet & phone: nav becomes an off-canvas drawer, inbox shows one pane at a time */
@media (max-width: 900px) {
  .left-nav, .left-nav.collapsed {
    position: fixed; top: 0; bottom: 0; left: 0; width: 260px; background: var(--bg);
    transform: translateX(-105%); box-shadow: var(--shadow-lg);
  }
  .left-nav.collapsed .nav-label, .left-nav.collapsed .brand-title { display: inline; }
  .left-nav.collapsed .nav-tab { justify-content: flex-start; padding: 4px 8px; }
  .nav-collapse-btn { display: none; }
  body.nav-open .left-nav { transform: none; }
  body.nav-open .nav-backdrop { display: block; }
  .topbar .btn-mobile-nav { display: inline-flex; }

  .main-workspace { padding: 8px; }
  .topbar { padding: 0 2px 8px; min-height: 44px; }
  .page-title { font-size: 18px; }
  .user-chip-text { display: none; }
  .user-chip { padding: 3px; }
  .workspace-sheet { border-radius: 16px; }
  .tab-panel.page-pad.active { padding: 16px; }

  .inbox-layout.active { grid-template-columns: minmax(0, 1fr); }
  .inbox-layout .chat-pane { display: none; }
  .inbox-layout.show-chat .sidebar { display: none; }
  .inbox-layout.show-chat .chat-pane { display: flex; }
  .chat-header .btn-back, .chat-header .btn-chat-tools { display: inline-flex; }
  .chat-header { padding: 8px 10px; }
  .chat-title { flex-basis: 0; }
  .chat-title-row { flex-wrap: nowrap; gap: 6px; }
  .chat-title-row > .conv-avatar { display: none; }
  .chat-subline { flex-wrap: nowrap; overflow: hidden; }
  .chat-subline .tags-bar, .chat-subline #chat-page-name { display: none; }
  .chat-title-actions { flex-wrap: nowrap; }
  .chat-title-actions #btn-snooze-2h, .chat-title-actions #btn-export-chat { display: none; }
  .chat-title-actions .select-sm { max-width: 104px; }
  .chat-title-actions { gap: 4px; }
  .btn-context-toggle .btn-label { display: none; }
  .chat-header .btn-context-toggle { width: 34px; height: 34px; padding: 0; }
  .chat-toolbar { display: none; }
  .chat-header.show-tools .chat-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-header.show-tools .chat-toolbar .mobile-only { display: inline-flex; }
  .composer-tabs { flex-wrap: wrap; row-gap: 4px; }
  .composer-tools { margin-left: 0; width: 100%; }
  .composer-tools .select-sm { flex: 1; min-width: 0; }
  .composer-hint { display: none; }
  .message-list { padding: 14px; }
  .msg { max-width: 86%; }
  .chat-toolbar .search-field { margin-left: 0; width: 100%; }
  .chat-toolbar .search-field input { width: 100%; }
  .toolbar-field { flex: 1 1 140px; }
  .toolbar-field .select-sm { max-width: none; width: 100%; }
  .toolbar-field > span { display: none; }

  .form-grid { grid-template-columns: 1fr 1fr; }
  .inline-form > * { flex: 1 1 160px; }
  .section-header h2 { font-size: 16px; }
}

@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .kpi-grid, .dash-hero-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dash-big-num { font-size: 22px; }
  .kpi-value { font-size: 22px; }
  .kpi-card, .dash-hero-card { padding: 14px; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-card { border-radius: 18px 18px 0 0; width: 100%; max-height: 90dvh; }
  .toast-container { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .cart-add-row { grid-template-columns: 1fr 1fr 60px; }
  .cart-add-row #order-item-name { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media print {
  .left-nav, .topbar, .toast-container, .side-drawer, .drawer-backdrop { display: none !important; }
  .modal { position: static; background: none; backdrop-filter: none; }
  .modal-card { box-shadow: none; }
}

/* ---------- Reports: date range bar, KPI cards, charts ---------- */
.range-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.range-presets { display: flex; flex-wrap: wrap; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px; }
.range-chip { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.range-chip:hover { background: var(--surface-alt); color: var(--text); }
.range-chip.active { background: var(--ink, #021d35); color: #fff; }
.range-custom { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.range-custom input, .range-channel select { height: 36px; padding: 0 10px; font-size: 13px; width: auto; }
.range-channel { margin-left: auto; }
.report-range { margin: -6px 0 14px; font-size: 12.5px; color: var(--muted); }

.attention-strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.attention-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-right: 2px; }
.attention-item { display: inline-flex; gap: 6px; align-items: baseline; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; color: var(--text); text-decoration: none; }
.attention-item strong { font-size: 14px; }
.attention-item:hover { border-color: var(--primary); }
.attention-item.alert { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }
.attention-item.zero { opacity: .55; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow-sm); min-width: 0; }
.stat-card.main { background: var(--ink, #021d35); border-color: transparent; color: #fff; }
.stat-card.main .kpi-label, .stat-card.main .stat-foot span { color: #94a3b8; }
.stat-value { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 4px 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value small { font-size: 12px; font-weight: 600; color: var(--muted); }
.stat-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); min-height: 18px; }
.delta { font-weight: 700; font-size: 11.5px; padding: 1px 7px; border-radius: 999px; }
.delta.up { background: var(--success-soft); color: #047857; }
.delta.down { background: #fee2e2; color: #b91c1c; }
.delta.neutral { background: var(--surface-alt); color: var(--muted); }
.stat-card.main .delta.up { background: rgba(16, 185, 129, .2); color: #6ee7b7; }
.stat-card.main .delta.down { background: rgba(239, 68, 68, .2); color: #fca5a5; }

.report-card { margin-bottom: 16px; min-width: 0; }
.report-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.report-card-head h3 { margin: 0; }
.card-link { font-size: 12.5px; font-weight: 600; color: var(--primary); text-decoration: none; }
.report-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.sub-head { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; }
.table-scroll { overflow-x: auto; }
.data-table.compact td, .data-table.compact th { padding-top: 8px; padding-bottom: 8px; }
.empty-state.small { padding: 18px; font-size: 13px; }

.chart-legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); margin: -4px 0 6px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.lg-bar { background: var(--primary); }
.lg-line { background: var(--ink, #021d35); height: 3px !important; vertical-align: 2px !important; }
.trend-chart { width: 100%; height: 230px; display: block; overflow: visible; }
.trend-chart .grid { stroke: var(--border); stroke-width: 1; }
.trend-chart text { font-size: 10.5px; fill: var(--muted); }
.trend-chart .trend-bar { fill: var(--primary); opacity: .85; }
.trend-chart .trend-hit { fill: transparent; }
.trend-chart .trend-col:hover .trend-hit { fill: var(--surface-alt); }
.trend-chart .trend-col:hover .trend-bar { opacity: 1; }
.trend-chart .trend-line { fill: none; stroke: var(--ink, #021d35); stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }

.hbars { display: grid; gap: 8px; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 10px; background: var(--surface-alt); border-radius: 99px; overflow: hidden; }
.hbar-track span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.hbar-value { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }

.hour-bars { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; height: 130px; align-items: end; }
.hour-col { height: 100%; display: flex; align-items: flex-end; background: var(--surface-alt); border-radius: 4px; overflow: hidden; }
.hour-col span { width: 100%; background: #8fb7f7; border-radius: 4px; min-height: 2px; }
.hour-col.peak span { background: var(--primary); }
.hour-axis { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 6px; }

.funnel { display: grid; gap: 8px; }
.funnel-row { display: grid; grid-template-columns: 80px 1fr 70px; gap: 10px; align-items: center; font-size: 13px; }
.funnel-track { height: 22px; background: var(--surface-alt); border-radius: 8px; overflow: hidden; }
.funnel-track span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--brand-sky)); border-radius: 8px; }
.funnel-num { font-weight: 700; text-align: right; }
.funnel-num small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.mini-stats.four { grid-template-columns: repeat(4, 1fr); margin: 0 0 14px; }
.mini-stats > div { background: var(--surface-alt); border-radius: 12px; padding: 10px 12px; }
.mini-stats strong { display: block; font-size: 19px; }
.mini-stats span { font-size: 11.5px; color: var(--muted); }
.split-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin: 4px 0; }
.split-label strong { color: var(--text); font-size: 13px; }
.inline-share { display: inline-block; width: calc(100% - 46px); height: 8px; background: var(--surface-alt); border-radius: 99px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.inline-share span { display: block; height: 100%; background: var(--primary); }

.insights-card h3 { margin-top: 0; }
.insights { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.insight { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.5; padding: 8px 12px; border-radius: 10px; background: var(--surface-alt); }
.insight-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: #64748b; }
.insight.good { background: var(--success-soft); }
.insight.good .insight-dot { background: var(--success); }
.insight.bad { background: #fef2f2; }
.insight.bad .insight-dot { background: #dc2626; }

.leader-cell { display: flex; gap: 8px; align-items: center; }
.rank { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-alt); font-size: 12px; font-weight: 700; flex: none; }
.rank.first { background: var(--primary); color: #fff; }

.heatmap { display: grid; gap: 3px; }
.heat-row { display: grid; grid-template-columns: 34px repeat(24, 1fr); gap: 3px; align-items: center; }
.heat-day { font-size: 11px; color: var(--muted); }
.heat-cell { height: 16px; border-radius: 3px; background: var(--primary); }
.heat-axis { grid-template-columns: 34px repeat(5, 1fr); font-size: 10.5px; color: var(--muted); }

@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .report-two { grid-template-columns: 1fr; }
  .range-channel { margin-left: 0; }
  .mini-stats.four { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) { .stat-value { font-size: 20px; } .heat-cell { height: 12px; } }

/* ---------- Teams ---------- */
.team-how { margin-bottom: 16px; font-size: 13px; color: #334155; }
.team-how ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.team-channels-row { display: flex; flex-wrap: wrap; gap: 6px; }
.role-card-stats .waiting strong { color: var(--primary); }
.member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 220px; overflow: auto; }
.member-list li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.member-list li.inactive { opacity: .5; }
.member-list .empty-members { color: var(--muted); font-size: 12.5px; }
.mini-avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-alt); font-size: 10.5px; font-weight: 700; flex: none; }
.member-name { flex: 1; min-width: 0; font-weight: 600; }
.member-name small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }
.member-load { font-size: 11.5px; color: var(--muted); background: var(--surface-alt); padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.team-field-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.team-channel-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.team-channel-pick { display: inline-flex !important; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; cursor: pointer; }
.team-channel-pick:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.team-member-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px; padding: 6px 0 16px; }
.team-member-picks small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; font-family: inherit; }
.team-chip { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--surface-alt); color: #334155; margin-right: 6px; }

/* ---------- Tags ---------- */
.tag-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.tag-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-sm); }
.tag-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tag-card .tag-pill { font-size: 12px; padding: 3px 10px; }
.tag-card .subtitle { margin: 0; font-size: 12.5px; }
.tag-auto { font-size: 12px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 4px 8px; overflow-wrap: anywhere; }
.tag-stats { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-top: auto; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.danger-text { color: var(--danger, #dc2626); }
#ui-dialog input[type=color] { height: 38px; padding: 2px 4px; width: 80px; cursor: pointer; }

/* Report tag filter, orders tag filter */
.range-tag select { height: 36px; padding: 0 10px; font-size: 13px; width: auto; max-width: 200px; }
.orders-filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.orders-filter-row .select-sm { min-width: 160px; }
.order-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.order-tags .tag-pill { font-size: 10px; padding: 1px 7px; }

/* ---------- Customer tiers ---------- */
.tier-badge {
  display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px;
  color: var(--tier); background: color-mix(in srgb, var(--tier) 14%, white); border: 1px solid color-mix(in srgb, var(--tier) 40%, white);
  white-space: nowrap;
}
.ctx-tier { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-alt); font-size: 12.5px; display: grid; gap: 6px; }
.ctx-tier:empty { display: none; }
.ctx-tier .tier-badge { font-size: 12px; padding: 2px 10px; }
.ctx-tier-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ctx-tier-perks { color: #334155; }
.ctx-tier-stats { font-weight: 600; }
.ctx-tier-stats span, .ctx-tier-next { color: var(--muted); font-weight: 400; }
.ctx-tier-note { font-size: 11.5px; color: #92400e; }
.tier-progress { height: 6px; border-radius: 99px; background: #e2e8f0; overflow: hidden; }
.tier-progress span { display: block; height: 100%; border-radius: 99px; }
.ctx-tier-history summary { cursor: pointer; color: var(--muted); font-size: 11.5px; }
.ctx-tier-history ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.ctx-tier-history li { font-size: 11.5px; }
.ctx-tier-history li > span { color: var(--muted); }
.ctx-tier-history small { display: block; color: var(--muted); }
.cart-tier-benefit { font-size: 12.5px; padding: 6px 10px; border-radius: 10px; background: #fffbeb; border: 1px solid #fde68a; }
.cart-tier-benefit .inline-check { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.camp-tiers { display: flex; flex-wrap: wrap; gap: 14px; }
.camp-tiers small { color: var(--muted); }

.tier-rules { display: grid; grid-template-columns: 1.3fr repeat(3, 1fr) auto; gap: 14px; align-items: end; margin-bottom: 16px; }
.tier-ladder { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tier-card {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 8px; border-top: 4px solid var(--tier);
}
.tier-card-top { display: flex; justify-content: space-between; align-items: center; }
.tier-rank { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tier-name { font-size: 19px; font-weight: 800; color: var(--tier); }
.tier-req { font-size: 12.5px; color: #334155; }
.tier-perks { margin: 0; padding-left: 18px; font-size: 12.5px; display: grid; gap: 3px; flex: 1; }
.tier-perks .muted { color: var(--muted); list-style: none; margin-left: -18px; }
.tier-members { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 8px; }
@media (max-width: 900px) { .tier-rules { grid-template-columns: 1fr 1fr; } }
.tier-rules > div:first-child { grid-column: 1 / -1; }
.tier-rules { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; }

/* ---------- Pagination ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; font-size: 13px; color: var(--muted); }
.pager:empty { display: none; }
.pager-info strong { color: var(--text); }
.pager-pages { display: flex; align-items: center; gap: 4px; }
.pager-btn {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface);
  font: inherit; font-weight: 600; color: var(--text); cursor: pointer;
}
.pager-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager-btn.active { background: var(--ink, #021d35); border-color: var(--ink, #021d35); color: #fff; }
.pager-btn:disabled { opacity: .4; cursor: default; }
.pager-gap { padding: 0 4px; }
.pager-size { display: flex; align-items: center; gap: 6px; }
.pager-size select { width: auto; }
.orders-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.orders-filters .select-sm { min-width: 0; width: auto; }
.orders-date input { height: 34px; }
.load-more-row { display: flex; justify-content: center; padding: 12px; }
.list-sentinel { height: 1px; }

/* ---------- Inboxes (Channels) ---------- */
.ch-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface-alt); color: #334155; flex: none; }
.ch-icon-facebook { color: #1877f2; } .ch-icon-telegram { color: #0ea5e9; } .ch-icon-viber { color: #7360f2; }
.ch-icon-website { color: var(--primary); } .ch-icon-api { color: #0f766e; } .ch-icon-tiktok { color: #111827; }
.badge-website { background: var(--primary-soft); color: var(--primary-deep); } .badge-api { background: #ccfbf1; color: #0f766e; }
.avatar-website { background: var(--primary); } .avatar-api { background: #0f766e; }
.inbox-list { display: grid; gap: 10px; }
.inbox-row { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px; box-shadow: var(--shadow-sm); }
.inbox-row-main { flex: 1; min-width: 0; }
.inbox-row-name { font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inbox-row-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) {
  .inbox-row { flex-wrap: wrap; gap: 10px; padding: 12px; }
  .inbox-row-main { flex-basis: calc(100% - 60px); }
  .inbox-row-sub { white-space: normal; }
  .inbox-row > .btn, .inbox-row > a.btn { margin-left: auto; }
}
.wizard-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.wizard-top h2 { margin: 0; display: flex; align-items: center; gap: 10px; }
.wizard-top h2 .ch-icon { width: 34px; height: 34px; }
.wizard-steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 14px; counter-reset: step; flex-wrap: wrap; }
.wizard-steps li { counter-increment: step; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.wizard-steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-alt); font-weight: 700; font-size: 12px; }
.wizard-steps li.current { color: var(--text); font-weight: 600; border-color: var(--primary); }
.wizard-steps li.current::before { background: var(--primary); color: #fff; }
.wizard-steps li.done::before { content: '✓'; background: var(--success-soft); color: #047857; }
.wizard-body { padding: 22px; }
.wizard-body h3 { margin-top: 0; }
.wizard-lead { margin: -4px 0 16px; }
.channel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.channel-choice {
  position: relative; text-align: left; display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; font: inherit; color: var(--text); min-height: 150px;
}
.channel-choice:hover:not(:disabled) { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.channel-choice strong { font-size: 15px; display: flex; align-items: center; gap: 6px; }
.channel-choice span:not(.ch-icon) { font-size: 13px; color: var(--muted); line-height: 1.45; }
.channel-choice.soon { cursor: default; opacity: .55; }
.beta-chip { font-size: 10.5px; font-weight: 600; color: #2563eb; background: #dbeafe; padding: 1px 7px; border-radius: 999px; }
.soon-chip { position: absolute; top: 12px; right: 12px; font-style: normal; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface-alt); padding: 2px 8px; border-radius: 999px; }
.wizard-form { margin-top: 4px; }
.fb-connect { display: grid; justify-items: center; gap: 14px; padding: 26px 10px; text-align: center; }
.fb-connect p { max-width: 520px; margin: 0; color: #334155; font-size: 13.5px; }
.fb-connect .manual-connect { width: 100%; max-width: 680px; text-align: left; border: 1px solid var(--border); border-radius: 12px; }
.btn-fb-lg { padding: 12px 22px; font-size: 15px; border-radius: 10px; }
.agent-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px; }
.agent-picks small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; font-family: inherit; }
.copy-box { display: flex; align-items: center; gap: 8px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; padding: 8px 8px 8px 12px; margin: 6px 0 12px; }
.copy-box code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-size: 12.5px; background: none; padding: 0; }
.code-block { background: #021d35; color: #e2e8f0; border-radius: 10px; padding: 12px 14px; font-size: 12px; overflow-x: auto; margin: 6px 0; white-space: pre; }
.warn-line { color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 8px 12px; }
.wizard-done { display: grid; gap: 14px; }
.done-badge { width: 48px; height: 48px; border-radius: 50%; background: var(--success-soft); color: #047857; display: grid; place-items: center; font-size: 24px; font-weight: 800; }
.wizard-done h3 { margin: 0; }
.done-inbox { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.done-inbox > div { flex: 1; min-width: 0; }
.done-inbox p { margin: 6px 0; font-size: 13.5px; }
.danger-zone { border-color: #fecaca; }
input.color-input { height: 40px; padding: 3px 6px; width: 90px; cursor: pointer; }
#inbox-settings-body .form-card { margin-bottom: 14px; }

/* ---------- Shop & plan, platform console ---------- */
.shop-banner { margin: 0 16px 10px; padding: 10px 14px; border-radius: 12px; font-size: 13px; border: 1px solid var(--primary-border, #bfdbfe); background: var(--primary-soft); color: var(--primary-deep); }
.shop-banner.tone-warning { background: var(--warning-soft); color: var(--warning); border-color: #fde68a; }
.shop-banner.tone-danger { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.shop-blocked { flex: 1; display: grid; place-items: center; padding: 24px; }
body.shop-is-blocked .workspace-sheet, body.shop-is-blocked .nav-tabs { display: none; }
.shop-blocked-card { max-width: 520px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow-sm); }
.shop-blocked-card h2 { margin: 0 0 10px; font-size: 18px; color: var(--ink); }
.shop-blocked-card p { margin: 0 0 18px; font-size: 14px; line-height: 1.55; color: #334155; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.shop-grid h3 { display: flex; align-items: center; gap: 8px; }
.usage-row { margin: 10px 0; }
.usage-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 5px; }
.usage-bar { height: 8px; border-radius: 99px; background: var(--surface-sunken); overflow: hidden; }
.usage-bar span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.usage-bar span.full { background: var(--danger); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.text-danger { color: var(--danger); }
.shop-grid .form-card label { display: block; font-size: 13px; font-weight: 600; color: var(--text); }
.shop-grid .form-card label > input { display: block; width: 100%; box-sizing: border-box; margin-top: 5px; }
.shop-grid .form-card { display: flex; flex-direction: column; gap: 10px; }
.shop-grid .form-card h3 { margin: 0; }

/* ---------- POS & Logistics Layout ---------- */
.pos-two-col {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .pos-two-col { grid-template-columns: 1fr; }
}

.logistics-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.logistics-card:hover {
  border-color: var(--border-strong);
}
.logistics-main {
  flex: 1;
  min-width: 240px;
}
.logistics-items {
  margin: 6px 0 4px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
}
.logistics-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: 170px;
}
.logistics-side strong {
  font-size: 16px;
  color: var(--ink);
}

/* Dashboard Widget Customizer List */
.widget-toggle-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.widget-toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  gap: 12px;
  cursor: pointer;
}
.widget-toggle-item:hover {
  border-color: var(--border-strong);
}
.widget-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.widget-toggle-info strong {
  font-size: 13.5px;
  color: var(--ink);
}
.widget-toggle-info span {
  font-size: 12px;
  color: var(--muted);
}

/* Barcode Scanner Bar in Direct POS */
.barcode-scan-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--muted);
}
.barcode-scan-bar:focus-within {
  border-style: solid;
  border-color: var(--primary);
  background: var(--surface);
  color: var(--primary);
}
.barcode-scan-bar input {
  border: 0;
  background: transparent;
  outline: none;
  flex: 1;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
}

/* Thermal Receipt (80mm / 58mm) & Packing Slip */
.receipt-paper {
  margin: 0 auto;
  padding: 16px;
  background: #fff;
  color: #111;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  max-height: 58vh;
  overflow-y: auto;
}
.receipt-paper.w80 { width: 302px; }
.receipt-paper.w58 { width: 220px; font-size: 11px; padding: 10px; }
.receipt-paper.packing { width: 100%; font-family: inherit; font-size: 13px; }
.receipt-paper hr { border: 0; border-top: 1px dashed #94a3b8; margin: 8px 0; }
.receipt-row { display: flex; justify-content: space-between; gap: 8px; }
.receipt-center { text-align: center; }

@media print {
  body.printing-receipt > *:not(#receipt-print-modal) { display: none !important; }
  body.printing-receipt #receipt-print-modal {
    position: static !important;
    background: #fff !important;
    padding: 0 !important;
    display: block !important;
  }
  body.printing-receipt #receipt-print-modal .modal-card {
    box-shadow: none !important;
    border: 0 !important;
    max-width: none !important;
    padding: 0 !important;
  }
  body.printing-receipt .no-print { display: none !important; }
  body.printing-receipt .receipt-paper {
    border: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    margin: 0 !important;
  }
}

/* SyncPOS-style Product Form Sections & Variant Builder */
.prod-form-section {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}
.prod-form-section-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 10px;
}
.select-with-add {
  display: flex;
  gap: 6px;
  align-items: center;
}
.select-with-add select {
  flex: 1;
  min-width: 0;
}
.variant-option-row {
  display: grid;
  grid-template-columns: 150px 1fr 32px;
  gap: 8px;
  align-items: center;
}
.variant-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

/* Logistics Bulk Bar, Returned badge & Printable Handover Manifest */
.log-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-top: 10px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft, #eef4ff);
  border: 1px solid #bfdbfe;
  font-size: 13px;
}
.logistics-card-select {
  display: flex;
  align-items: flex-start;
  padding-top: 3px;
}
.st-returned {
  background: var(--danger-soft, #fef2f2);
  color: var(--danger, #dc2626);
}
.receipt-paper.manifest {
  width: 100%;
  max-width: 100%;
  font-family: inherit;
  font-size: 12px;
}
.manifest-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 11.5px;
}
.manifest-table th,
.manifest-table td {
  border: 1px solid #cbd5e1;
  padding: 5px 6px;
  text-align: left;
  vertical-align: top;
}
.manifest-table th {
  background: #f8fafc;
  font-weight: 700;
}

/* POS Customer Match / Risk / Tier Banner & Customer Profile Drawer KPIs */
.pos-cust-banner {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pos-cust-banner.warn {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #92400e;
}
.pos-cust-banner.danger {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}
.cust-mini-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.cust-mini-kpi {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}
.cust-mini-kpi .lbl {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.cust-mini-kpi .val {
  font-size: 15px;
  font-weight: 700;
  margin-top: 2px;
}




