:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #182230;
  --muted: #667085;
  --line: #d8dee8;
  --accent: #146c94;
  --accent-strong: #0f5678;
  --ok: #178c5f;
  --warn: #b7791f;
  --bad: #b42318;
  --shadow: 0 16px 40px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 Inter, Segoe UI, Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #111827;
  color: #fff;
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 32px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #30b0c7;
  font-weight: 800;
}
.brand small { display: block; color: #aab4c5; margin-top: 2px; }
.nav { display: grid; gap: 6px; }
.nav a {
  color: #dbe4f0;
  padding: 11px 12px;
  border-radius: 8px;
}
.nav a.active, .nav a:hover { background: #243044; color: #fff; text-decoration: none; }
.main { padding: 28px; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 22px;
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 28px; }
h2 { margin-bottom: 14px; font-size: 18px; }
.topbar p { color: var(--muted); margin-bottom: 0; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.ghost-button, button, .primary-link {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 650;
  cursor: pointer;
}
.ghost-button {
  color: var(--accent);
  background: transparent;
}
button.danger { background: var(--bad); border-color: var(--bad); }
.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.metric, .panel, .lead-card, .toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.metric { padding: 16px; }
.metric span { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 6px; font-size: 24px; }
.toolbar { padding: 14px; margin-bottom: 18px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
label { display: grid; gap: 6px; color: var(--muted); font-weight: 600; }
input, select {
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  background: #fff;
}
.lead-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}
.lead-card { padding: 16px; display: grid; gap: 12px; }
.lead-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.lead-title { font-weight: 800; color: var(--ink); }
.lead-head p { color: var(--muted); margin-bottom: 0; }
.badge {
  border-radius: 999px;
  padding: 4px 9px;
  background: #edf2f7;
  color: #344054;
  font-size: 12px;
  white-space: nowrap;
}
.status-client .badge { background: #dcfae6; color: var(--ok); }
.status-assigned .badge { background: #fef0c7; color: var(--warn); }
.status-need_call .badge { background: #fff7ed; color: #c2410c; }
.status-closed .badge, .status-burned .badge { background: #fee4e2; color: var(--bad); }
.question {
  margin: 0;
  color: #344054;
  min-height: 42px;
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
  margin: 0;
}
.facts div, .detail-list div {
  padding: 10px;
  border-radius: 8px;
  background: #f8fafc;
}
dt { color: var(--muted); font-size: 12px; }
dd { margin: 2px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.card-actions { display: flex; gap: 10px; }
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  margin-bottom: 16px;
}
.panel { padding: 18px; }
.detail-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.actions-panel form { display: grid; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.timeline { display: grid; gap: 10px; }
.message {
  max-width: 780px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f8fafc;
}
.message.outgoing { margin-left: auto; background: #eef6fb; }
.message.bot { background: #f2f4f7; color: var(--muted); }
.message-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.message p { margin: 6px 0 0; white-space: pre-wrap; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0; }
.empty { padding: 24px; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: 8px; }

@media (max-width: 900px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .detail-layout { grid-template-columns: 1fr; }
  .super-hero { flex-direction: column; }
  .super-metrics { grid-template-columns: repeat(2, 1fr); }
  .super-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .super-form .wide { grid-column: 1 / -1; }
  .super-form button { grid-column: 1 / -1; }
  .super-table-head { display: none; }
  .super-row { grid-template-columns: 1fr; }
  .license-request-main,
  .license-request-meta,
  .license-request-actions { grid-template-columns: 1fr; }
  .license-request-main p { grid-column: auto; }
  .license-request-actions button { width: 100%; }
}

textarea {
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.super-admin-sales-page {
  display: block;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(20, 108, 148, .13), transparent 34rem),
    linear-gradient(180deg, #f8fafc 0%, #eef3f8 100%);
}
.super-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}
.super-hero,
.super-panel,
.super-metrics article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .88);
  box-shadow: var(--shadow);
}
.super-hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding: 24px;
  margin-bottom: 16px;
}
.super-hero h1 {
  margin: 0 0 6px;
  font-size: 32px;
}
.super-hero p { max-width: 720px; color: var(--muted); margin-bottom: 0; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .08em;
}
.super-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.super-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.super-metrics article { padding: 16px; }
.super-metrics span { color: var(--muted); font-size: 12px; }
.super-metrics strong { display: block; margin-top: 6px; font-size: 28px; }
.super-panel { padding: 18px; margin-bottom: 16px; }
.super-panel > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.super-panel h2 { margin-bottom: 4px; }
.super-panel p { color: var(--muted); margin-bottom: 0; }
.super-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}
.super-form .wide { grid-column: span 2; }
.super-form textarea {
  width: 100%;
  min-height: 118px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--panel);
  font: inherit;
}
.created-license,
.super-error {
  margin-top: 14px;
  border-radius: 8px;
  padding: 12px;
}
.created-license {
  display: grid;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--ok) 40%, var(--line));
  background: color-mix(in srgb, var(--ok) 9%, #fff);
}
.created-license span { color: var(--muted); font-size: 12px; }
.created-license strong {
  color: var(--ok);
  font-size: 20px;
  overflow-wrap: anywhere;
  letter-spacing: .06em;
}
.super-error {
  border: 1px solid color-mix(in srgb, var(--bad) 38%, var(--line));
  background: color-mix(in srgb, var(--bad) 8%, #fff);
  color: var(--bad);
}
.super-table { display: grid; gap: 8px; }
.super-table-head,
.super-row {
  display: grid;
  grid-template-columns: minmax(120px, .8fr) 110px minmax(160px, 1fr) minmax(120px, .8fr) minmax(130px, .8fr) minmax(160px, 1fr) 100px;
  gap: 10px;
  align-items: center;
}
.super-table-head {
  padding: 0 10px 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.super-row {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.super-row.highlight { border-color: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 12%, transparent); }
.super-row > * { min-width: 0; overflow-wrap: anywhere; }
.super-row form { margin: 0; }
.super-row button { padding: 8px 10px; }
.license-request-list {
  display: grid;
  gap: 12px;
}
.license-request-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #f8fafc);
}
.license-request-card.handled {
  opacity: .72;
  background: #f8fafc;
}
.license-request-main {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 10px;
  align-items: center;
}
.license-request-main h3 {
  margin: 0;
  font-size: 18px;
}
.license-request-main p {
  grid-column: 2;
  margin: -2px 0 0;
  color: var(--muted);
}
.license-request-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}
.license-request-meta div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: rgba(255, 255, 255, .72);
}
.license-request-meta dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.license-request-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}
.license-request-comment,
.license-request-note {
  margin: 0;
  border-radius: 8px;
  padding: 10px;
  line-height: 1.5;
}
.license-request-comment {
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, #fff);
}
.license-request-note {
  border: 1px dashed var(--line);
  color: var(--muted);
}
.license-request-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.license-request-actions button {
  white-space: nowrap;
}
.license-status {
  justify-self: start;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 800;
}
.status-activated { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 42%, var(--line)); }
.status-new { color: var(--accent-strong); border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); }
.status-revoked, .status-expired { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 38%, var(--line)); }
.crm-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: -8px 0 20px;
}
.crm-strip a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(16, 24, 40, 0.04);
}
.crm-strip a:hover { text-decoration: none; border-color: #9fc7d6; background: #e7f4f8; }
.crm-strip strong { color: var(--accent-strong); }
.funnel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 320px);
  gap: 14px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 8px;
}
.funnel-column {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  padding: 12px;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}
.funnel-column.drag-over {
  border-color: #146c94;
  background: #e7f4f8;
  transform: translateY(-2px);
}
.funnel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.funnel-head h2 { margin: 0; }
.funnel-head span {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #e7f4f8;
  color: var(--accent-strong);
  font-weight: 800;
}
.funnel-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.chat-card {
  position: relative;
  width: 100%;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px;
  display: grid;
  gap: 10px;
  cursor: grab;
}
.chat-card .lead-head,
.chat-card .lead-head > div {
  min-width: 0;
}
.chat-card .lead-title,
.chat-card .lead-head p,
.chat-card .question {
  overflow-wrap: anywhere;
}
.chat-card .badge {
  max-width: 118px;
  white-space: normal;
  text-align: center;
}
.chat-card .facts {
  grid-template-columns: 1fr;
}
.chat-card:active { cursor: grabbing; }
.chat-card.dragging { opacity: 0.62; transform: rotate(1deg) scale(0.99); }
.chat-card.status-lead { border-left-color: #0ea5e9; }
.chat-card.status-client { border-left-color: var(--ok); }
.chat-card.status-disappeared,
.chat-card.status-not_enrolled,
.chat-card.status-trained_left,
.chat-card.status-no_money { border-left-color: var(--bad); }
.chat-card.status-irregular { border-left-color: var(--warn); }
.status-lost .badge { background: #fee4e2; color: var(--bad); }
.status-disappeared .badge,
.status-not_enrolled .badge,
.status-trained_left .badge,
.status-no_money .badge { background: #fee4e2; color: var(--bad); }
.status-lead .badge { background: #e0f2fe; color: #026aa2; }
.status-irregular .badge { background: #fef0c7; color: var(--warn); }
.status-new .badge { background: #f2f4f7; color: #475467; }
.crm-profile .primary-link, .crm-profile .inline { display: inline-block; margin-right: 8px; margin-top: 8px; }
.note-box {
  padding: 12px;
  margin: 0 0 14px;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}
.note-box p { margin: 6px 0 0; color: #7c2d12; white-space: pre-wrap; }

@media (max-width: 900px) {
  .crm-strip { grid-template-columns: repeat(2, 1fr); }
}

body {
  background:
    radial-gradient(circle at 18% 0%, rgba(20, 108, 148, 0.10), transparent 28%),
    linear-gradient(180deg, #f7fafc 0%, #edf3f7 100%);
}
.sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #162235 100%);
  box-shadow: 10px 0 30px rgba(15, 23, 42, 0.10);
}
.brand-mark { background: linear-gradient(135deg, #2dd4bf, #38bdf8); }
.topbar {
  padding: 4px 0 8px;
  border-bottom: 1px solid rgba(216, 222, 232, 0.72);
}
.metric {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
  border-color: rgba(159, 199, 214, 0.55);
}
.metric strong { color: #0f5678; }
.lead-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(250px, 1fr));
  gap: 14px;
  align-items: start;
  overflow-x: auto;
  padding: 2px 2px 12px;
}
.board-column {
  min-width: 250px;
  min-height: 420px;
  padding: 12px;
  border: 1px solid rgba(216, 222, 232, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}
.board-column.drag-over {
  border-color: #146c94;
  background: #e7f4f8;
  transform: translateY(-2px);
}
.board-dropzone {
  display: grid;
  gap: 10px;
  min-height: 320px;
}
.board-card {
  position: relative;
  cursor: grab;
  border-left: 4px solid #94a3b8;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}
.board-card:active { cursor: grabbing; }
.board-card.dragging {
  opacity: 0.62;
  transform: rotate(1deg) scale(0.99);
}
.board-column.status-assigned .board-card, .board-card.status-assigned { border-left-color: #0ea5e9; }
.board-column.status-need_call .board-card, .board-card.status-need_call { border-left-color: #f97316; }
.board-column.status-client .board-card, .board-card.status-client { border-left-color: #178c5f; }
.board-column.status-closed .board-card, .board-card.status-closed { border-left-color: #b42318; }
.board-column.status-burned .board-card, .board-card.status-burned { border-left-color: #b7791f; }
.board-card:hover, .chat-card:hover, .lead-card:hover {
  box-shadow: 0 20px 44px rgba(16, 24, 40, 0.12);
  transform: translateY(-1px);
}
.drag-handle {
  position: absolute;
  top: 10px;
  right: 10px;
  color: #98a2b3;
  font-weight: 800;
  letter-spacing: -2px;
  cursor: grab;
  user-select: none;
}
.state-control {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}
.state-control select {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  font-size: 13px;
}
.charts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.chart-panel {
  min-height: 320px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
}
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}
.chart-head h2 { margin: 0; }
.chart-head span {
  color: var(--muted);
  font-size: 12px;
}
.chart-panel canvas {
  width: 100%;
  display: block;
}
.stats-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.stats-period-copy h2 {
  margin: 0 0 4px;
}
.stats-period-copy p {
  margin: 0;
  color: var(--muted);
}
.period-filters {
  margin-top: 0;
}
.seller-settings {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.seller-create {
  position: sticky;
  top: 28px;
}
.seller-form,
.seller-list {
  display: grid;
  gap: 12px;
}
.seller-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(150px, 0.8fr) minmax(110px, 0.5fr) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.seller-row.is-inactive {
  opacity: 0.68;
}
.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 41px;
}
.checkbox-line input {
  min-width: 0;
  width: 16px;
  height: 16px;
  padding: 0;
}
.seller-usage {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}
.seller-usage div {
  padding: 8px;
  border-radius: 8px;
  background: #fff;
}
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}
.section-head h2,
.section-head p {
  margin: 0;
}
.section-head p {
  color: var(--muted);
}
.compact-empty {
  padding: 12px;
}
.seller-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 16px;
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid rgba(159, 199, 214, 0.62);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbfd 100%);
  box-shadow: var(--shadow);
}
.seller-hero-copy {
  display: grid;
  gap: 8px;
  align-content: center;
}
.eyebrow {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}
.seller-hero h2 {
  margin: 0;
  font-size: 24px;
}
.seller-hero p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
}
.seller-overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.seller-overview div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.seller-overview span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.seller-overview strong {
  display: block;
  margin-top: 6px;
  color: var(--accent-strong);
  font-size: 26px;
}
.seller-settings-redesign {
  grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
  gap: 18px;
}
.seller-create-redesign {
  padding: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
}
.seller-card-head {
  display: flex;
  gap: 12px;
  align-items: start;
  margin-bottom: 16px;
}
.seller-card-head h2,
.seller-card-head p {
  margin: 0;
}
.seller-card-head p {
  margin-top: 4px;
  color: var(--muted);
}
.seller-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid #b9d7e4;
  border-radius: 8px;
  background: #e7f4f8;
  color: var(--accent-strong);
  font-weight: 900;
}
.seller-avatar-add {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-size: 24px;
}
.seller-form-card {
  gap: 14px;
}
.switch-line {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 10px;
  min-height: 38px;
  color: var(--ink);
  font-weight: 700;
}
.switch-line input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switch-line span {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 140ms ease;
}
.switch-line span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(16, 24, 40, 0.22);
  transition: transform 140ms ease;
}
.switch-line input:checked + span {
  background: var(--accent);
}
.switch-line input:checked + span::after {
  transform: translateX(18px);
}
.seller-directory {
  padding: 18px;
}
.seller-directory-head {
  align-items: end;
}
.seller-summary-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.seller-summary-pills span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #344054;
  font-weight: 750;
}
.seller-card-list {
  gap: 12px;
}
.seller-card-row {
  grid-template-columns: minmax(180px, 0.8fr) minmax(300px, 1.15fr) minmax(240px, 1fr) auto;
  padding: 14px;
  background: #fff;
  border-color: rgba(159, 199, 214, 0.55);
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.06);
}
.seller-card-row:hover {
  border-color: #9fc7d6;
  box-shadow: 0 18px 38px rgba(16, 24, 40, 0.10);
}
.seller-card-row.is-inactive {
  background: #f2f4f7;
  border-style: dashed;
}
.seller-identity {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}
.seller-identity strong,
.seller-identity span {
  display: block;
  overflow-wrap: anywhere;
}
.seller-identity strong {
  color: var(--ink);
  font-size: 16px;
}
.seller-identity span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}
.seller-fields {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(130px, 0.85fr);
  gap: 10px;
}
.seller-fields input {
  width: 100%;
  min-width: 0;
}
.seller-usage-redesign {
  grid-template-columns: repeat(4, minmax(54px, 1fr));
  align-self: stretch;
}
.seller-usage-redesign div {
  display: grid;
  align-content: center;
  min-height: 58px;
  border: 1px solid #e4eaf1;
  background: #f8fafc;
}
.seller-usage-redesign dd {
  font-size: 18px;
  color: var(--accent-strong);
}
.seller-card-actions {
  display: grid;
  gap: 10px;
  align-content: end;
  min-width: 120px;
}
.compact-switch {
  grid-template-columns: auto auto;
  justify-content: end;
  color: var(--muted);
  font-size: 12px;
}
.seller-empty {
  text-align: center;
}
.seller-empty h2 {
  margin-bottom: 6px;
}
.seller-empty p {
  margin: 0;
}
table {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}
tbody tr:hover { background: #f8fafc; }
.toolbar {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
}
.better-filters {
  display: grid;
  grid-template-columns: minmax(300px, 2fr) minmax(170px, 0.75fr) minmax(170px, 0.75fr) auto;
  gap: 12px;
  align-items: end;
}
.search-field input {
  width: 100%;
  min-width: 0;
  padding-left: 38px;
  background:
    linear-gradient(transparent, transparent),
    #fff;
  background-image:
    url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m21 21-4.35-4.35m1.35-5.65a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z' stroke='%23667085' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px 50%;
}
.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.filter-actions .ghost-button {
  display: inline-flex;
  align-items: center;
  min-height: 41px;
}
.filter-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
}
.filter-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
}
.filter-meta strong { color: var(--ink); }
.quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.quick-filters a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #344054;
  font-weight: 650;
}
.quick-filters a:hover {
  border-color: #9fc7d6;
  background: #e7f4f8;
  text-decoration: none;
}
.quick-filters a.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.triage-layout {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.triage-side {
  position: sticky;
  top: 28px;
  display: grid;
  gap: 14px;
}
.triage-score {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.triage-score span { color: var(--muted); font-weight: 700; }
.triage-score strong { font-size: 28px; color: var(--accent-strong); }
.triage-score.muted strong { color: #475467; }
.triage-progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4eaf1;
}
.triage-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}
.triage-status-list {
  display: grid;
  gap: 9px;
}
.triage-action {
  width: 100%;
  border-color: #cbd5e1;
  background: #fff;
  color: var(--ink);
  text-align: left;
}
.triage-action:hover { border-color: #9fc7d6; background: #eef6fb; }
.triage-action.action-need_call { border-color: #fed7aa; color: #c2410c; }
.triage-action.action-assigned { border-color: #bae6fd; color: #026aa2; }
.triage-action.action-client { border-color: #bbf7d0; color: var(--ok); }
.triage-action.action-closed,
.triage-action.action-burned { border-color: #fecaca; color: var(--bad); }
.triage-full-link {
  display: inline-flex;
  justify-content: center;
  text-align: center;
}
.triage-stage {
  min-height: 620px;
  display: grid;
  place-items: start center;
}
.triage-deck {
  position: relative;
  width: min(100%, 620px);
  height: 620px;
}
.triage-card {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: 16px;
  min-height: 560px;
  padding: 22px;
  border: 1px solid rgba(159, 199, 214, 0.62);
  border-left: 5px solid #94a3b8;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
  box-shadow: 0 28px 70px rgba(16, 24, 40, 0.16);
  transform: translateY(var(--offset, 0)) scale(var(--scale, 1));
  transition: transform 180ms ease, opacity 180ms ease, box-shadow 180ms ease;
  touch-action: none;
  user-select: none;
}
.triage-card:not(.is-active) {
  opacity: 0.62;
  box-shadow: 0 18px 38px rgba(16, 24, 40, 0.10);
}
.triage-card.is-dragging {
  transition: none;
}
.triage-card::after {
  content: attr(data-decision-label);
  position: absolute;
  top: 20px;
  right: 20px;
  min-width: 120px;
  padding: 8px 12px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.92);
  font-weight: 800;
  text-align: center;
  opacity: 0;
  transform: rotate(4deg);
  pointer-events: none;
}
.triage-card[data-decision-label]:not([data-decision-label=""])::after {
  opacity: 1;
}
.triage-card.leave-assigned { transform: translateX(760px) rotate(14deg); opacity: 0; }
.triage-card.leave-burned { transform: translateX(-760px) rotate(-14deg); opacity: 0; }
.triage-card.leave-need_call { transform: translateY(-720px) rotate(-5deg); opacity: 0; }
.triage-card.leave-closed { transform: translateY(720px) rotate(5deg); opacity: 0; }
.triage-card.leave-client { transform: translateX(760px) translateY(-120px) rotate(10deg); opacity: 0; }
.triage-card-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}
.triage-card-top h2 {
  margin: 10px 0 4px;
  font-size: 24px;
}
.triage-card-top p {
  margin: 0;
  color: var(--muted);
}
.triage-question {
  padding: 16px;
  border: 1px solid #dbe8ef;
  border-radius: 8px;
  background: #eef6fb;
}
.triage-question span {
  display: block;
  margin-bottom: 8px;
  color: var(--accent-strong);
  font-weight: 800;
}
.triage-question p {
  margin: 0;
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  white-space: pre-wrap;
}
.triage-thread {
  display: grid;
  gap: 8px;
  overflow: auto;
}
.triage-thread p {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  color: #344054;
}
.triage-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.triage-card-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.triage-card-actions a,
.triage-card-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 8px;
}
.triage-empty {
  width: min(100%, 560px);
  padding: 34px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: center;
}
.triage-empty.is-hidden { display: none; }
.is-busy .triage-action,
.is-busy .triage-card-actions button {
  opacity: 0.68;
  pointer-events: none;
}

@media (max-width: 1200px) {
  .charts-grid { grid-template-columns: 1fr; }
  .lead-board { grid-template-columns: repeat(6, minmax(240px, 1fr)); }
  .better-filters { grid-template-columns: minmax(260px, 1fr) minmax(160px, 0.5fr); }
  .filter-actions { grid-column: 1 / -1; }
  .seller-settings { grid-template-columns: 1fr; }
  .seller-create { position: static; }
  .seller-hero { grid-template-columns: 1fr; }
  .seller-row,
  .seller-card-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seller-card-actions { grid-column: 1 / -1; grid-template-columns: 1fr auto; align-items: center; }
  .seller-usage { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .better-filters { grid-template-columns: 1fr; }
  .filter-actions { align-items: stretch; }
  .filter-actions button,
  .filter-actions .ghost-button {
    justify-content: center;
    flex: 1;
  }
  .triage-layout { grid-template-columns: 1fr; }
  .triage-side { position: static; }
  .triage-stage { min-height: 560px; }
  .triage-deck { height: 580px; }
  .triage-card { min-height: 530px; padding: 16px; }
  .triage-card-actions,
  .triage-facts { grid-template-columns: 1fr; }
  .seller-row,
  .seller-card-row,
  .seller-fields,
  .seller-overview,
  .seller-usage { grid-template-columns: 1fr; }
  .seller-card-actions { grid-template-columns: 1fr; }
  .compact-switch { justify-content: start; }
}

.login-page {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(48, 176, 199, 0.16), transparent 34%),
    linear-gradient(145deg, #edf5f8 0%, #f7f8fb 48%, #eef2f7 100%);
}
.login-shell {
  width: min(100%, 420px);
  padding: 0;
}
.login-card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}
.login-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 26px;
}
.login-brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}
.login-form {
  display: grid;
  gap: 14px;
}
.login-form input {
  width: 100%;
  min-width: 0;
  font-size: 16px;
}
.login-form button {
  width: 100%;
  min-height: 44px;
}
.login-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #f5b7b1;
  border-radius: 8px;
  background: #fff1f0;
  color: var(--bad);
  font-weight: 700;
}

/* YouGile-inspired workspace skin */
:root {
  --bg: #f1f2f7;
  --panel: #ffffff;
  --ink: #202230;
  --muted: #75798a;
  --line: #dde0ea;
  --accent: #6a5cff;
  --accent-strong: #4e42d8;
  --accent-soft: #eceaff;
  --ok: #21a67a;
  --warn: #d79122;
  --bad: #d14d45;
  --sidebar-bg: #232232;
  --sidebar-panel: #302f42;
  --sidebar-text: #f6f4ff;
  --sidebar-muted: #aaa7bd;
  --shadow: 0 14px 34px rgba(32, 34, 48, 0.08);
  --shadow-strong: 0 20px 46px rgba(32, 34, 48, 0.14);
  --radius: 8px;
}

body {
  grid-template-columns: 282px minmax(0, 1fr);
  background:
    linear-gradient(90deg, rgba(255,255,255,0.54) 0 1px, transparent 1px 48px),
    linear-gradient(180deg, #f7f7fb 0%, #eeeff6 100%);
  color: var(--ink);
  font: 14px/1.45 Inter, "Segoe UI", Arial, sans-serif;
}

a {
  color: var(--accent-strong);
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.sidebar {
  z-index: 20;
  padding: 18px 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), transparent 46%),
    var(--sidebar-bg);
  color: var(--sidebar-text);
  box-shadow: 18px 0 42px rgba(30, 30, 48, 0.16);
}

.brand {
  min-height: 78px;
  margin: 0 0 16px;
  padding: 14px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.045);
}

.brand-mark {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #ffda62 0%, #8b7cff 54%, #44c8ff 100%);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(106, 92, 255, 0.34);
}

.brand strong {
  color: #ffffff;
  font-size: 15px;
}

.brand small {
  color: var(--sidebar-muted);
}

.nav {
  gap: 4px;
}

.nav a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px 10px 40px;
  border-radius: var(--radius);
  color: #dcd9eb;
  font-weight: 720;
}

.nav a::before {
  content: "";
  position: absolute;
  left: 14px;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: rgba(255,255,255,0.22);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
}

.nav a:hover {
  background: rgba(255,255,255,0.075);
  color: #ffffff;
  text-decoration: none;
}

.nav a.active {
  background: var(--sidebar-panel);
  color: #ffffff;
  box-shadow: inset 3px 0 0 #ffda62, 0 10px 24px rgba(0,0,0,0.14);
}

.nav a.active::before {
  background: #ffda62;
  box-shadow: 0 0 0 4px rgba(255,218,98,0.12);
}

.main {
  min-width: 0;
  padding: 22px 24px 34px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  align-items: center;
  margin: -22px -24px 18px;
  padding: 18px 24px 16px;
  border-bottom: 1px solid rgba(218, 222, 234, 0.82);
  background: rgba(247, 247, 251, 0.88);
  backdrop-filter: blur(16px);
}

h1 {
  margin-bottom: 3px;
  font-size: clamp(25px, 2vw, 34px);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  letter-spacing: 0;
}

.topbar p {
  max-width: 860px;
  color: var(--muted);
}

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ghost-button,
button,
.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 9px 18px rgba(106, 92, 255, 0.18);
  font-weight: 760;
}

.ghost-button {
  border-color: var(--line);
  background: rgba(255,255,255,0.72);
  color: var(--ink);
  box-shadow: none;
}

button:hover,
.primary-link:hover {
  background: var(--accent-strong);
  color: #ffffff;
  text-decoration: none;
  transform: translateY(-1px);
}

.ghost-button:hover {
  border-color: #c5c9d7;
  background: #ffffff;
  color: var(--accent-strong);
  text-decoration: none;
}

button.danger {
  background: var(--bad);
  border-color: var(--bad);
  box-shadow: 0 9px 18px rgba(209, 77, 69, 0.16);
}

.metrics {
  grid-template-columns: repeat(6, minmax(132px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric,
.panel,
.lead-card,
.toolbar,
.chat-card,
.board-column,
.funnel-column {
  border-color: rgba(221, 224, 234, 0.92);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric {
  position: relative;
  min-height: 92px;
  padding: 14px 15px;
  overflow: hidden;
  background: #ffffff;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #ffda62, var(--accent));
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.metric strong {
  color: var(--ink);
  font-size: 27px;
  line-height: 1.1;
}

.crm-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, max-content);
  gap: 8px;
  overflow-x: auto;
  margin: 0 0 16px;
  padding: 2px 2px 8px;
}

.crm-strip a {
  min-height: 40px;
  border: 1px solid rgba(221, 224, 234, 0.94);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.82);
  color: var(--ink);
  box-shadow: none;
  white-space: nowrap;
}

.crm-strip a:hover {
  border-color: rgba(106, 92, 255, 0.34);
  background: var(--accent-soft);
  color: var(--accent-strong);
  transform: translateY(-1px);
}

.crm-strip strong {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(106, 92, 255, 0.20);
  background: #ffffff;
  color: #4e42d8;
  box-shadow: 0 4px 12px rgba(32, 34, 48, 0.08);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.toolbar {
  padding: 16px;
  margin-bottom: 16px;
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(14px);
}

label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

input,
select,
textarea {
  border-color: #d8dce8;
  background: #ffffff;
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(106, 92, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(106, 92, 255, 0.12);
}

.better-filters {
  grid-template-columns: minmax(340px, 2fr) minmax(190px, 0.75fr) minmax(190px, 0.75fr) auto;
  gap: 10px;
}

.search-field input {
  background-color: #ffffff;
  background-image:
    url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m21 21-4.35-4.35m1.35-5.65a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z' stroke='%2375798a' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.filter-meta span,
.quick-filters a,
.seller-summary-pills span {
  border-color: #dde0ea;
  background: #ffffff;
  color: #4f5365;
}

.quick-filters a.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.quick-filters a:hover {
  border-color: rgba(106, 92, 255, 0.36);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.lead-board,
.funnel {
  gap: 12px;
  padding: 2px 2px 14px;
  scrollbar-color: #c6c8d4 transparent;
}

.lead-board {
  grid-template-columns: repeat(6, minmax(286px, 1fr));
}

.funnel {
  grid-auto-columns: minmax(300px, 336px);
}

.board-column,
.funnel-column {
  min-width: 286px;
  padding: 10px;
  background: rgba(248, 248, 252, 0.92);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.78), 0 12px 28px rgba(32, 34, 48, 0.07);
}

.funnel-column {
  min-width: 300px;
}

.board-column.drag-over,
.funnel-column.drag-over {
  border-color: rgba(106, 92, 255, 0.72);
  background: #f1efff;
  box-shadow: 0 0 0 3px rgba(106, 92, 255, 0.12), var(--shadow);
}

.funnel-head {
  min-height: 36px;
  margin-bottom: 8px;
  padding: 2px 3px 7px;
  border-bottom: 1px solid rgba(221, 224, 234, 0.76);
}

.funnel-head h2 {
  color: #4b4f61;
  font-size: 14px;
  font-weight: 850;
}

.funnel-head span {
  min-width: 28px;
  height: 26px;
  background: #ffffff;
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px rgba(221, 224, 234, 0.92);
}

.board-dropzone,
.funnel-list {
  gap: 8px;
}

.lead-card,
.board-card,
.chat-card {
  background: #ffffff;
  border-left-width: 5px;
  padding: 12px;
  box-shadow: 0 7px 18px rgba(32, 34, 48, 0.075);
}

.board-card:hover,
.chat-card:hover,
.lead-card:hover {
  box-shadow: var(--shadow-strong);
}

.lead-head {
  gap: 9px;
}

.lead-title {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
}

.lead-head p {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 8px;
  background: #f0f1f6;
  color: #565b6d;
  font-weight: 780;
}

.status-client .badge {
  border-color: #b9ead8;
  background: #e3f9ef;
  color: #12805d;
}

.status-assigned .badge,
.status-lead .badge {
  border-color: #c9d4ff;
  background: #eef0ff;
  color: var(--accent-strong);
}

.status-need_call .badge {
  border-color: #fbdba4;
  background: #fff4dd;
  color: #a85f05;
}

.status-irregular .badge {
  border-color: #f7d990;
  background: #fff5dd;
  color: #9a6508;
}

.status-closed .badge,
.status-burned .badge,
.status-lost .badge,
.status-disappeared .badge,
.status-not_enrolled .badge,
.status-trained_left .badge,
.status-no_money .badge {
  border-color: #f3c4c0;
  background: #fff0ef;
  color: var(--bad);
}

.question {
  min-height: 0;
  padding: 9px 10px;
  border: 1px solid #eceef5;
  border-radius: var(--radius);
  background: #fafafe;
  color: #383b4d;
  font-size: 13px;
  line-height: 1.42;
}

.facts {
  gap: 6px;
}

.facts div,
.detail-list div,
.seller-usage div,
.seller-overview div {
  border: 1px solid #eceef5;
  background: #fafafe;
}

dt {
  color: var(--muted);
  font-weight: 760;
}

dd {
  color: #303345;
}

.state-control select {
  min-height: 36px;
  background: #fbfbff;
}

.card-actions {
  align-items: center;
}

.card-actions .primary-link,
.card-actions .ghost-button {
  min-height: 34px;
  padding: 8px 10px;
  font-size: 13px;
}

.drag-handle {
  top: 8px;
  right: 9px;
  color: #b5b8c6;
}

.detail-layout {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
}

.panel {
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(10px);
}

.detail-list {
  gap: 8px;
}

.actions-panel {
  position: sticky;
  top: 96px;
}

.actions-panel form {
  border-top-color: #eceef5;
}

.timeline {
  background: rgba(255,255,255,0.88);
}

.message {
  border-color: #e2e5ef;
  background: #fbfbff;
}

.message.outgoing {
  background: #efedff;
  border-color: #d9d3ff;
}

.message.bot {
  background: #f4f5f9;
}

.message-meta {
  color: var(--muted);
}

.note-box {
  border-color: #f3dcaa;
  background: #fff7e8;
}

.charts-grid {
  gap: 12px;
}

.chart-panel {
  min-height: 330px;
  background: #ffffff;
}

.chart-head {
  padding-bottom: 9px;
  border-bottom: 1px solid #eceef5;
}

.chart-head h2,
.section-head h2 {
  color: #303345;
}

.chart-head span,
.section-head p,
.stats-period-copy p {
  color: var(--muted);
}

table {
  border: 1px solid #e7e9f1;
  box-shadow: var(--shadow);
}

th {
  background: #f7f7fb;
  color: #696d7f;
  font-weight: 850;
}

td {
  background: #ffffff;
}

tbody tr:hover td {
  background: #fafafe;
}

.triage-layout {
  gap: 16px;
}

.triage-side {
  top: 96px;
}

.triage-score,
.triage-action,
.triage-question,
.triage-thread p {
  border-color: #e7e9f1;
  background: #ffffff;
}

.triage-score strong {
  color: var(--accent-strong);
}

.triage-progress {
  background: #e5e6ee;
}

.triage-progress span {
  background: linear-gradient(90deg, #ffda62, var(--accent));
}

.triage-action {
  min-height: 42px;
  color: #383b4d;
  box-shadow: none;
}

.triage-action:hover {
  background: var(--accent-soft);
  border-color: rgba(106, 92, 255, 0.36);
  color: var(--accent-strong);
  transform: none;
}

.triage-card {
  border-color: #e2e5ef;
  background: #ffffff;
  box-shadow: 0 24px 58px rgba(32, 34, 48, 0.16);
}

.triage-card:not(.is-active) {
  background: #fafafe;
}

.triage-card::after {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.triage-question {
  background: #f5f4ff;
}

.triage-question span {
  color: var(--accent-strong);
}

.triage-card-actions {
  gap: 8px;
}

.seller-hero {
  border-color: #e2e5ef;
  background:
    linear-gradient(90deg, rgba(106,92,255,0.09), transparent 42%),
    #ffffff;
}

.eyebrow,
.seller-overview strong,
.seller-usage-redesign dd {
  color: var(--accent-strong);
}

.seller-create-redesign,
.seller-card-row,
.seller-directory {
  background: rgba(255,255,255,0.92);
}

.seller-avatar {
  border-color: #dad5ff;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.seller-avatar-add {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.switch-line input:checked + span {
  background: var(--accent);
}

.seller-summary-pills span {
  font-weight: 780;
}

.empty {
  border-color: #d9dce8;
  background: rgba(255,255,255,0.78);
}

.login-page {
  display: grid;
  grid-template-columns: 1fr;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.58) 0 1px, transparent 1px 48px),
    linear-gradient(135deg, #242333 0%, #343247 42%, #f2f2f7 42.2%, #f7f7fb 100%);
}

.login-shell {
  width: min(100%, 440px);
}

.login-card {
  border-color: rgba(255,255,255,0.52);
  background: rgba(255,255,255,0.94);
  box-shadow: 0 28px 70px rgba(22, 22, 35, 0.24);
}

.login-brand .brand-mark {
  background: linear-gradient(135deg, #ffda62 0%, #8b7cff 54%, #44c8ff 100%);
}

.login-brand strong {
  color: var(--ink);
}

.login-form button {
  background: var(--accent);
}

@media (max-width: 1280px) {
  body {
    grid-template-columns: 248px minmax(0, 1fr);
  }
  .metrics {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }
  .lead-board {
    grid-template-columns: repeat(6, minmax(276px, 1fr));
  }
}

@media (max-width: 900px) {
  body {
    display: block;
  }
  .sidebar {
    position: static;
    height: auto;
  }
  .brand {
    min-height: auto;
    margin-bottom: 10px;
  }
  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .nav a {
    flex: 0 0 auto;
    padding: 10px 12px 10px 34px;
  }
  .main {
    padding: 16px;
  }
  .topbar {
    position: static;
    margin: -16px -16px 14px;
    padding: 16px;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .actions-panel {
    position: static;
  }
}

@media (max-width: 700px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }
  .topbar-actions {
    justify-content: flex-start;
  }
  .metrics {
    grid-template-columns: 1fr;
  }
  .better-filters {
    grid-template-columns: 1fr;
  }
  .lead-board {
    grid-template-columns: repeat(6, minmax(272px, 1fr));
  }
  .funnel {
    grid-auto-columns: minmax(286px, 1fr);
  }
}

body {
  overflow-x: hidden;
}

.main {
  overflow-x: hidden;
}

.lead-board,
.funnel {
  max-width: 100%;
}

.board-column,
.funnel-column {
  display: flex;
  flex-direction: column;
  max-height: min(74vh, 760px);
}

.board-dropzone,
.funnel-list {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: #c6c8d4 transparent;
}

.board-dropzone::-webkit-scrollbar,
.funnel-list::-webkit-scrollbar {
  width: 8px;
}

.board-dropzone::-webkit-scrollbar-thumb,
.funnel-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #c6c8d4;
}

@media (max-width: 700px) {
  .board-column,
  .funnel-column {
    max-height: none;
  }
}

/* Automation messenger */
.automation-shell {
  display: grid;
  grid-template-columns: minmax(310px, 380px) minmax(0, 1fr);
  height: clamp(560px, calc(100vh - 250px), 760px);
  min-height: 0;
  overflow: hidden;
  border: 1px solid #d9dce8;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.automation-dialogs-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e5e7f0;
  background: #f7f8fc;
}

.automation-dialogs-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #e5e7f0;
}

.automation-dialogs-head h2,
.automation-dialogs-head p {
  margin: 0;
}

.automation-dialogs-head p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.automation-ai-state {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #fff0ef;
  color: var(--bad);
  font-size: 12px;
  font-weight: 850;
}

.automation-ai-state.is-on {
  background: #e3f9ef;
  color: #12805d;
}

.automation-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid #e5e7f0;
}

.automation-search input {
  min-width: 0;
}

.automation-dialogs-list {
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
}

.tg-dialog {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  color: var(--ink);
}

.tg-dialog:hover {
  background: #eef0ff;
  text-decoration: none;
}

.tg-dialog.active {
  background: #6a5cff;
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(106, 92, 255, 0.24);
}

.tg-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #44c8ff, #8b7cff);
  color: #ffffff;
  font-weight: 900;
}

.tg-avatar.large {
  width: 48px;
  height: 48px;
}

.tg-dialog-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.tg-dialog-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.tg-dialog-top strong,
.tg-dialog-title,
.tg-dialog-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tg-dialog-top strong {
  font-size: 14px;
}

.tg-dialog-top time,
.tg-dialog-title,
.tg-dialog-preview {
  color: var(--muted);
  font-size: 12px;
}

.tg-dialog-preview {
  color: #4d5265;
}

.tg-dialog-preview.outgoing {
  color: var(--accent-strong);
}

.tg-dialog.active .tg-dialog-top time,
.tg-dialog.active .tg-dialog-title,
.tg-dialog.active .tg-dialog-preview,
.tg-dialog.active .tg-dialog-preview.outgoing {
  color: rgba(255,255,255,0.78);
}

.automation-chat-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.36) 0 1px, transparent 1px 32px),
    linear-gradient(180deg, #eef5fb 0%, #e7eef6 100%);
}

.tg-chat-header {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(210, 216, 228, 0.9);
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(12px);
}

.tg-chat-person {
  min-width: 0;
  display: flex;
  gap: 12px;
  align-items: center;
}

.tg-chat-person h2,
.tg-chat-person p {
  margin: 0;
}

.tg-chat-person h2 {
  font-size: 17px;
}

.tg-chat-person p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.tg-chat-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tg-chat-actions form {
  margin: 0;
}

.ai-process-button {
  background: linear-gradient(135deg, #6a5cff, #28a9e8);
}

.ai-process-button[disabled] {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
}

.automation-alert {
  flex: 0 0 auto;
  margin: 12px 16px 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid #d9dce8;
  background: rgba(255,255,255,0.86);
  font-weight: 760;
}

.automation-alert.success {
  border-color: #b9ead8;
  background: #e3f9ef;
  color: #12805d;
}

.automation-alert.error {
  border-color: #f3c4c0;
  background: #fff0ef;
  color: var(--bad);
}

.automation-alert.warning {
  border-color: #f4d899;
  background: #fff7e8;
  color: #946309;
}

.tg-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 16px;
}

.tg-message-row {
  display: grid;
  justify-items: start;
  max-width: min(74%, 720px);
}

.tg-message-row.outgoing {
  align-self: end;
  justify-items: end;
}

.tg-message-bubble {
  position: relative;
  padding: 10px 12px 7px;
  border-radius: 8px 8px 8px 2px;
  background: #ffffff;
  border: 1px solid rgba(213, 218, 230, 0.78);
  box-shadow: 0 6px 16px rgba(32, 34, 48, 0.08);
}

.tg-message-row.outgoing .tg-message-bubble {
  border-color: #c6edcd;
  border-radius: 8px 8px 2px 8px;
  background: #dff6d8;
}

.tg-message-row.is-ai .tg-message-bubble {
  border-color: #c8d3ff;
  background: #eff1ff;
}

.tg-message-bubble p {
  margin: 0;
  color: #202230;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tg-message-bubble time {
  display: block;
  margin-top: 4px;
  color: #7a7f8f;
  font-size: 11px;
  text-align: right;
}

.ai-answer-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 4px 4px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 850;
}

.ai-answer-label span {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 22px;
  padding: 0 5px;
  border-radius: 999px;
  background: #6a5cff;
  color: #ffffff;
  font-size: 11px;
}

.tg-compose-bar {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid rgba(210, 216, 228, 0.9);
  background: rgba(255,255,255,0.9);
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.tg-empty-thread,
.automation-empty-chat,
.automation-empty-list {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.automation-empty-chat {
  display: grid;
  place-content: center;
}

.automation-empty-chat h2,
.automation-empty-chat p {
  margin: 0;
}

@media (max-width: 1100px) {
  .automation-shell {
    grid-template-columns: 320px minmax(0, 1fr);
  }
  .tg-message-row {
    max-width: 86%;
  }
}

@media (max-width: 760px) {
  .automation-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
  }
  .automation-dialogs-panel {
    border-right: 0;
    border-bottom: 1px solid #e5e7f0;
    max-height: 360px;
  }
  .automation-chat-panel {
    min-height: 620px;
  }
  .tg-chat-header,
  .tg-compose-bar {
    align-items: stretch;
    flex-direction: column;
  }
  .tg-chat-actions {
    justify-content: flex-start;
  }
  .tg-message-row {
    max-width: 94%;
  }
}

/* Stats console */
.stats-console {
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid #252a33;
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(51, 162, 255, 0.11), transparent 36%),
    linear-gradient(260deg, rgba(255, 204, 77, 0.09), transparent 32%),
    #111318;
  color: #eef2ff;
  box-shadow: 0 20px 58px rgba(20, 24, 32, 0.22);
}

.stats-console-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.stats-console h2 {
  margin: 6px 0 4px;
  font-size: 24px;
}

.stats-console p {
  max-width: 760px;
  margin: 0;
  color: #a7b0c0;
}

.stats-status {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: #53d769;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.stats-status i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #53d769;
  box-shadow: 0 0 0 5px rgba(83, 215, 105, 0.14);
}

.stats-range {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.stats-range a {
  min-width: 66px;
  padding: 8px 10px;
  border: 1px solid #303640;
  border-radius: 8px;
  background: #171a20;
  color: #a7b0c0;
  text-align: center;
  font-weight: 800;
}

.stats-range a:hover,
.stats-range a.active {
  border-color: #ffcc4d;
  background: #242017;
  color: #ffdf82;
  text-decoration: none;
}

.stats-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}

.stats-kpi {
  position: relative;
  overflow: hidden;
  min-height: 118px;
  padding: 13px;
  border: 1px solid #252a33;
  border-radius: 8px;
  background: #171a20;
}

.stats-kpi span,
.stats-kpi small {
  display: block;
  color: #8c96a8;
  font-weight: 750;
}

.stats-kpi strong {
  display: block;
  margin: 7px 0 4px;
  color: #eef2ff;
  font-size: 28px;
  line-height: 1;
}

.stats-kpi b {
  position: absolute;
  left: 0;
  bottom: 0;
  max-width: 100%;
  height: 3px;
  background: var(--kpi-color, #33a2ff);
}

.accent-blue { --kpi-color: #33a2ff; }
.accent-yellow { --kpi-color: #ffcc4d; }
.accent-purple { --kpi-color: #b678ff; }
.accent-green { --kpi-color: #53d769; }
.accent-red { --kpi-color: #ff6b6b; }
.accent-cyan { --kpi-color: #45d5ff; }

.stats-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
  gap: 14px;
  margin-bottom: 14px;
}

.grafana-panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid #252a33;
  border-radius: 8px;
  background: #111318;
  color: #eef2ff;
  box-shadow: 0 16px 42px rgba(20, 24, 32, 0.18);
}

.grafana-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding-bottom: 11px;
  border-bottom: 1px solid #252a33;
}

.grafana-panel-head span {
  display: block;
  color: #ffcc4d;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.grafana-panel-head h2 {
  margin: 3px 0 0;
  color: #eef2ff;
  font-size: 16px;
}

.grafana-panel-head em {
  color: #8c96a8;
  font-style: normal;
  font-weight: 750;
}

.grafana-panel canvas {
  display: block;
  width: 100%;
  margin-top: 10px;
  border-radius: 8px;
}

.seller-performance {
  margin-bottom: 18px;
}

.stats-table-wrap {
  overflow-x: auto;
}

.stats-table {
  width: 100%;
  min-width: 720px;
  margin-top: 12px;
  border: 0;
  box-shadow: none;
}

.stats-table th {
  border-bottom: 1px solid #252a33;
  background: #171a20;
  color: #8c96a8;
}

.stats-table td {
  border-bottom: 1px solid #252a33;
  background: #111318;
  color: #dbe4f0;
}

.stats-table tbody tr:hover td {
  background: #171a20;
}

.stats-table td strong {
  color: #eef2ff;
}

.conversion-pill {
  display: inline-flex;
  min-width: 58px;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(83, 215, 105, 0.12);
  color: #53d769;
  font-weight: 850;
}

@media (max-width: 1180px) {
  .stats-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stats-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .stats-console-head {
    display: grid;
  }

  .stats-range {
    justify-content: stretch;
  }

  .stats-range a {
    flex: 1 1 72px;
  }

  .stats-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .stats-kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* Motion and mobile polish */
@keyframes adminFadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes adminScaleIn {
  from {
    opacity: 0;
    transform: scale(0.985);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes softPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(51, 162, 255, 0.18);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(51, 162, 255, 0);
  }
}

.topbar,
.metrics,
.crm-strip,
.toolbar,
.lead-grid,
.lead-board,
.funnel,
.stats-console,
.stats-dashboard-grid,
.automation-shell,
.seller-hero,
.seller-settings,
.detail-layout,
.panel {
  animation: adminFadeUp 360ms cubic-bezier(.2,.8,.2,1) both;
}

.metrics { animation-delay: 35ms; }
.crm-strip { animation-delay: 70ms; }
.toolbar,
.stats-console { animation-delay: 90ms; }
.lead-grid,
.lead-board,
.funnel,
.stats-dashboard-grid,
.automation-shell { animation-delay: 125ms; }

.metric,
.lead-card,
.board-card,
.chat-card,
.grafana-panel,
.stats-kpi,
.seller-card-row,
.triage-card,
.tg-dialog {
  will-change: transform;
  transition:
    transform 180ms cubic-bezier(.2,.8,.2,1),
    box-shadow 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    opacity 180ms ease;
}

.metric:hover,
.lead-card:hover,
.board-card:hover,
.chat-card:hover,
.grafana-panel:hover,
.stats-kpi:hover,
.seller-card-row:hover,
.tg-dialog:hover {
  transform: translateY(-2px);
}

.metric:hover,
.lead-card:hover,
.board-card:hover,
.chat-card:hover,
.seller-card-row:hover {
  box-shadow: 0 20px 50px rgba(16, 24, 40, 0.14);
}

.grafana-panel:hover,
.stats-kpi:hover {
  border-color: rgba(255, 204, 77, 0.45);
  box-shadow: 0 20px 56px rgba(17, 19, 24, 0.26);
}

.nav a,
.crm-strip a,
.stats-range a,
.ghost-button,
button,
.primary-link {
  position: relative;
  overflow: hidden;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.nav a:hover,
.crm-strip a:hover,
.stats-range a:hover,
.ghost-button:hover,
button:hover,
.primary-link:hover {
  transform: translateY(-1px);
}

.nav a.active::before,
.nav a:hover::before {
  content: "";
  position: absolute;
  inset: 8px auto 8px 0;
  width: 3px;
  border-radius: 999px;
  background: #ffcc4d;
}

.brand-mark,
.stats-status i {
  animation: softPulse 2200ms ease-in-out infinite;
}

.board-column.drag-over,
.funnel-column.drag-over {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 18px 48px rgba(20, 108, 148, 0.16);
}

.board-card.dragging,
.chat-card.dragging {
  box-shadow: 0 24px 58px rgba(16, 24, 40, 0.20);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(20, 108, 148, 0.12);
}

.tg-message {
  animation: adminScaleIn 220ms ease both;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 900px) {
  body {
    display: block;
    min-width: 0;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: auto;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  }

  .brand {
    margin-bottom: 10px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand small {
    display: none;
  }

  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 0 5px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav a {
    flex: 0 0 auto;
    padding: 9px 12px;
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 8px;
    white-space: nowrap;
  }

  .nav a.active::before,
  .nav a:hover::before {
    inset: auto 12px 0 12px;
    width: auto;
    height: 2px;
  }

  .main {
    padding: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
  }

  h1 {
    font-size: 24px;
    line-height: 1.15;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .topbar-actions a,
  .topbar-actions button,
  .ghost-button,
  button,
  .primary-link {
    min-height: 42px;
    justify-content: center;
    text-align: center;
  }

  .metrics,
  .stats-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .metric,
  .stats-kpi {
    min-height: 104px;
    padding: 13px;
  }

  .metric strong,
  .stats-kpi strong {
    font-size: 24px;
  }

  .crm-strip {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: -4px -16px 16px;
    padding: 0 16px 8px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .crm-strip::-webkit-scrollbar {
    display: none;
  }

  .crm-strip a {
    flex: 0 0 auto;
    min-width: 154px;
  }

  .filters,
  .better-filters,
  .stats-console-head,
  .section-head,
  .seller-card-head {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  input,
  select,
  textarea {
    width: 100%;
    min-width: 0;
    font-size: 16px;
  }

  .lead-grid {
    grid-template-columns: 1fr;
  }

  .detail-layout,
  .seller-settings,
  .seller-settings-redesign,
  .seller-hero {
    grid-template-columns: 1fr;
  }

  .detail-list,
  .facts,
  .triage-facts,
  .seller-fields,
  .seller-overview,
  .seller-usage {
    grid-template-columns: 1fr;
  }

  .lead-head,
  .triage-card-top,
  .tg-chat-header {
    align-items: start;
    flex-direction: column;
  }

  .card-actions,
  .triage-card-actions,
  .seller-card-actions,
  .filter-actions,
  .tg-chat-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .card-actions a,
  .card-actions button,
  .triage-card-actions a,
  .triage-card-actions button,
  .seller-card-actions button,
  .filter-actions button,
  .filter-actions a {
    width: 100%;
  }

  .lead-board,
  .funnel {
    display: flex;
    gap: 12px;
    margin: 0 -16px;
    padding: 0 16px 12px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .board-column,
  .funnel-column {
    flex: 0 0 min(86vw, 360px);
    min-width: min(86vw, 360px);
    min-height: 0;
    scroll-snap-align: start;
  }

  .board-dropzone,
  .funnel-list {
    max-height: 68vh;
    overflow-y: auto;
  }

  .triage-stage {
    min-height: 520px;
  }

  .triage-deck {
    height: 540px;
  }

  .triage-card {
    min-height: 500px;
    padding: 16px;
  }

  .stats-console {
    margin-left: -4px;
    margin-right: -4px;
    padding: 15px;
  }

  .stats-range {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .stats-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .grafana-panel {
    padding: 12px;
  }

  .grafana-panel canvas {
    min-height: 220px;
  }

  table {
    min-width: 680px;
  }

  .panel,
  .toolbar {
    padding: 14px;
  }

  .automation-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
  }

  .automation-dialogs-panel {
    max-height: 360px;
    border-right: 0;
    border-bottom: 1px solid #e5e7f0;
  }

  .automation-chat-panel {
    min-height: 620px;
  }

  .tg-message-row {
    max-width: 94%;
  }
}

@media (max-width: 560px) {
  .main {
    padding: 12px;
  }

  .topbar p {
    font-size: 13px;
  }

  .metrics,
  .stats-kpi-grid,
  .stats-range {
    grid-template-columns: 1fr;
  }

  .crm-strip {
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .lead-board,
  .funnel {
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .board-column,
  .funnel-column {
    flex-basis: 88vw;
    min-width: 88vw;
  }

  .lead-card,
  .board-card,
  .chat-card,
  .panel,
  .toolbar,
  .grafana-panel {
    border-radius: 8px;
  }

  .triage-deck {
    height: 560px;
  }

  .triage-question p {
    font-size: 15px;
  }

  .tg-message-row {
    max-width: 100%;
  }

  .tg-message {
    padding: 9px 11px;
  }
}

/* Theme switcher and final responsive nav fixes */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f2f7;
  --panel: #ffffff;
  --ink: #202230;
  --muted: #75798a;
  --line: #dde0ea;
  --accent: #6a5cff;
  --accent-strong: #4e42d8;
  --accent-soft: #eceaff;
  --ok: #21a67a;
  --warn: #d79122;
  --bad: #d14d45;
  --sidebar-bg: #ffffff;
  --sidebar-panel: #f3f2ff;
  --sidebar-text: #202230;
  --sidebar-muted: #75798a;
  --shadow: 0 14px 34px rgba(32, 34, 48, 0.08);
  --shadow-strong: 0 20px 46px rgba(32, 34, 48, 0.14);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1117;
  --panel: #171a22;
  --ink: #eef2ff;
  --muted: #a7b0c0;
  --line: #2a303b;
  --accent: #8b7cff;
  --accent-strong: #b8b1ff;
  --accent-soft: rgba(139, 124, 255, 0.16);
  --ok: #53d769;
  --warn: #ffcc4d;
  --bad: #ff6b6b;
  --sidebar-bg: #141721;
  --sidebar-panel: #222637;
  --sidebar-text: #f6f4ff;
  --sidebar-muted: #9aa4b5;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
  --shadow-strong: 0 24px 64px rgba(0, 0, 0, 0.36);
}

:root[data-theme="light"] body {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.54) 0 1px, transparent 1px 48px),
    linear-gradient(180deg, #f7f7fb 0%, #eeeff6 100%);
  color: var(--ink);
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at 16% 12%, rgba(139, 124, 255, 0.16), transparent 28%),
    radial-gradient(circle at 88% 8%, rgba(68, 200, 255, 0.10), transparent 26%),
    linear-gradient(180deg, #10131b 0%, #0b0d12 100%);
  color: var(--ink);
}

:root[data-theme="light"] .sidebar {
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  box-shadow: 14px 0 34px rgba(32, 34, 48, 0.07);
}

:root[data-theme="dark"] .sidebar {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), transparent 46%),
    var(--sidebar-bg);
  color: var(--sidebar-text);
  box-shadow: 18px 0 42px rgba(0, 0, 0, 0.28);
}

:root[data-theme="light"] .brand {
  border-color: var(--line);
  background: #f8f8fe;
}

:root[data-theme="dark"] .brand {
  border-color: rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.045);
}

:root[data-theme="light"] .brand strong {
  color: var(--ink);
}

:root[data-theme="light"] .brand small,
:root[data-theme="dark"] .brand small {
  color: var(--sidebar-muted);
}

.nav {
  min-width: 0;
}

.nav a {
  visibility: visible;
  opacity: 1;
  min-width: 0;
  overflow: visible;
  text-decoration: none;
}

:root[data-theme="light"] .nav a {
  color: #4b5062;
}

:root[data-theme="dark"] .nav a {
  color: #dcd9eb;
}

:root[data-theme="light"] .nav a:hover,
:root[data-theme="light"] .nav a.active {
  background: var(--sidebar-panel);
  color: var(--accent-strong);
}

:root[data-theme="dark"] .nav a:hover,
:root[data-theme="dark"] .nav a.active {
  background: var(--sidebar-panel);
  color: #ffffff;
}

:root[data-theme="light"] .topbar {
  border-bottom-color: rgba(218, 222, 234, 0.82);
  background: rgba(247, 247, 251, 0.88);
}

:root[data-theme="dark"] .topbar {
  border-bottom-color: rgba(42, 48, 59, 0.9);
  background: rgba(16, 19, 27, 0.88);
}

.theme-toggle {
  gap: 8px;
  white-space: nowrap;
}

.theme-toggle [data-theme-icon] {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  font-size: 15px;
  line-height: 1;
}

:root[data-theme="dark"] .metric,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .lead-card,
:root[data-theme="dark"] .toolbar,
:root[data-theme="dark"] .board-column,
:root[data-theme="dark"] .funnel-column,
:root[data-theme="dark"] .chat-card,
:root[data-theme="dark"] .seller-hero,
:root[data-theme="dark"] .seller-create,
:root[data-theme="dark"] .seller-create-redesign,
:root[data-theme="dark"] .seller-card-row,
:root[data-theme="dark"] .seller-overview div,
:root[data-theme="dark"] .seller-usage div,
:root[data-theme="dark"] .triage-side,
:root[data-theme="dark"] .triage-empty,
:root[data-theme="dark"] .facts div,
:root[data-theme="dark"] .detail-list div,
:root[data-theme="dark"] .automation-shell,
:root[data-theme="dark"] .automation-dialogs-panel,
:root[data-theme="dark"] .automation-chat-panel,
:root[data-theme="dark"] .tg-dialog,
:root[data-theme="dark"] .detail-message-card {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

:root[data-theme="dark"] .ghost-button {
  border-color: var(--line);
  background: #191d28;
  color: var(--ink);
}

:root[data-theme="dark"] .ghost-button:hover {
  border-color: rgba(139, 124, 255, 0.48);
  background: #222637;
  color: var(--accent-strong);
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  border-color: var(--line);
  background: #11141c;
  color: var(--ink);
}

:root[data-theme="dark"] .lead-title,
:root[data-theme="dark"] .triage-question p,
:root[data-theme="dark"] .stats-table td strong,
:root[data-theme="dark"] .question {
  color: var(--ink);
}

:root[data-theme="dark"] .question,
:root[data-theme="dark"] .triage-thread p,
:root[data-theme="dark"] .message,
:root[data-theme="dark"] .crm-strip a {
  border-color: var(--line);
  background: #121620;
  color: #dbe4f0;
}

:root[data-theme="dark"] .message.outgoing,
:root[data-theme="dark"] .triage-question {
  border-color: rgba(139, 124, 255, 0.34);
  background: rgba(139, 124, 255, 0.13);
}

:root[data-theme="dark"] .message.bot {
  background: #1d2230;
  color: var(--muted);
}

:root[data-theme="dark"] .badge {
  background: #232838;
  color: #dbe4f0;
}

:root[data-theme="dark"] th {
  color: var(--muted);
}

:root[data-theme="dark"] td {
  border-bottom-color: var(--line);
  color: #dbe4f0;
}

:root[data-theme="dark"] .empty {
  border-color: var(--line);
  background: var(--panel);
  color: var(--muted);
}

:root[data-theme="light"] .stats-console {
  border-color: var(--line);
  background:
    linear-gradient(120deg, rgba(106, 92, 255, 0.10), transparent 36%),
    linear-gradient(260deg, rgba(255, 218, 98, 0.16), transparent 32%),
    #ffffff;
  color: var(--ink);
  box-shadow: var(--shadow);
}

:root[data-theme="light"] .stats-console p {
  color: var(--muted);
}

:root[data-theme="light"] .stats-status {
  color: var(--ok);
}

:root[data-theme="light"] .stats-range a {
  border-color: var(--line);
  background: #ffffff;
  color: #4b5062;
}

:root[data-theme="light"] .stats-range a:hover,
:root[data-theme="light"] .stats-range a.active {
  border-color: #d7cfff;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

:root[data-theme="light"] .stats-kpi,
:root[data-theme="light"] .grafana-panel {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
  box-shadow: var(--shadow);
}

:root[data-theme="light"] .stats-kpi span,
:root[data-theme="light"] .stats-kpi small,
:root[data-theme="light"] .grafana-panel-head em {
  color: var(--muted);
}

:root[data-theme="light"] .stats-kpi strong,
:root[data-theme="light"] .grafana-panel-head h2,
:root[data-theme="light"] .stats-table td strong {
  color: var(--ink);
}

:root[data-theme="light"] .grafana-panel-head {
  border-bottom-color: var(--line);
}

:root[data-theme="light"] .grafana-panel-head span {
  color: var(--accent-strong);
}

:root[data-theme="light"] .stats-table th {
  border-bottom-color: var(--line);
  background: #f7f8fb;
  color: var(--muted);
}

:root[data-theme="light"] .stats-table td {
  border-bottom-color: var(--line);
  background: #ffffff;
  color: #4b5062;
}

:root[data-theme="light"] .stats-table tbody tr:hover td {
  background: #f7f8fb;
}

:root[data-theme="dark"] .stats-console {
  border-color: #252a33;
  background:
    linear-gradient(120deg, rgba(51, 162, 255, 0.11), transparent 36%),
    linear-gradient(260deg, rgba(255, 204, 77, 0.09), transparent 32%),
    #111318;
  color: #eef2ff;
  box-shadow: 0 20px 58px rgba(0, 0, 0, 0.30);
}

:root[data-theme="dark"] .stats-console p {
  color: #a7b0c0;
}

:root[data-theme="dark"] .stats-range a {
  border-color: #303640;
  background: #171a20;
  color: #a7b0c0;
}

:root[data-theme="dark"] .stats-range a:hover,
:root[data-theme="dark"] .stats-range a.active {
  border-color: #ffcc4d;
  background: #242017;
  color: #ffdf82;
}

:root[data-theme="dark"] .stats-kpi,
:root[data-theme="dark"] .grafana-panel {
  border-color: #252a33;
  background: #111318;
  color: #eef2ff;
}

:root[data-theme="dark"] .stats-kpi span,
:root[data-theme="dark"] .stats-kpi small,
:root[data-theme="dark"] .grafana-panel-head em {
  color: #8c96a8;
}

:root[data-theme="dark"] .stats-kpi strong,
:root[data-theme="dark"] .grafana-panel-head h2 {
  color: #eef2ff;
}

:root[data-theme="dark"] .grafana-panel-head {
  border-bottom-color: #252a33;
}

:root[data-theme="dark"] .grafana-panel-head span {
  color: #ffcc4d;
}

:root[data-theme="dark"] .stats-table th {
  border-bottom-color: #252a33;
  background: #171a20;
  color: #8c96a8;
}

:root[data-theme="dark"] .stats-table td {
  border-bottom-color: #252a33;
  background: #111318;
  color: #dbe4f0;
}

:root[data-theme="dark"] .stats-table tbody tr:hover td {
  background: #171a20;
}

@media (max-width: 900px) {
  .nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 8px;
    overflow: visible;
    padding: 0;
  }

  .nav::-webkit-scrollbar {
    display: initial;
  }

  .nav a {
    flex: initial;
    justify-content: flex-start;
    min-height: 40px;
    padding: 9px 10px 9px 32px;
    white-space: normal;
    line-height: 1.15;
  }

  .nav a::before {
    left: 10px;
  }

  .topbar-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav a {
    padding-left: 30px;
    font-size: 13px;
  }

  .topbar-actions {
    grid-template-columns: 1fr;
  }
}

/* Telegram-like automation chat on mobile */
.tg-back-link,
.tg-mobile-compose {
  display: none;
}

@media (max-width: 760px) {
  body.page-automation {
    background: #e7eef6;
  }

  .page-automation .main {
    padding: 0;
  }

  .page-automation .topbar,
  .page-automation .metrics,
  .page-automation .crm-strip {
    display: none;
  }

  .page-automation .sidebar {
    border-radius: 0;
    box-shadow: 0 2px 10px rgba(20, 35, 50, 0.12);
  }

  .page-automation .automation-shell {
    display: flex;
    height: calc(100svh - 118px);
    min-height: 620px;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: #ffffff;
  }

  .page-automation .automation-shell.has-selected-chat .automation-dialogs-panel {
    display: none;
  }

  .page-automation .automation-shell.no-selected-chat .automation-chat-panel {
    display: none;
  }

  .page-automation .automation-dialogs-panel,
  .page-automation .automation-chat-panel {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .page-automation .automation-dialogs-panel {
    background: #ffffff;
  }

  .page-automation .automation-dialogs-head {
    min-height: 56px;
    padding: 10px 14px;
    border-bottom: 1px solid #d8e0e8;
    background: #527da3;
    color: #ffffff;
  }

  .page-automation .automation-dialogs-head h2 {
    font-size: 18px;
    line-height: 1.1;
  }

  .page-automation .automation-dialogs-head p {
    color: rgba(255,255,255,0.78);
  }

  .page-automation .automation-ai-state {
    min-height: 24px;
    background: rgba(255,255,255,0.18);
    color: #ffffff;
  }

  .page-automation .automation-search {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
    background: #f3f7fa;
  }

  .page-automation .automation-search label {
    color: transparent;
    gap: 0;
  }

  .page-automation .automation-search input {
    height: 38px;
    border: 0;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px #dce4ec;
    font-size: 15px;
  }

  .page-automation .automation-search button {
    display: none;
  }

  .page-automation .automation-dialogs-list {
    padding: 0;
    background: #ffffff;
  }

  .page-automation .tg-dialog {
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 10px;
    min-height: 68px;
    padding: 9px 12px;
    border-radius: 0;
    border-bottom: 1px solid #eef2f6;
    background: #ffffff;
    color: #17212b;
  }

  .page-automation .tg-dialog:hover,
  .page-automation .tg-dialog.active {
    background: #edf5fc;
    color: #17212b;
    box-shadow: none;
  }

  .page-automation .tg-avatar {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #5eb5e6, #3d8fc8);
    font-size: 18px;
  }

  .page-automation .tg-dialog-top strong {
    color: #17212b;
    font-size: 15px;
  }

  .page-automation .tg-dialog-top time {
    color: #8b98a5;
    font-size: 12px;
  }

  .page-automation .tg-dialog-title,
  .page-automation .tg-dialog-preview,
  .page-automation .tg-dialog-preview.outgoing,
  .page-automation .tg-dialog.active .tg-dialog-title,
  .page-automation .tg-dialog.active .tg-dialog-preview {
    color: #6f7d89;
    font-size: 13px;
  }

  .page-automation .automation-chat-panel {
    display: flex;
    min-height: 0;
    background:
      linear-gradient(135deg, rgba(255,255,255,0.35) 25%, transparent 25%) 0 0 / 28px 28px,
      linear-gradient(315deg, rgba(255,255,255,0.28) 25%, transparent 25%) 0 0 / 28px 28px,
      #dbe7ef;
  }

  .page-automation .tg-chat-header {
    position: sticky;
    top: 0;
    z-index: 5;
    flex: 0 0 56px;
    flex-direction: row;
    align-items: center;
    min-height: 56px;
    padding: 5px 8px;
    border: 0;
    background: #527da3;
    color: #ffffff;
    box-shadow: 0 1px 0 rgba(0,0,0,0.13);
    backdrop-filter: none;
  }

  .page-automation .tg-chat-person {
    flex: 1 1 auto;
    min-width: 0;
    gap: 8px;
  }

  .page-automation .tg-back-link {
    display: inline-grid;
    flex: 0 0 34px;
    place-items: center;
    width: 34px;
    height: 42px;
    border-radius: 999px;
    color: #ffffff;
    font-size: 25px;
    font-weight: 500;
    line-height: 1;
  }

  .page-automation .tg-back-link:hover {
    background: rgba(255,255,255,0.12);
    text-decoration: none;
  }

  .page-automation .tg-avatar.large {
    width: 38px;
    height: 38px;
    font-size: 15px;
  }

  .page-automation .tg-chat-person h2 {
    overflow: hidden;
    margin: 0;
    color: #ffffff;
    font-size: 16px;
    line-height: 1.14;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page-automation .tg-chat-person p {
    overflow: hidden;
    max-width: 54vw;
    margin: 2px 0 0;
    color: rgba(255,255,255,0.72);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page-automation .tg-chat-actions {
    display: none;
  }

  .page-automation .automation-alert {
    margin: 8px 8px 0;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
  }

  .page-automation .tg-messages {
    flex: 1 1 auto;
    gap: 5px;
    padding: 10px 7px 8px;
    scroll-padding-bottom: 72px;
  }

  .page-automation .tg-message-row {
    max-width: 82%;
  }

  .page-automation .tg-message-row.outgoing {
    align-self: flex-end;
  }

  .page-automation .tg-message-bubble {
    padding: 7px 9px 5px;
    border: 0;
    border-radius: 13px 13px 13px 3px;
    background: #ffffff;
    box-shadow: 0 1px 1px rgba(30, 45, 60, 0.14);
  }

  .page-automation .tg-message-row.outgoing .tg-message-bubble {
    border: 0;
    border-radius: 13px 13px 3px 13px;
    background: #effdde;
  }

  .page-automation .tg-message-row.is-ai .tg-message-bubble {
    background: #eef3ff;
  }

  .page-automation .tg-message-bubble p {
    color: #111820;
    font-size: 15px;
    line-height: 1.32;
  }

  .page-automation .tg-message-bubble time {
    float: right;
    margin: 2px 0 0 8px;
    color: #7f8b95;
    font-size: 11px;
    line-height: 1.2;
  }

  .page-automation .ai-answer-label {
    margin: 0 6px 3px;
    color: #527da3;
    font-size: 11px;
  }

  .page-automation .ai-answer-label span {
    min-width: 22px;
    height: 20px;
    background: #527da3;
    font-size: 10px;
  }

  .page-automation .tg-compose-bar {
    flex: 0 0 auto;
    display: block;
    padding: 6px 7px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(160, 174, 188, 0.45);
    background: #f3f6f8;
    color: #6f7d89;
  }

  .page-automation .tg-compose-note {
    display: none;
  }

  .page-automation .tg-mobile-compose {
    display: flex;
    align-items: center;
    gap: 7px;
  }

  .page-automation .tg-mobile-compose form {
    margin: 0;
  }

  .page-automation .tg-mobile-attach {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    height: 38px;
    padding: 0 10px;
    border-radius: 999px;
    background: transparent;
    color: #527da3;
    font-size: 13px;
    font-weight: 800;
  }

  .page-automation .tg-input-shell {
    flex: 1 1 auto;
    min-width: 0;
    height: 38px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border-radius: 999px;
    background: #ffffff;
    color: #8a97a4;
    font-size: 15px;
    box-shadow: inset 0 0 0 1px #dbe3ea;
  }

  .page-automation .tg-send-button {
    display: inline-grid;
    place-items: center;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #4ea4df;
    color: #ffffff;
    box-shadow: none;
    font-size: 13px;
    font-weight: 900;
  }

  .page-automation .tg-send-button[disabled] {
    background: #b8c5d1;
  }

  .page-automation .tg-lead-link {
    display: block;
    margin-top: 5px;
    color: #527da3;
    font-size: 12px;
    text-align: center;
  }
}

@media (max-width: 760px) {
  :root[data-theme="dark"] body.page-automation {
    background: #0e1621;
  }

  :root[data-theme="dark"] .page-automation .automation-shell,
  :root[data-theme="dark"] .page-automation .automation-dialogs-panel {
    background: #17212b;
  }

  :root[data-theme="dark"] .page-automation .automation-dialogs-head,
  :root[data-theme="dark"] .page-automation .tg-chat-header {
    background: #17212b;
    box-shadow: 0 1px 0 rgba(255,255,255,0.08);
  }

  :root[data-theme="dark"] .page-automation .automation-search {
    background: #0e1621;
  }

  :root[data-theme="dark"] .page-automation .automation-search input {
    background: #242f3d;
    box-shadow: none;
    color: #f2f6fb;
  }

  :root[data-theme="dark"] .page-automation .tg-dialog {
    border-bottom-color: #202b36;
    background: #17212b;
    color: #f2f6fb;
  }

  :root[data-theme="dark"] .page-automation .tg-dialog:hover,
  :root[data-theme="dark"] .page-automation .tg-dialog.active {
    background: #202b36;
  }

  :root[data-theme="dark"] .page-automation .tg-dialog-top strong {
    color: #f2f6fb;
  }

  :root[data-theme="dark"] .page-automation .tg-dialog-title,
  :root[data-theme="dark"] .page-automation .tg-dialog-preview,
  :root[data-theme="dark"] .page-automation .tg-dialog-preview.outgoing {
    color: #9aa8b6;
  }

  :root[data-theme="dark"] .page-automation .automation-chat-panel {
    background:
      linear-gradient(135deg, rgba(255,255,255,0.035) 25%, transparent 25%) 0 0 / 28px 28px,
      linear-gradient(315deg, rgba(255,255,255,0.025) 25%, transparent 25%) 0 0 / 28px 28px,
      #0e1621;
  }

  :root[data-theme="dark"] .page-automation .tg-message-bubble {
    background: #182533;
    color: #f2f6fb;
  }

  :root[data-theme="dark"] .page-automation .tg-message-row.outgoing .tg-message-bubble {
    background: #2b5278;
  }

  :root[data-theme="dark"] .page-automation .tg-message-row.is-ai .tg-message-bubble {
    background: #213657;
  }

  :root[data-theme="dark"] .page-automation .tg-message-bubble p {
    color: #f2f6fb;
  }

  :root[data-theme="dark"] .page-automation .tg-message-bubble time {
    color: #b2bfca;
  }

  :root[data-theme="dark"] .page-automation .tg-compose-bar {
    border-top-color: #202b36;
    background: #17212b;
  }

  :root[data-theme="dark"] .page-automation .tg-input-shell {
    background: #242f3d;
    color: #9aa8b6;
    box-shadow: none;
  }

  :root[data-theme="dark"] .page-automation .tg-mobile-attach,
  :root[data-theme="dark"] .page-automation .tg-lead-link,
  :root[data-theme="dark"] .page-automation .ai-answer-label {
    color: #6ab7ef;
  }

  :root[data-theme="dark"] .page-automation .ai-answer-label span,
  :root[data-theme="dark"] .page-automation .tg-send-button {
    background: #5288c1;
  }
}

@media (max-width: 420px) {
  .page-automation .automation-shell {
    height: calc(100svh - 168px);
    min-height: 560px;
  }

  .page-automation .tg-message-row {
    max-width: 88%;
  }

  .page-automation .tg-chat-person p {
    max-width: 46vw;
  }
}

@media (max-width: 760px) {
  body.page-automation:has(.automation-shell.has-selected-chat) .sidebar {
    display: none;
  }

  body.page-automation:has(.automation-shell.has-selected-chat) .automation-shell {
    height: 100svh;
    min-height: 100svh;
  }
}

/* Dark theme hardening for desktop CRM surfaces */
:root[data-theme="dark"] .metric,
:root[data-theme="dark"] .toolbar,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .board-column,
:root[data-theme="dark"] .funnel-column,
:root[data-theme="dark"] .lead-card,
:root[data-theme="dark"] .board-card,
:root[data-theme="dark"] .chat-card,
:root[data-theme="dark"] .chart-panel,
:root[data-theme="dark"] .seller-directory,
:root[data-theme="dark"] .seller-card-row,
:root[data-theme="dark"] .seller-create-redesign,
:root[data-theme="dark"] .triage-side,
:root[data-theme="dark"] .automation-shell,
:root[data-theme="dark"] .automation-dialogs-panel,
:root[data-theme="dark"] .automation-chat-panel {
  border-color: #2a303b;
  background: #171a22;
  color: #eef2ff;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.24);
}

:root[data-theme="dark"] .toolbar,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .automation-dialogs-panel {
  background: rgba(23, 26, 34, 0.94);
}

:root[data-theme="dark"] .metric strong,
:root[data-theme="dark"] .lead-title,
:root[data-theme="dark"] .funnel-head h2,
:root[data-theme="dark"] .section-head h2,
:root[data-theme="dark"] .chart-head h2,
:root[data-theme="dark"] .seller-card-head h2,
:root[data-theme="dark"] .seller-identity strong,
:root[data-theme="dark"] .triage-card-top h2,
:root[data-theme="dark"] .automation-dialogs-head h2,
:root[data-theme="dark"] .tg-chat-person h2,
:root[data-theme="dark"] .tg-dialog-top strong {
  color: #f4f7ff;
}

:root[data-theme="dark"] .metric span,
:root[data-theme="dark"] .topbar p,
:root[data-theme="dark"] .lead-head p,
:root[data-theme="dark"] .funnel-head,
:root[data-theme="dark"] .section-head p,
:root[data-theme="dark"] .chart-head span,
:root[data-theme="dark"] .seller-card-head p,
:root[data-theme="dark"] .seller-identity span,
:root[data-theme="dark"] .triage-card-top p,
:root[data-theme="dark"] .automation-dialogs-head p,
:root[data-theme="dark"] .tg-chat-person p,
:root[data-theme="dark"] .tg-dialog-top time,
:root[data-theme="dark"] .tg-dialog-title,
:root[data-theme="dark"] .tg-dialog-preview,
:root[data-theme="dark"] .tg-message-bubble time,
:root[data-theme="dark"] dt,
:root[data-theme="dark"] label {
  color: #a7b0c0;
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .search-field input,
:root[data-theme="dark"] .state-control select {
  border-color: #343b49;
  background-color: #11151e;
  color: #eef2ff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder {
  color: #6f7a8c;
}

:root[data-theme="dark"] .filter-meta span,
:root[data-theme="dark"] .quick-filters a,
:root[data-theme="dark"] .crm-strip a,
:root[data-theme="dark"] .seller-summary-pills span {
  border-color: #2a303b;
  background: #171a22;
  color: #dbe4f0;
}

:root[data-theme="dark"] .filter-meta strong,
:root[data-theme="dark"] .crm-strip strong {
  color: #c7c2ff;
}

:root[data-theme="dark"] .quick-filters a:hover,
:root[data-theme="dark"] .crm-strip a:hover {
  border-color: rgba(139, 124, 255, 0.54);
  background: rgba(139, 124, 255, 0.15);
  color: #f4f7ff;
}

:root[data-theme="dark"] .quick-filters a.active {
  border-color: #8b7cff;
  background: #7b68ff;
  color: #ffffff;
}

:root[data-theme="dark"] .funnel-head {
  border-bottom-color: #3a4250;
}

:root[data-theme="dark"] .funnel-head span {
  background: #f4f7ff;
  color: #7b68ff;
  box-shadow: none;
}

:root[data-theme="dark"] .question,
:root[data-theme="dark"] .facts div,
:root[data-theme="dark"] .detail-list div,
:root[data-theme="dark"] .seller-usage div,
:root[data-theme="dark"] .seller-overview div,
:root[data-theme="dark"] .seller-usage-redesign div,
:root[data-theme="dark"] .message,
:root[data-theme="dark"] .note-box {
  border-color: #2a303b;
  background: #11151e;
  color: #dbe4f0;
}

:root[data-theme="dark"] dd,
:root[data-theme="dark"] .question,
:root[data-theme="dark"] .message p {
  color: #e7ecf7;
}

:root[data-theme="dark"] .message.outgoing {
  border-color: rgba(139, 124, 255, 0.42);
  background: rgba(139, 124, 255, 0.15);
}

:root[data-theme="dark"] .message.bot {
  background: #202636;
  color: #a7b0c0;
}

:root[data-theme="dark"] .drag-handle {
  color: #6f7a8c;
}

:root[data-theme="dark"] .badge {
  border-color: #3a4250;
  background: #242a38;
  color: #e7ecf7;
}

:root[data-theme="dark"] .status-client .badge {
  border-color: rgba(83, 215, 105, 0.38);
  background: rgba(83, 215, 105, 0.13);
  color: #74e28a;
}

:root[data-theme="dark"] .status-assigned .badge,
:root[data-theme="dark"] .status-lead .badge {
  border-color: rgba(139, 124, 255, 0.44);
  background: rgba(139, 124, 255, 0.14);
  color: #c7c2ff;
}

:root[data-theme="dark"] .status-need_call .badge,
:root[data-theme="dark"] .status-irregular .badge {
  border-color: rgba(255, 204, 77, 0.42);
  background: rgba(255, 204, 77, 0.12);
  color: #ffd978;
}

:root[data-theme="dark"] .status-closed .badge,
:root[data-theme="dark"] .status-burned .badge,
:root[data-theme="dark"] .status-lost .badge,
:root[data-theme="dark"] .status-disappeared .badge,
:root[data-theme="dark"] .status-not_enrolled .badge,
:root[data-theme="dark"] .status-trained_left .badge,
:root[data-theme="dark"] .status-no_money .badge {
  border-color: rgba(255, 107, 107, 0.42);
  background: rgba(255, 107, 107, 0.12);
  color: #ff9b9b;
}

:root[data-theme="dark"] table {
  border-color: #2a303b;
  background: #171a22;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.24);
}

:root[data-theme="dark"] thead,
:root[data-theme="dark"] th {
  border-bottom-color: #343b49;
  background: #202636;
  color: #c5ccda;
}

:root[data-theme="dark"] td {
  border-bottom-color: #2a303b;
  background: #171a22;
  color: #e7ecf7;
}

:root[data-theme="dark"] tbody tr:hover,
:root[data-theme="dark"] tbody tr:hover td {
  background: #202636;
}

:root[data-theme="dark"] td a {
  color: #b8b1ff;
}

:root[data-theme="dark"] .triage-score,
:root[data-theme="dark"] .triage-action,
:root[data-theme="dark"] .triage-question,
:root[data-theme="dark"] .triage-thread p {
  border-color: #2a303b;
  background: #11151e;
  color: #e7ecf7;
}

:root[data-theme="dark"] .triage-score strong {
  color: #c7c2ff;
}

:root[data-theme="dark"] .triage-score.muted strong {
  color: #dbe4f0;
}

:root[data-theme="dark"] .triage-progress {
  background: #2a303b;
}

:root[data-theme="dark"] .triage-action:hover {
  border-color: rgba(139, 124, 255, 0.54);
  background: rgba(139, 124, 255, 0.15);
  color: #f4f7ff;
}

:root[data-theme="dark"] .triage-action.action-need_call {
  border-color: rgba(255, 204, 77, 0.40);
  color: #ffd978;
}

:root[data-theme="dark"] .triage-action.action-assigned {
  border-color: rgba(69, 213, 255, 0.34);
  color: #7ddcff;
}

:root[data-theme="dark"] .triage-action.action-client {
  border-color: rgba(83, 215, 105, 0.34);
  color: #74e28a;
}

:root[data-theme="dark"] .triage-action.action-closed,
:root[data-theme="dark"] .triage-action.action-burned {
  border-color: rgba(255, 107, 107, 0.36);
  color: #ff9b9b;
}

:root[data-theme="dark"] .triage-card {
  border-color: #343b49;
  background: #171a22;
  color: #eef2ff;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.38);
}

:root[data-theme="dark"] .triage-card:not(.is-active) {
  background: #141821;
}

:root[data-theme="dark"] .triage-card::after {
  border-color: #8b7cff;
  background: rgba(17, 21, 30, 0.94);
  color: #f4f7ff;
}

:root[data-theme="dark"] .triage-question {
  background: rgba(139, 124, 255, 0.13);
}

:root[data-theme="dark"] .triage-question span {
  color: #c7c2ff;
}

:root[data-theme="dark"] .triage-question p,
:root[data-theme="dark"] .triage-thread p {
  color: #f4f7ff;
}

:root[data-theme="dark"] .triage-card-actions a,
:root[data-theme="dark"] .triage-card-actions button {
  border-color: #343b49;
  background: #202636;
  color: #f4f7ff;
}

:root[data-theme="dark"] .triage-card-actions button {
  background: #7b68ff;
  color: #ffffff;
}

:root[data-theme="dark"] .automation-shell {
  border-color: #2a303b;
  background: #11151e;
}

:root[data-theme="dark"] .automation-dialogs-head,
:root[data-theme="dark"] .automation-search,
:root[data-theme="dark"] .tg-chat-header,
:root[data-theme="dark"] .tg-compose-bar {
  border-color: #2a303b;
  background: #171a22;
  color: #eef2ff;
}

:root[data-theme="dark"] .automation-dialogs-list {
  background: #11151e;
}

:root[data-theme="dark"] .tg-dialog {
  background: #171a22;
  color: #eef2ff;
}

:root[data-theme="dark"] .tg-dialog:hover,
:root[data-theme="dark"] .tg-dialog.active {
  background: #202636;
  color: #ffffff;
  box-shadow: none;
}

:root[data-theme="dark"] .automation-chat-panel {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 32px),
    linear-gradient(180deg, #11151e 0%, #0f131b 100%);
}

:root[data-theme="dark"] .tg-message-bubble {
  border-color: #2a303b;
  background: #182533;
  color: #f2f6fb;
}

:root[data-theme="dark"] .tg-message-bubble p {
  color: #f2f6fb;
}

:root[data-theme="dark"] .tg-message-row.outgoing .tg-message-bubble {
  border-color: rgba(139, 124, 255, 0.38);
  background: #2b5278;
}

:root[data-theme="dark"] .tg-message-row.is-ai .tg-message-bubble {
  border-color: rgba(139, 124, 255, 0.46);
  background: #213657;
}

:root[data-theme="dark"] .tg-message-bubble time {
  color: #b2bfca;
}

:root[data-theme="dark"] .ai-answer-label {
  color: #c7c2ff;
}

:root[data-theme="dark"] .ai-answer-label span {
  background: #7b68ff;
  color: #ffffff;
}

/* High-contrast CRM counters */
:root[data-theme="light"] .crm-strip strong {
  border-color: rgba(106, 92, 255, 0.22);
  background: #ffffff;
  color: #4e42d8;
}

:root[data-theme="light"] .crm-strip a:hover strong {
  border-color: rgba(106, 92, 255, 0.34);
  background: #f4f2ff;
  color: #3f35bd;
}

:root[data-theme="dark"] .crm-strip strong {
  border-color: rgba(199, 194, 255, 0.34);
  background: #f4f7ff;
  color: #4e42d8;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.24);
}

:root[data-theme="dark"] .crm-strip a:hover strong {
  border-color: rgba(255, 218, 98, 0.52);
  background: #ffda62;
  color: #1b2030;
}

/* Stable triage cards: keep the swipe deck to one visible client card */
.triage-deck {
  isolation: isolate;
}

.triage-card {
  overflow: hidden;
  transform: translate3d(0, var(--offset, 0), 0) scale(var(--scale, 1));
  backface-visibility: hidden;
  transform-origin: 50% 52%;
}

.triage-deck .triage-card:not(:first-child):not(.is-active):not(.is-next):not(.is-preview):not(.is-leaving) {
  opacity: 0;
  visibility: hidden;
}

.triage-card.is-active {
  opacity: 1;
  visibility: visible;
  filter: none;
}

.triage-card.is-next {
  opacity: 0.28;
  visibility: visible;
  filter: saturate(0.86);
}

.triage-card.is-preview {
  opacity: 0.08;
  visibility: visible;
  filter: blur(0.4px) saturate(0.75);
}

.triage-card.is-hidden-stack {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.triage-card.is-leaving {
  transition:
    transform 260ms cubic-bezier(.22,.8,.22,1),
    opacity 240ms ease !important;
  will-change: transform, opacity;
}

.triage-card.leave-assigned {
  transform: translate3d(115vw, 8vh, 0) rotate(14deg) !important;
  opacity: 0 !important;
}

.triage-card.leave-burned {
  transform: translate3d(-115vw, 8vh, 0) rotate(-14deg) !important;
  opacity: 0 !important;
}

.triage-card.leave-need_call {
  transform: translate3d(0, -115vh, 0) rotate(-5deg) !important;
  opacity: 0 !important;
}

.triage-card.leave-closed {
  transform: translate3d(0, 115vh, 0) rotate(5deg) !important;
  opacity: 0 !important;
}

.triage-card.leave-client {
  transform: translate3d(115vw, -18vh, 0) rotate(10deg) !important;
  opacity: 0 !important;
}

.triage-card.is-dragging {
  cursor: grabbing;
  transition: none !important;
  box-shadow: 0 30px 80px rgba(16, 24, 40, 0.22);
}

.triage-card.is-active .triage-card-actions {
  transform: translateZ(0);
}

@media (hover: hover) {
  .triage-card:hover {
    transform: translate3d(0, var(--offset, 0), 0) scale(var(--scale, 1));
  }
}

@media (max-width: 760px) {
  .triage-layout {
    gap: 12px;
  }

  .triage-stage {
    min-height: 0;
    place-items: start center;
  }

  .triage-deck {
    width: min(100%, 480px);
    height: clamp(540px, calc(100svh - 220px), 690px);
    margin: 0 auto;
  }

  .triage-card {
    height: 100%;
    min-height: 0;
    grid-template-rows: auto auto minmax(92px, 1fr) auto auto;
    gap: 10px;
    padding: 14px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .triage-card.is-next,
  .triage-card.is-preview,
  .triage-card.is-hidden-stack {
    opacity: 0;
    visibility: hidden;
  }

  .triage-card-top {
    gap: 10px;
  }

  .triage-card-top h2 {
    margin-top: 8px;
    font-size: 20px;
    line-height: 1.15;
  }

  .triage-question {
    padding: 12px;
  }

  .triage-question p {
    font-size: 15px;
    line-height: 1.42;
  }

  .triage-thread {
    max-height: 180px;
  }

  .triage-card-actions {
    position: sticky;
    bottom: -14px;
    margin: 0 -14px -14px;
    padding: 10px 14px 14px;
    background: linear-gradient(180deg, transparent, rgba(255,255,255,0.96) 18px, rgba(255,255,255,0.98));
  }

  :root[data-theme="dark"] .triage-card-actions {
    background: linear-gradient(180deg, transparent, rgba(23,26,34,0.96) 18px, rgba(23,26,34,0.98));
  }
}

@media (max-width: 420px) {
  .triage-deck {
    height: clamp(520px, calc(100svh - 190px), 650px);
  }

  .triage-side {
    gap: 10px;
  }

  .triage-status-list {
    gap: 7px;
  }
}

/* Amo-style CRM additions: client drawer, tasks and today's workspace */
.smart-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.smart-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid rgba(20, 108, 148, 0.12);
  border-radius: 999px;
  background: #eef7fb;
  color: #0f5678;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
}

.smart-badge.tone-danger { border-color: rgba(180, 35, 24, 0.18); background: #fff0ee; color: #b42318; }
.smart-badge.tone-warning { border-color: rgba(183, 121, 31, 0.2); background: #fff7e5; color: #a15c07; }
.smart-badge.tone-success { border-color: rgba(23, 140, 95, 0.2); background: #e8f8ee; color: #087443; }
.smart-badge.tone-info { border-color: rgba(20, 108, 148, 0.18); background: #e8f4ff; color: #175cd3; }
.smart-badge.tone-task { border-color: rgba(106, 92, 255, 0.22); background: #f2efff; color: #5b4fe8; }
.smart-badge.tone-neutral { border-color: rgba(102, 112, 133, 0.18); background: #f2f4f7; color: #475467; }

.card-action-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  border-radius: 0;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.card-action-button:hover {
  text-decoration: underline;
}

.client-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.42);
  opacity: 0;
  transition: opacity 160ms ease;
}

body.has-client-drawer .client-drawer-backdrop {
  opacity: 1;
}

.client-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 90;
  width: min(520px, calc(100vw - 24px));
  pointer-events: none;
}

.client-drawer-shell {
  position: relative;
  height: 100%;
  overflow-y: auto;
  padding: 18px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -30px 0 80px rgba(16, 24, 40, 0.22);
  transform: translateX(104%);
  transition: transform 180ms cubic-bezier(.22,.8,.22,1);
  pointer-events: auto;
}

body.has-client-drawer .client-drawer-shell {
  transform: translateX(0);
}

.drawer-close {
  position: sticky;
  top: 0;
  z-index: 2;
  float: right;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin: -4px -4px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
}

.drawer-card,
.drawer-section,
.today-panel,
.today-hero > div {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.drawer-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  margin-bottom: 12px;
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.drawer-kicker,
.task-type {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
}

.drawer-head h2 {
  margin: 0 0 4px;
  font-size: 24px;
  line-height: 1.15;
}

.drawer-head p {
  margin: 0;
  color: var(--muted);
}

.drawer-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.drawer-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.drawer-section h3 {
  margin: 0;
  font-size: 16px;
}

.task-current {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-left: 4px solid #8b7cff;
}

.task-current.is-overdue {
  border-left-color: var(--bad);
}

.task-current span,
.task-current small {
  display: block;
  color: var(--muted);
}

.task-current strong {
  display: block;
  margin: 2px 0;
  font-size: 17px;
}

.drawer-form {
  display: grid;
  gap: 10px;
}

.drawer-form-grid,
.drawer-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.drawer-form input,
.drawer-form select,
.drawer-form textarea {
  width: 100%;
  min-width: 0;
}

.drawer-task-list,
.drawer-messages,
.drawer-activity,
.today-task-stack,
.today-compact-list,
.mini-lead-list {
  display: grid;
  gap: 8px;
}

.drawer-task,
.drawer-activity article {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.drawer-task span,
.drawer-activity span {
  color: var(--muted);
  font-size: 12px;
}

.drawer-task.done {
  opacity: 0.62;
}

.drawer-task.is-overdue {
  border-color: rgba(180, 35, 24, 0.22);
  background: #fff6f5;
}

.drawer-message {
  max-width: 100%;
}

.drawer-loading,
.drawer-error,
.compact-empty {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: #f8fafc;
}

.today-hero {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.today-hero > div {
  padding: 18px;
}

.today-hero span,
.today-hero p {
  color: var(--muted);
}

.today-hero strong {
  display: block;
  margin: 4px 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1;
}

.today-hero p {
  margin: 0;
}

.today-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.today-main,
.today-side {
  display: grid;
  gap: 16px;
}

.today-panel {
  padding: 16px;
}

.today-panel.urgent {
  border-top: 3px solid #8b7cff;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 0 0 4px;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.section-head > span {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #f2efff;
  color: #5b4fe8;
  font-weight: 900;
}

.today-task {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(248,250,252,0.94));
}

.today-task.is-overdue {
  border-color: rgba(180, 35, 24, 0.22);
  background: linear-gradient(135deg, #fff, #fff4f2);
}

.today-task h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.today-task p {
  margin: 0 0 10px;
  color: var(--muted);
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

.task-actions form {
  margin: 0;
}

.today-compact-list button,
.mini-lead-list button,
.upcoming-grid button {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.today-compact-list button:hover,
.mini-lead-list button:hover,
.upcoming-grid button:hover {
  border-color: rgba(106, 92, 255, 0.32);
  background: #f3f1ff;
}

.today-compact-list span,
.mini-lead-list span,
.upcoming-grid span {
  color: var(--muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.upcoming-panel {
  margin-top: 16px;
}

.upcoming-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

:root[data-theme="dark"] .client-drawer-backdrop {
  background: rgba(0, 0, 0, 0.58);
}

:root[data-theme="dark"] .client-drawer-shell,
:root[data-theme="dark"] .drawer-card,
:root[data-theme="dark"] .drawer-section,
:root[data-theme="dark"] .today-panel,
:root[data-theme="dark"] .today-hero > div {
  border-color: #2a303b;
  background: #171a22;
  color: #eef2ff;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.32);
}

:root[data-theme="dark"] .drawer-close {
  border-color: #2a303b;
  background: #11151e;
  color: #eef2ff;
}

:root[data-theme="dark"] .drawer-task,
:root[data-theme="dark"] .drawer-loading,
:root[data-theme="dark"] .drawer-error,
:root[data-theme="dark"] .compact-empty,
:root[data-theme="dark"] .today-compact-list button,
:root[data-theme="dark"] .mini-lead-list button,
:root[data-theme="dark"] .upcoming-grid button {
  border-color: #2a303b;
  background: #11151e;
  color: #eef2ff;
}

:root[data-theme="dark"] .today-task {
  border-color: #2a303b;
  background: linear-gradient(135deg, #171a22, #11151e);
  color: #eef2ff;
}

:root[data-theme="dark"] .today-task.is-overdue,
:root[data-theme="dark"] .drawer-task.is-overdue {
  border-color: rgba(255, 123, 105, 0.35);
  background: #271a1c;
}

:root[data-theme="dark"] .smart-badge.tone-danger { background: #361b1f; color: #ffb4a8; border-color: rgba(255, 123, 105, 0.32); }
:root[data-theme="dark"] .smart-badge.tone-warning { background: #35250f; color: #ffda62; border-color: rgba(255, 218, 98, 0.32); }
:root[data-theme="dark"] .smart-badge.tone-success { background: #102b22; color: #86efac; border-color: rgba(134, 239, 172, 0.28); }
:root[data-theme="dark"] .smart-badge.tone-info { background: #11243b; color: #93c5fd; border-color: rgba(147, 197, 253, 0.28); }
:root[data-theme="dark"] .smart-badge.tone-task { background: #221f45; color: #c7c2ff; border-color: rgba(199, 194, 255, 0.32); }
:root[data-theme="dark"] .smart-badge.tone-neutral { background: #222734; color: #cbd5e1; border-color: rgba(203, 213, 225, 0.18); }

@media (max-width: 980px) {
  .today-layout {
    grid-template-columns: 1fr;
  }

  .today-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .client-drawer {
    width: 100vw;
  }

  .client-drawer-shell {
    padding: 14px;
    border-left: 0;
  }

  .drawer-head,
  .task-current,
  .today-task {
    grid-template-columns: 1fr;
  }

  .drawer-head {
    display: grid;
  }

  .drawer-form-grid,
  .drawer-split,
  .today-hero,
  .today-side {
    grid-template-columns: 1fr;
  }

  .task-actions {
    justify-content: stretch;
  }

  .task-actions > *,
  .task-actions a,
  .task-actions button,
  .task-actions form {
    width: 100%;
  }

  .task-actions form button {
    width: 100%;
  }

  .drawer-actions-row > *,
  .drawer-form button,
  .task-current form,
  .task-current button {
    width: 100%;
  }
}
