/* ============================================================
   Ainora.lt valdymo sąsaja - design system
   Light theme, brand-matched.
   ============================================================ */

/* ─── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
button { font: inherit; cursor: pointer; background: none; border: none; padding: 0; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
table { border-collapse: collapse; width: 100%; }
ul, ol { margin: 0; padding: 0; }

/* ─── Tokens ──────────────────────────────────────────────── */
:root {
  --primary: #5951EC;
  --primary-hover: #4338ca;
  --primary-soft: rgba(89, 81, 236, 0.08);
  --primary-soft-strong: rgba(89, 81, 236, 0.14);

  --bg-page: #f8f9fb;
  --bg-card: #ffffff;
  --bg-subtle: #f1f3f8;
  --bg-hover: #f5f7fb;

  --text: #0f172a;
  --text-strong: #020617;
  --text-muted: #64748b;
  --text-soft: #94a3b8;

  --border: #e6e8ef;
  --border-strong: #cbd5e1;

  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --success: #059669;
  --success-soft: #d1fae5;

  --slate-pill-bg: #f1f5f9;
  --slate-pill-text: #475569;

  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-card-hover: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-pop: 0 12px 32px rgba(15, 23, 42, 0.12);

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --nav-h: 64px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* ─── Base ────────────────────────────────────────────────── */
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
.soft { color: var(--text-soft); }
.hidden { display: none !important; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.text-right { text-align: right; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* ─── Top nav ─────────────────────────────────────────────── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topnav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.topnav-logo-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0;
  box-shadow: 0 4px 10px rgba(89, 81, 236, 0.25);
}
.topnav-brand {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.topnav-brand-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.topnav-brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.topnav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}
.topnav-links a {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.topnav-links a:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.topnav-links a.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.topnav-spacer { flex: 1; }

.topnav-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: var(--bg-subtle);
}
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Mobile hamburger + drawer ───────────────────────────── */
.topnav-burger {
  display: none;               /* shown only in the mobile media query */
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.topnav-burger:hover { background: var(--bg-hover); border-color: var(--border-strong); }

.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.mobile-drawer-backdrop.open { opacity: 1; }

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 100;
  width: 82vw;
  max-width: 320px;
  height: 100dvh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 32px rgba(15, 23, 42, 0.14);
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
}
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer[hidden], .mobile-drawer-backdrop[hidden] { display: none; }

.mobile-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.mobile-drawer-user { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.mobile-drawer-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.mobile-drawer-email {
  font-size: 11.5px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px;
}

.mobile-drawer-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 14px;
}
.mobile-drawer-links a {
  display: flex;
  align-items: center;
  height: 46px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  transition: background 0.15s, color 0.15s;
}
.mobile-drawer-links a:hover { background: var(--bg-hover); }
.mobile-drawer-links a.active { color: var(--primary); background: var(--primary-soft); font-weight: 600; }

/* ─── Container ───────────────────────────────────────────── */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px;
}

/* ─── Page header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-title {
  margin: 0 0 4px 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 14px;
}
.page-greeting {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 4px 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 500;
}
.back-link:hover { color: var(--primary); }

/* ─── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-strong);
}
.card-flush { padding: 0; overflow: hidden; }

.card-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 14px 0;
}

/* ─── Leads (cold-call B2B) ───────────────────────────────── */
.tier-chips { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.tier-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--border, #e6e8ef); border-radius: 10px; background: #fff; font-size: 12.5px; }
.tier-chip .n { font-weight: 700; font-size: 15px; }
.tier-chip .lbl { color: var(--text-muted, #64748b); }
.rating { color: #d97706; font-weight: 600; white-space: nowrap; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 18px; }
.pager .muted { min-width: 150px; text-align: center; font-size: 12.5px; }

/* ─── KPI / Stat grid ─────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-grid-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
@media (max-width: 1180px) {
  .stat-grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  position: relative;
  transition: box-shadow 0.15s;
}
.stat-card:hover { box-shadow: var(--shadow-card-hover); }
.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.stat-value {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}
.stat-value.accent { color: var(--primary); }
.stat-value.danger { color: var(--danger); }
.stat-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-icon.red { background: var(--danger-soft); color: var(--danger); }
.stat-icon.amber { background: var(--warning-soft); color: var(--warning); }
.stat-icon.emerald { background: var(--success-soft); color: var(--success); }

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  transition: background 0.15s, border 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  cursor: pointer;
  line-height: 1.2;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { flex-shrink: 0; }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-secondary {
  background: #fff;
  border-color: var(--border-strong);
  color: #334155;
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: #94a3b8;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-danger-outline {
  background: #fff;
  border-color: #fecaca;
  color: var(--danger);
}
.btn-danger-outline:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #fca5a5;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
  border-radius: 6px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.btn-icon:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text);
}
.btn-icon:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-icon-danger:hover:not(:disabled) {
  background: #fef2f2;
  color: var(--danger);
}
.btn-icon-primary:hover:not(:disabled) {
  background: var(--primary-soft);
  color: var(--primary);
}

.btn-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── Pills ───────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill-slate {
  background: var(--slate-pill-bg);
  color: var(--slate-pill-text);
  border-color: #e2e8f0;
}
.pill-red {
  background: #fef2f2;
  color: var(--danger);
  border-color: #fecaca;
}
.pill-amber {
  background: var(--warning-soft);
  color: #b45309;
  border-color: #fde68a;
}
.pill-emerald {
  background: var(--success-soft);
  color: var(--success);
  border-color: #a7f3d0;
}
.pill-purple {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: rgba(89, 81, 236, 0.2);
}

/* ─── Filter / toolbar ────────────────────────────────────── */
.toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.toolbar-spacer { flex: 1; }

/* ─── Inputs ──────────────────────────────────────────────── */
.input, .select, .textarea {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  color: var(--text);
  transition: border 0.15s, box-shadow 0.15s;
  width: 100%;
  max-width: 100%;
}
.textarea {
  height: auto;
  min-height: 84px;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input::placeholder { color: var(--text-soft); }

.select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

.input-with-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 1;
  min-width: 220px;
  max-width: 360px;
}
.input-with-icon svg {
  position: absolute;
  left: 11px;
  color: var(--text-soft);
  pointer-events: none;
}
.input-with-icon input {
  padding-left: 34px;
}

.label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-row { margin-bottom: 14px; }
.form-row:last-of-type { margin-bottom: 0; }
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.helper {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Segmented control ───────────────────────────────────── */
.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--bg-subtle);
  border-radius: 9px;
  border: 1px solid var(--border);
}
.segmented button {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active {
  background: #fff;
  color: var(--text-strong);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

/* ─── Toggle switch ───────────────────────────────────────── */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--text);
}
.toggle input { display: none; }
.toggle-slider {
  position: relative;
  width: 34px;
  height: 20px;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 0.18s;
  flex-shrink: 0;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.18s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(14px); }

/* ─── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}
.table thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 12px 16px;
  background: #fafbfd;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr {
  transition: background 0.12s;
}
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--bg-hover); }

.table .cell-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.table .cell-stack .top {
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table .cell-stack .sub {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.table .actions {
  text-align: right;
  white-space: nowrap;
}
.table .actions > * + * { margin-left: 4px; }

.recording-row td {
  background: var(--bg-subtle);
  padding: 12px 16px;
}
.recording-row audio {
  width: 100%;
  max-width: 480px;
  height: 36px;
}

/* ─── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  background: var(--bg-card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}
.empty-state .icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  margin: 0 auto 16px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-state h3 {
  margin: 0 0 6px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: -0.01em;
}
.empty-state p {
  margin: 0 auto 18px auto;
  color: var(--text-muted);
  max-width: 420px;
  font-size: 13.5px;
}

/* ─── Loader ──────────────────────────────────────────────── */
.loader {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* ─── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop);
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popIn 0.18s ease-out;
}
.modal-card.modal-sm { max-width: 400px; }
@keyframes popIn {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 8px 22px;
}
.modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: -0.01em;
}
.modal-body {
  padding: 4px 22px 16px 22px;
  font-size: 13.5px;
  color: var(--text);
  overflow-y: auto;
}
.modal-body p { margin: 0 0 10px 0; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px 18px 22px;
  border-top: 1px solid var(--border);
  background: #fafbfd;
}

/* ─── Toast ───────────────────────────────────────────────── */
.toast-stack {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  box-shadow: var(--shadow-pop);
  min-width: 220px;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.18s ease-out;
}
@keyframes slideIn {
  from { transform: translateX(8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.toast .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-soft);
  flex-shrink: 0;
}
.toast.success .dot { background: var(--success); }
.toast.error .dot { background: var(--danger); }
.toast.info .dot { background: var(--primary); }

/* ─── Tooltip / help ──────────────────────────────────────── */
.help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  background: #fff;
  cursor: help;
}
.help:hover { color: var(--text); border-color: #94a3b8; }
.help-body {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: 300px;
  background: var(--text-strong);
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: 8px;
  box-shadow: var(--shadow-pop);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
  z-index: 30;
  text-align: left;
}
.help-body code {
  background: rgba(255, 255, 255, 0.12);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11.5px;
  font-family: var(--font-mono);
}
.help:hover .help-body,
.help:focus .help-body {
  opacity: 1;
  visibility: visible;
  transform: none;
}

/* ─── Login page ──────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-page);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.06);
  padding: 40px;
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.login-logo .mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 6px 16px rgba(89, 81, 236, 0.3);
}
.login-logo .text {
  display: flex; flex-direction: column;
  line-height: 1.15;
}
.login-logo .name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: -0.01em;
}
.login-logo .sub {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.login-title {
  font-size: 20px;
  font-weight: 600;
  margin: 4px 0 20px 0;
  letter-spacing: -0.015em;
  color: var(--text-strong);
}
@media (max-width: 460px) {
  .login-card { padding: 28px 22px; }
}
.login-sub {
  font-size: 13.5px;
  color: var(--text-muted);
  margin: 0 0 22px 0;
}

.login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 44px;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: #334155;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, border 0.15s;
}
.btn-google:hover {
  background: var(--bg-hover);
  border-color: #94a3b8;
}

.login-footer {
  margin-top: 22px;
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.55;
}
.login-footer code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--bg-subtle);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ─── Call detail page ────────────────────────────────────── */
.call-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .call-grid { grid-template-columns: 1fr; }
}

.kv-list {
  display: flex;
  flex-direction: column;
}
.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.kv-row:last-child { border-bottom: none; }
.kv-row .k {
  color: var(--text-muted);
  font-weight: 500;
}
.kv-row .v {
  color: var(--text);
  text-align: right;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kv-row .v.mono { font-family: var(--font-mono); font-size: 12.5px; }

.contact-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.contact-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}
.contact-head .name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: -0.01em;
}
.contact-head .company {
  font-size: 13px;
  color: var(--text-muted);
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  color: var(--text-soft);
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.copy-btn:hover { background: var(--bg-hover); color: var(--primary); }

/* recording player card */
.player-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #fafbfd, #f1f5fb);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}
.player-card .icon {
  width: 40px; height: 40px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.player-card .meta {
  flex: 1;
  min-width: 0;
}
.player-card .title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-strong);
  margin-bottom: 4px;
}
.player-card audio {
  height: 36px;
  width: 100%;
  max-width: 100%;
}

/* audio player with speed controls */
.audio-player {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.audio-player audio {
  width: 100%;
  height: 38px;
}
.audio-speed {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.audio-speed .speed-label {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  margin-right: 4px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 600;
}
.speed-btn {
  appearance: none;
  background: #fff;
  border: 1px solid var(--border, #e6e8ef);
  color: var(--text-primary, #0f172a);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  transition: all 120ms;
}
.speed-btn:hover {
  background: #f8f9fb;
  border-color: var(--primary, #5951EC);
  color: var(--primary, #5951EC);
}
.speed-btn.is-active {
  background: var(--primary, #5951EC);
  color: #fff;
  border-color: var(--primary, #5951EC);
}

/* transcript */
.transcript {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 4px 2px;
}
.transcript-turn {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}
.transcript-turn.user { align-self: flex-start; }
.transcript-turn.assistant { align-self: flex-end; align-items: flex-end; }

.transcript-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.transcript-meta .who { color: var(--text); font-weight: 600; }
.transcript-meta .time { font-family: var(--font-mono); color: var(--text-soft); }

.transcript-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.transcript-turn.user .transcript-bubble {
  background: #f1f5f9;
  border-bottom-left-radius: 6px;
}
.transcript-turn.assistant .transcript-bubble {
  background: var(--primary-soft);
  border-bottom-right-radius: 6px;
}

/* function calls */
.fn-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fn-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.fn-item .icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.fn-item .icon.red { background: var(--danger-soft); color: var(--danger); }
.fn-item .icon.amber { background: var(--warning-soft); color: var(--warning); }
.fn-item .icon.emerald { background: var(--success-soft); color: var(--success); }
.fn-item .icon.slate { background: #fff; color: var(--text-muted); border: 1px solid var(--border); }

.fn-item .body { flex: 1; min-width: 0; }
.fn-item .name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-strong);
  margin-bottom: 2px;
}
.fn-item .detail {
  font-size: 12.5px;
  color: var(--text-muted);
}
.fn-item .time {
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-soft);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── Hot leads grid ──────────────────────────────────────── */
.hot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 760px) {
  .hot-grid { grid-template-columns: 1fr; }
}
.hot-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  position: relative;
  transition: box-shadow 0.15s, transform 0.15s;
}
.hot-card:hover {
  box-shadow: var(--shadow-card-hover);
}
.hot-card .flame {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  display: flex; align-items: center; justify-content: center;
}
.hot-card .name {
  font-size: 15.5px;
  font-weight: 600;
  margin: 0 50px 2px 0;
  color: var(--text-strong);
  letter-spacing: -0.01em;
}
.hot-card .company {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.hot-card .contact-line {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 12px;
}
.hot-card .contact-line .row {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px;
  color: var(--text);
}
.hot-card .summary {
  font-size: 13px;
  color: var(--text);
  margin: 10px 0 14px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}
.hot-card .timestamp {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.hot-card .actions {
  display: flex;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* count badge */
.count-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  margin-left: 10px;
  vertical-align: middle;
}

/* drawer */
.drawer-row {
  background: var(--bg-subtle);
}
.drawer-row td {
  padding: 18px 20px;
  border-top: 1px solid var(--border);
}
.drawer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 14px;
}
@media (max-width: 720px) {
  .drawer-grid { grid-template-columns: 1fr; }
}
.drawer-kv .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.drawer-kv .val {
  font-size: 13.5px;
  color: var(--text);
  word-break: break-word;
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 760px) {
  .topnav { padding: 0 14px; gap: 10px; }
  .topnav-links { display: none; }
  .topnav-user { display: none; }          /* moved into the drawer */
  .topnav-burger { display: inline-flex; }
  .topnav-brand-sub { display: none; }

  .container { padding: 18px 14px; }

  .stat-grid,
  .stat-grid-5 { grid-template-columns: repeat(2, 1fr); gap: 12px; }

  .page-header { align-items: flex-start; gap: 14px; margin-bottom: 18px; }
  .page-title { font-size: 22px; }

  /* Toolbars / filter bars stack and go full-width */
  .toolbar { padding: 12px; gap: 10px; }
  .toolbar-spacer { display: none; }
  .toolbar > .select,
  .toolbar > .input,
  .toolbar .input-with-icon { width: 100% !important; max-width: none; flex: 1 1 100%; }
  .input-with-icon { min-width: 0; }

  /* Segmented controls scroll horizontally rather than overflow */
  .segmented { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .segmented button { flex: 1 0 auto; white-space: nowrap; }

  /* Card headers may wrap their action button below the title */
  .card-header { flex-wrap: wrap; }

  /* Button rows wrap; full-width primary actions read better on phones */
  .btn-row { flex-wrap: wrap; }

  /* Modals hug the screen edges */
  .modal-card { width: 100%; }
  .modal-footer { flex-wrap: wrap; }
}

@media (max-width: 460px) {
  .stat-grid,
  .stat-grid-5 { grid-template-columns: 1fr; }
  .page-title { font-size: 20px; }
  .tier-chips { gap: 8px; }
  .pager { gap: 8px; }
  .pager .muted { min-width: 0; }
}

/* ─── Mobile: wide data tables → compact list rows ────────────
   Desktop is untouched. On phones every table collapses to one
   row per record showing only the name (.m-primary) + a small
   meta line (.m-meta, e.g. date/status) + the row's action/view
   button. All other columns are hidden; the row stays tappable. */
@media (max-width: 760px) {
  .table-wrap { overflow-x: visible; }
  table.table { display: block; width: 100%; }
  table.table thead { display: none; }
  table.table tbody { display: block; }

  table.table tbody tr {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px 12px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
  }
  table.table tbody tr:last-child { border-bottom: none; }

  /* Hide every cell by default; opt specific ones back in per table */
  table.table tbody td { display: none; padding: 0; border: none; white-space: normal; }

  table.table tbody td.m-primary {
    display: block; flex: 1 1 auto; min-width: 0; order: 1;
    font-size: 14px; font-weight: 600;
  }
  table.table tbody td.m-primary .sub { font-weight: 400; }

  table.table tbody td.m-meta {
    display: block; flex-basis: 100%; order: 3;
    font-size: 12px; color: var(--text-muted); margin-top: 1px;
    text-align: left; font-weight: 400;
  }

  table.table tbody td.actions {
    display: inline-flex; align-items: center; gap: 6px;
    order: 2; margin-left: auto; text-align: right;
  }
  table.table tbody td.actions > * + * { margin-left: 0; }

  /* Tap-to-open chevron for navigable rows that carry no action button */
  table.table tbody tr.clickable:not(:has(td.actions))::after {
    content: "";
    width: 7px; height: 7px; margin-left: auto; order: 2; flex-shrink: 0;
    border-top: 2px solid var(--text-soft);
    border-right: 2px solid var(--text-soft);
    transform: rotate(45deg);
  }

  /* Inline-expanded detail rows keep their normal block layout */
  table.table tbody tr.recording-row,
  table.table tbody tr.drawer-row {
    display: block; padding: 0 16px 14px;
  }
  table.table tbody tr.recording-row td,
  table.table tbody tr.drawer-row td { display: block; padding: 0; }
}

/* ─── Notifications bell + panel ─────────────────────────────── */
.notif-wrap { position: relative; display: flex; align-items: center; }
.notif-bell {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--radius-md, 8px);
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
  cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.notif-bell:hover { background: var(--primary-soft, rgba(89,81,236,0.08)); color: var(--primary); border-color: var(--primary); }
.notif-badge {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--danger, #dc2626); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; border: 2px solid var(--bg-card, #fff);
}
.notif-panel {
  position: absolute; top: calc(100% + 10px); right: 0; width: 360px; max-width: 90vw;
  background: var(--bg-card, #fff); border: 1px solid var(--border); border-radius: var(--radius-lg, 12px);
  box-shadow: 0 12px 32px rgba(15,23,42,0.14); z-index: 60; overflow: hidden;
}
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 700; color: var(--text);
}
.notif-readall { background: none; border: none; color: var(--primary); font-size: 12px; font-weight: 600; cursor: pointer; }
.notif-readall:hover { text-decoration: underline; }
.notif-list { max-height: 60vh; overflow-y: auto; }
.notif-item {
  display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border);
  text-decoration: none; color: var(--text); transition: background 0.12s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: #f8f9fb; }
.notif-item.unread { background: var(--primary-soft, rgba(89,81,236,0.06)); }
.notif-item.unread:hover { background: rgba(89,81,236,0.11); }
.notif-ic {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fee2e2; color: #dc2626;
}
.notif-ic.notif-comment { background: #eef0ff; color: #5951EC; }
.notif-ic.notif-palaikymas { background: #fef3c7; color: #b45309; }
.notif-ic.notif-callback { background: #e8eaff; color: #4338ca; }
.notif-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text); }
.notif-sub { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-time { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.notif-empty { padding: 28px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ─── Charts (donut + legend) ────────────────────────────────── */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 20px; }
.chart-card { background: var(--bg-card, #fff); border: 1px solid var(--border); border-radius: var(--radius-lg, 12px); padding: 20px; }
.chart-card-title { font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; margin: 0 0 16px; }
.chart-body { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut { flex-shrink: 0; }
.chart-legend { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 150px; }
.chart-legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.chart-dot { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.chart-legend-label { color: var(--text); flex: 1; }
.chart-legend-val { color: var(--text-muted); font-variant-numeric: tabular-nums; font-weight: 600; }

/* ─── Pipeline funnel ────────────────────────────────────────── */
.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 190px 1fr auto; align-items: center; gap: 14px; cursor: pointer; }
.funnel-row.active .funnel-label { color: var(--primary); font-weight: 700; }
.funnel-label { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.funnel-swatch { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.funnel-track { position: relative; height: 26px; background: #f1f3f8; border-radius: 6px; overflow: hidden; }
.funnel-fill { height: 100%; border-radius: 6px; min-width: 2px; transition: width 0.4s ease; }
.funnel-count { font-size: 13px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; min-width: 84px; text-align: right; }
.funnel-count .funnel-pct { color: var(--text-muted); font-weight: 500; margin-left: 6px; }
@media (max-width: 620px) { .funnel-row { grid-template-columns: 130px 1fr auto; } }

/* Task-row → profile link: inherit text styling, subtle hover affordance */
.row-link { color: inherit; text-decoration: none; display: block; }
.row-link:hover .top { color: #5951EC; text-decoration: underline; }
