:root {
  --cream: #f4ebe3;
  --cream-2: #ead9cc;
  --paper: #fffaf6;
  --ink: #3b2432;
  --ink-soft: #6d5560;
  --blush: #f0c4ce;
  --rose: #d98a9e;
  --rose-deep: #c45b78;
  --vois: #2e3cc0;
  --vois-deep: #232d96;
  --gold: #c4a574;
  --line: rgba(59, 36, 50, 0.12);
  --shadow: 0 24px 60px rgba(80, 36, 52, 0.08);
  --radius: 28px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--cream);
  color: var(--ink);
  font-family: Manrope, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
}

h1, h2, h3, .serif {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

a { color: inherit; }

button, input, textarea, select {
  font: inherit;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

#neural-bg {
  width: 100%;
  height: 100%;
  display: block;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.55;
}

.orb-a {
  width: 420px;
  height: 420px;
  right: -80px;
  top: -60px;
  background: radial-gradient(circle, #f3c5d2 0%, transparent 70%);
}

.orb-b {
  width: 380px;
  height: 380px;
  left: -90px;
  bottom: -80px;
  background: radial-gradient(circle, rgba(46, 60, 192, 0.18) 0%, transparent 70%);
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.boot {
  display: grid;
  place-items: center;
  min-height: 100vh;
  color: var(--ink-soft);
}

.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(16px);
  background: rgba(244, 235, 227, 0.78);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand img,
.auth-logo {
  height: 44px;
  width: auto;
  display: block;
  background: #f6f0e4;
  border-radius: 12px;
}

.brand span {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 28px;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.topbar nav a,
.topbar nav button,
.linkish {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: none;
  padding: 8px 10px;
}

.who {
  color: var(--ink);
  font-size: 13px;
}

.page-main {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 80px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: var(--rose-deep);
  margin: 0 0 8px;
}

h1 {
  font-size: clamp(36px, 6vw, 64px);
  line-height: 0.95;
  margin: 0 0 12px;
}

.lead {
  color: var(--ink-soft);
  max-width: 46ch;
}

.lead-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.lead-row .lead {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.lead-row .btn {
  flex-shrink: 0;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-top: 36px;
}

.home-tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 280px;
  padding: 32px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.home-tile:hover {
  transform: translateY(-4px);
  border-color: var(--rose);
}

.home-tile-accent {
  background:
    linear-gradient(180deg, rgba(240, 196, 206, 0.35), transparent 48%),
    var(--paper);
}

.tile-kicker {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--vois);
}

.home-tile strong {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 48px;
  font-weight: 600;
}

.home-tile span:last-child {
  color: var(--ink-soft);
  margin-top: auto;
}

.sheet-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0 18px;
}

.cluster-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 760px;
}

.btn {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: 0.18s ease;
}

.btn:hover {
  border-color: var(--rose);
}

.btn.is-active,
.btn.is-selected {
  background: var(--vois);
  border-color: var(--vois);
  color: #fff;
}

.btn.has-pick:not(.is-active) {
  background: #f7dde4;
  border-color: var(--rose);
}

.btn-cluster {
  border-radius: 18px;
  text-align: left;
  padding: 14px 18px;
  line-height: 1.35;
}

.btn-wide {
  width: 100%;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(460px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 36px;
  padding: 36px 32px 32px;
  box-shadow: var(--shadow);
}

.auth-logo {
  height: 58px;
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-soft);
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 12px 14px;
  color: var(--ink);
}

textarea { min-height: 110px; resize: vertical; }

.btn-primary {
  background: var(--vois);
  color: #fff;
  border-color: var(--vois);
  padding: 14px 22px;
  font-weight: 600;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
}

.form-error, .notice {
  color: var(--rose-deep);
  background: #fbe7ec;
  border-radius: 16px;
  padding: 12px 14px;
}

.notice-token {
  background: #f4e8d4;
  color: #6a4b1f;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.picked {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 18px 0;
  list-style: none;
}

.picked li {
  background: rgba(255, 250, 246, 0.8);
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 10px 14px;
  font-size: 14px;
}

.duration-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cluster-page {
  display: grid;
  gap: 16px;
}

.field-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
}

.field-card h3 {
  margin: 0 0 10px;
  font-size: 22px;
}

.field-card p, .field-card a {
  white-space: pre-wrap;
  line-height: 1.55;
  margin: 0;
}

.field-card a {
  color: var(--vois);
  display: inline-block;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(59, 36, 50, 0.18);
  z-index: 8;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100%);
  height: 100%;
  background: var(--paper);
  z-index: 9;
  border-left: 1px solid var(--line);
  padding: 22px;
  overflow: auto;
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 8px;
}

.history-list button {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 12px 14px;
  cursor: pointer;
}

.history-list .meta {
  display: block;
  color: var(--ink-soft);
  font-size: 12px;
  margin-top: 4px;
}

.scenario {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.scenario-title {
  margin: 0;
  font-size: 32px;
}

.script {
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.script li {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  align-items: start;
}

.script li:last-child {
  border-bottom: 0;
}

.script-head {
  background: rgba(46, 60, 192, 0.06);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.script time,
.script-head > span:first-child {
  font-weight: 700;
  color: var(--vois);
  font-variant-numeric: tabular-nums;
}

.script-cols {
  display: grid;
  gap: 10px;
}

.script-cols p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.5;
}

.script-cols b {
  display: none;
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.bad-box {
  border-radius: 24px;
  padding: 18px 20px;
  background: #f7ece4;
  border: 1px solid rgba(196, 165, 116, 0.45);
}

.generating {
  display: grid;
  gap: 8px;
  place-items: center;
  text-align: center;
  min-height: 180px;
  background: var(--paper);
  border-radius: 24px;
  border: 1px dashed var(--rose);
  padding: 28px;
}

.pulse {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--vois);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% { transform: scale(1.5); opacity: 0.4; }
}

.admin-grid {
  display: grid;
  gap: 22px;
}

.table-wrap {
  overflow: auto;
  background: var(--paper);
  border-radius: 24px;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.empty {
  color: var(--ink-soft);
  padding: 20px 0;
}

.back {
  display: inline-flex;
  margin-bottom: 18px;
  color: var(--ink-soft);
  text-decoration: none;
}

@media (min-width: 901px) {
  .script-cols {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
  }
}

@media (max-width: 900px) {
  .script li {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .script-head {
    display: none;
  }
  .script-cols b {
    display: block;
  }
}

@media (max-width: 800px) {
  .home-grid { grid-template-columns: 1fr; }
  .topbar { padding: 14px 16px; }
  .page-main { width: min(100% - 24px, 1120px); }
  .home-tile strong { font-size: 40px; }
}
