:root {
  color-scheme: light;
  --navy-950: #061c2d;
  --navy-900: #082c46;
  --navy-800: #0b4268;
  --blue-600: #087eb6;
  --blue-500: #0e9ace;
  --cyan-300: #70d6ef;
  --ink: #102b3f;
  --muted: #607787;
  --line: #dce7ed;
  --surface: #ffffff;
  --wash: #f3f8fa;
  --error: #b42318;
  --shadow: 0 28px 80px rgba(2, 31, 51, 0.13);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
html { background: var(--wash); }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--wash);
  font-family: "DM Sans", Arial, sans-serif;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; overflow: hidden; }

.site-header {
  position: relative;
  height: 92px;
  padding: 0 clamp(24px, 6vw, 92px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid rgba(8, 66, 104, 0.1);
}

.brand {
  position: relative;
  width: 200px;
  height: 100%;
  max-height: 70px;
  display: block;
  justify-self: start;
  overflow: hidden;
}
.brand img {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: clamp(205px, 26vh, 250px);
  max-width: none;
  height: auto;
  transform: translate(-50%, -50%);
}

.header-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--navy-800);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-title {
  margin: 0;
  justify-self: center;
  color: var(--ink);
  font-family: "Manrope", Arial, sans-serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.07em;
  line-height: 1.2;
  text-align: center;
}

.header-actions { display: flex; align-items: center; justify-self: end; gap: 12px; }
.admin-gear, .header-icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--navy-800);
  background: #f2f8fa;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
}
.admin-gear:hover, .admin-gear:focus-visible,
.header-icon-button:hover, .header-icon-button:focus-visible { color: #fff; background: var(--blue-600); border-color: var(--blue-600); outline: none; }
.admin-gear svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 180ms ease; }
.admin-gear:hover svg, .admin-gear:focus-visible svg { transform: rotate(28deg); }
.theme-toggle { position: relative; }
.theme-icon { position: absolute; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: opacity 160ms ease, transform 180ms ease; }
.theme-icon-sun { opacity: 0; transform: scale(0.55) rotate(-35deg); }
:root[data-theme="dark"] .theme-icon-moon { opacity: 0; transform: scale(0.55) rotate(35deg); }
:root[data-theme="dark"] .theme-icon-sun { opacity: 1; transform: scale(1) rotate(0); }

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blue-500);
  box-shadow: 0 0 0 5px rgba(14, 154, 206, 0.12);
}

main {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: calc(100vh - 164px);
  padding-bottom: 76px;
  background:
    radial-gradient(circle at 84% 7%, rgba(112, 214, 239, 0.15), transparent 27%),
    linear-gradient(180deg, #eef7fa 0, #f8fbfc 460px, #f3f8fa 100%);
}

main::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: -150%;
  pointer-events: none;
  background: url("assets/roi-logo-transparent.png?v=3") repeat;
  background-size: 340px auto;
  background-position: center;
  opacity: 0.026;
  mix-blend-mode: multiply;
  transform: rotate(-45deg) scale(1.08);
  transform-origin: center;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.5) 46%, rgba(0, 0, 0, 0.18));
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.5) 46%, rgba(0, 0, 0, 0.18));
}

main > * { position: relative; z-index: 2; }

.hero {
  position: relative;
  max-width: 1220px;
  margin: 0 auto;
  min-height: 344px;
  padding: 76px 28px 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

body:not([data-portal-depth="0"]) .hero { display: none; }

.eyebrow, .section-kicker {
  margin: 0 0 16px;
  color: var(--blue-600);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1, h2 { font-family: "Manrope", Arial, sans-serif; }
h1 {
  max-width: 760px;
  margin: 0;
  color: var(--navy-950);
  font-size: clamp(42px, 6vw, 72px);
  line-height: 1.03;
  letter-spacing: -0.055em;
}

.hero-description {
  max-width: 560px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.portal-panel {
  position: relative;
  max-width: 1220px;
  min-height: 410px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 64px);
  background: var(--surface);
  border: 1px solid rgba(8, 66, 104, 0.1);
  box-shadow: var(--shadow);
}

.progress-wrap { margin-bottom: 46px; }
.progress-meta { min-height: 28px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.progress-meta p { margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.progress-meta .back-link { grid-column: 1; justify-self: start; }
.progress-meta #stepLabel { grid-column: 2; justify-self: center; }
.progress-track { height: 4px; margin-top: 12px; background: #e7eff3; overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 33.333%; background: linear-gradient(90deg, var(--blue-600), var(--cyan-300)); transition: width 240ms ease; }

.back-link {
  padding: 0;
  border: 0;
  color: var(--navy-800);
  background: transparent;
  font-weight: 700;
}
.back-link:hover { color: var(--blue-600); }

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: flex-end;
  margin-bottom: 32px;
}
.section-heading h2 {
  margin: 0;
  color: var(--navy-950);
  font-size: clamp(26px, 4vw, 40px);
  letter-spacing: -0.035em;
}
.section-heading > p { max-width: 330px; margin: 0 0 4px; color: var(--muted); line-height: 1.55; }
.form-heading-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 14px; }
.form-heading-actions p { max-width: 330px; margin: 0; color: var(--muted); line-height: 1.55; text-align: right; }
.inline-admin-button { padding: 9px 13px; color: var(--blue-600); background: #f2fafe; border: 1px solid rgba(14, 154, 206, 0.35); font-size: 12px; font-weight: 800; }
.inline-admin-button:hover, .inline-admin-button:focus-visible, .inline-admin-button.is-active { color: #fff; background: var(--blue-600); border-color: var(--blue-600); outline: none; }
.inline-admin-button.is-active { position: fixed; top: 24px; right: 92px; z-index: 40; box-shadow: 0 10px 28px rgba(4, 47, 76, 0.22); }

.platform-grid, .category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.platform-card, .category-card {
  position: relative;
  min-height: 210px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  color: var(--ink);
  background: #f8fbfc;
  border: 1px solid var(--line);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}
.platform-card:hover, .platform-card:focus-visible,
.category-card:hover, .category-card:focus-visible {
  transform: translateY(-5px);
  border-color: rgba(14, 154, 206, 0.6);
  background: var(--surface);
  box-shadow: 0 18px 34px rgba(4, 47, 76, 0.1);
  outline: none;
}
.platform-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  margin-bottom: 34px;
  color: var(--surface);
  background: var(--navy-800);
  font-family: "Manrope", Arial, sans-serif;
  font-weight: 800;
  font-size: 18px;
}
.platform-card h3 { margin: 0; font-size: 21px; }
.platform-card p { margin: 8px 0 0; color: var(--muted); line-height: 1.45; }
.platform-arrow { position: absolute; right: 22px; bottom: 24px; color: var(--blue-600); font-size: 22px; }
.category-card h3 { margin: 0; max-width: 170px; font-size: 20px; }
.category-card p { margin: 10px 0 0; color: var(--muted); line-height: 1.45; }
.category-card.is-admin-sortable {
  padding-top: 48px;
  cursor: grab;
  transform-origin: 50% 55%;
  animation: category-wobble 320ms ease-in-out infinite alternate;
}
.category-card.is-admin-sortable:nth-child(even) { animation-direction: alternate-reverse; animation-delay: -120ms; }
.category-card.is-admin-sortable:nth-child(3n) { animation-delay: -220ms; }
.category-card.is-admin-sortable:active { cursor: grabbing; }
.category-card.is-dragging { opacity: 0.22; animation: none; transform: scale(0.97); border-color: var(--blue-600); box-shadow: none; }
.category-drag-ghost {
  position: fixed;
  z-index: 80;
  margin: 0;
  pointer-events: none;
  opacity: 0.96;
  transform: rotate(1.5deg) scale(1.035);
  box-shadow: 0 24px 60px rgba(4, 47, 76, 0.24);
}
@keyframes category-wobble {
  from { transform: rotate(-0.45deg) translateY(-0.5px); }
  to { transform: rotate(0.45deg) translateY(0.5px); }
}
.category-drag-handle {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  padding-bottom: 8px;
  color: var(--blue-600);
  border-bottom: 1px solid rgba(14, 154, 206, 0.2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.category-drag-handle:active { cursor: grabbing; }
.empty-category { margin: 0; padding: 22px; color: var(--muted); background: #f8fbfc; border: 1px solid var(--line); line-height: 1.55; }

#selectionStep .section-heading {
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
#selectionStep .section-heading > p { max-width: 520px; margin: 0; }
.selection-heading-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.selection-heading-actions > p { max-width: 520px; margin: 0; color: var(--muted); line-height: 1.55; }
.selection-heading-actions .category-reorder-hint { color: var(--blue-600); font-size: 12px; font-weight: 700; }
.selection-heading-actions .category-reorder-hint.is-error { color: var(--error); }
.page-admin-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 15px;
  color: var(--blue-600);
  background: #f2fafe;
  border: 1px solid rgba(14, 154, 206, 0.38);
  font-size: 12px;
  font-weight: 800;
}
.page-admin-button:hover, .page-admin-button:focus-visible {
  color: #fff;
  background: var(--blue-600);
  border-color: var(--blue-600);
  outline: none;
}
#selectionStep .category-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 280px));
  justify-content: center;
  max-width: 940px;
  margin: 0 auto;
}
#selectionStep .category-card { align-items: center; text-align: center; }
#selectionStep .category-card h3 { max-width: none; }
#selectionStep .platform-arrow { position: static; align-self: center; margin-top: auto; padding-top: 14px; }
#selectionStep .empty-category { max-width: 680px; margin-inline: auto; text-align: center; }

.type-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.type-card {
  min-height: 104px;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: left;
  font-weight: 700;
  line-height: 1.35;
  transition: border-color 180ms ease, background 180ms ease;
}
.type-card:hover, .type-card:focus-visible { border-color: var(--blue-500); background: #f2fafe; outline: none; }
.type-card span:last-child { color: var(--blue-600); font-size: 20px; }

.step-view[hidden] { display: none; }
.step-view.is-active { animation: reveal 240ms ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.form-grid { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 24px; transition: background-color 160ms ease, box-shadow 160ms ease; }
.form-grid.is-grid-drag-target { background: rgba(14, 154, 206, 0.045); box-shadow: 0 0 0 10px rgba(14, 154, 206, 0.045); }
.ticket-field-wrap { min-width: 0; }
.grid-columns-1 { grid-column: auto / span 1; }
.grid-columns-2 { grid-column: auto / span 2; }
.grid-rows-3 { grid-row: auto / span 3; }
.grid-rows-4 { grid-row: auto / span 4; }
.grid-rows-5 { grid-row: auto / span 5; }
.grid-rows-6 { grid-row: auto / span 6; }
.grid-rows-7 { grid-row: auto / span 7; }
.grid-rows-8 { grid-row: auto / span 8; }
.grid-rows-9 { grid-row: auto / span 9; }
.grid-rows-10 { grid-row: auto / span 10; }
.grid-rows-11 { grid-row: auto / span 11; }
.grid-rows-12 { grid-row: auto / span 12; }
.grid-rows-13 { grid-row: auto / span 13; }
.grid-rows-14 { grid-row: auto / span 14; }
.grid-rows-15 { grid-row: auto / span 15; }
.grid-rows-16 { grid-row: auto / span 16; }
.grid-rows-17 { grid-row: auto / span 17; }
.grid-rows-18 { grid-row: auto / span 18; }
.grid-rows-19 { grid-row: auto / span 19; }
.grid-rows-20 { grid-row: auto / span 20; }
.grid-rows-21 { grid-row: auto / span 21; }
.grid-rows-22 { grid-row: auto / span 22; }
.grid-rows-23 { grid-row: auto / span 23; }
.grid-rows-24 { grid-row: auto / span 24; }
.grid-rows-25 { grid-row: auto / span 25; }
.grid-rows-26 { grid-row: auto / span 26; }
.grid-rows-27 { grid-row: auto / span 27; }
.grid-rows-28 { grid-row: auto / span 28; }
.grid-rows-29 { grid-row: auto / span 29; }
.grid-rows-30 { grid-row: auto / span 30; }
.ticket-field-wrap:not(.editable-ticket-field) .field { height: 100%; }
.field { display: flex; flex-direction: column; gap: 9px; }
.field span { color: var(--navy-900); font-size: 14px; font-weight: 700; }
.field strong { color: var(--blue-600); }
.field.full-width { grid-column: 1 / -1; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 14px 15px;
  color: var(--ink);
  background: #fbfdfe;
  border: 1px solid #cddce4;
  border-radius: 0;
  outline: none;
}
.field textarea { resize: vertical; min-height: 138px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(14, 154, 206, 0.12); }
.field input.is-invalid, .field select.is-invalid, .field textarea.is-invalid { border-color: var(--error); }
.field small { color: var(--muted); font-size: 12px; }
.example-file-download {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 20px;
  color: var(--navy-900);
  background: #eef9fc;
  border: 1px solid rgba(14, 154, 206, 0.35);
}
.example-file-download div { display: flex; flex-direction: column; gap: 4px; }
.example-file-download strong { font-size: 15px; }
.example-file-download span { color: var(--muted); font-size: 13px; }
.example-file-download a {
  flex: 0 0 auto;
  padding: 11px 15px;
  color: #fff;
  background: var(--navy-900);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}
.example-file-download a:hover, .example-file-download a:focus-visible { background: var(--blue-600); }
.radio-options { display: flex; flex-wrap: wrap; gap: 16px 28px; min-height: 50px; padding: 13px 15px; background: #fbfdfe; border: 1px solid #cddce4; }
.radio-options label { display: inline-flex; align-items: center; gap: 8px; }
.radio-options input { width: auto; margin: 0; padding: 0; }
.radio-options span { font-weight: 500; }

.inline-form-editor { margin: -4px 0 30px; padding: 24px; color: var(--ink); background: #eef9fc; border: 2px solid var(--blue-500); }
.inline-form-editor h3 { margin: 0; color: var(--navy-950); font-family: "Manrope", Arial, sans-serif; font-size: 26px; }
.inline-form-editor > div > p:last-child { margin: 8px 0 0; color: var(--muted); }
.inline-add-field-form { display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 16px; margin-top: 22px; padding-top: 20px; border-top: 1px solid rgba(14, 154, 206, 0.25); }
.inline-add-field-form .primary-button { justify-self: start; }
.editable-ticket-field { position: relative; min-height: 0; padding: 16px; background: #f7fcfe; border: 2px dashed rgba(14, 154, 206, 0.5); animation: module-wobble 170ms ease-in-out infinite alternate; transition: border-color 120ms ease, box-shadow 120ms ease; }
.editable-ticket-field:nth-child(even) { animation-direction: alternate-reverse; animation-duration: 190ms; }
.editable-ticket-field:nth-child(3n) { animation-delay: -90ms; animation-duration: 210ms; }
.editable-ticket-field.is-dragging { opacity: 0.45; animation: none; transform: scale(0.98); }
.editable-ticket-field.is-drag-target { border-style: solid; border-color: var(--blue-600); box-shadow: 0 0 0 4px rgba(14, 154, 206, 0.12); }
.editable-ticket-field.is-resizing { border-style: solid; border-color: var(--blue-600); box-shadow: 0 0 0 4px rgba(14, 154, 206, 0.12); animation: none; transform: none; user-select: none; }
@keyframes module-wobble {
  from { transform: rotate(-0.32deg) translate(-0.4px, 0); }
  to { transform: rotate(0.32deg) translate(0.4px, -0.35px); }
}
.inline-drag-handle { position: relative; z-index: 4; margin: -8px -8px 12px; padding: 6px 8px; color: var(--blue-600); background: #e7f7fb; font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; cursor: grab; touch-action: none; user-select: none; }
.inline-drag-handle:active { cursor: grabbing; }
.resize-handle { position: absolute; z-index: 3; padding: 0; background: transparent; border: 0; outline: none; }
.resize-handle::after { content: ""; position: absolute; border-radius: 10px; background: var(--blue-500); opacity: 0.45; transition: opacity 120ms ease, transform 120ms ease; }
.resize-handle:hover::after, .resize-handle:focus-visible::after, .is-resizing .resize-handle::after { opacity: 1; transform: scale(1.15); }
.resize-handle-top, .resize-handle-bottom { left: 50%; width: 58px; height: 14px; margin-left: -29px; cursor: ns-resize; }
.resize-handle-top { top: -13px; }
.resize-handle-bottom { bottom: -13px; }
.resize-handle-top::after, .resize-handle-bottom::after { inset: 5px 8px; height: 4px; }
.resize-handle-left, .resize-handle-right { top: 50%; width: 14px; height: 58px; margin-top: -29px; cursor: ew-resize; }
.resize-handle-left { left: -8px; }
.resize-handle-right { right: -8px; }
.resize-handle-left::after, .resize-handle-right::after { inset: 8px 5px; width: 4px; }
.editable-ticket-field input, .editable-ticket-field select, .editable-ticket-field textarea { pointer-events: none; background: #fff; }
.inline-field-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.inline-field-actions button { padding: 6px 9px; color: var(--navy-800); background: #fff; border: 1px solid var(--line); font-size: 11px; font-weight: 700; }
.inline-field-actions button:hover, .inline-field-actions button:focus-visible { color: var(--blue-600); border-color: var(--blue-500); outline: none; }
.inline-field-actions .danger-action { margin-left: auto; color: var(--error); }
.inline-field-actions .danger-action:hover, .inline-field-actions .danger-action:focus-visible { color: #fff; background: var(--error); border-color: var(--error); }
#ticketForm.is-editing-form .form-footer { display: none; }
#ticketForm.is-editing-form .form-grid {
  --editor-row-height: 44px;
  --editor-grid-gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(30, var(--editor-row-height));
  grid-auto-rows: var(--editor-row-height);
  gap: var(--editor-grid-gap);
  min-height: 1668px;
  align-items: stretch;
  background-image:
    linear-gradient(to right, transparent calc(50% - 7px), rgba(14, 154, 206, 0.09) calc(50% - 7px), rgba(14, 154, 206, 0.09) calc(50% + 7px), transparent calc(50% + 7px)),
    repeating-linear-gradient(to bottom, transparent 0, transparent 55px, rgba(14, 154, 206, 0.08) 55px, rgba(14, 154, 206, 0.08) 56px);
}

@media (prefers-reduced-motion: reduce) {
  .editable-ticket-field { animation: none; }
}

.form-footer, .review-actions {
  margin-top: 30px;
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  border-top: 1px solid var(--line);
}
.form-footer p { margin: 0; color: var(--muted); font-size: 13px; }
.lock-icon { color: var(--blue-500); font-size: 9px; }

.primary-button, .secondary-button {
  min-height: 50px;
  padding: 0 23px;
  border: 1px solid var(--navy-900);
  font-weight: 800;
}
.primary-button { color: #fff; background: var(--navy-900); }
.primary-button:hover { background: var(--blue-600); border-color: var(--blue-600); }
.secondary-button { color: var(--navy-900); background: var(--surface); }
.secondary-button:hover { border-color: var(--blue-500); color: var(--blue-600); }

.review-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.75fr); gap: 34px; }
.review-list { margin: 0; border-top: 1px solid var(--line); }
.review-row { padding: 17px 0; display: grid; grid-template-columns: 160px 1fr; gap: 20px; border-bottom: 1px solid var(--line); }
.review-row dt { color: var(--muted); font-size: 13px; font-weight: 700; }
.review-row dd { margin: 0; color: var(--ink); white-space: pre-wrap; }
.route-card { padding: 26px; color: #dcecf4; background: var(--navy-950); }
.route-card .section-kicker { color: var(--cyan-300); }
.route-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 25px 0; color: #fff; font-weight: 700; }
.route-line b { color: var(--cyan-300); }
.route-card > p:last-child { margin: 0; color: #aac0ce; line-height: 1.55; font-size: 14px; }

.confirmation { max-width: 620px; margin: 10px auto; padding: 24px 0 36px; text-align: center; }
.success-mark { width: 76px; height: 76px; margin: 0 auto 30px; display: grid; place-items: center; color: #fff; background: var(--blue-600); border-radius: 50%; font-size: 34px; }
.confirmation h2 { margin: 0; font-size: clamp(32px, 5vw, 48px); }
.confirmation-copy { margin: 18px auto 30px; color: var(--muted); line-height: 1.6; }
.submission-error { margin: 24px 0 0; padding: 14px 16px; color: var(--error); background: #fff5f4; border: 1px solid #f1b7b2; }

body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 24, 39, 0.72);
}
.admin-dialog {
  width: min(920px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: clamp(26px, 5vw, 48px);
  background: #fff;
  box-shadow: 0 30px 90px rgba(0, 20, 34, 0.3);
}
.page-editor-dialog { width: min(700px, 100%); }
.page-editor-form { display: grid; gap: 22px; }
.page-editor-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.page-editor-fieldset legend { margin-bottom: 12px; color: var(--ink); font-weight: 800; }
.page-editor-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.page-editor-choice {
  min-height: 120px;
  padding: 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  background: #f8fbfc;
  border: 1px solid var(--line);
}
.page-editor-choice:has(input:checked) { background: #eef9fd; border-color: var(--blue-600); box-shadow: inset 0 0 0 1px var(--blue-600); }
.page-editor-choice.is-unavailable { display: none; }
.page-editor-choice input { width: 18px; height: 18px; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--blue-600); }
.page-editor-choice span { display: grid; gap: 7px; }
.page-editor-choice strong { color: var(--navy-950); }
.page-editor-choice small { color: var(--muted); line-height: 1.45; }
.page-editor-actions { display: flex; justify-content: flex-end; gap: 12px; }
.admin-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 28px; }
.admin-heading h2 { margin: 0; color: var(--navy-950); font-size: 32px; }
.modal-close { width: 42px; height: 42px; border: 1px solid var(--line); color: var(--navy-800); background: #f8fbfc; font-size: 28px; line-height: 1; }
.admin-login { display: grid; gap: 20px; }
.admin-login > p, .admin-intro { margin: 0; color: var(--muted); line-height: 1.55; }
.admin-login .primary-button { justify-self: start; }
.admin-add-form { display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 18px; margin-top: 24px; padding: 24px; background: #f5f9fb; border: 1px solid var(--line); }
.admin-add-form .primary-button { justify-self: start; }
.admin-check { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 14px; }
.admin-check input { width: 18px; height: 18px; accent-color: var(--blue-600); }
.required-field-note { margin-left: 8px; color: var(--muted); font-weight: 400; }
.full-width { grid-column: 1 / -1; }
.admin-tree-wrap { margin-top: 24px; }
.admin-tree-wrap h3 { margin: 0 0 18px; color: var(--navy-950); }
#adminTree ul { margin: 0; padding: 0; list-style: none; }
#adminTree li { margin: 0; color: var(--ink); }
#adminTree em { margin-left: 5px; color: var(--blue-600); font-size: 11px; font-style: normal; font-weight: 700; text-transform: uppercase; }
.admin-node-row { min-height: 54px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.admin-tree-list { border-top: 1px solid var(--line); }
.admin-tree-branch > summary { cursor: pointer; list-style: none; background: #f8fbfc; }
.admin-tree-branch > summary::-webkit-details-marker { display: none; }
.admin-tree-branch > summary .admin-node-label::before { content: "›"; width: 18px; display: inline-block; color: var(--blue-600); font-size: 22px; font-weight: 700; transform-origin: center; transition: transform 160ms ease; }
.admin-tree-branch[open] > summary .admin-node-label::before { transform: rotate(90deg); }
.admin-tree-branch > summary:hover, .admin-tree-branch > summary:focus-visible { background: #eef8fc; outline: none; }
.admin-tree-children { padding-left: 24px; border-left: 2px solid #d9edf5; }
.admin-tree-leaf .admin-node-row { background: #fff; }
.admin-node-actions { display: inline-flex; gap: 7px; opacity: 0.72; transition: opacity 160ms ease; }
.admin-node-row:hover .admin-node-actions, .admin-node-row:focus-within .admin-node-actions { opacity: 1; }
.admin-node-actions button { padding: 5px 8px; color: var(--navy-800); background: #fff; border: 1px solid var(--line); font-size: 11px; font-weight: 700; }
.admin-node-actions button:hover, .admin-node-actions button:focus-visible { border-color: var(--blue-500); color: var(--blue-600); outline: none; }
.admin-node-actions .danger-action { color: var(--error); }
.admin-node-actions .danger-action:hover, .admin-node-actions .danger-action:focus-visible { color: #fff; background: var(--error); border-color: var(--error); }
.admin-node-actions .form-action { color: var(--blue-600); background: #f2fafe; }
.admin-builder-back { margin-bottom: 26px; }
.form-builder-title { margin: 0 0 10px; color: var(--navy-950); font-family: "Manrope", Arial, sans-serif; font-size: 30px; }
.form-builder-list { display: grid; gap: 14px; margin: 26px 0; }
.builder-field-card { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 14px 22px; padding: 18px; background: #f8fbfc; border: 1px solid var(--line); }
.builder-field-preview input, .builder-field-preview textarea, .builder-field-preview select { background: #fff; }
.builder-field-meta { display: flex; align-items: flex-start; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.builder-field-meta span { padding: 4px 7px; color: var(--muted); background: #eaf2f6; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.builder-field-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.builder-field-actions button { padding: 7px 10px; color: var(--navy-800); background: #fff; border: 1px solid var(--line); font-size: 12px; font-weight: 700; }
.builder-field-actions button:hover, .builder-field-actions button:focus-visible { color: var(--blue-600); border-color: var(--blue-500); outline: none; }
.builder-field-actions .danger-action { margin-left: auto; color: var(--error); }
.builder-field-actions .danger-action:hover, .builder-field-actions .danger-action:focus-visible { color: #fff; background: var(--error); border-color: var(--error); }
.form-builder-add { margin-top: 0; }
.builder-status { min-height: 22px; margin: 16px 0 0; color: #087443; font-weight: 700; }
.admin-footer { margin-top: 26px; padding-top: 22px; display: flex; justify-content: space-between; align-items: center; gap: 18px; border-top: 1px solid var(--line); }
.admin-footer p { margin: 0; color: #087443; font-weight: 700; }

footer {
  min-height: 72px;
  padding: 0 clamp(24px, 6vw, 92px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  color: #78909e;
  background: var(--navy-950);
  font-size: 12px;
  letter-spacing: 0.05em;
}

@media (min-width: 621px) {
  body { height: 100dvh; overflow: hidden; }
  .app-shell {
    height: 100dvh;
    min-height: 0;
    display: grid;
    grid-template-rows: clamp(64px, 9vh, 82px) minmax(0, 1fr) clamp(36px, 6vh, 56px);
  }
  .site-header { height: 100%; }
  main {
    min-height: 0;
    padding-bottom: 0;
    overflow: clip;
    display: grid;
    grid-template-rows: minmax(165px, 35%) minmax(0, 65%);
  }
  body:not([data-portal-depth="0"]) main {
    grid-template-rows: minmax(0, 1fr);
    align-content: stretch;
  }
  .hero {
    width: 100%;
    min-height: 0;
    padding: clamp(18px, 3.4vh, 34px) 28px clamp(14px, 2.6vh, 28px);
  }
  h1 { font-size: clamp(38px, min(4.8vw, 7vh), 62px); }
  .hero-description { margin-top: clamp(10px, 2vh, 20px); font-size: clamp(15px, 1.35vw, 18px); }
  body:not([data-portal-depth="0"]) .hero { display: none; }
  .portal-panel {
    width: min(calc(100% - 48px), 1220px);
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding: clamp(20px, 3vh, 34px) clamp(28px, 5vw, 64px);
  }
  body[data-portal-view="selection"][data-portal-depth="0"] main {
    grid-template-rows: auto auto;
    align-content: center;
    gap: clamp(0px, 1.5vh, 14px);
  }
  body[data-portal-view="selection"][data-portal-depth="0"] .hero { padding-block: clamp(10px, 2vh, 22px); }
  body[data-portal-view="selection"][data-portal-depth="0"] .hero-description { margin-top: clamp(7px, 1.5vh, 14px); }
  body[data-portal-view="selection"][data-portal-depth="0"] .portal-panel { height: auto; max-height: 100%; }
  body[data-portal-view="selection"][data-portal-depth="0"] .portal-panel { padding-block: clamp(14px, 2vh, 24px); }
  body:not([data-portal-depth="0"]) .portal-panel {
    align-self: center;
    height: auto;
    max-height: min(760px, calc(100% - 48px));
  }
  .progress-wrap { margin-bottom: clamp(18px, 2.8vh, 30px); }
  .section-heading { margin-bottom: clamp(18px, 2.8vh, 28px); }
  body[data-portal-view="selection"][data-portal-depth="0"] .progress-wrap { margin-bottom: clamp(10px, 1.5vh, 18px); }
  body[data-portal-view="selection"][data-portal-depth="0"] #selectionStep .section-heading { gap: 8px; margin-bottom: 12px; }
  body[data-portal-view="selection"][data-portal-depth="0"] #selectionStep .section-kicker { margin-bottom: 9px; }
  body[data-portal-view="selection"][data-portal-depth="0"] #selectionStep .section-heading h2 { font-size: clamp(24px, min(3vw, 4.6vh), 36px); }
  body[data-portal-view="selection"][data-portal-depth="0"] #selectionStep .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #selectionStep .category-card { min-height: clamp(102px, 15vh, 135px); padding: clamp(14px, 2.2vh, 21px); }
  #selectionStep .platform-icon {
    width: 40px;
    height: 40px;
    margin-bottom: clamp(8px, 1.4vh, 14px);
  }
  footer { min-height: 0; height: 100%; }
}

@media (min-width: 621px) and (max-height: 650px) {
  .app-shell { grid-template-rows: 56px minmax(0, 1fr) 32px; }
  main { grid-template-rows: minmax(132px, 28%) minmax(0, 72%); }
  body:not([data-portal-depth="0"]) main { grid-template-rows: minmax(0, 1fr); }
  .hero { padding-block: 10px; }
  h1 { font-size: 38px; }
  .hero-description { margin-top: 7px; font-size: 14px; line-height: 1.4; }
  body[data-portal-view="selection"][data-portal-depth="0"] .portal-panel { padding-block: 10px; }
  body[data-portal-view="selection"][data-portal-depth="0"] .progress-wrap { margin-bottom: 7px; }
  body[data-portal-view="selection"][data-portal-depth="0"] #selectionStep .section-heading { gap: 4px; margin-bottom: 8px; }
  body[data-portal-view="selection"][data-portal-depth="0"] #selectionStep .section-kicker { margin-bottom: 5px; }
  body[data-portal-view="selection"][data-portal-depth="0"] #selectionStep .category-card { min-height: 92px; padding-block: 10px; }
  body[data-portal-view="selection"][data-portal-depth="0"] #selectionStep .platform-icon { width: 36px; height: 36px; margin-bottom: 6px; }
  footer { font-size: 10px; }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --navy-950: #edf9ff;
  --navy-900: #ccebf8;
  --navy-800: #8ed8f2;
  --blue-600: #22a9df;
  --blue-500: #45c3ec;
  --cyan-300: #83def4;
  --ink: #dcecf4;
  --muted: #9db5c2;
  --line: #294858;
  --surface: #112b39;
  --wash: #071923;
  --error: #ff8b80;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

:root[data-theme="dark"] .site-header { border-bottom-color: rgba(131, 222, 244, 0.14); }
:root[data-theme="dark"] .admin-gear,
:root[data-theme="dark"] .header-icon-button { background: #173746; }
:root[data-theme="dark"] main {
  background:
    radial-gradient(circle at 84% 7%, rgba(69, 195, 236, 0.12), transparent 29%),
    linear-gradient(180deg, #0a2330 0, #091d28 460px, var(--wash) 100%);
}
:root[data-theme="dark"] main::before { opacity: 0.018; mix-blend-mode: normal; filter: brightness(1.7); }
:root[data-theme="dark"] .portal-panel { border-color: rgba(131, 222, 244, 0.12); }
:root[data-theme="dark"] .progress-track { background: #294553; }
:root[data-theme="dark"] .platform-card,
:root[data-theme="dark"] .category-card,
:root[data-theme="dark"] .empty-category,
:root[data-theme="dark"] .page-editor-choice,
:root[data-theme="dark"] .builder-field-card { background: #0d2532; }
:root[data-theme="dark"] .platform-card:hover,
:root[data-theme="dark"] .platform-card:focus-visible,
:root[data-theme="dark"] .category-card:hover,
:root[data-theme="dark"] .category-card:focus-visible { background: #163745; box-shadow: 0 18px 34px rgba(0, 0, 0, 0.28); }
:root[data-theme="dark"] .platform-icon { color: #061c2d; background: var(--cyan-300); }
:root[data-theme="dark"] .type-card { background: #102936; }
:root[data-theme="dark"] .type-card:hover,
:root[data-theme="dark"] .type-card:focus-visible,
:root[data-theme="dark"] .page-admin-button,
:root[data-theme="dark"] .inline-admin-button { background: #113746; }
:root[data-theme="dark"] .field input,
:root[data-theme="dark"] .field select,
:root[data-theme="dark"] .field textarea,
:root[data-theme="dark"] .radio-options { color: var(--ink); background: #0a202c; border-color: #355464; }
:root[data-theme="dark"] .field input::placeholder,
:root[data-theme="dark"] .field textarea::placeholder { color: #7896a5; }
:root[data-theme="dark"] .example-file-download,
:root[data-theme="dark"] .inline-form-editor { background: #0d303f; }
:root[data-theme="dark"] .editable-ticket-field { background: #0d2936; }
:root[data-theme="dark"] .inline-drag-handle { background: #143b49; }
:root[data-theme="dark"] .editable-ticket-field input,
:root[data-theme="dark"] .editable-ticket-field select,
:root[data-theme="dark"] .editable-ticket-field textarea,
:root[data-theme="dark"] .builder-field-preview input,
:root[data-theme="dark"] .builder-field-preview textarea,
:root[data-theme="dark"] .builder-field-preview select { background: #091e29; }
:root[data-theme="dark"] .inline-field-actions button,
:root[data-theme="dark"] .admin-node-actions button,
:root[data-theme="dark"] .builder-field-actions button { color: var(--navy-800); background: #102b38; }
:root[data-theme="dark"] .primary-button { color: #fff; background: #087eb6; border-color: #1599ce; }
:root[data-theme="dark"] .secondary-button { color: var(--navy-900); background: #102b38; border-color: #426171; }
:root[data-theme="dark"] .route-card,
:root[data-theme="dark"] footer { background: #04131c; }
:root[data-theme="dark"] .submission-error { background: #371b1c; border-color: #79413e; }
:root[data-theme="dark"] .admin-dialog { background: var(--surface); box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55); }
:root[data-theme="dark"] .modal-close,
:root[data-theme="dark"] .admin-add-form,
:root[data-theme="dark"] .admin-tree-branch > summary,
:root[data-theme="dark"] .admin-tree-leaf .admin-node-row { background: #0d2532; }
:root[data-theme="dark"] .page-editor-choice:has(input:checked),
:root[data-theme="dark"] .admin-tree-branch > summary:hover,
:root[data-theme="dark"] .admin-tree-branch > summary:focus-visible { background: #123847; }
:root[data-theme="dark"] .admin-tree-children { border-left-color: #315666; }
:root[data-theme="dark"] .builder-field-meta span { background: #1a3a48; }
:root[data-theme="dark"] .builder-status,
:root[data-theme="dark"] .admin-footer p { color: #67d7a2; }

@media (max-width: 920px) {
  .platform-grid, .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-layout { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .site-header { height: 78px; padding-inline: 20px; }
  .brand { width: 126px; height: 56px; }
  .brand img { width: 158px; }
  .header-title { width: 110px; font-size: 11px; letter-spacing: 0.04em; }
  .header-label { font-size: 10px; letter-spacing: 0.05em; }
  .header-actions { gap: 10px; }
  .admin-gear, .header-icon-button { width: 38px; height: 38px; }
  .hero { min-height: 290px; padding: 56px 20px 40px; }
  .hero-description { font-size: 16px; }
  .portal-panel { margin: 0 12px; padding: 28px 20px; }
  body:not([data-portal-depth="0"]) .portal-panel { margin-block: 24px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .section-heading > p { font-size: 14px; }
  .form-heading-actions { align-items: flex-start; }
  .form-heading-actions p { text-align: left; }
  .inline-admin-button.is-active { top: 18px; right: 66px; }
  .platform-grid, .category-grid, .type-grid, .form-grid { grid-template-columns: 1fr; }
  .ticket-field-wrap { grid-column: 1 / -1 !important; }
  #ticketForm.is-editing-form .form-grid { grid-template-columns: 1fr; grid-template-rows: none; min-height: 0; background-image: none; }
  #ticketForm.is-editing-form .editable-ticket-field { grid-row: auto !important; min-height: 180px; }
  .field.full-width { grid-column: auto; }
  .platform-card, .category-card { min-height: 165px; }
  .platform-icon { margin-bottom: 20px; }
  .form-footer, .review-actions { align-items: stretch; flex-direction: column; }
  .admin-add-form { grid-template-columns: 1fr; padding: 18px; }
  .page-editor-choices { grid-template-columns: 1fr; }
  .page-editor-actions { align-items: stretch; flex-direction: column-reverse; }
  .inline-add-field-form { grid-template-columns: 1fr; }
  .inline-add-field-form .full-width { grid-column: auto; }
  .admin-add-form .full-width { grid-column: auto; }
  .admin-footer { align-items: stretch; flex-direction: column; }
  .builder-field-card { grid-template-columns: 1fr; }
  .builder-field-meta { justify-content: flex-start; }
  .builder-field-actions .danger-action { margin-left: 0; }
  .primary-button, .secondary-button { width: 100%; }
  .review-row { grid-template-columns: 1fr; gap: 6px; }
  footer { padding: 22px; align-items: flex-start; flex-direction: column; }
}

@media (max-width: 420px) {
  .site-header { padding-inline: 16px; }
  .brand { width: 96px; }
  .brand img { width: 120px; }
  .header-title { width: 88px; font-size: 9.5px; letter-spacing: 0.02em; }
  .header-actions { gap: 6px; }
  .admin-gear, .header-icon-button { width: 34px; height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
