:root {
  --bg: #020408;
  --surface: #111318;
  --surface-low: #0c0e12;
  --surface-mid: #1e2024;
  --surface-high: #282a2e;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(173, 199, 255, 0.24);
  --text: #e2e2e8;
  --muted: #c1c6d7;
  --quiet: #8b90a0;
  --primary: #adc7ff;
  --primary-strong: #4a8eff;
  --secondary: #00dbe7;
  --tertiary: #00e290;
  --danger: #ffb4ab;
  --radius: 18px;
  --sidebar: 272px;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  vertical-align: middle;
}

.material-symbols-outlined.fill { font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.02); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.13); border-radius: 999px; }

.side-nav {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.52);
  backdrop-filter: blur(24px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.38);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 30px 28px 18px;
}

.brand-icon,
.channel-icon,
.icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: #00285b;
  background: linear-gradient(135deg, var(--primary), #ddfcff);
  box-shadow: 0 16px 36px rgba(74, 142, 255, 0.2);
}

.brand-block strong,
.mobile-brand {
  display: block;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #60a5fa, #67e8f9);
  -webkit-background-clip: text;
  color: transparent;
}

.brand-block small {
  display: block;
  margin-top: 2px;
  color: rgba(173, 199, 255, 0.64);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.workspace-switcher {
  display: flex;
  gap: 8px;
  padding: 0 22px 14px;
  overflow-x: auto;
}

.workspace-switcher a {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--quiet);
  font-size: 0.78rem;
}

.workspace-switcher a.active {
  color: var(--primary);
  background: rgba(74, 142, 255, 0.12);
}

.nav-links {
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px 22px;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 14px;
  margin-bottom: 4px;
  border-radius: 14px;
  color: #94a3b8;
  font-size: 0.9rem;
  font-weight: 600;
  transition: 180ms ease;
}

.nav-links a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }

.nav-links a.active {
  color: #60a5fa;
  background: rgba(37, 99, 235, 0.2);
  box-shadow: inset -2px 0 0 #3b82f6;
}

.side-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 22px 24px;
  padding: 14px;
  border: 1px solid rgba(0, 226, 144, 0.22);
  border-radius: 14px;
  color: var(--tertiary);
  background: rgba(0, 226, 144, 0.09);
  font-size: 0.78rem;
  font-weight: 800;
}

.main-shell {
  height: 100vh;
  margin-left: var(--sidebar);
  background: #06080b;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
  min-height: 76px;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.68);
  backdrop-filter: blur(16px);
}

.top-search {
  position: relative;
  width: min(520px, 100%);
}

.top-search span,
.inline-search span {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 1.15rem;
}

.top-search input,
.inline-search input {
  width: 100%;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  color: var(--text);
  background: rgba(15, 23, 42, 0.62);
  outline: none;
}

.top-search input { padding: 0 18px 0 44px; }

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn,
.mobile-back {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  color: #cbd5e1;
  background: transparent;
  transition: 160ms ease;
}

.icon-btn:hover,
.mobile-back:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.primary-btn,
.secondary-btn,
.handover-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  border: 0;
  border-radius: 13px;
  padding: 0 18px;
  font-weight: 800;
  white-space: nowrap;
}

.primary-btn {
  color: #002e68;
  background: var(--primary);
  box-shadow: 0 16px 34px rgba(74, 142, 255, 0.18);
}

.secondary-btn {
  color: #00311b;
  background: var(--tertiary);
}

.user-chip {
  display: grid;
  gap: 1px;
  padding-left: 10px;
  text-align: right;
}

.user-chip span { font-size: 0.82rem; font-weight: 800; }
.user-chip small { color: var(--quiet); font-size: 0.68rem; }

.page-canvas,
.ai-page {
  width: min(100%, 1500px);
  margin: 0 auto;
  padding: 36px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 28px;
}

.page-heading h1,
.chat-list-head h1,
.flow-topbar h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1;
  letter-spacing: -0.055em;
  font-weight: 900;
}

.page-heading p,
.flow-topbar p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  background: var(--surface-mid);
}

.segmented button {
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  color: var(--muted);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 900;
}

.segmented button.active { color: var(--text); background: rgba(255, 255, 255, 0.1); }

.glass-panel,
.stat-card,
.channel-card,
.notice-card,
.detail-card,
.profile-card,
.info-grid article {
  border: 1px solid var(--line);
  background: rgba(30, 32, 36, 0.42);
  backdrop-filter: blur(20px);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 30px;
}

.stat-card {
  min-height: 142px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  border-radius: 26px;
  transition: 180ms ease;
}

.stat-card:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.stat-card.glow { border-color: rgba(0, 226, 144, 0.38); box-shadow: 0 0 18px rgba(0, 226, 144, 0.18); }
.stat-card > span { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--primary); background: rgba(173, 199, 255, 0.1); }
.stat-card small { color: var(--muted); font-size: 0.64rem; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; }
.stat-card strong { display: block; margin-top: 5px; font-size: 1.95rem; line-height: 1; font-weight: 900; letter-spacing: -0.05em; }
.stat-card em { color: var(--tertiary); font-size: 0.72rem; font-style: normal; font-weight: 800; }

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: 28px;
  margin-bottom: 28px;
}

.dash-grid.lower { align-items: stretch; }

.glass-panel {
  border-radius: 30px;
  padding: 26px;
}

.panel-title,
.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-title span {
  width: 4px;
  height: 30px;
  border-radius: 999px;
  background: var(--primary);
}

.panel-title.cyan span { background: var(--secondary); }
.panel-title.green span { background: var(--tertiary); }
.panel-title.danger span { background: var(--danger); }
.panel-title h2 { margin: 0; font-size: 1.08rem; }
.panel-head { justify-content: space-between; margin-bottom: 20px; }
.panel-head a, .panel-head button { color: var(--primary); border: 0; background: transparent; font-weight: 900; text-transform: uppercase; font-size: 0.72rem; }

.chart-line { height: 310px; margin-top: 26px; }
.chart-line svg { width: 100%; height: 100%; }
.chart-labels { display: flex; justify-content: space-between; margin-top: 8px; color: var(--quiet); font-size: 0.7rem; font-weight: 900; letter-spacing: 0.18em; text-transform: uppercase; }

.donut {
  width: 190px;
  height: 190px;
  display: grid;
  place-content: center;
  margin: 30px auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--surface-low) 0 54%, transparent 55%),
    conic-gradient(var(--secondary) 0 72%, var(--primary) 72% 88%, var(--tertiary) 88% 100%);
  text-align: center;
}

.donut strong { font-size: 2rem; letter-spacing: -0.05em; }
.donut small { color: var(--quiet); font-weight: 900; text-transform: uppercase; }

.legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.legend-row i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--quiet);
}

.legend-row .cyan-dot { background: var(--secondary); box-shadow: 0 0 8px rgba(0, 219, 231, 0.55); }
.legend-row span { flex: 1; color: var(--muted); font-weight: 800; }
.legend-row.muted { opacity: 0.68; }

.recent-list { display: grid; }

.recent-item {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 78px;
  padding: 14px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.recent-copy { min-width: 0; flex: 1; }
.recent-copy strong, .contact-copy strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.recent-copy small, .recent-meta small { color: var(--quiet); }
.recent-meta { display: grid; justify-items: end; gap: 6px; }
.recent-meta em, .contact-tags em { border-radius: 999px; padding: 5px 9px; font-size: 0.62rem; font-style: normal; font-weight: 900; text-transform: uppercase; }
.ai-on { color: var(--tertiary); background: rgba(0, 226, 144, 0.12); }
.ai-off { color: #fb923c; background: rgba(251, 146, 60, 0.12); }

.alert-card {
  display: flex;
  gap: 14px;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid rgba(255, 180, 171, 0.15);
  border-radius: 22px;
  background: rgba(255, 180, 171, 0.08);
}

.alert-card > span { color: var(--danger); }
.alert-card strong { display: block; margin-bottom: 6px; }
.alert-card p, .efficiency-box small { margin: 0; color: var(--muted); line-height: 1.55; }

.efficiency-box {
  margin-top: 24px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(0, 226, 144, 0.08);
  border: 1px solid rgba(0, 226, 144, 0.18);
}

.efficiency-box strong { display: block; margin: 8px 0; font-size: 2.2rem; color: var(--tertiary); }
.efficiency-box div { height: 10px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, 0.06); }
.efficiency-box span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, rgba(0, 226, 144, 0.55), var(--tertiary)); }

.chat-shell {
  height: 100vh;
  height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
}

.chats-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 330px;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.chat-list-column,
.customer-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--surface-low);
  border-right: 1px solid var(--line);
}

.customer-column {
  display: block;
  overflow-y: auto;
  border-right: 0;
  border-left: 1px solid var(--line);
}

.chat-list-head {
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.mobile-brand { display: none; margin-bottom: 14px; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.chat-list-head h1 { font-size: 1.25rem; letter-spacing: 0; }

.inline-search {
  position: relative;
  display: block;
  margin: 16px 0 12px;
}

.inline-search input {
  height: 44px;
  padding: 0 14px 0 42px;
  border-radius: 12px;
  background: var(--surface-mid);
}

.filter-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.filter-tabs button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 8px 13px;
  color: var(--muted);
  background: var(--surface-high);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.filter-tabs button.active { color: #002e68; background: var(--primary); }

.contact-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.contact-item {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  border-left: 4px solid transparent;
  padding: 15px 14px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.contact-item:hover { background: rgba(255, 255, 255, 0.045); }
.contact-item.active { border-left-color: var(--primary); background: rgba(173, 199, 255, 0.1); }

.avatar,
.profile-avatar,
.active-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: #00285b;
  background: linear-gradient(135deg, var(--primary), #ddfcff);
  font-weight: 900;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 0.78rem;
}

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

.contact-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.contact-top small,
.contact-meta {
  color: var(--quiet);
  font-size: 0.68rem;
}

.contact-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.contact-meta i { color: #e4405f; font-size: 0.78rem; }
.contact-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.contact-tags em:not(.ai-on):not(.ai-off) { color: var(--secondary); background: rgba(0, 219, 231, 0.12); }

.mini-dot {
  width: 8px;
  height: 8px;
  margin-top: 44px;
  border-radius: 50%;
  background: #fb923c;
}

.mini-dot.on { background: var(--tertiary); box-shadow: 0 0 10px rgba(0, 226, 144, 0.65); }

.conversation-column {
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: rgba(2, 6, 23, 0.68);
}

.conversation-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(17, 19, 24, 0.72);
  backdrop-filter: blur(16px);
}

.mobile-back { display: none; }
.active-avatar { width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--primary); }

.conversation-title {
  min-width: 0;
  flex: 1;
}

.conversation-title h2 {
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 1rem;
}

.conversation-title p {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 3px 0 0;
  color: var(--quiet);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.handover-btn {
  min-height: 40px;
  color: var(--primary);
  background: rgba(173, 199, 255, 0.1);
  border: 1px solid rgba(173, 199, 255, 0.18);
}

.conversation-stream {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px;
  background: rgba(15, 23, 42, 0.35);
}

.empty-state {
  min-height: 100%;
  display: grid;
  place-content: center;
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  letter-spacing: -0.06em;
}

.empty-state p,
.state-text {
  color: var(--quiet);
  line-height: 1.65;
}

.state-text { padding: 20px; }
.state-text.center { text-align: center; }

.stream-event {
  width: max-content;
  max-width: 100%;
  margin: 0 auto 24px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  color: var(--quiet);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.message {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  margin: 18px 0;
}

.message.assistant { align-items: flex-start; }

.bubble {
  max-width: min(74%, 720px);
  padding: 14px 18px;
  border-radius: 20px 20px 4px 20px;
  color: var(--text);
  background: var(--surface-high);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
  overflow-wrap: anywhere;
}

.message.assistant .bubble {
  border: 1px solid rgba(0, 226, 144, 0.22);
  border-radius: 20px 20px 20px 4px;
  background: rgba(0, 226, 144, 0.09);
  box-shadow: 0 0 20px rgba(0, 226, 144, 0.12);
}

.bubble p { margin: 0; line-height: 1.6; }
.message time { color: var(--quiet); font-size: 0.68rem; }

.assistant-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  padding: 5px 9px;
  border: 1px solid rgba(0, 226, 144, 0.18);
  border-radius: 8px;
  color: var(--tertiary);
  background: rgba(0, 226, 144, 0.1);
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
}

.assistant-label i { font-size: 0.82rem; }

.composer {
  padding: 18px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface-low);
}

.composer-tools {
  display: flex;
  gap: 18px;
  margin-bottom: 12px;
}

.composer-tools button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  color: var(--quiet);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 700;
}

.composer-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.composer-box textarea {
  flex: 1;
  min-height: 54px;
  max-height: 120px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 15px;
  color: var(--text);
  background: var(--surface-mid);
  outline: none;
}

.composer-box button {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 18px;
  color: #00285b;
  background: var(--primary);
}

.composer-box.disabled { opacity: 0.7; }

.toast-wrap {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  transform: translateY(10px);
  opacity: 0;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: rgba(17, 19, 24, 0.94);
  backdrop-filter: blur(18px);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.34);
  font-size: 0.86rem;
  line-height: 1.45;
  transition: 180ms ease;
}

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

.toast.success { border-color: rgba(0, 226, 144, 0.3); }
.toast.warn { border-color: rgba(255, 180, 171, 0.34); }

.profile-card {
  padding: 30px 24px;
  text-align: center;
  border-width: 0 0 1px;
}

.profile-avatar {
  width: 92px;
  height: 92px;
  margin: 0 auto 16px;
  border-radius: 28px;
  font-size: 1.45rem;
}

.profile-card h2 { margin: 0; font-size: 1.12rem; }
.profile-card p { margin: 7px 0 16px; color: var(--quiet); overflow-wrap: anywhere; }

.status-pill {
  display: inline-flex;
  justify-content: center;
  min-width: 82px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--tertiary);
  background: rgba(0, 226, 144, 0.12);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-pill.off { color: #fb923c; background: rgba(251, 146, 60, 0.12); }

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 20px;
}

.info-grid article {
  padding: 16px;
  border-radius: 18px;
}

.info-grid small,
.detail-card small {
  display: block;
  color: var(--quiet);
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.info-grid strong { display: block; margin-top: 8px; color: var(--tertiary); font-size: 1.55rem; }

.detail-card {
  margin: 0 20px 18px;
  padding: 18px;
  border-radius: 20px;
}

.detail-card h3 { margin: 0 0 14px; font-size: 0.95rem; }
.detail-card p { color: var(--muted); line-height: 1.6; }

.toggle-row,
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toggle-row input,
.switch-row input {
  width: 38px;
  height: 20px;
  accent-color: var(--tertiary);
}

.tags,
.blocked-tags,
.kb-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tags span,
.tags button,
.blocked-tags span,
.kb-tags span,
.kb-tags button {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 7px 9px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.68rem;
  font-weight: 900;
}

.tags button,
.kb-tags button { color: var(--primary); border-color: rgba(173, 199, 255, 0.2); }

.notice-card {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
  padding: 18px;
  border-radius: 18px;
}

.notice-card.warning { border-color: rgba(255, 180, 171, 0.24); background: rgba(255, 180, 171, 0.06); }
.notice-card span { color: var(--danger); }
.notice-card strong { display: block; margin-bottom: 4px; color: var(--danger); }
.notice-card p { margin: 0; color: var(--muted); }

.channels-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.channel-card {
  position: relative;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  padding: 22px;
  border-radius: 20px;
}

.channel-card.connected { border-color: rgba(0, 226, 144, 0.26); }
.channel-card.inactive { opacity: 0.86; }
.badge {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 5px 8px;
  border-radius: 8px;
  color: #fb7185;
  background: rgba(244, 63, 94, 0.12);
  font-size: 0.66rem;
  font-weight: 900;
}

.channel-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 18px;
  border-radius: 16px;
  color: white;
  background: linear-gradient(135deg, #7c3aed, #ec4899);
}

.channel-icon.whatsapp { background: #059669; }
.channel-icon.web { background: #2563eb; }
.channel-card h2 { margin: 0; font-size: 1.2rem; }
.connected-text { color: var(--tertiary); }
.inactive-text { color: #fb923c; }
.channel-card dl { display: grid; gap: 10px; margin: 18px 0; }
.channel-card div + h2 + p { margin: 7px 0 0; font-size: 0.74rem; font-weight: 900; text-transform: uppercase; }
.channel-card dt, .channel-card dd { margin: 0; }
.channel-card dt { color: var(--quiet); }
.channel-card dd { text-align: right; font-weight: 800; }
.channel-card dl { grid-template-columns: 1fr auto; }
.channel-card a, .channel-card button {
  margin-top: auto;
  border: 1px solid rgba(173, 199, 255, 0.22);
  border-radius: 12px;
  padding: 11px 14px;
  color: var(--primary);
  background: rgba(173, 199, 255, 0.08);
  text-align: center;
  font-weight: 900;
}

.add-card {
  align-items: center;
  justify-content: center;
  border-style: dashed;
  text-align: center;
}

.add-card > span { margin-bottom: 12px; color: var(--primary); font-size: 3rem; }

.flow-page {
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(74, 142, 255, 0.09), transparent 30%),
    linear-gradient(180deg, #070a10 0%, #030509 100%);
}

.flow-topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(3, 5, 9, 0.78);
  backdrop-filter: blur(16px);
}

.flow-topbar h1 { font-size: 1.5rem; color: var(--primary); }
.flow-topbar p { margin: 3px 0 0; font-size: 0.86rem; }

.flow-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.flow-zoom-label {
  min-width: 54px;
  padding: 8px 10px;
  border: 1px solid rgba(173, 199, 255, 0.14);
  border-radius: 12px;
  color: var(--primary);
  background: rgba(173, 199, 255, 0.07);
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
}

.flow-add-btn {
  min-height: 38px;
  padding: 0 14px;
  font-size: 0.78rem;
  gap: 6px;
}
.flow-state {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(0, 226, 144, 0.22);
  border-radius: 14px;
  padding: 10px 13px;
  color: var(--muted);
  background: rgba(0, 226, 144, 0.08);
}
.flow-state strong { color: var(--tertiary); letter-spacing: 0.14em; text-transform: uppercase; }
.flow-state.off { border-color: rgba(255, 180, 171, 0.24); background: rgba(255, 180, 171, 0.08); }
.flow-state.off strong { color: var(--danger); }

.flow-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  height: calc(100vh - 76px);
}

.flow-canvas {
  position: relative;
  overflow: auto;
  min-width: 0;
  --flow-content-w: 2200px;
  --flow-content-h: 1320px;
  background-color: #04070d;
  background-image:
    linear-gradient(rgba(255,255,255,.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px),
    radial-gradient(circle at 50% 0, rgba(173, 199, 255, 0.08), transparent 38%);
  background-size: 48px 48px, 48px 48px, 100% 100%;
  cursor: grab;
}

.flow-canvas:active,
.flow-canvas.is-panning {
  cursor: grabbing;
}

.flow-canvas-hint {
  position: sticky;
  top: 78px;
  left: 18px;
  z-index: 13;
  width: max-content;
  max-width: calc(100% - 36px);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0 18px;
  padding: 8px 11px;
  border: 1px solid rgba(173, 199, 255, 0.13);
  border-radius: 999px;
  color: rgba(193, 198, 215, 0.82);
  background: rgba(6, 8, 13, 0.74);
  backdrop-filter: blur(16px);
  font-size: 0.72rem;
  font-weight: 800;
  pointer-events: none;
}

.flow-canvas-hint span {
  color: var(--primary);
  font-size: 1rem;
}

.flow-palette {
  position: sticky;
  top: 14px;
  left: 14px;
  z-index: 12;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: max-content;
  max-width: calc(100% - 28px);
  padding: 9px;
  border: 1px solid rgba(173, 199, 255, 0.14);
  border-radius: 18px;
  background: rgba(8, 12, 20, 0.82);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.32);
}

.flow-palette button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  border: 0;
  border-radius: 10px;
  padding: 0 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.72rem;
  font-weight: 900;
}

.flow-palette button:hover {
  color: var(--text);
  background: rgba(173, 199, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(173, 199, 255, 0.16);
}
.flow-palette span { font-size: 1rem; }

.flow-canvas::before {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--flow-content-w);
  height: var(--flow-content-h);
  min-width: var(--flow-content-w);
  min-height: var(--flow-content-h);
  pointer-events: none;
}

.flow-lines {
  position: absolute;
  left: 0;
  top: 0;
  width: 2200px;
  height: 1320px;
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(74, 142, 255, 0.24));
}

.flow-lines path {
  fill: none;
  stroke: var(--primary);
  stroke-width: 3.4;
  stroke-linecap: round;
  pointer-events: stroke;
  cursor: pointer;
  opacity: 0.92;
}

.flow-lines path.edge-true {
  stroke: var(--tertiary);
}

.flow-lines path.edge-false {
  stroke: var(--danger);
}

.flow-lines path.edge-out {
  stroke: #9bbcff;
}

.flow-lines path:hover {
  stroke: #fff;
  stroke-width: 5;
  opacity: 1;
}

.flow-node {
  position: absolute;
  z-index: 2;
  width: 310px;
  min-height: 178px;
  padding: 16px;
  border: 1px solid rgba(173, 199, 255, 0.12);
  border-top-color: rgba(255, 255, 255, 0.13);
  border-left: 5px solid var(--primary);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(30, 35, 46, 0.88), rgba(12, 16, 24, 0.88));
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.32);
  cursor: pointer;
  user-select: none;
  transform: scale(var(--flow-zoom, 1));
  transform-origin: top left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.flow-node:hover {
  transform: translateY(-2px) scale(var(--flow-zoom, 1));
  border-color: rgba(173, 199, 255, 0.28);
  box-shadow: 0 24px 58px rgba(0, 0, 0, 0.42), 0 0 22px rgba(74, 142, 255, 0.08);
}

.flow-node small { color: var(--primary); font-size: 0.62rem; font-weight: 950; letter-spacing: 0.16em; text-transform: uppercase; }
.flow-node h2 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.2;
  letter-spacing: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.flow-node p {
  min-height: 34px;
  margin: 7px 0 0;
  color: rgba(193, 198, 215, 0.82);
  font-size: 0.8rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.flow-node.condition { border-left-color: var(--secondary); }
.flow-node.condition small,
.flow-node.condition .node-type-icon { color: var(--secondary); }
.flow-node.active { border-color: rgba(255, 255, 255, 0.24); border-left-color: var(--tertiary); box-shadow: 0 0 0 2px rgba(173, 199, 255, 0.09), 0 0 30px rgba(74, 142, 255, 0.2); }
.flow-node.active small { color: var(--tertiary); }
.flow-node.muted { opacity: 0.62; border-left-color: var(--quiet); }
.flow-node.start { border-left-color: var(--primary); }
.flow-node.handover { border-left-color: var(--danger); }
.flow-node.knowledge { border-left-color: var(--secondary); }
.flow-node.booking { border-left-color: #fb923c; }
.flow-node.ai { border-left-color: var(--tertiary); }
.flow-node.tag { border-left-color: #c084fc; }
.flow-node.action { border-left-color: #93c5fd; }

.node-card-head {
  display: flex;
  align-items: center;
  gap: 11px;
}

.node-type-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 13px;
  color: var(--primary);
  background: rgba(173, 199, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(173, 199, 255, 0.12);
}

.node-type-icon.tertiary { color: var(--tertiary); background: rgba(0, 226, 144, 0.1); }
.node-type-icon.secondary { color: var(--secondary); background: rgba(0, 219, 231, 0.1); }
.node-type-icon.danger { color: var(--danger); background: rgba(255, 180, 171, 0.11); }
.node-type-icon.warning { color: #fb923c; background: rgba(251, 146, 60, 0.1); }

.node-type-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.node-type-copy strong {
  color: rgba(226, 226, 232, 0.92);
  font-size: 0.72rem;
  font-weight: 900;
}

.node-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--quiet);
  box-shadow: 0 0 0 4px rgba(139, 144, 160, 0.1);
}

.node-status-dot.on {
  background: var(--tertiary);
  box-shadow: 0 0 0 4px rgba(0, 226, 144, 0.12), 0 0 12px rgba(0, 226, 144, 0.5);
}

.node-status-dot.off {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(255, 180, 171, 0.12);
}

.node-card-main {
  margin-top: 14px;
}

.node-summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 12px;
  color: rgba(226, 226, 232, 0.9);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.76rem;
  line-height: 1.35;
  overflow: hidden;
}

.node-port {
  position: absolute;
  z-index: 4;
  width: 18px;
  height: 18px;
  border: 2px solid var(--surface-low);
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(173, 199, 255, 0.1);
  cursor: crosshair;
}

.node-port:hover { transform: scale(1.18); }
.node-port span {
  position: absolute;
  top: 50%;
  color: rgba(226, 226, 232, 0.72);
  font-size: 0.55rem;
  font-weight: 950;
  letter-spacing: 0.1em;
  pointer-events: none;
}

.node-port-in { left: -10px; top: 50%; transform: translateY(-50%); }
.node-port-in:hover { transform: translateY(-50%) scale(1.18); }
.node-port-in span {
  right: 22px;
  transform: translateY(-50%);
}
.node-output-ports {
  position: absolute;
  right: -10px;
  top: 0;
  bottom: 0;
  display: grid;
  align-content: center;
  gap: 18px;
}

.node-port-out {
  position: relative;
  right: auto;
  top: auto;
  color: #001a41;
  font-size: 0.54rem;
  font-weight: 900;
  line-height: 1;
}

.node-port-out span {
  left: 24px;
  transform: translateY(-50%);
  padding: 3px 6px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  background: rgba(2, 4, 8, 0.72);
}

.node-port-out.true { background: var(--tertiary); box-shadow: 0 0 0 4px rgba(0, 226, 144, 0.11); }
.node-port-out.false { background: var(--danger); box-shadow: 0 0 0 4px rgba(255, 180, 171, 0.11); }

body.connecting-edge .node-port-in {
  animation: portPulse 900ms ease-in-out infinite alternate;
}

@keyframes portPulse {
  from { box-shadow: 0 0 0 4px rgba(173, 199, 255, 0.1); }
  to { box-shadow: 0 0 0 9px rgba(173, 199, 255, 0.2); }
}

.node-indicators {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.node-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 8px;
  color: rgba(193, 198, 215, 0.9);
  background: rgba(255, 255, 255, 0.055);
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.node-badge span { font-size: 0.8rem; }
.prompt-badge { color: var(--tertiary); background: rgba(0, 226, 144, 0.12); }
.link-badge { color: var(--primary); background: rgba(173, 199, 255, 0.1); }

.flow-settings {
  padding: 22px;
  border-left: 1px solid var(--line);
  background: var(--surface-low);
  overflow-y: auto;
}

.flow-settings h2 { margin: 0 0 20px; color: var(--primary); }
.selected-node { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid rgba(173, 199, 255, 0.18); border-radius: 16px; background: rgba(173, 199, 255, 0.06); flex: 1; min-width: 0; }
.selected-node > span { color: var(--primary); flex-shrink: 0; }
.selected-node strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.selected-node small { display: block; margin-top: 3px; color: var(--quiet); font-size: 0.68rem; }

.node-panel-empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  text-align: center;
  color: var(--quiet);
  gap: 12px;
}

.node-panel-empty > span { font-size: 3rem; opacity: 0.35; }
.node-panel-empty p { margin: 0; font-size: 0.86rem; }

.node-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.node-delete-btn { color: var(--danger); flex-shrink: 0; }
.node-delete-btn:hover { background: rgba(255, 180, 171, 0.1); }

.node-active-label {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.node-active-label input { width: auto; accent-color: var(--tertiary); }

.node-type-fields { display: none; }

.file-links-section { margin-top: 22px; }

.file-links-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.file-links-head > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.file-links-head > button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  border-radius: 9px;
  padding: 5px 10px;
  color: var(--primary);
  background: rgba(173, 199, 255, 0.1);
  font-size: 0.72rem;
  font-weight: 900;
}

.file-links-head > button span { font-size: 0.88rem; }

.file-links-list { display: grid; gap: 8px; }

.file-upload-label {
  min-height: 42px;
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: center;
  gap: 8px !important;
  margin: 0 0 12px !important;
  border: 1px dashed rgba(173, 199, 255, 0.26);
  border-radius: 12px;
  color: var(--primary) !important;
  background: rgba(173, 199, 255, 0.06);
  cursor: pointer;
}

.file-upload-label input { display: none; }
.file-upload-label span { font-size: 1.05rem; }

.file-link-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-high);
}

.file-link-item > span:first-child { color: var(--primary); font-size: 1.05rem; flex-shrink: 0; }

.file-link-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.82rem;
}

.file-link-remove {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--danger);
  background: transparent;
}

.file-link-remove:hover { background: rgba(255, 180, 171, 0.1); }
.file-link-remove span { font-size: 0.9rem; }
.file-links-empty { margin: 0; color: var(--quiet); font-size: 0.82rem; }

.global-settings-section {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.global-settings-label {
  margin: 0 0 4px;
  color: var(--quiet);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.flow-settings label,
.form-grid label {
  display: grid;
  gap: 9px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.flow-preview-box {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.flow-preview-box textarea {
  min-height: 82px;
}

.flow-preview-box button {
  min-height: 42px;
  border: 1px solid rgba(0, 226, 144, 0.2);
  border-radius: 12px;
  color: var(--tertiary);
  background: rgba(0, 226, 144, 0.08);
  font-weight: 900;
}

.preview-output.small {
  min-height: 96px;
  font-size: 0.78rem;
}

.flow-validation {
  position: sticky;
  left: 14px;
  bottom: 14px;
  z-index: 14;
  display: none;
  width: min(520px, calc(100% - 28px));
  margin: 24px 14px 14px;
  padding: 14px;
  border: 1px solid rgba(255, 180, 171, 0.28);
  border-radius: 16px;
  color: var(--danger);
  background: rgba(41, 12, 15, 0.84);
  backdrop-filter: blur(16px);
}

.flow-validation.show { display: block; }
.flow-validation strong { display: block; margin-bottom: 6px; }
.flow-validation p { margin: 4px 0 0; color: #ffd8d3; font-size: 0.82rem; }

select,
textarea,
.inline-input input {
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface-mid);
  outline: none;
}

select { height: 44px; padding: 0 12px; }
textarea { resize: vertical; padding: 14px; min-height: 120px; }
input[type="range"] { width: 100%; accent-color: var(--primary); }

.flow-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 24px;
}

.flow-actions button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.74rem;
}

.flow-actions button:last-child {
  color: #002e68;
  border-color: transparent;
  background: var(--primary);
}

.ai-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 22px;
}

.ai-grid .glass-panel { border-radius: 20px; }
.ai-grid .wide { grid-column: span 8; }
.ai-grid .handover { grid-column: span 4; }
.ai-grid .full-width { grid-column: 1 / -1; }
.ai-grid > .glass-panel:not(.wide):not(.handover):not(.full-width) { grid-column: span 6; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 20px;
}

.form-grid .full { grid-column: 1 / -1; }
.switch-row { margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--surface-high); color: var(--text); text-transform: none; letter-spacing: 0; font-size: 0.9rem; }
.source-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.source-grid div { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-high); cursor: pointer; transition: 160ms ease; }
.source-grid div:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.source-grid .dashed { border-style: dashed; place-items: center; text-align: center; }
.source-grid span { color: var(--primary); font-size: 2rem; }
.source-grid small { color: var(--tertiary); }
.faq-item { margin-top: 14px; padding: 14px; border-radius: 14px; background: rgba(255,255,255,.045); }
.faq-item strong { color: var(--primary); }
.faq-item p { margin: 7px 0 0; color: var(--muted); }
.blocked-tags { margin-top: 18px; }
.blocked-tags span { color: var(--danger); border-color: rgba(255, 180, 171, .2); background: rgba(255, 180, 171, .08); }
.inline-input { position: relative; display: flex; margin-top: 22px; }
.inline-input input { width: 100%; height: 46px; padding: 0 50px 0 14px; }
.inline-input button { position: absolute; right: 6px; top: 6px; width: 34px; height: 34px; border: 0; border-radius: 9px; color: var(--danger); background: transparent; }

.test-console {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
  gap: 16px;
  margin-top: 20px;
}

.test-console textarea {
  min-height: 140px;
}

.preview-output {
  min-height: 140px;
  border: 1px solid rgba(0, 226, 144, 0.18);
  border-radius: 16px;
  padding: 16px;
  color: var(--text);
  background: rgba(0, 226, 144, 0.07);
  line-height: 1.6;
  white-space: pre-wrap;
}

.utility-page {
  min-height: calc(100vh - 76px);
}

.utility-grid,
.profile-grid,
.tag-board,
.report-grid {
  display: grid;
  gap: 20px;
}

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

.reply-card {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 260px;
}

.reply-card > span {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--primary);
  background: rgba(173, 199, 255, 0.1);
}

.reply-card h2,
.tag-board h2 {
  margin: 0;
}

.reply-card p,
.tag-board p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.reply-card button {
  align-self: end;
  min-height: 42px;
  border: 1px solid rgba(173, 199, 255, 0.22);
  border-radius: 12px;
  color: var(--primary);
  background: rgba(173, 199, 255, 0.08);
  font-weight: 900;
}

.profile-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.profile-mini-card {
  display: grid;
  gap: 8px;
  border-radius: 20px;
  padding: 18px;
}

.profile-mini-card strong,
.profile-mini-card small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.profile-mini-card small {
  color: var(--quiet);
}

.profile-mini-card em {
  width: max-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 6px 10px;
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.tag-board,
.report-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tag-board .glass-panel {
  border-radius: 20px;
}

.tag-board strong {
  display: block;
  margin: 16px 0 8px;
  color: var(--tertiary);
  font-size: 2.35rem;
  line-height: 1;
}

.report-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 24px;
}

.report-table {
  border-radius: 24px;
}

.report-rows {
  display: grid;
  margin-top: 20px;
}

.report-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, auto) auto;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.report-row span,
.report-row small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.report-row small {
  color: var(--quiet);
}

.report-row em {
  border-radius: 999px;
  padding: 6px 10px;
  font-style: normal;
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.login-page {
  min-height: 100vh;
  overflow: auto;
  background:
    radial-gradient(720px 420px at 18% 0%, rgba(74, 142, 255, 0.2), transparent 60%),
    radial-gradient(600px 360px at 90% 18%, rgba(0, 226, 144, 0.13), transparent 55%),
    var(--bg);
}

.login-shell {
  min-height: 100vh;
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 430px);
  align-items: center;
  gap: 22px;
  margin: 0 auto;
  padding: 24px;
}

.login-panel,
.login-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(30, 32, 36, 0.42);
  backdrop-filter: blur(20px);
  padding: 30px;
}

.brand-row { display: flex; align-items: center; gap: 13px; margin-bottom: 44px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; color: #00285b; background: linear-gradient(135deg, var(--primary), #ddfcff); font-weight: 900; }
.brand-row strong { display: block; font-size: 1.3rem; font-weight: 900; }
.brand-row small { color: var(--quiet); }
.login-panel h1 { max-width: 760px; margin: 0; font-size: clamp(2.4rem, 6vw, 5.4rem); line-height: .96; letter-spacing: -.07em; }
.login-panel p { max-width: 650px; color: var(--muted); line-height: 1.7; font-size: 1.05rem; }
.login-card { display: grid; gap: 12px; }
.login-card h2 { margin: 0 0 8px; }
.login-card label { color: var(--muted); font-size: .78rem; font-weight: 900; text-transform: uppercase; }
.login-card input { height: 48px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--surface-low); padding: 0 13px; outline: none; }
.login-card button { min-height: 50px; margin-top: 8px; border: 0; border-radius: 13px; color: #002e68; background: var(--primary); font-weight: 900; }
.alert { padding: 12px; border: 1px solid rgba(255, 180, 171, .25); border-radius: 12px; color: var(--danger); background: rgba(255, 180, 171, .08); }

@media (max-width: 1320px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .dash-grid, .channels-grid { grid-template-columns: 1fr 1fr; }
  .chats-layout { grid-template-columns: 320px minmax(0, 1fr); }
  .customer-column { display: none; }
  .ai-grid .wide, .ai-grid .handover, .ai-grid > .glass-panel:not(.wide):not(.handover):not(.full-width) { grid-column: 1 / -1; }
}

@media (max-width: 980px) {
  body { overflow: auto; }
  .side-nav {
    position: static;
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand-block { padding: 18px 18px 10px; }
  .nav-links {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 14px 16px;
  }
  .nav-links a { flex: 0 0 auto; margin: 0; }
  .side-status { display: none; }
  .main-shell {
    height: auto;
    min-height: 100vh;
    margin-left: 0;
    overflow: visible;
  }
  .topbar { padding: 14px 18px; flex-wrap: wrap; }
  .top-actions { width: 100%; justify-content: space-between; }
  .page-canvas, .ai-page { padding: 24px 18px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .stats-grid, .dash-grid, .channels-grid, .source-grid, .utility-grid, .profile-grid, .tag-board, .report-grid, .test-console { grid-template-columns: 1fr; }
  .flow-workspace { grid-template-columns: 1fr; height: auto; }
  .flow-settings { border-left: 0; border-top: 1px solid var(--line); }
  .flow-canvas { min-height: 560px; }
  .login-shell { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  body.app-body { overflow: hidden; }
  body.app-body[data-page]:not([data-page="chats"]) { overflow: auto; }
  body[data-page="chats"] .side-nav { display: none; }
  .chats-layout { grid-template-columns: 1fr; }
  .chat-shell {
    height: 100dvh;
    overflow: hidden;
  }
  .chats-layout {
    height: 100%;
    min-height: 0;
  }
  .chat-list-column, .conversation-column {
    height: 100%;
    min-height: 0;
  }
  .conversation-column { display: none; }
  body.chat-open .chat-list-column { display: none; }
  body.chat-open .conversation-column { display: flex; }
  .customer-column { display: none; }
  .mobile-brand, .mobile-back { display: inline-flex; align-items: center; justify-content: center; }
  .mobile-brand { display: block; }
  .handover-btn span:last-child { display: none; }
  .conversation-header { padding: 0 12px; }
  .conversation-stream { padding: 18px 12px; }
  .bubble { max-width: 88%; }
  .composer { padding: 14px 12px; }
  .composer-tools { gap: 10px; overflow-x: auto; }
  .composer-tools button { flex: 0 0 auto; }
  .login-panel h1 { font-size: clamp(2.1rem, 13vw, 3.4rem); }
}
