/* QMAI Labs theme — aligned with qmai-web-v2 (dark · gold · teal) */
:root {
  --bg: #050506;
  --panel: #0f1118;
  --panel-soft: #161a24;
  --ink: #f2f4ff;
  --muted: #9ba3b4;
  --accent: #c9a24a;
  --accent2: #e0bc62;
  --teal: #7ee0c2;
  --blue: #8fb7ff;
  --line: rgba(201, 162, 74, 0.22);
  --good: #3ecf8e;
  --warn: #e6b84d;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(90% 80% at 12% -8%, rgba(201, 162, 74, 0.14), transparent 48%),
    radial-gradient(70% 60% at 92% 8%, rgba(126, 224, 194, 0.07), transparent 50%),
    linear-gradient(180deg, #06070d 0%, var(--bg) 100%);
  color: var(--ink);
}
body {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

header.app-bar {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15, 17, 24, 0.96) 0%, rgba(5, 5, 6, 0.92) 100%);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}
header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
header .brand img { width: 28px; height: 28px; }
header .sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}
header .tenant {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
select, button, input, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
button,
select,
input {
  min-height: 44px;
}
button {
  background: linear-gradient(180deg, var(--accent2), var(--accent));
  border: none;
  font-weight: 600;
  cursor: pointer;
  color: #07080d;
  box-shadow: 0 0 0 1px rgba(201, 162, 74, 0.18), 0 8px 24px rgba(0, 0, 0, 0.35);
}
button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}

nav.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 72px;
  z-index: 4;
}
nav.tabs button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 8px 4px;
  font-size: 12px;
  border-radius: 10px;
}
nav.tabs button.active {
  color: var(--ink);
  border-color: var(--line);
  background: var(--panel);
}

main {
  flex: 1;
  padding: 12px 14px calc(18px + var(--safe-bottom));
  overflow: auto;
}
.panel { display: none; }
.panel.active { display: block; }
.panel:focus { outline: none; }

.card {
  background: linear-gradient(165deg, rgba(22, 26, 36, 0.95), rgba(15, 17, 24, 0.98));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
}
.card h2 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 650;
}
.muted { color: var(--muted); font-size: 13px; line-height: 1.45; }
.pill {
  display: inline-block;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  margin: 2px 4px 2px 0;
}
.pill.good { color: var(--good); border-color: rgba(62, 207, 142, 0.35); }
.pill.warn { color: var(--warn); border-color: rgba(230, 184, 77, 0.35); }

/* Chat */
.chat-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 42vh;
  max-height: 52vh;
  overflow: auto;
  padding: 4px 2px 12px;
}
.bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble.me {
  align-self: flex-end;
  background: rgba(194, 103, 63, 0.28);
  border: 1px solid rgba(239, 143, 60, 0.35);
}
.bubble.them {
  align-self: flex-start;
  background: var(--panel);
  border: 1px solid var(--line);
}
.bubble .meta {
  font-size: 10px;
  color: var(--muted);
  margin-top: 6px;
}
.chat-compose {
  display: grid;
  gap: 8px;
  position: sticky;
  bottom: 0;
  padding-top: 8px;
  background: linear-gradient(180deg, transparent, var(--bg) 24%);
}
.chat-compose textarea {
  min-height: 72px;
  resize: vertical;
  width: 100%;
}
.chat-card { padding-bottom: 8px; }
.compose-meta { margin-bottom: 6px; }
.compose-label {
  margin: 0;
  flex: 0 0 auto;
  align-self: center;
}
.compose-select { flex: 1; }
.mic-status { font-size: 11px; margin: 4px 0 0; }
.stage-link { color: var(--accent2); }
.surface-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.surface-tab.active {
  color: var(--ink);
  border-color: rgba(126, 224, 194, 0.45);
  background: rgba(126, 224, 194, 0.1);
}
.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.row > * { flex: 1; }
.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.feature-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.feature-list li span:last-child {
  color: var(--good);
  font-size: 11px;
  white-space: nowrap;
}
.compare {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.price-tier {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
  background: #12151c;
}
.price-tier.featured {
  border-color: rgba(239, 143, 60, 0.55);
  box-shadow: 0 0 0 1px rgba(194, 103, 63, 0.25);
}
.price-tier h3 { margin: 0 0 4px; font-size: 15px; }
.price-tier .amt { font-size: 22px; font-weight: 700; color: var(--accent2); }
.price-tier ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; }

.login-gate {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 18px;
  gap: 12px;
}
.login-gate h1 { font-size: 22px; margin: 0; }
.auth-logo { width: 48px; height: 48px; }
.hidden { display: none !important; }
.auth-card { text-align: left; }
.auth-tabs { margin-bottom: 12px; }
.auth-tabs button { flex: 1; font-size: 12px; }
.auth-tabs button.active {
  color: var(--ink);
  border-color: rgba(239, 143, 60, 0.45);
  background: rgba(194, 103, 63, 0.15);
}
.auth-form input, .auth-form select, .auth-form button { width: 100%; margin-top: 4px; }
.form-submit { width: 100%; margin-top: 12px; }
.compact-copy { margin: 0 0 10px; font-size: 12px; }
.signup-result { margin-top: 12px; background: #12151c; }
.recovery-codes {
  font-size: 11px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--accent2);
}
.install-panel {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.install-panel button { width: 100%; }
.lbl { display: block; font-size: 11px; color: var(--muted); margin-top: 10px; }
.err { color: #ff8f8f; font-size: 13px; margin-top: 10px; }
.pilot-stack { display: grid; gap: 8px; }
.pilot-btn {
  display: grid;
  gap: 2px;
  text-align: left;
  background: #12151c;
  border: 1px solid var(--line);
  padding: 12px;
}
.pilot-btn strong { font-size: 14px; }
.warn-box {
  border-color: rgba(230, 184, 77, 0.4);
  background: rgba(230, 184, 77, 0.08);
  margin-bottom: 10px;
}
code { font-size: 11px; color: var(--accent2); }
#btn-mic.active {
  border-color: rgba(239, 143, 60, 0.7);
  color: var(--accent2);
  box-shadow: 0 0 0 1px rgba(194, 103, 63, 0.35);
}

.ai-disclosure,
.transparency-panel {
  border: 1px solid rgba(126, 224, 194, 0.34);
  background: rgba(126, 224, 194, 0.08);
  border-radius: 14px;
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.ai-disclosure strong { color: var(--ink); }
.ai-disclosure a,
.transparency-panel a,
.legal-links a,
.policy-check a { color: var(--accent2); }
.transparency-panel { margin: 10px 0; }
.transparency-panel summary { color: var(--teal); cursor: pointer; font-weight: 650; }
.policy-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.policy-check input { width: auto; margin: 2px 0 0; flex: 0 0 auto; }
.data-receipt {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}
.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px calc(18px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}
.legal-links--inline { padding: 6px 0 0; border-top: 0; }
.policy-page {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 48px 18px;
}
.policy-page h1 { margin: 8px 0 24px; font-size: clamp(28px, 8vw, 48px); }
.policy-kicker { color: var(--teal); text-transform: uppercase; letter-spacing: .12em; font-size: 11px; }
.policy-copy h2 { margin: 24px 0 6px; font-size: 16px; color: var(--ink); }
.policy-copy h2:first-child { margin-top: 0; }
.policy-copy p { margin: 0; color: var(--muted); line-height: 1.65; font-size: 14px; }
.usage-list {
  display: grid;
  gap: 6px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}
.usage-list strong { color: var(--ink); }
.status-pills { margin-top: 10px; }
.activation-list {
  list-style: none;
  padding: 0;
  margin: 8px 0;
  display: grid;
  gap: 8px;
}
.activation-list li {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}
.activation-list strong {
  color: var(--warn);
  text-align: right;
  overflow-wrap: anywhere;
}
.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;
}

@media (max-width: 360px) {
  nav.tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  nav.tabs { position: static; }
  .surface-tabs { grid-template-columns: 1fr; }
  .activation-list li { flex-direction: column; }
  .activation-list strong { text-align: left; }
}
