/* ===== Design tokens ===== */
/* Teal/navy derived from the real Playroom Originals logo (plr.png): --brand-neon is the exact
   logo cyan (#01fbef), used for glows/highlights; --brand-teal is a darkened, WCAG-safe version
   of the same hue for solid button fills (the neon itself is too light for white text on it). */
:root {
  --brand-neon: #01fbef;
  --brand-teal: #09a59d;
  --brand-teal-dark: #077e78;
  --brand-teal-soft: #e1faf8;

  --bg-app: #f7f8fa;
  --bg-surface: #ffffff;
  --bg-surface-raised: #ffffff;
  --text-primary: #0b1220;
  --text-secondary: #5b6472;
  --text-muted: #8a919c;
  --border-subtle: #e7e9ec;
  --border-strong: #d7dae0;

  --success: #22a35a;
  --success-soft: #e7f7ee;
  --warning: #c78a1f;
  --warning-soft: #fbf1de;
  --danger: #d9433c;
  --danger-soft: #fbe9e8;
  --info: #2f7de1;
  --info-soft: #e8f1fd;

  --radius-card: 16px;
  --radius-control: 12px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-elevated: 0 8px 24px rgba(16, 24, 40, 0.10);

  --header-height: 112px;
  --max-content-width: 640px;
  --max-content-width-wide: 960px;

  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-app: #020329;
    --bg-surface: #070843;
    --bg-surface-raised: #080a51;
    --text-primary: #f4f6f8;
    --text-secondary: #aab3c0;
    --text-muted: #7c8794;
    --border-subtle: #202143;
    --border-strong: #2d2e54;

    --success-soft: #103322;
    --warning-soft: #352a10;
    --danger-soft: #3a1a18;
    --info-soft: #112438;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.4);
  }
}

:root[data-theme="dark"] {
  --bg-app: #020329;
  --bg-surface: #070843;
  --bg-surface-raised: #080a51;
  --text-primary: #f4f6f8;
  --text-secondary: #aab3c0;
  --text-muted: #7c8794;
  --border-subtle: #202143;
  --border-strong: #2d2e54;
  --success-soft: #103322;
  --warning-soft: #352a10;
  --danger-soft: #3a1a18;
  --info-soft: #112438;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ===== Reset ===== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button { font-family: inherit; }

/* ===== Mobile header ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-height);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 16px;
  background: color-mix(in srgb, var(--bg-app) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}
.app-header > :first-child { justify-self: start; }
.app-header > .brand-logo { justify-self: center; }
.app-header > :last-child { justify-self: end; }
.app-header .icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
}
.app-header .icon-btn:hover { background: var(--bg-surface); color: var(--text-primary); }
.app-header .brand-logo {
  display: flex;
  align-items: center;
}
.app-header .brand-logo img {
  height: 92px;
  width: 92px;
  border-radius: 22px;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--border-subtle), 0 4px 20px color-mix(in srgb, var(--brand-neon) 45%, transparent);
}
.app-header .icon-spacer { width: 36px; }

/* ===== Layout containers ===== */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-main { flex: 1; padding: 20px 16px 96px; }
.content-narrow { max-width: var(--max-content-width); margin: 0 auto; }
.content-wide { max-width: var(--max-content-width-wide); margin: 0 auto; }

/* ===== Stepper ===== */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 0 4px;
}
.stepper .dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-strong);
  color: var(--text-muted);
}
.stepper .dot.active {
  background: var(--brand-teal);
  border-color: var(--brand-teal);
  color: #fff;
}
.stepper .dot.done {
  background: var(--brand-teal-soft);
  border-color: var(--brand-teal);
  color: var(--brand-teal-dark);
}
.stepper .line {
  width: 18px;
  height: 1.5px;
  background: var(--border-strong);
}
.stepper .line.done { background: var(--brand-teal); }

.step-heading { padding: 12px 4px 20px; }
.step-heading .step-num { color: var(--brand-teal); font-weight: 600; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }
.step-heading h1 { font-size: 22px; font-weight: 700; margin-top: 4px; }
.step-heading p { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }

/* ===== Cards ===== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 16px;
}
.card + .card { margin-top: 12px; }

/* ===== Form fields ===== */
.field { margin-bottom: 22px; }
.field label.field-label {
  display: block;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.field .field-label .required { color: var(--danger); margin-left: 2px; }
.field .field-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.4;
}
.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="number"],
.field input[type="date"],
.field select,
.field textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--radius-control);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.15s ease;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand-teal);
}
.field textarea { min-height: 100px; resize: vertical; }
.field .field-error { color: var(--danger); font-size: 13px; margin-top: 6px; }
.field input.input-error, .field select.input-error, .field textarea.input-error { border-color: var(--danger); }

.field-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 4px 0;
}
.field-check input[type="checkbox"] { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand-teal); }
.field-check label { font-size: 14px; color: var(--text-primary); line-height: 1.4; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 15px 20px;
  border-radius: var(--radius-control);
  font-size: 16px;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-align: center;
}
.btn-primary { background: var(--brand-teal); color: #fff; }
.btn-primary:hover { background: var(--brand-teal-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: transparent; color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg-surface); }
.btn-link { width: auto; padding: 8px 4px; background: transparent; color: var(--text-secondary); font-weight: 500; }

.action-bar { display: flex; flex-direction: column; gap: 10px; margin-top: 28px; }

/* ===== Autosave note ===== */
.autosave-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  padding: 10px 2px 0;
}
.autosave-note .dot-live { width: 6px; height: 6px; border-radius: 50%; background: var(--success); flex-shrink: 0; }

/* ===== Upload ===== */
.upload-box {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-card);
  padding: 24px 16px;
  text-align: center;
  background: var(--bg-surface);
  cursor: pointer;
}
.upload-box:hover { border-color: var(--brand-teal); }
.upload-box .upload-title { font-weight: 600; font-size: 14px; }
.upload-box .upload-hint { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.upload-box.has-file { border-style: solid; border-color: var(--brand-teal); }
.file-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  background: var(--brand-teal-soft);
  color: var(--brand-teal-dark);
  font-size: 13px;
  margin-top: 8px;
}

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
}
.badge-draft { background: var(--border-subtle); color: var(--text-secondary); }
.badge-submitted, .badge-underreview { background: var(--info-soft); color: var(--info); }
.badge-changesrequested { background: var(--warning-soft); color: var(--warning); }
.badge-approved, .badge-distributed, .badge-live { background: var(--success-soft); color: var(--success); }
.badge-rejected { background: var(--danger-soft); color: var(--danger); }
.badge-scheduled { background: var(--brand-teal-soft); color: var(--brand-teal-dark); }

/* ===== Review summary ===== */
.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-subtle); }
.summary-row:last-child { border-bottom: none; }
.summary-row .k { color: var(--text-secondary); font-size: 13.5px; }
.summary-row .v { color: var(--text-primary); font-size: 13.5px; font-weight: 600; text-align: right; }
.summary-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.summary-section-title a { color: var(--brand-teal); font-size: 12.5px; text-transform: none; letter-spacing: normal; font-weight: 600; }

/* ===== OTP ===== */
.otp-input-group { display: flex; gap: 8px; justify-content: center; margin: 24px 0; }
.otp-input-group input {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  border-radius: var(--radius-control);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface-raised);
  color: var(--text-primary);
}
.otp-input-group input:focus { outline: none; border-color: var(--brand-teal); }
.dev-otp-banner {
  background: var(--warning-soft);
  color: var(--warning);
  border-radius: var(--radius-control);
  padding: 12px 14px;
  font-size: 13.5px;
  text-align: center;
  margin-bottom: 16px;
}

/* ===== Utility ===== */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.muted { color: var(--text-secondary); }
.small { font-size: 13px; }

@media (min-width: 768px) {
  .app-main { padding: 32px 24px 96px; }
  .step-heading h1 { font-size: 26px; }
}
