:root {
  --ink: #1b1530;
  --ink-2: #3a3350;
  --muted: #7e768b;
  --cream: #f4efe5;
  --paper: #fffdf8;
  --line: #e6ded1;
  --violet: #6d4aff;
  --violet-2: #5434d6;
  --violet-soft: #eee9ff;
  --coral: #ff7a59;
  --coral-soft: #ffe9e2;
  --mint: #2fbf8f;
  --mint-soft: #e0f7ee;
  --amber: #e8a93e;
  --amber-soft: #fff1d6;
  --danger: #c94f2c;
  --dark: #17122e;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 2%, rgba(109, 74, 255, 0.07), transparent 26%),
    var(--cream);
  -webkit-font-smoothing: antialiased;
}

button,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(27, 21, 48, 0.06);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: 260px;
  height: 100vh;
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  padding: 26px 20px 22px;
  color: #fff;
  background:
    radial-gradient(circle at 10% 0%, rgba(109, 74, 255, 0.35), transparent 30%),
    radial-gradient(circle at 100% 100%, rgba(255, 122, 89, 0.12), transparent 34%),
    linear-gradient(170deg, #1c1538 0%, #120e23 70%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 6px 26px;
}

.side-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #7b5cff, #5434d6);
  box-shadow: 0 8px 22px rgba(84, 52, 214, 0.35);
  font-size: 18px;
}

.side-brand strong {
  display: block;
  font-size: 14.5px;
  letter-spacing: -0.01em;
}

.side-brand small {
  display: block;
  margin-top: 3px;
  font-size: 8px;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.42);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border-radius: 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.62);
  border: 1px solid transparent;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.side-nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.side-nav a.active {
  background: rgba(109, 74, 255, 0.18);
  border-color: rgba(137, 111, 255, 0.26);
  color: #fff;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.68);
}

.side-nav a.active .nav-icon {
  background: rgba(137, 111, 255, 0.25);
  color: #d7cbff;
}

.nav-count {
  margin-left: auto;
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.64);
  font-size: 9px;
  font-weight: 700;
  text-align: center;
}

.nav-count.warn {
  background: rgba(255, 122, 89, 0.16);
  color: #ffb7a4;
}

.side-card {
  margin-top: 28px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.04);
}

.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #65e2b4;
  margin-right: 7px;
  box-shadow: 0 0 0 3px rgba(101, 226, 180, 0.12);
}

.side-card strong {
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

.side-card p {
  margin: 8px 0 10px;
  font-size: 9.5px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.46);
}

.side-card code {
  display: inline-block;
  padding: 3px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.6);
  font-size: 8.5px;
}

.side-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.side-links a {
  display: flex;
  justify-content: space-between;
  padding: 7px 2px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.48);
  transition: color 150ms ease;
}

.side-links a:hover {
  color: #fff;
}

.side-links span {
  opacity: 0.45;
}

.side-foot {
  margin-top: auto;
  padding: 18px 2px 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 8.5px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.28);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.side-foot span:first-child {
  color: rgba(255, 255, 255, 0.46);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 28px clamp(22px, 3vw, 42px) 30px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  margin: 0 0 7px;
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--violet-2);
}

.topbar h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(31px, 3.4vw, 43px);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1;
}

.sub {
  margin: 9px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}

.engine-badge {
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.7);
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.range-wrap select {
  height: 36px;
  padding: 0 28px 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.range-wrap select:focus {
  border-color: #b9a9ff;
  box-shadow: 0 0 0 3px rgba(109, 74, 255, 0.12);
}

.refresh {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 13px;
  border: 1px solid var(--ink);
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  font-size: 10.5px;
  font-weight: 650;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
}

.refresh:hover {
  background: #2b2345;
  transform: translateY(-1px);
}

.refresh.loading .refresh-icon {
  animation: spin 900ms linear infinite;
}

.refresh:focus-visible {
  outline: 3px solid rgba(109, 74, 255, 0.28);
  outline-offset: 2px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 14px;
  font-size: 8.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.status-line > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #1f8f6b;
  font-weight: 650;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 3px rgba(47, 191, 143, 0.12);
}

.status-sep {
  opacity: 0.4;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
  margin-bottom: 11px;
}

.kpi {
  position: relative;
  overflow: hidden;
  padding: 17px 17px 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(27, 21, 48, 0.03);
}

.kpi::after {
  content: "";
  position: absolute;
  right: -26px;
  top: -26px;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  opacity: 0.5;
  pointer-events: none;
}

.kpi-violet::after { background: var(--violet-soft); }
.kpi-coral::after { background: var(--coral-soft); }
.kpi-mint::after { background: var(--mint-soft); }
.kpi-amber::after { background: var(--amber-soft); }

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.03em;
  color: var(--muted);
  text-transform: uppercase;
}

.kpi-icon {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-size: 10px;
  position: relative;
  z-index: 1;
}

.kpi-violet .kpi-icon { background: var(--violet-soft); color: var(--violet-2); }
.kpi-coral .kpi-icon { background: var(--coral-soft); color: var(--danger); }
.kpi-mint .kpi-icon { background: var(--mint-soft); color: #16815e; }
.kpi-amber .kpi-icon { background: var(--amber-soft); color: #9b6511; }

.kpi strong {
  display: block;
  margin-top: 15px;
  font-family: var(--serif);
  font-size: clamp(31px, 3vw, 39px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.kpi p {
  margin: 7px 0 0;
  font-size: 9.5px;
  color: var(--muted);
  line-height: 1.4;
}

.kpi-spark {
  position: absolute;
  right: 16px;
  bottom: 15px;
  width: 38px;
  height: 16px;
  opacity: 0.5;
  background:
    linear-gradient(90deg, transparent 0 8%, currentColor 8% 12%, transparent 12% 26%, currentColor 26% 30%, transparent 30% 50%, currentColor 50% 54%, transparent 54% 70%, currentColor 70% 74%, transparent 74%);
  mask-image: linear-gradient(90deg, transparent, black 25%);
}

.kpi-violet .kpi-spark { color: var(--violet); }
.kpi-coral .kpi-spark { color: var(--coral); }
.kpi-mint .kpi-spark { color: var(--mint); }
.kpi-amber .kpi-spark { color: var(--amber); }

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.9fr);
  gap: 11px;
  margin-bottom: 11px;
}

.card {
  min-width: 0;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(27, 21, 48, 0.03);
}

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

.card-head h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.hint {
  padding: 4px 7px;
  border-radius: 999px;
  background: #f0ebe1;
  color: var(--muted);
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.hint.danger {
  background: #ffe8df;
  color: #a84627;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  font-size: 8.5px;
  color: var(--muted);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend i {
  width: 7px;
  height: 7px;
  border-radius: 2px;
}

.legend-violet { background: var(--violet); }
.legend-coral { background: var(--coral); }

.chart-wrap {
  padding: 4px 0 0;
}

.daily-bars {
  display: flex;
  align-items: flex-end;
  gap: clamp(4px, 0.6vw, 9px);
  height: 176px;
  padding: 0 2px;
  border-bottom: 1px solid #ece5d9;
}

.bar-group {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.bars-pair {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  width: 100%;
  height: 142px;
  flex: 0 0 142px;
}

.bar {
  width: min(46%, 9px);
  min-height: 3px;
  border-radius: 4px 4px 2px 2px;
  transition: height 500ms cubic-bezier(0.2, 0.8, 0.25, 1), filter 150ms ease;
}

.bar:hover {
  filter: brightness(0.9);
}

.bar.messages {
  background: linear-gradient(to top, #6d4aff, #a08cff);
}

.bar.conversations {
  background: linear-gradient(to top, #ff7a59, #ffb09b);
}

.bar-label {
  font-size: 7px;
  color: #a49bad;
  white-space: nowrap;
  letter-spacing: 0.01em;
  transform: rotate(-0deg);
}

.chart-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  font-size: 8.5px;
  color: var(--muted);
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 5px 3px 18px;
}

.donut {
  position: relative;
  width: 142px;
  height: 142px;
  flex: 0 0 142px;
  border-radius: 50%;
  background: conic-gradient(var(--violet) 0 50%, var(--coral) 50% 100%);
  display: grid;
  place-items: center;
  transition: background 500ms ease;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.65);
}

.donut-hole {
  position: relative;
  z-index: 1;
  width: 93px;
  height: 93px;
  border-radius: 50%;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(27, 21, 48, 0.06);
}

.donut-hole strong {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
}

.donut-hole span {
  margin-top: 4px;
  font-size: 7.5px;
  color: var(--muted);
  text-align: center;
}

.channel-legend {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 9px;
}

.channel-swatch {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex: 0 0 9px;
}

.channel-swatch.web { background: var(--violet); }
.channel-swatch.whatsapp { background: var(--coral); }

.channel-copy {
  min-width: 0;
  flex: 1;
}

.channel-copy strong {
  display: block;
  font-size: 10px;
  font-weight: 650;
}

.channel-copy small {
  display: block;
  margin-top: 2px;
  font-size: 8px;
  color: var(--muted);
}

.channel-value {
  font-size: 11px;
  font-weight: 700;
}

.channel-note {
  padding-top: 13px;
  border-top: 1px solid #efe9de;
  font-size: 8.5px;
  line-height: 1.55;
  color: var(--muted);
}

.channel-note strong {
  color: var(--ink-2);
}

.intent-list {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.intent-row {
  display: grid;
  grid-template-columns: 19px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.intent-rank {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #f2ede4;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
}

.intent-row:first-child .intent-rank {
  background: var(--violet-soft);
  color: var(--violet-2);
}

.intent-body {
  min-width: 0;
}

.intent-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.intent-title span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intent-title span:last-child {
  color: var(--muted);
  font-size: 8px;
  font-weight: 500;
  white-space: nowrap;
}

.intent-track {
  height: 4px;
  margin-top: 6px;
  border-radius: 99px;
  background: #f1ece3;
  overflow: hidden;
}

.intent-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7b5cff, #b3a2ff);
  transition: width 500ms ease;
}

.intent-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  min-width: 20px;
  text-align: right;
}

.unanswered-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 262px;
  overflow-y: auto;
  scrollbar-width: thin;
  min-width: 0;
}

.unanswered-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 11px;
  border: 1px solid #f0e3dc;
  border-radius: 10px;
  background: #fffaf7;
}

.unanswered-mark {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #ffe8df;
  color: #b64e2c;
  font-size: 10px;
  font-weight: 700;
}

.unanswered-copy {
  min-width: 0;
  flex: 1;
}

.unanswered-copy p {
  margin: 0;
  font-size: 9.5px;
  line-height: 1.42;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.unanswered-copy small {
  display: block;
  margin-top: 4px;
  font-size: 7.5px;
  color: #a19a8d;
}

.unanswered-count {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 999px;
  background: #f3e5dc;
  color: #95452a;
  font-size: 8px;
  font-weight: 700;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 150px;
  padding: 18px;
  border: 1px dashed #ded5c6;
  border-radius: 11px;
  text-align: center;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
}

.empty-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8f8f1;
  color: #16815e;
  font-size: 13px;
}

.table-card {
  padding-bottom: 8px;
}

.card-link {
  font-size: 8.5px;
  font-weight: 700;
  color: var(--violet-2);
  white-space: nowrap;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9px;
}

thead th {
  padding: 8px 8px;
  border-bottom: 1px solid #ece5d9;
  text-align: left;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a49bad;
  white-space: nowrap;
}

tbody td {
  padding: 10px 8px;
  border-bottom: 1px solid #f3eee5;
  vertical-align: middle;
  color: var(--ink-2);
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr.clickable {
  cursor: pointer;
  transition: background 120ms ease;
}

tbody tr.clickable:hover {
  background: #faf6ee;
}

.channel-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 7.5px;
  font-weight: 650;
  white-space: nowrap;
}

.channel-badge.web {
  background: var(--violet-soft);
  color: var(--violet-2);
}

.channel-badge.whatsapp {
  background: #e2f8ee;
  color: #127355;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 7.5px;
  font-weight: 650;
  white-space: nowrap;
}

.status-badge.auto {
  background: #eef7f2;
  color: #1f7f61;
}

.status-badge.escalated {
  background: #ffece4;
  color: #a84727;
}

.turn-count {
  font-size: 9px;
  color: var(--muted);
}

.last-message {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.relative {
  font-size: 8px;
  color: #a49bad;
  white-space: nowrap;
}

.table-empty {
  padding: 28px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 9.5px;
}

.handover-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.handover-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 11px;
  border: 1px solid #efe8dd;
  border-radius: 10px;
  background: #fffaf6;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.handover-item:hover {
  border-color: #d9c8b8;
  background: #fff7ef;
  transform: translateY(-1px);
}

.handover-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #ffe9dc;
  color: #b64e2c;
  font-size: 11px;
}

.handover-copy {
  min-width: 0;
  flex: 1;
}

.handover-copy strong {
  display: block;
  font-size: 9px;
  line-height: 1.35;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.handover-copy small {
  display: block;
  margin-top: 4px;
  font-size: 7.5px;
  color: #a49bad;
}

.handover-status {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 999px;
  background: #e8f8f1;
  color: #16815e;
  font-size: 7px;
  font-weight: 700;
}

.admin-foot {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 2px 0;
  font-size: 8px;
  color: #aaa295;
  flex-wrap: wrap;
}

dialog {
  width: min(620px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 40px));
  padding: 0;
  border: 1px solid #dfd5c6;
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 40px 100px rgba(23, 18, 46, 0.35);
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(17, 13, 34, 0.5);
  backdrop-filter: blur(5px);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 19px 20px 15px;
  border-bottom: 1px solid #eee7dc;
}

.dialog-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.dialog-close {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

.dialog-close:hover {
  background: #f7f2e8;
  color: var(--ink);
}

.dialog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 12px 20px;
  border-bottom: 1px solid #f1ebe1;
  background: #fcf8f1;
  font-size: 8.5px;
  color: var(--muted);
}

.dialog-meta code {
  font-size: 8px;
}

.transcript {
  padding: 17px 20px 22px;
  max-height: 480px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
  background-color: #f8f4ec;
  background-image: radial-gradient(rgba(29, 23, 51, 0.035) 1px, transparent 1px);
  background-size: 16px 16px;
}

.transcript-msg {
  max-width: 86%;
  padding: 9px 11px;
  border-radius: 11px;
  font-size: 10px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.transcript-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #7454ff, #5b38e6);
  color: #fff;
  border-bottom-right-radius: 3px;
}

.transcript-msg.assistant {
  align-self: flex-start;
  background: #fffdf9;
  border: 1px solid #e8e1d4;
  color: var(--ink-2);
  border-bottom-left-radius: 3px;
}

.transcript-meta {
  display: flex;
  gap: 5px;
  align-items: center;
  margin-top: 4px;
  font-size: 7px;
  opacity: 0.62;
}

.transcript-meta .pill {
  padding: 1px 4px;
  border-radius: 4px;
  background: #efe9df;
  color: #736b80;
}

.transcript-empty {
  padding: 30px;
  text-align: center;
  color: var(--muted);
  font-size: 10px;
}

.token-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 13, 34, 0.52);
  backdrop-filter: blur(7px);
}

.token-gate[hidden] {
  display: none;
}

.token-card {
  width: min(390px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 40px 100px rgba(23, 18, 46, 0.35);
}

.token-card h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.token-card p:not(.eyebrow):not(.token-error) {
  margin: 9px 0 17px;
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--muted);
}

.token-card input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f2e8;
  padding: 0 12px;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  outline: none;
}

.token-card input:focus {
  border-color: #a08cff;
  box-shadow: 0 0 0 3px rgba(109, 74, 255, 0.12);
  background: #fff;
}

.token-card button {
  width: 100%;
  height: 42px;
  margin-top: 10px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(145deg, #7b5cff, #5a36e8);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.token-card button:hover {
  filter: brightness(1.04);
}

.token-error {
  margin: 10px 0 0;
  font-size: 10px;
  color: var(--danger);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  max-width: 340px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid #ead3c9;
  background: #fff7f2;
  color: #9c3d24;
  font-size: 10px;
  line-height: 1.5;
  box-shadow: 0 16px 40px rgba(27, 21, 48, 0.18);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1180px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-two {
    grid-template-columns: 1fr;
  }
  .donut-wrap {
    padding-bottom: 12px;
  }
}

@media (max-width: 900px) {
  .shell {
    flex-direction: column;
  }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    flex: none;
    padding: 15px 18px;
  }
  .side-brand {
    padding: 0;
  }
  .side-nav {
    display: none;
  }
  .side-card,
  .side-links {
    display: none;
  }
  .side-foot {
    flex-direction: row;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
  }
  .main {
    padding: 20px 18px 28px;
  }
  .topbar {
    flex-direction: column;
  }
  .top-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}

@media (max-width: 620px) {
  .kpis {
    grid-template-columns: 1fr;
  }
  .top-actions {
    gap: 6px;
  }
  .engine-badge {
    display: none;
  }
  .daily-bars {
    gap: 3px;
    height: 150px;
  }
  .bar-label {
    font-size: 6px;
  }
  .donut-wrap {
    flex-direction: column;
    align-items: flex-start;
  }
  .channel-legend {
    width: 100%;
  }
  .card {
    padding: 15px;
  }
  .unanswered-list {
    max-height: none;
    overflow-y: visible;
  }
  table {
    table-layout: fixed;
  }
  thead th:nth-child(3),
  tbody td:nth-child(3),
  thead th:nth-child(5),
  tbody td:nth-child(5) {
    display: none;
  }
  thead th:nth-child(1),
  tbody td:nth-child(1) {
    width: 68px;
  }
  thead th:nth-child(4),
  tbody td:nth-child(4) {
    width: 82px;
  }
  tbody td,
  thead th {
    padding-left: 6px;
    padding-right: 6px;
  }
  .last-message {
    max-width: none;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .admin-foot {
    flex-direction: column;
    gap: 5px;
  }
}

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