:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-soft: #ccfbf1;
  --accent: #ea580c;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
  --sidebar: #0b3b3a;
  --sidebar-end: #115e59;
  --sidebar-text: #d1fae5;
  --bg-from: #ecfeff;
  --bg-mid: #f8fafc;
  --bg-to: #fff7ed;
  --radius: 12px;
  --space-scale: 1;
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, 0.12);
  --font: "Vazirmatn", "Tahoma", sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  overflow-x: clip;
  max-width: 100%;
}
body {
  font-family: var(--font);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 500px at 100% -10%, rgba(15, 118, 110, 0.12), transparent 55%),
    radial-gradient(900px 420px at 0% 0%, rgba(234, 88, 12, 0.10), transparent 50%),
    linear-gradient(165deg, var(--bg-from) 0%, var(--bg-mid) 42%, var(--bg-to) 100%);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
@supports (background: color-mix(in srgb, white 50%, black)) {
  body {
    background-image:
      radial-gradient(1200px 500px at 100% -10%, color-mix(in srgb, var(--brand) 12%, transparent), transparent 55%),
      radial-gradient(900px 420px at 0% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 50%),
      linear-gradient(165deg, var(--bg-from) 0%, var(--bg-mid) 42%, var(--bg-to) 100%);
  }
}
body.theme-compact .content { padding: .85rem 1.1rem 1.5rem; }
body.theme-compact .card { padding: .8rem .9rem; }
body.theme-compact .topbar { padding: .7rem 1.1rem; }

a { color: var(--brand); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--brand-dark); }

.app-shell {
  display: flex;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: clip;
}
.sidebar {
  width: 264px;
  background: linear-gradient(175deg, var(--sidebar) 0%, var(--sidebar-end) 100%);
  color: var(--sidebar-text);
  padding: 1.15rem .85rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: inset -1px 0 0 rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
}
.sidebar .nav { flex: 1; overflow-y: auto; min-height: 0; }
.sidebar-foot {
  margin-top: auto;
  padding: .75rem .35rem .15rem;
  border-top: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.app-version-badge {
  display: block;
  font-size: .68rem;
  opacity: .55;
  text-align: center;
  letter-spacing: .02em;
  color: var(--sidebar-text);
  user-select: none;
}
.app-main-foot {
  margin-top: auto;
  padding: .65rem 1.25rem 1rem;
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  text-align: center;
  flex-shrink: 0;
}
.app-main-foot-version {
  font-size: .72rem;
  color: var(--muted);
  opacity: .85;
  letter-spacing: .02em;
}
.brand {
  display: flex; align-items: center; gap: .75rem;
  padding: .45rem .7rem 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: .95rem;
}
.brand-mark {
  width: 42px; height: 42px; border-radius: calc(var(--radius) - 2px);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 55%, #fff), var(--accent));
  display: grid; place-items: center; color: #042f2e; font-weight: 800;
  box-shadow: 0 8px 20px rgba(0,0,0,.18);
}
.brand strong { display: block; color: #fff; font-size: 1rem; letter-spacing: -.01em; }
.brand span { font-size: .72rem; opacity: .72; }

.nav-group { margin-bottom: .95rem; }
.nav-label {
  font-size: .68rem; letter-spacing: .06em; opacity: .5;
  padding: .3rem .75rem; text-transform: uppercase;
}
.nav a, .nav-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem .75rem; margin: .1rem 0;
  border-radius: calc(var(--radius) - 2px); color: var(--sidebar-text); font-size: .88rem;
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.nav a:hover, .nav-link:hover { background: rgba(255,255,255,.1); color: #fff; transform: translateX(-2px); }
.nav a.active, .nav-link.active {
  background: rgba(255,255,255,.14); color: #fff;
  box-shadow: inset 3px 0 0 color-mix(in srgb, #fff 70%, var(--brand));
}

.nav-section { margin-bottom: .35rem; }
.nav-section-btn {
  width: 100%; display: flex; align-items: center; gap: .55rem;
  padding: .55rem .7rem; margin: 0;
  border: 0; border-radius: calc(var(--radius) - 2px);
  background: transparent; color: #fff; font: inherit; font-weight: 600; font-size: .86rem;
  cursor: pointer; text-align: right;
}
.nav-section-btn:hover { background: rgba(255,255,255,.08); }
.nav-section.is-active > .nav-section-btn {
  background: rgba(255,255,255,.12);
}
.nav-section-ico { display: inline-grid; place-items: center; opacity: .9; }
.nav-section-label { flex: 1; }
.nav-section-caret {
  opacity: .55; font-size: .7rem; transition: transform .2s var(--ease);
  transform: rotate(-90deg);
}
.nav-section.is-open > .nav-section-btn .nav-section-caret { transform: rotate(0deg); }
.nav-section-body {
  display: none; padding: .15rem .2rem .35rem .35rem;
}
.nav-section.is-open > .nav-section-body { display: block; }
.nav-link-ico { display: inline-grid; place-items: center; opacity: .75; }
.nav-link-text { flex: 1; }
.nav-ico { display: block; flex-shrink: 0; }

.nav-catalog-cta {
  display: flex; align-items: center; gap: .65rem;
  padding: .62rem .85rem; margin: 0 0 .85rem;
  border-radius: calc(var(--radius) - 2px);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 82%, #fff 18%), var(--accent));
  color: #fff; font-size: .88rem; font-weight: 700;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 38%, transparent);
  transition: background .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease);
}
.nav-catalog-cta:hover {
  color: #fff;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 92%, #fff 8%), color-mix(in srgb, var(--accent) 88%, #000 12%));
  transform: translateY(-1px);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 45%, transparent);
}
.nav-catalog-cta .nav-link-ico { opacity: 1; }
.nav-catalog-cta-ext {
  font-size: .78rem; opacity: .88; line-height: 1;
}

.topbar-section {
  font-size: .72rem; color: #64748b; font-weight: 600; margin-bottom: .1rem;
}
.trial-badge {
  display: inline-block;
  font-size: .62rem;
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: .1rem .4rem;
  vertical-align: middle;
  margin-inline-start: .25rem;
}
.trial-badge-sm { font-size: .58rem; padding: .05rem .35rem; }
.tenant-chip {
  font-size: .78rem;
  color: #0f766e;
  font-weight: 600;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plan-chip {
  font-size: .72rem;
  font-weight: 600;
  color: #115e59;
  background: #ccfbf1;
  border: 1px solid #99f6e4;
  border-radius: 999px;
  padding: .2rem .55rem;
  white-space: nowrap;
}
.sms-credit-chip {
  font-size: .72rem;
  font-weight: 600;
  color: #9a3412;
  background: #ffedd5;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  padding: .2rem .55rem;
  white-space: nowrap;
  text-decoration: none;
}
.section-tabs {
  position: sticky; top: 64px; z-index: 15;
  background: color-mix(in srgb, var(--surface, #fff) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--line, #e2e8f0) 85%, transparent);
  padding: 0 1.25rem;
}
.section-tabs-inner {
  display: flex; gap: .35rem; overflow-x: auto; padding: .55rem 0;
  scrollbar-width: thin;
}
.section-tab {
  flex: 0 0 auto;
  padding: .4rem .85rem;
  border-radius: 999px;
  font-size: .8rem; font-weight: 600;
  color: #475569;
  background: color-mix(in srgb, var(--line, #e2e8f0) 55%, transparent);
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.section-tab:hover { color: var(--brand-dark, #0f766e); background: color-mix(in srgb, var(--brand, #0d9488) 12%, #fff); }
.section-tab.active {
  color: #fff;
  background: var(--brand, #0d9488);
  border-color: color-mix(in srgb, var(--brand, #0d9488) 70%, #000);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--brand, #0d9488) 28%, transparent);
}
html.crm-dark .section-tabs {
  background: color-mix(in srgb, #0f172a 90%, transparent);
  border-bottom-color: #1e293b;
}
html.crm-dark .section-tab { color: #cbd5e1; background: #1e293b; }
html.crm-dark .section-tab:hover { background: #334155; color: #fff; }
html.crm-dark .topbar-section { color: #94a3b8; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.5rem; background: rgba(255,255,255,.78);
  backdrop-filter: blur(14px) saturate(1.2); border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  position: sticky; top: 0; z-index: 20;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}
.topbar h1 { margin: 0; font-size: 1.22rem; letter-spacing: -.02em; font-weight: 700; }
.topbar-actions {
  display: flex; align-items: center; gap: .75rem;
  flex-shrink: 0;
  min-width: 0;
}
.content {
  padding: 1.25rem 1.5rem 2rem;
  animation: fadeUp .35s var(--ease);
  min-width: 0;
  max-width: 100%;
}

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

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 90%, transparent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
  backdrop-filter: blur(8px);
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.card:hover { box-shadow: var(--shadow-lg); }
.card h3 { margin: 0 0 .75rem; font-size: 1rem; letter-spacing: -.01em; }
.stat {
  display: flex; flex-direction: column; gap: .35rem;
  position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; inset: auto -20px -30px auto;
  width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 18%, transparent), transparent 70%);
}
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: none; border-radius: calc(var(--radius) - 2px); padding: .55rem .95rem;
  background: var(--brand); color: #fff; cursor: pointer; font-family: inherit; font-size: .9rem;
  transition: background .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset;
}
.btn:hover { background: var(--brand-dark); color: #fff; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn-secondary:hover { background: #f8fafc; color: var(--ink); }
.btn-danger { background: var(--danger); }
.btn-accent { background: var(--accent); }
.btn-sm { padding: .35rem .65rem; font-size: .8rem; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .7rem .6rem; border-bottom: 1px solid var(--line); text-align: right; }
th { color: var(--muted); font-weight: 600; background: #f8fafc; }
tr:hover td { background: #f8fafc; }

/* Sortable + selectable data tables */
.sortable-table th.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.sortable-table th.sortable-th:hover {
  background: #f1f5f9;
  color: var(--ink);
}
.sortable-table th.sortable-th--static {
  cursor: default;
}
.sortable-th-indicator {
  display: inline-flex;
  flex-direction: column;
  margin-inline-start: .35rem;
  vertical-align: middle;
  opacity: .35;
  font-size: .55rem;
  line-height: .65;
  color: var(--muted);
}
.sortable-th-indicator::before { content: '▲'; }
.sortable-th-indicator::after { content: '▼'; }
.sortable-table th.sortable-th--active .sortable-th-indicator { opacity: 1; color: var(--brand); }
.sortable-table th.sortable-th--asc .sortable-th-indicator::after { opacity: .2; }
.sortable-table th.sortable-th--desc .sortable-th-indicator::before { opacity: .2; }
.sortable-table tbody tr.sortable-table-row--selected > td,
.sortable-table tbody tr:has(.sortable-table-row-check:checked) > td {
  background: #ecfdf5;
}
.sortable-table tbody tr:has(.sortable-table-row-check:checked):hover > td {
  background: #d1fae5;
}
.sortable-table-select-col {
  width: 2.5rem;
  text-align: center;
  vertical-align: middle;
}
.sortable-table--sticky-select .sortable-table-select-col {
  position: sticky;
  inset-inline-end: 0;
  z-index: 2;
  background: inherit;
  box-shadow: -2px 0 4px rgba(15, 23, 42, .06);
}
.sortable-table--sticky-select thead .sortable-table-select-col {
  background: #f8fafc;
}
.sortable-table tbody tr { cursor: default; }
.sortable-table tbody tr:has(.sortable-table-row-check) { cursor: pointer; }

.badge {
  display: inline-flex; padding: .15rem .55rem; border-radius: 999px;
  font-size: .75rem; background: #e2e8f0; color: #334155;
}
.badge-ok { background: #dcfce7; color: #166534; }
.badge-warn { background: #ffedd5; color: #9a3412; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: var(--brand-soft); color: #115e59; }

.form-row { display: grid; gap: .75rem; margin-bottom: .9rem; }
.form-row.two { grid-template-columns: 1fr 1fr; }
label { display: block; margin-bottom: .3rem; font-size: .85rem; color: var(--muted); }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
select,
textarea {
  width: 100%; padding: .65rem .75rem; border: 1px solid var(--line);
  border-radius: 10px; font-family: inherit; background: #fff; color: var(--ink);
}
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0;
  margin: 0;
  border-radius: 4px;
  flex-shrink: 0;
  accent-color: var(--brand);
  vertical-align: middle;
}
label.inline-check,
.form-row > label:has(input[type="checkbox"]),
.form-row > label:has(input[type="radio"]) {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 0;
}
textarea { min-height: 110px; resize: vertical; }
.alert {
  padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: .9rem;
}
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-info { background: #e0f2fe; color: #075985; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  position: relative; padding: 0 1.2rem 1rem 0; border-right: 2px solid var(--line); margin-right: .5rem;
}
.timeline li::before {
  content: ""; position: absolute; right: -6px; top: .35rem;
  width: 10px; height: 10px; border-radius: 50%; background: var(--brand);
}

.kanban {
  display: flex;
  flex-direction: row-reverse;
  direction: ltr;
  gap: .45rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: .25rem 1rem .65rem;
  align-items: stretch;
  scrollbar-gutter: stable;
  scroll-padding-inline: 1rem;
  -webkit-overflow-scrolling: touch;
}
.kanban-col {
  flex: 0 0 188px;
  width: 188px;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  direction: rtl;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.kanban-col h4,
.kanban-col__title {
  margin: 0;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.3;
}
.kanban-col-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: .35rem .25rem .35rem .35rem;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 transparent;
}
.kanban-col-body::-webkit-scrollbar {
  width: 6px;
}
.kanban-col-body::-webkit-scrollbar-track {
  background: transparent;
  margin: .15rem 0;
}
.kanban-col-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.kanban-col-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
.kanban-col.drag-over {
  background: rgba(13, 148, 136, .08);
  border-color: var(--brand);
  box-shadow: inset 0 0 0 2px rgba(15, 118, 110, .25);
}
.kanban-card {
  background: #fff;
  border: 1px solid #e8edf2;
  border-radius: 6px;
  padding: .35rem .4rem .3rem .75rem;
  margin-bottom: .3rem;
  position: relative;
  cursor: grab;
  user-select: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.kanban-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
}
.kanban-card__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .35rem;
  min-width: 0;
}
.kanban-card__order {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 700;
  font-size: .76rem;
  color: #0f766e;
  cursor: pointer;
  text-align: right;
  flex-shrink: 0;
  line-height: 1.2;
}
.kanban-card__order:hover { text-decoration: underline; }
.kanban-card__total {
  font-weight: 600;
  font-size: .7rem;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  text-align: left;
}
.kanban-card__customer {
  margin-top: .18rem;
  font-size: .68rem;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
}
.kanban-card__date {
  margin-top: .12rem;
  font-size: .62rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging {
  opacity: .45;
  transform: scale(.98);
  box-shadow: none;
}
.kanban-card-handle {
  position: absolute;
  right: .15rem;
  top: 50%;
  transform: translateY(-50%);
  color: #cbd5e1;
  font-size: .72rem;
  letter-spacing: -.05em;
  cursor: grab;
  opacity: 0;
  transition: opacity .12s ease, color .12s ease;
}
.kanban-card:hover .kanban-card-handle,
.kanban-card:focus-within .kanban-card-handle {
  opacity: 1;
  color: #94a3b8;
}
.kanban-card .meta { color: var(--muted); font-size: .78rem; margin-top: .35rem; }
.kanban-toast {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: .65rem 1rem; border-radius: 999px;
  font-size: .85rem; z-index: 100; box-shadow: var(--shadow);
}

.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(45,212,191,.25), transparent 35%),
    radial-gradient(circle at 80% 0%, rgba(251,146,60,.2), transparent 30%),
    linear-gradient(160deg, #042f2e, #0f766e 45%, #fff7ed);
  padding: 1rem;
}
.login-back-home {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: .85rem;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  z-index: 2;
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.login-back-home:hover { text-decoration: underline; }
.login-page { position: relative; }
.login-card {
  width: min(400px, 100%);
  background: rgba(255,255,255,.95);
  border-radius: 18px;
  padding: 1.5rem 1.35rem;
  box-shadow: 0 25px 60px rgba(0,0,0,.2);
}
.login-card--compact { padding: 1.25rem 1.15rem; }
.login-card h1 { margin: 0 0 .25rem; font-size: 1.35rem; }
.login-card p { color: var(--muted); margin-top: 0; font-size: .85rem; line-height: 1.45; }
.login-card--compact .form-row { margin-bottom: .65rem; }
.login-card--compact .form-row label { font-size: .82rem; margin-bottom: .2rem; }
.login-card--compact .auth-tabs { margin-bottom: .65rem; }
.login-card--compact .alert { margin-bottom: .65rem; padding: .5rem .65rem; font-size: .82rem; }
.login-card .auth-tabs { display: flex; gap: .35rem; margin: 0 0 .75rem; border-bottom: 1px solid rgba(148,163,184,.35); padding-bottom: .3rem; }
.login-card .auth-tabs button { flex: 1; border: 0; background: transparent; padding: .45rem .35rem; font: inherit; cursor: pointer; color: #64748b; border-radius: .5rem .5rem 0 0; font-size: .88rem; }
.login-card .auth-tabs button.active { color: var(--brand,#0f766e); font-weight: 700; box-shadow: inset 0 -2px 0 var(--brand,#0f766e); }
.login-card .auth-pane { display: none; }
.login-card .auth-pane.active { display: block; }
.login-card .otp-hint { font-size: .78rem; color: #64748b; margin: .25rem 0 .55rem; line-height: 1.4; min-height: 1em; }
.login-card .otp-hint.ok { color: #047857; }
.login-card .otp-hint.err { color: #b91c1c; }
.login-foot-version {
  margin: .75rem 0 0;
  text-align: center;
  font-size: .72rem;
  color: var(--muted);
  opacity: .8;
}
.otp-digits-host { margin: .15rem 0 .35rem; position: relative; }
.otp-autofill-capture {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}
.otp-digits-row {
  display: flex;
  gap: .45rem;
  justify-content: center;
  direction: ltr;
}
.otp-digit {
  width: 2.65rem;
  height: 2.85rem;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  border: 1px solid rgba(148,163,184,.45);
  border-radius: .55rem;
  background: #fff;
  padding: 0;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.otp-digit:focus {
  outline: none;
  border-color: var(--brand,#0f766e);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand,#0f766e) 18%, transparent);
}
.otp-timer {
  font-size: .76rem;
  color: #64748b;
  text-align: center;
  margin: .35rem 0 .15rem;
  min-height: 1.1em;
}
.otp-timer.is-valid { color: #047857; }
.otp-timer.is-expired { color: #b91c1c; }
@media (max-width: 640px) {
  .login-page {
    padding: 0;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
  }
  .login-card,
  .login-card--compact {
    width: 100%;
    min-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
    padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .login-card .form-row.two { grid-template-columns: 1fr; }
  .login-card p.auth-tagline { display: none; }
}

.pagination { display: flex; gap: .4rem; margin-top: 1rem; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: .35rem .65rem; border-radius: 8px; border: 1px solid var(--line); background: #fff;
}
.pagination .active { background: var(--brand); color: #fff; border-color: var(--brand); }

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1rem;
  margin-top: 1rem;
  padding-top: .85rem;
  border-top: 1px solid var(--line);
}
.pager-meta {
  font-size: .85rem;
  color: var(--muted);
  line-height: 1.5;
}
.pager-meta strong { color: var(--ink); font-weight: 700; }
.pager-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem 1rem;
}
.pager-size {
  margin: 0;
  font-size: .82rem;
  color: var(--muted);
}
.pager-size label {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
  color: var(--muted);
}
.pager-size select {
  width: auto;
  min-width: 4.5rem;
  padding: .35rem .5rem;
  border-radius: 8px;
  font-size: .82rem;
}
.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  height: 2.1rem;
  padding: 0 .65rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
a.pager-btn:hover {
  background: var(--brand-soft);
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  color: var(--brand-dark);
}
.pager-btn.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.pager-btn.is-disabled {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}
.pager-ellipsis {
  min-width: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}
@media (max-width: 640px) {
  .pager { flex-direction: column; align-items: stretch; }
  .pager-nav { justify-content: center; }
}

.chat { display: flex; flex-direction: column; gap: .65rem; }
.bubble {
  max-width: 82%; padding: .78rem .95rem; border-radius: 16px 16px 4px 16px;
  background: #f1f5f9; box-shadow: 0 1px 2px rgba(15,23,42,.04);
  animation: bubbleIn .28s var(--ease);
}
.bubble.agent {
  background: linear-gradient(160deg, var(--brand-soft), #fff);
  margin-right: auto; border-radius: 16px 16px 16px 4px;
  border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent);
}
.bubble.customer {
  background: linear-gradient(160deg, #ffedd5, #fff7ed);
  margin-left: auto; border-radius: 16px 16px 4px 16px;
}
.bubble.system {
  background: rgba(255,255,255,.9); border: 1px solid var(--line);
  margin: 0 auto; max-width: 94%; text-align: center; font-size: .88rem;
  border-radius: 12px; color: var(--muted);
}
.bubble .who { font-size: .72rem; color: var(--muted); margin-bottom: .28rem; font-weight: 600; }
.bubble a { color: var(--brand); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.chat-product-list { display: flex; flex-direction: column; gap: .4rem; margin-top: .55rem; text-align: right; }
.chat-product-img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: #f1f5f9; }
.chat-product-body { min-width: 0; flex: 1; }
.chat-product {
  display: flex; align-items: flex-start; gap: .55rem; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; color: inherit; text-decoration: none !important;
  transition: border-color .15s ease, transform .15s ease;
}
a.chat-product:hover { border-color: var(--brand); transform: translateY(-1px); }
.chat-product-name { font-weight: 700; color: var(--brand); font-size: .88rem; line-height: 1.45; }
.chat-product-meta { font-size: .78rem; color: var(--muted); margin-top: .15rem; font-weight: 500; }

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.chat-inbox {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 320px;
  gap: 1rem;
  align-items: stretch;
  min-height: calc(100vh - 9rem);
  width: 100%;
  max-width: none;
}
.chat-inbox-list, .chat-inbox-main, .chat-inbox-side {
  min-height: calc(100vh - 9rem); display: flex; flex-direction: column;
}
.chat-inbox-side.chat-toolbox {
  overflow: auto;
  max-height: calc(72vh + 2rem);
  padding: .85rem .9rem 1rem;
}
.chat-toolbox-head {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  margin-bottom: .65rem; flex-wrap: wrap;
}
.chat-toolbox-alert {
  font-size: .8rem; padding: .45rem .6rem; margin-bottom: .65rem;
  background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; color: #9a3412;
}
.chat-toolbox-alert a { margin-right: .35rem; }
.chat-toolbox-section {
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: .55rem;
  background: #f8fafc;
}
.chat-toolbox-section > summary {
  cursor: pointer; list-style: none; padding: .55rem .7rem;
  font-weight: 600; font-size: .88rem; user-select: none;
}
.chat-toolbox-section > summary::-webkit-details-marker { display: none; }
.chat-toolbox-section > summary::before {
  content: '▸'; display: inline-block; margin-left: .35rem;
  transition: transform .15s ease; color: var(--muted); font-size: .75rem;
}
.chat-toolbox-section[open] > summary::before { transform: rotate(90deg); }
.chat-toolbox-body { padding: 0 .7rem .7rem; }
.chat-toolbox-body label { font-size: .78rem; display: block; margin-bottom: .2rem; }
.chat-toolbox-body input,
.chat-toolbox-body textarea,
.chat-toolbox-body select { width: 100%; font-size: .85rem; }
.chat-toolbox-list { list-style: none; padding: 0; margin: .35rem 0 0; }
.chat-toolbox-list li { margin-bottom: .45rem; font-size: .85rem; }
.chat-toolbox-phone {
  display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: .35rem; font-size: .85rem;
}
.chat-toolbox-row-actions {
  display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem;
}
.chat-toolbox-order-row { padding-bottom: .4rem; border-bottom: 1px dashed var(--line); }
.chat-toolbox-order-row:last-child { border-bottom: 0; }
.chat-toolbox-card-row {
  padding: .45rem 0; border-bottom: 1px dashed var(--line); font-size: .85rem;
}
.chat-toolbox-card-row:last-child { border-bottom: 0; }
.chat-toolbox-results { margin-top: .45rem; display: flex; flex-direction: column; gap: .45rem; }
.chat-toolbox-result {
  display: flex; gap: .5rem; align-items: flex-start;
  padding: .45rem; background: #fff; border: 1px solid var(--line); border-radius: 8px;
}
.chat-toolbox-thumb {
  width: 42px; height: 42px; object-fit: cover; border-radius: 6px; flex-shrink: 0; background: #eee;
}
.chat-toolbox-result-body { flex: 1; min-width: 0; font-size: .82rem; }
.chat-toolbox-footer {
  display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .75rem; padding-top: .5rem;
  border-top: 1px solid var(--line);
}
.chat-toolbox-tabs {
  display: flex; gap: .25rem; margin-bottom: .65rem; flex-wrap: wrap;
}
.chat-toolbox-tab {
  flex: 1; min-width: 3.5rem; border: 1px solid var(--line); background: #fff;
  border-radius: 8px; padding: .35rem .4rem; font-size: .78rem; cursor: pointer;
  color: var(--muted); font-family: inherit;
}
.chat-toolbox-tab.is-active {
  background: var(--primary, #0f766e); color: #fff; border-color: transparent; font-weight: 600;
}
.chat-toolbox-panel { display: none; }
.chat-toolbox-panel.is-active { display: block; }
.chat-toolbox-perf {
  margin-top: .55rem; padding: .55rem; background: #fff; border: 1px solid var(--line); border-radius: 8px;
}
.chat-toolbox-perf-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: .35rem .5rem; font-size: .82rem;
}
.chat-toolbox-perf-grid span { display: block; font-size: .72rem; }
.meta-muted { font-size: .78rem; color: var(--muted); }
.chat-toolbox-order-linked { margin-bottom: .55rem; font-size: .88rem; }

/* Customer mood / personality bar — compact chip strip (CRM brand tokens) */
.mood-bar {
  margin-top: .5rem;
  padding: .4rem .55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  width: 100%; max-width: 100%; min-width: 0;
  box-sizing: border-box; overflow: visible;
}
.mood-bar--sm { padding: .32rem .45rem; }
.mood-bar--spotlight {
  margin-top: .55rem;
  margin-bottom: .15rem;
  padding: .55rem .7rem;
  border-color: color-mix(in srgb, var(--brand) 30%, var(--line));
  background: color-mix(in srgb, var(--brand-soft) 42%, var(--surface));
  overflow: visible;
}
/* Chat conversation header: single compact horizontal strip */
.mood-bar--header {
  margin-top: .35rem;
  margin-bottom: 0;
  padding: .12rem 0;
  border: none;
  background: transparent;
  border-radius: 0;
  width: auto;
  max-width: 100%;
}
.mood-bar__row {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .45rem;
  width: 100%; min-width: 0;
}
.mood-bar--header .mood-bar__row {
  flex-wrap: nowrap;
  gap: .28rem;
  width: auto;
  max-width: 100%;
}
.mood-bar__label {
  flex: 0 0 auto;
  font-size: .68rem; font-weight: 700; line-height: 1.2;
  color: var(--muted);
  padding: .2rem .45rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--line) 70%, var(--surface));
  white-space: nowrap;
}
.mood-bar--spotlight .mood-bar__label {
  color: var(--brand-dark);
  background: color-mix(in srgb, var(--brand-soft) 80%, #fff);
}
.mood-bar__strip {
  display: flex; flex-wrap: wrap; gap: .3rem; align-items: center;
  flex: 1 1 7rem; min-width: 0; max-width: 100%;
}
.mood-bar--header .mood-bar__strip {
  flex: 0 1 auto;
  flex-wrap: nowrap;
  gap: .22rem;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: min(100%, 18rem);
  scrollbar-width: thin;
}
.mood-bar__empty {
  font-size: .78rem; color: var(--muted);
  white-space: normal; overflow-wrap: anywhere; max-width: 100%;
  font-style: normal;
}
.mood-bar--header .mood-bar__empty {
  font-size: .72rem;
  white-space: nowrap;
  overflow-wrap: normal;
}
.mood-chip {
  display: inline-flex; align-items: center; gap: .28rem;
  padding: .2rem .55rem .2rem .4rem; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--mood-color, #64748b) 38%, var(--line));
  background: color-mix(in srgb, var(--mood-color, #64748b) 12%, var(--surface));
  color: var(--ink); font-size: .78rem; line-height: 1.2;
  max-width: 100%; min-width: 0;
}
.mood-bar--sm .mood-chip { font-size: .72rem; padding: .14rem .42rem .14rem .32rem; }
.mood-bar--sm .mood-chip__icon { font-size: .9rem; }
/* Header: icon-first round chips; name via title/tooltip only */
.mood-bar--header .mood-chip {
  width: 1.55rem; height: 1.55rem; padding: 0;
  justify-content: center; gap: 0;
  flex: 0 0 auto;
}
.mood-bar--header .mood-chip__name { display: none; }
.mood-bar--header .mood-chip__icon { font-size: .92rem; }
.mood-chip.is-on {
  background: color-mix(in srgb, var(--mood-color, #64748b) 82%, #0f172a);
  border-color: color-mix(in srgb, var(--mood-color, #64748b) 88%, #0f172a);
  color: #fff;
  font-weight: 600;
}
.mood-chip__icon { font-size: .95rem; line-height: 1; flex: 0 0 auto; }
.mood-chip__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 9rem; }
.mood-chip--toggle {
  cursor: pointer; font: inherit; appearance: none; -webkit-appearance: none;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.mood-chip--toggle:hover {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--mood-color, #64748b) 22%, transparent);
}
.mood-chip--toggle:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand) 55%, var(--mood-color, #64748b));
  outline-offset: 1px;
}
.mood-chip--toggle:active { transform: scale(.97); }
.mood-bar__picker {
  flex: 0 0 auto; position: relative; min-width: 0; max-width: 100%;
  margin-inline-start: auto;
}
.mood-bar--header .mood-bar__picker {
  margin-inline-start: 0;
}
/* Overlay popover — must NOT stretch header / flex column height */
.mood-bar__picker[open] {
  z-index: 60;
}
.mood-bar__picker > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: .28rem;
  font-size: .74rem; font-weight: 600; line-height: 1.2;
  padding: .22rem .5rem; border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  max-width: 100%;
  white-space: nowrap;
}
.mood-bar--header .mood-bar__picker > summary {
  font-size: .68rem;
  padding: .14rem .4rem;
  border-radius: 7px;
  background: color-mix(in srgb, var(--line) 55%, var(--surface));
}
.mood-bar__picker > summary::-webkit-details-marker { display: none; }
.mood-bar__picker-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1rem; height: 1rem; font-size: .85rem; line-height: 1;
  color: var(--brand); font-weight: 700;
}
.mood-bar--header .mood-bar__picker-ico { font-size: .78rem; width: .9rem; height: .9rem; }
.mood-bar__picker-txt { font-weight: 600; }
.mood-bar__picker[open] > summary {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.mood-bar__palette {
  display: flex; flex-wrap: wrap; gap: .3rem;
  position: absolute;
  top: calc(100% + .28rem);
  inset-inline-end: 0;
  z-index: 70;
  margin-top: 0; padding: .5rem;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface);
  width: min(17.5rem, 78vw);
  max-width: min(17.5rem, calc(100vw - 1.5rem));
  min-width: 11rem;
  box-sizing: border-box;
  max-height: 11rem; overflow-x: hidden; overflow-y: auto;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .14), 0 1px 3px rgba(15, 23, 42, .06);
}
.mood-bar--header .mood-bar__palette {
  inset-inline-end: auto;
  inset-inline-start: 0;
  width: min(16rem, 82vw);
}
.mood-bar__msg {
  flex: 1 0 100%;
  width: 100%; max-width: 100%;
  font-size: .72rem; margin-top: .15rem;
  color: var(--muted); overflow-wrap: anywhere;
}
.chat-toolbox-body .mood-bar,
.chat-toolbox-panel .mood-bar,
.chat-inbox-main .mood-bar {
  max-width: 100%;
}
.chat-inbox-main .mood-bar--header {
  max-width: 100%;
}
.mood-inbox-icons { display: flex; gap: .2rem; margin-top: .28rem; flex-wrap: wrap; }
.mood-inbox-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.35rem; height: 1.35rem; border-radius: 999px; font-size: .85rem;
  background: color-mix(in srgb, var(--mood-color, #64748b) 18%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--mood-color, #64748b) 35%, var(--line));
}

.chat-coupon-chip, .chat-refund-form-card {
  margin-top: .45rem; padding: .55rem .7rem; border: 1px dashed var(--line);
  border-radius: 10px; background: #f8fafc; font-size: .85rem;
  transform: none !important; zoom: 1 !important;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.chat-coupon-chip:hover,
.chat-coupon-chip:focus-within {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
  box-shadow: 0 2px 10px rgba(15, 23, 42, .06);
  background: #fff;
  transform: none !important;
  zoom: 1 !important;
}
.chat-coupon-code {
  display: inline-block;
  font-family: ui-monospace, Consolas, monospace !important;
  font-size: .95rem !important;
  font-weight: 700 !important;
  letter-spacing: .04em !important;
  line-height: 1.35 !important;
  transform: none !important;
  zoom: 1 !important;
}
.chat-coupon-chip:hover .chat-coupon-code,
.chat-coupon-chip:focus-within .chat-coupon-code,
.chat-coupon-code:hover,
.chat-coupon-code:focus {
  font-size: .95rem !important;
  font-weight: 700 !important;
  letter-spacing: .04em !important;
  line-height: 1.35 !important;
  transform: none !important;
  zoom: 1 !important;
}
.chat-coupon-label, .chat-coupon-meta {
  font-size: .78rem !important;
  font-weight: 400 !important;
  letter-spacing: normal !important;
  line-height: 1.35 !important;
  color: var(--muted);
  margin-top: .2rem;
  transform: none !important;
}
.chat-coupon-chip:hover .chat-coupon-label,
.chat-coupon-chip:hover .chat-coupon-meta,
.chat-coupon-chip:focus-within .chat-coupon-label,
.chat-coupon-chip:focus-within .chat-coupon-meta {
  font-size: .78rem !important;
  font-weight: 400 !important;
  letter-spacing: normal !important;
  line-height: 1.35 !important;
  transform: none !important;
}
.chat-conv-list { display: flex; flex-direction: column; gap: .45rem; max-height: 64vh; overflow: auto; padding: .15rem; }
.chat-conv-item {
  display: block; padding: .75rem .85rem; border: 1px solid transparent; border-radius: var(--radius);
  text-decoration: none; color: inherit; background: #f8fafc;
  transition: background .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease);
}
.chat-conv-item:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); transform: translateY(-1px); }
.chat-conv-item.active {
  border-color: var(--brand); background: var(--brand-soft);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 12%, transparent);
}
.chat-conv-item .meta { font-size: .75rem; color: var(--muted); margin-top: .28rem; }
.live-chat-thread {
  display: flex; flex-direction: column; gap: .65rem;
  flex: 1; max-height: 52vh; overflow: auto; padding: .85rem;
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--brand) 8%, transparent), transparent 40%),
    #f8fafc;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  scroll-behavior: smooth;
}

.chat-reply-composer { margin-top: .5rem; position: relative; overflow: visible; z-index: 2; }
.chat-reply-composer textarea { margin-top: 0; display: block; width: 100%; font-family: inherit, "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.chat-reply-toolbar {
  display: flex; align-items: center; justify-content: flex-start; gap: .5rem; margin-top: .5rem;
  position: relative; overflow: visible; z-index: 3; flex-wrap: wrap;
}
.chat-reply-hint {
  margin-right: auto;
  font-size: .75rem;
  color: var(--muted);
}
.chat-typing-indicator {
  font-size: .82rem;
  color: var(--muted);
  padding: .35rem .15rem .15rem;
  min-height: 1.4rem;
}
.chat-typing-indicator[hidden] { display: none !important; }
.chat-reply-form.is-sending textarea,
#chat-reply-form.is-sending textarea { opacity: .85; }
@media (max-width: 640px) {
  .chat-reply-hint { display: none; }
}
.chat-inbox-main.card { overflow: visible; }
.chat-emoji-wrap { position: relative; overflow: visible; z-index: 4; }
.chat-emoji-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.4rem; height: 2.4rem; padding: 0 .55rem;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; cursor: pointer; font-size: 1.15rem; line-height: 1;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.chat-emoji-btn:hover,
.chat-emoji-wrap.is-open .chat-emoji-btn {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent);
}
.chat-emoji-panel {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  box-sizing: border-box;
  width: min(320px, 92vw);
  max-width: calc(100vw - 16px);
  height: auto;
  max-height: 220px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: repeat(7, 40px);
  grid-auto-rows: 40px;
  justify-content: center;
  align-content: start;
  gap: 4px;
  padding: 8px;
  margin: 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .14);
  z-index: 100000;
  direction: rtl;
  -webkit-overflow-scrolling: touch;
  transform: none !important;
}
body > .chat-emoji-panel,
.chat-emoji-panel.chat-emoji-panel--portal {
  position: fixed !important;
  bottom: auto !important;
  top: auto;
  z-index: 100000 !important;
}
.chat-emoji-panel[hidden] { display: none !important; }
.chat-emoji-item {
  all: unset;
  box-sizing: border-box;
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 40px !important;
  height: 40px !important;
  min-width: 40px;
  min-height: 40px;
  max-width: 40px;
  max-height: 40px;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 8px;
  cursor: pointer;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif !important;
  font-size: 22px !important;
  line-height: 1 !important;
  overflow: hidden;
  text-align: center;
  transform: none !important;
  transition: background .12s ease;
}
.chat-emoji-item:hover,
.chat-emoji-item:focus-visible {
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  transform: none !important;
}
.kanban-toolbar {
  display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; justify-content: space-between;
  margin-bottom: 0;
  flex-shrink: 0;
}
.kanban-toolbar--minimal {
  padding: .65rem .85rem;
  margin-inline: 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.kanban-toolbar__start { flex: 1; min-width: 200px; }
.kanban-filter-input {
  width: 100%;
  max-width: 320px;
  height: 2.25rem;
  padding: 0 .65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
.kanban-sync-toggle {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  margin: 0;
  color: #64748b;
  white-space: nowrap;
}
.kanban-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: .55rem;
  margin: 0;
  overflow: hidden;
}
body.page-kanban .app-shell,
.app-shell:has(.kanban-page) {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
body.page-kanban .sidebar,
.app-shell:has(.kanban-page) .sidebar {
  height: 100dvh;
  max-height: 100dvh;
}
body.page-kanban .topbar,
body.page-kanban .section-tabs {
  flex-shrink: 0;
}
body.page-kanban .main,
.main:has(.kanban-page) {
  flex: 1;
  min-height: 0;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.page-kanban .content,
.content:has(> .kanban-page) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  padding: 1rem 0 .5rem;
}
.kanban-layout--full {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.kanban--full {
  flex: 1;
  min-height: 0;
  min-width: 0;
  height: 100%;
  max-height: 100%;
  align-items: stretch;
}
.kanban--full::before,
.kanban--full::after {
  content: '';
  flex: 0 0 .35rem;
  display: block;
}
.kanban--full .kanban-col {
  flex: 0 0 188px;
  width: 188px;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  align-self: stretch;
  overflow: hidden;
  flex-shrink: 0;
}
.kanban-col__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .3rem;
  padding: .4rem .45rem;
  border-bottom: 1px solid rgba(15, 23, 42, .06);
  border-radius: 8px 8px 0 0;
  flex-shrink: 0;
}
.kanban-col__title {
  flex: 1;
  min-width: 0;
  white-space: normal;
}
.kanban-col__count {
  flex-shrink: 0;
  font-size: .68rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .7);
  line-height: 1.2;
}
.kanban-col--info { background: #f0fdfa; border-color: #99f6e4; }
.kanban-col--info .kanban-col__head { background: #ccfbf1; color: #115e59; }
.kanban-col--warn { background: #fff7ed; border-color: #fed7aa; }
.kanban-col--warn .kanban-col__head { background: #ffedd5; color: #9a3412; }
.kanban-col--ok { background: #f0fdf4; border-color: #bbf7d0; }
.kanban-col--ok .kanban-col__head { background: #dcfce7; color: #166534; }
.kanban-col--danger { background: #fef2f2; border-color: #fecaca; }
.kanban-col--danger .kanban-col__head { background: #fee2e2; color: #991b1b; }
.kanban-side-panel {
  position: fixed;
  top: 4.5rem;
  left: 1rem;
  bottom: 1rem;
  width: min(320px, calc(100vw - 2rem));
  z-index: 45;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: .85rem;
  overflow: auto;
  max-height: none;
}
.kanban-side-panel__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  margin-bottom: .75rem;
}
.kanban-layout {
  display: block;
}
.kanban-layout.no-panel { display: block; }
.kanban-side-panel[hidden] { display: none !important; }
.kanban-card.is-selected { outline: 2px solid var(--brand); background: #f0fdfa; }
.kanban-quick-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin: .75rem 0; }
.kanban-quick-actions button { font-size: .78rem; }

/* Follow-ups */
.followups-page { display: flex; flex-direction: column; gap: .75rem; }
.followups-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}
.followups-head__stats {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.followups-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 4.5rem;
  padding: .45rem .65rem;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: border-color .12s ease, background .12s ease;
}
.followups-stat:hover { border-color: #99f6e4; background: #f0fdfa; }
.followups-stat.is-active { border-color: #0f766e; background: #f0fdfa; }
.followups-stat__val { font-size: 1.15rem; font-weight: 700; line-height: 1.2; color: #0f766e; }
.followups-stat__lbl { font-size: .68rem; color: #64748b; margin-top: .1rem; }
.followups-stat--danger .followups-stat__val { color: #dc2626; }
.followups-stat--muted .followups-stat__val { color: #64748b; }
.followups-head__actions { display: flex; gap: .45rem; flex-wrap: wrap; }
.followups-toolbar {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
  padding: .55rem .7rem;
}
.followups-seg {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: .15rem;
  gap: .1rem;
}
.followups-seg__btn {
  display: inline-block;
  padding: .3rem .55rem;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 600;
  color: #64748b;
  text-decoration: none;
  white-space: nowrap;
  transition: background .12s ease, color .12s ease;
}
.followups-seg__btn:hover { color: #334155; background: rgba(255,255,255,.6); }
.followups-seg__btn.is-active {
  background: #fff;
  color: #0f766e;
  box-shadow: 0 1px 2px rgba(15,23,42,.06);
}
.followups-user-filter select {
  font-size: .78rem;
  padding: .3rem .45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 8rem;
}
.followups-layout {
  display: grid;
  grid-template-columns: 1fr min(300px, 100%);
  gap: .85rem;
  align-items: start;
}
.followups-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.followups-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: .65rem .75rem;
  margin: 0;
}
.followups-card.is-overdue {
  border-color: #fecaca;
  background: linear-gradient(135deg, #fff 0%, #fef2f2 100%);
}
.followups-card.is-done { opacity: .82; }
.followups-card__main { flex: 1; min-width: 0; }
.followups-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .25rem;
}
.followups-card__title {
  margin: 0;
  font-size: .88rem;
  font-weight: 700;
  line-height: 1.35;
  color: #0f172a;
}
.followups-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  justify-content: flex-end;
}
.followups-card__badges .badge { font-size: .65rem; padding: .1rem .35rem; }
.followups-card__notes {
  margin: 0 0 .35rem;
  font-size: .76rem;
  color: #64748b;
  line-height: 1.4;
}
.followups-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .65rem;
  font-size: .75rem;
}
.followups-card__link {
  color: #0f766e;
  text-decoration: none;
  font-weight: 500;
}
.followups-card__link:hover { text-decoration: underline; }
.followups-card__assignee {
  color: #94a3b8;
  font-size: .72rem;
}
.followups-card__assignee::before { content: '· '; }
.followups-card__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .4rem;
  flex-shrink: 0;
}
.followups-card__due {
  font-size: .72rem;
  color: #64748b;
  white-space: nowrap;
}
.followups-card__due.is-overdue { color: #dc2626; font-weight: 700; }
.followups-card__done-form { margin: 0; }
.followups-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: #64748b;
}
.followups-empty p { margin: 0 0 .75rem; }
.followups-compose {
  position: sticky;
  top: 4.5rem;
  padding: .85rem;
}
.followups-compose__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .75rem;
}
.followups-compose__title {
  margin: 0;
  font-size: .95rem;
}
.followups-compose-close { display: none; }
.followups-compose__form .form-row { margin-bottom: .65rem; }
.followups-compose__form .form-row label {
  font-size: .78rem;
  margin-bottom: .2rem;
}
.followups-compose__form input,
.followups-compose__form select,
.followups-compose__form textarea {
  font-size: .85rem;
  padding: .4rem .5rem;
}
.followups-compose-toggle { display: none; }
.followups-list .pager { margin-top: .75rem; }
.followups-card.has-unread-notes {
  border-color: #fca5a5;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, .12);
}
.followups-card__activity {
  margin-top: .5rem;
  border-top: 1px solid #f1f5f9;
  padding-top: .45rem;
}
.followups-card__activity-summary {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}
.followups-note-alert,
.followups-note-new {
  font-size: .62rem;
  padding: .08rem .35rem;
  animation: followups-note-pulse 1.6s ease-in-out infinite;
}
.followups-note.is-unread {
  border-color: #fecaca;
  background: #fff7f7;
}
@keyframes followups-note-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .72; }
}
.followups-card__activity > summary {
  cursor: pointer;
  font-size: .76rem;
  font-weight: 600;
  color: #64748b;
  user-select: none;
}
.followups-card__activity > summary:hover { color: #0f766e; }
.followups-note-list {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  margin: .5rem 0;
  max-height: 12rem;
  overflow-y: auto;
}
.followups-note {
  padding: .45rem .55rem;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}
.followups-note__meta {
  font-size: .68rem;
  color: #94a3b8;
  margin-bottom: .2rem;
}
.followups-note__body {
  font-size: .78rem;
  color: #334155;
  line-height: 1.45;
}
.followups-note-form {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-top: .35rem;
}
.followups-note-form textarea {
  font-size: .8rem;
  padding: .4rem .5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  min-height: 2.5rem;
}
.followups-note-form .btn { align-self: flex-start; }

.order-preview-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: #0f766e;
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}
.order-preview-link:hover { text-decoration: underline; }
button.order-preview-link.btn {
  padding: .25rem .55rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: inherit;
  font-weight: 600;
}
button.order-preview-link.btn:hover { background: #f8fafc; text-decoration: none; }
.orders-num-link.order-preview-link { font-weight: 700; }

@media (max-width: 1023px) {
  .followups-layout { grid-template-columns: 1fr; }
  .followups-compose {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 80;
    margin: 0;
    border-radius: 0;
    max-height: 100dvh;
    overflow-y: auto;
    top: 0;
  }
  .followups-compose.is-open { display: block; }
  .followups-compose-close { display: inline-flex; }
  .followups-compose-toggle { display: inline-flex; }
  .followups-card {
    flex-direction: column;
    gap: .5rem;
  }
  .followups-card__side {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
}

.desk-widgets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.desk-widget h3 { margin: 0 0 .75rem; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.desk-list { list-style: none; padding: 0; margin: 0; }
.desk-list li {
  padding: .55rem 0; border-bottom: 1px dashed var(--line);
  display: flex; justify-content: space-between; gap: .75rem; align-items: start; font-size: .9rem;
}
.desk-list li:last-child { border-bottom: 0; }
.desk-shortcuts { display: flex; flex-wrap: wrap; gap: .5rem; }

@media (max-width: 1100px) {
  .chat-inbox { grid-template-columns: 1fr; }
  .chat-inbox-list, .chat-inbox-main, .chat-inbox-side { min-height: auto; }
  .chat-conv-list { max-height: 240px; }
  .kanban-layout { grid-template-columns: 1fr; }
  .desk-widgets { grid-template-columns: 1fr; }
}

.user-chip {
  display: flex; align-items: center; gap: .5rem; background: #fff;
  border: 1px solid var(--line); border-radius: 999px; padding: .25rem .7rem .25rem .25rem;
}
.user-chip-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.user-chip-link:hover {
  background: var(--brand-soft, #ecfdf5);
  border-color: #99f6e4;
}
.user-chip-link:focus-visible {
  outline: 2px solid var(--brand, #0f766e);
  outline-offset: 2px;
}

.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-dark);
  display: grid; place-items: center; font-weight: 700; font-size: .85rem;
}

.topbar-title-wrap { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.nav-toggle, .sidebar-close, .sidebar-collapse-toggle {
  display: none; border: 1px solid var(--line); background: #fff; border-radius: 10px;
  width: 40px; height: 40px; font-size: 1.15rem; cursor: pointer; color: var(--ink);
  flex-shrink: 0; transition: background .15s var(--ease), border-color .15s var(--ease);
  position: relative;
  z-index: 25;
}
.sidebar-collapse-toggle:hover { background: #f8fafc; border-color: color-mix(in srgb, var(--line) 70%, var(--brand) 30%); }
.sidebar-collapse-toggle[aria-expanded="false"] { color: var(--brand-dark); }
.sidebar-close {
  margin-right: auto; background: rgba(255,255,255,.12); border-color: transparent; color: #fff;
}
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 40;
}

.tabs { display: flex; flex-direction: column; gap: .85rem; }
.tab-nav {
  display: flex; flex-wrap: wrap; gap: .35rem; border-bottom: 1px solid var(--line); padding-bottom: .5rem;
}
.tab-btn {
  border: 1px solid transparent; background: transparent; font-family: inherit;
  padding: .45rem .85rem; border-radius: 999px; cursor: pointer; color: var(--muted); font-size: .88rem;
  transition: color .15s var(--ease), background .15s var(--ease), border-color .15s var(--ease);
}
.tab-btn.active {
  background: var(--brand-soft); color: var(--brand-dark); border-color: color-mix(in srgb, var(--brand) 35%, #fff); font-weight: 700;
}
.tab-btn[data-tab="chat-widget"]:not(.active) {
  border-color: color-mix(in srgb, var(--brand) 35%, #fff); color: var(--brand-dark);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeUp .28s var(--ease); }

/* Settings page: full-width horizontal tabs + content under panels */
.settings-page {
  width: 100%;
  display: block;
}
.settings-page.tabs { gap: 0; }
.settings-shell {
  padding: 0;
  overflow: hidden;
}
.settings-shell:hover {
  transform: none;
  box-shadow: var(--shadow);
}
.settings-tab-bar {
  background: color-mix(in srgb, var(--surface) 92%, var(--brand-soft));
  border-bottom: 1px solid var(--line);
}
.settings-group-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  padding: .55rem .65rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
}
.settings-group-btn {
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, var(--brand-soft));
  color: var(--muted);
  font: inherit;
  font-size: .82rem;
  font-weight: 700;
  padding: .42rem .85rem;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.settings-group-btn:hover {
  color: var(--brand-dark, #0f766e);
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
}
.settings-group-btn.active {
  color: #fff;
  background: var(--brand, #0d9488);
  border-color: color-mix(in srgb, var(--brand) 70%, #000);
}
.settings-tab-nav .tab-btn[hidden] { display: none !important; }
.settings-tab-nav.tab-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: .1rem;
  align-items: stretch;
  border-bottom: none;
  padding: .35rem .65rem 0;
  margin: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--brand) 35%, var(--line)) transparent;
}
.settings-tab-nav::-webkit-scrollbar { height: 4px; }
.settings-tab-nav::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--brand) 35%, var(--line));
  border-radius: 99px;
}
.settings-page .tab-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  border: none;
  border-radius: calc(var(--radius) - 4px) calc(var(--radius) - 4px) 0 0;
  background: transparent;
  padding: .72rem 1rem .78rem;
  margin: 0;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 500;
  position: relative;
  box-shadow: none;
}
.settings-page .tab-btn::after {
  content: "";
  position: absolute;
  right: .55rem;
  left: .55rem;
  bottom: 0;
  height: 2.5px;
  border-radius: 99px 99px 0 0;
  background: transparent;
  transition: background .18s var(--ease);
}
.settings-page .tab-btn:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--brand-soft) 45%, transparent);
}
.settings-page .tab-btn.active {
  color: var(--brand-dark);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  font-weight: 700;
  border-color: transparent;
}
.settings-page .tab-btn.active::after {
  background: var(--brand);
}
.settings-page .tab-btn[data-tab="chat-widget"]:not(.active) {
  border: none;
  color: var(--brand-dark);
}
.settings-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 24rem);
  align-items: start;
  gap: 0;
}
.settings-main {
  min-width: 0;
  padding: 1.15rem 1.25rem 1.35rem;
  border-inline-end: 1px solid var(--line);
}
.settings-aside-stack {
  min-width: 0;
  padding: 1.15rem 1.05rem 1.35rem;
  background: color-mix(in srgb, var(--bg-mid) 70%, var(--surface));
  align-self: stretch;
}
.settings-aside-stack .table-wrap {
  overflow-x: auto;
  max-width: 100%;
}
.settings-aside-stack table {
  min-width: 20rem;
}
.settings-aside-panel h3 {
  margin: 0 0 .65rem;
  font-size: .95rem;
}
.settings-aside-panel[hidden] { display: none !important; }

/* Chat widget settings: full-width when preview tab is open */
.settings-page:has(.tab-panel[data-panel="chat-widget"].active) .settings-body {
  grid-template-columns: 1fr;
}
.settings-page:has(.tab-panel[data-panel="chat-widget"].active) .settings-main {
  border-inline-end: none;
}
.settings-page:has(.tab-panel[data-panel="chat-widget"].active) .settings-aside-stack {
  display: none;
}

@media (max-width: 992px) {
  .settings-body {
    grid-template-columns: 1fr;
  }
  .settings-main {
    border-inline-end: none;
    border-bottom: 1px solid var(--line);
  }
  .settings-aside-stack {
    border-top: 0;
  }
  .settings-page .tab-btn {
    padding: .65rem .85rem .7rem;
    font-size: .82rem;
  }
}

/* Chat widget live preview layout (RTL: form right, sticky preview left) */
.cw-widget-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 1.25rem;
  align-items: start;
}
.cw-widget-form-col { min-width: 0; }
.cw-widget-preview-col {
  min-width: 0;
  position: sticky;
  top: 5.25rem;
  align-self: start;
  z-index: 4;
}
.cw-widget-preview-sticky {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.cw-widget-preview-title {
  margin: 0;
  font-size: .95rem;
}
.cw-widget-preview-hint {
  margin: 0 0 .35rem;
  font-size: .75rem;
  color: #94a3b8;
}
.cw-preview-stage {
  position: relative;
  width: 100%;
  height: 460px;
  max-height: calc(100vh - 9rem);
  border-radius: 18px;
  padding: 1rem .9rem 4.5rem;
  overflow: visible;
  direction: rtl;
  background:
    radial-gradient(ellipse 80% 60% at 50% 20%, rgba(148, 163, 184, .18), transparent 60%),
    linear-gradient(165deg, #1e293b 0%, #0f172a 55%, #111827 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 12px 32px rgba(15, 23, 42, .22);
  border: 1px solid rgba(148, 163, 184, .22);
}
.cw-preview-panel-wrap {
  width: min(268px, 100%);
  margin: 0 auto;
  pointer-events: none;
}
#cw-preview {
  width: 100%;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
  font-family: Vazirmatn, Tahoma, sans-serif;
  background: #fff;
  color: #0f172a;
}
#cw-pv-head {
  padding: 12px 14px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0f766e;
}
#cw-pv-close {
  all: unset;
  box-sizing: border-box;
  margin-inline-start: auto;
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
  color: #fff;
  background: #0f172a;
  opacity: 0.92;
  cursor: default;
  flex-shrink: 0;
}
#cw-pv-av {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(255,255,255,.2);
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 14px;
}
.cw-pv-head-text { min-width: 0; }
#cw-pv-title { font-weight: 700; font-size: 13px; }
#cw-pv-sub { font-size: 11px; opacity: .85; }
#cw-pv-msgs {
  padding: 12px;
  background: #f1f5f9;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#cw-pv-bot {
  align-self: flex-end;
  max-width: 85%;
  padding: 8px 11px;
  border-radius: 14px 14px 14px 4px;
  font-size: 12px;
  background: #ccfbf1;
  border: 1px solid rgba(15,118,110,.15);
}
#cw-pv-user {
  align-self: flex-start;
  max-width: 85%;
  padding: 8px 11px;
  border-radius: 14px 14px 4px 14px;
  font-size: 12px;
  background: #ffedd5;
}
#cw-pv-qr {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.cw-pv-chip {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #99f6e4;
  background: #fff;
  border-radius: 999px;
  color: #0d5f59;
}
.cw-pv-composer {
  padding: 8px 10px;
  display: flex;
  gap: 6px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}
.cw-pv-input-mock {
  flex: 1;
  height: 34px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
#cw-pv-send {
  width: 40px;
  height: 34px;
  border-radius: 10px;
  background: #0f766e;
  flex-shrink: 0;
}
#cw-pv-brand {
  font-size: 9px;
  color: #94a3b8;
  text-align: center;
  padding: 0 8px 8px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
#cw-pv-brand-logo {
  max-height: 14px;
  max-width: 72px;
  width: auto;
  height: auto;
  object-fit: contain;
  vertical-align: middle;
}
#cw-pv-brand-logo[hidden] {
  display: none !important;
}
#cw-pv-brand-text {
  line-height: 1.3;
}

@media (max-width: 1100px) {
  .cw-widget-layout {
    grid-template-columns: 1fr;
  }
  .cw-widget-preview-col {
    position: static;
    order: -1;
    z-index: auto;
  }
  .cw-preview-stage {
    height: 400px;
    max-height: none;
  }
}

.bar-chart { display: flex; flex-direction: column; gap: .45rem; }
.bar-row { display: grid; grid-template-columns: 52px 1fr auto; gap: .5rem; align-items: center; }
.bar-label { font-size: .75rem; color: var(--muted); }
.bar-track { height: 10px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 40%, #fff)); border-radius: 99px; min-width: 2px; }
.bar-value { font-size: .75rem; color: var(--muted); white-space: nowrap; }

.attention-list { list-style: none; padding: 0; margin: .5rem 0 .75rem; font-size: .85rem; }
.attention-list li { padding: .25rem 0; border-bottom: 1px dashed #fed7aa; }
.row-overdue { background: #fff7ed; }
.ticket-sidebar .sidebar-block {
  padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line);
}
.ticket-sidebar .sidebar-block:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.settings-save-bar {
  position: sticky; bottom: 0; background: rgba(255,255,255,.95); padding: .75rem 0;
  border-top: 1px solid var(--line); margin-top: 1rem; z-index: 5;
}
a.card.stat:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 23, 42, .5);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-backdrop[hidden] { display: none !important; }
.modal-dialog {
  background: var(--surface, #fff); color: var(--ink, #0f172a);
  border-radius: 16px; width: min(720px, 100%);
  max-height: min(85vh, 820px); display: flex; flex-direction: column;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .25); border: 1px solid var(--line);
}
.need-editable {
  cursor: pointer; border-radius: 8px; padding: .2rem .35rem; margin: -.2rem -.35rem;
  transition: background .15s var(--ease, ease);
}
.need-editable:hover,
.need-editable:focus {
  background: color-mix(in srgb, var(--brand, #0f766e) 12%, transparent);
  outline: none;
}
.need-editable:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand, #0f766e) 45%, transparent);
}
.need-edit-hint {
  font-size: .68rem; color: var(--muted, #64748b); opacity: 0; transition: opacity .15s;
}
.need-editable:hover .need-edit-hint,
.need-editable:focus .need-edit-hint { opacity: 1; }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.1rem; border-bottom: 1px solid var(--line);
}
.modal-close {
  border: 0; background: transparent; font-size: 1.4rem; cursor: pointer; line-height: 1; color: #64748b;
}
.modal-body { padding: 1rem 1.1rem; overflow: auto; }
.journey-summary {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem;
}
.journey-summary .card { margin: 0; padding: .75rem; }
.journey-timeline { list-style: none; padding: 0; margin: 0; }
.journey-timeline li {
  padding: .65rem 0; border-bottom: 1px dashed var(--line); font-size: .9rem;
}
.journey-timeline .meta { font-size: .78rem; color: #64748b; margin-top: .2rem; }
.journey-badge {
  display: inline-block; font-size: .7rem; padding: .1rem .4rem; border-radius: 6px;
  background: #f1f5f9; color: #334155; margin-left: .35rem;
}
.journey-badge.matomo { background: #ecfeff; color: #0e7490; }
.journey-badge.crm { background: #f0fdf4; color: #166534; }

.coupon-code-row { display: flex; gap: .5rem; align-items: stretch; }
.coupon-code-row input { min-width: 0; }

.page-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.page-head-title { margin: 0; font-size: 1.25rem; }
.page-head-sub { margin: .25rem 0 0; color: var(--muted); font-size: .88rem; }

.coupon-form {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 1fr);
  gap: 1rem;
  align-items: start;
  max-width: none;
  width: 100%;
}
.coupon-col-main { min-width: 0; }
.coupon-col-side { min-width: 0; }
.coupon-span-2 { grid-column: 1 / -1; }
.coupon-section {
  margin: 0;
  height: 100%;
}
.coupon-section h3 {
  margin: 0 0 1rem;
  font-size: .95rem;
  color: var(--ink);
  padding-bottom: .65rem;
  border-bottom: 1px solid var(--line);
}
.field-hint { font-size: .75rem; color: #94a3b8; margin: .35rem 0 0; }
.field-hint.is-error { color: #b91c1c; }
.opt { color: #94a3b8; font-weight: 400; font-size: .8em; }

.code-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .5rem;
  align-items: stretch;
}
.code-field input {
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 600;
  min-width: 0;
}
.code-field .btn { white-space: nowrap; min-width: 7.5rem; }

.option-list {
  display: flex; flex-wrap: wrap; gap: .55rem .9rem;
  padding-top: .25rem;
}
.option-item {
  display: inline-flex; align-items: center; gap: .4rem;
  margin: 0; color: var(--ink); font-size: .88rem; cursor: pointer;
}

.scope-toggle {
  display: flex; flex-wrap: wrap; gap: .5rem;
  margin-bottom: .85rem;
}
.scope-toggle-col { flex-direction: column; align-items: stretch; }
.scope-option {
  display: inline-flex; align-items: center; gap: .4rem;
  margin: 0; padding: .55rem .85rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: #f8fafc; cursor: pointer; font-size: .88rem; color: var(--ink);
}
.scope-option:has(input:checked),
.scope-option.is-active {
  background: var(--brand-soft);
  border-color: #99f6e4;
  font-weight: 600;
}
.picker-block { margin-top: .25rem; }
.multi-select { min-height: 140px; }
#usage-limits.is-disabled { opacity: .45; pointer-events: none; }
.coupon-actions {
  display: flex; gap: .5rem; flex-wrap: wrap;
  padding: .15rem 0 .5rem;
}

@media (max-width: 980px) {
  .coupon-form { grid-template-columns: 1fr; }
  .coupon-span-2 { grid-column: auto; }
}

.entity-picker { display: flex; flex-direction: column; gap: .65rem; }
.entity-picker-selected {
  display: flex; flex-wrap: wrap; gap: .45rem; min-height: 42px;
  padding: .55rem; border: 1px dashed var(--line); border-radius: var(--radius); background: #f8fafc;
}
.entity-picker-empty { color: #94a3b8; font-size: .82rem; padding: .25rem .35rem; }
.entity-chip {
  display: inline-flex; align-items: center; gap: .45rem; max-width: 100%;
  background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .25rem .45rem .25rem .3rem;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.entity-chip img, .entity-result img {
  width: 28px; height: 28px; border-radius: 8px; object-fit: cover; background: #e2e8f0; flex-shrink: 0;
}
.entity-chip-icon {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--brand-soft); font-size: .85rem; flex-shrink: 0;
}
.entity-chip-body { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; padding-left: .15rem; }
.entity-chip-body strong { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.entity-chip-body small { font-size: .68rem; color: var(--muted); }
.entity-chip-remove {
  border: 0; background: #f1f5f9; width: 22px; height: 22px; border-radius: 50%;
  cursor: pointer; color: #64748b; line-height: 1; font-size: 14px;
}
.entity-chip-remove:hover { background: #fee2e2; color: #991b1b; }
.entity-picker-search-wrap { position: relative; }
.entity-picker-results {
  position: absolute; right: 0; left: 0; top: calc(100% + 4px); z-index: 30;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); max-height: 280px; overflow: auto; padding: .35rem;
}
.entity-picker-hint { padding: .75rem; color: var(--muted); font-size: .85rem; text-align: center; }
.entity-result {
  width: 100%; display: flex; align-items: center; gap: .55rem; text-align: right;
  border: 0; background: transparent; padding: .55rem .5rem; border-radius: 10px;
  cursor: pointer; font-family: inherit; color: inherit;
}
.entity-result:hover { background: #f8fafc; }
.entity-result.is-selected { opacity: .65; cursor: default; }
.entity-result .entity-chip-body { flex: 1; }
.entity-result .entity-chip-body strong { max-width: none; white-space: normal; }
.entity-result-badge {
  font-size: .7rem; padding: .15rem .45rem; border-radius: 999px; background: #e2e8f0; color: #475569; flex-shrink: 0;
}
.entity-result-badge.add { background: var(--brand-soft); color: var(--brand-dark); }

/* Analytics filter toolbar: dropdown must sit above KPI cards below */
.analytics-toolbar.card { overflow: visible; position: relative; }
.analytics-toolbar.card.is-picker-open { z-index: 120; }
.analytics-filter-picker .entity-picker-search-wrap { position: relative; z-index: 2; }
.analytics-filter-picker .entity-picker-results { z-index: 130; }
.analytics-picker-portal {
  position: fixed;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 280px;
  overflow: auto;
  padding: .35rem;
}
html.crm-dark .analytics-picker-portal,
html.dark .analytics-picker-portal { background: var(--card, #1e293b); }

/* Searchable combobox (Select2-style multi-select) */
.searchable-combobox { position: relative; width: 100%; }
.scb-control {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem;
  min-height: 2rem; padding: 0.25rem 0.35rem;
  border: 1px solid var(--line, #e2e8f0); border-radius: var(--radius, .45rem);
  background: #fff;
}
.scb-chips { display: contents; }
.scb-empty { color: #94a3b8; font-size: .78rem; padding: 0 .15rem; white-space: nowrap; }
.scb-input {
  flex: 1 1 120px; min-width: 100px; border: 0; background: transparent;
  font: inherit; font-size: .8125rem; padding: .2rem .15rem; outline: none;
}
.scb-chip {
  display: inline-flex; align-items: center; gap: .25rem; max-width: 100%;
  background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 999px;
  padding: .12rem .35rem .12rem .25rem; font-size: .75rem; line-height: 1.2;
}
.scb-chip-icon { font-size: .72rem; flex-shrink: 0; }
.scb-chip-label { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scb-chip-remove {
  border: 0; background: transparent; width: 16px; height: 16px; border-radius: 50%;
  cursor: pointer; color: #64748b; line-height: 1; font-size: 13px; padding: 0;
}
.scb-chip-remove:hover { background: #fee2e2; color: #991b1b; }
.scb-dropdown {
  position: fixed; background: #fff; border: 1px solid var(--line, #e2e8f0);
  border-radius: var(--radius, .45rem); box-shadow: var(--shadow-lg);
  max-height: 200px; overflow: auto; padding: .25rem; font-size: 0.8125rem; z-index: 10050;
}
.scb-dropdown--compact .scb-option { padding: 0.35rem 0.5rem; }
.scb-dropdown--grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px;
}
.scb-option {
  display: flex; flex-direction: column; align-items: flex-start; gap: .1rem;
  width: 100%; text-align: right; border: 0; background: transparent;
  border-radius: .35rem; cursor: pointer; font-family: inherit; color: inherit;
}
.scb-option:hover { background: #f8fafc; }
.scb-option.is-selected { opacity: .7; cursor: default; }
.scb-option-label { font-size: .8125rem; line-height: 1.25; }
.scb-option-meta { font-size: .68rem; color: var(--muted, #64748b); }
.scb-option-badge { font-size: .65rem; color: var(--brand, #0d9488); margin-top: .1rem; }
.scb-hint { padding: .5rem; color: var(--muted, #64748b); font-size: .78rem; text-align: center; }
.analytics-filter-scb .scb-control { background: #f8fafc; }
html.crm-dark .scb-control,
html.dark .scb-control { background: var(--card, #1e293b); border-color: var(--line, #334155); }
html.crm-dark .scb-dropdown,
html.dark .scb-dropdown { background: var(--card, #1e293b); }
html.crm-dark .scb-chip,
html.dark .scb-chip { background: #334155; border-color: #475569; }

@media (min-width: 961px) {
  .sidebar-collapse-toggle { display: inline-grid; place-items: center; }
  body.sidebar-collapsed .sidebar {
    width: 72px;
    padding: 1.15rem .45rem;
    overflow: visible;
    transition: width .22s var(--ease), padding .22s var(--ease);
  }
  .sidebar { transition: width .22s var(--ease), padding .22s var(--ease); }
  body.sidebar-collapsed .brand {
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    padding: .45rem .25rem 1rem;
  }
  body.sidebar-collapsed .brand-meta,
  body.sidebar-collapsed .nav-link-text,
  body.sidebar-collapsed .nav-section-label,
  body.sidebar-collapsed .nav-section-caret,
  body.sidebar-collapsed .nav-catalog-cta .nav-link-text,
  body.sidebar-collapsed .nav-catalog-cta-ext,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .badge { display: none; }
  body.sidebar-collapsed .nav a,
  body.sidebar-collapsed .nav-link,
  body.sidebar-collapsed .nav-section-btn,
  body.sidebar-collapsed .nav-catalog-cta {
    justify-content: center;
    padding-inline: .5rem;
    gap: 0;
  }
  body.sidebar-collapsed .nav a:hover,
  body.sidebar-collapsed .nav-link:hover,
  body.sidebar-collapsed .nav-section-btn:hover { transform: none; }
  body.sidebar-collapsed .nav a.active,
  body.sidebar-collapsed .nav-link.active {
    box-shadow: inset 0 -3px 0 color-mix(in srgb, #fff 70%, var(--brand));
  }
  body.sidebar-collapsed .nav-section { position: relative; }
  body.sidebar-collapsed .nav-section.is-open > .nav-section-body { display: none; }
  body.sidebar-collapsed .nav-section:hover > .nav-section-body,
  body.sidebar-collapsed .nav-section:focus-within > .nav-section-body {
    display: block;
    position: absolute;
    top: 0;
    right: calc(100% + 8px);
    left: auto;
    min-width: 220px;
    padding: .45rem .35rem;
    background: linear-gradient(175deg, var(--sidebar) 0%, var(--sidebar-end) 100%);
    border-radius: calc(var(--radius) - 2px);
    box-shadow: -6px 8px 28px rgba(0, 0, 0, .28);
    z-index: 60;
  }
  body.sidebar-collapsed .nav-section:hover > .nav-section-body .nav-link,
  body.sidebar-collapsed .nav-section:focus-within > .nav-section-body .nav-link {
    justify-content: flex-start;
    gap: .65rem;
    padding: .55rem .75rem;
  }
  body.sidebar-collapsed .nav-section:hover > .nav-section-body .nav-link-text,
  body.sidebar-collapsed .nav-section:focus-within > .nav-section-body .nav-link-text { display: block; flex: 1; }
  body.sidebar-collapsed .nav-section:hover > .nav-section-body .badge,
  body.sidebar-collapsed .nav-section:focus-within > .nav-section-body .badge { display: inline-flex; }
}

@media (max-width: 960px) {
  .app-shell {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }
  .main {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
  }
  .nav-toggle { display: inline-grid; place-items: center; }
  .sidebar-collapse-toggle { display: none !important; }
  .sidebar-close { display: inline-grid; place-items: center; }
  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-end: 0;
    left: auto;
    width: min(300px, 86vw);
    max-width: 86vw;
    height: 100dvh;
    z-index: 50;
    transform: translate3d(100%, 0, 0);
    visibility: hidden;
    pointer-events: none;
    transition: transform .22s ease, visibility .22s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar.is-open {
    transform: translate3d(0, 0, 0);
    visibility: visible;
    pointer-events: auto;
  }
  body.sidebar-collapsed .sidebar {
    width: min(300px, 86vw);
    padding: 1.15rem .85rem;
    overflow-y: auto;
  }
  body.sidebar-collapsed .brand-meta,
  body.sidebar-collapsed .nav-link-text,
  body.sidebar-collapsed .nav-section-label,
  body.sidebar-collapsed .nav-section-caret,
  body.sidebar-collapsed .nav-catalog-cta .nav-link-text,
  body.sidebar-collapsed .nav-catalog-cta-ext,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .badge {
    display: revert;
  }
  body.sidebar-collapsed .nav a,
  body.sidebar-collapsed .nav-link,
  body.sidebar-collapsed .nav-section-btn,
  body.sidebar-collapsed .nav-catalog-cta {
    justify-content: flex-start;
    gap: .65rem;
    padding: .55rem .75rem;
  }
  .sidebar-backdrop.is-visible { display: block; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row.two { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 40px 1fr auto; }
  .journey-summary { grid-template-columns: 1fr; }
  .kanban {
    padding-inline: .75rem;
    scroll-snap-type: none;
    padding-bottom: .75rem;
  }
  .kanban-col {
    flex: 0 0 min(72vw, 188px);
    width: min(72vw, 188px);
    min-height: 0;
    max-height: 100%;
  }
  .kanban-col-body { min-height: 0; max-height: none; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .topbar {
    flex-wrap: nowrap;
    align-items: center;
    gap: .5rem;
    padding: .65rem .85rem;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: clip;
  }
  .topbar-title-wrap {
    flex: 1 1 0%;
    min-width: 0;
    max-width: none;
    overflow: hidden;
  }
  .topbar-title-wrap > div {
    min-width: 0;
    overflow: hidden;
  }
  .nav-toggle {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    z-index: 25;
  }
  .topbar h1,
  .topbar .page-title {
    font-size: 1rem;
    line-height: 1.35;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar h1.page-title .help-tip,
  .topbar h1.page-title .settings-link {
    display: none !important;
  }
  .topbar-section {
    display: none;
  }
  .section-tabs {
    max-width: 100%;
    overflow-x: clip;
    padding-inline: .75rem;
    box-sizing: border-box;
  }
  .section-tabs-inner {
    max-width: 100%;
  }
  .content { padding: 1rem; }
  .topbar-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: .35rem;
    max-width: none;
    min-width: 0;
    overflow-x: clip;
    order: unset;
    padding-top: 0;
    margin-top: 0;
    border-top: none;
  }
  .topbar-actions .topbar-extra,
  .topbar-actions form.topbar-extra,
  .topbar-actions .topbar-tenant-form,
  .topbar-actions .topbar-tenant-select,
  .topbar-actions select[name="tenant_id"],
  .topbar-actions .tenant-chip,
  .topbar-actions .plan-chip,
  .topbar-actions .sms-credit-chip,
  .topbar-actions a.btn-secondary.topbar-extra {
    display: none !important;
  }
  .topbar-actions .user-chip div:last-child,
  .topbar-actions .user-chip strong {
    display: none;
  }
  .topbar-actions .user-chip-link {
    padding: .2rem;
    border-radius: 50%;
  }
  .topbar-actions .user-chip-link .avatar { margin: 0; }
  .topbar-actions .topbar-logout-form .btn {
    padding: .35rem .55rem;
    font-size: .74rem;
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  .topbar h1,
  .topbar .page-title {
    font-size: .92rem;
  }
}

/* Order line items — spreadsheet-style columns */
.cell-ellipsis {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.cell-ellipsis--sm { font-size: .75rem; color: #64748b; max-width: 8rem; }
.order-lines-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.order-lines-table th,
.order-lines-table td { padding: .45rem .5rem; vertical-align: middle; border-bottom: 1px solid var(--line, #e2e8f0); }
.order-lines-table thead th { font-size: .8rem; color: #64748b; background: #f8fafc; white-space: nowrap; }
.order-lines-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.order-lines-table:not(.order-lines-table--edit) .ol-col-num { width: 3rem; text-align: center; }
.order-lines-table:not(.order-lines-table--edit) .ol-col-product { width: 38%; min-width: 10rem; }
.order-lines-table:not(.order-lines-table--edit) .ol-col-qty { width: 5.5rem; }
.order-lines-table:not(.order-lines-table--edit) .ol-col-price { width: 7.5rem; }
.order-lines-table:not(.order-lines-table--edit) .ol-col-total { width: 7rem; }
.order-lines-table:not(.order-lines-table--edit) .ol-col-status { width: 8rem; }
.order-lines-table:not(.order-lines-table--edit) .ol-col-actions { width: 2.5rem; text-align: center; }
.order-lines-table .ol-qty,
.order-lines-table .ol-price { width: 100%; max-width: 100%; box-sizing: border-box; }
.order-lines-table .ol-name-display { font-size: .85rem; color: #334155; margin-top: .2rem; max-width: 100%; }
.order-lines-table .order-line-name { font-weight: 600; max-width: 100%; }
.order-lines-inline { max-width: 14rem; }
.order-lines-inline-list { margin: 0; padding: 0; list-style: none; font-size: .85rem; }
.order-lines-inline-list li { margin: .2rem 0; display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.order-lines-inline-list .order-line-name { max-width: 9rem; }
.orders-bulk-bar { border: 1px solid #bae6fd; background: #f0f9ff; }

.orders-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.orders-table {
  table-layout: fixed;
  min-width: 900px;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.orders-table th,
.orders-table td {
  vertical-align: middle;
  overflow: hidden;
  padding: .6rem .55rem;
  line-height: 1.4;
}
.orders-table thead th {
  font-size: .78rem;
  white-space: nowrap;
  background: #f1f5f9;
}
.orders-table .badge {
  font-size: .68rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}
.orders-col-check { width: 2.5rem; }
.orders-col-num { width: 7rem; }
.orders-col-customer { width: 16rem; }
.orders-col-status { width: 7rem; }
.orders-col-payment { width: 7.5rem; }
.orders-col-items { width: 4rem; text-align: center; }
.orders-col-total { width: 7rem; }
.orders-col-date { width: 5.5rem; font-size: .8rem; }
.orders-num-link { font-weight: 700; white-space: nowrap; display: inline-block; }
.orders-channel-tag {
  display: block;
  margin-top: .2rem;
  font-size: .68rem;
  font-weight: 600;
  line-height: 1.2;
}
.orders-channel-tag.orders-channel--catalog { color: #0f766e; }
.orders-channel-tag.orders-channel--manual { color: #3730a3; }
.orders-channel-tag.orders-channel--wc { color: #64748b; }
.order-new-badge {
  display: inline-block;
  margin-top: .15rem;
  background: #0f766e !important;
  color: #fff !important;
  font-size: .62rem !important;
}
.orders-cell-ellipsis {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .82rem;
  color: #475569;
}
.orders-total-cell { font-weight: 700; white-space: nowrap; }
.order-customer-cell__inner {
  display: flex;
  align-items: center;
  gap: .4rem;
  min-width: 0;
  max-width: 100%;
}
.order-preview-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color .15s, color .15s, background .15s;
}
.order-preview-btn:hover {
  border-color: #0f766e;
  color: #0f766e;
  background: #f0fdfa;
}
.order-preview-btn svg { pointer-events: none; }
.order-customer-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.order-items-count__badge {
  display: inline-block;
  padding: .15rem .45rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: .76rem;
  font-weight: 600;
  white-space: nowrap;
}
body.order-preview-open { overflow: hidden; }
.order-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.order-preview-modal.is-open { display: flex !important; }
.order-preview-modal[hidden]:not(.is-open) { display: none !important; }
.order-preview-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .45);
}
.order-preview-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
  overflow: hidden;
}
.order-preview-modal__header,
.order-preview-modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .9rem 1.1rem;
  background: #fff;
  flex-shrink: 0;
}
.order-preview-modal__header {
  border-bottom: 1px solid #e2e8f0;
}
.order-preview-modal__footer {
  border-top: 1px solid #e2e8f0;
}
.order-preview-modal__footer-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.order-preview-modal__title {
  margin: 0;
  font-size: 1.05rem;
}
.order-preview-modal__sub {
  margin: .35rem 0 0;
  color: #64748b;
  font-size: .84rem;
}
.order-preview-modal__close {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: #f1f5f9;
  color: #334155;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.order-preview-modal__body {
  padding: 1rem 1.1rem;
  overflow: auto;
}
.order-preview-modal__loading,
.order-preview-error,
.order-preview-empty {
  color: #64748b;
  margin: 0;
}
.order-preview-error { color: #b91c1c; }
.order-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}
.order-preview-panel {
  padding: .85rem .95rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}
.order-preview-panel h4,
.order-preview-items h4 {
  margin: 0 0 .55rem;
  font-size: .9rem;
}
.order-preview-panel p {
  margin: .25rem 0;
  font-size: .86rem;
  line-height: 1.55;
}
.order-preview-customer {
  font-weight: 700;
  font-size: .95rem !important;
}
.order-preview-label {
  color: #64748b;
  font-size: .78rem;
  margin-left: .25rem;
}
.order-preview-note {
  margin-top: .45rem !important;
  padding-top: .45rem;
  border-top: 1px dashed #cbd5e1;
}
.order-preview-total strong {
  color: #0f766e;
  font-size: 1rem;
}
.order-preview-items-table-wrap {
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.order-preview-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .86rem;
}
.order-preview-items-table th,
.order-preview-items-table td {
  padding: .5rem .6rem;
  border-bottom: 1px solid #e2e8f0;
  text-align: right;
  vertical-align: top;
}
.order-preview-items-table thead th {
  background: #f8fafc;
  color: #64748b;
  font-size: .78rem;
  white-space: nowrap;
}
.order-preview-item-name {
  min-width: 12rem;
}
.order-preview-sku {
  color: #64748b;
  font-size: .76rem;
  margin-top: .15rem;
}
.order-preview-hint {
  margin: .55rem 0 0;
  color: #64748b;
  font-size: .8rem;
}
@media (max-width: 720px) {
  .order-preview-grid { grid-template-columns: 1fr; }
}

/* Order detail page layout */
.order-detail-page { display: flex; flex-direction: column; gap: 1rem; }
.order-detail-stats { margin-bottom: 0; }
.order-detail-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.order-detail-sidebar {
  padding: 1rem;
  position: sticky;
  top: .75rem;
}
.order-detail-sidebar__head { margin-bottom: .85rem; }
.order-detail-title {
  margin: 0;
  font-size: 1.05rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
}
.order-detail-channel {
  background: #ccfbf1;
  color: #115e59;
  font-size: .72rem;
  font-weight: 700;
}
.order-detail-date {
  margin: .35rem 0 0;
  font-size: .82rem;
  color: #64748b;
}
.order-detail-dl {
  display: grid;
  grid-template-columns: minmax(72px, 34%) 1fr;
  gap: .4rem .65rem;
  margin: 0 0 .85rem;
  font-size: .88rem;
}
.order-detail-dl dt {
  margin: 0;
  color: #64748b;
  font-weight: 600;
}
.order-detail-dl dd { margin: 0; color: var(--ink, #0f172a); word-break: break-word; }
.order-detail-link { margin: 0 0 .85rem; font-size: .85rem; }
.order-detail-status-form {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  margin-bottom: .85rem;
  padding-top: .85rem;
  border-top: 1px solid var(--line, #e2e8f0);
}
.order-detail-status-form label {
  font-size: .8rem;
  color: #64748b;
  font-weight: 600;
}
.order-detail-alert { margin: .65rem 0; font-size: .84rem; }
.order-detail-erp {
  font-size: .82rem;
  color: #64748b;
  margin: 0 0 .85rem;
  line-height: 1.5;
}
.order-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  padding-top: .85rem;
  border-top: 1px solid var(--line, #e2e8f0);
}
.order-detail-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

/* Order detail — lines table */
.order-detail-lines-wrap { border-radius: 0 0 14px 14px; }
.order-detail-lines-table thead th {
  padding: .65rem .85rem;
  font-size: .78rem;
  text-transform: none;
  letter-spacing: 0;
  border-bottom: 2px solid #e2e8f0;
}
.order-detail-lines-table tbody td {
  padding: .75rem .85rem;
  vertical-align: middle;
}
.order-detail-lines-table .ol-col-product { width: 44%; min-width: 12rem; }
.order-detail-lines-table .ol-col-price { width: 11%; }
.order-detail-lines-table .ol-col-qty { width: 8%; text-align: center; }
.order-detail-lines-table .ol-col-total { width: 11%; }
.order-detail-lines-table .ol-col-status { width: 14%; }
.order-detail-lines-table tbody tr.odi-line:hover td { background: #f8fafc; }
.odi-product {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}
.odi-thumb {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}
.odi-thumb--empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #94a3b8;
}
.odi-product__body { min-width: 0; flex: 1; }
.odi-product__name {
  font-weight: 600;
  font-size: .9rem;
  color: var(--ink, #0f172a);
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.odi-product__name:hover { color: #0f766e; }
.odi-sku {
  font-size: .74rem;
  color: #94a3b8;
  margin-top: .15rem;
}
.odi-money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.odi-qty { font-weight: 600; color: #334155; }
.odi-line-total { font-weight: 700; color: #0f766e; }
.odi-foot td {
  padding: .85rem;
  background: #f8fafc;
  border-top: 2px solid #e2e8f0;
  font-weight: 600;
}
.odi-foot__label { text-align: left; color: #64748b; font-size: .88rem; }
.odi-foot__total { font-size: 1rem; color: #0f766e; }

/* Order notes card */
.order-notes-card { padding: 1rem; }
.order-notes-card__title { margin: 0 0 .75rem; font-size: .95rem; }
.order-notes-form { margin-bottom: .85rem; }
.order-notes-form textarea { width: 100%; margin-bottom: .45rem; }
.order-notes-form__check {
  display: flex;
  gap: .4rem;
  align-items: center;
  margin: 0 0 .5rem;
  font-size: .85rem;
  color: #64748b;
}
.order-notes-list { display: flex; flex-direction: column; gap: .55rem; }
.order-note {
  padding: .65rem .75rem;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}
.order-note__meta {
  color: #64748b;
  font-size: .74rem;
  margin-bottom: .35rem;
}
.order-note__sync {
  margin-inline-start: .35rem;
  padding: .1rem .35rem;
  border-radius: 4px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: .68rem;
}
.order-note__body { font-size: .88rem; line-height: 1.55; }
.order-notes-empty {
  margin: 0;
  color: #94a3b8;
  font-size: .88rem;
  text-align: center;
  padding: .75rem;
}
.order-items-edit-sticky__end {
  display: flex;
  gap: .65rem;
  align-items: center;
  flex-wrap: wrap;
}
.order-items-edit-subtotal {
  font-size: .88rem;
  color: #64748b;
}
.order-items-edit-subtotal strong { color: #0f766e; }

@media (max-width: 960px) {
  .order-detail-layout { grid-template-columns: 1fr; }
  .order-detail-sidebar { position: static; }
}
@media (max-width: 720px) {
  .order-detail-lines-table .ol-col-price,
  .order-detail-lines-table .ol-col-status { display: none; }
  .order-detail-lines-table .ol-col-product { width: auto; }
}

/* Order detail — items (legacy card rows) */
.order-items-card {
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}
.order-items-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
  flex-wrap: wrap;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--line, #e2e8f0);
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}
.order-items-card__head h3 { margin: 0; font-size: 1rem; }
.order-items-card__hint {
  margin: .25rem 0 0;
  font-size: .82rem;
  color: #64748b;
}
.order-items-card__total {
  font-size: .9rem;
  color: #64748b;
  white-space: nowrap;
}
.order-items-card__total strong {
  display: block;
  font-size: 1.1rem;
  color: #0f766e;
  margin-top: .1rem;
}
.order-items-list { display: flex; flex-direction: column; }
.order-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .65rem;
  align-items: center;
  padding: .85rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  border-right: 3px solid #0f766e;
  background: #fff;
  transition: background .12s, box-shadow .12s;
}
.order-item-row:last-child { border-bottom: none; }
.order-item-row:hover {
  background: #f8fafc;
  box-shadow: inset 0 0 0 1px #e2e8f0;
}
.order-item-row__main {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  min-width: 0;
}
.order-item-row__num {
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 8px;
  background: #f1f5f9;
  color: #64748b;
  font-size: .75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.order-item-row__info { min-width: 0; flex: 1; }
.order-item-row__name {
  font-weight: 600;
  font-size: .92rem;
  color: var(--ink, #0f172a);
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-item-row__name:hover { color: #0f766e; }
.order-item-row__sku {
  font-size: .74rem;
  color: #94a3b8;
  margin-top: .15rem;
}
.order-item-row__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .25rem;
  flex-shrink: 0;
}
.order-item-row__qty {
  font-size: .8rem;
  color: #64748b;
}
.order-item-row__price {
  font-weight: 700;
  font-size: .9rem;
  white-space: nowrap;
}
.order-items-empty {
  padding: 1.5rem;
  text-align: center;
  color: #94a3b8;
  font-size: .9rem;
}
.order-items-edit-wrap {
  padding: .85rem 1rem 1rem;
}
.order-items-edit-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .65rem;
}
.order-items-edit-sticky {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: .85rem;
  padding: .75rem 1rem;
  margin-inline: -1rem -1rem;
  margin-bottom: -1rem;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -8px 24px rgba(15, 23, 42, .06);
}
.order-lines-table.order-lines-table--edit {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}
.order-lines-table.order-lines-table--edit th,
.order-lines-table.order-lines-table--edit td {
  padding: .4rem .35rem;
  vertical-align: middle;
  min-width: 0;
  box-sizing: border-box;
}
.order-lines-table.order-lines-table--edit thead th {
  padding: .5rem .35rem;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
  background: #f8fafc;
  border-bottom: 1px solid var(--line, #e2e8f0);
}
.order-lines-table.order-lines-table--edit thead th.ol-col-product,
.order-lines-table.order-lines-table--edit .ol-col-product {
  text-align: right;
}
.order-lines-table.order-lines-table--edit .ol-col-num {
  text-align: center;
}
.order-lines-table.order-lines-table--edit .ol-col-qty,
.order-lines-table.order-lines-table--edit .ol-col-price,
.order-lines-table.order-lines-table--edit .ol-col-total,
.order-lines-table.order-lines-table--edit .ol-col-actions {
  text-align: center;
}
.order-lines-table.order-lines-table--edit .ol-product-cell {
  display: block;
  min-width: 0;
  width: 100%;
}
.order-lines-table.order-lines-table--edit .ol-product-cell .ol-search {
  display: block;
  width: 100%;
  height: 2.25rem;
  box-sizing: border-box;
  font-size: .875rem;
  padding: 0 .5rem;
  margin: 0;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  background: #fff;
}
.order-lines-table.order-lines-table--edit tr.ol-row-has-product .ol-search {
  display: none;
}
.order-lines-table.order-lines-table--edit tr:not(.ol-row-has-product) .ol-selected {
  display: none !important;
}
.order-lines-table.order-lines-table--edit tr.ol-row-has-product .ol-selected {
  display: flex;
}
.order-lines-table.order-lines-table--edit .ol-selected,
.order-lines-table.order-lines-table--edit .ep-selected.ol-selected {
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
  margin: 0;
  padding: 0 .5rem;
  width: 100%;
  height: 2.25rem;
  box-sizing: border-box;
  font-size: .8rem;
  line-height: 1.35;
  color: #0f766e;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: 8px;
}
.order-lines-table.order-lines-table--edit .ol-selected-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-lines-table.order-lines-table--edit .ol-clear-product {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  font-size: .95rem;
  line-height: 1;
  padding: 0;
}
.order-lines-table.order-lines-table--edit .ol-clear-product:hover {
  background: #fee2e2;
  color: #b91c1c;
}
.order-lines-table.order-lines-table--edit .ol-qty-stepper {
  display: grid;
  grid-template-columns: 1.65rem minmax(0, 1fr) 1.65rem;
  align-items: stretch;
  width: 100%;
  max-width: 9rem;
  margin-inline: auto;
  height: 2.25rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-sizing: border-box;
}
.order-lines-table.order-lines-table--edit .ol-qty-stepper button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border: none;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}
.order-lines-table.order-lines-table--edit .ol-qty-stepper button:hover {
  background: #ecfdf5;
  color: #0f766e;
}
.order-lines-table.order-lines-table--edit .ol-qty-stepper .ol-qty {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: none;
  border-radius: 0;
  border-inline: 1px solid #e2e8f0;
  text-align: center;
  padding: 0 .1rem;
  font-size: .875rem;
  -moz-appearance: textfield;
  appearance: textfield;
  box-sizing: border-box;
}
.order-lines-table.order-lines-table--edit .ol-qty-stepper .ol-qty::-webkit-outer-spin-button,
.order-lines-table.order-lines-table--edit .ol-qty-stepper .ol-qty::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.order-lines-table.order-lines-table--edit .ol-price {
  display: block;
  width: 100%;
  max-width: 9rem;
  margin-inline: auto;
  height: 2.25rem;
  box-sizing: border-box;
  padding: 0 .45rem;
  margin-top: 0;
  margin-bottom: 0;
  font-size: .875rem;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  text-align: center;
}
.order-lines-table.order-lines-table--edit .ol-line-total {
  display: block;
  text-align: center;
  font-weight: 600;
  color: #0f766e;
  font-variant-numeric: tabular-nums;
  line-height: 2.25rem;
}
.order-lines-table.order-lines-table--edit .ol-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2.25rem;
  padding: 0;
  min-width: 0;
  margin: 0 auto;
}
.order-lines-table.order-lines-table--edit tbody tr {
  background: #fff;
}
.order-lines-table.order-lines-table--edit tbody tr:hover td {
  background: #f8fafc;
}
.order-lines-table:not(.order-lines-table--edit) .ol-qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.order-lines-table:not(.order-lines-table--edit) .ol-qty-stepper button {
  width: 1.75rem;
  height: 2rem;
  border: none;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.order-lines-table:not(.order-lines-table--edit) .ol-qty-stepper button:hover { background: #ecfdf5; color: #0f766e; }
.order-lines-table:not(.order-lines-table--edit) .ol-qty-stepper .ol-qty {
  width: 3.25rem;
  border: none;
  border-radius: 0;
  text-align: center;
  padding: .35rem .25rem;
}
.order-lines-table .ol-remove {
  min-width: 2rem;
  color: #b91c1c !important;
  border-color: #fecaca !important;
}
.order-pending-banner {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .75rem;
  margin-bottom: .75rem;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: .84rem;
}

/* Profile */
.profile-dl {
  display: grid;
  grid-template-columns: minmax(120px, 38%) 1fr;
  gap: .45rem .75rem;
  margin: 0;
  font-size: .9rem;
}
.profile-dl dt {
  margin: 0;
  color: var(--muted, #64748b);
  font-weight: 600;
}
.profile-dl dd {
  margin: 0;
  color: var(--ink, #0f172a);
}
.profile-pill {
  display: inline-block;
  font-size: .78rem;
  font-weight: 700;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
}
.profile-form-card { max-width: 520px; }
.profile-password-form .form-row:last-of-type { margin-bottom: 0; }
.profile-form-actions {
  margin-top: 1.25rem;
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
}

/* —— Responsive tables & forms (portal) —— */
.content .table-wrap,
.content .table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.content .card:has(table.table),
.content .card:has(> .table),
.content .card:has(> table),
.content .tab-panel:has(table.table) {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.content .card table.table,
.content .card > .table,
.content .card > table.table {
  min-width: 28rem;
}
.topbar-tenant-form {
  display: flex;
  align-items: center;
  gap: .35rem;
}
.topbar-actions select.form-control[name="tenant_id"],
.topbar-tenant-select {
  min-width: 0 !important;
  max-width: 8.5rem;
  font-size: .8rem;
  padding: .25rem .4rem;
}
.cw-widget-layout {
  grid-template-columns: minmax(0, 1fr);
}
.cw-widget-preview-col {
  position: static;
  order: -1;
}
@media (max-width: 992px) {
  .cw-widget-layout {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 480px) {
  .content { padding: .75rem; }
  .topbar { padding: .55rem .65rem; }
  .card { padding: .75rem .85rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
