/* WaveTalk — premium minimal UI */
:root {
  --bg: #060608;
  --bg-elevated: #0c0c10;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.1);
  --text: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  --accent: #c4b5fd;
  --accent-dim: rgba(196, 181, 253, 0.15);
  --accent-glow: rgba(167, 139, 250, 0.35);
  --voice: #fda4af;
  --voice-glow: rgba(253, 164, 175, 0.4);
  --success: #86efac;
  --danger: #fca5a5;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-full: 999px;
  --font: "Outfit", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --topbar-h: 64px;
  --max-w: 720px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  letter-spacing: -0.01em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(167, 139, 250, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(253, 164, 175, 0.06), transparent),
    radial-gradient(ellipse 50% 30% at 0% 80%, rgba(125, 211, 252, 0.05), transparent);
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.page {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px 48px;
}

.page-narrow { max-width: 420px; }

/* —— Typography —— */
.overline {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.display {
  margin: 0;
  font-size: clamp(2.25rem, 5.5vw, 3.25rem);
  font-weight: 300;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.display em {
  font-style: normal;
  font-weight: 500;
  background: linear-gradient(135deg, #e9d5ff 0%, #fda4af 50%, #a5f3fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  margin: 16px 0 0;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 28em;
}

.section-label {
  margin: 40px 0 12px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

h1.page-title {
  margin: 8px 0 0;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

h1.page-title span {
  font-weight: 300;
  color: var(--text-secondary);
}

/* —— Topbar —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--topbar-h);
  padding: 0 20px;
  background: rgba(6, 6, 8, 0.72);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(1.2);
}

.topbar-start { display: flex; align-items: center; justify-self: start; }
.topbar-center { display: flex; flex-direction: column; align-items: center; justify-self: center; min-width: 0; }
.topbar-end { display: flex; align-items: center; gap: 4px; justify-self: end; }

.topbar-title {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(145deg, #a78bfa, #f9a8d4);
  box-shadow: 0 0 24px var(--accent-glow);
}

.brand-text {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--border-strong);
}

/* —— Icon buttons —— */
.ico { display: block; flex-shrink: 0; }

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s var(--ease), background 0.2s var(--ease), transform 0.15s var(--ease);
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.icon-btn:active { transform: scale(0.94); }

.icon-btn-accent {
  color: var(--accent);
  background: var(--accent-dim);
}

.icon-btn-accent:hover {
  background: rgba(196, 181, 253, 0.22);
  color: #e9d5ff;
}

.icon-btn-lg {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
}

.icon-btn-voice {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-full);
  color: #fff;
  background: linear-gradient(145deg, #fb7185, #f472b6);
  box-shadow: 0 0 48px var(--voice-glow), inset 0 1px 0 rgba(255,255,255,0.2);
}

.icon-btn-voice:hover {
  color: #fff;
  background: linear-gradient(145deg, #fda4af, #f9a8d4);
  box-shadow: 0 0 64px var(--voice-glow);
}

.icon-btn-voice.active {
  transform: scale(1.06);
  box-shadow: 0 0 72px var(--voice-glow);
}

.inline-form { display: inline; margin: 0; }

[data-tip] { position: relative; }

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s var(--ease);
  z-index: 100;
}

[data-tip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* —— Landing —— */
.landing {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px 80px;
  min-height: calc(100dvh - var(--topbar-h));
}

.landing-cta {
  margin-top: 40px;
}

/* —— Auth —— */
.auth-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px 64px;
  min-height: calc(100dvh - var(--topbar-h));
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 40px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(24px);
}

.auth-card h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.auth-card .lead { margin-top: 8px; font-size: 14px; }

.auth-hint {
  margin-top: 16px;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-tertiary);
  background: rgba(0,0,0,0.25);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.auth-error {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--danger);
  text-align: center;
}

.auth-footer {
  margin-top: 28px;
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary);
}

.auth-footer a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: 6px;
  vertical-align: middle;
  color: var(--accent);
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.auth-footer a:hover { background: var(--accent-dim); text-decoration: none; }

/* —— Forms —— */
.field {
  margin-top: 20px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.input {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input::placeholder { color: var(--text-tertiary); }

.input:focus {
  border-color: rgba(196, 181, 253, 0.4);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Selects inherit WaveTalk dark dropdowns when both stylesheets load */
select.input {
  appearance: none;
  -webkit-appearance: none;
  color-scheme: dark;
  background-color: #0c1224;
  color: var(--text);
  cursor: pointer;
}

select.input option {
  background-color: #07070f;
  color: var(--text);
}

.form-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 24px;
}

.form-row .input { flex: 1; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* —— Channel list —— */
.channel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}

.channel-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}

.channel-row:last-child { border-bottom: none; }

.channel-row:hover { background: var(--surface-hover); }

.channel-row.is-pinned { background: rgba(196, 181, 253, 0.04); }

.channel-name {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.channel-name::before {
  content: "#";
  color: var(--text-tertiary);
  font-weight: 400;
  margin-right: 2px;
}

.channel-desc {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-tertiary);
  line-height: 1.4;
}

.channel-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.pin-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 8px;
  box-shadow: 0 0 8px var(--accent-glow);
}

.create-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
  padding: 6px 6px 6px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.create-bar .input {
  flex: 1;
  padding: 10px 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.create-bar .input:focus { box-shadow: none; border: none; }

/* —— Chat —— */
.channel-page .app-shell { height: 100dvh; overflow: hidden; }

.channel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.msg {
  max-width: 72%;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.55;
  border-radius: var(--radius-lg);
  word-break: break-word;
}

.msg.mine {
  align-self: flex-end;
  background: linear-gradient(145deg, rgba(167, 139, 250, 0.35), rgba(244, 114, 182, 0.2));
  border: 1px solid rgba(196, 181, 253, 0.2);
  border-bottom-right-radius: 6px;
}

.msg.theirs {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
}

.msg .name {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 20px;
  border-top: 1px solid var(--border);
  background: rgba(6, 6, 8, 0.85);
  backdrop-filter: blur(16px);
}

.composer .input {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--radius-full);
  background: var(--surface);
}

.voice-dock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 32px;
  border-top: 1px solid var(--border);
}

.voice-hint {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* —— Admin —— */
.admin-dock {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 12px 16px 24px;
  flex-wrap: wrap;
}

.admin-dock a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  color: var(--text-tertiary);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.2s var(--ease);
}

.admin-dock a:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.admin-dock a.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: rgba(196, 181, 253, 0.2);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 8px;
}

@media (min-width: 520px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
  padding: 20px 16px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat-card .overline { margin-bottom: 8px; }

.stat-value {
  font-size: 28px;
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1;
}

.data-table {
  width: 100%;
  margin-top: 16px;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table .cell-muted { color: var(--text-tertiary); font-size: 13px; }

.table-wrap {
  margin-top: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}

.table-actions {
  display: flex;
  gap: 2px;
  justify-content: flex-end;
}

.admin-create {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding: 6px 6px 6px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
}

.admin-create .input {
  flex: 1;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 10px 0;
}

/* —— Toast —— */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-full);
  z-index: 200;
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(12px);
  animation: toast-in 0.4s var(--ease);
}

.toast-ok {
  background: rgba(6, 6, 8, 0.9);
  color: var(--success);
}

.toast-err {
  background: rgba(6, 6, 8, 0.9);
  color: var(--danger);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 14px;
}
