:root {
  --ink: #1b1715;
  --muted: #766a62;
  --paper: #fffaf5;
  --cream: #fffdf8;
  --line: #eadbd0;
  --rose: #a36a53;
  --rose-dark: #7f4c3b;
  --sage: #72806f;
  --gold: #c4a15b;
  --ok: #2f6c4f;
  --danger: #9d2d22;
  --shadow: 0 24px 80px rgba(56, 35, 24, 0.13);
  font-family: Arial, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(255, 250, 245, 0.96), rgba(255, 250, 245, 0.78)),
    url("/pdf-bg.png") center/cover fixed;
  color: var(--ink);
}

body.modal-open {
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

.client-shell {
  width: min(1120px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 28px 0;
}

.client-card {
  min-height: calc(100vh - 56px);
  padding: clamp(20px, 4vw, 42px);
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid rgba(234, 219, 208, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.client-head,
.nav-actions,
.preview-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--ink);
  font-size: 18px;
  font-weight: 700;
}

.brand strong,
.brand small {
  display: block;
  letter-spacing: 0;
}

.brand strong {
  font-size: 14px;
}

.brand small {
  color: var(--muted);
  font-size: 11px;
}

.progress {
  display: grid;
  gap: 7px;
  width: min(270px, 42vw);
}

.progress span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.progress-track {
  height: 5px;
  background: #eadbd0;
}

.progress-track b {
  display: block;
  width: 16.66%;
  height: 100%;
  background: var(--rose);
  transition: width 0.22s ease;
}

.screen {
  display: none;
  max-width: 850px;
  margin: 54px auto 0;
}

.screen.is-active {
  display: block;
}

.screen h1 {
  margin: 0 0 26px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 7vw, 78px);
  font-weight: 400;
  line-height: 0.98;
}

.step-hint {
  position: relative;
  margin: -12px 0 24px;
  padding: 12px 14px 12px 42px;
  border-left: 3px solid var(--gold);
  background: rgba(255, 247, 230, 0.78);
  color: #6a4d20;
  font-size: 14px;
  line-height: 1.45;
  animation: hintFloat 2.8s ease-in-out infinite;
}

.step-hint::before {
  content: "?";
  position: absolute;
  left: 13px;
  top: 12px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--rose-dark);
  font-size: 12px;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--sage);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.field-grid {
  display: grid;
  gap: 16px;
}

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

.wide {
  grid-column: 1 / -1;
}

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

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.required span::after {
  content: " *";
  color: var(--rose);
}

input,
textarea,
select {
  width: 100%;
  min-height: 50px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(163, 106, 83, 0.12);
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

.big-choice .choice {
  min-width: 160px;
  min-height: 58px;
  font-size: 14px;
}

.choice,
.button {
  position: relative;
  min-height: 46px;
  padding: 12px 20px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.choice.is-active,
.button.primary {
  background: var(--ink);
  color: white;
}

.choice.is-active::after {
  content: " \2713";
  font-weight: 900;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.54);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

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

.select-card {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 126px;
  padding: 18px 56px 18px 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  text-align: left;
  color: var(--ink);
}

.select-card::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid transparent;
  pointer-events: none;
}

.select-card.is-selected {
  border-color: var(--rose);
  background: #fbefe8;
  box-shadow: 0 16px 40px rgba(163, 106, 83, 0.13);
}

.select-card.is-selected::after {
  border-color: rgba(163, 106, 83, 0.32);
}

.checkmark {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(163, 106, 83, 0.24);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  color: transparent;
  font-size: 16px;
  font-weight: 900;
  transform: scale(0.86);
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.select-card.is-selected .checkmark {
  background: var(--ok);
  border-color: var(--ok);
  color: white;
  transform: scale(1);
}

.select-card b {
  font-size: 17px;
}

.select-card small {
  color: var(--muted);
  font-size: 13px;
}

.select-card input {
  min-height: 40px;
  margin-top: 6px;
}

.form-error {
  min-height: 22px;
  margin: 22px auto 0;
  max-width: 850px;
  color: var(--danger);
  font-weight: 700;
}

.nav-actions {
  margin: 22px auto 0;
  max-width: 850px;
}

.preview-screen {
  max-width: 980px;
  padding-bottom: 72px;
}

.warning-list {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.warning {
  padding: 12px 14px;
  border-left: 4px solid var(--gold);
  background: #fff7e6;
  color: #6a4d20;
}

.warning.suggestion {
  border-left-color: var(--sage);
  background: #f4f7f1;
  color: #40513e;
}

.final-order-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
  border: 2px solid rgba(163, 106, 83, 0.32);
  background: rgba(255, 253, 248, 0.9);
  box-shadow: 0 18px 46px rgba(56, 35, 24, 0.08);
}

.final-order-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.final-order-head h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 5vw, 48px);
  font-weight: 400;
}

.final-order-head p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.final-order-list {
  padding-bottom: 0;
}

.final-order-panel .timeline-tools {
  display: inline-flex;
}

.final-order-panel .timeline-item.movable {
  cursor: grab;
}

.manual-event-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid rgba(114, 128, 111, 0.28);
  background: rgba(255, 255, 255, 0.74);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.manual-event-panel.is-highlighted {
  border-color: var(--gold);
  box-shadow: 0 14px 38px rgba(196, 161, 91, 0.18);
}

.manual-event-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.manual-event-head h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  font-weight: 400;
}

.compact-grid {
  gap: 12px;
}

.manual-error {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.suggestion-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.suggestion-options button,
.reorder-banner button,
.timeline-tools button {
  min-height: 34px;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.62);
  color: inherit;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.timeline-list {
  display: grid;
  gap: 10px;
  padding-bottom: 8px;
}

.reorder-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(114, 128, 111, 0.36);
  background: rgba(244, 247, 241, 0.92);
  color: #40513e;
  font-size: 13px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  touch-action: pan-y;
}

.timeline-item[draggable="true"] {
  cursor: grab;
}

.timeline-item.is-dragging {
  opacity: 0.45;
}

.timeline-list.reorder-mode .timeline-item.movable,
.timeline-item.is-wiggling {
  border-color: var(--rose);
  box-shadow: 0 12px 34px rgba(163, 106, 83, 0.14);
  animation: reorderWiggle 0.38s ease-in-out infinite;
}

.timeline-item.parallel {
  border-left: 4px solid var(--sage);
  background: rgba(244, 247, 241, 0.9);
}

.timeline-item.custom {
  border-left: 4px solid var(--gold);
}

.timeline-time {
  color: var(--rose);
  font-weight: 800;
}

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

.timeline-title b {
  font-size: 16px;
}

.timeline-title small {
  color: var(--muted);
}

.timeline-lock {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.timeline-tools {
  display: none;
  gap: 6px;
}

.timeline-list.reorder-mode .timeline-tools {
  display: inline-flex;
}

.timeline-tools button {
  width: 38px;
  min-height: 38px;
  padding: 0;
  color: var(--rose-dark);
  font-size: 17px;
  line-height: 1;
}

.timeline-tools button:disabled,
.check-tools button:disabled {
  cursor: not-allowed;
  opacity: 0.34;
}

.timeline-tools [data-remove-custom] {
  color: var(--danger);
}

.timeline-end {
  padding: 14px;
  border: 1px dashed rgba(114, 128, 111, 0.48);
  background: rgba(244, 247, 241, 0.72);
  color: #40513e;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.preview-actions {
  margin-top: 24px;
  padding-bottom: 30px;
}

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

.admin-shell {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.admin-panel {
  padding: clamp(20px, 4vw, 38px);
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.admin-grid {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 24px;
}

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

.admin-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 110px 120px 88px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.admin-row label {
  display: grid;
  gap: 6px;
}

.admin-row span,
.admin-panel h3 {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.hidden {
  display: none !important;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(27, 23, 21, 0.52);
}

.confirm-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(860px, 100%);
  max-height: min(86vh, 760px);
  background: var(--cream);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.confirm-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--line);
}

.confirm-head h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 400;
}

.confirm-head p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
}

.icon-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.confirm-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding: 14px 20px;
}

.check-row {
  display: grid;
  grid-template-columns: 44px 116px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.check-row.movable {
  cursor: grab;
}

.check-row.is-dragging {
  opacity: 0.5;
}

.check-row.parallel {
  border-left: 4px solid var(--sage);
  background: rgba(244, 247, 241, 0.9);
}

.check-row span,
.check-row b {
  color: var(--rose);
  font-weight: 900;
}

.check-row strong,
.check-row small {
  display: block;
}

.check-row small {
  margin-top: 4px;
  color: var(--muted);
}

.check-row em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.check-tools {
  display: flex;
  gap: 6px;
}

.check-tools button {
  display: grid;
  place-items: center;
  width: 38px;
  min-height: 38px;
  border: 1px solid var(--rose-dark);
  background: rgba(255, 255, 255, 0.72);
  color: var(--rose-dark);
  font-size: 17px;
  font-weight: 900;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.96);
}

@keyframes hintFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes reorderWiggle {
  0%,
  100% {
    transform: rotate(-0.35deg);
  }
  50% {
    transform: rotate(0.35deg);
  }
}

@media (max-width: 760px) {
  .client-shell,
  .admin-shell {
    width: 100%;
    padding: 0;
  }

  .client-card,
  .admin-panel {
    min-height: 100vh;
    border: 0;
  }

  .client-head {
    align-items: flex-start;
  }

  .progress {
    width: 120px;
  }

  .screen {
    margin-top: 38px;
  }

  .preview-screen {
    padding-bottom: 120px;
  }

  .field-grid.two,
  .select-grid,
  .admin-grid,
  .admin-row {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }

  .timeline-tools {
    width: 100%;
  }

  .timeline-item.movable .timeline-tools {
    display: flex;
  }

  .timeline-tools button {
    flex: 1;
  }

  .reorder-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .manual-event-head {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-actions,
  .preview-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .pdf-actions {
    flex-direction: column;
  }

  .confirm-modal {
    align-items: stretch;
    padding: 0;
  }

  .confirm-panel {
    width: 100%;
    max-height: 100vh;
  }

  .confirm-head,
  .confirm-actions {
    padding-left: 14px;
    padding-right: 14px;
  }

  .confirm-list {
    padding: 12px 14px;
  }

  .check-row {
    grid-template-columns: 36px 1fr;
  }

  .check-row b {
    text-align: right;
  }

  .check-row div:not(.check-tools) {
    grid-column: 1 / -1;
  }

  .check-tools {
    grid-column: 1 / -1;
    width: 100%;
  }

  .check-tools button {
    flex: 1;
  }

  .check-row em {
    grid-column: 1 / -1;
  }

  .confirm-actions {
    flex-direction: column-reverse;
  }

  .button,
  .choice {
    width: 100%;
  }
}
