:root {
  color-scheme: dark;
  font-family: 'Space Grotesk', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --bg: #05060a;
  --surface: #11111a;
  --card: #191a24;
  --border: rgba(255, 255, 255, 0.08);
  --primary: #8f7bff;
  --primary-contrast: #0b0b12;
  --text: #f8f8ff;
  --muted: rgba(255, 255, 255, 0.7);
  --accent: #48e6b6;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #17172b, #05060a);
  color: var(--text);
}

button {
  border: none;
  font: inherit;
  cursor: pointer;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 2rem;
  background: rgba(5, 6, 10, 0.7);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

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

.logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(143, 123, 255, 0.2);
  border: 1px solid rgba(143, 123, 255, 0.5);
  display: grid;
  place-items: center;
  font-weight: 600;
  color: var(--primary);
}

.logo-title {
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  margin: 0;
}
.logo-subtitle {
  margin: 0;
  font-size: 0.7rem;
  color: var(--muted);
}

.nav-links {
  display: flex;
  gap: 0.75rem;
  flex: 1;
  flex-wrap: wrap;
}

.nav-links button {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  transition: all 0.2s ease;
}
.nav-links button:hover,
.nav-links button.active {
  border-color: var(--border);
  color: var(--text);
}

.auth-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

main {
  padding: 2rem clamp(1rem, 4vw, 3rem) 4rem;
  display: grid;
  gap: 4rem;
}

.section {
  display: none;
  animation: fade 0.35s ease;
}
.section.visible {
  display: block;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero {
  background: linear-gradient(135deg, rgba(143, 123, 255, 0.15), rgba(72, 230, 182, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 32px;
  padding: clamp(1.5rem, 4vw, 3rem);
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.25);
}
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  margin-bottom: 1rem;
}
.hero p {
  color: var(--muted);
  max-width: 720px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}
.stats article {
  padding: 1rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
}
.stat-value {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 600;
}
.stat-label {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.8rem;
  color: var(--accent);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.card {
  border-radius: 24px;
  padding: 1.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 18px;
}

.primary,
.ghost {
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
}
.primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--primary-contrast);
}
.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.program-detail {
  display: grid;
  gap: 1.5rem;
}
.detail-head {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}
.detail-head img {
  width: min(380px, 100%);
  border-radius: 24px;
  border: 1px solid var(--border);
}
.detail-meta {
  flex: 1;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.coach-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1rem;
}
@media (max-width: 900px) {
  .coach-layout {
    grid-template-columns: 1fr;
  }
}
aside {
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 1rem;
  background: var(--card);
}
#chatSessionList {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
#chatSessionList li {
  padding: 0.6rem 0.7rem;
  border-radius: 16px;
  border: 1px solid transparent;
  cursor: pointer;
}
#chatSessionList li.active {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.05);
}

.chat-panel {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  min-height: 420px;
}
.chat-title {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.chat-messages {
  flex: 1;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  overflow-y: auto;
}
.bubble {
  max-width: 80%;
  padding: 0.75rem 1rem;
  border-radius: 18px;
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
}
.bubble.me {
  align-self: flex-end;
  background: var(--primary);
  color: #0d0d15;
}
.chat-form {
  display: flex;
  gap: 0.6rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}
.chat-form input {
  flex: 1;
  padding: 0.75rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
}

.progress-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.progress-card {
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 1rem;
  background: var(--card);
}
.progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  margin-top: 0.6rem;
}
.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--primary));
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}
.auth-card {
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 1.5rem;
  background: var(--card);
  display: grid;
  gap: 0.9rem;
}
.auth-card input,
.auth-card select,
.auth-card textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
}
.hint {
  color: var(--muted);
  font-size: 0.8rem;
}

.admin-form {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 24px;
  padding: 1.5rem;
  display: grid;
  gap: 1rem;
}
.admin-form label {
  display: grid;
  gap: 0.3rem;
  color: var(--muted);
}
.admin-form input,
.admin-form textarea,
.admin-form select {
  padding: 0.65rem 0.9rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
}

.table-wrapper {
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 0.8rem 1.1rem;
  border-radius: 14px;
  background: rgba(15, 16, 26, 0.95);
  border: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  transform: translateY(10px);
}
.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.back-button {
  margin-bottom: 1rem;
}

footer {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.voice-grid {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 1.5rem;
}
@media (max-width: 900px) {
  .voice-grid {
    grid-template-columns: 1fr;
  }
}
.voice-avatar,
.voice-log {
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 1.5rem;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.voice-avatar textarea {
  width: 100%;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  padding: 0.8rem;
}
.voice-avatar button.large {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.mic-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary-contrast);
}
.voice-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.voice-messages {
  min-height: 220px;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.voice-entry {
  padding: 0.75rem 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.voice-entry.agent {
  border-color: rgba(143, 123, 255, 0.4);
  background: rgba(143, 123, 255, 0.08);
}
.voice-entry span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.voice-entry p {
  margin: 0;
}

.voice-avatar {
  text-align: center;
}
.avatar-visual {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto 1rem;
}
.avatar-wave {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(143, 123, 255, 0.4);
  animation: pulse 3s infinite;
}
.avatar-wave.delay {
  animation-delay: 1.2s;
}
.avatar-core {
  position: absolute;
  inset: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 1.3rem;
  color: var(--primary-contrast);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.35);
}
.avatar-visual.listening .avatar-wave {
  animation-duration: 1.4s;
}
.avatar-visual.speaking .avatar-core {
  animation: bounce 1s infinite;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  30% {
    opacity: 0.8;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}
@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@media (max-width: 720px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
.muted {
  color: var(--muted);
}

.large {
  padding: 0.8rem 1.4rem;
  font-size: 1rem;
}
.small {
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
}
