:root {
  --ink: #172126;
  --muted: #64727a;
  --line: #d8e1e5;
  --paper: #f7faf9;
  --panel: #ffffff;
  --green: #0d7c66;
  --green-dark: #075d4d;
  --coral: #f36b4f;
  --gold: #f5bd4f;
  --blue: #2f6df6;
  --shadow: 0 20px 50px rgba(23, 33, 38, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, Arial, sans-serif;
}

button,
textarea,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px clamp(18px, 5vw, 64px);
  background: rgba(247, 250, 249, 0.9);
  border-bottom: 1px solid rgba(216, 225, 229, 0.8);
  backdrop-filter: blur(16px);
}

.brand {
  color: var(--ink);
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: white;
  background: var(--green);
  border-radius: 8px;
  font-size: 14px;
}

.brand-mark.large {
  width: 68px;
  height: 68px;
  font-size: 22px;
  box-shadow: var(--shadow);
}

.is-hidden {
  display: none !important;
}

.user-badge {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.ghost-button,
.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: white;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 800;
}

.auth-screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 440px);
  gap: 36px;
  min-height: calc(100vh - 71px);
  align-items: center;
  padding: 46px clamp(18px, 5vw, 64px);
  background:
    radial-gradient(circle at 12% 18%, rgba(245, 189, 79, 0.28), transparent 26%),
    linear-gradient(135deg, #102729 0%, #164e48 52%, #f7faf9 52%, #eef5f2 100%);
}

.auth-hero {
  max-width: 660px;
  color: white;
}

.auth-hero h1 {
  margin: 18px 0 0;
  font-size: clamp(42px, 6vw, 78px);
  line-height: 1;
  letter-spacing: 0;
}

.auth-hero p:last-child {
  max-width: 560px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 20px;
  line-height: 1.6;
}

.auth-card {
  width: 100%;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 20px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.auth-tab {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 10px;
  font-weight: 800;
}

.auth-tab.is-active {
  background: white;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(23, 33, 38, 0.08);
}

.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
}

.remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 800;
}

.auth-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.auth-message,
.admin-message {
  margin: 14px 0 0;
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
}

.app-shell.is-locked {
  display: none;
}

.auth-screen.is-hidden {
  display: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 42px;
  min-height: 520px;
  align-items: center;
  padding: 58px clamp(18px, 5vw, 64px) 34px;
  color: white;
  background:
    radial-gradient(circle at 82% 15%, rgba(245, 189, 79, 0.5), transparent 25%),
    linear-gradient(135deg, #102729 0%, #164e48 48%, #19252f 100%);
}

.hero-copy {
  max-width: 760px;
}

.eyebrow,
.section-label {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero p:last-child {
  max-width: 620px;
  margin: 24px 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 20px;
  line-height: 1.6;
}

.studio-visual {
  position: relative;
  min-height: 340px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.mic {
  position: absolute;
  left: 50%;
  top: 35px;
  width: 104px;
  height: 150px;
  transform: translateX(-50%);
  border-radius: 52px;
  background: #f7faf9;
  border: 12px solid #172126;
}

.mic span {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 22px;
  bottom: 22px;
  border-radius: 24px;
  background: repeating-linear-gradient(
    to bottom,
    #172126,
    #172126 8px,
    #f7faf9 8px,
    #f7faf9 16px
  );
}

.meter {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 92px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  align-items: end;
  gap: 10px;
  height: 98px;
}

.meter i {
  display: block;
  height: 42px;
  border-radius: 8px 8px 0 0;
  background: white;
  animation: pulse 1.4s ease-in-out infinite;
}

.meter i:nth-child(2) { height: 70px; animation-delay: 0.12s; background: var(--gold); }
.meter i:nth-child(3) { height: 50px; animation-delay: 0.22s; background: var(--coral); }
.meter i:nth-child(4) { height: 98px; animation-delay: 0.32s; background: #ffffff; }
.meter i:nth-child(5) { height: 62px; animation-delay: 0.42s; background: var(--blue); }
.meter i:nth-child(6) { height: 88px; animation-delay: 0.52s; background: var(--gold); }
.meter i:nth-child(7) { height: 45px; animation-delay: 0.62s; background: #ffffff; }
.meter i:nth-child(8) { height: 76px; animation-delay: 0.72s; background: var(--coral); }

.knobs {
  position: absolute;
  left: 32px;
  right: 32px;
  bottom: 28px;
  display: flex;
  justify-content: space-between;
}

.knobs span {
  width: 44px;
  height: 44px;
  border: 8px solid #172126;
  border-radius: 50%;
  background: #f7faf9;
}

@keyframes pulse {
  0%, 100% { transform: scaleY(0.72); opacity: 0.76; }
  50% { transform: scaleY(1); opacity: 1; }
}

.workspace,
.history-section,
.tutorials-section,
.voice-clone-section {
  padding: 54px clamp(18px, 5vw, 64px);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.74fr);
  gap: 24px;
  align-items: start;
}

.creator,
.preview,
.history-item,
.tutorial-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(23, 33, 38, 0.06);
}

.creator,
.preview {
  padding: 28px;
}

.section-title h2,
.history-section h2,
.tutorials-heading h2,
.voice-clone-heading h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.field {
  display: grid;
  gap: 9px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

textarea,
select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
  color: var(--ink);
  padding: 14px;
}

textarea {
  min-height: 176px;
  resize: vertical;
  line-height: 1.5;
}

textarea:focus,
select:focus,
input:focus {
  outline: 3px solid rgba(13, 124, 102, 0.16);
  border-color: var(--green);
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.primary-button {
  width: 100%;
  margin-top: 24px;
  border: 0;
  border-radius: 8px;
  color: white;
  background: var(--green);
  padding: 15px 18px;
  font-weight: 800;
}

.primary-button:hover {
  background: var(--green-dark);
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--gold);
}

.script-output {
  min-height: 170px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
  color: var(--muted);
  line-height: 1.6;
}

.player {
  display: grid;
  grid-template-columns: 48px 1fr 42px;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
}

.play-button {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: white;
  background: var(--coral);
}

.track {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #e7eef0;
}

.track-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.2s ease;
}

.audio-preview {
  display: none;
  width: 100%;
  margin-top: 18px;
}

.audio-preview.is-ready {
  display: block;
}

.export-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}

.preview-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}

.track-preview {
  margin-top: 14px;
}

.history-section {
  display: grid;
  grid-template-columns: minmax(220px, 0.45fr) minmax(0, 1fr);
  gap: 24px;
  background: #eef5f2;
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 18px;
}

.history-item span {
  color: var(--muted);
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.tutorials-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.voice-clone-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.plan-badge {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.plan-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  line-height: 1.5;
}

.plan-summary strong {
  color: var(--ink);
  font-size: 18px;
}

.tutorials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 24px;
}

.tutorial-card {
  overflow: hidden;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.tutorial-card iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 8px;
  background: #0d1b1f;
}

.tutorial-card strong {
  display: block;
  line-height: 1.35;
}

.tutorial-card.is-empty {
  min-height: 190px;
  align-content: center;
  background: #fbfdfd;
  color: var(--muted);
}

.tutorial-card.is-empty strong {
  color: var(--ink);
}

.voice-clone-section {
  background: #f7faf9;
}

.voice-clone-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.45fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 24px;
}

.voice-clone-form,
.voice-clone-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 12px 30px rgba(23, 33, 38, 0.06);
}

.voice-clone-form {
  padding: 20px;
}

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.consent-check input {
  width: auto;
  margin-top: 3px;
}

.voice-clone-list {
  display: grid;
  gap: 12px;
}

.voice-clone-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
}

.voice-clone-item span {
  color: var(--muted);
}

.voice-clone-item.is-empty {
  min-height: 160px;
  align-items: center;
}

.admin-section {
  padding: 54px clamp(18px, 5vw, 64px);
  background: #f7faf9;
}

.admin-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.admin-heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.admin-heading h2 {
  margin: 0;
  font-size: 28px;
}

.admin-add {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(220px, 1fr) minmax(180px, 0.6fr);
  gap: 14px;
  align-items: end;
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.admin-add .field,
.admin-add .primary-button {
  margin-top: 0;
}

.admin-api {
  margin-top: 22px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.admin-api-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) repeat(3, minmax(160px, 0.7fr));
  gap: 14px;
  margin-top: 20px;
}

.api-key-field {
  grid-row: span 2;
}

.api-key-field small {
  color: var(--muted);
  font-size: 12px;
}

.admin-heading.compact {
  align-items: center;
}

.admin-heading.compact h2 {
  font-size: 24px;
}

.admin-tutorials {
  margin-top: 28px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.tutorial-editor-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 20px;
}

.tutorial-editor {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.user-list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(90px, 0.35fr) minmax(130px, 0.5fr) minmax(260px, auto);
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 10px 24px rgba(23, 33, 38, 0.05);
}

.user-row strong,
.user-row span {
  display: block;
}

.user-row small {
  color: var(--muted);
  font-weight: 700;
}

.password-cell {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.password-cell strong {
  color: var(--green-dark);
  font-size: 18px;
  letter-spacing: 0;
}

.status-pill {
  justify-self: start;
  padding: 7px 10px;
  border-radius: 999px;
  background: #eef5f2;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.status-pill.pending {
  background: #fff6df;
  color: #8a5a00;
}

.status-pill.blocked {
  background: #ffe9e4;
  color: #9b2d1a;
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.tiny-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 800;
}

.tiny-button.danger {
  border-color: #ffd1c8;
  color: #9b2d1a;
  background: #fff2ef;
}

.tiny-button.primary-action {
  border-color: var(--green);
  color: white;
  background: var(--green);
}

@media (max-width: 860px) {
  .hero,
  .auth-screen,
  .workspace,
  .history-section,
  .voice-clone-layout,
  .tutorials-grid,
  .tutorial-editor-grid,
  .admin-api-grid,
  .admin-add,
  .user-row {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .auth-screen {
    background: linear-gradient(180deg, #102729 0%, #164e48 48%, #eef5f2 48%, #eef5f2 100%);
  }

  .admin-heading {
    align-items: start;
    flex-direction: column;
  }

  .tutorials-heading {
    align-items: start;
    flex-direction: column;
  }

  .voice-clone-heading,
  .plan-summary {
    align-items: start;
    flex-direction: column;
  }

  .admin-heading-actions {
    justify-content: flex-start;
  }

  .user-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
  }

  .grid-two,
  .export-actions,
  .preview-actions,
  .auth-options {
    grid-template-columns: 1fr;
  }

  .auth-options {
    display: grid;
    align-items: start;
  }

  .history-item {
    display: grid;
  }

  .history-actions {
    justify-content: flex-start;
  }

  .creator,
  .preview,
  .auth-card {
    padding: 20px;
  }
}
