:root {
  --accent: #0c73b6;
  --accent-hover: #095f97;
  --soft: #e8f2fa;
  --ink: #1d1d1f;
  --muted: #5c6066;
  --line: #e3e6ea;
  --bad: #b3261e;
  --bad-soft: #fdecea;
  --ok: #1e7a3c;
  --ok-soft: #e7f5ec;
  --warn-soft: #fff6e0;
  --radius: 16px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 12px 0; z-index: 10; }
.skip:focus { left: 0; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.top { border-bottom: 1px solid var(--line); background: #fff; }
.top-in { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; padding-top: 14px; padding-bottom: 0; }
.brand { margin: 0 0 14px; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  font: inherit; font-weight: 600; background: none; border: 0; cursor: pointer; color: var(--muted);
  min-height: 44px; padding: 8px 18px; border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--accent-hover); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

main { padding-top: 28px; padding-bottom: 48px; }
.foot { border-top: 1px solid var(--line); color: var(--muted); padding: 20px 0; font-size: 14px; }

h2 { font-size: 26px; margin: 0 0 4px; letter-spacing: -0.01em; }
.lead { color: var(--muted); margin: 0 0 24px; max-width: 60ch; }

.layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 32px; align-items: start; }
.steps { display: grid; gap: 20px; min-width: 0; }
.preview { position: sticky; top: 16px; min-width: 0; }

.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; background: #fff; min-width: 0; }
.card h3 { margin: 0 0 14px; font-size: 19px; display: flex; align-items: center; gap: 12px; }
.num {
  flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px;
}
.card.done .num { background: var(--accent); color: #fff; }

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px;
  border: 2px dashed #b9c4cf; border-radius: var(--radius); padding: 22px 16px; min-height: 110px; cursor: pointer; background: #fafcfe;
}
.drop:hover, .drop.over, .drop:focus-within { border-color: var(--accent); background: var(--soft); }
.drop strong { font-size: 17px; }
.drop span { color: var(--muted); font-size: 14px; }
.drop.has { min-height: 64px; padding: 12px 16px; flex-direction: row; gap: 10px; justify-content: flex-start; text-align: left; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.file-name { word-break: break-all; }

.btn {
  font: inherit; font-weight: 600; min-height: 44px; padding: 10px 22px; border-radius: 999px; cursor: pointer;
  border: 2px solid var(--accent); background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: #fff; color: var(--accent); }
.btn.ghost:hover { background: var(--soft); border-color: var(--accent-hover); color: var(--accent-hover); }
.btn[disabled], .btn[aria-disabled="true"] { background: #d5dbe1; border-color: #d5dbe1; color: #7a8189; cursor: not-allowed; }
.btn.big { min-height: 52px; font-size: 18px; padding: 12px 32px; }
.btn.small { min-height: 44px; padding: 8px 18px; }
.btn.on { background: var(--soft); }

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row + .row, .row + p, p + .row { margin-top: 12px; }
.msg { margin: 12px 0 0; }
.msg.good { color: var(--ok); font-weight: 600; }
.msg.warn { background: var(--warn-soft); padding: 10px 14px; border-radius: 12px; }
.msg.error, .error { background: var(--bad-soft); color: var(--bad); padding: 10px 14px; border-radius: 12px; }
.muted { color: var(--muted); }
.small-text { font-size: 14px; }
ul.plain { margin: 8px 0 0; padding-left: 20px; }

label.field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; min-width: 0; }
select, input[type=text] {
  font: inherit; font-weight: 400; min-height: 44px; border: 1px solid #b9c4cf; border-radius: 12px; padding: 8px 12px; background: #fff; color: var(--ink); max-width: 100%;
}
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

.table-wrap { border: 1px solid var(--line); border-radius: 12px; max-height: 360px; overflow: auto; margin-top: 14px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
th { position: sticky; top: 0; background: #f6f8fa; font-weight: 600; z-index: 1; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f3f8fc; }
tbody tr[aria-selected="true"] { background: var(--soft); }
tbody tr.bad td.prob { color: var(--bad); }
td.prob { color: var(--bad); }
td.num-col { color: var(--muted); width: 3em; }
.summary { margin: 14px 0 0; font-weight: 600; }

.font-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.font-row label.field { flex: 1 1 220px; }
.x-btn { min-width: 44px; padding: 8px; }
.sample { display: block; width: 100%; max-width: 560px; height: auto; aspect-ratio: 1120 / 112; margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }

.progress { height: 12px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 12px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.downloads { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.check-list { background: var(--ok-soft); border-radius: 12px; padding: 10px 14px; margin-top: 14px; }
.check-list p { margin: 2px 0; }

.stage-box { border: 1px solid var(--line); border-radius: var(--radius); background: #f6f8fa; padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 12px; min-height: 240px; }
.stage { position: relative; background: #fff; box-shadow: 0 1px 8px rgba(0,0,0,.15); line-height: 0; touch-action: pan-y; }
.stage canvas { display: block; }
.empty-preview { color: var(--muted); text-align: center; padding: 60px 20px; line-height: 1.5; }
.overlay { position: absolute; inset: 0; line-height: 1; }
.overlay .box { position: absolute; border: 2px solid; border-radius: 2px; pointer-events: none; }
.box.name { border-color: #1e9e4a; background: rgba(30,158,74,.12); }
.box.dr { border-color: var(--accent); background: rgba(12,115,182,.14); }
.box.room { border: 2px dashed #e08a00; background: rgba(224,138,0,.05); }
.overlay .pick { position: absolute; border: 1px solid rgba(12,115,182,.6); background: rgba(12,115,182,.10); cursor: pointer; padding: 0; min-width: 6px; min-height: 6px; }
.overlay .pick:hover, .overlay .pick:focus-visible { background: rgba(12,115,182,.35); border-color: var(--accent-hover); }
.handle { position: absolute; background: transparent; border: 0; padding: 0; z-index: 2; touch-action: none; }
.handle::after { content: ''; position: absolute; background: #e08a00; border-radius: 3px; box-shadow: 0 0 0 2px #fff; }
.handle.h-bottom { height: 28px; cursor: ns-resize; }
.handle.h-bottom::after { left: 20%; right: 20%; top: 11px; height: 6px; }
.handle.h-left, .handle.h-right { width: 28px; cursor: ew-resize; }
.handle.h-left::after, .handle.h-right::after { top: 20%; bottom: 20%; left: 11px; width: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--muted); margin: 10px 0 0; }
.legend i { display: inline-block; width: 14px; height: 14px; border: 2px solid; border-radius: 2px; vertical-align: -2px; margin-right: 6px; }
.legend .l-name { border-color: #1e9e4a; background: rgba(30,158,74,.2); }
.legend .l-dr { border-color: var(--accent); background: rgba(12,115,182,.2); }
.legend .l-room { border: 2px dashed #e08a00; }
.view-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.caption { text-align: center; margin: 0; font-size: 14px; color: var(--muted); }

@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; }
  .layout.has-design .preview { order: -1; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .card { padding: 16px; }
  .top-in { gap: 8px; }
  h2 { font-size: 22px; }
  .btn.big { width: 100%; }
  .downloads .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

th { white-space: nowrap; }
td.num-col { width: 2.5em; }
#design-msg .msg:first-child { margin-top: 14px; }
#design-actions { margin-top: 14px; }
#names-setup { margin-top: 14px; }
#names-setup .row { margin-bottom: 8px; }
.lead { margin-top: 6px; }
[hidden] { display: none !important; }
td:nth-child(4) { white-space: nowrap; }

main h2 { margin-top: 16px; }
main { padding-top: 36px; }
.amber { background: var(--warn-soft); border: 1px solid #f0c969; border-radius: 12px; padding: 12px 16px; margin-top: 14px; }
.amber p { margin: 4px 0; }
.amber .row { margin-top: 10px; }
.note-amber { background: var(--warn-soft); border-radius: 10px; padding: 6px 12px; margin: 10px 0 0; font-size: 14px; }
.zoom-row { width: 100%; }
.stage { overflow: hidden; }

main.wrap { padding-top: 40px; }
main h2 { margin-top: 0; }
