:root {
  --blue: #003594;
  --teal: #47D7AC;
  --red: #F9423A;
  --ink: #0b1a3a;
  --muted: #55607a;
  --line: #c9d3e6;
  --paper: #ffffff;
  --ground: #eef2f9;
  --offset: 6px;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: Bitter, Georgia, serif;
  line-height: 1.45;
}

h2, .btn, .field > span, legend, summary, .top-title strong, .tile strong, .num, .seg label span {
  font-family: Chivo, system-ui, sans-serif;
}

.top {
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  border-bottom: 6px solid var(--teal);
}
.top-logo { height: 44px; width: auto; display: block; }
.top-title { display: flex; flex-direction: column; }
.top-title strong { font-weight: 900; font-size: 1.25rem; letter-spacing: -0.01em; }
.top-title span { font-size: 0.875rem; opacity: 0.9; }

.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 16px 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  gap: 32px;
  align-items: start;
}

.form { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.step {
  background: var(--paper);
  border: 2px solid var(--blue);
  box-shadow: var(--offset) var(--offset) 0 var(--teal);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

h2 {
  margin: 0;
  font-weight: 900;
  font-size: 1.125rem;
  color: var(--blue);
  display: flex;
  align-items: center;
  gap: 10px;
}
.num {
  background: var(--blue);
  color: #fff;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.9375rem;
}

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

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > span, legend {
  font-weight: 700;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--blue);
  padding: 0;
}
.field small, .note, .upload small { font-size: 0.8125rem; color: var(--muted); }
.note { margin: 0; }
.count.over { color: #b3261e; font-weight: 700; }

input[type="text"], input[type="password"], select, textarea {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 0;
  padding: 10px 12px;
  width: 100%;
  min-height: 44px;
}
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, .tile:focus-visible,
.seg input:focus-visible + span, summary:focus-visible, .thumb:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
  border-color: var(--blue);
}

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tile {
  font: inherit;
  text-align: left;
  background: #fff;
  color: var(--ink);
  border: 2px solid var(--line);
  border-radius: 0;
  padding: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 76px;
}
.tile strong { font-weight: 900; color: var(--blue); }
.tile span { font-size: 0.8125rem; color: var(--muted); }
.tile:hover { border-color: var(--blue); }
.tile[aria-checked="true"] { border-color: var(--blue); background: var(--teal); box-shadow: 4px 4px 0 var(--blue); }
.tile[aria-checked="true"] span { color: var(--blue); }

.seg { flex-direction: row; flex-wrap: wrap; gap: 0; }
.seg legend { margin-bottom: 6px; width: 100%; }
.seg label { position: relative; flex: 1; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg label span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 2px solid var(--line);
  font-weight: 700;
  color: var(--blue);
  background: #fff;
}
.seg label + label span { border-left: 0; }
.seg input:checked + span { background: var(--blue); border-color: var(--blue); color: #fff; }

.btn {
  font-weight: 900;
  font-size: 1rem;
  border: 2px solid var(--blue);
  border-radius: 0;
  background: var(--blue);
  color: #fff;
  padding: 10px 18px;
  min-height: 44px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.btn:hover { background: #002a78; }
.btn-ghost { background: #fff; color: var(--blue); }
.btn-ghost:hover { background: var(--ground); }
.btn-primary { box-shadow: var(--offset) var(--offset) 0 var(--teal); font-size: 1.0625rem; padding: 12px 24px; }
.btn-primary:active { transform: translate(3px, 3px); box-shadow: 3px 3px 0 var(--teal); }
.btn[disabled] { background: #8794b0; border-color: #8794b0; box-shadow: none; cursor: not-allowed; }
.link { font: inherit; background: none; border: 0; padding: 8px; color: var(--blue); text-decoration: underline; cursor: pointer; }

.row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.status { font-size: 0.875rem; color: var(--muted); }
.status.error { color: #b3261e; font-weight: 700; }

.check { display: flex; align-items: center; gap: 10px; font-size: 0.9375rem; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); }

.upload { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; cursor: pointer; }

.images { display: flex; flex-direction: column; gap: 12px; }
.images:empty { display: none; }
.image {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
  border: 2px solid var(--line);
  padding: 10px;
  background: #fff;
}
.thumb {
  position: relative;
  padding: 0;
  border: 0;
  background: #15181f;
  cursor: crosshair;
  align-self: start;
  line-height: 0;
}
.thumb img { width: 132px; height: auto; display: block; }
.thumb i {
  position: absolute;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 3px solid #fff;
  background: var(--red);
  pointer-events: none;
}
.image-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.image-role { font-family: Chivo, sans-serif; font-weight: 700; font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--blue); }
.image-actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: auto; }

details.more, details.assist { border: 2px solid var(--line); background: #fff; }
details.api { border-color: var(--blue); }
details > summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 700;
  color: var(--blue);
  min-height: 44px;
}
details[open] > summary { border-bottom: 2px solid var(--line); }
details > :not(summary) { margin: 14px; }
details.assist { border-color: var(--blue); background: #f4fbf8; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 0.875rem; }
dt { font-family: Chivo, sans-serif; font-weight: 700; color: var(--blue); }
dd { margin: 0; overflow-wrap: anywhere; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 0.8125rem; }

.side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.preview {
  background: #e6ecf5;
  border: 2px solid var(--blue);
  box-shadow: var(--offset) var(--offset) 0 var(--blue);
  aspect-ratio: 4 / 5;
  max-height: 68vh;
  width: 100%;
}
.preview iframe { width: 100%; height: 100%; border: 0; display: block; }

.slides { display: flex; gap: 6px; flex-wrap: wrap; }
.slides button {
  font: 700 0.8125rem Chivo, sans-serif;
  min-width: 44px;
  min-height: 36px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--blue);
  cursor: pointer;
}
.slides button[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }

.msgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 0.875rem; }
.msgs:empty { display: none; }
.msgs li { padding: 8px 12px; border-left: 6px solid; background: #fff; }
.msgs-error li { border-color: var(--red); font-weight: 700; }
.msgs-warn li { border-color: var(--blue); }

[hidden] { display: none !important; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .side { position: static; order: -1; }
  .preview { max-height: 60vh; }
}
@media (max-width: 560px) {
  .grid, .grid.three, .tiles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .grid, .grid.three { grid-template-columns: minmax(0, 1fr); }
  .image { grid-template-columns: 96px minmax(0, 1fr); }
  .thumb img { width: 96px; }
  .top { padding: 12px 16px; }
  .top-title span { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .tile { transition: background-color 120ms ease, border-color 120ms ease; }
}

.top-nav { margin-left: auto; display: flex; align-items: center; gap: 16px; font-family: Chivo, sans-serif; font-size: 0.9375rem; }
.top-nav a, .top-nav .link { color: #fff; }
.top-nav #nav-user { opacity: 0.85; }

.narrow { max-width: 460px; margin: 48px auto; padding: 0 16px; display: flex; flex-direction: column; gap: 20px; }
.wide { max-width: 860px; margin: 32px auto 64px; padding: 0 16px; display: flex; flex-direction: column; gap: 20px; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.table th { font-family: Chivo, sans-serif; font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--blue); text-align: left; }
.table th, .table td { padding: 8px 10px 8px 0; border-bottom: 2px solid var(--line); vertical-align: middle; }
.table input[type="text"] { min-height: 40px; padding: 6px 8px; }
.secret { background: #f4fbf8; border: 2px solid var(--blue); padding: 12px; overflow-wrap: anywhere; }
@media (max-width: 560px) { .top-nav #nav-user { display: none; } .table { font-size: 0.875rem; } }

.narrow details.more > .step { margin: 0; border: 0; box-shadow: none; }
.narrow details.more:not(:has(> summary:not([hidden]))) { border: 0; background: none; }
.narrow details.more:not(:has(> summary:not([hidden]))) > .step { border: 2px solid var(--blue); box-shadow: var(--offset) var(--offset) 0 var(--teal); }
