:root {
  color-scheme: dark;
  --bg: #0b1e3a;
  --bg-card: #10294d;
  --bg-input: #0a1930;
  --text: #e7eefb;
  --muted: #93a5c4;
  --ok: #38b24a;
  --warn: #d9a413;
  --err: #e2503c;
  --accent: #3e7bd6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 0%, #123057 0%, var(--bg) 55%);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}

.shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--bg-card);
  border: 1px solid rgba(147, 165, 196, 0.25);
  border-radius: 14px;
  padding: 16px;
}

.login {
  max-width: 360px;
  margin: 12vh auto 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login h1,
.panel-header h1 {
  margin: 0;
  letter-spacing: 1px;
}

.subtitle {
  color: var(--muted);
  margin: 0;
}

label {
  font-size: 14px;
  color: var(--muted);
}

input {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid rgba(147, 165, 196, 0.35);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 16px;
  width: 100%;
}

button {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

button:hover:not(:disabled) {
  filter: brightness(1.15);
}

.primary {
  background: var(--accent);
  color: #ffffff;
}

.danger {
  background: var(--err);
  color: #ffffff;
}

.warn {
  background: var(--warn);
  color: #101010;
}

.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(147, 165, 196, 0.35);
}

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

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

.state-card {
  background: var(--bg-card);
  border: 1px solid rgba(147, 165, 196, 0.25);
  border-radius: 14px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.state-card h2 {
  font-size: 15px;
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.chip {
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(147, 165, 196, 0.2);
  white-space: nowrap;
}

.chip[data-status="ONLINE"],
.chip[data-status="RUNNING"],
.chip[data-status="CONNECTED"] {
  background: var(--ok);
  color: #06120a;
}

.chip[data-status="QR_REQUIRED"],
.chip[data-status="CONNECTING"],
.chip[data-status="STARTING"],
.chip[data-status="PENDING"] {
  background: var(--warn);
  color: #141006;
}

.chip[data-status="FAILED"],
.chip[data-status="DEGRADED"] {
  background: var(--err);
  color: #ffffff;
}

.chip[data-status="STOPPED"],
.chip[data-status="DISCONNECTED"] {
  background: rgba(147, 165, 196, 0.35);
  color: var(--text);
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
  margin: 6px 0;
}

.feedback.error {
  color: #ff9d90;
  background: rgba(226, 80, 60, 0.12);
  border-radius: 8px;
  padding: 8px 12px;
}

.add-row {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.blacklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.blacklist li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid rgba(147, 165, 196, 0.2);
  border-radius: 8px;
  padding: 10px 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.4px;
}

#qr-panel img {
  width: 100%;
  max-width: 320px;
  border-radius: 12px;
  background: #ffffff;
  display: block;
  margin: 12px auto 0;
}

dialog {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid rgba(147, 165, 196, 0.35);
  border-radius: 14px;
  padding: 20px;
  max-width: 340px;
  width: calc(100% - 32px);
}

dialog::backdrop {
  background: rgba(4, 10, 20, 0.75);
}

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

@media (min-width: 560px) {
  .states {
    grid-template-columns: repeat(3, 1fr);
  }

  .state-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* v4.0: idioma/llamadas, respuestas bilingües y registro de llamadas. */
.settings-row {
  display: grid;
  gap: 0.35rem;
  margin: 0.9rem 0;
}

.settings-row label {
  font-weight: 600;
  font-size: 0.92rem;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.switch-row input[type='checkbox'] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: #2563eb;
}

.responses li .lang-tag {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #0f172a;
}

.call-log {
  list-style: none;
  margin: 0.6rem 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.call-log-entry {
  display: grid;
  gap: 0.15rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid #dbe2ea;
  border-radius: 10px;
  background: #f8fafc;
}

.call-log-title {
  font-weight: 600;
  font-size: 0.92rem;
}
