:root {
  --blue: #b8dcf5;
  --blue-soft: #edf8ff;
  --ink: #003565;
  --ink-deep: #012a55;
  --muted: #537191;
  --purple: #5b49c8;
  --purple-2: #7a55ef;
  --pink: #ef3f90;
  --orange: #ff9c45;
  --surface: #ffffff;
  --line: #b7d6ee;
  --line-soft: #d9edf9;
  --shadow: 0 24px 70px rgba(1, 44, 89, .15);
  --shadow-soft: 0 12px 34px rgba(1, 44, 89, .09);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100%;
  margin: 0;
  background: #f7fbff;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

a { color: inherit; text-decoration: none; }

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 15px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #7aaef2;
  box-shadow: 0 0 0 4px rgba(92, 78, 210, .11);
}

textarea { resize: vertical; }

label {
  display: grid;
  gap: 8px;
  color: #7890aa;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p { margin-top: 0; }

h1 {
  margin-bottom: 18px;
  color: var(--ink-deep);
  font-size: clamp(36px, 4vw, 54px);
  line-height: .98;
  letter-spacing: -.03em;
}

h2 {
  margin-bottom: 12px;
  color: var(--ink-deep);
  font-size: 25px;
  line-height: 1.12;
}

h3 {
  color: var(--ink-deep);
  font-size: 18px;
}

p {
  color: var(--muted);
  line-height: 1.65;
}

small {
  color: var(--muted);
  display: block;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 18%, rgba(232, 61, 136, .18), transparent 28%),
    radial-gradient(circle at 82% 10%, rgba(255, 155, 69, .18), transparent 26%),
    linear-gradient(135deg, #eff8ff, #fff7fb);
}

.login-card {
  width: min(480px, 100%);
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, .85);
  border-radius: 30px;
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow);
}

.login-brand,
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

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

.brand-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6656d6, #473ab2);
  color: #fff;
  box-shadow: 0 16px 34px rgba(88, 70, 190, .3);
}

.brand strong {
  display: block;
  font-size: 16px;
  line-height: 1.05;
}

.brand small {
  color: #01406f;
  font-size: 12px;
}

.kicker {
  margin-bottom: 10px;
  color: var(--pink);
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: .34em;
  text-transform: uppercase;
}

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

.primary-button,
.secondary-button,
.link-button {
  border: 0;
  cursor: pointer;
  font-weight: 900;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 28px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--purple), #6c4ee7 45%, var(--pink) 76%, var(--orange));
  box-shadow: 0 18px 38px rgba(88, 70, 190, .26);
  transition: transform .18s ease, box-shadow .18s ease;
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 42px rgba(88, 70, 190, .32);
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--purple);
}

.wide { width: 100%; }

.link-button {
  background: transparent;
  color: var(--ink);
  padding: 0;
}

.logout-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

.alert {
  padding: 15px 18px;
  border-radius: 16px;
  font-weight: 800;
}

.alert-error {
  background: #fff0f4;
  color: #b71952;
}

.alert-success {
  background: #e9fff4;
  color: #087248;
}

.app-shell {
  width: min(1390px, calc(100% - 32px));
  min-height: calc(100vh - 20px);
  margin: 10px auto;
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 34px;
  border-radius: 10px;
  background: var(--blue);
  padding: 28px;
}

.sidebar {
  min-height: calc(100vh - 76px);
  display: flex;
  flex-direction: column;
}

.nav {
  display: grid;
  gap: 12px;
  margin-top: 38px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 10px;
  color: var(--ink-deep);
  font-weight: 1000;
  transition: background .18s ease, transform .18s ease;
}

.nav a.is-active,
.nav a:hover {
  background: #fff;
  transform: translateX(1px);
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  color: #225d8a;
}

.sidebar-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 34px;
  padding: 14px;
  border: 1px solid rgba(1, 44, 89, .12);
  border-radius: 16px;
  background: rgba(255, 255, 255, .46);
}

.avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  color: var(--purple);
  background: #f0e9ff;
  font-weight: 1000;
}

.sidebar-card strong,
.sidebar-footer strong {
  display: block;
  color: var(--ink-deep);
  font-weight: 1000;
}

.sidebar-card small,
.sidebar-footer span {
  color: #235b86;
  font-size: 12px;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(1, 44, 89, .22);
  padding-top: 24px;
  display: grid;
  gap: 3px;
}

.main-panel {
  width: min(100%, 980px);
  display: grid;
  gap: 22px;
  align-content: start;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.topbar p:not(.kicker) {
  max-width: 760px;
  color: #004c85;
  font-size: 17px;
  line-height: 1.7;
}

.date-pill {
  color: var(--ink-deep);
  font-weight: 900;
  white-space: nowrap;
}

.back-link {
  display: inline-flex;
  margin-bottom: 20px;
  color: #005294;
  font-weight: 1000;
}

.hero-card,
.panel-card,
.creator-card {
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 34px;
}

.hero-card-compact {
  min-height: 176px;
}

.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.steps span {
  border-radius: 999px;
  background: #e2f2ff;
  padding: 8px 13px;
  color: #005294;
  font-size: 13px;
  font-weight: 1000;
}

.panel-card {
  padding: 30px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.section-head h2 {
  margin-bottom: 4px;
}

.search-form {
  width: min(360px, 100%);
}

.package-list {
  display: grid;
  gap: 0;
  margin-top: 20px;
}

.package-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.package-row:last-child {
  border-bottom: 0;
}

.row-icon {
  display: grid;
  place-items: center;
  width: 26px;
  color: var(--purple);
  font-weight: 1000;
}

.row-main strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-deep);
  font-size: 16px;
  font-weight: 1000;
}

.row-actions {
  display: flex;
  gap: 9px;
}

.row-actions a {
  min-width: 72px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 13px;
  background: #fff;
  color: var(--ink);
  text-align: center;
  font-weight: 900;
}

.empty-state {
  padding: 20px;
  border-radius: 12px;
  background: #eef8ff;
  color: var(--ink);
}

.center-link {
  margin-top: 20px;
  text-align: center;
  color: var(--purple);
  font-weight: 1000;
}

.creator-card {
  display: grid;
  gap: 22px;
  padding: 34px;
}

.pm-form {
  gap: 24px;
}

.language-switch {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.language-switch label {
  display: inline-flex;
  width: auto;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  background: #eef0ff;
  color: var(--purple);
  font-size: 12px;
  letter-spacing: .08em;
}

.language-switch input {
  width: auto;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 34px;
}

.form-grid-tight {
  gap: 18px;
}

.form-section {
  display: grid;
  align-content: start;
  gap: 16px;
}

.form-section h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--purple);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
}

.section-icon {
  color: #5d6cff;
  font-family: Inter, sans-serif;
}

.section-icon-pink {
  color: var(--pink);
}

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

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

.medication-row {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid #d3eaf8;
  border-radius: 18px;
  background: #f5fbff;
}

.dashed-button {
  width: 100%;
  border-style: dashed;
  border-color: #8fd0f8;
  color: #0085d5;
}

.settings-card {
  display: grid;
  gap: 22px;
}

.help-card {
  display: grid;
  gap: 18px;
}

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

.help-grid article {
  padding: 22px;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: #f8fcff;
}

.help-grid span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 14px;
  border-radius: 999px;
  color: var(--purple);
  background: #eee9ff;
  font-weight: 1000;
}

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

.feature-list p {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: #f9fcff;
}

.story-preview {
  display: grid;
  grid-template-columns: 390px 1fr;
  overflow: hidden;
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}

.cover-card {
  position: relative;
  min-height: 520px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #e5efff, #ffe0ef);
  color: #fff;
  font-size: 38px;
  font-weight: 1000;
  text-align: center;
}

.cover-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-card span {
  position: absolute;
  top: 30px;
  left: 30px;
  right: 30px;
  text-shadow: 0 4px 16px rgba(0, 0, 0, .35);
}

.cover-placeholder { color: var(--purple); }

.story-card {
  padding: 42px;
  background: #fff;
  font-size: 18px;
  line-height: 1.8;
}

.story-card h1,
.print-story h1 {
  color: var(--purple);
  font-size: 34px;
  line-height: 1.1;
}

.story-card h2,
.print-story h2 {
  margin-top: 28px;
  color: #5846ff;
  font-size: 20px;
}

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

.mission-item {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 10px 0;
  padding: 14px;
  border-radius: 14px;
  background: #f5fbff;
  font-weight: 800;
}

.coloring-card img {
  max-width: 100%;
  border-radius: 18px;
}

.prompt-box {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.print-root {
  padding: 28px;
  background: #b9ddf6;
}

.print-page {
  width: 794px;
  min-height: 1123px;
  margin: 0 auto 32px;
  padding: 48px;
  page-break-after: always;
  border-radius: 28px;
  background: linear-gradient(180deg, #fff 0%, #e2f4ff 100%);
  box-shadow: 0 20px 55px rgba(0, 0, 0, .18);
}

.parent-print { background: #fff; }

.print-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  color: #7068ff;
}

.print-title {
  margin: 0;
  color: #7068ff;
  font-family: Georgia, serif;
  font-size: 30px;
  font-weight: 800;
}

.print-cover {
  width: 100%;
  height: 280px;
  object-fit: cover;
  border-radius: 22px;
  margin: 28px 0 32px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, .16);
}

.print-story {
  font-size: 16px;
  line-height: 1.7;
}

.print-bottom-grid,
.parent-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-top: 28px;
}

.print-coloring {
  min-height: 260px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: #fff;
}

.print-coloring img {
  max-width: 220px;
  max-height: 220px;
}

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

.field-row div,
.parent-grid p {
  padding: 14px;
  border: 1px solid #d9e8f2;
  border-radius: 12px;
  background: #f7fbff;
}

.field-row span {
  display: block;
  color: #7068ff;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.print-signature {
  margin-top: 120px;
  border-top: 1px solid #d9e8f2;
  padding-top: 28px;
  display: flex;
  justify-content: space-around;
  text-align: center;
}

.print-signature div {
  display: grid;
  gap: 8px;
}

.print-signature span {
  color: #8194ad;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

@media (max-width: 980px) {
  .app-shell {
    width: min(100%, calc(100% - 20px));
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .sidebar {
    min-height: auto;
  }

  .main-panel {
    width: 100%;
  }

  .form-grid,
  .story-preview,
  .package-grid,
  .admin-grid,
  .help-grid,
  .feature-list p {
    grid-template-columns: 1fr;
  }

  .field-pair {
    grid-template-columns: 1fr;
  }

  .hero-card,
  .topbar,
  .section-head {
    flex-direction: column;
  }

  .package-row {
    grid-template-columns: auto 1fr;
  }

  .row-actions {
    grid-column: 2;
  }
}

@media print {
  body { background: #b9ddf6; }
  .print-root { padding: 0; }
  .print-page {
    box-shadow: none;
    margin: 0 auto;
    border-radius: 0;
  }
}
