
/* Voice Studio — base layer: reset, layout shell, typography, components */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  color: var(--text-primary);
  background: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  transition: background var(--dur-base) var(--ease), color var(--dur-base) var(--ease);
}

h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; letter-spacing: -0.01em; color: var(--text-primary); }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img, svg { display: block; max-width: 100%; }

::selection { background: var(--accent-200); }

/* Scrollbar (webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink-200); border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-300); }

/* ---------- Ambient backdrop (behind the workspace canvas) ---------- */

.app-bg-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.app-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--app-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--app-grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, black, transparent 75%);
  transition: background-image var(--dur-base) var(--ease);
}

.app-bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: var(--app-blob-opacity);
  will-change: transform;
  transition: opacity var(--dur-base) var(--ease), background var(--dur-base) var(--ease);
}
.app-bg-blob-1 {
  width: 640px; height: 460px;
  left: calc(50% + (var(--sidebar-w) / 2));
  margin-left: -320px;
  top: -230px;
  background: var(--app-blob-color-1);
  animation: app-blob-float-1 15s ease-in-out infinite;
}
.app-bg-blob-2 {
  width: 440px; height: 440px;
  right: -60px;
  top: 140px;
  background: var(--app-blob-color-2);
  animation: app-blob-float-2 18s ease-in-out infinite;
}
.app-bg-blob-3 {
  width: 420px; height: 420px;
  left: 38%;
  bottom: -220px;
  background: var(--app-blob-color-3);
  animation: app-blob-float-3 20s ease-in-out infinite;
}

@keyframes app-blob-float-1 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(70px, 55px) scale(1.18); } }
@keyframes app-blob-float-2 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-65px, 60px) scale(0.88); } }
@keyframes app-blob-float-3 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(55px, -55px) scale(1.12); } }

.app-bg-particles { position: absolute; inset: 0; }
.app-bg-particle {
  position: absolute;
  bottom: -20px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--app-particle-color);
  box-shadow: 0 0 6px 1px var(--app-particle-color);
  animation-name: app-particle-float;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes app-particle-float {
  0% { transform: translateY(0) scale(1); opacity: 0; }
  12% { opacity: 0.9; }
  85% { opacity: 0.35; }
  100% { transform: translateY(-85vh) scale(0.4); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .app-bg-blob, .app-bg-particle { animation: none; }
}

/* ---------- App shell ---------- */

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

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  color: var(--text-on-dark);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  transition: transform var(--dur-base) var(--ease);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 28px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-name {
  font-weight: 700;
  font-size: var(--fs-md);
  color: white;
  letter-spacing: -0.01em;
}

.nav-group-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-on-dark-muted);
  padding: 8px 12px 6px;
}

.nav-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 2px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-on-dark-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  position: relative;
}

.nav-link .nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-link:hover { background: var(--bg-sidebar-hover); color: var(--text-on-dark); }

.nav-link.active {
  background: var(--bg-sidebar-hover);
  color: white;
}
.nav-link.active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: var(--radius-pill);
  background: var(--accent-400);
}

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.08);
  color: var(--text-on-dark-muted);
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 10px;
  min-width: 0;
}
.sidebar-account-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-500);
  color: white;
  font-weight: 700;
  font-size: var(--fs-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-account-info { min-width: 0; }
.sidebar-account-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-account-email {
  font-size: var(--fs-xs);
  color: var(--text-on-dark-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  color: var(--text-on-dark-muted);
  padding: 6px 0;
}
.sidebar-footer-link:hover { color: var(--text-on-dark); }

/* ---------- Main column ---------- */

.main-col {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 30;
  transition: background var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}

.topbar-actions-group { display: flex; align-items: center; gap: 10px; }

.credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--accent-50);
  color: var(--accent-700);
  border: 1px solid var(--accent-200);
  font-size: var(--fs-sm);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.credit-pill-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-600);
}
button.credit-pill {
  font-family: inherit;
  cursor: pointer;
}
button.credit-pill:hover { border-color: var(--accent-400); }
.credit-bill { max-width: 760px; }
.credit-equation {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px 12px;
  align-items: end;
  padding-bottom: 16px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
}
.credit-equation-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.credit-equation-value {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent-500);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.credit-equation-op {
  font-weight: 700;
  color: var(--text-muted);
  padding-bottom: 2px;
}
.credit-bill-list { max-height: 340px; overflow: auto; }
.credit-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.credit-entry-label { font-weight: 700; }
.credit-entry-time {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: var(--fs-xs);
}
.credit-entry-amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.credit-entry-amount.is-credit { color: var(--teal-600); }
.credit-bill-empty {
  padding: 28px 0 12px;
  text-align: center;
  color: var(--text-secondary);
}
.credit-bill-note {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: var(--fs-xs);
}
@media (max-width: 720px) {
  .credit-equation { grid-template-columns: 1fr 1fr; }
  .credit-equation-op { display: none; }
}
.upgrade-btn.is-current {
  background: var(--accent-700);
  box-shadow: none;
  pointer-events: none;
}
:root[data-theme="dark"] .credit-pill {
  color: var(--accent-200);
  border-color: var(--accent-700);
}
:root[data-theme="dark"] .credit-pill-label { color: var(--accent-300); }

.theme-toggle {
  position: relative;
  overflow: hidden;
}
.theme-toggle .theme-icon-sun,
.theme-toggle .theme-icon-moon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
}
.theme-toggle .theme-icon-moon { opacity: 0; transform: translate(-50%, -50%) rotate(-90deg) scale(0.4); }
:root[data-theme="dark"] .theme-toggle .theme-icon-sun { opacity: 0; transform: translate(-50%, -50%) rotate(90deg) scale(0.4); }
:root[data-theme="dark"] .theme-toggle .theme-icon-moon { opacity: 1; transform: translate(-50%, -50%) rotate(0) scale(1); }

.topbar-title { font-size: var(--fs-lg); font-weight: 700; }
.topbar-subtitle { font-size: var(--fs-sm); color: var(--text-secondary); margin-top: 2px; }

.menu-toggle {
  display: none;
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.content {
  flex: 1;
  padding: 32px;
  max-width: var(--content-max-w);
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main-col { margin-left: 0; }
  .menu-toggle { display: flex; }
  .content { padding: 20px; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 720px) {
  .topbar {
    height: auto;
    min-height: var(--topbar-h);
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }
  .topbar > div:first-child { min-width: 0; flex: 1; }
  .topbar-title {
    font-size: var(--fs-base);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-subtitle { display: none; }
  .topbar-actions-group { gap: 6px; }
  .credit-pill-label { display: none; }
  .credit-pill { padding: 6px 10px; }
  .content { padding: 16px 12px 32px; }
  .card { padding: 16px; }
  .speech-layout { gap: 16px; }
  .textarea { min-height: 160px; }
  .input, .select, .textarea { font-size: 16px; }
  .history-list { max-height: none; }
  .history-item { align-items: flex-start; }
  .modal-overlay { padding: 12px; align-items: flex-end; }
  .modal-panel { max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .voice-row { flex-wrap: wrap; }
  .voice-row .btn { margin-left: auto; }
}

.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 16, 0.4);
  z-index: 39;
}
.sidebar-scrim.visible { display: block; }

/* ---------- Page structure ---------- */

.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: var(--fs-2xl); }
.page-header p { color: var(--text-secondary); margin-top: 6px; font-size: var(--fs-base); }

.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  align-items: start;
}

.speech-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 980px) {
  .speech-layout { grid-template-columns: 1fr; }
}

.history-panel { position: sticky; top: 88px; }
.scroll-together .history-panel { position: static; }

.side-tabs {
  display: flex;
  gap: 18px;
  border-bottom: 1px solid var(--border-subtle);
  margin: -6px 0 18px;
}
.side-tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 8px 2px 10px;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}
.side-tab.active { color: var(--text-primary); border-bottom-color: var(--accent-500); }
.settings-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: 8px;
}
.voice-picker {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
  color: var(--text-primary);
  cursor: pointer;
}
.voice-picker:hover { border-color: var(--accent-400); }
.voice-picker-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.voice-picker-name { font-weight: 600; font-size: var(--fs-sm); }
.voice-picker-meta { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }
.voice-modifier {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}
.modifier-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px 12px;
  margin-top: 14px;
}
.modifier-name { font-size: var(--fs-sm); font-weight: 600; }
.modifier-value {
  font-size: var(--fs-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}
.modifier-slider {
  grid-column: 1 / -1;
  width: 100%;
  margin: 0;
  appearance: none;
  height: 4px;
  border-radius: var(--radius-pill);
  background: linear-gradient(to right, var(--text-primary) var(--fill, 0%), var(--ink-300) var(--fill, 0%));
  outline: none;
  cursor: pointer;
}
.modifier-slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink-800);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.modifier-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink-800);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.modifier-slider::-moz-range-track {
  height: 4px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--ink-300);
}
.voice-swap {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--accent-600);
  background: var(--accent-50);
}
.voice-swap svg { width: 18px; height: 18px; }
.voice-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--accent-400), var(--accent-700));
}
.voice-modal { max-width: 640px; }
.voice-tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 14px; }
.voice-tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 8px 2px 10px;
  font: inherit;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}
.voice-tab.active { color: var(--text-primary); border-bottom-color: var(--text-primary); }
#voiceSearch { margin-bottom: 14px; }
.voice-list { display: flex; flex-direction: column; gap: 8px; min-height: 180px; }
.voice-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
}
.voice-row-copy { flex: 1; min-width: 0; }
.voice-row-name { font-weight: 600; }
.voice-row-meta { margin-top: 2px; font-size: var(--fs-xs); color: var(--text-muted); }
.voice-row-source { margin-top: 2px; font-size: var(--fs-xs); color: var(--text-muted); }
.voice-photo {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
}
.voice-play {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: var(--ink-100);
  color: var(--text-primary);
  cursor: pointer;
  flex-shrink: 0;
}
.grid-2 .history-panel { margin-top: 24px; position: static; }
.history-note { margin-bottom: 14px; }
.history-list { display: flex; flex-direction: column; gap: 6px; max-height: 70vh; overflow: auto; }
.history-day {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin: 8px 2px 2px;
}
.history-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
}
.history-play {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent-500);
  color: white;
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
}
.history-text {
  font-size: var(--fs-sm);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-meta { margin-top: 2px; font-size: 11px; color: var(--text-muted); }
.history-body { flex: 1; min-width: 0; }
.history-download {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-50);
  color: var(--accent-400);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}
.history-download:hover { filter: brightness(1.25); }
.history-item audio { display: none; }
.history-status {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--ink-100);
  color: var(--text-secondary);
  font-weight: 700;
}
.history-item.is-progress .history-meta { color: var(--accent-600); }
.history-item.is-failed .history-meta {
  color: var(--danger-600);
  white-space: normal;
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- Card ---------- */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 24px;
  transition: background var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}

.card + .card { margin-top: 20px; }

@media (prefers-reduced-motion: no-preference) {
  .content { animation: app-fade-up 0.4s var(--ease) both; }
  .card { animation: app-fade-up 0.42s var(--ease) both; }
  .grid-2 > div:nth-of-type(2) .card { animation-delay: 0.06s; }
  .card + .card { animation-delay: 0.08s; }
  .modal-panel { animation: app-pop-in 0.28s var(--ease) both; }
}

@keyframes app-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes app-pop-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .result-pop { animation: app-pop-in 0.35s var(--ease) both; }
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}
.card-header h2 { font-size: var(--fs-lg); }
.card-header h3 { font-size: var(--fs-md); }

.card-subtle {
  background: var(--ink-50);
  border: 1px solid var(--border-subtle);
}

/* ---------- Form elements ---------- */

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }

.label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 7px;
}
.label .hint { font-weight: 400; color: var(--text-muted); }

.help-text { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 6px; }

.input, .select, .textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: var(--fs-base);
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background var(--dur-base) var(--ease), color var(--dur-base) var(--ease);
}
.textarea { resize: vertical; min-height: 84px; }

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent-400);
  box-shadow: var(--shadow-focus);
}

.input:disabled, .select:disabled, .textarea:disabled {
  background: var(--ink-50);
  color: var(--text-muted);
  cursor: not-allowed;
}

.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6e85' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.char-counter { text-align: right; font-size: var(--fs-xs); color: var(--text-muted); margin-top: 6px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-icon { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary { background: var(--accent-500); color: var(--text-on-accent); box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { background: var(--accent-600); box-shadow: 0 6px 20px -4px rgba(106, 82, 240, 0.5); }

.btn-secondary { background: var(--bg-surface); color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--ink-50); }

.btn-danger-outline { background: var(--bg-surface); color: var(--danger-600); border-color: var(--danger-300); }
.btn-danger-outline:hover:not(:disabled) { background: var(--danger-50); }

.btn-success { background: var(--teal-500); color: white; }
.btn-success:hover:not(:disabled) { background: var(--teal-600); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--ink-100); color: var(--text-primary); }

.btn-sm { padding: 7px 12px; font-size: var(--fs-xs); }
.btn-block { width: 100%; }

.btn.recording {
  background: var(--danger-500);
  border-color: var(--danger-500);
  color: white;
  animation: btn-rec-pulse 1.4s ease-out infinite;
}
.btn.recording:hover:not(:disabled) { background: var(--danger-600); }
@keyframes btn-rec-pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
  70% { box-shadow: 0 0 0 9px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.icon-btn {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.icon-btn:hover { background: var(--ink-50); color: var(--text-primary); transform: translateY(-1px); }
.icon-btn:active { transform: translateY(0); }
.icon-btn.danger:hover { background: var(--danger-50); color: var(--danger-600); border-color: var(--danger-300); }

/* ---------- Dropzone / audio source control ---------- */

.source-row { display: flex; gap: 10px; flex-wrap: wrap; }

.audio-slot {
  margin-top: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--ink-50);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.audio-slot .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal-500); flex-shrink: 0; }
.audio-slot.recording .dot { background: var(--danger-500); animation: pulse 1.1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.audio-slot-text { flex: 1; font-size: var(--fs-sm); color: var(--text-secondary); }
.audio-slot audio { width: 100%; margin-top: 10px; height: 36px; }

audio { border-radius: var(--radius-md); }

/* ---------- Badges / alerts ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}
.badge-neutral { background: var(--ink-100); color: var(--text-secondary); }
.badge-accent { background: var(--accent-50); color: var(--accent-700); }
.badge-soon { background: var(--ink-100); color: var(--text-muted); }

.alert {
  display: flex;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-danger { background: var(--danger-50); color: var(--danger-600); border-color: var(--danger-300); }
.alert-info { background: var(--accent-50); color: var(--accent-700); border-color: var(--accent-200); }
.alert-success { background: #ecfdf5; color: var(--teal-600); border-color: #a7f3d0; }

.hidden { display: none !important; }

/* ---------- Profile list ---------- */

.profile-list { display: flex; flex-direction: column; gap: 12px; max-height: 560px; overflow-y: auto; padding-right: 4px; }

.profile-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--bg-surface);
  transition: background var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.profile-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
@media (prefers-reduced-motion: no-preference) {
  .profile-card { animation: app-fade-up 0.35s var(--ease) both; }
}
.profile-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.profile-card-name { font-weight: 600; font-size: var(--fs-base); color: var(--text-primary); }
.profile-card-meta { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 3px; display: flex; gap: 8px; align-items: center; }
.profile-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.profile-card audio { width: 100%; margin-top: 12px; height: 36px; }

.empty-state { text-align: center; padding: 36px 16px; color: var(--text-muted); font-size: var(--fs-sm); }
.empty-state .btn-icon { margin: 0 auto 10px; }

.add-profile-trigger {
  width: 100%;
  margin-top: 14px;
  padding: 14px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}
.add-profile-trigger:hover { background: var(--ink-50); border-color: var(--accent-400); color: var(--accent-600); }

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(17, 18, 26, 0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.modal-panel {
  width: 100%;
  max-width: 460px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border-subtle); }
.modal-head h3 { font-size: var(--fs-md); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border-subtle); display: flex; justify-content: flex-end; gap: 10px; }

.field-error { font-size: var(--fs-xs); color: var(--danger-600); margin-top: 6px; }

/* ---------- Toasts ---------- */

.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}
.toast {
  background: var(--ink-900);
  color: white;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: toast-in var(--dur-base) var(--ease);
}
.toast-success { background: #0f6b5f; }
.toast-error { background: #7a1f1f; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Placeholder / coming-soon page ---------- */

.placeholder {
  text-align: center;
  padding: 72px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
.placeholder-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--accent-50);
  color: var(--accent-600);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.placeholder-icon svg { width: 28px; height: 28px; }
.placeholder h2 { font-size: var(--fs-xl); margin-bottom: 10px; }
.placeholder p { color: var(--text-secondary); max-width: 460px; margin: 0 auto; }
.placeholder .btn { margin-top: 22px; }

/* ---------- Emotion grid ---------- */

.emotion-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 560px) {
  .emotion-grid { grid-template-columns: repeat(2, 1fr); }
}

.emotion-chip {
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.emotion-chip:hover { border-color: var(--accent-300); transform: translateY(-2px); }
.emotion-chip.selected {
  border-color: var(--accent-500);
  background: var(--accent-50);
  color: var(--accent-700);
  box-shadow: 0 0 0 3px var(--accent-100);
  animation: chip-pop 0.3s var(--ease);
}
@keyframes chip-pop {
  0% { transform: scale(0.94); }
  60% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* ---------- Spinner ---------- */

.spinner {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: white;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.spinner-dark { border-color: var(--ink-200); border-top-color: var(--accent-500); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Upgrade / credit packs ---------- */

.upgrade-lead {
  margin-bottom: 22px;
  color: var(--text-secondary);
  font-size: var(--fs-base);
}
.upgrade-lead strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.upgrade-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  align-items: stretch;
}
@media (max-width: 900px) {
  .upgrade-grid { grid-template-columns: 1fr; }
}
.upgrade-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px 22px 22px;
  box-shadow: var(--shadow-xs);
}
.upgrade-card h2 { font-size: var(--fs-lg); margin-bottom: 10px; }
.upgrade-price {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.upgrade-credits {
  margin: 6px 0 16px;
  color: var(--accent-700);
  font-weight: 700;
}
:root[data-theme="dark"] .upgrade-credits { color: var(--accent-300); }
.upgrade-card ul { list-style: none; margin: 0 0 20px; padding: 0; flex: 1; }
.upgrade-card li {
  position: relative;
  padding: 7px 0 7px 22px;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}
.upgrade-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 8px;
  height: 5px;
  border-left: 2px solid var(--accent-500);
  border-bottom: 2px solid var(--accent-500);
  transform: rotate(-45deg);
}
.upgrade-card-featured {
  border-color: var(--accent-400);
  box-shadow: 0 18px 40px -22px rgba(106, 82, 240, 0.7);
}
.upgrade-card-featured h2 { padding-right: 92px; }
.upgrade-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-500);
  color: white;
  font-size: var(--fs-xs);
  font-weight: 700;
}
.upgrade-note { margin-top: 16px; }
.upgrade-section { margin-top: 28px; }
.upgrade-section h2 { font-size: var(--fs-lg); margin-bottom: 14px; }
.upgrade-table-wrap { overflow-x: auto; }
.upgrade-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.upgrade-table th,
.upgrade-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.upgrade-table th { color: var(--text-primary); font-weight: 700; }
.upgrade-table td:first-child,
.upgrade-table th:first-child { color: var(--text-primary); }
.upgrade-points { margin: 0; padding-left: 18px; color: var(--text-secondary); }
.upgrade-points li + li { margin-top: 8px; }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 240px));
  gap: 16px;
  margin-bottom: 16px;
}
.admin-stat { padding: 16px 18px; }
.admin-stat-label { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 600; }
.admin-stat-value { margin-top: 4px; font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.admin-card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-search { max-width: 260px; }
.admin-table-wrap { overflow-x: auto; margin-top: 14px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  white-space: nowrap;
}
.admin-table th { color: var(--text-muted); font-size: var(--fs-xs); font-weight: 700; }
.admin-email { color: var(--text-secondary); }
.admin-table .input { min-width: 140px; }
.admin-credits { width: 120px; min-width: 120px !important; }
.admin-actions { display: flex; align-items: center; gap: 6px; }
.admin-expired { color: var(--danger-600); font-weight: 700; }
.admin-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
}
.admin-status.is-on { background: rgba(20, 184, 166, 0.15); color: var(--teal-600); }
.admin-status.is-off { background: var(--danger-50); color: var(--danger-600); }
.credit-expiry {
  margin: 0 0 12px;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
}
@media (max-width: 720px) {
  .admin-stats { grid-template-columns: 1fr; }
  .admin-card-header { align-items: stretch; flex-direction: column; }
  .admin-search { max-width: none; }
}
