:root {
  --bg: #f4f4f5;
  --panel: #ffffff;
  --border: #e4e4e7;
  --text: #18181b;
  --muted: #52525b;
  --muted-dim: #71717a;
  --accent: #28b8e9;
  --accent-glow: rgba(40, 184, 233, 0.2);
  --accent-dim: #d9f3fc;
  --danger: #dc2626;
  --btn-on-accent: #ffffff;
  --elevated: #fafafa;
  --raised: #f4f4f5;
  --modal-surface: #ffffff;
  --overlay-bg: rgba(15, 23, 42, 0.5);
  --shadow-modal: 0 24px 80px rgba(0, 0, 0, 0.12);
  --nav-hover-bg: rgba(0, 0, 0, 0.04);
  --nav-hover-border: rgba(0, 0, 0, 0.06);
  --nav-active-bg: linear-gradient(
    135deg,
    rgba(40, 184, 233, 0.2),
    rgba(40, 184, 233, 0.08)
  );
  --nav-active-border: rgba(40, 184, 233, 0.35);
  --nav-active-small: rgba(0, 0, 0, 0.45);
  --close-hover: rgba(0, 0, 0, 0.06);
  --card-grad-1: #ffffff;
  --card-grad-2: #f4f4f5;
  --card-edge-hover: #d4d4d8;
  --card-shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.08);
  --agent-desc-muted: var(--muted-dim);
  --outline-hover: #a1a1aa;
  --wiz-mark-bg: #f4f4f5;
  --wiz-mark-ring: #d4d4d8;
  --wiz-line: #e4e4e7;
  --wiz-connector-active: linear-gradient(
    90deg,
    var(--accent),
    rgba(40, 184, 233, 0.45)
  );
  --field-label-color: #3f3f46;
  --tile-hover-edge: #a1a1aa;
  --mic-face-1: #b8e8fb;
  --mic-face-2: #7dd3f5;
  --mic-orb-shadow: 0 12px 40px rgba(14, 116, 165, 0.22);
  --ctrl-muted-bg: #ffffff;
  --pick-hover-edge: #d4d4d8;
  --chat-bubble-bg: rgba(0, 0, 0, 0.04);
  --secure-code-bg: rgba(0, 0, 0, 0.06);
  --empty-icon-grad: linear-gradient(
    145deg,
    rgba(40, 184, 233, 0.14),
    #f4f4f5
  );
  --empty-icon-border: rgba(40, 184, 233, 0.28);
  --pick-ico-bg: rgba(0, 0, 0, 0.04);
  --ctrl-mic-grad: linear-gradient(180deg, #4fc3f7, #0288d1);
  --mic-orb-ring: rgba(40, 184, 233, 0.4);
  --mic-orb-active-ring: rgba(40, 184, 233, 0.6);
  --transcript-user: #0369a1;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --btn-on-accent: #ffffff;
  --bg: #050505;
  --panel: #0f0f0f;
  --border: #2a2a2a;
  --text: #ececec;
  --muted: #a1a1a1;
  --muted-dim: #6b6b6b;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.22);
  --accent-dim: #0c4a6e;
  --danger: #ef4444;
  --elevated: #0d0d0d;
  --raised: #1a1a1a;
  --modal-surface: #141414;
  --overlay-bg: rgba(0, 0, 0, 0.72);
  --shadow-modal: 0 24px 80px rgba(0, 0, 0, 0.65);
  --nav-hover-bg: rgba(255, 255, 255, 0.05);
  --nav-hover-border: rgba(255, 255, 255, 0.06);
  --nav-active-bg: linear-gradient(
    135deg,
    rgba(12, 74, 110, 0.55),
    rgba(8, 47, 73, 0.28)
  );
  --nav-active-border: rgba(56, 189, 248, 0.35);
  --nav-active-small: rgba(255, 255, 255, 0.45);
  --close-hover: rgba(255, 255, 255, 0.06);
  --card-grad-1: #161616;
  --card-grad-2: #101010;
  --card-edge-hover: #3f3f3f;
  --card-shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.45);
  --agent-desc-muted: #aaa;
  --outline-hover: #555;
  --wiz-mark-bg: #0c0c0c;
  --wiz-mark-ring: #3f3f3f;
  --wiz-line: #2f2f2f;
  --wiz-connector-active: linear-gradient(
    90deg,
    var(--accent),
    rgba(40, 184, 233, 0.45)
  );
  --field-label-color: #b0b0b0;
  --tile-hover-edge: #444;
  --mic-face-1: #164e63;
  --mic-face-2: #0c2b3d;
  --mic-orb-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  --ctrl-muted-bg: #141414;
  --pick-hover-edge: #3a3a3a;
  --chat-bubble-bg: rgba(255, 255, 255, 0.04);
  --secure-code-bg: rgba(0, 0, 0, 0.35);
  --empty-icon-grad: linear-gradient(
    145deg,
    rgba(40, 184, 233, 0.14),
    #141414
  );
  --empty-icon-border: rgba(56, 189, 248, 0.28);
  --pick-ico-bg: rgba(255, 255, 255, 0.04);
  --ctrl-mic-grad: linear-gradient(180deg, #38bdf8, #0284c7);
  --mic-orb-ring: rgba(56, 189, 248, 0.4);
  --mic-orb-active-ring: rgba(56, 189, 248, 0.6);
  --transcript-user: #7dd3fc;
}

/* Theme toggle (sidebar) */
.theme-switch {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.theme-switch-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-dim);
  margin-bottom: 0.5rem;
}

.theme-toggle {
  display: flex;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--elevated);
}

.theme-btn {
  flex: 1;
  padding: 0.45rem 0.5rem;
  font-size: 0.75rem;
  font-family: inherit;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.theme-btn:hover {
  color: var(--text);
  background: var(--nav-hover-bg);
}

.theme-btn.is-active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}

/* Modals (shared: change password, admin) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.modal-overlay.open {
  display: flex;
}

.modal-panel {
  width: 100%;
  max-width: 440px;
  background: var(--modal-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-modal);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.modal-panel .field-input,
.modal-panel .field-label {
  margin-top: 0;
}

.modal-panel form {
  padding: 1rem 1.25rem 1.25rem;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.modal-err {
  margin: 0.75rem 1.25rem 0;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  font-size: 0.85rem;
}

.admin-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.btn-ico-only {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--elevated);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}

.btn-ico-only:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.btn-ico-only.danger:hover {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.45);
}

.btn-ico-only svg {
  width: 1rem;
  height: 1rem;
}

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-badge.on {
  background: rgba(40, 184, 233, 0.15);
  color: var(--accent);
}

.status-badge.off {
  background: var(--chat-bubble-bg);
  color: var(--muted-dim);
}

.admin-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  display: flex;
}

.app-shell {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
}

.brand {
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.03em;
}

.brand-dot {
  color: var(--accent);
  font-weight: 800;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--muted-dim);
  margin-top: 0.25rem;
}

.brand-wrap {
  margin-bottom: 0.15rem;
}

.brand-logo-img {
  display: block;
  max-width: 100%;
  height: auto;
}

.powered-by-line {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.65rem;
  line-height: 1.45;
  color: var(--muted-dim);
}

.powered-by-rsoft-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.powered-by-rsoft-link:hover {
  text-decoration: underline;
}

/* Login / register: small blue line below card footer (in flow — no fixed overlap on scroll) */
body.auth-body .auth-powered {
  margin: 1.25rem 0 0;
  padding: 0;
  text-align: center;
  font-size: 0.6875rem;
  line-height: 1.45;
  color: var(--accent);
}

body.auth-body .auth-powered .powered-by-rsoft-link {
  color: var(--accent);
  font-weight: 600;
  font-size: inherit;
}

.nav {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav a {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.nav a:hover {
  color: var(--text);
  background: var(--nav-hover-bg);
  border-color: var(--nav-hover-border);
}

.nav a.active {
  background: var(--nav-active-bg);
  border-color: var(--nav-active-border);
  color: var(--accent);
}

.nav-link-icon {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.05rem;
  color: var(--muted-dim);
}

.nav a:hover .nav-link-icon,
.nav a.active .nav-link-icon {
  color: var(--accent);
}

.nav-ico {
  width: 100%;
  height: 100%;
  display: block;
}

.nav-link-text {
  min-width: 0;
}

.nav-link-title {
  display: block;
  font-weight: 600;
  color: inherit;
}

.nav small {
  display: block;
  font-size: 0.68rem;
  color: var(--muted-dim);
  margin-top: 0.12rem;
}

.nav a.active small {
  color: var(--nav-active-small);
}

.sidebar-footer {
  margin-top: auto;
  font-size: 0.65rem;
  color: var(--muted-dim);
}

main {
  flex: 1;
  padding: 1.5rem 2rem;
  overflow: auto;
}

h1 {
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 1rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.agent-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.agent-row:last-child {
  border-bottom: none;
}

.agent-meta h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.agent-meta p {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.icon-bot {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--border);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}

button,
.btn {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-primary {
  background: var(--accent);
  color: var(--btn-on-accent);
  font-weight: 600;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.form-grid {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .form-grid.cols-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem;
  min-height: 360px;
}

.empty-icon {
  width: 96px;
  height: 96px;
  border-radius: 20px;
  background: var(--raised);
  display: grid;
  place-items: center;
  font-size: 2.5rem;
  margin-bottom: 1.25rem;
}

.empty-icon .empty-robot-img {
  width: 88px;
  height: 88px;
  object-fit: contain;
}

.empty-state h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
}

.empty-state p {
  color: var(--muted);
  margin: 0;
  max-width: 320px;
}

.transcript {
  font-size: 0.85rem;
  line-height: 1.5;
  max-height: 160px;
  overflow-y: auto;
  padding: 0.75rem;
  background: var(--elevated);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.transcript .u {
  color: var(--transcript-user);
}

.transcript .m {
  color: var(--accent);
}

/* Test page: chat-style transcript — agent left, user right */
.transcript-chat {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 280px;
  padding: 0.85rem;
}

.transcript-chat .tc-row {
  display: flex;
  gap: 0.55rem;
  max-width: min(92%, 520px);
}

.transcript-chat .tc-agent {
  align-self: flex-start;
  flex-direction: row;
}

.transcript-chat .tc-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.transcript-chat .tc-avatar {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
  width: 2rem;
  text-align: center;
}

.transcript-chat .tc-bubble {
  min-width: 0;
  flex: 1;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  background: var(--chat-bubble-bg);
  border: 1px solid var(--border);
}

.transcript-chat .tc-agent .tc-bubble {
  border-top-left-radius: 4px;
}

.transcript-chat .tc-user .tc-bubble {
  border-top-right-radius: 4px;
}

.transcript-chat .tc-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.transcript-chat .tc-name {
  font-weight: 600;
  color: var(--text);
}

.transcript-chat .tc-time {
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

.transcript-chat .tc-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
}

.transcript-chat .tc-agent .tc-text {
  color: var(--accent);
}

.transcript-chat .tc-user .tc-text {
  color: var(--transcript-user);
}

.badge {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  background: var(--border);
  color: var(--muted);
}

.error-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.secure-banner {
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.45);
  color: #fde68a;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.secure-banner a {
  color: var(--accent);
  word-break: break-all;
}

.secure-banner code {
  font-size: 0.8rem;
  background: var(--secure-code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.test-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 800px) {
  .test-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .app-shell {
    flex-direction: column;
  }
}

/* ——— Agents dashboard ——— */
.main-agents {
  flex: 1;
  padding: 1.5rem 2rem 3rem;
  overflow: auto;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 0;
  text-transform: none;
}

.page-sub {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.btn-new {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1.15rem;
  border-radius: 10px;
  font-size: 0.9rem;
}

.btn-new .btn-ico {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.empty-grid-msg {
  grid-column: 1 / -1;
  color: var(--muted);
  text-align: center;
  padding: 3rem 1rem;
}

.agent-card {
  background: linear-gradient(
    165deg,
    var(--card-grad-1) 0%,
    var(--card-grad-2) 100%
  );
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.agent-card:hover {
  border-color: var(--card-edge-hover);
  box-shadow: var(--card-shadow-hover);
}

.agent-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.agent-card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
}

.agent-card-icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  background: rgba(40, 184, 233, 0.1);
  border: 1px solid rgba(40, 184, 233, 0.22);
  display: grid;
  place-items: center;
  color: var(--accent);
}

.agent-card-icon .ui-icon {
  width: 1.35rem;
  height: 1.35rem;
}

.agent-card-icon.agent-card-icon--img {
  padding: 0;
  overflow: hidden;
}

.agent-card-icon.agent-card-icon--img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  border-radius: 10px;
  border: 2px solid #fff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
}

.agent-card-head-text {
  min-width: 0;
}

.agent-card-role-pill {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: var(--chat-bubble-bg);
  color: var(--muted);
}

.agent-card-status {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}

.agent-card-status.draft {
  background: var(--chat-bubble-bg);
  color: var(--muted);
}

.agent-card-status.published {
  background: rgba(40, 184, 233, 0.15);
  color: var(--accent);
}

.agent-card-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.25;
}

.agent-card-owner {
  margin: 0.4rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}

.agent-card-owner .owner-pill {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.68rem;
}

.agent-card-desc {
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
  color: var(--agent-desc-muted);
  line-height: 1.45;
  flex: 1;
}

.agent-card-voice {
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.agent-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.1rem;
  flex-wrap: wrap;
}

.agent-card-embed {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.agent-card-embed-hint {
  margin: 0.75rem 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
}

.btn-embed-open {
  text-decoration: none;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
}

.btn-outline .ui-icon {
  width: 0.95rem;
  height: 0.95rem;
  opacity: 0.9;
}

.btn-outline:hover {
  border-color: var(--outline-hover);
}

.btn-test {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
}

.btn-test .ui-icon {
  width: 0.85rem;
  height: 0.85rem;
}

.btn-test .ui-icon--fill {
  color: var(--btn-on-accent);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--muted-dim);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
}

.btn-icon .ui-icon {
  width: 1.1rem;
  height: 1.1rem;
}

.btn-icon:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* Wizard */
.wizard-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
}

.wizard-overlay.open {
  display: flex;
}

.wizard-modal {
  width: 100%;
  max-width: 640px;
  background: var(--modal-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-height: calc(100vh - 3rem);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
}

.wizard-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.25rem 1.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.wizard-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.wizard-step-label {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.btn-text {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
}

.btn-text:hover {
  color: var(--text);
}

.btn-close {
  display: grid;
  place-items: center;
  padding: 0.35rem;
  border-radius: 8px;
}

.btn-close:hover {
  background: var(--close-hover);
}

.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  padding: 1rem 1.5rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.wiz-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
  text-align: center;
}

.wiz-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 2px solid var(--wiz-mark-ring);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted-dim);
  background: var(--wiz-mark-bg);
  position: relative;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.wiz-num,
.wiz-check {
  grid-area: 1 / 1;
}

.wiz-check {
  display: none;
  font-size: 0.75rem;
  color: var(--btn-on-accent);
}

.wiz-step.active .wiz-mark {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--btn-on-accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.wiz-step.active .wiz-num {
  display: block;
}

.wiz-step.active .wiz-check {
  display: none;
}

.wiz-step.done .wiz-mark {
  border-color: rgba(40, 184, 233, 0.55);
  background: rgba(40, 184, 233, 0.18);
  color: var(--accent);
}

.wiz-step.done .wiz-num {
  display: none;
}

.wiz-step.done .wiz-check {
  display: block;
  color: var(--accent);
}

.wiz-name {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-dim);
  line-height: 1.2;
}

.wiz-step.active .wiz-name {
  color: var(--accent);
}

.wiz-step.done .wiz-name {
  color: var(--muted);
}

.wiz-connector {
  flex: 0 0 1.25rem;
  height: 2px;
  background: var(--wiz-line);
  border-radius: 1px;
  margin-bottom: 1.35rem;
  transition: background 0.25s;
}

.wiz-connector.done {
  background: var(--wiz-connector-active);
}

.wizard-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.wiz-panel.hidden {
  display: none;
}

.wiz-h {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
}

.field-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--field-label-color);
  margin-bottom: 0.35rem;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.65rem;
}

.field-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

textarea.field-input {
  resize: vertical;
  min-height: 80px;
}

.purpose-grid,
.tone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
}

.tile-btn {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

.tile-btn:hover {
  border-color: var(--tile-hover-edge);
}

.tile-btn.selected {
  border-color: var(--accent);
  background: rgba(40, 184, 233, 0.08);
  box-shadow: 0 0 0 1px rgba(40, 184, 233, 0.28);
}

.tone-tile {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tile-title {
  font-weight: 600;
}

.tile-desc {
  font-size: 0.72rem;
  color: var(--muted);
}

.energy-bar {
  display: flex;
  gap: 0.5rem;
}

.energy-btn {
  flex: 1;
  padding: 0.55rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--elevated);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.energy-btn.selected {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(40, 184, 233, 0.08);
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
}

.lang-tile {
  text-align: center;
  padding: 0.55rem 0.4rem;
  font-size: 0.78rem;
}

.avatar-preset-panel {
  padding: 1rem 1rem 0.85rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(
    180deg,
    rgba(40, 184, 233, 0.04) 0%,
    var(--elevated) 28%
  );
  margin-bottom: 0.35rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.avatar-preset-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: min(58vh, 30rem);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.15rem 0.35rem 0.35rem 0;
  margin: 0 -0.15rem 0 0;
  scrollbar-gutter: stable;
}

.avatar-preset-grid::-webkit-scrollbar {
  width: 7px;
}

.avatar-preset-grid::-webkit-scrollbar-track {
  background: transparent;
}

.avatar-preset-grid::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.avatar-preset-grid::-webkit-scrollbar-thumb:hover {
  background: var(--muted-dim);
}

.avatar-preset-section {
  margin: 0;
}

.avatar-preset-section + .avatar-preset-section {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.avatar-preset-section-title {
  margin: 0 0 0.5rem;
  padding: 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text);
  opacity: 0.85;
}

.avatar-preset-section-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

@media (min-width: 520px) {
  .avatar-preset-section-tiles {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

.avatar-preset-tile {
  position: relative;
  text-align: center;
  padding: 0.5rem 0.35rem 0.55rem;
  min-height: 8.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--modal-surface, var(--elevated));
  color: inherit;
  font-family: inherit;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s,
    transform 0.12s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.avatar-preset-tile:hover {
  border-color: var(--tile-hover-edge);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.avatar-preset-tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.avatar-preset-tile.selected {
  border-color: var(--accent);
  background: rgba(40, 184, 233, 0.1);
  box-shadow:
    0 0 0 1px rgba(40, 184, 233, 0.35),
    0 6px 16px rgba(40, 184, 233, 0.12);
}

.avatar-preset-tile.selected::after {
  content: "✓";
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.avatar-preset-tile--robot .avatar-preset-img-wrap {
  background: #0f172a;
}

.avatar-preset-img-wrap {
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto 0.4rem;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: var(--chat-bubble-bg);
  border: 3px solid #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.14);
}

.avatar-preset-tile.selected .avatar-preset-img-wrap {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.avatar-preset-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.avatar-preset-tile--robot .avatar-preset-img-wrap img {
  object-fit: contain;
  object-position: center;
  padding: 6px;
}

.avatar-preset-label {
  display: block;
  font-weight: 600;
  font-size: 0.78rem;
  line-height: 1.25;
  max-width: 100%;
}

.avatar-preset-hint {
  display: block;
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.15rem;
  line-height: 1.2;
}

.avatar-preset-scroll-hint {
  margin: 0.5rem 0 0;
  font-size: 0.68rem;
  color: var(--muted-dim);
  text-align: center;
}

.voice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.65rem;
}

.voice-card {
  text-align: left;
  padding: 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--elevated);
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.12s;
}

.voice-card:hover {
  border-color: var(--tile-hover-edge);
}

.voice-card.selected {
  border-color: var(--accent);
  background: rgba(40, 184, 233, 0.06);
}

.voice-card-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.voice-card-desc {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  color: var(--agent-desc-muted);
  line-height: 1.35;
}

.voice-card-tags {
  margin: 0.45rem 0 0;
  font-size: 0.68rem;
  color: var(--muted);
}

.status-row {
  display: flex;
  gap: 1.25rem;
}

.radio-line {
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.wizard-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  gap: 1rem;
}

.wizard-foot-right {
  display: flex;
  gap: 0.5rem;
}

.hidden {
  display: none !important;
}

/* ——— Test console ——— */
.test-page {
  flex: 1;
  min-height: 100vh;
}

.test-col-left {
  padding: 1.5rem 1.25rem;
  border-right: 1px solid var(--border);
  background: var(--panel);
}

.test-col-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0;
}

.test-col-left .page-sub {
  margin-bottom: 1rem;
}

.agent-pick-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.agent-pick-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--elevated);
  color: inherit;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.12s, background 0.12s;
}

.agent-pick-row:hover {
  border-color: var(--pick-hover-edge);
}

.agent-pick-row.selected {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.agent-pick-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.agent-pick-role {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.agent-pick-owner {
  font-size: 0.7rem;
  color: var(--muted-dim);
  margin-top: 0.2rem;
}

.agent-pick-owner strong {
  color: var(--muted);
  font-weight: 600;
}

.empty-pick {
  color: var(--muted);
  font-size: 0.85rem;
}

.empty-pick a {
  color: var(--accent);
}

.test-col-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 480px;
}

.test-console {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 2rem 2rem;
}

.test-console-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.test-agent-name {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
}

.test-voice-line {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.badge-listening {
  display: inline-block;
  margin-top: 0;
  font-size: 0.7rem;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
}

.btn-end {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-end-ico {
  width: 1rem;
  height: 1rem;
  opacity: 0.85;
  flex-shrink: 0;
}

.btn-end:hover:not(:disabled) {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-end:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.test-console-visual {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

.mic-orb-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  display: grid;
  place-items: center;
  margin-bottom: 1.25rem;
}

.mic-orb-wrap.active .mic-orb-ring {
  animation: pulse-ring 2s ease-out infinite;
}

.mic-orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent-glow);
  opacity: 0;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.92);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

.mic-orb {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--mic-face-1), var(--mic-face-2));
  border: 1px solid var(--mic-orb-ring);
  display: grid;
  place-items: center;
  box-shadow: var(--mic-orb-shadow);
  z-index: 1;
}

.mic-orb-wrap.active .mic-orb {
  border-color: var(--mic-orb-active-ring);
  box-shadow: 0 0 44px var(--accent-glow);
}

.test-hint {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text);
}

.test-subhint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.test-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin: 1.5rem 0 1rem;
}

.ctrl-side {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--ctrl-muted-bg);
  cursor: not-allowed;
  opacity: 0.45;
  display: grid;
  place-items: center;
  padding: 0;
}

.ctrl-mic {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  background: var(--ctrl-mic-grad);
  color: var(--btn-on-accent);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 28px var(--accent-glow);
  transition: transform 0.1s, opacity 0.1s;
}

.ctrl-mic:hover:not(:disabled) {
  transform: scale(1.04);
}

.ctrl-mic:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.ctrl-mic-inner {
  font-size: 1.75rem;
}

.transcript-wrap {
  margin-top: auto;
  max-width: 560px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.transcript-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 0.4rem;
}

.transcript-panel {
  max-height: 140px;
}

.transcript-panel.transcript-chat {
  max-height: 280px;
}

.test-footnote {
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted-dim);
  margin: 1rem 0 0;
}

/* Shared SVG icons */
.ui-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  display: block;
}

.ui-icon.ui-icon--robot {
  object-fit: contain;
  border-radius: 6px;
}

.agent-card-icon .ui-icon--robot,
.agent-pick-ico .ui-icon--robot {
  width: 100%;
  height: 100%;
}

.test-agent-avatar .ui-icon--robot {
  width: 100%;
  height: 100%;
  border-radius: 12px;
}

.transcript-chat .tc-avatar .ui-icon--robot {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 6px;
}

.ui-icon.tile-ico {
  width: 1.75rem;
  height: 1.75rem;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

.tile-btn.selected .ui-icon.tile-ico {
  color: var(--accent);
}

.purpose-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.purpose-tile-label {
  font-weight: 600;
}

.tone-tile .tile-ico {
  margin-bottom: 0.4rem;
}

.energy-bar {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.energy-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 3.5rem;
}

.energy-btn .energy-ico {
  width: 1.35rem;
  height: 1.35rem;
  color: var(--muted);
}

.energy-btn.selected .energy-ico {
  color: var(--accent);
}

.energy-label {
  font-size: 0.82rem;
  font-weight: 600;
}

.lang-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.6rem 0.35rem;
}

.lang-tile-label {
  font-weight: 600;
  font-size: 0.8rem;
}

.lang-tile-native {
  font-size: 0.68rem;
  color: var(--muted-dim);
  line-height: 1.2;
}

.lang-tile.selected .lang-tile-native {
  color: rgba(40, 184, 233, 0.85);
}

/* Test: agent row & controls */
.test-console-id {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.test-agent-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.test-agent-avatar {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  background: rgba(40, 184, 233, 0.1);
  border: 1px solid rgba(40, 184, 233, 0.22);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--accent);
}

.test-agent-avatar .ui-icon {
  width: 1.45rem;
  height: 1.45rem;
}

.test-agent-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 12px;
  display: block;
  border: 2px solid #fff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

.test-agent-text {
  min-width: 0;
}

.mic-orb-svg {
  width: 2.25rem;
  height: 2.25rem;
  color: var(--accent);
}

.ctrl-mic-svg {
  width: 1.85rem;
  height: 1.85rem;
  color: var(--btn-on-accent);
}

.ctrl-ico {
  width: 1.2rem;
  height: 1.2rem;
  color: var(--muted);
}

.agent-pick-ico {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  background: var(--pick-ico-bg);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--accent);
}

.agent-pick-ico .ui-icon {
  width: 1.35rem;
  height: 1.35rem;
}

.agent-pick-ico--img {
  padding: 0;
  overflow: hidden;
}

.agent-pick-ico--img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 10px;
  display: block;
  border: 2px solid #fff;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.1);
}

.agent-pick-meta {
  flex: 1;
  min-width: 0;
}

.agent-pick-signal {
  flex-shrink: 0;
  color: var(--muted-dim);
  opacity: 0.65;
}

.agent-pick-signal .ui-icon {
  width: 1rem;
  height: 1rem;
}

.agent-pick-row.selected .agent-pick-signal {
  color: var(--accent);
  opacity: 1;
}

.empty-icon {
  background: var(--empty-icon-grad);
  border: 1px solid var(--empty-icon-border);
}

.empty-ico {
  width: 2.75rem;
  height: 2.75rem;
  color: var(--accent);
}

.transcript-chat .tc-avatar .ui-icon {
  width: 1.2rem;
  height: 1.2rem;
  color: var(--muted);
}

.transcript-chat .tc-agent .tc-avatar .ui-icon {
  color: var(--accent);
}

.transcript-chat .tc-user .tc-avatar .ui-icon {
  color: var(--transcript-user);
}

/* Conversation history (/conversations) */
.conv-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.conv-toolbar label {
  font-size: 0.85rem;
  color: var(--muted);
}

.conv-agent-select {
  min-width: 220px;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

.conv-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .conv-layout {
    grid-template-columns: 1fr;
  }
}

.conv-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: min(70vh, 520px);
  overflow-y: auto;
}

.conv-row {
  width: 100%;
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: background 0.12s, border-color 0.12s;
}

.conv-row:hover {
  background: var(--nav-hover-bg);
}

.conv-row.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow);
}

.conv-row-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.conv-row-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.conv-badge {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: var(--raised);
  color: var(--muted-dim);
}

.conv-detail-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  background: var(--panel);
}

.conv-detail-panel h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
}

.conv-detail-panel .conv-transcript.transcript-chat {
  max-height: min(52vh, 440px);
  margin-bottom: 1.25rem;
  border-radius: 10px;
  background: var(--elevated);
  border: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
}

.conv-audio-block {
  margin-bottom: 1rem;
}

.conv-audio-block--full {
  margin-top: 0.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.conv-audio-hint {
  margin: 0 0 0.75rem !important;
  font-size: 0.78rem !important;
}

.conv-audio-block h3 {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.conv-audio-block audio {
  width: 100%;
  max-width: 480px;
}

.error-inline {
  color: var(--danger);
  font-size: 0.9rem;
}
