/* =========================================================
   频道广播台 · Telegram Broadcast Console
   Local-first, no external assets.
   ========================================================= */

:root {
  --bg: #060a11;
  --bg-2: #080e18;
  --surface: #0e1725;
  --surface-2: #111c2d;
  --surface-3: #162338;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #edf4fc;
  --text-2: #b6c4d6;
  --muted: #7f90a6;
  --faint: #55657b;
  --blue: #2aabee;
  --blue-bright: #64cdff;
  --blue-deep: #1683c4;
  --mint: #5ce1c6;
  --green: #3ddc97;
  --orange: #ffb454;
  --red: #ff6b7a;
  --red-soft: rgba(255, 107, 122, 0.12);
  --radius: 20px;
  --radius-sm: 12px;
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, 0.65);
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(1000px 600px at 80% -10%, rgba(42, 171, 238, 0.14), transparent 62%),
    radial-gradient(900px 600px at -10% 100%, rgba(92, 225, 198, 0.055), transparent 60%),
    var(--bg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--blue-bright);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  color: #c9e9ff;
  background: rgba(42, 171, 238, 0.1);
  border: 1px solid rgba(42, 171, 238, 0.16);
  border-radius: 5px;
  padding: 1px 5px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

img {
  max-width: 100%;
}

::selection {
  background: rgba(42, 171, 238, 0.34);
  color: #fff;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

.hidden {
  display: none !important;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.03;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

.ambient {
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  filter: blur(110px);
  pointer-events: none;
  opacity: 0.55;
}

.ambient-a {
  width: 520px;
  height: 520px;
  right: -180px;
  top: -220px;
  background: rgba(24, 145, 212, 0.18);
}

.ambient-b {
  width: 460px;
  height: 460px;
  left: 20%;
  bottom: -300px;
  background: rgba(42, 171, 238, 0.09);
}

/* ---------------------------------------------------------
   Shared primitives
   --------------------------------------------------------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  user-select: none;
}

.brand-mark {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #53c8ff 0%, #279bdd 48%, #106fa8 100%);
  box-shadow:
    0 10px 24px -8px rgba(42, 171, 238, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.36);
  flex: 0 0 auto;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.2);
  pointer-events: none;
}

.brand-mark.small {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.logo-plane {
  width: 21px;
  height: 21px;
  fill: #fff;
  filter: drop-shadow(0 2px 3px rgba(0, 45, 70, 0.25));
}

.brand-mark.small .logo-plane {
  width: 18px;
  height: 18px;
}

.brand-type {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-type b {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-type small {
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--muted);
}

.brand-compact .brand-type b {
  font-size: 14px;
}

.brand-compact .brand-type small {
  font-size: 7.5px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.19em;
  color: #84b9d8;
  text-transform: uppercase;
}

.eyebrow.small {
  font-size: 9px;
  letter-spacing: 0.17em;
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(42, 171, 238, 0.11), 0 0 12px rgba(42, 171, 238, 0.6);
}

.gradient-text {
  background: linear-gradient(110deg, #6ed4ff 0%, #2aabee 45%, #5ce1c6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.005em;
  white-space: nowrap;
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    opacity 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.btn .icon {
  width: 17px;
  height: 17px;
}

.btn.primary {
  color: #fff;
  border-color: rgba(121, 216, 255, 0.4);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.17), transparent 45%),
    linear-gradient(135deg, #32b6f5 0%, #1994d6 100%);
  box-shadow:
    0 12px 30px -10px rgba(42, 171, 238, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn.primary:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 45%),
    linear-gradient(135deg, #44c2ff 0%, #219fdf 100%);
  box-shadow:
    0 16px 34px -10px rgba(42, 171, 238, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.btn.ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-2);
}

.btn.ghost:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.btn.soft {
  border-color: rgba(42, 171, 238, 0.22);
  background: rgba(42, 171, 238, 0.1);
  color: #93dcff;
}

.btn.subtle {
  height: 34px;
  padding: 0 12px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-2);
  font-size: 12px;
  border-radius: 9px;
}

.btn.subtle:hover {
  border-color: rgba(42, 171, 238, 0.3);
  color: #bfeaff;
  background: rgba(42, 171, 238, 0.07);
}

.btn.wide {
  width: 100%;
  height: 50px;
  border-radius: 13px;
}

.btn.small {
  height: 34px;
  font-size: 12px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  transition:
    color 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease,
    transform 0.16s ease;
  flex: 0 0 auto;
}

.icon-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  border-color: var(--line);
}

.icon-btn:active {
  transform: scale(0.96);
}

.icon-btn.accent {
  color: #8cdcff;
  background: rgba(42, 171, 238, 0.1);
  border-color: rgba(42, 171, 238, 0.2);
}

.icon-btn.accent:hover {
  background: rgba(42, 171, 238, 0.18);
  border-color: rgba(42, 171, 238, 0.38);
}

.icon-btn.danger-hover:hover {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(255, 107, 122, 0.22);
}

.text-btn {
  padding: 0;
  border: 0;
  background: none;
  color: #74c9f1;
  font-size: 11px;
  font-weight: 600;
}

.text-btn:hover {
  color: #a9e4ff;
  text-decoration: underline;
}

.mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid rgba(42, 171, 238, 0.24);
  border-radius: 8px;
  background: rgba(42, 171, 238, 0.1);
  color: #9adfff;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  transition: 0.16s ease;
}

.mini-btn:hover {
  background: rgba(42, 171, 238, 0.17);
  border-color: rgba(42, 171, 238, 0.4);
}

.mini-btn.ghost {
  background: rgba(255, 255, 255, 0.025);
  border-color: var(--line);
  color: var(--text-2);
}

.mini-btn.ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line-strong);
  color: var(--text);
}

.mini-btn .icon {
  width: 13px;
  height: 13px;
}

.round-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-weight: 700;
  transition: 0.16s ease;
}

.round-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.055);
}

.mobile-settings-btn {
  display: none;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.09);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.small-btn-spinner {
  width: 15px;
  height: 15px;
  border-width: 1.6px;
  margin-right: 2px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-2);
}

.field-label em {
  font-style: normal;
  font-size: 10px;
  font-weight: 500;
  color: var(--faint);
}

.field-hint {
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--faint);
}

.field-hint a {
  color: #7fd4ff;
}

.input-shell {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(5, 10, 17, 0.55);
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.input-shell:focus-within {
  border-color: rgba(42, 171, 238, 0.55);
  background: rgba(5, 10, 17, 0.8);
  box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.1);
}

.input-shell.is-invalid {
  border-color: rgba(255, 107, 122, 0.65);
  box-shadow: 0 0 0 3px rgba(255, 107, 122, 0.08);
}

.input-shell .input-icon {
  position: absolute;
  left: 13px;
  width: 16px;
  height: 16px;
  color: var(--faint);
  pointer-events: none;
}

.input-shell input {
  width: 100%;
  height: 42px;
  padding: 0 13px 0 40px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
  color: var(--text);
}

.input-shell input::placeholder {
  color: #4e5c70;
}

.input-shell .input-action {
  position: absolute;
  right: 4px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.input-shell input[type="password"],
.input-shell input[type="text"] {
  padding-right: 42px;
}

.input-shell input[type="url"] {
  padding-right: 13px;
}

.field > input,
.field > .plain-input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  background: rgba(5, 10, 17, 0.55);
  color: var(--text);
  font-size: 13px;
}

.field > input:focus {
  border-color: rgba(42, 171, 238, 0.55);
  box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.1);
}

/* ---------------------------------------------------------
   Boot / setup
   --------------------------------------------------------- */

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background:
    radial-gradient(600px 400px at 50% 35%, rgba(42, 171, 238, 0.1), transparent 70%),
    var(--bg);
  transition: opacity 0.35s ease;
}

.boot-logo {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  background: linear-gradient(145deg, #53c8ff 0%, #279bdd 48%, #106fa8 100%);
  box-shadow:
    0 20px 50px -15px rgba(42, 171, 238, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  animation: boot-pop 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.boot-logo .logo-plane {
  width: 30px;
  height: 30px;
}

.boot-screen p {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.boot-screen .spinner {
  width: 17px;
  height: 17px;
  margin-top: 2px;
}

.boot-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  max-width: 440px;
  color: #ffb3bb;
  font-size: 12px;
  text-align: center;
}

.boot-error .text-btn {
  font-size: 12px;
}

@keyframes boot-pop {
  from {
    opacity: 0;
    transform: scale(0.7) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.setup {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(440px, 0.88fr);
  min-height: 100vh;
}

.setup-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 34px 46px 26px;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.055);
  background:
    radial-gradient(700px 600px at 20% 10%, rgba(42, 171, 238, 0.1), transparent 62%),
    radial-gradient(600px 500px at 95% 90%, rgba(92, 225, 198, 0.06), transparent 60%);
}

.setup-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.11) 0.7px, transparent 0.7px);
  background-size: 25px 25px;
  mask-image: radial-gradient(700px 500px at 40% 40%, black, transparent 75%);
  opacity: 0.26;
  pointer-events: none;
}

.setup-visual::after {
  content: "";
  position: absolute;
  width: 720px;
  height: 720px;
  right: -380px;
  top: 20%;
  border: 1px solid rgba(42, 171, 238, 0.09);
  border-radius: 50%;
  box-shadow: 0 0 0 90px rgba(42, 171, 238, 0.022), 0 0 0 180px rgba(42, 171, 238, 0.014);
  pointer-events: none;
}

.setup-hero {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  width: min(100%, 720px);
  padding: 42px 0 20px;
}

.setup-hero h1 {
  margin: 20px 0 18px;
  font-size: clamp(44px, 4.4vw, 66px);
  line-height: 1.07;
  letter-spacing: -0.055em;
  font-weight: 720;
  color: #f3f8ff;
}

.setup-hero .lead {
  max-width: 560px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.75;
}

.setup .brand-on-dark {
  position: relative;
  z-index: 2;
}

.setup-visual-foot {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 22px;
  padding-top: 10px;
  color: #5f7187;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.setup-visual-foot span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.setup-visual-foot .icon {
  width: 12px;
  height: 12px;
  color: #6f849b;
}

/* Hero stage */
.stage {
  position: relative;
  width: min(100%, 660px);
  height: 330px;
  margin-top: 36px;
}

.stage-orbit {
  position: absolute;
  border: 1px solid rgba(42, 171, 238, 0.1);
  border-radius: 50%;
  pointer-events: none;
}

.orbit-a {
  width: 470px;
  height: 470px;
  left: 20px;
  top: -70px;
}

.orbit-b {
  width: 320px;
  height: 320px;
  left: 95px;
  top: 5px;
  border-style: dashed;
  opacity: 0.7;
  animation: slow-spin 45s linear infinite;
}

@keyframes slow-spin {
  to {
    transform: rotate(360deg);
  }
}

.stage-card {
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: linear-gradient(155deg, rgba(20, 35, 55, 0.92), rgba(10, 18, 30, 0.94));
  box-shadow: 0 30px 60px -25px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(14px);
}

.stage-main {
  position: absolute;
  left: 6px;
  top: 8px;
  z-index: 2;
  width: 390px;
  padding: 13px;
  border-radius: 20px;
  transform: rotate(-1deg);
  animation: stage-in 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s both;
}

@keyframes stage-in {
  from {
    opacity: 0;
    transform: rotate(-1deg) translateY(22px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: rotate(-1deg) translateY(0) scale(1);
  }
}

.stage-card-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 2px 3px 10px;
}

.stage-avatar {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(145deg, #44c3ff, #167ab3);
  font-size: 11px;
  font-weight: 800;
  color: #fff;
}

.stage-card-name {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.stage-card-name b {
  font-size: 11px;
  color: #eaf4ff;
}

.stage-card-name span {
  font-size: 8.5px;
  color: #6e8299;
}

.stage-live {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.16em;
  color: #6ce2be;
  background: rgba(61, 220, 151, 0.08);
  border: 1px solid rgba(61, 220, 151, 0.16);
  border-radius: 5px;
  padding: 3px 6px;
}

.stage-message {
  padding: 10px;
  border: 1px solid rgba(84, 172, 221, 0.15);
  border-radius: 5px 14px 14px 14px;
  background: linear-gradient(150deg, #1c3850, #172e43);
}

.stage-message > p {
  color: #c9d8e7;
  font-size: 10.5px;
  line-height: 1.65;
}

.stage-image {
  position: relative;
  height: 100px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 9px;
  background:
    radial-gradient(150px 100px at 80% 20%, rgba(92, 225, 198, 0.24), transparent 65%),
    linear-gradient(135deg, #143f5b, #0e263b 55%, #1b3c4b);
}

.stage-image::before {
  content: "";
  position: absolute;
  width: 140px;
  height: 140px;
  border: 1px solid rgba(110, 212, 255, 0.2);
  border-radius: 50%;
  right: -35px;
  top: -55px;
  box-shadow: 0 0 0 22px rgba(110, 212, 255, 0.035);
}

.stage-image-glow {
  position: absolute;
  width: 80px;
  height: 80px;
  left: -12px;
  bottom: -35px;
  border-radius: 50%;
  background: rgba(42, 171, 238, 0.35);
  filter: blur(30px);
}

.stage-image-ui {
  position: absolute;
  left: 13px;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.stage-image-pill {
  width: fit-content;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.16em;
  color: #8ce7d2;
  border: 1px solid rgba(92, 225, 198, 0.23);
  border-radius: 4px;
  padding: 3px 5px;
}

.stage-image-line {
  display: block;
  height: 4px;
  border-radius: 3px;
  background: rgba(208, 236, 255, 0.26);
}

.stage-image-line.w70 {
  width: 120px;
}

.stage-image-line.w45 {
  width: 78px;
  background: rgba(208, 236, 255, 0.14);
}

.stage-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0 0 6px 6px;
  background: rgba(255, 255, 255, 0.04);
  color: #8fdcff;
  font-size: 9px;
  font-weight: 650;
}

.stage-button .icon {
  width: 10px;
  height: 10px;
}

.stage-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  margin-top: 5px;
  color: #62788f;
  font-size: 7px;
}

.stage-checks {
  width: 10px;
  height: 10px;
  color: #56b6df;
}

.stage-float {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 14px;
  animation: float-y 5s ease-in-out infinite;
}

.stage-float b {
  display: block;
  font-size: 10px;
  line-height: 1.3;
}

.stage-float > div:not(.float-stack) > span {
  display: block;
  font-size: 8px;
  color: #70849a;
}

.float-a {
  right: 2px;
  top: 54px;
  animation-delay: 0.8s;
}

.float-b {
  right: 28px;
  bottom: 20px;
  animation-delay: 1.7s;
}

@keyframes float-y {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

.float-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(42, 171, 238, 0.12);
  color: #7bd4ff;
}

.float-icon .icon {
  width: 14px;
  height: 14px;
}

.float-check {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  margin-left: 2px;
  border-radius: 50%;
  background: rgba(61, 220, 151, 0.12);
  color: var(--green);
}

.float-check .icon {
  width: 11px;
  height: 11px;
  stroke-width: 2.4;
}

.float-stack {
  display: flex;
}

.float-stack span {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  margin-left: -7px;
  border: 2px solid #0c1624;
  border-radius: 50%;
  background: linear-gradient(145deg, #3d95c1, #14597e);
  font-size: 7px;
  font-weight: 700;
  color: #e9f8ff;
}

.float-stack span:first-child {
  margin-left: 0;
}

.float-stack span:last-child {
  background: #152437;
  color: #7990a8;
}

/* Setup form side */
.setup-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 42px;
  background: rgba(6, 10, 17, 0.42);
}

.setup-card {
  position: relative;
  width: min(100%, 448px);
  padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(21, 33, 51, 0.82), rgba(10, 17, 28, 0.92));
  box-shadow:
    0 40px 100px -30px rgba(0, 0, 0, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.055);
  backdrop-filter: blur(18px);
}

.setup-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: 25px;
  background: linear-gradient(150deg, rgba(42, 171, 238, 0.25), transparent 30%, transparent 75%, rgba(92, 225, 198, 0.09));
  opacity: 0.45;
}

.setup-card-head {
  margin-bottom: 24px;
}

.step-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 15px;
  padding: 5px 9px;
  border: 1px solid rgba(42, 171, 238, 0.18);
  border-radius: 999px;
  background: rgba(42, 171, 238, 0.06);
  color: #7fd0f7;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.03em;
}

.step-pill span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 8px rgba(42, 171, 238, 0.8);
}

.setup-card-head h2 {
  font-size: 29px;
  line-height: 1.2;
  letter-spacing: -0.035em;
  font-weight: 720;
}

.setup-card-head p {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.65;
}

.setup-card .field {
  margin-top: 17px;
}

.advanced {
  margin-top: 17px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.018);
  overflow: hidden;
}

.advanced summary {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 13px;
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced summary small {
  color: var(--faint);
  font-size: 10px;
  font-weight: 500;
}

.advanced summary .icon {
  width: 14px;
  height: 14px;
  margin-left: auto;
  color: var(--faint);
  transition: transform 0.2s ease;
}

.advanced[open] summary .icon {
  transform: rotate(180deg);
}

.advanced-body {
  padding: 2px 13px 14px;
  border-top: 1px solid var(--line);
}

.advanced-body .field {
  margin-top: 12px;
}

.setup-card .btn.wide {
  margin-top: 22px;
}

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 14px;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.55;
}

.privacy-note .icon {
  width: 12px;
  height: 12px;
  margin-top: 1px;
  color: #5c7189;
}

.setup-foot-note {
  margin-top: 18px;
  color: #4e5d71;
  font-size: 10px;
}

.setup-mobile-brand {
  display: none;
  margin-bottom: 22px;
}

.callout {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 107, 122, 0.18);
  border-radius: 11px;
  background: rgba(255, 107, 122, 0.075);
  color: #ffb4bd;
  font-size: 11.5px;
  line-height: 1.55;
}

.callout.danger {
  border-color: rgba(255, 107, 122, 0.22);
  background: rgba(255, 107, 122, 0.08);
  color: #ffb1ba;
}

.callout.compact {
  padding: 9px 11px;
  font-size: 11px;
}

.setup-card .callout {
  margin-bottom: 4px;
}

/* ---------------------------------------------------------
   Main application shell
   --------------------------------------------------------- */

.app-shell {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 304px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  animation: app-in 0.4s ease both;
}

@keyframes app-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px 15px 12px;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(380px 260px at 20% 0%, rgba(42, 171, 238, 0.055), transparent 70%),
    rgba(7, 12, 20, 0.78);
  backdrop-filter: blur(20px);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 3px 0 2px;
}

.bot-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(42, 171, 238, 0.06), transparent 55%),
    rgba(255, 255, 255, 0.018);
}

.bot-avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(145deg, #3ebcf7, #1674ab);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 16px;
  font-weight: 750;
  text-transform: uppercase;
}

.bot-avatar.small {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 13px;
}

.bot-meta {
  min-width: 0;
  flex: 1;
}

.bot-name {
  overflow: hidden;
  color: #e9f2fc;
  font-size: 12.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bot-handle {
  overflow: hidden;
  margin-top: 2px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid rgba(61, 220, 151, 0.18);
  border-radius: 999px;
  background: rgba(61, 220, 151, 0.07);
  color: #78e7b6;
  font-size: 9px;
  font-weight: 650;
  white-space: nowrap;
}

.status-pill.is-connecting {
  border-color: rgba(255, 180, 84, 0.2);
  background: rgba(255, 180, 84, 0.07);
  color: #ffc77a;
}

.status-pill.is-error {
  border-color: rgba(255, 107, 122, 0.22);
  background: rgba(255, 107, 122, 0.08);
  color: #ff9aa5;
}

.status-pill i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.is-connecting i,
.is-error i {
  animation: pulse-dot 1.6s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.conn-banner {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 107, 122, 0.18);
  border-radius: 11px;
  background: rgba(255, 107, 122, 0.055);
}

.conn-banner-head {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ff9aa5;
  font-size: 10.5px;
}

.conn-banner-head .icon {
  width: 13px;
  height: 13px;
}

.conn-banner p {
  margin-top: 4px;
  color: #c58f96;
  font-size: 10px;
  line-height: 1.5;
  word-break: break-word;
}

.conn-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.conn-actions .mini-btn {
  height: 25px;
  padding: 0 8px;
  font-size: 10px;
}

.chat-section-head {
  margin-top: 19px;
}

.label-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.section-label {
  color: #9aabc0;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.count-pill,
.counter-soft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: #8297ae;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0;
}

.counter-soft {
  border: 0;
  background: transparent;
  color: var(--faint);
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(5, 9, 16, 0.48);
  transition: border-color 0.16s ease, background 0.16s ease;
}

.search-box:focus-within {
  border-color: rgba(42, 171, 238, 0.4);
  background: rgba(5, 9, 16, 0.75);
}

.search-box .icon {
  width: 14px;
  height: 14px;
  color: var(--faint);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 11px;
}

.search-box input::placeholder {
  color: #536176;
}

.search-box input::-webkit-search-cancel-button {
  display: none;
}

.search-box kbd {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.025);
  color: #58687d;
  font-family: var(--mono);
  font-size: 9px;
}

.toolbar-row .icon-btn {
  width: 36px;
  height: 36px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.toolbar-row .icon-btn .icon {
  width: 15px;
  height: 15px;
}

.toolbar-row .icon-btn.spinning .icon {
  animation: spin 0.8s linear infinite;
}

.select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 0 3px 7px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 550;
}

.check input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.checkbox-ui {
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.19);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.025);
  transition: 0.15s ease;
}

.checkbox-ui::after {
  content: "";
  width: 6px;
  height: 3px;
  margin-top: -2px;
  border-left: 1.6px solid #fff;
  border-bottom: 1.6px solid #fff;
  transform: rotate(-45deg) scale(0.4);
  opacity: 0;
  transition: 0.15s ease;
}

.check input:checked + .checkbox-ui {
  border-color: var(--blue);
  background: var(--blue);
}

.check input:checked + .checkbox-ui::after {
  opacity: 1;
  transform: rotate(-45deg) scale(1);
}

.check input:focus-visible + .checkbox-ui {
  box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.2);
}

.selection-hint {
  color: #5f7187;
  font-size: 9.5px;
}

.chat-list {
  flex: 1;
  min-height: 0;
  margin: 2px -4px 0;
  padding: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat-item {
  position: relative;
  display: flex;
  align-items: stretch;
  margin-bottom: 3px;
  border: 1px solid transparent;
  border-radius: 11px;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.chat-item:hover {
  background: rgba(255, 255, 255, 0.028);
}

.chat-item.is-selected {
  border-color: rgba(42, 171, 238, 0.2);
  background:
    linear-gradient(90deg, rgba(42, 171, 238, 0.1), rgba(42, 171, 238, 0.035));
}

.chat-main {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
  padding: 8px 8px;
  cursor: pointer;
}

.chat-main input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.chat-main .checkbox-ui {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
}

.chat-main input:checked + .checkbox-ui {
  border-color: var(--blue);
  background: var(--blue);
}

.chat-main input:checked + .checkbox-ui::after {
  opacity: 1;
  transform: rotate(-45deg) scale(1);
}

.chat-main input:focus-visible + .checkbox-ui {
  box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.2);
}

.chat-item.is-selected .chat-title {
  color: #e8f6ff;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  color: #bfeaff;
  background:
    radial-gradient(28px 22px at 30% 20%, rgba(255, 255, 255, 0.14), transparent),
    linear-gradient(145deg, #1b4c68, #102d42);
}

.chat-avatar.is-group {
  color: #cbb8ff;
  background:
    radial-gradient(28px 22px at 30% 20%, rgba(255, 255, 255, 0.12), transparent),
    linear-gradient(145deg, #3c3367, #231f43);
}

.chat-avatar .icon {
  width: 16px;
  height: 16px;
}

.chat-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.chat-title-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.chat-title {
  overflow: hidden;
  color: #dbe7f4;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  color: #61738a;
  font-size: 10px;
  white-space: nowrap;
}

.chat-meta .dot {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #46566b;
}

.chat-warning {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  color: var(--orange);
}

.chat-warning .icon {
  width: 11px;
  height: 11px;
}

.chat-remove {
  width: 28px;
  align-self: center;
  margin-right: 3px;
  opacity: 0;
  color: #62748a;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.chat-item:hover .chat-remove,
.chat-remove:focus-visible {
  opacity: 1;
}

.chat-remove:hover {
  color: var(--red);
  background: rgba(255, 107, 122, 0.08);
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 190px;
  padding: 24px 18px;
  text-align: center;
}

.empty-orbit {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border: 1px dashed rgba(42, 171, 238, 0.26);
  border-radius: 50%;
  background: rgba(42, 171, 238, 0.045);
  color: #65a9ca;
}

.empty-orbit .icon {
  width: 20px;
  height: 20px;
}

.chat-empty b {
  color: var(--text-2);
  font-size: 12px;
}

.chat-empty p {
  max-width: 235px;
  margin-top: 5px;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.6;
}

.empty-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

.sync-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 3px 1px;
  border-top: 1px solid rgba(255, 255, 255, 0.045);
  color: #526176;
  font-size: 9px;
}

.sync-foot .text-btn {
  margin-left: auto;
  font-size: 9px;
  color: #68849a;
}

.sync-dot {
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #4d6077;
}

.sync-dot.ok {
  background: var(--green);
  box-shadow: 0 0 7px rgba(61, 220, 151, 0.5);
}

.sync-dot.error {
  background: var(--red);
  box-shadow: 0 0 7px rgba(255, 107, 122, 0.45);
}

.sync-dot.syncing {
  background: var(--blue);
  animation: pulse-dot 1.2s infinite;
}

/* ---------------------------------------------------------
   Saved content rail
   --------------------------------------------------------- */

.draft-rail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px 12px 12px;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(300px 240px at 50% 0%, rgba(125, 107, 232, 0.055), transparent 70%),
    rgba(8, 13, 22, 0.67);
  backdrop-filter: blur(18px);
}

.draft-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1px 3px 0;
}

.draft-rail-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.draft-rail-head .icon-btn {
  width: 29px;
  height: 29px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.022);
}

.draft-toggle-btn {
  display: none;
}

.draft-rail-head .icon-btn .icon {
  width: 14px;
  height: 14px;
}

.draft-save-card {
  margin-top: 13px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(42, 171, 238, 0.055), transparent 70%),
    rgba(255, 255, 255, 0.018);
}

.draft-title-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.draft-title-field > span {
  color: #6f8298;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.draft-title-field em {
  font-style: normal;
  color: #4e5f74;
  letter-spacing: 0;
}

.draft-title-field input {
  width: 100%;
  height: 31px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 7px;
  outline: 0;
  background: rgba(4, 9, 15, 0.55);
  color: #d5e3f1;
  font-size: 10px;
}

.draft-title-field input:focus {
  border-color: rgba(42, 171, 238, 0.45);
  box-shadow: 0 0 0 2px rgba(42, 171, 238, 0.07);
}

.draft-title-field input::placeholder {
  color: #45556a;
}

.draft-save-btn {
  position: relative;
  width: 100%;
  height: 32px;
  margin-top: 7px;
  border-radius: 8px;
  font-size: 10px;
}

.draft-save-btn .icon {
  width: 13px;
  height: 13px;
}

.draft-save-btn .small-btn-spinner:not(.hidden) ~ .draft-save-icon {
  display: none;
}

.dirty-dot {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffe08d;
  box-shadow: 0 0 7px rgba(255, 224, 141, 0.7);
}

.draft-list {
  flex: 1;
  min-height: 0;
  margin: 11px -4px 0;
  padding: 3px 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.draft-item {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  margin-bottom: 4px;
  padding: 8px 9px;
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.018);
  color: #91a4b9;
  text-align: left;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}

.draft-item:hover {
  color: #d3e2f1;
  background: rgba(255, 255, 255, 0.032);
}

.draft-item.is-active {
  border-color: rgba(42, 171, 238, 0.22);
  background:
    linear-gradient(90deg, rgba(42, 171, 238, 0.13), rgba(42, 171, 238, 0.035));
  color: #e5f4ff;
}

.draft-item.is-active::before {
  content: "";
  width: 3px;
  height: 15px;
  flex: 0 0 auto;
  border-radius: 3px;
  background: var(--blue);
  box-shadow: 0 0 8px rgba(42, 171, 238, 0.55);
}

.draft-item-title {
  overflow: hidden;
  font-size: 10.5px;
  font-weight: 550;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draft-item.is-active .draft-item-title {
  font-weight: 650;
}

.draft-item.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

.draft-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 150px;
  padding: 18px 10px;
  text-align: center;
}

.draft-empty-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  margin-bottom: 9px;
  border: 1px dashed rgba(125, 107, 232, 0.25);
  border-radius: 11px;
  background: rgba(125, 107, 232, 0.05);
  color: #9185d6;
}

.draft-empty-icon .icon {
  width: 16px;
  height: 16px;
}

.draft-empty b {
  color: #95a8bd;
  font-size: 10px;
  font-weight: 600;
}

.draft-empty p {
  margin-top: 4px;
  color: #53657b;
  font-size: 8.5px;
  line-height: 1.55;
}

.draft-rail-foot {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px 3px 1px;
  border-top: 1px solid rgba(255, 255, 255, 0.045);
}

.draft-rail-foot .text-btn {
  align-self: flex-start;
  font-size: 9px;
}

.danger-text {
  color: #d98690;
}

.danger-text:hover {
  color: #ff9aa5;
}

.draft-foot-hint {
  color: #4b5b6e;
  font-size: 8px;
}

/* ---------------------------------------------------------
   Main workspace
   --------------------------------------------------------- */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 84px;
  padding: 17px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 10, 17, 0.55);
  backdrop-filter: blur(18px);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #596a80;
  font-size: 9.5px;
  font-weight: 550;
}

.breadcrumb .icon {
  width: 11px;
  height: 11px;
  transform: rotate(-90deg);
}

.breadcrumb b {
  color: #8498ad;
  font-weight: 600;
}

.topbar-title h1 {
  margin-top: 3px;
  font-size: 25px;
  font-weight: 720;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.title-dot {
  color: var(--blue);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.target-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.018);
}

.avatar-stack {
  display: flex;
  min-width: 4px;
}

.avatar-stack .stack-avatar {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  margin-left: -7px;
  border: 2px solid #0b111b;
  border-radius: 50%;
  color: #f2fbff;
  font-size: 8px;
  font-weight: 750;
  text-transform: uppercase;
}

.avatar-stack .stack-avatar:first-child {
  margin-left: 0;
}

.avatar-stack .stack-avatar.more {
  background: #172437;
  color: #91a7be;
}

.stack-c0 {
  background: linear-gradient(145deg, #2aabee, #166b98);
}

.stack-c1 {
  background: linear-gradient(145deg, #7d6be8, #4538a4);
}

.stack-c2 {
  background: linear-gradient(145deg, #36c99e, #1a7a60);
}

.stack-c3 {
  background: linear-gradient(145deg, #e39a4d, #97571c);
}

.stack-c4 {
  background: linear-gradient(145deg, #e266a4, #96365f);
}

.target-summary-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.target-summary-copy span {
  color: #c9d9ea;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.target-summary-copy small {
  color: #5b6d83;
  font-size: 8.5px;
  white-space: nowrap;
}

.workspace-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 28px 30px;
  background:
    radial-gradient(900px 500px at 80% 0%, rgba(42, 171, 238, 0.035), transparent 70%),
    transparent;
}

.compose-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 334px;
  gap: 20px;
  width: 100%;
  max-width: 1260px;
  margin: 0 auto;
}

.left-stack,
.preview-stack {
  display: flex;
  flex-direction: column;
  gap: 17px;
  min-width: 0;
}

.preview-stack {
  position: sticky;
  top: 0;
  align-self: start;
}

.panel {
  position: relative;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(18, 28, 44, 0.8), rgba(10, 17, 28, 0.86));
  box-shadow:
    0 24px 55px -34px rgba(0, 0, 0, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.panel-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.panel-title h2 {
  color: #e6effa;
  font-size: 15px;
  font-weight: 680;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.panel-title p {
  margin-top: 2px;
  color: #62748b;
  font-size: 10.5px;
  line-height: 1.45;
}

.step-number {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  margin-top: -1px;
  border: 1px solid rgba(42, 171, 238, 0.17);
  border-radius: 8px;
  background: rgba(42, 171, 238, 0.055);
  color: #6eb4d7;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
}

.char-counter {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #6a7d93;
  font-family: var(--mono);
  font-size: 9px;
  white-space: nowrap;
}

.char-counter.is-warning {
  border-color: rgba(255, 180, 84, 0.25);
  background: rgba(255, 180, 84, 0.06);
  color: #ffc372;
}

.char-counter.is-over {
  border-color: rgba(255, 107, 122, 0.28);
  background: rgba(255, 107, 122, 0.07);
  color: #ff9aa5;
}

.composer-panel .callout {
  margin-top: 12px;
}

.editor-wrap {
  margin-top: 15px;
}

#messageText {
  display: block;
  width: 100%;
  min-height: 174px;
  max-height: 460px;
  padding: 15px 16px;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 13px;
  outline: 0;
  background:
    linear-gradient(180deg, rgba(4, 9, 15, 0.68), rgba(5, 10, 17, 0.48));
  color: #dce9f7;
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.7;
  resize: vertical;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

#messageText::placeholder {
  color: #4d5d72;
}

#messageText:focus {
  border-color: rgba(42, 171, 238, 0.48);
  background: rgba(4, 9, 15, 0.82);
  box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.075);
}

#messageText.is-invalid {
  border-color: rgba(255, 107, 122, 0.6);
  box-shadow: 0 0 0 3px rgba(255, 107, 122, 0.08);
}

.editor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
  padding: 0 2px;
}

.editor-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #55677d;
  font-size: 9px;
}

.editor-hint .icon {
  width: 11px;
  height: 11px;
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 7px;
  border: 1px solid rgba(42, 171, 238, 0.15);
  border-radius: 5px;
  background: rgba(42, 171, 238, 0.05);
  color: #70b7da;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
}

.mode-pill.subtle {
  border-color: var(--line);
  background: transparent;
  color: #63758a;
}

.photo-zone {
  margin-top: 14px;
}

.dropzone {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.014);
  color: var(--text-2);
  text-align: left;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    transform 0.16s ease;
}

.dropzone:hover,
.dropzone.is-dragging {
  border-color: rgba(42, 171, 238, 0.45);
  background: rgba(42, 171, 238, 0.045);
}

.dropzone.is-dragging {
  transform: scale(1.005);
}

.drop-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(42, 171, 238, 0.14);
  border-radius: 10px;
  background: rgba(42, 171, 238, 0.055);
  color: #74bfe2;
}

.drop-icon .icon {
  width: 17px;
  height: 17px;
}

.drop-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.drop-copy b {
  color: #b8c9da;
  font-size: 11px;
  font-weight: 650;
}

.drop-copy small {
  overflow: hidden;
  color: #52647a;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drop-action {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
  color: #8b9eb3;
  font-size: 9.5px;
}

.photo-preview {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px;
  border: 1px solid rgba(42, 171, 238, 0.16);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(42, 171, 238, 0.055), transparent 60%),
    rgba(255, 255, 255, 0.015);
}

.photo-thumb {
  position: relative;
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  background: #08101a;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(4, 9, 15, 0.76);
  backdrop-filter: blur(3px);
  color: #bfeaff;
  font-family: var(--mono);
  font-size: 9px;
}

.upload-bar {
  width: 36px;
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.14);
}

.upload-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.2s ease;
}

.photo-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.photo-info b {
  max-width: 100%;
  overflow: hidden;
  color: #c9d9e9;
  font-size: 10.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-info > span {
  color: #5e7086;
  font-size: 9px;
}

.photo-info .photo-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  color: #64cda6;
  font-size: 8.5px;
}

.photo-status i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--green);
}

.photo-preview .icon-btn {
  width: 31px;
  height: 31px;
}

/* Inline buttons editor */
.buttons-panel {
  padding-bottom: 19px;
}

.buttons-panel .panel-head {
  align-items: center;
}

.layout-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 13px;
  padding: 8px 10px;
  border: 1px solid rgba(42, 171, 238, 0.13);
  border-radius: 10px;
  background:
    linear-gradient(90deg, rgba(42, 171, 238, 0.045), transparent 70%),
    rgba(255, 255, 255, 0.014);
}

.layout-title {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #7fa3bb;
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
}

.layout-title .icon {
  width: 12px;
  height: 12px;
  color: #5d9dbd;
}

.layout-hint {
  color: #607589;
  font-size: 8.5px;
}

.layout-bar .mini-btn {
  height: 25px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 9px;
}

.layout-bar .mini-btn .icon {
  width: 11px;
  height: 11px;
}

.step-btn {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.045);
  color: #9bb4c8;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1;
}

.step-btn:hover:not(:disabled) {
  background: rgba(42, 171, 238, 0.17);
  color: #d6f2ff;
}

.step-btn:disabled {
  cursor: not-allowed;
  opacity: 0.3;
}

.layout-capacity {
  color: #61788d;
  font-size: 8.5px;
  white-space: nowrap;
}

.layout-bar .text-btn {
  margin-left: auto;
  color: #70879c;
  font-size: 8.5px;
}

.layout-bar .text-btn:hover {
  color: #ff9aa5;
}

.button-layout {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 11px;
}

.button-layout-row {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 65%),
    rgba(5, 10, 17, 0.25);
}

.button-row-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
}

.button-row-title {
  color: #8298ad;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.row-col-control {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  background: rgba(4, 9, 15, 0.4);
}

.row-col-control > span {
  padding: 0 2px 0 4px;
  color: #5f7489;
  font-size: 7.5px;
}

.row-col-control b {
  min-width: 14px;
  color: #b8d7e9;
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 600;
  text-align: center;
}

.row-col-control .step-btn {
  width: 18px;
  height: 18px;
  font-size: 11px;
}

.row-remove {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #5c7187;
}

.row-remove:hover {
  color: var(--red);
  background: rgba(255, 107, 122, 0.08);
}

.row-remove .icon {
  width: 11px;
  height: 11px;
}

.button-row-slots {
  display: grid;
  grid-template-columns: repeat(var(--row-cols, 1), minmax(108px, 1fr));
  gap: 8px;
  padding-bottom: 1px;
  overflow-x: auto;
}

.button-slot {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.02), transparent 65%),
    rgba(5, 10, 17, 0.38);
  animation: row-in 0.18s ease both;
}

.button-slot.is-empty {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.008);
}

.button-slot.is-invalid {
  border-color: rgba(255, 107, 122, 0.45);
}

@keyframes row-in {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.button-slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 16px;
}

.slot-index {
  color: #61758b;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.07em;
}

.slot-clear {
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #52677c;
}

.slot-clear:hover {
  color: var(--red);
  background: rgba(255, 107, 122, 0.08);
}

.slot-clear .icon {
  width: 10px;
  height: 10px;
}

.button-slot input {
  width: 100%;
  height: 31px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 6px;
  outline: 0;
  background: rgba(4, 9, 15, 0.55);
  color: #d4e2f1;
  font-size: 9.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.button-slot input::placeholder {
  color: #44546a;
}

.button-slot input:focus {
  border-color: rgba(42, 171, 238, 0.45);
  box-shadow: 0 0 0 2px rgba(42, 171, 238, 0.07);
}

.button-slot input.is-invalid {
  border-color: rgba(255, 107, 122, 0.55);
}

.mini-error {
  display: block;
  color: #e68a94;
  font-size: 8px;
  font-style: normal;
  line-height: 1.4;
}

.buttons-empty {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 13px;
  padding: 13px;
  border: 1px dashed rgba(255, 255, 255, 0.09);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.012);
}

.buttons-empty-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #647b92;
}

.buttons-empty-icon .icon {
  width: 15px;
  height: 15px;
}

.buttons-empty > div:nth-child(2) {
  flex: 1;
  min-width: 0;
}

.buttons-empty b {
  display: block;
  color: #9fb0c4;
  font-size: 10.5px;
}

.buttons-empty p {
  margin-top: 2px;
  color: #56687e;
  font-size: 9px;
  line-height: 1.45;
}

/* Options */
.options-panel {
  padding-bottom: 18px;
}

.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 14px;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.014);
  cursor: pointer;
  user-select: none;
}

.switch-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.switch-copy b {
  color: #b9cadb;
  font-size: 10.5px;
  font-weight: 600;
}

.switch-copy small {
  color: #55677d;
  font-size: 8.5px;
  line-height: 1.4;
}

.switch-row input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch-ui {
  position: relative;
  width: 36px;
  height: 21px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  transition: 0.18s ease;
}

.switch-ui::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: #93a5b8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: 0.18s ease;
}

.switch-row input:checked + .switch-ui {
  border-color: rgba(42, 171, 238, 0.45);
  background: rgba(42, 171, 238, 0.85);
}

.switch-row input:checked + .switch-ui::after {
  left: 17px;
  background: #fff;
}

.switch-row input:focus-visible + .switch-ui {
  box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.16);
}

/* Preview */
.preview-panel {
  padding: 18px;
}

.live-dot {
  width: 6px;
  height: 6px;
  margin-top: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(61, 220, 151, 0.08);
  animation: pulse-dot 2.2s infinite;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 6px;
  border: 1px solid rgba(61, 220, 151, 0.18);
  border-radius: 5px;
  color: #72e1b2;
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.13em;
}

.phone-frame {
  margin-top: 15px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 18px;
  background: #0a1622;
  box-shadow:
    0 20px 40px -25px rgba(0, 0, 0, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.phone-top {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 54px;
  padding: 0 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.065);
  background: rgba(8, 18, 29, 0.94);
}

.phone-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(145deg, #3ebcf7, #1674ab);
  color: #fff;
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.phone-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.25;
}

.phone-title b {
  overflow: hidden;
  color: #d7e7f7;
  font-size: 10.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phone-title span {
  color: #5b7690;
  font-family: var(--mono);
  font-size: 8px;
}

.phone-more {
  color: #5d748b;
}

.phone-more .icon {
  width: 16px;
  height: 16px;
}

.phone-chat {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 338px;
  max-height: 430px;
  overflow-y: auto;
  padding: 13px 12px 17px;
  background-color: #0a1a29;
  background-image:
    radial-gradient(rgba(148, 199, 235, 0.055) 0.8px, transparent 0.8px),
    radial-gradient(350px 250px at 100% 100%, rgba(42, 171, 238, 0.08), transparent 65%);
  background-size: 16px 16px, 100% 100%;
}

.phone-date {
  width: fit-content;
  margin: 2px auto 15px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(7, 17, 27, 0.62);
  color: #7790a6;
  font-size: 7.5px;
  backdrop-filter: blur(4px);
}

.preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 255px;
  padding: 25px;
  text-align: center;
}

.preview-empty-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  border: 1px dashed rgba(42, 171, 238, 0.25);
  border-radius: 12px;
  background: rgba(42, 171, 238, 0.04);
  color: #5c9fc1;
}

.preview-empty-icon .icon {
  width: 19px;
  height: 19px;
}

.preview-empty b {
  color: #8da4ba;
  font-size: 10.5px;
  font-weight: 600;
}

.preview-empty p {
  max-width: 200px;
  margin-top: 4px;
  color: #526a80;
  font-size: 8.5px;
  line-height: 1.55;
}

.preview-bubble {
  align-self: flex-start;
  width: fit-content;
  max-width: 92%;
  padding: 7px 9px 5px;
  border: 1px solid rgba(112, 180, 218, 0.12);
  border-radius: 5px 13px 13px 13px;
  background:
    linear-gradient(155deg, rgba(35, 61, 83, 0.98), rgba(26, 48, 68, 0.98));
  box-shadow: 0 5px 14px -6px rgba(0, 0, 0, 0.35);
  animation: bubble-in 0.22s ease both;
}

@keyframes bubble-in {
  from {
    opacity: 0;
    transform: translateY(5px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.preview-image {
  overflow: hidden;
  margin: -7px -9px 6px;
  border-radius: 5px 12px 0 0;
}

.preview-image img {
  display: block;
  width: 100%;
  max-height: 205px;
  object-fit: cover;
}

.preview-text {
  color: #d6e4f0;
  font-size: 11.5px;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.preview-text:empty {
  display: none;
}

.preview-buttons {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 7px -9px -5px;
  overflow: hidden;
  border-radius: 0 0 9px 9px;
}

.preview-button-row {
  display: flex;
  gap: 1px;
  border-top: 1px solid rgba(120, 183, 218, 0.13);
}

.preview-button-row:first-child {
  border-top: 0;
}

.preview-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
  min-height: 31px;
  padding: 6px 8px;
  background: rgba(72, 151, 193, 0.13);
  color: #91d8fa;
  font-size: 10.5px;
  font-weight: 600;
  text-align: center;
  word-break: break-word;
}

.preview-button + .preview-button {
  border-left: 1px solid rgba(120, 183, 218, 0.13);
}

.preview-button .icon {
  width: 10px;
  height: 10px;
  opacity: 0.65;
}

.bubble-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  margin-top: 3px;
  color: #7290a7;
  font-size: 6.5px;
  line-height: 1;
}

.bubble-checks {
  width: 10px;
  height: 10px;
  color: #59b5df;
}

.phone-input {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(8, 18, 29, 0.94);
}

.phone-input-text {
  flex: 1;
  color: #526b80;
  font-size: 9px;
}

.phone-mic {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(42, 171, 238, 0.12);
  color: #68b8dc;
}

.phone-mic .icon {
  width: 12px;
  height: 12px;
}

.preview-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 11px;
  padding: 0 1px;
  color: #70849a;
  font-size: 9.5px;
}

.preview-caption b {
  color: #b8d9ed;
  font-weight: 650;
}

.targets-panel {
  padding: 15px 17px;
}

.targets-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.target-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 95px;
  overflow-y: auto;
}

.target-empty {
  color: #53657a;
  font-size: 9.5px;
}

.target-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 4px 7px;
  border: 1px solid rgba(42, 171, 238, 0.15);
  border-radius: 7px;
  background: rgba(42, 171, 238, 0.055);
  color: #9ecfe7;
  font-size: 9.5px;
}

.target-chip span {
  overflow: hidden;
  max-width: 220px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-chip button {
  display: grid;
  place-items: center;
  width: 13px;
  height: 13px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #7096ac;
}

.target-chip button:hover {
  color: var(--red);
  background: rgba(255, 107, 122, 0.08);
}

.target-chip button .icon {
  width: 9px;
  height: 9px;
}

.tip-card {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid rgba(255, 180, 84, 0.12);
  border-radius: 12px;
  background: rgba(255, 180, 84, 0.035);
}

.tip-icon {
  color: #d49a50;
}

.tip-icon .icon {
  width: 13px;
  height: 13px;
}

.tip-card p {
  color: #877158;
  font-size: 8.8px;
  line-height: 1.55;
}

.tip-card b {
  color: #b99568;
  font-weight: 650;
}

/* Action bar */
.actionbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  padding: 13px 28px;
  border-top: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(10, 17, 28, 0.9), rgba(7, 12, 20, 0.96));
  backdrop-filter: blur(22px);
  box-shadow: 0 -18px 40px -30px rgba(0, 0, 0, 0.9);
}

.actionbar-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.send-targets {
  overflow: hidden;
  color: #c3d4e6;
  font-size: 11.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actionbar-info small {
  color: #596b80;
  font-size: 9px;
}

.actionbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.actionbar-actions .btn.ghost {
  height: 44px;
}

.send-btn {
  min-width: 162px;
  height: 47px;
  font-size: 13px;
  border-radius: 12px;
}

.send-btn .send-icon {
  transition: transform 0.2s ease;
}

.send-btn:not(:disabled):hover .send-icon {
  transform: translate(2px, -2px) rotate(2deg);
}

/* ---------------------------------------------------------
   Dialogs
   --------------------------------------------------------- */

dialog.modal {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 36px);
  padding: 25px;
  overflow: auto;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(20, 32, 50, 0.98), rgba(9, 16, 27, 0.99));
  box-shadow: var(--shadow-lg);
}

dialog.modal::backdrop {
  background: rgba(2, 6, 11, 0.72);
  backdrop-filter: blur(5px);
}

dialog.modal[open] {
  animation: modal-in 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.modal-head h2 {
  margin-top: 7px;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.modal-close {
  margin-top: -4px;
  margin-right: -4px;
}

.modal-desc {
  margin: 9px 0 17px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.modal form .field {
  margin-top: 13px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.modal-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 14px;
  color: #65778d;
  font-size: 9.5px;
  line-height: 1.55;
}

.modal-note .icon {
  width: 12px;
  height: 12px;
  margin-top: 1px;
}

.hint-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 13px;
  padding: 10px 11px;
  border: 1px solid rgba(42, 171, 238, 0.14);
  border-radius: 9px;
  background: rgba(42, 171, 238, 0.045);
}

.hint-box .icon {
  width: 13px;
  height: 13px;
  margin-top: 1px;
  color: #6ab9de;
}

.hint-box p {
  color: #7693a9;
  font-size: 9.5px;
  line-height: 1.6;
}

.current-bot-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.018);
}

.current-bot-row > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.current-bot-row b {
  color: #c7d8e9;
  font-size: 11px;
  font-weight: 600;
}

.current-bot-row span:not(.bot-avatar):not(.token-hint) {
  color: #5d7187;
  font-family: var(--mono);
  font-size: 8.5px;
}

.token-hint {
  max-width: 150px;
  overflow: hidden;
  color: #5b7087;
  font-family: var(--mono);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Result dialog */
.result-modal {
  width: min(620px, calc(100vw - 32px));
}

.result-hero {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.result-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(61, 220, 151, 0.22);
  border-radius: 14px;
  background: rgba(61, 220, 151, 0.09);
  color: var(--green);
}

.result-icon .icon {
  width: 21px;
  height: 21px;
  stroke-width: 2.2;
}

.result-icon.partial {
  border-color: rgba(255, 180, 84, 0.24);
  background: rgba(255, 180, 84, 0.08);
  color: var(--orange);
}

.result-icon.failed {
  border-color: rgba(255, 107, 122, 0.22);
  background: rgba(255, 107, 122, 0.08);
  color: var(--red);
}

.result-hero > div:nth-child(2) {
  flex: 1;
  min-width: 0;
}

.result-hero h2 {
  margin-top: 5px;
  font-size: 23px;
  letter-spacing: -0.03em;
}

.result-hero p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10.5px;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 19px 0 13px;
}

.result-stats > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.018);
}

.stat-value {
  color: #dbe9f7;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 650;
  line-height: 1.2;
}

.stat-value.success {
  color: #6fe4b5;
}

.stat-value.danger {
  color: #ff9ba5;
}

.stat-label {
  color: #5d7187;
  font-size: 8.5px;
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 290px;
  overflow-y: auto;
  padding-right: 2px;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.015);
}

.result-item .chat-avatar {
  width: 29px;
  height: 29px;
  border-radius: 8px;
}

.result-item .chat-avatar .icon {
  width: 13px;
  height: 13px;
}

.result-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.result-copy b {
  overflow: hidden;
  color: #bfd0e1;
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-copy span {
  overflow: hidden;
  color: #5c6e84;
  font-size: 8.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-copy span.is-error {
  color: #d18b93;
  white-space: normal;
}

.result-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  color: #63d5a7;
  font-size: 8.5px;
  font-weight: 600;
}

.result-status.is-failed {
  color: #ff98a2;
}

.result-status .icon {
  width: 11px;
  height: 11px;
}

/* Guide */
.guide-modal {
  width: min(600px, calc(100vw - 32px));
}

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 18px;
}

.guide-step {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.015);
}

.guide-step > span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(42, 171, 238, 0.16);
  border-radius: 7px;
  background: rgba(42, 171, 238, 0.05);
  color: #6eb4d7;
  font-family: var(--mono);
  font-size: 8px;
}

.guide-step b {
  color: #c1d3e4;
  font-size: 10.5px;
  font-weight: 600;
}

.guide-step p {
  margin-top: 3px;
  color: #6e8198;
  font-size: 9.5px;
  line-height: 1.6;
}

/* Toasts */
.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 98px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(15, 25, 40, 0.96);
  box-shadow: 0 16px 38px -16px rgba(0, 0, 0, 0.8);
  color: #c4d5e6;
  font-size: 11px;
  line-height: 1.5;
  pointer-events: auto;
  animation: toast-in 0.22s ease both;
  backdrop-filter: blur(12px);
}

.toast.is-leaving {
  animation: toast-out 0.2s ease both;
}

.toast .icon {
  width: 14px;
  height: 14px;
  margin-top: 1px;
  flex: 0 0 auto;
}

.toast.success {
  border-color: rgba(61, 220, 151, 0.2);
}

.toast.success .icon {
  color: var(--green);
}

.toast.error {
  border-color: rgba(255, 107, 122, 0.24);
}

.toast.error .icon {
  color: var(--red);
}

.toast.info .icon {
  color: var(--blue-bright);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(7px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(4px) scale(0.98);
  }
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.13) transparent;
}

*::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.23);
  background-clip: padding-box;
}

:focus-visible {
  outline: 2px solid rgba(84, 199, 255, 0.65);
  outline-offset: 2px;
}

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */

@media (max-width: 1360px) {
  .compose-layout {
    grid-template-columns: minmax(0, 1fr);
    max-width: 800px;
  }

  .preview-stack {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
    align-items: start;
    gap: 16px;
  }

  .preview-panel {
    grid-row: span 2;
  }

  .tip-card {
    align-self: start;
  }

  .phone-chat {
    min-height: 310px;
  }
}

@media (max-width: 1240px) {
  .app-shell {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .setup-visual {
    padding-inline: 34px;
  }

  .stage-main {
    width: 355px;
  }

  .float-a {
    right: -14px;
  }
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 282px minmax(0, 1fr);
  }

  .draft-rail {
    padding-inline: 9px;
  }

  .draft-save-card {
    padding: 8px;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 268px minmax(0, 1fr);
  }

  .topbar {
    padding-inline: 18px;
  }

  .workspace-scroll {
    padding-inline: 18px;
  }

  .actionbar {
    padding-inline: 18px;
  }
}

@media (max-width: 980px) {
  .setup {
    grid-template-columns: minmax(0, 1fr) minmax(410px, 0.84fr);
  }

  .setup-visual {
    padding-inline: 28px;
  }

  .setup-hero h1 {
    font-size: 46px;
  }

  .stage {
    transform: scale(0.9);
    transform-origin: left top;
    height: 300px;
  }

  .stage-float {
    display: none;
  }

  .float-a {
    display: flex;
  }

  .setup-panel {
    padding: 28px;
  }

  .target-summary {
    display: none;
  }
}

@media (max-width: 860px) {
  .setup {
    display: block;
  }

  .setup-visual {
    display: none;
  }

  .setup-panel {
    min-height: 100vh;
    padding: 26px 18px;
  }

  .setup-mobile-brand {
    display: flex;
    align-self: center;
    margin-bottom: 20px;
  }

  .setup-card {
    padding: 26px;
  }

  .app-shell {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    min-height: 0;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px 14px 10px;
  }

  .sidebar-head {
    display: none;
  }

  .bot-panel {
    margin-top: 0;
  }

  .chat-section-head {
    margin-top: 13px;
  }

  .chat-list {
    max-height: 180px;
    min-height: 62px;
    flex: none;
  }

  .chat-empty {
    min-height: 150px;
    flex: none;
  }

  .sync-foot {
    padding-top: 7px;
  }

  .draft-rail {
    min-height: 0;
    padding: 12px 14px 9px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .draft-toggle-btn {
    display: grid;
  }

  .draft-toggle-btn .icon {
    transition: transform 0.18s ease;
  }

  .draft-rail.is-open .draft-toggle-btn .icon {
    transform: rotate(180deg);
  }

  .draft-rail:not(.is-open) .draft-save-card,
  .draft-rail:not(.is-open) .draft-list,
  .draft-rail:not(.is-open) .draft-empty,
  .draft-rail:not(.is-open) .draft-rail-foot {
    display: none;
  }

  .draft-rail-head {
    padding-inline: 2px;
  }

  .draft-save-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 148px;
    align-items: end;
    gap: 9px;
    margin-top: 10px;
    padding: 8px;
  }

  .draft-save-btn {
    margin-top: 0;
  }

  .draft-list {
    flex: none;
    max-height: 174px;
    margin-top: 8px;
  }

  .draft-empty {
    flex: none;
    min-height: 102px;
    padding: 12px;
  }

  .draft-empty p {
    max-width: 380px;
  }

  .draft-rail-foot {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-top: 7px;
  }

  .main {
    min-height: 100vh;
  }

  .topbar {
    min-height: 72px;
    padding: 14px 18px;
  }

  .mobile-settings-btn {
    display: grid;
  }

  .topbar-title h1 {
    font-size: 22px;
  }

  .workspace-scroll {
    overflow: visible;
    padding: 18px 18px 24px;
  }

  .compose-layout {
    max-width: none;
  }

  .actionbar {
    position: sticky;
    bottom: 0;
    z-index: 30;
    min-height: 72px;
    padding: 11px 18px;
  }

  .preview-stack {
    display: flex;
  }

  .phone-chat {
    max-height: 390px;
  }

  .tip-card {
    margin-bottom: 8px;
  }
}

@media (max-width: 640px) {
  .setup-card {
    padding: 22px 18px;
    border-radius: 19px;
  }

  .setup-card-head h2 {
    font-size: 25px;
  }

  .setup-mobile-brand {
    margin-bottom: 16px;
  }

  .setup-panel {
    padding: 18px 12px 26px;
  }

  .topbar {
    padding: 12px 14px;
  }

  .topbar-actions {
    gap: 7px;
  }

  .breadcrumb {
    display: none;
  }

  .topbar-title h1 {
    margin-top: 0;
    font-size: 20px;
  }

  .workspace-scroll {
    padding: 14px 12px 20px;
  }

  .draft-save-card {
    grid-template-columns: minmax(0, 1fr) 132px;
  }

  .draft-save-btn {
    margin-top: 0;
  }

  .draft-list {
    max-height: 160px;
  }

  .panel {
    padding: 16px;
    border-radius: 16px;
  }

  .panel-head {
    gap: 8px;
  }

  .panel-head-actions .counter-soft {
    display: none;
  }

  .panel-head-actions .btn.subtle {
    width: 34px;
    padding: 0;
  }

  .panel-head-actions .btn.subtle span {
    display: none;
  }

  .option-grid {
    grid-template-columns: 1fr;
  }

  .layout-bar {
    gap: 6px;
  }

  .layout-bar .text-btn {
    margin-left: 0;
  }

  .layout-hint {
    display: none;
  }

  .button-row-slots {
    grid-template-columns: repeat(var(--row-cols, 1), minmax(92px, 1fr));
  }

  .photo-preview {
    flex-wrap: wrap;
  }

  .photo-info {
    min-width: 120px;
  }

  .buttons-empty {
    flex-wrap: wrap;
  }

  .buttons-empty .mini-btn {
    margin-left: 45px;
  }

  .dropzone {
    flex-wrap: wrap;
    gap: 9px;
  }

  .drop-copy {
    flex-basis: calc(100% - 55px);
  }

  .drop-action {
    margin-left: 50px;
  }

  .actionbar {
    gap: 10px;
    padding: 10px 13px;
    min-height: 68px;
  }

  .actionbar-info {
    display: none;
  }

  .actionbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .actionbar-actions .btn.ghost {
    padding-inline: 14px;
  }

  .send-btn {
    flex: 1;
    min-width: 0;
  }

  .target-summary {
    display: none;
  }

  .preview-stack {
    gap: 13px;
  }

  .phone-chat {
    max-height: 350px;
    min-height: 290px;
  }

  .modal {
    padding: 20px;
    border-radius: 18px;
  }

  .modal-head h2 {
    font-size: 20px;
  }

  .result-stats > div {
    padding: 9px 10px;
  }

  .stat-value {
    font-size: 17px;
  }

  .toast-stack {
    right: 12px;
    bottom: 82px;
    left: 12px;
    width: auto;
    align-items: stretch;
  }

  .toast {
    width: 100%;
  }

  .current-bot-row {
    flex-wrap: wrap;
  }

  .token-hint {
    max-width: 100%;
  }
}

@media (max-height: 800px) and (min-width: 861px) {
  .stage {
    height: 285px;
    transform: scale(0.92);
    transform-origin: left center;
  }

  .setup-hero {
    padding-top: 28px;
  }

  .setup-hero h1 {
    margin-top: 14px;
    font-size: clamp(40px, 4vw, 58px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
