:root {
  --ink: #022451;
  --muted: #5B5E5F;
  --line: #d8dde3;
  --paper: #FFFFFF;
  --panel: #ffffff;
  --soft: #f6f8fb;
  --teal: #022451;
  --teal-2: #DB9D20;
  --coral: #DB9D20;
  --gold: #DB9D20;
  --graphite: #5B5E5F;
  --shadow: 0 18px 45px rgba(2, 36, 81, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  background: #022451;
  color: #f7fbfa;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.05rem;
}

.brand-mark,
.icon-box {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--teal-2);
  color: white;
  flex: 0 0 auto;
}

.brand-mark svg,
.icon-box svg,
.tiny-icon svg,
.tool-button svg,
.copy-btn svg,
.nav-item svg,
.profile-btn svg,
.primary svg,
.secondary svg,
.ghost svg,
.status-pill svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.trial-box {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  border-radius: 8px;
}

.trial-box strong {
  display: block;
  margin-bottom: 6px;
}

.trial-box p,
.helper,
.small {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.sidebar .helper {
  color: rgba(255, 255, 255, 0.72);
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.82);
  background: transparent;
  border-radius: 8px;
  padding: 10px;
  text-align: left;
}

.nav-item.active {
  background: rgba(219, 157, 32, 0.22);
  color: white;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

.mobile-menu {
  display: none;
}

.headline h1 {
  margin: 0 0 6px;
  font-size: clamp(1.65rem, 4vw, 2.45rem);
  line-height: 1.05;
}

.headline p {
  max-width: 720px;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.profile-btn,
.primary,
.secondary,
.ghost,
.danger {
  min-height: 42px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 14px;
  font-weight: 750;
  white-space: nowrap;
}

.primary {
  background: var(--teal);
  color: white;
}

.primary:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.is-loading {
  cursor: wait;
}

.is-loading:disabled {
  opacity: 1;
}

.spinner {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  display: inline-block;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.next-action-highlight {
  position: relative;
  border-color: var(--teal) !important;
  animation: nextActionPulse 2s ease-in-out infinite;
}

@keyframes nextActionPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(219, 157, 32, 0.3);
  }
  55% {
    box-shadow: 0 0 0 7px rgba(219, 157, 32, 0.13);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(219, 157, 32, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .next-action-highlight {
    animation: none;
    box-shadow: 0 0 0 3px rgba(219, 157, 32, 0.18);
  }
}

.secondary {
  background: #fff4df;
  color: var(--teal);
}

.compact-copy {
  min-height: 36px;
  padding: 8px 10px;
  font-size: 0.88rem;
}

.ghost {
  background: transparent;
  color: var(--graphite);
  border: 1px solid var(--line);
}

.danger {
  background: #fff4df;
  color: #7a5615;
}

.profile-btn {
  background: white;
  color: var(--graphite);
  box-shadow: 0 1px 0 rgba(2, 36, 81, 0.08);
  border: 1px solid var(--line);
}

.grid {
  display: grid;
  gap: 18px;
}

.dashboard {
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  align-items: start;
}

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

.next-step-card,
.quality-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.next-step-card.ready,
.quality-item.ready {
  border-color: rgba(219, 157, 32, 0.45);
  background: #fffaf1;
}

.next-step-card h3,
.quality-item h3 {
  margin: 0;
  font-size: 1rem;
}

.next-step-card p,
.quality-item p {
  margin: 8px 0 14px;
  color: var(--muted);
  line-height: 1.45;
}

.quality-list {
  display: grid;
  gap: 10px;
}

.quality-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: start;
}

.quality-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--teal);
}

.reels-image-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.reels-image-card,
.reels-line-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.reels-image-card {
  display: grid;
  gap: 10px;
}

.reels-image-card img {
  width: 100%;
  aspect-ratio: 9 / 12;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.reels-image-card h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  word-break: break-word;
}

.reels-line-list {
  display: grid;
  gap: 14px;
}

.reels-line-card.warning {
  border-color: #e9bc76;
  background: #fffaf1;
}

.compact-toolbar {
  margin-top: 0;
}

.compact-prompt {
  margin-top: 12px;
}

.large-textarea {
  min-height: 260px;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.start-mode-grid {
  align-items: stretch;
}

.start-mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.start-mode-card button {
  margin-top: auto;
}

.coach-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.coach-main,
.coach-side {
  display: grid;
  gap: 14px;
}

.coach-side {
  position: sticky;
  top: 18px;
}

.coach-progress-card,
.coach-explain,
.coach-recommendation,
.coach-complete {
  border-color: rgba(219, 157, 32, 0.42);
  background: #fffaf1;
}

.coach-next-panel h3 {
  margin: 0 0 10px;
  line-height: 1.2;
}

.coach-controls {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.coach-scene-card .mini-check,
.mini-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 750;
}

.scene-status-grid {
  margin-top: 14px;
}

.tool-walkthrough ol {
  margin: 12px 0 0;
  padding-left: 22px;
  line-height: 1.55;
}

.coach-instructions {
  margin: 12px 0 0;
  padding-left: 22px;
  line-height: 1.55;
}

.mini-fix {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.mini-fix + .mini-fix {
  margin-top: 10px;
}

.mini-fix h4 {
  margin: 0 0 8px;
}

.mini-fix p {
  margin: 6px 0;
  line-height: 1.45;
}

.welcome-panel {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 8px;
}

.welcome-art {
  width: 100%;
  aspect-ratio: 16 / 8;
  object-fit: cover;
  display: block;
}

.welcome-copy {
  padding: 22px;
  display: grid;
  gap: 14px;
}

.welcome-copy h2,
.panel h2,
.step-title h2 {
  margin: 0;
  font-size: 1.35rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.account-metrics {
  margin-bottom: 18px;
}

.metric {
  background: var(--soft);
  border-radius: 8px;
  padding: 14px;
}

.metric strong {
  display: block;
  font-size: 1.5rem;
}

.progress-track {
  height: 12px;
  background: #e8edf3;
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0 8px;
}

.progress-fill {
  height: 100%;
  width: var(--progress, 0%);
  background: linear-gradient(90deg, var(--teal), var(--gold));
}

.stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 20px;
}

.step-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 8px 10px;
  background: #f6f8fb;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.88rem;
}

.step-chip.active {
  color: white;
  background: var(--teal);
  border-color: var(--teal);
}

.workspace {
  max-width: 1120px;
  margin: 0 auto;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #ffffff, #f6f8fb);
}

.auth-card {
  width: min(560px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  gap: 18px;
}

.auth-brand {
  color: var(--ink);
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1.05;
}

.form-grid.single {
  grid-template-columns: 1fr;
}

.flow-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 18px;
  align-items: start;
}

.step-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.step-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  font-weight: 750;
}

.help-tip {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-left: 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff4df;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 850;
  vertical-align: middle;
  cursor: help;
}

.help-tip::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: calc(100% + 9px);
  transform: translateX(-50%);
  width: min(280px, 80vw);
  padding: 10px 12px;
  border-radius: 8px;
  background: #022451;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.35;
  box-shadow: 0 12px 28px rgba(2, 36, 81, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.help-tip:hover::after,
.help-tip:focus::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: white;
  min-height: 46px;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

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

.choice-card,
.topic-card,
.tool-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  min-height: 128px;
  text-align: left;
  display: grid;
  gap: 9px;
  align-content: start;
  color: var(--ink);
}

.choice-card:hover,
.topic-card:hover,
.tool-card:hover,
.choice-card.selected,
.topic-card.selected,
.tool-card.selected {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(219, 157, 32, 0.18);
}

.choice-card h3,
.topic-card h3,
.tool-card h3 {
  margin: 0;
  font-size: 1rem;
}

.choice-card p,
.topic-card p,
.tool-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.selected-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--teal);
  font-weight: 850;
  font-size: 0.9rem;
}

.selected-note svg {
  width: 16px;
  height: 16px;
}

.muted-note {
  color: var(--muted);
  font-weight: 700;
}

.recommended-label {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  background: #fff4df;
  color: var(--teal);
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 850;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 18px;
}

.script-section,
.prompt-box,
.history-item,
.check-item {
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  padding: 14px;
}

.settings-toggle {
  justify-content: flex-start;
  margin-bottom: 18px;
}

.script-section + .script-section,
.prompt-box + .prompt-box,
.history-item + .history-item,
.check-item + .check-item,
.admin-user + .admin-user {
  margin-top: 10px;
}

.admin-user {
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  padding: 14px;
}

.admin-user-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.admin-user h3 {
  margin: 0 0 6px;
}

.admin-user-controls {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.section-head,
.history-head,
.check-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.script-section h3,
.prompt-box h3 {
  margin: 0 0 8px;
}

.script-section p,
.prompt-box p {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
}

.advanced-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin: 14px 0;
  overflow: hidden;
}

.advanced-details summary {
  cursor: pointer;
  padding: 14px;
  font-weight: 850;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.advanced-details summary span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
  text-transform: none;
}

.advanced-body {
  border-top: 1px solid var(--line);
  padding: 14px;
}

.character-photo-grid {
  align-items: start;
  margin-top: 12px;
}

.character-photo-preview {
  display: block;
  width: min(260px, 100%);
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 10px;
}

.compact-empty {
  padding: 12px;
  margin-top: 10px;
}

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

.prompt-part h3 {
  font-size: 0.98rem;
}

.shot-part-card {
  background: #f6f8fb;
}

.prompt-action-card {
  background: #ffffff;
}

.prompt-output-control {
  max-width: 520px;
  margin: 0 0 16px;
}

.copy-btn,
.tool-button {
  min-width: 38px;
  height: 38px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--graphite);
  background: #fff;
  flex: 0 0 auto;
}

.copy-btn:hover,
.tool-button:hover {
  background: var(--soft);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 7px 10px;
  background: #fff4df;
  color: #7a5615;
  font-weight: 750;
  font-size: 0.84rem;
}

.status-pill.active {
  background: #f6f8fb;
  color: var(--teal);
}

.aside {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
}

.mini-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.mini-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.mini-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.help-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.help-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px;
}

.help-item h3 {
  margin: 0 0 8px;
}

.help-item p {
  margin: 0;
  line-height: 1.5;
}

.help-item p + p {
  margin-top: 8px;
}

.tool-logo {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--teal);
  font-weight: 900;
}

.check-item {
  align-items: center;
}

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

.direction-check {
  min-height: 54px;
  background: #f6f8fb;
}

.check-left {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.check-left input {
  width: 20px;
  min-height: 20px;
  margin-top: 2px;
  accent-color: var(--teal);
}

.section-label {
  margin: 18px 0 10px;
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
  color: var(--muted);
}

.empty {
  min-height: 130px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #022451;
  color: white;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
  z-index: 20;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 36, 81, 0.46);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 10;
}

.modal,
.modal-card {
  width: min(760px, 100%);
  max-height: min(820px, 92vh);
  overflow: auto;
  background: var(--paper);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
}

.tour-card {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: min(390px, calc(100vw - 32px));
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(2, 36, 81, 0.22);
  padding: 18px;
  pointer-events: auto;
}

.tour-card::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  transform: rotate(45deg);
}

.tour-card.arrow-left::before {
  left: -10px;
  top: 32px;
}

.tour-card.arrow-right::before {
  right: -10px;
  top: 32px;
  transform: rotate(225deg);
}

.tour-card.arrow-down::before {
  left: 38px;
  bottom: -10px;
  transform: rotate(225deg);
}

.tour-card h2 {
  margin: 4px 0 8px;
  font-size: 1.2rem;
}

.tour-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.tour-kicker {
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.tour-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.hidden {
  display: none !important;
}

@media (max-width: 940px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .mobile-menu {
    display: inline-flex;
  }

  .dashboard,
  .flow-layout,
  .coach-layout,
  .next-step-grid,
  .reels-image-grid {
    grid-template-columns: 1fr;
  }

  .aside,
  .coach-side {
    position: static;
  }

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

@media (max-width: 640px) {
  .main {
    padding: 16px;
  }

  .topbar,
  .step-title,
  .section-head,
  .history-head {
    flex-direction: column;
    align-items: stretch;
  }

  .actions,
  .toolbar {
    justify-content: stretch;
  }

  .primary,
  .secondary,
  .ghost,
  .danger,
  .profile-btn {
    width: 100%;
  }

  .form-grid,
  .choice-grid,
  .check-grid,
  .metric-row,
  .admin-user-controls {
    grid-template-columns: 1fr;
  }

  .admin-user-head {
    flex-direction: column;
    align-items: stretch;
  }

  .choice-card,
  .topic-card,
  .tool-card {
    min-height: 112px;
  }

  .tour-card {
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
  }
}
