:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111827;
  color: #f8fafc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(229, 57, 53, 0.24), transparent 34%),
    linear-gradient(315deg, rgba(180, 180, 180, 0.2), transparent 32%),
    #111827;
}

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(100%, 560px);
  min-height: 100vh;
  margin: 0 auto;
  background: rgba(15, 23, 42, 0.78);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.top-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.service-button {
  min-height: 34px;
  border: 1px solid rgba(94, 234, 212, 0.45);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(229, 57, 53, 0.16);
  color: #ffcdd2;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.service-button:hover {
  background: rgba(229, 57, 53, 0.28);
}

.service-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.eyebrow {
  margin: 0 0 4px;
  color: #E53935;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1;
}

.build-label {
  margin: 8px 0 0;
  color: #cbd5e1;
  font-size: 12px;
}

.status {
  border: 1px solid rgba(94, 234, 212, 0.45);
  border-radius: 999px;
  padding: 7px 11px;
  color: #ffcdd2;
  font-size: 12px;
  white-space: nowrap;
}

.composer-status {
  grid-column: 1 / -1;
  justify-self: end;
  min-height: 28px;
  padding: 5px 10px;
}

.conversation {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 18px;
}

.bubble {
  max-width: 86%;
  border-radius: 8px;
  padding: 12px 13px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}

.bubble span {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 800;
  color: #E53935;
}

.bubble p {
  margin: 0;
  color: #f8fafc;
  line-height: 1.45;
  white-space: pre-line;
}

.qr-code {
  display: block;
  max-width: 100%;
  margin: 10px 0 0;
  overflow-x: auto;
  border-radius: 6px;
  padding: 8px;
  background: #f8fafc;
  color: #020617;
  font-family: Consolas, "Courier New", monospace;
  font-size: 5px;
  line-height: 1;
  letter-spacing: 0;
  white-space: pre;
}

.bubble audio {
  display: block;
  width: 100%;
  margin-top: 10px;
}

.bubble-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-top: 12px;
  border-radius: 8px;
  padding: 0 14px;
  background: #E53935;
  color: #ffffff;
  font-weight: 800;
  text-decoration: none;
}

.bubble-action:hover {
  background: #C62828;
}

.bubble.user {
  align-self: flex-end;
  background: #f8fafc;
}

.bubble.user span,
.bubble.user p {
  color: #0f172a;
}

.bubble.madhi {
  align-self: flex-start;
  background: rgba(31, 41, 55, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.composer {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.92);
}

.input-stack {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.voice-tools {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 110px;
  gap: 8px;
}

.voice-tools select,
.composer input {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0 13px;
  background: rgba(17, 24, 39, 0.9);
  color: #f8fafc;
  font: inherit;
}

.voice-tools select {
  min-height: 34px;
  color: #cbd5e1;
  font-size: 13px;
}

.meter {
  align-self: stretch;
  min-height: 34px;
  overflow: hidden;
  border: 1px solid rgba(94, 234, 212, 0.35);
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.9);
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: #E53935;
  transition: width 80ms linear;
}

.icon-button,
.send-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.icon-button {
  background: #E53935;
  color: #ffffff;
}

.icon-button.listening {
  background: #C62828;
  color: #431407;
}

.send-button {
  padding: 0 16px;
  background: #f8fafc;
  color: #111827;
}

/* Commands panel */
.commands-toggle,
.contacts-button {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 0 11px;
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.commands-toggle:hover,
.contacts-button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
}

.commands-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  z-index: 10;
}

.commands-backdrop.open {
  display: block;
}

.contacts-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  overflow-y: auto;
  background: #0c1526;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  transform: translateX(100%);
  transition: transform 0.22s ease;
  z-index: 11;
  display: flex;
  flex-direction: column;
}

.contacts-panel.open {
  transform: translateX(0);
}

.contacts-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  z-index: 10;
}

.contacts-backdrop.open {
  display: block;
}

.contacts-list {
  padding: 8px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.contacts-empty {
  color: #475569;
  font-size: 13px;
  padding: 16px 0;
  text-align: center;
}

.contact-item {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.contact-item:last-child {
  border-bottom: 0;
}

.contact-name {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0 0 3px;
}

.contact-phone {
  font-size: 12px;
  color: #64748b;
  margin: 0;
  font-family: monospace;
}

.contact-alias {
  font-size: 11px;
  color: #475569;
  margin: 2px 0 0;
}

.commands-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 248px;
  overflow-y: auto;
  background: #0c1526;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  transform: translateX(100%);
  transition: transform 0.22s ease;
  z-index: 11;
  display: flex;
  flex-direction: column;
}

.commands-panel.open {
  transform: translateX(0);
}

.commands-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 18px 14px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  background: #0c1526;
  z-index: 1;
}

.commands-header span {
  font-size: 13px;
  font-weight: 800;
  color: #E53935;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.commands-close {
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 15px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
}

.commands-close:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.08);
}

.commands-list {
  padding: 6px 8px 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cmd-section {
  margin: 14px 0 4px;
  padding: 0 6px;
  color: #475569;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cmd-section:first-child {
  margin-top: 6px;
}

.cmd {
  text-align: left;
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  background: transparent;
  color: #94a3b8;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  line-height: 1.3;
}

.cmd:hover {
  background: rgba(229, 57, 53, 0.14);
  color: #f8fafc;
}

.cmd:active {
  background: rgba(229, 57, 53, 0.26);
}

@media (max-width: 420px) {
  .topbar {
    padding-top: 18px;
    align-items: flex-start;
  }

  .composer {
    grid-template-columns: 58px 1fr 64px;
    padding: 10px;
  }

  .voice-tools {
    grid-template-columns: 1fr;
  }
}
