/* Лидоген - админка (Telegram Mini App) */

:root {
  color-scheme: light;
  --bg: #f3f4f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eceef2;
  --line: #e5e7ec;
  --line-strong: #d3d7df;
  --text: #111827;
  --text-2: #3f4a5c;
  --muted: #6b7385;
  --accent: #2563eb;
  --accent-hover: #1d4fd8;
  --accent-soft: #eaf1ff;
  --accent-text: #1d4fd8;
  --violet-soft: #f0edff;
  --violet-text: #5a3fc8;
  --success: #08875a;
  --success-soft: #e6f7ef;
  --warning: #b25e09;
  --warning-soft: #fff4e5;
  --danger: #d1281c;
  --danger-soft: #fdeceb;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid: #eceef2;
    --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-md: 0 10px 30px rgba(17, 24, 39, 0.1);
  --shadow-lg: 0 24px 60px rgba(17, 24, 39, 0.22);
  --radius: 16px;
  --radius-sm: 10px;
  --tabbar-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --kb-offset: 0px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0e13;
  --surface: #151821;
  --surface-2: #1b1f29;
  --surface-3: #232835;
  --line: #262b37;
  --line-strong: #353b4a;
  --text: #f1f3f7;
  --text-2: #c3c9d4;
  --muted: #8a93a5;
  --accent: #4c87ff;
  --accent-hover: #6a9cff;
  --accent-soft: rgba(76, 135, 255, 0.15);
  --accent-text: #8db3ff;
  --violet-soft: rgba(144, 133, 233, 0.16);
  --violet-text: #b7aef6;
  --success: #3dc985;
  --success-soft: rgba(61, 201, 133, 0.13);
  --warning: #f2a33a;
  --warning-soft: rgba(242, 163, 58, 0.13);
  --danger: #f8736a;
  --danger-soft: rgba(248, 115, 106, 0.13);
  --series-1: #3987e5;
  --series-2: #d95926;
  --grid: #232835;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

h1, h2, h3, h4, p { margin: 0; }

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

.ic {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- App bar ---------- */

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.appbar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex: none;
  display: block;
}

.brand-mark img { width: 100%; height: 100%; display: block; border-radius: 50%; object-fit: cover; }

/* ---------- Layout ---------- */

.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 18px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 32px);
}

.view-head { margin-bottom: 16px; }

.view-head h1 {
  font-size: 26px;
  line-height: 1.15;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.view-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.stack { display: grid; gap: 12px; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.toolbar .grow { flex: 1 1 220px; min-width: 0; }

/* ---------- Tab bar ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  padding: 6px 8px calc(6px + var(--safe-bottom));
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--line);
  transform: translateY(var(--kb-offset));
}

.tabbar-inner {
  display: flex;
  width: 100%;
  max-width: 560px;
  gap: 2px;
}

.tab {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 2px 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 12px;
}

.tab-icon {
  width: 46px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.tab-icon .ic { width: 21px; height: 21px; }

.tab-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab:hover { color: var(--text-2); }

.tab.is-active { color: var(--accent-text); }

.tab.is-active .tab-icon { background: var(--accent-soft); }

@media (min-width: 760px) {
  .tabbar {
    left: 50%;
    right: auto;
    bottom: 14px;
    transform: translate(-50%, var(--kb-offset));
    width: min(600px, calc(100vw - 32px));
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow-md);
    padding: 6px 8px;
  }
}

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.card + .card { margin-top: 12px; }
.stack > .card + .card { margin-top: 0; }

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

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-title-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-text);
  flex: none;
}

.card-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13.5px;
}

.card-flush { padding: 0; overflow: hidden; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn .ic { width: 17px; height: 17px; }

.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--accent) 35%, var(--line-strong)); }

.btn:active { transform: translateY(1px); }

.btn:focus-visible,
.tab:focus-visible,
.seg button:focus-visible,
.pill:focus-visible,
.row-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }

.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: color-mix(in srgb, var(--danger) 88%, #000); border-color: transparent; }

.btn-sm { height: 34px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn-sm .ic { width: 15px; height: 15px; }

.btn-icon { width: 40px; padding: 0; }
.btn-sm.btn-icon { width: 34px; }

.btn-block { width: 100%; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

/* ---------- Forms ---------- */

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 650;
  color: var(--text-2);
  margin-bottom: 6px;
}

.field-hint {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input, .select { height: 42px; padding: 0 12px; }

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7385' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}

.textarea {
  padding: 10px 12px;
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

.textarea.is-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.input::placeholder, .textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }

.input-icon {
  position: relative;
  display: block;
}

.input-icon > .ic {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.input-icon > .input { padding-left: 38px; }

.form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .form-grid.cols-3 { grid-template-columns: 1.2fr 1fr 0.9fr; }
  .form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }

/* Switch */
.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex: none;
}

.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background-color 0.18s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease;
}

.switch input:checked + .switch-track { background: var(--success); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Segmented control & pills ---------- */

.seg {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-3);
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 14px;
}

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

.seg button {
  flex: 1 0 auto;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.seg button:hover { color: var(--text); }

.seg button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--line);
}

.seg .count {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.seg.is-inline { display: inline-flex; margin-bottom: 0; }
.seg.is-inline button { flex: 0 0 auto; height: 32px; padding: 0 12px; font-size: 13px; }

.pills { display: flex; gap: 6px; flex-wrap: wrap; }

.pill {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.pill:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line-strong)); }

.pill.is-active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent-text);
}

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--text-2);
}

.badge .ic { width: 13px; height: 13px; stroke-width: 2.3; }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-violet { background: var(--violet-soft); color: var(--violet-text); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.appbar-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 650;
  background: var(--success-soft);
  color: var(--success);
}

.appbar-status.is-off { background: var(--warning-soft); color: var(--warning); }

/* ---------- Callouts & empty states ---------- */

.callout {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--text-2);
}

.callout > .ic { margin-top: 1px; color: var(--muted); }
.callout b { color: var(--text); }
.callout-accent { background: var(--accent-soft); border-color: transparent; }
.callout-accent > .ic { color: var(--accent-text); }
.callout-warning { background: var(--warning-soft); border-color: transparent; }
.callout-warning > .ic { color: var(--warning); }
.callout-danger { background: var(--danger-soft); border-color: transparent; }
.callout-danger > .ic { color: var(--danger); }
.callout-success { background: var(--success-soft); border-color: transparent; }
.callout-success > .ic { color: var(--success); }
.callout .btn { margin-top: 8px; }

.empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
  font-size: 14px;
}

.empty .ic {
  width: 34px;
  height: 34px;
  margin: 0 auto 10px;
  display: block;
  color: color-mix(in srgb, var(--muted) 70%, transparent);
  stroke-width: 1.6;
}

.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.num { font-variant-numeric: tabular-nums; }

/* Skeleton */
.skeleton {
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

/* ---------- Dashboard ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

@media (min-width: 760px) {
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.kpi-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.kpi-value {
  margin-top: 6px;
  font-size: 28px;
  line-height: 1.1;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.kpi.is-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.kpi.is-accent .kpi-label,
.kpi.is-accent .kpi-sub { color: rgba(255, 255, 255, 0.82); }

.dash-grid {
  display: grid;
  gap: 12px;
}

@media (min-width: 900px) {
  .dash-grid { grid-template-columns: 1.6fr 1fr; align-items: start; }
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12.5px;
  color: var(--text-2);
  margin-bottom: 10px;
}

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

.legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.colchart {
  position: relative;
  padding-left: 52px;
  user-select: none;
}

.colchart-plot {
  position: relative;
  height: 160px;
}

.colchart-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.colchart-grid div {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid var(--grid);
}

.colchart-grid div:first-child { border-top-color: var(--line-strong); }

.colchart-grid span {
  position: absolute;
  left: -52px;
  width: 46px;
  white-space: nowrap;
  text-align: right;
  top: -8px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.colchart-cols {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: stretch;
}

.colchart-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 0 1px;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
}

.colchart-col:hover,
.colchart-col.is-active { background: color-mix(in srgb, var(--surface-3) 70%, transparent); }

.colchart-stack {
  width: 100%;
  max-width: 24px;
  height: 100%;
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
}

.colchart-seg {
  width: 100%;
  min-height: 2px;
}

.colchart-seg:last-child { border-radius: 4px 4px 0 0; }

.colchart-x {
  display: flex;
  margin-top: 6px;
}

.colchart-x span {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: visible;
}

.chart-tip {
  position: absolute;
  z-index: 5;
  min-width: 150px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  font-size: 12.5px;
  pointer-events: none;
}

.chart-tip b { display: block; margin-bottom: 4px; font-size: 13px; }

.chart-tip div {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  justify-content: space-between;
}

.chart-tip div span { display: inline-flex; align-items: center; gap: 6px; }
.chart-tip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.chart-tip em { font-style: normal; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

.hbar-list { display: grid; gap: 10px; }

.hbar {
  display: grid;
  grid-template-columns: minmax(80px, 38%) 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}

.hbar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hbar-track {
  height: 10px;
  border-radius: 0 4px 4px 0;
  background: transparent;
}

.hbar-track i {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--series-1);
}

.hbar b { font-variant-numeric: tabular-nums; font-size: 13px; }

.stat-list { display: grid; gap: 0; }

.stat-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.stat-line:first-child { border-top: 0; padding-top: 0; }
.stat-line span { color: var(--text-2); }
.stat-line b { font-variant-numeric: tabular-nums; }

/* ---------- Lists & rows ---------- */

.list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.list-item + .list-item { border-top: 1px solid var(--line); }

.row-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.row-btn:hover { background: var(--surface-2); }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.row-main { flex: 1; min-width: 0; }

.row-title {
  font-weight: 650;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-sub {
  margin-top: 3px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.row-chevron {
  color: var(--muted);
  transition: transform 0.18s ease;
}

.row-chevron.is-open { transform: rotate(90deg); }

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex: none;
  font-weight: 700;
  font-size: 15px;
  background: var(--accent-soft);
  color: var(--accent-text);
  text-transform: uppercase;
}

.avatar.is-channel { background: var(--violet-soft); color: var(--violet-text); }

.row-detail {
  padding: 4px 14px 16px 64px;
}

@media (max-width: 520px) {
  .row-detail { padding-left: 14px; }
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  margin-bottom: 14px;
}

.meta-grid dt { font-size: 12px; color: var(--muted); }
.meta-grid dd { margin: 2px 0 0; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.meta-grid div { min-width: 0; }

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.section-title b { font-size: 14px; }
.section-title span { font-size: 12.5px; color: var(--muted); }

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.pager .btn-row { margin-top: 0; }

.sticky-bar {
  position: sticky;
  top: 58px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  margin-bottom: 10px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.meta-line {
  font-size: 13px;
  color: var(--muted);
  margin: -4px 0 10px;
}

/* ---------- Tag editor ---------- */

.tag-editor { min-width: 0; }

.te-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.te-count {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.te-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.te-filter {
  position: relative;
  display: block;
  width: 150px;
}

@media (max-width: 480px) {
  .te-tools { flex: 1 1 100%; flex-wrap: nowrap; }
  .te-filter { flex: 1; width: auto; min-width: 0; }
  .te-tool-label { display: none; }
  .te-tools .btn-sm { width: 34px; padding: 0; }
}

.te-filter .ic {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted);
}

.te-filter input {
  height: 34px;
  padding-left: 30px;
  font-size: 13.5px;
}

.te-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  height: 32px;
  padding: 0 3px 0 11px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 14px;
  color: var(--text);
}

.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chip button {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex: none;
}

.chip button .ic { width: 14px; height: 14px; stroke-width: 2.3; }
.chip button:hover { background: var(--danger-soft); color: var(--danger); }

.chip.is-new {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

.chip.is-minus.is-new {
  background: var(--warning-soft);
  border-color: color-mix(in srgb, var(--warning) 35%, transparent);
}

.chip.is-flash { animation: flash 0.9s ease; }

@keyframes flash {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  30% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
}

.chip-static {
  padding: 0 10px;
  height: 26px;
  font-size: 12.5px;
  border-radius: 7px;
}

.te-more {
  height: 32px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px dashed var(--line-strong);
  background: transparent;
  color: var(--accent-text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.te-empty {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
}

.te-add {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.te-add .input { flex: 1; min-width: 0; }

.te-savebar {
  position: sticky;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 8px 8px 8px 14px;
  border-radius: 12px;
  background: var(--text);
  color: var(--surface);
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
  font-weight: 600;
}

.te-savebar span { flex: 1; min-width: 0; }
.te-savebar .btn-ghost { color: color-mix(in srgb, var(--surface) 80%, transparent); }
.te-savebar .btn-ghost:hover { background: color-mix(in srgb, var(--surface) 14%, transparent); color: var(--surface); }

@media (min-width: 760px) {
  .te-savebar { bottom: 96px; }
}

/* ---------- Auth screen ---------- */

.auth-screen {
  min-height: 70vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.auth-card {
  max-width: 380px;
  text-align: center;
}

.auth-card .card-title-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  margin: 0 auto 14px;
}

.auth-card .card-title-icon .ic { width: 26px; height: 26px; }
.auth-card h2 { font-size: 20px; margin-bottom: 6px; }
.auth-card p { color: var(--muted); font-size: 14.5px; }
.auth-card.is-error .card-title-icon { background: var(--danger-soft); color: var(--danger); }

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 14, 22, 0.45);
  animation: fade-in 0.15s ease;
}

@media (min-width: 560px) {
  .modal-backdrop { align-items: center; }
}

.modal {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  animation: slide-up 0.2s ease;
  margin-bottom: var(--safe-bottom);
}

.modal h3 { font-size: 18px; margin-bottom: 8px; }
.modal p { color: var(--text-2); font-size: 14.5px; }
.modal .btn-row { margin-top: 20px; justify-content: flex-end; }

@media (max-width: 559px) {
  .modal .btn-row { flex-direction: column-reverse; }
  .modal .btn-row .btn { width: 100%; height: 46px; }
}

@keyframes fade-in { from { opacity: 0; } }
@keyframes slide-up { from { transform: translateY(16px); opacity: 0; } }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 18px);
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(92vw, 440px);
  padding: 11px 16px 11px 12px;
  border-radius: 14px;
  background: var(--text);
  color: var(--surface);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.toast .toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--success);
  color: #fff;
  flex: none;
}

.toast.is-error .toast-icon { background: var(--danger); }
.toast .toast-icon .ic { width: 14px; height: 14px; stroke-width: 2.6; }

@media (min-width: 760px) {
  .toast { bottom: 104px; }
}

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

/* Settings sub-tabs: 2×2 on phones so every section is visible without scrolling */
.seg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
.seg-grid button { min-width: 0; padding: 0 8px; }
.seg-grid.seg-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg-grid.seg-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) {
  .seg-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .seg-grid.seg-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .seg-grid.seg-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* One-line status (e.g. the connected lead chat): long titles are truncated with an ellipsis */
.callout-oneline { align-items: center; }
.callout-oneline > div { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.callout-oneline > .ic { margin-top: 0; }

/* ---------- OSTRO AI cabinet: screens before the workspace ---------- */

.screen { max-width: 560px; margin: 0 auto; padding: 24px 16px calc(var(--safe-bottom) + 32px); }
.screen-card { display: grid; gap: 14px; }
.screen-card > h2 { font-size: 22px; line-height: 1.2; letter-spacing: -0.01em; }
.screen-card > p { color: var(--muted); }
.screen-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; background: var(--accent-soft); color: var(--accent-text); }
.screen-icon .ic { width: 26px; height: 26px; }
.screen-icon.is-warning, .card-title-icon.is-warning { background: var(--warning-soft); color: var(--warning); }
.screen-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; padding: 12px 0 calc(var(--safe-bottom) + 4px); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.btn-stack { display: grid; gap: 8px; }
.center { text-align: center; }
.input-code { font-size: 22px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }

.plan-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.plan-card { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); display: grid; gap: 4px; }
.plan-name { font-weight: 650; }
.plan-price b { font-size: 22px; letter-spacing: -0.02em; }
.plan-price span { color: var(--muted); font-size: 13px; margin-left: 4px; }
.plan-trial { color: var(--muted); font-size: 13px; }

.module-cards { display: grid; gap: 10px; }
.module-card, .preset-card { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
.module-card:hover, .preset-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong)); }
.module-card:focus-visible, .preset-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.module-card > span:nth-child(2) { flex: 1; display: grid; gap: 2px; }
.module-card small, .preset-card small { color: var(--muted); font-size: 13.5px; line-height: 1.4; }
.module-icon { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 14px; background: var(--accent-soft); color: var(--accent-text); }
.module-icon .ic { width: 24px; height: 24px; }

.preset-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.preset-card { flex-direction: column; align-items: flex-start; gap: 6px; }
.preset-card b { font-size: 15.5px; }
.preset-card.is-picked { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); }

.module-switch { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--surface-3); }
.module-switch button { all: unset; cursor: pointer; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.module-switch button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.module-switch button:focus-visible { outline: 2px solid var(--accent); }

.admin-banner { padding: 8px 16px; text-align: center; font-size: 13px; font-weight: 600; background: var(--violet-soft); color: var(--violet-text); }

.help-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; text-align: left; }

/* ---------- workspace extras ---------- */

.lead-text { display: block; margin-top: 6px; color: var(--text-2); font-size: 13.5px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.lead-group-line { display: flex; gap: 8px; flex-wrap: wrap; }
.lead-group-line .select { flex: 1 1 220px; min-width: 0; }
.team-form { margin-top: 14px; align-items: end; }
.seg-scroll { overflow-x: auto; }

.chat { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.bubble { max-width: 82%; padding: 9px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.bubble span { display: block; margin-top: 4px; color: var(--muted); font-size: 11.5px; }
.bubble.is-ai, .bubble.is-manager { align-self: flex-end; background: var(--accent-soft); border-color: transparent; }
.bubble.is-manager { background: var(--violet-soft); }
.dialog-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-top: 14px; }
.dialog-controls .field { flex: 1 1 200px; }

.stage-card { padding: 12px 14px; }
.stage-card .row { align-items: center; }
.stage-head { flex: 1; min-width: 0; }
.stage-step { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 14px; }
.stage-tools { display: flex; gap: 2px; flex: none; }
.stage-form { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.stage-messages { display: grid; gap: 10px; margin-bottom: 8px; }
.stage-message { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.stage-message-meta { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.stage-message-meta label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); flex: 1 1 120px; }
.pill-check { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 13px; cursor: pointer; }
.pill-check input { margin: 0; }
.pill-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }

@media (max-width: 420px) {
  .module-switch button { padding: 6px 9px; font-size: 12.5px; }
  .brand > span:last-child { display: none; }
}

/* ---------- No access: tariffs (look of the OSTRO AI site: notched corners, mono labels, blue → violet) ---------- */

.screen.is-tariffs { padding-top: 12px; padding-bottom: calc(var(--safe-bottom) + 10px); }
.screen.is-tariffs .screen-card { gap: 10px; }
.tariff-head { display: flex; gap: 12px; align-items: flex-start; }
.tariff-head .screen-icon { flex: none; width: 36px; height: 36px; border-radius: 11px; }
.tariff-head .screen-icon .ic { width: 18px; height: 18px; }
.tariff-head h2 { margin: 0 0 3px; font-size: 18px; line-height: 1.2; letter-spacing: -0.01em; }
.tariff-head p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.text-link { padding: 0; border: 0; background: none; color: var(--accent-text); font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

.tariffs { --t-blue: #1f5eff; --t-violet: #9333ea; --t-duo: linear-gradient(90deg, #1f5eff, #9333ea); --notch: 14px; display: grid; gap: 8px; }
.tariff-periods { margin: 0; }
.tariff-periods button { flex: 1 1 0; min-width: 0; padding: 0 6px; font-size: 13px; }
.tariff-off { margin-left: 4px; color: var(--violet-text); font: 700 10.5px ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

.tariff-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tariff-card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; min-width: 0;
  padding: 12px 10px 10px; border: 0; background: var(--surface); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line); text-align: left; font: inherit; cursor: pointer;
  clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% 100%, 0 100%);
  transition: background-color .15s, color .15s;
}
.tariff-card::before { content: ""; position: absolute; top: 0; left: 0; right: var(--notch); height: 3px; background: var(--tone); }
.tariff-card::after {
  content: ""; position: absolute; top: 0; right: 0; width: var(--notch); height: var(--notch);
  background: linear-gradient(to bottom left, transparent calc(50% - .6px), var(--line) calc(50% - .6px), var(--line) calc(50% + .6px), transparent calc(50% + .6px));
}
.tone-blue { --tone: var(--t-blue); --tone-text: var(--t-blue); }
.tone-violet { --tone: var(--t-violet); --tone-text: var(--t-violet); }
.tone-duo { --tone: var(--t-duo); --tone-text: var(--t-violet); }
:root[data-theme="dark"] .tone-blue { --tone-text: #6f9bff; }
:root[data-theme="dark"] .tone-violet, :root[data-theme="dark"] .tone-duo { --tone-text: #b98af5; }
.tariff-card:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.tariff-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tariff-card.is-picked { background: var(--text); color: var(--bg); box-shadow: none; }
.tariff-card.is-picked::after { display: none; }
.tariff-label { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; color: var(--muted); font: 600 9.5px/1.3 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.tariff-card.is-picked .tariff-label, .tariff-card.is-picked .tariff-caption { color: color-mix(in srgb, var(--bg) 62%, var(--text)); }
.tariff-save { padding: 1px 4px; background: var(--t-duo); color: #fff; letter-spacing: .02em; }
.tariff-name { margin-top: 5px; font-size: 13.5px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.tariff-price { margin-top: auto; padding-top: 6px; font-size: 24px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.tariff-caption { margin-top: 3px; color: var(--muted); font-size: 11.5px; }

.tariff-detail { display: grid; gap: 7px; padding: 10px 14px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.tariff-detail-title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; font-size: 14px; }
.tariff-detail-title small { color: var(--muted); font-size: 12px; }
.tariff-features { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; font-size: 13.5px; line-height: 1.35; }
.tariff-features li { display: flex; gap: 8px; align-items: flex-start; }
.tariff-features .ic { flex: none; width: 16px; height: 16px; margin-top: 1px; color: var(--tone-text); stroke-width: 2.4; }
.tariff-limits { display: grid; gap: 2px; margin: 0; padding-top: 7px; border-top: 1px dashed var(--line-strong); font-size: 12.5px; }
.tariff-limits div { display: flex; justify-content: space-between; gap: 10px; }
.tariff-limits dt { color: var(--muted); }
.tariff-limits dd { margin: 0; font: 600 12px ui-monospace, "SF Mono", Menlo, Consolas, monospace; white-space: nowrap; }

.tariff-buy {
  min-height: 44px; border: 0; border-radius: 0; background: var(--tone); color: #fff; font-weight: 700;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
}
.tariff-buy:hover { background: var(--tone); filter: brightness(1.08); }
.tariff-setup { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 6px 6px 12px; box-shadow: inset 0 0 0 1px var(--line); font-size: 12.5px; line-height: 1.35; }
.tariff-setup button {
  flex: none; padding: 8px 12px; border: 0; background: var(--text); color: var(--bg); font: inherit; font-size: 12.5px; font-weight: 700; line-height: 1; cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
}
.tariff-setup button:focus-visible, .tariff-buy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 400px) { .tariff-name { font-size: 12.5px; } .tariff-card { padding-left: 9px; padding-right: 8px; } }
@media (max-width: 350px) { .tariff-price { font-size: 20px; } .tariff-name { font-size: 12px; } }
.tariff-setup b { white-space: nowrap; }

/* ---------- AI-manager: scenario form, dialogs, test chat ---------- */

.meter { height: 4px; margin-top: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.28); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: #fff; }
.scenario-head { display: grid; gap: 10px; margin-bottom: 14px; }
.scenario-head .seg { margin-bottom: 0; }
.scenario-tools { margin-top: 0; }
.field-rows { display: grid; gap: 6px; margin: 4px 0 8px; }
.field-row { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.field-row-label { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.field-row .check { flex: none; font-size: 13px; color: var(--text-2); }
.field-add { display: grid; gap: 8px; margin-bottom: 6px; }
.field-custom { display: flex; gap: 8px; }
.field-custom .input { flex: 1; min-width: 0; }
.push-delay { max-width: 220px; }
.dialog-summary { margin: 10px 0 0; color: var(--text-2); font-size: 14px; line-height: 1.45; }
.bubble.is-human { align-self: flex-start; }
.test-layout { display: grid; gap: 12px; }
.test-chat { min-height: 220px; max-height: 52vh; }
.test-input { display: grid; gap: 8px; }
.test-input .btn-row { margin-top: 0; justify-content: space-between; }
.advanced summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::after { content: "+"; color: var(--muted); font-size: 18px; font-weight: 400; }
.advanced[open] summary::after { content: "−"; }
.mono-text { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.5; }
@media (min-width: 760px) {
  .scenario-head { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .test-layout { grid-template-columns: minmax(0, 1fr) 280px; align-items: start; }
}
