:root {
  --bg: #120f0d;
  --panel: rgba(29, 22, 17, 0.82);
  --panel-strong: rgba(40, 29, 22, 0.92);
  --card: rgba(255, 248, 239, 0.05);
  --line: rgba(255, 231, 204, 0.12);
  --line-strong: rgba(255, 220, 175, 0.24);
  --text: #f8efe6;
  --muted: #bea78f;
  --accent: #f28f3b;
  --accent-soft: #f4b860;
  --success: #2db96b;
  --danger: #df5f4c;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
  --radius: 24px;
  --radius-sm: 18px;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", "Menlo", "Consolas", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--sans);
  background:
    radial-gradient(circle at top left, rgba(242, 143, 59, 0.16), transparent 34%),
    radial-gradient(circle at top right, rgba(223, 95, 76, 0.16), transparent 28%),
    linear-gradient(180deg, #19120e 0%, #120f0d 60%, #0d0a09 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent);
}

.shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 24px auto 48px;
  display: grid;
  gap: 18px;
}

.workspace-top {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(420px, 1fr);
  gap: 18px;
  align-items: stretch;
}

.workspace-side {
  display: grid;
  min-width: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  padding: 22px;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--accent-soft);
}

h2,
h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, background-color 120ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.ghost,
.chip,
.small-pill {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border: 1px solid var(--line);
}

.small-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
}

.call-ui {
  height: calc(100vh - 48px);
  min-height: 760px;
  position: sticky;
  top: 24px;
}

.phone-frame {
  height: 100%;
  border-radius: 0;
  padding: 8px 0 0;
  background: transparent;
  border: 0;
  display: grid;
  gap: 8px;
  grid-template-rows: auto 1fr;
}

.phone-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 8px;
}

.brand-block {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
}

.brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: 0 0 auto;
  pointer-events: none;
}

.status-icons {
  display: flex;
  align-items: center;
  justify-content: end;
  flex-wrap: wrap;
  gap: 10px;
}

.install-app-button {
  min-height: 34px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid rgba(255, 214, 168, 0.34);
  background: linear-gradient(135deg, rgba(244, 184, 96, 0.96), rgba(242, 143, 59, 0.94));
  color: #1d1009;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 14px 28px rgba(242, 143, 59, 0.2);
}

.install-app-button[hidden] {
  display: none;
}

.status-icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  display: grid;
  place-items: center;
}

.status-icon-button svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.status-icon-button.paused {
  background: linear-gradient(135deg, rgba(223, 95, 76, 0.92), rgba(242, 143, 59, 0.88));
  color: #180d09;
  border-color: rgba(255, 196, 160, 0.34);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
}

.connection-chip {
  color: #64d59a;
  width: 24px;
  height: 24px;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.connection-chip[data-state="connected"] {
  color: #64d59a;
}

.connection-chip[data-state="connecting"] {
  color: var(--accent-soft);
}

.connection-chip[data-state="closed"] {
  color: rgba(255, 255, 255, 0.5);
}

.connection-chip[data-state="error"] {
  color: var(--danger);
}

.connection-icon {
  width: 19px;
  height: 19px;
  overflow: visible;
  filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.2));
}

.connection-arc,
.connection-slash {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.connection-dot {
  fill: currentColor;
}

.connection-slash {
  display: none;
}

.connection-chip[data-state="closed"] .connection-slash,
.connection-chip[data-state="error"] .connection-slash {
  display: block;
}

.phone-screen {
  min-height: 0;
  height: 100%;
  border-radius: 32px;
  padding: 14px 14px 16px;
  background:
    radial-gradient(circle at top right, rgba(242, 143, 59, 0.12), transparent 24%),
    linear-gradient(180deg, rgba(31, 22, 17, 0.98), rgba(15, 11, 9, 0.98));
  border: 1px solid rgba(255, 220, 175, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 22px 42px rgba(0, 0, 0, 0.24);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
}

.contact-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 4px 2px 0;
}

.contact-avatar {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.34), transparent 36%),
    linear-gradient(135deg, #f3be63, #d97048 68%, #53352d);
  color: #1a110d;
  box-shadow: 0 10px 22px rgba(217, 112, 72, 0.22);
}

.contact-avatar-icon {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.95;
}

.contact-copy-block {
  min-width: 0;
}

.contact-name {
  display: block;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}

.contact-role {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.contact-debug-button {
  min-height: 32px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.call-feed {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  padding: 0 4px 0 0;
}

.call-feed::-webkit-scrollbar {
  width: 8px;
}

.call-feed::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.call-bubble {
  max-width: 78%;
  padding: 14px 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.call-bubble p {
  margin: 0;
  line-height: 1.45;
}

.call-live-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.call-live-text {
  flex: 1;
}

.recording-indicator {
  position: relative;
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border-radius: 999px;
  background: #ff7a63;
  box-shadow: 0 0 0 5px rgba(255, 122, 99, 0.18);
}

.recording-indicator::before {
  content: "";
  position: absolute;
  inset: -6px;
  border: 1px solid rgba(255, 122, 99, 0.35);
  border-radius: 999px;
  animation: record-pulse 1.35s ease-out infinite;
}

.call-bubble.player {
  justify-self: end;
  background: linear-gradient(135deg, rgba(242, 143, 59, 0.26), rgba(255, 255, 255, 0.08));
}

.call-bubble.player.live {
  background: linear-gradient(135deg, rgba(242, 143, 59, 0.34), rgba(255, 255, 255, 0.12));
  border-color: rgba(242, 143, 59, 0.35);
  box-shadow: 0 0 0 1px rgba(242, 143, 59, 0.16), 0 10px 24px rgba(0, 0, 0, 0.18);
}

.call-bubble.player.captured .recording-indicator {
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: none;
}

.call-bubble.player.captured .recording-indicator::before {
  display: none;
}

.call-bubble.assistant {
  justify-self: start;
  background: rgba(255, 255, 255, 0.08);
}

.call-bubble.assistant.thinking {
  min-width: 88px;
}

.call-thinking-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
}

.call-thinking-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.thinking-tool-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  line-height: 1.1;
  cursor: pointer;
}

.thinking-tool-chip.sent {
  border-color: rgba(244, 184, 96, 0.28);
  color: var(--accent-soft);
}

.thinking-tool-chip.done {
  border-color: rgba(127, 224, 172, 0.26);
  color: #9ce0b8;
}

.call-thinking-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(248, 239, 230, 0.8);
  animation: call-thinking-bounce 1s ease-in-out infinite;
}

.call-thinking-dot:nth-child(2) {
  animation-delay: 0.14s;
}

.call-thinking-dot:nth-child(3) {
  animation-delay: 0.28s;
}

.call-bubble.system {
  justify-self: center;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.call-stage {
  display: grid;
  gap: 12px;
  align-content: end;
  justify-items: stretch;
  padding: 10px 2px 2px;
}

.hero-call-button {
  width: 100%;
  min-height: 84px;
  border-radius: 28px;
  background: linear-gradient(135deg, var(--success), #77d39c);
  color: #0d0a09;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  box-shadow: 0 22px 40px rgba(45, 185, 107, 0.2);
}

.active-call-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding-bottom: 4px;
}

.active-call-actions[hidden] {
  display: none;
}

.call-mini {
  min-width: 128px;
  min-height: 48px;
}

.call-mini.skip {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid var(--line);
}

.call-mini.end {
  background: linear-gradient(135deg, #cb5a4a, #ef8b6d);
  color: #180d09;
}

.meta-label,
.metric-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.panel-header,
.history-head,
.text-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.settings-card {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.settings-stack {
  display: grid;
  gap: 12px;
  margin-top: 0;
}

.settings-stack .settings-card {
  margin: 0;
}

.settings-tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 22px;
}

.settings-tab {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.settings-tab.is-active {
  border-color: rgba(244, 184, 96, 0.34);
  background: linear-gradient(135deg, rgba(244, 184, 96, 0.22), rgba(255, 255, 255, 0.05));
  color: var(--text);
}

.settings-tabpanels {
  display: grid;
}

.settings-tabpanel {
  margin: 0;
}

.settings-tabpanel[hidden] {
  display: none;
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-section-reset {
  min-height: 34px;
  padding: 8px 14px;
  font-size: 0.82rem;
}

.settings-grid {
  display: grid;
  gap: 10px;
}

.settings-group-block[hidden] {
  display: none;
}

.settings-group-block {
  display: grid;
  gap: 14px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-field {
  display: grid;
  gap: 8px;
}

.settings-label {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.settings-hint {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.settings-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.voice-picker {
  position: relative;
}

.voice-picker-results {
  position: absolute;
  z-index: 3;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(24, 18, 14, 0.98);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.34);
}

.voice-picker-results[hidden] {
  display: none;
}

.voice-picker-option {
  width: 100%;
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  text-align: left;
}

.voice-picker-option:hover,
.voice-picker-option.is-active {
  border-color: rgba(244, 184, 96, 0.3);
  background: rgba(244, 184, 96, 0.08);
  transform: none;
}

.voice-picker-name {
  font-weight: 700;
}

.voice-picker-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.voice-picker-empty {
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.settings-range {
  width: 100%;
  accent-color: var(--accent-soft);
}

select.settings-select {
  width: 100%;
  min-height: 42px;
  padding: 10px 42px 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  appearance: none;
  -webkit-appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--text) 50%) calc(100% - 20px) calc(50% - 2px) / 7px 7px no-repeat,
    linear-gradient(135deg, var(--text) 50%, transparent 50%) calc(100% - 15px) calc(50% - 2px) / 7px 7px no-repeat,
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.04));
  color: var(--text);
  font: inherit;
  line-height: 1.3;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

select.settings-select.native-select-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

select.settings-select:focus,
.settings-input:focus {
  outline: none;
  border-color: rgba(244, 184, 96, 0.5);
  box-shadow:
    0 0 0 3px rgba(244, 184, 96, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

select.settings-select option {
  background: #211813;
  color: #f8efe6;
}

select.settings-select option:disabled {
  background: #211813;
  color: #9b8570;
}

.settings-input {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
}

.ts-wrapper {
  width: 100%;
  font: inherit;
  min-height: 0;
}

.ts-wrapper.single .ts-control,
.ts-wrapper.single.input-active .ts-control {
  min-height: 42px;
  padding: 10px 42px 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.ts-wrapper.single .ts-control::after {
  border-color: var(--text) transparent transparent;
  right: 16px;
  margin-top: -2px;
}

.ts-wrapper.single.dropdown-active .ts-control::after {
  border-color: transparent transparent var(--text);
  margin-top: -7px;
}

.ts-wrapper .ts-control,
.ts-wrapper .ts-control input {
  color: var(--text);
  font: inherit;
}

.ts-wrapper .ts-control input::placeholder {
  color: rgba(248, 239, 230, 0.55);
}

.ts-wrapper.focus .ts-control {
  border-color: rgba(244, 184, 96, 0.5);
  box-shadow:
    0 0 0 3px rgba(244, 184, 96, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.ts-dropdown {
  margin-top: 8px;
  z-index: 60;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(24, 18, 14, 0.98);
  color: var(--text);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.34);
  overflow: hidden;
}

.ts-dropdown .dropdown-input-wrap {
  padding: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ts-dropdown .dropdown-input {
  width: 100%;
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
}

.ts-dropdown .dropdown-input:focus {
  outline: none;
  border-color: rgba(244, 184, 96, 0.5);
}

.ts-dropdown .ts-dropdown-content {
  max-height: min(180px, 24vh);
  padding: 8px;
}

.ts-dropdown .option,
.ts-dropdown .create {
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--text);
}

.ts-dropdown .active,
.ts-dropdown .option:hover {
  background: rgba(244, 184, 96, 0.12);
  color: var(--text);
}

.ts-dropdown .selected {
  background: rgba(244, 184, 96, 0.18);
  color: var(--text);
}

.ts-option-row {
  display: grid;
  gap: 2px;
}

.ts-option-label {
  font-weight: 700;
}

.ts-option-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.ts-no-results {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.custom-select {
  position: relative;
}

.custom-select-trigger {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.04));
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.custom-select-trigger:focus {
  outline: none;
  border-color: rgba(244, 184, 96, 0.5);
  box-shadow:
    0 0 0 3px rgba(244, 184, 96, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.custom-select-trigger-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-trigger-icon {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  opacity: 0.85;
}

.custom-select.is-open .custom-select-trigger-icon {
  transform: rotate(225deg) translateY(-1px);
}

.custom-select-panel {
  position: absolute;
  z-index: 4;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: grid;
  gap: 8px;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(24, 18, 14, 0.98);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.34);
}

.custom-select-search {
  min-height: 40px;
}

.custom-select-options {
  max-height: 260px;
  overflow: auto;
  display: grid;
  gap: 6px;
}

.custom-select-option {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  text-align: left;
}

.custom-select-option:hover,
.custom-select-option.is-active {
  transform: none;
  border-color: rgba(244, 184, 96, 0.3);
  background: rgba(244, 184, 96, 0.08);
}

.custom-select-option:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.custom-select-empty {
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.settings-field.is-disabled {
  opacity: 0.6;
}

.settings-field.is-disabled .settings-input,
.settings-field.is-disabled select.settings-select,
.settings-field.is-disabled .ts-wrapper {
  cursor: not-allowed;
}

.settings-status {
  margin: 0;
  min-height: 1.3em;
  font-size: 0.84rem;
}

.error-text {
  color: #ffac9f;
}

.settings-refresh-button {
  min-height: 34px;
  padding: 8px 12px;
  font-size: 0.8rem;
}

.settings-value {
  min-width: 74px;
  justify-content: center;
}

.model-details {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
}

.model-details h4 {
  margin: 0;
  font-size: 0.98rem;
  font-family: var(--sans);
  font-weight: 700;
}

.model-details p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.model-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.model-meta-item {
  display: grid;
  gap: 4px;
}

.model-meta-item strong {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.model-meta-item span {
  font-size: 0.92rem;
}

.model-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.model-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.78rem;
}

.model-badge.warning {
  border-color: rgba(255, 172, 159, 0.36);
  color: #ffac9f;
}

.operations-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: end;
}

.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 12px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.inline-toggle input {
  accent-color: var(--accent-soft);
}

.collapse-button {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 0.8rem;
}

.history-nav-button {
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 1rem;
}

.operations {
  display: grid;
  gap: 18px;
  min-height: 100%;
}

.operations-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr);
  gap: 12px;
  align-items: start;
}

.summary-tile-event {
  min-height: 100%;
}

.summary-tile {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border-radius: var(--radius-sm);
  padding: 16px;
  display: grid;
  gap: 8px;
}

.summary-tile strong {
  font-size: 1rem;
}

.event-inline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.metric-card,
.card,
.history-card {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius-sm);
}

.card,
.history-card,
.metric-card {
  padding: 16px;
}

.accent {
  background:
    linear-gradient(135deg, rgba(242, 143, 59, 0.16), rgba(255, 255, 255, 0.04)),
    var(--card);
}

.summary-line,
.summary-copy,
.history-card p {
  margin: 0;
  line-height: 1.45;
}

.summary-line {
  font-weight: 600;
}

.summary-copy + .summary-copy {
  margin-top: 8px;
}

.event-response-list {
  display: grid;
  gap: 8px;
}

.event-response-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 4px;
}

.event-response-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.event-response-card strong {
  font-size: 0.95rem;
}

.event-response-card p {
  margin: 0;
  line-height: 1.45;
}

.event-response-effects {
  color: var(--muted);
  font-size: 0.84rem;
}

.event-response-card.selected {
  border-color: rgba(242, 143, 59, 0.45);
  background: linear-gradient(180deg, rgba(242, 143, 59, 0.12), rgba(255, 255, 255, 0.03));
}

.vitals-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.vital-tile {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  display: grid;
  gap: 4px;
}

.vital-value-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.vital-number {
  font-family: var(--mono);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.vital-delta {
  font-family: var(--mono);
  font-size: 0.88rem;
}

.vital-delta.positive {
  color: var(--success);
}

.vital-delta.negative {
  color: #ff9d8d;
}

.vital-delta.neutral {
  color: var(--muted);
}

.vital-tile[data-severity="good"] {
  border-color: rgba(45, 185, 107, 0.28);
}

.vital-tile[data-severity="good"] .vital-number {
  color: var(--success);
}

.vital-tile[data-severity="warn"] {
  border-color: rgba(242, 143, 59, 0.28);
}

.vital-tile[data-severity="warn"] .vital-number {
  color: var(--accent-soft);
}

.vital-tile[data-severity="danger"] {
  border-color: rgba(223, 95, 76, 0.28);
}

.vital-tile[data-severity="danger"] .vital-number {
  color: var(--danger);
}

.vital-tile[data-severity="neutral"] .vital-number {
  color: var(--text);
}

.metric-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.4;
  vertical-align: middle;
}

.metric-badge.policy {
  background: rgba(157, 197, 255, 0.12);
  color: #9dc5ff;
  border: 1px solid rgba(157, 197, 255, 0.2);
}

.metric-badge.queued {
  background: rgba(244, 184, 96, 0.12);
  color: var(--accent-soft);
  border: 1px solid rgba(244, 184, 96, 0.2);
}

.department-overview-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.department-overview-item {
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.department-overview-item:hover {
  transform: none;
  border-color: var(--line-strong);
}

.department-overview-item.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line-strong);
}

.department-overview-item strong {
  font-size: 0.98rem;
}

.department-overview-subtle {
  color: var(--muted);
  font-size: 0.8rem;
}

.department-board {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  margin-bottom: 16px;
}

.department-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.03));
  border-radius: var(--radius-sm);
  padding: 16px;
  display: grid;
  gap: 14px;
}

.department-head,
.department-stat,
.metric-detail {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.department-stats,
.metric-detail-list {
  display: grid;
  gap: 8px;
}

.department-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.metric-row {
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.metric-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.department-stat strong {
  font-size: 1.02rem;
}

.metric-with-delta {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.inline-delta {
  font-family: var(--mono);
  font-size: 0.88rem;
}

.inline-delta.positive {
  color: var(--success);
}

.inline-delta.negative {
  color: #ff9d8d;
}

.inline-delta.neutral {
  color: var(--muted);
}

.metric-detail-list {
  margin-top: 8px;
}

.metric-detail {
  font-size: 0.9rem;
}

.metric-detail strong {
  font-family: var(--mono);
}

.metric-detail.positive strong {
  color: var(--success);
}

.metric-detail.negative strong {
  color: #ff9d8d;
}

.metric-detail.neutral strong {
  color: var(--muted);
}

.breakdown-card {
  gap: 8px;
}

.list-view {
  display: grid;
  gap: 12px;
}

.debug-log {
  display: grid;
  gap: 10px;
  max-height: min(72vh, 760px);
  overflow: auto;
}

.debug-log.hide-tool-results .debug-entry[data-category="tool-result"] {
  display: none;
}

.debug-entry {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.debug-entry[hidden] {
  display: none;
}

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

.debug-entry p {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.debug-entry-content.collapsed {
  position: relative;
  max-height: 7.8em;
  overflow: hidden;
}

.debug-entry-content.collapsed::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 2.8em;
  background: linear-gradient(180deg, rgba(23, 17, 13, 0), rgba(23, 17, 13, 0.96));
  pointer-events: none;
}

.debug-expand-button {
  margin-top: 10px;
  padding: 7px 12px;
  min-height: 32px;
  font-size: 0.78rem;
}

.debug-kind,
.debug-time {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.debug-time {
  color: var(--muted);
}

.debug-entry.runtime .debug-kind {
  color: #9dc5ff;
}

.debug-entry.llm .debug-kind {
  color: #f4b860;
}

.debug-entry.system .debug-kind {
  color: #7fe0ac;
}

.debug-entry.player .debug-kind {
  color: #ffd79f;
}

.debug-entry.error .debug-kind {
  color: #ff9d8d;
}

.debug-entry.llm {
  border-color: rgba(244, 184, 96, 0.22);
  background: rgba(244, 184, 96, 0.06);
}

.debug-entry.system {
  border-color: rgba(127, 224, 172, 0.22);
  background: rgba(127, 224, 172, 0.06);
}

.debug-entry.error {
  border-color: rgba(255, 157, 141, 0.24);
  background: rgba(255, 157, 141, 0.06);
}

.history-head {
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.history-head span,
.history-subtle {
  color: var(--muted);
}

.output {
  margin: 12px 0 0;
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 0.92rem;
  line-height: 1.5;
  max-height: 320px;
  overflow: auto;
}

.raw {
  max-height: 420px;
}

.muted {
  color: var(--muted);
}

.memory-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
}

.memory-modal[hidden] {
  display: none;
}

.memory-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 6, 5, 0.72);
  backdrop-filter: blur(6px);
}

.memory-modal-panel {
  position: relative;
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(26, 20, 16, 0.96);
  box-shadow: var(--shadow);
}

.modal-panel-wide {
  width: min(980px, calc(100vw - 32px));
}

.modal-panel-medium {
  width: min(820px, calc(100vw - 32px));
}

#settingsModal {
  align-items: start;
  justify-items: center;
  padding-top: 18px;
}

.settings-modal-panel {
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  padding: 0;
  overflow: hidden;
}

.settings-modal-panel > .panel-header {
  position: relative;
  z-index: 1;
  padding: 20px 22px 0;
  margin: 0;
  background: linear-gradient(180deg, rgba(26, 20, 16, 0.98), rgba(26, 20, 16, 0.92));
}

.settings-modal-body {
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px 22px 22px;
}

.memory-modal-copy {
  margin: 10px 0 0;
}

.settings-modal-card {
  margin: 18px 0 0;
}

.debug-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 16px;
}

.debug-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
}

.debug-filter input {
  accent-color: var(--accent-soft);
}

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

@keyframes record-pulse {
  0% {
    opacity: 0.9;
    transform: scale(0.9);
  }

  70% {
    opacity: 0;
    transform: scale(1.35);
  }

  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

@keyframes call-thinking-bounce {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@media (max-width: 1100px) {
  .workspace-top {
    grid-template-columns: 1fr;
  }

  .operations-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .phone-statusbar {
    flex-direction: column;
    align-items: stretch;
  }

  .status-icons {
    justify-content: start;
  }

  .call-ui {
    position: static;
    height: auto;
    min-height: 0;
  }

  .workspace-side {
    grid-template-rows: auto auto;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 20px, 100%);
    margin-top: 12px;
  }

  .panel {
    padding: 18px;
  }

  .phone-screen {
    min-height: 560px;
    height: auto;
    padding: 18px;
  }

  .contact-strip {
    grid-template-columns: auto 1fr;
  }

  .contact-debug-button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .call-bubble {
    max-width: 92%;
  }

  .text-row,
  .panel-header,
  .history-head {
    flex-direction: column;
    align-items: stretch;
  }

  .vitals-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .department-overview-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .operations-summary {
    grid-template-columns: 1fr;
  }

  .memory-modal {
    padding: 12px;
  }

  #settingsModal {
    padding: 0;
  }

  .settings-modal-panel {
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .settings-modal-panel > .panel-header {
    padding: 16px 16px 0;
  }

  .settings-tabbar {
    padding: 0 16px;
  }

  .settings-modal-body {
    padding: 12px 16px 16px;
  }
}
