/*
 * ZynTrail — интерактивно демо на продукта.
 *
 * Стиловете тук са ПРЕНЕСЕНИ от приложението, не измислени по мотиви от него:
 *
 *   frontend/src/app/globals.css                          токени, .btn, .status-dot
 *   frontend/src/components/Sidebar/Sidebar.module.css    менюто вляво
 *   frontend/src/components/Header/Header.module.css      горната лента
 *   frontend/src/components/AdminLayout/AdminLayout.module.css  (20px 24px)
 *   frontend/src/components/ui/PageHeader.module.css      заглавието на страница
 *   frontend/src/app/page.module.css                      карти, табове, таблица
 *
 * Стойностите са преписани оттам. Сменят ли се там, сменят се и тук — това е
 * втори екземпляр на същата палитра, не неин наследник.
 *
 * Собствени на демото са само лентата за смяна на ролята (.demobar), която е
 * на сайта, а не на продукта, и графиките, които тук са чист SVG.
 */

/* ─── Токени (globals.css) ───────────────────────────────────────────────── */
:root {
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 8px;

  --transition-fast: .15s cubic-bezier(.4, 0, .2, 1);
  --transition-normal: .25s cubic-bezier(.4, 0, .2, 1);

  --sidebar-width: 260px;
  --header-height: 64px;
  /* Панелът взема 48% от ширината, между 520 и 780. Долната граница е за
     кореспонденцията — под нея мехурчетата стават на две думи на ред; горната
     е границата на продукта (min(780px, 94vw) в globals.css). Списъкът зад
     панела се сбива, вместо да се скролира настрани — виж правилата за
     .app.drawer-open по-долу. */
  --drawer-width: clamp(520px, 48vw, 780px);

  --space-2: 8px;

  --font-sans: 'Golos Text', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;

  --accent: #1675C4;
  --primary-hover: #11609F;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
}

.app[data-theme="dark"] {
  --bg-primary: #0b0f19;
  --bg-secondary: #0f1522;
  --bg-tertiary: #1c283b;
  --bg-sidebar: #080c14;
  --bg-sidebar-hover: #111826;
  --bg-sidebar-active: #172131;

  --text-primary: #f1f5f9;
  --text-secondary: #a3adbd;
  --text-muted: #8a94a6;
  --text-sidebar: #a3adbd;
  --accent-text: #5DB0F2;

  --accent-light: rgba(22, 117, 196, .16);
  --success-light: rgba(16, 185, 129, .14);
  --warning-light: rgba(245, 158, 11, .14);
  --danger-light: rgba(239, 68, 68, .14);
  --info-light: rgba(59, 130, 246, .14);

  --border: #243047;
  --border-light: #1a2436;

  --input-bg: #0b1019;
  --input-border: #34425a;
  --input-border-hover: #46577a;

  --shadow-lg: 0 12px 28px rgba(0, 0, 0, .45);
}

.app[data-theme="light"] {
  --bg-primary: #F7F8FA;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #EEF1F5;
  /* Менюто остава тъмно и в светлата тема — както в приложението. */
  --bg-sidebar: #080c14;
  --bg-sidebar-hover: #111826;
  --bg-sidebar-active: #172131;

  --text-primary: #16191F;
  --text-secondary: #4B5563;
  --text-muted: #6B7280;
  --text-sidebar: #a3adbd;
  --accent-text: #1668AE;

  --accent-light: rgba(22, 117, 196, .10);
  --success-light: rgba(16, 185, 129, .12);
  --warning-light: rgba(245, 158, 11, .14);
  --danger-light: rgba(239, 68, 68, .10);
  --info-light: rgba(59, 130, 246, .10);

  --border: #E4E7EC;
  --border-light: #DCE0E6;

  --input-bg: #FFFFFF;
  --input-border: #D6DAE1;
  --input-border-hover: #B9C0CA;

  --shadow-lg: 0 12px 28px rgba(16, 24, 40, .12);
}

/* ─── Основа ─────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  background: #0b0f19;
}

body { display: flex; flex-direction: column; overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Иконките са Font Awesome 6.4 Free (icons.js) — същият набор, който ползва
   приложението. Плътни рисунки, затова fill, а не stroke. */
svg.i { width: 15px; height: 15px; fill: currentColor; flex-shrink: 0; vertical-align: -.125em; }
svg.i-sm { width: 12px; height: 12px; }
svg.i-lg { width: 17px; height: 17px; }

/* ─── Лентата на демото (тя е на сайта, не на продукта) ──────────────────── */
.demobar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  height: 56px;
  background: #06090f;
  border-bottom: 1px solid #1a2436;
  color: #cbd5e1;
  font-size: 13px;
}

.demobar-label { display: flex; align-items: center; gap: 8px; font-weight: 600; color: #fff; white-space: nowrap; }
.demobar-label .tag {
  font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: #5DB0F2; border: 1px solid rgba(93, 176, 242, .35); border-radius: 3px; padding: 2px 5px;
}

.roleswitch { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.roleswitch::-webkit-scrollbar { display: none; }
.roleswitch button {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: var(--radius-sm);
  color: #94a3b8; font-size: 13px; font-weight: 500; white-space: nowrap;
  border: 1px solid transparent;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.roleswitch button:hover { color: #e2e8f0; background: #111a29; }
.roleswitch button[aria-pressed="true"] { color: #fff; background: #172131; border-color: #23405f; }
.roleswitch button .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }

/* the role switch scrolls inside the bar rather than pushing the bar wider
   than a phone (a flex child does not shrink below its content by default) */
#rolebar { flex: 0 1 auto; min-width: 0; }
#rolebar .roleswitch { max-width: 100%; }
.demobar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.demobar-hint { color: #64748b; font-size: 12px; }
.demobar-right a {
  padding: 7px 11px; border-radius: var(--radius-sm);
  border: 1px solid #1a2436; color: #94a3b8; font-size: 12.5px; text-decoration: none;
}
.demobar-right a:hover { color: #e2e8f0; border-color: #2b3d5c; }

/* ─── Рамка ──────────────────────────────────────────────────────────────── */
.app {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
}

/* ─── Меню вляво (Sidebar.module.css) ────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid #1a2436;
}

.logo {
  display: flex; align-items: center; gap: 11px;
  padding: 0 20px;
  min-height: var(--header-height);
  border-bottom: 1px solid #1a2436;
  white-space: nowrap;
}
.logoImg { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; }
.logoName { font-weight: 600; font-size: 15px; line-height: 1.25; color: #fff; }
.logoCompany { font-size: 12px; color: #7b8699; margin-top: 1px; }

.quotaBox {
  margin: 12px .75rem 0;
  padding: .5rem .75rem;
  background: rgba(255, 255, 255, .03);
  border: 1px solid #1a2436;
  border-radius: var(--radius-sm);
  font-size: .75rem;
  color: #a3adbd;
}
.quotaRow { display: flex; justify-content: space-between; margin-bottom: 4px; }
.quotaTrack { width: 100%; height: 4px; background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; }
.quotaFill { height: 100%; border-radius: 2px; background: var(--accent); }

.sidebarNav {
  flex: 1;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: none;
}
.sidebarNav::-webkit-scrollbar { display: none; }

.navSectionTitle {
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #7b8699;
  padding: 14px 12px 6px;
  font-weight: 600;
  white-space: nowrap;
}

.navItem {
  display: flex; align-items: center; gap: 11px;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  overflow: hidden;
  font-weight: 500;
  font-size: 13.5px;
  color: var(--text-sidebar);
  border: 1px solid transparent;
  width: 100%;
  text-align: left;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.navItem:hover { background: var(--bg-sidebar-hover); color: #fff; }
.navItem.active { background: var(--bg-sidebar-active); color: #fff; }
.navItem svg { width: 20px; height: 15px; color: #7b8699; }
.navItem.active svg { color: #5DB0F2; }
.navItem .tabCount { margin-left: auto; }

/* ─── Горна лента (Header.module.css) ────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.header {
  height: var(--header-height);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-light);
  background-color: var(--bg-primary);
}
.app[data-theme="light"] .header { background-color: var(--bg-secondary); }

.searchContainer { flex: 0 1 360px; max-width: 360px; position: relative; }
.searchBox {
  width: 100%;
  height: 34px;
  padding: 0 64px 0 34px;
  display: flex; align-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--input-bg);
  color: var(--text-muted);
  font-size: 13.5px;
  overflow: hidden; white-space: nowrap;
}
/* the placeholder ends in an ellipsis before the Ctrl K hint instead of running under it */
.searchPh { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.searchIcon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.searchKbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 1px solid var(--border); border-radius: 4px; padding: 0 5px;
  font-size: 10.5px; font-weight: 500; color: var(--text-muted); font-family: var(--font-mono);
}

.actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.actionBtn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  position: relative;
  transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.actionBtn:hover { background-color: var(--bg-tertiary); color: var(--text-primary); }
.actionBtn.on { border-color: var(--accent); background: var(--accent-light); color: var(--accent-text); }
.actionBtn .pip {
  position: absolute; top: -5px; right: -5px;
  min-width: 15px; height: 15px; padding: 0 3px;
  display: grid; place-items: center;
  background: var(--danger); color: #fff;
  font-size: 9.5px; font-family: var(--font-mono);
  border-radius: 8px;
}

.agentStatus {
  display: flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--text-secondary);
}
.agentStatus .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); }
.agentStatus.online .dot { background: var(--success); }
.agentStatus.busy .dot { background: var(--warning); }

.langSelect {
  height: 32px; padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12.5px; font-weight: 500;
  display: flex; align-items: center; gap: 5px;
}

/* ─── Съдържание (AdminLayout.module.css) ────────────────────────────────── */
.contentArea {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  transition: margin-right var(--transition-normal);
  /*
   * Всяка страница вътре пита КОЛКО Е ШИРОКА ТАЗИ КОЛОНА, а не прозорецът —
   * същото, което прави AdminLayout.module.css и по същата причина: отвореният
   * панел взема половината екран, а `@media` продължава да вижда целия
   * прозорец и реди пет плочки по осемдесет пиксела.
   */
  container-type: inline-size;
  container-name: content;
}
.app.drawer-open .contentArea { margin-right: var(--drawer-width); }

.dashboard { display: flex; flex-direction: column; gap: 14px; }

/* ─── Заглавие на страница (PageHeader.module.css) ───────────────────────── */
.headerRow { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.headerRow .title { font-size: 21px; font-weight: 600; letter-spacing: -.01em; color: var(--text-primary); line-height: 1.25; }
.headerRow .subtitle { font-size: 13px; color: var(--text-muted); font-weight: 400; display: block; margin-top: 2px; }
.headerRow .action { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

/* ─── Бутони (globals.css) ───────────────────────────────────────────────── */
.btn {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.3;
  border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  white-space: nowrap;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background-color: var(--bg-secondary); border: 1px solid var(--border); color: var(--text-primary); font-weight: 500; }
.btn-secondary:hover { border-color: var(--input-border-hover); background: var(--bg-tertiary); }
.btn-ghost { background: transparent; color: var(--text-secondary); font-weight: 500; }
.btn-ghost:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-danger { background-color: transparent; border: 1px solid var(--border); color: var(--danger); font-weight: 500; }
.btn-danger:hover { background: var(--danger-light); border-color: rgba(239,68,68,.4); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

/* ─── Карти с числа (page.module.css .statsGrid) ─────────────────────────── */
.statsGrid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--border-light);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.statCard {
  background: var(--bg-secondary);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
  text-align: left;
  transition: background-color var(--transition-fast);
}
.statCard:hover { background: var(--bg-tertiary); }
.statIcon { width: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.statIconBlue { color: var(--info); }
.statIconGreen { color: var(--success); }
.statIconOrange { color: var(--warning); }
.statIconPurple { color: var(--accent); }
.statIconGrey { color: var(--text-muted); }
.statValue { font-family: var(--font-mono); font-size: 21px; font-weight: 500; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.statLabel { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }
.statValue .u { font-family: var(--font-sans); font-size: 13.5px; font-weight: 400; color: var(--text-secondary); margin-left: 4px; }

/* ─── Таблица и лентата над нея (page.module.css) ────────────────────────── */
.tableArea {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 12px;
}

.tableTopRow { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }

.filterTabs {
  display: flex; flex: 0 0 auto; gap: 2px;
  border-radius: 7px; padding: 3px;
  border: 1px solid var(--border);
  width: fit-content;
  max-width: 100%;
}
/* Осемте таба на „Работно време“ се пренасят на втори ред, вместо да излизат
   извън екрана — както .tabsContainer в app/worktime/page.module.css. */
.filterTabs.wrap { flex-wrap: wrap; }
.filterTab {
  height: 28px; padding: 0 11px;
  white-space: nowrap;
  border-radius: 5px;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
  transition: all var(--transition-fast);
}
.filterTab:hover { color: var(--text-primary); }
.filterTab.active { background: var(--bg-tertiary); color: var(--text-primary); }
.tabCount {
  margin-left: 4px; padding: 0 5px;
  border-radius: 4px;
  font-size: 11.5px; font-weight: 500;
  font-family: var(--font-mono);
  background: rgba(127, 127, 127, .18);
}

.tableTopControls { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; min-width: 0; }

.selectControl {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 13px;
  display: inline-flex; align-items: center; gap: 7px;
}
.hiddenToggle {
  display: inline-flex; align-items: center; white-space: nowrap;
  flex: 0 0 auto; gap: 6px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12.5px; font-weight: 500;
}
.hiddenToggle.on { border-color: var(--accent); background: var(--accent-light); color: var(--accent-text); }

.searchWrap { position: relative; flex: 0 1 220px; min-width: 130px; }
.searchInput {
  width: 100%;
  padding: 6px 12px 6px 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text-muted);
  font-size: 13px;
  display: flex; align-items: center;
  overflow: hidden; white-space: nowrap;
}
.searchWrap .searchIcon { left: 14px; }

.tableWrapper { overflow-x: auto; scrollbar-width: thin; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  background: var(--bg-secondary);
  padding: 9px 14px;
  text-align: left;
  font-weight: 500;
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--border-light);
}
tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  font-size: 13.5px;
  color: var(--text-secondary);
}
tbody tr:last-child td { border-bottom: none; }

.sortHeader { display: inline-flex; align-items: center; gap: 6px; color: inherit; font: inherit; }
.sortHeader:hover { color: var(--text-primary); }
.sortIcon { opacity: .5; width: 9px; height: 11px; }

.selectCell { width: 34px; text-align: center; padding-right: 0; }
.selectCell input { accent-color: var(--accent); }

.ticketRow { cursor: pointer; }
.ticketRow:hover td { background: color-mix(in srgb, var(--text-primary) 3%, transparent); color: var(--text-primary); }
.activeTicketRow td { background-color: var(--accent-light) !important; }
.activeTicketRow td:first-child { box-shadow: inset 4px 0 0 var(--accent); }
.overdueRow td { background: rgba(239, 68, 68, .05); }
.overdueRow td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.overdueRow:hover td { background: rgba(239, 68, 68, .10); }

.ticketId { font-size: 12.5px; color: var(--text-muted); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.ticketCustomer { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ticketCustomer .customerName { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.customerAvatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}
.customerName { font-weight: 500; color: var(--text-primary); white-space: nowrap; }
.ticketSubject {
  font-weight: 500; color: var(--text-primary);
  max-width: 280px; min-width: 0;
  display: flex; align-items: center; gap: 6px;
}
/* Многоточието иска СОБСТВЕН елемент: върху flex-контейнер text-overflow не
   действа, затова темата се реже в своя span, а иконката на канала остава. */
.subjectText { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cellMuted { color: var(--text-muted); font-size: 13px; }
.dueCell { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.dueOverdue { color: var(--danger); font-weight: 600; }
.dueIcon { margin-right: 6px; }
.emptyCell { text-align: center; padding: 2rem; color: var(--text-muted); }

/* Статус: точка + текст (globals.css .status-dot) */
.status-dot { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; font-size: 13px; white-space: nowrap; }
.status-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--text-muted); }
.status-open::before { background: var(--info); }
.status-pending::before { background: var(--warning); }
.status-resolved::before { background: var(--success); }
.status-closed::before { background: var(--text-muted); }
.status-approved::before { background: var(--success); }
.status-rejected::before { background: var(--danger); }

.priorityCell { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; }
.priorityDot { width: 7px; height: 7px; border-radius: 50%; }

/* Кръгче на канала (components/ChannelBadge.tsx, variant="icon") */
.chBadge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  flex-shrink: 0;
}
.chBadge svg { width: 12px; height: 12px; }

.rowFlag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 6px; border-radius: 4px;
  background: var(--bg-tertiary); color: var(--text-secondary);
  font-size: 11px; font-weight: 600; white-space: nowrap;
}

/* ─── Карти и общи парчета за другите екрани ─────────────────────────────── */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.cardHead { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border-light); }
.cardHead h2, .cardHead h3 { font-size: 14px; font-weight: 600; }
.cardHead .sub { font-size: 12px; color: var(--text-muted); }
.cardHead .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.cardBody { padding: 16px; }
.cardBody.tight { padding: 0; overflow-x: auto; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-sidebarright { grid-template-columns: minmax(0, 1fr) 320px; }

.note {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 13px;
  border: 1px solid var(--border-light);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  font-size: 13px; color: var(--text-secondary);
}
.note svg { color: var(--accent-text); margin-top: 2px; }
.note.warn { border-left-color: var(--warning); }
.note.warn svg { color: var(--warning); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 7px; border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  font-size: 12px; color: var(--text-secondary); white-space: nowrap;
}
.chip.accent { color: var(--accent-text); border-color: rgba(22,117,196,.4); background: var(--accent-light); }
.chip.ok { color: var(--success); border-color: rgba(16,185,129,.35); background: var(--success-light); }
.chip.warn { color: var(--warning); border-color: rgba(245,158,11,.35); background: var(--warning-light); }
.chip.bad { color: var(--danger); border-color: rgba(239,68,68,.35); background: var(--danger-light); }

.ava {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; color: #fff; flex-shrink: 0;
}
.row-flex { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }

.meter { height: 6px; border-radius: 3px; background: var(--bg-tertiary); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); }
.meter.ok > span { background: var(--success); }
.meter.warn > span { background: var(--warning); }
.meter.bad > span { background: var(--danger); }

.kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 9px 12px; font-size: 13px; align-items: center; }
.kv dt { color: var(--text-secondary); }
.kv dd { font-weight: 500; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.field label { font-size: 12.5px; color: var(--text-secondary); }
.input, textarea.input {
  width: 100%; min-height: 34px; padding: 7px 10px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 13.5px;
}
.input::placeholder { color: var(--text-muted); }
textarea.input { resize: none; }

/* ─── Панел на тикета ────────────────────────────────────────────────────── */
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: var(--drawer-width);
  display: flex; flex-direction: column;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform var(--transition-normal);
  z-index: 40;
}
.app.drawer-open .drawer { transform: none; }

.drawerHead { display: flex; align-items: center; gap: 10px; padding: 12px 14px; min-height: var(--header-height); border-bottom: 1px solid var(--border-light); }
.drawerHead .id { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted); }
.drawerHead h2 { font-size: 15px; font-weight: 600; }
.drawerHead .right { margin-left: auto; display: flex; gap: 6px; }

.drawerBody { flex: 1; display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 0; }
.drawerSide { border-right: 1px solid var(--border-light); overflow-y: auto; overflow-x: hidden; padding: 14px; }
.drawerMain { display: flex; flex-direction: column; min-height: 0; }
.thread { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }

.msg { max-width: 78%; padding: 10px 12px; border-radius: var(--radius-md); font-size: 13.5px; line-height: 1.5; }
.msg .meta { margin-top: 6px; font-size: 11px; opacity: .72; }
.msg.in { align-self: flex-start; background: var(--bg-tertiary); }
.msg.out { align-self: flex-end; background: var(--accent); color: #fff; }
.msg.internal { align-self: flex-end; background: var(--warning-light); border: 1px solid rgba(245,158,11,.35); }
.msg.sys { align-self: center; max-width: 100%; color: var(--text-muted); font-size: 12px; display: flex; align-items: center; gap: 7px; }

.composer { border-top: 1px solid var(--border-light); padding: 12px 14px; }
.composerHead { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font-size: 12px; color: var(--text-muted); }
.composerTools { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.drawerSide .kv { grid-template-columns: minmax(0, 104px) minmax(0, 1fr); }
.sideTitle { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin: 16px 0 8px; font-weight: 600; }
.sideTitle:first-child { margin-top: 0; }

/* ─── Лентата на активния разговор (components/Voip/ActiveCallBar.tsx) ───── */
.callbar {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: 9px;
  height: 38px; padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(16, 185, 129, .3);
  background: rgba(16, 185, 129, .04);
  font-size: 13px;
  overflow: hidden; white-space: nowrap;
}
.callbar.held { border-color: rgba(245, 158, 11, .6); background: rgba(245, 158, 11, .15); }
.callbarState { display: flex; align-items: center; gap: 7px; color: var(--success); font-weight: 500; }
.callbar.held .callbarState { color: var(--warning); }
.callbarState .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.callbar.held .callbarState .dot { animation: blink 1s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.callbarSep { width: 1px; height: 18px; background: var(--border); flex-shrink: 0; }
.callbarWho { display: flex; align-items: center; gap: 7px; min-width: 104px; flex-shrink: 1; }
.callbarWho b { overflow: hidden; text-overflow: ellipsis; }
.callbarTimer { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--success); }
.callbar.held .callbarTimer { color: var(--warning); }
.callbarActions { margin-left: auto; display: flex; gap: 5px; flex-shrink: 0; }
.callbarActions .btn { padding: 5px 9px; font-size: 12.5px; }

/* ─── Екипен чат (components/InternalChat) ───────────────────────────────── */
.chatpanel {
  position: absolute;
  top: calc(var(--header-height) + 6px);
  right: 14px;
  width: 320px;
  max-height: min(460px, 70%);
  display: flex; flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  overflow: hidden;
}
.chatpanelHead { display: flex; align-items: center; gap: 8px; padding: 11px 13px; border-bottom: 1px solid var(--border-light); font-weight: 600; font-size: 13.5px; }
.chatpanelHead .right { margin-left: auto; display: flex; gap: 4px; }
.chatpanelBody { overflow-y: auto; }

.chatroom { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 13px; border-bottom: 1px solid var(--border-light); text-align: left; }
.chatroom:hover { background: var(--bg-tertiary); }
.chatroomInfo { min-width: 0; flex: 1; }
.chatroomName { font-size: 13px; font-weight: 500; }
.chatroomLast { display: block; font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatroomUnread { min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; border-radius: 9px; background: var(--accent); color: #fff; font-family: var(--font-mono); font-size: 10.5px; }

.chatdock { position: absolute; right: 14px; bottom: 0; display: flex; gap: 10px; align-items: flex-end; z-index: 55; }
.chatwin {
  width: 300px; display: flex; flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border); border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.chatwinHead { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-bottom: 1px solid var(--border-light); font-size: 13px; font-weight: 500; }
.chatwinHead .right { margin-left: auto; }
.chatwinBody { height: 208px; overflow-y: auto; padding: 11px; display: flex; flex-direction: column; gap: 8px; }
.chatwinMsg { max-width: 86%; padding: 7px 10px; border-radius: var(--radius-sm); font-size: 12.5px; line-height: 1.45; }
.chatwinMsg.in { align-self: flex-start; background: var(--bg-tertiary); }
.chatwinMsg.out { align-self: flex-end; background: var(--accent); color: #fff; }
.chatwinMsg .meta { margin-top: 4px; font-size: 10.5px; opacity: .72; }
.chatwinFoot { border-top: 1px solid var(--border-light); padding: 8px 10px; display: flex; align-items: center; gap: 8px; }
.chatwinFoot .input { min-height: 30px; padding: 5px 9px; font-size: 12.5px; }

/* ─── Софтфон, календар, графики ─────────────────────────────────────────── */
.dialpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.dialpad button {
  height: 40px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 15px; color: var(--text-primary);
  background: var(--bg-primary);
}
.dialpad button:hover { border-color: var(--input-border-hover); }
.dialpad button span { display: block; font-size: 8.5px; color: var(--text-muted); letter-spacing: .08em; }

.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: var(--font-mono); font-size: 10px; fill: var(--text-muted); }
.chart .grid-line { stroke: var(--border-light); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12.5px; color: var(--text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--border-light); border: 1px solid var(--border-light); border-radius: var(--radius-lg); overflow: hidden; }
.calDow { background: var(--bg-primary); padding: 7px 9px; font-size: 11.5px; color: var(--text-muted); text-align: center; }
.calDay { background: var(--bg-secondary); min-height: 84px; padding: 7px 8px; }
.calDay.out { background: var(--bg-primary); }
.calDay .d { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); }
.calDay.today .d { color: var(--accent-text); font-weight: 600; }
.calDay.holiday { background: var(--danger-light); }
.shift { margin-top: 5px; padding: 3px 6px; border-radius: var(--radius-xs); font-size: 11px; font-family: var(--font-mono); background: var(--accent-light); color: var(--accent-text); border-left: 2px solid var(--accent); }
.shift.night { background: rgba(139,92,246,.14); color: #a78bfa; border-left-color: #8b5cf6; }
.shift.leave { background: var(--success-light); color: var(--success); border-left-color: var(--success); font-family: var(--font-sans); }
.shift.off { background: var(--bg-tertiary); color: var(--text-muted); border-left-color: var(--text-muted); font-family: var(--font-sans); }

.timelineRow { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-light); }
.timelineRow:last-child { border-bottom: none; }
.timelineIcon { width: 28px; height: 28px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--bg-tertiary); color: var(--text-secondary); flex-shrink: 0; }
.timelineBody { min-width: 0; flex: 1; }
.timelineTime { margin-left: auto; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px);
  padding: 10px 14px;
  border: 1px solid #243047;
  border-radius: var(--radius-sm);
  background: #0f1522; color: #f1f5f9;
  font-size: 13px;
  box-shadow: 0 12px 28px rgba(0,0,0,.45);
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  z-index: 90;
  display: flex; align-items: center; gap: 9px;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast svg { color: #5DB0F2; }

/* ─── Тесни екрани ───────────────────────────────────────────────────────── */
@media (max-width: 1620px) {
  .callbar .chip, .callbar .callbarDetail { display: none; }
  .callbarActions [data-act="ticket"] .callbarLabel { display: none; }
}

@media (max-width: 1320px) {
  .callbar .callbarLabel { display: none; }
  .searchContainer { max-width: 200px; }
  /* 200px holds the placeholder or the key hint, not both */
  .searchKbd { display: none; }
  .searchBox { padding-right: 10px; }
}

/* ─── Лентата на демото в рамката на сайта (900–1180px) ───────────────────
   Четирите роли винаги се виждат: първо пада описанието на ролята, после
   надписът пред тях. Лентата на разговора под ~1100px не се сбива до
   половин иконка — скрива се (разговорът е и в екрана на централата). */
@media (max-width: 1180px) {
  .demobar-hint { display: none; }
}
@media (max-width: 1100px) {
  .callbar { display: none; }
}
/* 1101–1320px (the frame on a 1180–1440px site): with a call running, the
   call bar gets the search box's room, so its buttons — hang up included —
   are never cut off */
@media (min-width: 1101px) and (max-width: 1320px) {
  .header:has(.callbar) .searchContainer { display: none; }
}
@media (max-width: 1000px) {
  .demobar-label .name { display: none; }
}

/* на тъч екран бутоните за роля са 44px високи */
@media (pointer: coarse) {
  .roleswitch button { min-height: 44px; }
}

/* Петте плочки: две колони, щом колоната падне под 760px, и последната взема
   целия ред — иначе петата стои сама, половин ред широка, като дефект. */
@container content (max-width: 760px) {
  .statsGrid { grid-template-columns: repeat(2, 1fr); }
  .statsGrid > :last-child { grid-column: 1 / -1; }
  .grid-sidebarright { grid-template-columns: minmax(0, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@container content (max-width: 420px) {
  .statsGrid { grid-template-columns: 1fr; }
}

/*
 * ── Таблицата с тикетите спрямо колоната, в която стои ─────────────────────
 *
 * Деветте колони искат около 1100px. Свие ли се колоната — от отворен панел
 * или от тесен екран — таблицата НЕ се скролира настрани: тя пуска колоните,
 * които се четат другаде, и се сбива. Скролираща настрани таблица крие точно
 * статуса и приоритета, заради които човек я гледа.
 */
@container content (max-width: 1060px) {
  /* Адресът и датата на създаване: и двете ги пише панелът на тикета. */
  .ticketTable th:nth-child(4), .ticketTable td:nth-child(4),
  .ticketTable th:nth-child(8), .ticketTable td:nth-child(8) { display: none; }
  .ticketTable td { padding: 8px 10px; }
  .ticketTable th { padding: 6px 10px; }
  .ticketTable .customerAvatar { width: 24px; height: 24px; font-size: 10px; }
  .ticketTable .customerName { font-size: 12.5px; }
}

@container content (max-width: 760px) {
  /* Приоритетът и срокът също са в панела; остава номер, клиент, тема, статус. */
  .ticketTable th:nth-child(7), .ticketTable td:nth-child(7),
  .ticketTable th:nth-child(9), .ticketTable td:nth-child(9) { display: none; }
  .ticketTable { table-layout: fixed; width: 100%; }
  .ticketTable th:nth-child(1), .ticketTable .selectCell { width: 7%; }
  .ticketTable th:nth-child(2) { width: 11%; }
  .ticketTable th:nth-child(3) { width: 27%; }
  .ticketTable th:nth-child(5) { width: 33%; }
  .ticketTable th:nth-child(6) { width: 22%; }
  .ticketTable td, .ticketTable th { overflow: hidden; }
  .ticketTable .ticketSubject, .ticketTable .customerName { max-width: 100%; }
  .tableWrapper { overflow-x: hidden; }
  .filterTabs { flex-wrap: wrap; }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 64px; --drawer-width: 100%; }
  .logo { justify-content: center; padding: 0 8px; }
  .logo .logoText, .navItem span, .navSectionTitle, .quotaBox, .navItem .tabCount { display: none; }
  .navItem { justify-content: center; padding: 8px; }
  .app.drawer-open .contentArea { margin-right: 0; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .drawerBody { grid-template-columns: minmax(0, 1fr); }
  .drawerSide { display: none; }
  .chatdock { display: none; }
  .chatpanel { right: 8px; left: 8px; width: auto; }
  .whoamiText { display: none; }
  .demobar-hint { display: none; }
  .header { padding: 0 16px; gap: 8px; }
}

@media (max-width: 620px) {
  .contentArea { padding: 16px; }
  .statsGrid { grid-template-columns: 1fr; }
  .demobar { gap: 10px; padding: 0 10px; }
  .demobar-label .name { display: none; }
  /* телефон: ролите на два реда под лентата, всички видими, без скрол */
  .demobar { flex-wrap: wrap; height: auto; padding: 8px 10px; row-gap: 8px; }
  #rolebar { order: 3; flex: 1 1 100%; }
  .roleswitch { flex-wrap: wrap; overflow: visible; }
  .roleswitch button { flex: 1 1 calc(50% - 4px); justify-content: center; min-height: 44px; }
  .searchContainer { display: none; }
  .agentStatus, .langSelect { display: none; }
  .headerRow { flex-direction: column; align-items: flex-start; }
  table { min-width: 680px; }
}

/* ─── Ред с филтри над списък (app/customers, app/contacts) ──────────────── */
.filterRow { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.filterRow .grow { flex: 1 1 320px; min-width: 0; }
.fieldLabel {
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600; margin-bottom: 6px;
}
.searchWrap.grow { flex: 1 1 auto; }

/* ─── Решетка от карти (customers, kb, шаблони за смени) ─────────────────── */
/* grid auto-fill minmax(320px, 1fr), gap 16 — както в app/customers и app/kb. */
.cardGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; width: 100%; }

.entityCard {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
  text-align: left;
  transition: border-color var(--transition-fast);
}
.entityCard:hover { border-color: var(--input-border-hover); }
.entityCardHead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.entityCardTitle { font-size: 15px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.entityCardRows { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; font-size: 13px; color: var(--text-secondary); }
.entityCardRows span { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.entityCardRows svg { color: var(--text-muted); }
.entityCardFoot {
  display: flex; gap: 16px;
  border-top: 1px solid var(--border-light);
  padding-top: 10px; margin-top: auto;
  font-size: 12.5px; color: var(--text-muted);
}
.entityCardActions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }
.kbExcerpt { font-size: 13px; color: var(--text-secondary); line-height: 1.55; }

/* ─── Показатели (app/statistics .kpiGrid) ───────────────────────────────── */
.kpiGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.kpiCard { background: var(--bg-secondary); padding: 12px 16px; box-shadow: 1px 0 0 var(--border-light), 0 1px 0 var(--border-light); }
.kpiLabel { font-size: 12.5px; color: var(--text-muted); margin-bottom: 2px; }
.kpiValue { font-family: var(--font-mono); font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.kpiValue .u { font-family: var(--font-sans); font-size: 13.5px; font-weight: 400; color: var(--text-secondary); margin-left: 4px; }
.kpiChange { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.kpiChange.up { color: var(--success); }
.kpiChange.down { color: var(--danger); }

/* Вариантът с иконка вляво — таблото на „Работно време“. */
.kpiGridIcons .kpiCard { display: flex; align-items: center; gap: 12px; }
.kpiCardIcon .kpiLabel { margin-bottom: 0; }
.kpiIcon { width: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.statIconRed { color: var(--danger); }

.schedulerBar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 0 4px; }

/* ─── Хронология на дейността (app/timeline) ─────────────────────────────── */
.dayHeading {
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600; margin: 4px 0 -4px;
}
.feed { display: flex; flex-direction: column; gap: 10px; position: relative; }
/* Релсата минава зад иконките — линия през целия списък, не рамка на всяка карта. */
.feed::before { content: ''; position: absolute; left: 13px; top: 8px; bottom: 8px; width: 1px; background: var(--border-light); }
.feedRow { display: flex; align-items: flex-start; }
.feedIcon { width: 27px; height: 27px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; z-index: 2; }
.feedCard {
  flex: 1; min-width: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  margin-left: 8px;
}
.feedCardHead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.feedCustomer { font-size: 12.5px; color: var(--accent-text); display: inline-flex; align-items: center; gap: 5px; }
.feedTitle { font-weight: 600; color: var(--text-primary); }
.feedRight { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.feedMeta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.feedMeta span { display: inline-flex; align-items: center; gap: 5px; }

/* „+“ на запазените изгледи, вдясно от табовете (components/SavedViewsBar). */
.savedView { border: 1px solid var(--border); border-radius: var(--radius-sm); height: 34px; padding: 0 10px; }

@media (max-width: 620px) {
  .entityCardRows { grid-template-columns: 1fr; }
  .cardGrid { grid-template-columns: 1fr; }
}

/* Падащо поле в панела на тикета — статусът, приоритетът и отделът се сменят
   оттам (TicketDrawer). */
.drawerPick {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 12.5px; font-weight: 500;
}
.drawerPick:hover { border-color: var(--input-border-hover); }
.sideHint { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-top: 6px; }
.sideRow { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 4px; }
.sideRow svg { color: var(--text-muted); }

/* ─── Отворен панел: това, което app/page.module.css прави в .splitLayout ── */
/*
 * Докладвано от живата система и записано там: с отворен тикет читателят вижда
 * заглавие, поздрав и пет плочки, а самата опашка започва под ръба на екрана.
 * Затова, докато панелът е отворен, си отиват поздравът, плочките и бележката —
 * колоните се грижат сами за себе си чрез @container по-горе.
 */
@media (min-width: 1025px) {
  .app.drawer-open .statsGrid,
  .app.drawer-open .headerRow .subtitle,
  .app.drawer-open .contentArea > .dashboard > .note { display: none; }
}

/* Съдържанието скролира само вертикално; тясното се пренася, не изтича. */
.contentArea { overflow-x: hidden; }
.tableTopControls { flex-wrap: wrap; }

/* Лявата колона на панела е 250px — мерните стойности в нея се пренасят. */
.drawerSide .kv { grid-template-columns: minmax(0, 88px) minmax(0, 1fr); }
.drawerSide .kv dd.num { font-size: 12px; white-space: normal; }

}

/* В тясна лента на панела „Експорт на кореспонденцията“ остава само иконка —
   иначе заглавието на тикета се свива до една буква. */
@media (max-width: 1600px) {
  .drawerHead .exportBtn span { display: none; }
}
.drawerHead h2 { min-width: 90px; }

/* Тихи ленти за скрол — там, където изобщо остане такава. Приложението прави
   същото за .tableWrapper в app/page.module.css. */
.contentArea, .drawerSide, .thread, .chatwinBody, .chatpanelBody, .sidebarNav, .tableWrapper {
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}
.contentArea::-webkit-scrollbar,
.drawerSide::-webkit-scrollbar,
.thread::-webkit-scrollbar,
.chatwinBody::-webkit-scrollbar,
.chatpanelBody::-webkit-scrollbar,
.tableWrapper::-webkit-scrollbar { width: 7px; height: 7px; }
.contentArea::-webkit-scrollbar-thumb,
.drawerSide::-webkit-scrollbar-thumb,
.thread::-webkit-scrollbar-thumb,
.chatwinBody::-webkit-scrollbar-thumb,
.chatpanelBody::-webkit-scrollbar-thumb,
.tableWrapper::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.contentArea::-webkit-scrollbar-track,
.drawerSide::-webkit-scrollbar-track,
.thread::-webkit-scrollbar-track,
.tableWrapper::-webkit-scrollbar-track { background: transparent; }

/*
 * ── Панелът под 1400px ──────────────────────────────────────────────────────
 *
 * Над 1400px панелът СВИВА списъка, както прави приложението: двете се гледат
 * едновременно и това е смисълът на подредбата.
 *
 * Под 1400px свиването оставя на списъка под 430px и той започва да реже и
 * номера, и клиента — а това вече не е списък, а лента от многоточия. Затова
 * там панелът ляга ОТГОРЕ: списъкът остава цял зад него, какъвто си е. (В
 * продукта същото се случва под 900px — AdminLayout.module.css; демото мести
 * границата нагоре, защото се гледа и на лаптоп.)
 */
@media (max-width: 1400px) {
  :root { --drawer-width: min(720px, 72vw); }
  .app.drawer-open .contentArea { margin-right: 0; }
}

/*
 * ── Деветте колони на опашката, без скрол настрани ──────────────────────────
 *
 * Естествените им ширини искат около 1275px; на лаптоп колоната е 1090 и
 * таблицата тръгва настрани. Фиксирана подредба с дялове в проценти я побира:
 * дългото (тема, клиент, адрес) се реже с многоточие, а късото и важното —
 * статус, приоритет, срок — получава точно колкото му трябва.
 */
.ticketTable { table-layout: fixed; }
.ticketTable th:nth-child(1), .ticketTable .selectCell { width: 3%; }
.ticketTable th:nth-child(2) { width: 8%; }
.ticketTable th:nth-child(3) { width: 15%; }
.ticketTable th:nth-child(4) { width: 12%; }
.ticketTable th:nth-child(5) { width: 21%; }
.ticketTable th:nth-child(6) { width: 10%; }
.ticketTable th:nth-child(7) { width: 11%; }
.ticketTable th:nth-child(8) { width: 13%; }
.ticketTable th:nth-child(9) { width: 7%; }
.ticketTable td, .ticketTable th { overflow: hidden; }
.ticketTable td.cellMuted { text-overflow: ellipsis; white-space: nowrap; }
.ticketTable .sortHeader { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* Списъкът с обаждания — същото решение, осем колони вместо девет. */
.callTable { table-layout: fixed; }
.callTable th:nth-child(1) { width: 4%; }
.callTable th:nth-child(2) { width: 19%; }
.callTable th:nth-child(3) { width: 19%; }
.callTable th:nth-child(4) { width: 14%; }
.callTable th:nth-child(5) { width: 14%; }
.callTable th:nth-child(6) { width: 11%; }
.callTable th:nth-child(7) { width: 13%; }
.callTable th:nth-child(8) { width: 6%; }
.callTable td, .callTable th { overflow: hidden; text-overflow: ellipsis; }
