:root {
  --bg: #0b0d13;
  --panel: #141824;
  --panel-2: #1a1f2e;
  --border: #262c3d;
  --text: #e8ebf2;
  --muted: #8b92a5;
  --accent: #6c8cff;
  --ok: #2fbf71;
  --err: #ff5c5c;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

.app { display: grid; grid-template-columns: 300px 1fr; height: 100vh; }

/* ---- sidebar ---- */
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 1.25rem;
  overflow-y: auto;
}

.brand { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 1.5rem; }
.logo { font-size: 2rem; }
.brand h1 { font-size: 1.15rem; margin: 0; }
.brand p { font-size: 0.72rem; color: var(--muted); margin: 0.1rem 0 0; }

.section { margin-bottom: 1.5rem; }
.section h2 { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 0.75rem; }

label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.75rem; }

select, input[type="number"] {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: 0.85rem;
}

.seats { display: flex; flex-direction: column; gap: 0.4rem; }
.seat-row { display: flex; gap: 0.6rem; align-items: center; padding: 0.4rem; border-radius: 8px; }
.seat-row:hover { background: var(--panel-2); }
.seat-meta { display: flex; flex-direction: column; }
.seat-name { font-size: 0.85rem; font-weight: 600; }
.seat-role { font-size: 0.7rem; color: var(--muted); }

/* ---- main ---- */
.main { display: flex; flex-direction: column; overflow: hidden; }

.composer { display: flex; gap: 0.75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.composer textarea {
  flex: 1;
  resize: none;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  font: inherit;
}

button {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 0.7rem 1.5rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }

#status { margin: 0.75rem 1.25rem 0; padding: 0.75rem; border-radius: 8px; font-size: 0.9rem; }
#status.loading { background: #1b2440; border: 1px solid var(--accent); }
#status.error { background: #3a1b1b; border: 1px solid var(--err); color: #ffb3b3; }

#results {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 1.25rem 1rem;
}

#verdict,
#transcript {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#verdict { overflow-y: auto; }

.transcript {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding-top: 1rem;
}

.message {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}

.msg-head { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.5rem; }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  border: 2px solid transparent;
  flex-shrink: 0;
}

.who { font-size: 0.88rem; font-weight: 600; }
.msg-content { font-size: 0.95rem; white-space: pre-wrap; }
.word.current { color: var(--accent); font-weight: 700; }

.dots { display: inline-flex; gap: 4px; padding: 6px 2px; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; padding-top: 1rem; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; }
.card.unavailable { border-color: var(--err); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.seat { font-weight: 600; }
.role { font-size: 0.75rem; color: var(--muted); }
.model { font-size: 0.72rem; color: var(--muted); margin: 0.25rem 0 0.5rem; word-break: break-all; }
.content { font-size: 0.9rem; white-space: pre-wrap; }
.rank { font-weight: 600; color: var(--accent); margin-top: 1rem; }
.synthesis { background: #14201a; border: 1px solid var(--ok); border-radius: 12px; padding: 1rem; white-space: pre-wrap; margin-top: 1rem; }

.conclusion {
  flex-shrink: 0;
  max-height: 42vh;
  overflow-y: auto;
  margin-top: 1rem;
  background: #1c1a10;
  border: 1px solid #eab308;
  border-left: 3px solid #eab308;
  border-radius: 12px;
  padding: 1rem;
}
.conclusion-head { display: flex; align-items: center; gap: 0.55rem; font-weight: 700; color: #eab308; margin-bottom: 0.5rem; }
.conclusion-body { font-size: 0.95rem; white-space: pre-wrap; }

.audio-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.25rem; font-size: 0.82rem; color: var(--muted); }
.audio-row input { accent-color: var(--accent); }

.hidden { display: none !important; }

/* ---- auth ---- */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #1b2440 0%, var(--bg) 60%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.auth-card {
  width: 360px;
  max-width: calc(100vw - 2rem);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
}
.auth-brand { margin-bottom: 1.25rem; }
.auth-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }
.auth-tab {
  flex: 1;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  font-weight: 600;
}
.auth-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.auth-card label { margin-bottom: 0.9rem; }
.auth-card input[type="email"],
.auth-card input[type="password"] {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem;
  font: inherit;
  font-size: 0.9rem;
}
.auth-card button[type="submit"] { width: 100%; margin-top: 0.25rem; }
.auth-error { color: var(--err); font-size: 0.82rem; margin: 0 0 0.75rem; }
.auth-foot { color: var(--muted); font-size: 0.75rem; text-align: center; margin-top: 1rem; }

.user-box { display: flex; flex-direction: column; gap: 0.6rem; }
.user-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text); }
.user-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.user-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-ghost {
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem;
  font-weight: 600;
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }
