:root {
  color-scheme: light;
  --bg: #f3f6f5;
  --panel: #ffffff;
  --ink: #15231f;
  --muted: #66746f;
  --line: #d9e2de;
  --green: #0b8f73;
  --green-dark: #075d4c;
  --navy: #172c37;
  --gold: #b78a3b;
  --soft-green: #e7f4f0;
  --soft-gold: #fbf3e5;
  --soft-amber: #fff4df;
  --shadow: 0 16px 42px rgba(23, 44, 55, 0.1);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
}

button, input, textarea { font: inherit; }
button { border: 0; cursor: pointer; transition: all 0.15s ease; }
h1, h2, p { margin: 0; }

.landing-screen {
  position: fixed; inset: 0; display: grid; grid-template-rows: 1fr auto; padding: 52px;
  background: linear-gradient(135deg, rgba(23,44,55,0.96), rgba(9,93,76,0.9)),
    url("https://images.unsplash.com/photo-1554224155-6726b3ff858f?auto=format&fit=crop&w=1800&q=80") center/cover;
  color: #fff; z-index: 20;
}

.landing-auth-actions {
  position: fixed;
  top: 24px;
  right: 28px;
  z-index: 22;
  display: flex;
  gap: 10px;
}

.auth-trigger {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.7);
  color: var(--green-dark);
}

.landing-hidden,
.app-hidden {
  display: none !important;
}

.landing-center {
  place-self: center;
  width: min(680px, 100%);
  text-align: center;
}

.landing-eyebrow {
  color: #d5b06a;
  font-size: 13px;
  font-weight: 900;
}

.landing-center h1 {
  margin-top: 10px;
  font-size: 58px;
}

.landing-center p:last-of-type {
  margin: 16px auto 0;
  max-width: 560px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 18px;
  line-height: 1.7;
}

.start-button {
  position: relative;
  min-width: 178px;
  min-height: 58px;
  margin-top: 34px;
  border-radius: 999px;
  background: #fff;
  color: var(--green-dark);
  font-size: 17px;
  font-weight: 900;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.48);
  animation: pulseGlow 1.7s infinite;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.48); }
  70% { box-shadow: 0 0 0 18px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.landing-feature-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.landing-feature-grid div {
  min-height: 92px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
}

.landing-feature-grid strong,
.landing-feature-grid span {
  display: block;
}

.landing-feature-grid strong {
  font-size: 15px;
}

.landing-feature-grid span {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  line-height: 1.45;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(13, 28, 35, 0.42);
  backdrop-filter: blur(8px);
}

.auth-card {
  position: relative;
  width: min(460px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(20, 44, 54, 0.24);
}

.auth-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #eef5f2;
  color: var(--navy);
  font-size: 20px;
}

.auth-card h2 {
  color: var(--navy);
  font-size: 24px;
}

.auth-card p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.auth-form,
.admin-box {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.auth-form label,
.admin-grid label {
  display: grid;
  gap: 7px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 900;
}

.auth-form input,
.admin-grid input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
}

.contact-box,
.admin-box {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.contact-box strong,
.admin-box strong {
  color: var(--navy);
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.admin-list code {
  display: inline-block;
  margin: 2px;
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--soft-gold);
  color: #6f5316;
}

.single-app {
  width: 100%;
  height: 100vh;
  padding: 14px;
}

.app-shell {
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  height: 100vh;
  padding: 14px;
}

.app-topbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto minmax(220px, 1fr);
  align-items: center; gap: 16px; padding: 0 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(23,44,55,0.96), rgba(11,143,115,0.92)), var(--navy);
  box-shadow: 0 4px 20px rgba(23,44,55,0.15);
  color: #fff;
}
.app-topbar .brand-block strong { color: #fff; font-size: 18px; }
.app-topbar .brand-block span { color: rgba(255,255,255,0.78); }
.app-topbar .nav-button { background: #fff; color: var(--gold); border-radius: 10px; font-weight: 700; font-size: 14px; min-height: 38px; padding: 0 18px; }
.nav-button { border-radius: 8px; font-weight: 700; min-height: 36px; padding: 0 16px; }
.app-topbar .nav-button:hover { background: #fff; color: #c9952e; }
.app-topbar .nav-button.active { background: var(--green); color: #fff; font-weight: 900; }
.app-topbar .text-button { color: #fff; font-weight: 600; font-size: 13px; min-height: 34px; padding: 0 12px; border-radius: 6px; }
.app-topbar .text-button:hover { background: rgba(255,255,255,0.15); }

.brand-block {
  display: grid;
  gap: 4px;
}

.brand-block strong {
  color: var(--navy);
  font-size: 19px;
}

.brand-block span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.top-nav {
  display: flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: #f0f4f2;
}

.nav-button {
  min-height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.nav-button.active {
  background: var(--navy);
  color: #fff;
}

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

.top-actions .text-button {
  background: #eef3f0;
  color: var(--green-dark);
}

.app-view {
  min-height: 0;
}

#projectView {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 12px;
}

#projectView.is-hidden,
#libraryView.is-hidden {
  display: none !important;
}

.project-sidebar {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 190px;
  gap: 12px;
}

.project-sidebar .creator-panel,
.history-panel,
.workbench,
.library-panel {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.project-sidebar .creator-panel {
  overflow: auto;
  padding: 14px;
}

.compact-heading {
  margin-bottom: 10px;
}

.project-sidebar textarea {
  min-height: 86px;
  max-height: 138px;
}

#referenceContent {
  min-height: 82px;
}

#researchProductBrief {
  min-height: 100px;
}

.history-panel {
  overflow: hidden;
  padding: 14px;
}

.project-history {
  display: grid;
  gap: 8px;
  max-height: 108px;
  overflow: auto;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.history-item button:first-child {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  text-align: left;
}

.history-item strong,
.history-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item strong {
  color: var(--navy);
  font-size: 13px;
}

.history-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.history-delete {
  padding: 0 10px;
  border-radius: 8px;
  background: #fff2ee;
  color: #b04427;
  font-size: 12px;
  font-weight: 900;
}

.workbench {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

/* ---- Section picker (3-panel cards) ---- */

.section-picker {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 18px 18px, rgba(15, 143, 115, 0.04) 0.9px, transparent 1.2px),
    #fcfdfc;
  background-size: 28px 28px;
  overflow-x: auto;
}

.section-card {
  flex: 1;
  min-width: 170px;
  padding: 12px 14px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 1px 3px rgba(23, 44, 55, 0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 3px solid transparent;
}

.section-card:hover {
  box-shadow: 0 4px 14px rgba(23, 44, 55, 0.1);
  transform: translateY(-1px);
}

.section-card .section-name {
  font-size: 14px;
  font-weight: 900;
  color: var(--ink);
  line-height: 1;
}

.section-card .section-desc {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1;
}

/* ---- Section card color themes ---- */

.section-card.s-green { border-top-color: var(--green); }
.section-card.s-green .section-tabs .subtab.active { background: var(--green); color: #fff; }

.section-card.s-gold { border-top-color: var(--gold); }
.section-card.s-gold .section-tabs .subtab.active { background: var(--gold); color: #fff; }

.section-card.s-navy { border-top-color: var(--navy); }
.section-card.s-navy .section-tabs .subtab.active { background: var(--navy); color: #fff; }

/* Active state: tinted background + stronger shadow */
.section-card.active {
  box-shadow: 0 6px 20px rgba(23, 44, 55, 0.12);
}

.section-card.s-green.active { background: #f6fbf9; border-color: rgba(11, 143, 115, 0.28); }
.section-card.s-gold.active { background: #fefaf2; border-color: rgba(183, 138, 59, 0.28); }
.section-card.s-navy.active { background: #f5f8fb; border-color: rgba(23, 44, 55, 0.18); }

/* ---- Section tabs (inside each card) ---- */

.section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.subtab {
  min-height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  background: #eef3f0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.subtab:hover { background: #dde6e2; }

.subtab.active { background: var(--green); color: #fff; }

/* ---- Section tracker (context indicator above workbench) ---- */

.section-tracker {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: #fafbfa;
}

.section-tracker .st-current {
  color: var(--ink);
}

.section-tracker .st-sep {
  color: var(--line);
}

/* ---- Keep workbench background subtle ---- */

.workbench {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  background: #fff;
  border-radius: 10px;
}

/* ---- Legacy subnav-shell (kept for compatibility, hidden) ---- */

.subnav-shell { display: none; }

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 22px 24px;
  border: 1px solid rgba(217, 226, 222, 0.9);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(23, 44, 55, 0.96), rgba(12, 91, 77, 0.94)),
    var(--navy);
  color: #fff;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin-bottom: 6px;
  color: #d5b06a;
  font-size: 13px;
  font-weight: 900;
}

h1 {
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: 0;
}

.workspace-header p:last-child {
  max-width: 720px;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 15px;
  line-height: 1.65;
}

.header-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 800;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(390px, 440px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.workspace-left {
  display: grid;
  gap: 14px;
}

.creator-panel,
.knowledge-panel,
.research-output article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.creator-panel {
  padding: 18px;
}

.knowledge-panel {
  padding: 18px;
}

.panel-heading {
  display: grid;
  gap: 5px;
  margin-bottom: 14px;
}

.panel-heading span {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
}

.panel-heading strong {
  color: var(--navy);
  font-size: 17px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label,
.wide-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.wide-label {
  margin-top: 14px;
}

input[type="text"],
textarea {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: 0;
}

input[type="text"] {
  min-height: 46px;
  padding: 10px 12px;
}

textarea {
  min-height: 168px;
  resize: vertical;
  padding: 13px;
  line-height: 1.58;
}

input:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15, 143, 115, 0.12);
}

.secondary-button {
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  border-radius: 8px;
  border: 1px solid rgba(183, 138, 59, 0.28);
  background: var(--soft-gold);
  color: #765719;
  font-weight: 900;
}

.compact-top {
  margin-top: 8px;
}

.compact-button {
  width: auto;
  min-width: 86px;
  min-height: 48px;
  margin-top: 0;
}

.primary-button {
  width: 100%;
  min-height: 52px;
  margin-top: 16px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.primary-button:disabled {
  opacity: 0.62;
  cursor: progress;
}

.text-button,
.copy-button {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.copy-button {
  min-height: 32px;
  background: #eef3f0;
  color: var(--muted);
}

.copy-button:disabled,
.download-button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.primary-copy {
  background: var(--green);
  color: #fff;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.voice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.voice-grid label,
.scene-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

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

.voice-grid select,
.scene-label select {
  width: 100%;
  min-height: 42px;
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: 0;
}

.voice-grid select:focus,
.scene-label select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15, 143, 115, 0.12);
}

.scene-label {
  display: block;
  margin-top: 14px;
}

.voice-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.voice-control .copy-button {
  min-height: 42px;
  margin-top: 8px;
}

.speech-performance-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 10px 14px;
  align-items: end;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #cfe0da;
  border-radius: 10px;
  background: #f7fbf9;
}

.speech-performance-controls .speech-enhance-toggle {
  margin: 0;
  align-self: center;
}

.speech-performance-controls select {
  width: 100%;
  min-height: 40px;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.speech-performance-controls > p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 760px) {
  .speech-performance-controls {
    grid-template-columns: 1fr;
  }
}

.voice-preview-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #f5f8f7;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.voice-preview-box audio {
  width: 100%;
  margin-top: 10px;
}

.audio-generation-issue {
  padding: 12px 14px;
  border: 1px solid #e8b26a;
  border-radius: 9px;
  background: #fff7e8;
  color: #7a4300;
}

.audio-generation-issue strong,
.audio-generation-issue p {
  display: block;
  margin: 0;
}

.audio-generation-issue p {
  margin-top: 5px;
  line-height: 1.55;
}

.clone-voice-card {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.clone-voice-title {
  display: grid;
  gap: 4px;
}

.clone-voice-title strong {
  color: var(--ink);
  font-size: 15px;
}

.clone-voice-title span,
.confirm-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.clone-voice-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 10px;
  margin-top: 12px;
}

.file-input {
  width: 100%;
  min-height: 46px;
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.confirm-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
}

.confirm-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.podcast-assignment-step {
  display: grid;
  gap: 10px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid #cfe0da;
  border-radius: 12px;
  background: linear-gradient(180deg, #f7fbf9 0%, #ffffff 100%);
}

.podcast-step-heading {
  display: grid;
  gap: 4px;
}

.podcast-step-heading strong {
  color: var(--navy);
  font-size: 15px;
}

.podcast-step-heading span,
.role-assignment-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.podcast-assignment-step .podcast-editor {
  min-height: 220px;
  margin: 0;
}

.role-assignment-status {
  padding: 8px 10px;
  border-radius: 8px;
  background: #edf3f1;
}

.role-assignment-status[data-tone="success"] {
  color: #17613f;
  background: #e6f6ed;
}

.role-assignment-status[data-tone="warn"] {
  color: #8a4b00;
  background: #fff3dd;
}

.podcast-role-line-editor {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
  padding-right: 3px;
}

.podcast-role-line-editor.is-hidden {
  display: none;
}

.podcast-role-line {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.podcast-role-line p {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.65;
}

.podcast-role-buttons {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 5px;
}

.podcast-role-buttons button {
  min-height: 34px;
  padding: 5px 7px;
  border: 1px solid #cdd9d5;
  border-radius: 8px;
  background: #f3f7f5;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.podcast-role-buttons button.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

@media (max-width: 760px) {
  .podcast-role-line {
    grid-template-columns: 1fr;
  }

  .podcast-role-buttons {
    max-width: 250px;
  }
}

.clone-actions {
  margin-top: 10px;
}

.voice-preview-box.compact {
  margin-top: 10px;
  padding: 10px;
}

.knowledge-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.knowledge-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: 260px;
  overflow: auto;
}

.doc-item,
.empty-docs {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.doc-item strong {
  display: block;
  color: var(--navy);
  font-size: 14px;
}

.doc-item span {
  display: block;
  margin-top: 4px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
}

.doc-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.doc-item p,
.empty-docs {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.doc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.doc-tags em {
  padding: 3px 7px;
  border-radius: 999px;
  background: #ecf7f3;
  color: var(--green-dark);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.doc-open-link {
  display: inline-flex;
  margin-top: 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.assistant-chat {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.chat-window {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  border-radius: 8px;
  background: #f5f8f7;
}

.chat-bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.65;
}

.chat-bubble.assistant {
  justify-self: start;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

.chat-bubble.user {
  justify-self: end;
  background: var(--green);
  color: #fff;
}

.chat-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.chat-input-row textarea {
  min-height: 48px;
  max-height: 110px;
  margin-top: 0;
}

.library-panel {
  height: 100%;
  padding: 18px;
  overflow: hidden;
}

.knowledge-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
  height: calc(100vh - 154px);
}

.knowledge-layout > div,
.assistant-chat {
  min-height: 0;
}

.assistant-chat {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.assistant-chat .chat-window {
  max-height: none;
  min-height: 0;
}

.source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.source-list span,
.source-list a {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--soft-gold);
  color: #765719;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.save-message {
  min-height: 21px;
  margin-top: 10px;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.save-message[data-tone="warn"] {
  color: #9a5f00;
}

.research-output {
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.output-panel {
  display: none;
}

.output-panel.active {
  display: grid;
  gap: 14px;
}

.research-output article {
  padding: 18px;
  min-height: 100%;
}

.quick-start-card {
  background: var(--soft-green) !important;
  border-color: rgba(15, 143, 115, 0.22) !important;
}

.workflow-card {
  padding: 14px !important;
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.workflow-steps div {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.workflow-steps strong {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 13px;
}

.workflow-steps p {
  margin: 0 !important;
  color: var(--green-dark) !important;
  font-size: 13px !important;
  font-weight: 900;
  line-height: 1.35 !important;
}

.research-output article > span,
.result-title-row span {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 900;
}

.result-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.research-output h2 {
  margin-top: 8px;
  font-size: 20px;
  line-height: 1.35;
}

.research-output p {
  margin-top: 10px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.78;
  white-space: pre-wrap;
}

.editor-label {
  display: block;
  margin-top: 14px;
}

.inline-input {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: 0;
}

.output-editor {
  width: 100%;
  margin-top: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  line-height: 1.72;
  resize: vertical;
  outline: 0;
}

.article-editor {
  min-height: 360px;
}

.html-editor {
  min-height: 330px;
  font-family: "Consolas", "Microsoft YaHei", monospace;
  font-size: 13px;
}

.podcast-editor {
  min-height: 240px;
}

.inline-input:focus,
.output-editor:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15, 143, 115, 0.12);
}

.formatted-article {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.wechat-layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 0.78fr);
  gap: 16px;
  align-items: start;
  margin-top: 14px;
}

.wechat-layout-editor {
  min-width: 0;
}

.wechat-image-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.wechat-image-controls label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.wechat-image-controls select {
  width: 100%;
  min-height: 40px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.wechat-phone-preview {
  position: sticky;
  top: 14px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2f0;
  padding: 10px;
}

.wechat-preview-toolbar {
  padding: 7px 8px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.wechat-phone-preview .formatted-article {
  max-height: calc(100vh - 220px);
  overflow: auto;
  margin-top: 0;
  background: #fff;
}

.formatted-article img {
  max-width: 100%;
  height: auto;
}

.formatted-article.empty {
  background: #f5f8f7;
}

.formatted-article h2 {
  margin: 0 0 14px;
  font-size: 24px;
  line-height: 1.35;
}

.formatted-article h3 {
  margin: 22px 0 8px;
  padding-left: 10px;
  border-left: 4px solid var(--green);
  font-size: 18px;
  line-height: 1.45;
}

.formatted-article blockquote {
  margin: 12px 0 18px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--soft-green);
  color: var(--green-dark);
  font-weight: 800;
  line-height: 1.65;
}

.formatted-article ul {
  margin: 12px 0 0;
  padding-left: 22px;
  line-height: 1.75;
}

.formatted-article hr {
  margin: 24px 0 14px;
  border: 0;
  border-top: 1px solid var(--line);
}

.helper-text {
  margin-top: 10px;
  color: var(--muted) !important;
  font-size: 13px !important;
  line-height: 1.55 !important;
}

.image-planner-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 12px;
}

.image-instruction-editor {
  min-height: 118px;
}

.image-plan-box {
  min-height: 190px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.image-generation-area {
  min-height: 80px;
  padding: 12px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfa;
}

.image-generation-area .generated-media-grid {
  margin-top: 0;
}

.image-plan-text strong {
  color: var(--navy);
  font-size: 14px;
}

.image-plan-text ul {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.prompt-detail {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
}

.prompt-detail summary {
  cursor: pointer;
  color: var(--green);
  font-weight: 700;
}

.prompt-detail p {
  margin: 8px 0 0;
  color: var(--muted);
}

.compact-media {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.advanced-tools {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.advanced-tools > summary {
  cursor: pointer;
  padding: 14px 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.advanced-tools > article {
  border-width: 1px 0 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.article-preview {
  margin-top: 12px;
  padding-left: 14px;
  border-left: 4px solid var(--green);
}

.point-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.point-list div {
  min-height: 104px;
  padding: 13px;
  border-radius: 8px;
  background: #f5f8f7;
}

.point-list strong {
  display: block;
  font-size: 14px;
}

.point-list span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.generated-media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.generated-media-grid figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f7faf9;
}

.generated-media-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.generated-media-grid figcaption {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.audio-box {
  margin-top: 15px;
  padding: 14px;
  border-radius: 8px;
  background: var(--soft-green);
}

.audio-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.audio-title-row strong {
  color: var(--green-dark);
  font-size: 14px;
}

.download-button {
  min-height: 32px;
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
}

.manual-copy-box {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(12, 24, 31, 0.42);
}

.manual-copy-card {
  width: min(720px, 100%);
  padding: 16px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.manual-copy-card strong {
  display: block;
  color: var(--navy);
  font-size: 15px;
}

.manual-copy-card textarea {
  min-height: 260px;
  margin: 12px 0;
}

.share-link-box {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(15, 143, 115, 0.22);
  border-radius: 8px;
  background: var(--soft-green);
}

.share-link-box strong {
  display: block;
  color: var(--green-dark);
  font-size: 13px;
}

.share-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-top: 8px;
}

.share-link-row .copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  text-decoration: none;
}

.share-link-box p {
  margin-top: 8px !important;
  color: var(--muted) !important;
  font-size: 12px !important;
  line-height: 1.45 !important;
}

.audio-box audio {
  width: 100%;
  margin-top: 10px;
}

.audio-box p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.spark-icon {
  position: relative;
  width: 19px;
  height: 19px;
  display: inline-block;
}

.spark-icon::before {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  left: 5px;
  top: 2px;
  border: 2px solid currentColor;
  transform: rotate(45deg);
}

.spark-icon::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 2px;
  left: 3px;
  top: 14px;
  border-radius: 2px;
  background: currentColor;
}

@media (max-width: 860px) {
  body {
    overflow: auto;
  }

  .landing-screen {
    position: static;
    min-height: 100vh;
    padding: 30px 16px;
  }

  .landing-center h1 {
    font-size: 40px;
  }

  .landing-feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    padding: 0;
    grid-template-rows: auto auto;
  }

  .app-topbar {
    grid-template-columns: 1fr;
    justify-items: stretch;
    border-radius: 0;
  }

  .top-nav,
  .top-actions {
    justify-content: flex-start;
  }

  #projectView {
    grid-template-columns: 1fr;
  }

  .project-sidebar {
    grid-template-rows: auto auto;
  }

  .project-sidebar .creator-panel,
  .history-panel,
  .workbench,
  .library-panel {
    border-radius: 0;
    box-shadow: none;
  }

  .workbench {
    min-height: 720px;
  }

  .subnav-shell {
    justify-content: flex-start;
  }

  .knowledge-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .single-app {
    width: 100%;
    padding: 0;
  }

  .workspace-header {
    align-items: flex-start;
    padding: 18px;
    margin: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .creator-panel {
    position: static;
    border-radius: 0;
    border-width: 0 0 1px;
    box-shadow: none;
  }

  .knowledge-panel {
    border-radius: 0;
    border-width: 0 0 1px;
    box-shadow: none;
  }

  .research-output {
    padding: 14px;
  }

  .research-output article {
    box-shadow: none;
  }

  .wechat-layout-grid {
    grid-template-columns: 1fr;
  }

  .wechat-phone-preview {
    position: static;
  }
}

@media (max-width: 560px) {
  .landing-feature-grid {
    grid-template-columns: 1fr;
  }

  .subnav-shell > div {
    flex-wrap: wrap;
  }

  .workspace-header {
    display: grid;
  }

  .header-actions {
    justify-items: start;
  }

  .image-generation-area { padding: 10px; }

  h1 {
    font-size: 28px;
  }

  .form-grid,
  .voice-grid,
  .clone-voice-grid,
  .chat-input-row,
  .wechat-image-controls,
  .workflow-steps,
  .image-planner-grid,
  .point-list,
  .generated-media-grid {
    grid-template-columns: 1fr;
  }
}

/* Desktop Chat Panel */
.desktop-chat-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 420px; z-index: 50;
  background: var(--panel); border-left: 1px solid var(--line); box-shadow: -4px 0 20px rgba(0,0,0,0.08);
  display: flex; flex-direction: column;
}
.dcp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--green); color: #fff; font-weight: 700; font-size: 15px;
}
.dcp-close { background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; }
.dcp-messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.dcp-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 6px 44px; }
.dcp-input-bar { display: flex; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--line); align-items: center; }
.dcp-input { flex: 1; height: 38px; border: 1px solid var(--line); border-radius: 19px; padding: 0 14px; font-size: 14px; outline: none; }
.dcp-input:focus { border-color: var(--green); }
.dcp-organize { bottom: 80px; right: 20px; }
@media (max-width: 900px) { .desktop-chat-panel { width: 100%; } }

/* Admin Panel */
.admin-panel-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
}
.admin-panel {
  background: var(--panel); border-radius: 14px; width: 560px; max-height: 80vh;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,0.2);
}
.admin-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: var(--navy); color: #fff; font-size: 16px;
}
.admin-panel-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }
.admin-section h4 { font-size: 13px; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.admin-user-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: #f9fafa;
}
.admin-user-row .au-name { font-weight: 700; }
.admin-user-row .au-role { font-size: 12px; color: var(--muted); }
.admin-user-row .au-meta { font-size: 11px; color: var(--muted); }
.admin-user-row button { padding: 4px 10px; border-radius: 14px; border: 1px solid #cc0000; background: #fff; color: #cc0000; font-size: 11px; cursor: pointer; }
.admin-code { display: inline-block; padding: 4px 10px; background: var(--soft-green); border-radius: 6px; font-size: 13px; font-family: monospace; margin: 2px 4px; }

/* === Visual Enhancements === */
/* Section cards */
.section-card { transition: all 0.2s ease; }
.section-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(23,44,55,0.1); }

/* Primary button */
.primary-button {
  background: var(--green); color: #fff; border-radius: 8px; font-weight: 700;
  min-height: 46px; padding: 0 20px; letter-spacing: 0.3px;
}
.primary-button:hover { background: var(--green-dark); box-shadow: 0 4px 12px rgba(11,143,115,0.25); }
.primary-button:active { transform: scale(0.98); }

/* Secondary button */
.secondary-button {
  border: 1px solid rgba(183,138,59,0.28); background: var(--soft-gold); border-radius: 8px;
  font-weight: 700; min-height: 40px; padding: 0 16px; color: #765719;
}
.secondary-button:hover { background: #f7ebd0; }

/* Copy button */
.copy-button {
  background: #eef3f0; color: var(--muted); border-radius: 8px; font-weight: 700;
  min-height: 32px; padding: 0 14px; font-size: 12px;
}
.copy-button:hover { background: #dde6e2; color: var(--ink); }
.primary-copy { background: var(--green); color: #fff; }
.primary-copy:hover { background: var(--green-dark); }

/* Text inputs and textareas */
input[type="text"], input[type="password"], textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  background: #fafbfb; transition: all 0.15s; outline: none;
}
input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
  border-color: var(--green); background: #fff; box-shadow: 0 0 0 3px rgba(11,143,115,0.1);
}
.output-editor { background: #fdfefe; border: 1px solid var(--line); font-size: 14px; }
.output-editor:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(11,143,115,0.08); }
.inline-input { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }

/* Workbench */
.workbench { background: rgba(255,255,255,0.8); backdrop-filter: blur(8px); }

/* Result rows and panels */
.result-title-row { padding: 4px 0; }
.result-title-row span { color: var(--green-dark); font-weight: 900; }
.panel-heading strong { color: var(--navy); }

/* Subtabs */
.subtab { border-radius: 8px; min-height: 32px; padding: 0 14px; font-weight: 700; font-size: 12px; }
.subtab.active { background: var(--green); box-shadow: 0 2px 8px rgba(11,143,115,0.2); }

/* Image plan boxes */
.image-plan-box { background: #f8fbfa; border-radius: 10px; }
.image-generation-area { background: #fafbfa; border-radius: 10px; }

/* Cards */
.creator-panel, .history-panel, .research-output article {
  border-radius: 10px; border: 1px solid var(--line);
  background: #fff; box-shadow: 0 2px 8px rgba(23,44,55,0.05);
}
.creator-panel { background: rgba(255,255,255,0.9); }

/* Quick-start card */
.quick-start-card { background: var(--soft-green); border-color: rgba(11,143,115,0.18); border-radius: 10px; }

/* Knowledge panels */
.knowledge-panel { border-radius: 10px; }

.compliance-notice {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid #e4a853;
  border-radius: 8px;
  background: #fff8ec;
  color: #71420a;
  line-height: 1.6;
}
.compliance-notice strong { display: block; margin-bottom: 4px; }
.compliance-notice ul { margin: 0; padding-left: 20px; }
