@font-face {
  font-family: Manrope;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/manrope-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: Manrope;
  font-weight: 800;
  font-display: swap;
  src: url("/fonts/manrope-latin-800-normal.woff2") format("woff2");
}
@font-face {
  font-family: Archivo;
  font-weight: 800;
  font-display: swap;
  src: url("/fonts/archivo-latin-800-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --navy-950: #071522;
  --navy-900: #0e2748;
  --blue-600: #1474b8;
  --blue-50: #eef7fd;
  --gold-500: #d8aa3d;
  --ink: #172332;
  --muted: #5f6b7a;
  --line: #dce2e8;
  --line-strong: #cbd3dc;
  --surface: #ffffff;
  --canvas: #f3f5f7;
  --on-dark: #dfe7ee;
  --success: #197044;
  --success-bg: #e4f3eb;
  --warning: #8a5a12;
  --warning-bg: #fff1d6;
  --danger: #a63737;
  --danger-bg: #fbe8e7;
  --shadow: 0 12px 36px rgba(7, 21, 34, 0.12);
  --radius: 12px;
  --tap: 48px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--canvas);
  color: var(--ink);
  font:
    600 1rem/1.4 Manrope,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
}

h1,
h2,
h3 {
  font-family: Archivo, Manrope, system-ui, sans-serif;
  font-weight: 800;
  line-height: 1.15;
  margin: 0;
}
h1 {
  font-size: 1.5rem;
}
h2 {
  font-size: 1.2rem;
}
h3 {
  font-size: 1rem;
}
p {
  margin: 0;
}
a {
  color: var(--blue-600);
}

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

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top, 0px));
  background: var(--navy-900);
  color: var(--on-dark);
}
.bar .brand {
  font:
    800 1rem Archivo,
    sans-serif;
  letter-spacing: 0.04em;
  color: #fff;
  text-decoration: none;
  margin-right: auto;
}
.bar .who {
  font-size: 0.875rem;
}
.bar button {
  min-height: 40px;
  min-width: 40px;
  padding: 0 8px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  cursor: pointer;
  position: relative;
}
.bar button:hover {
  background: rgba(255, 255, 255, 0.08);
}
.badge {
  position: absolute;
  top: 0;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--gold-500);
  color: var(--navy-950);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 18px;
}

.page {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(96px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.page.wide {
  max-width: 1280px;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.spread {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.grow {
  flex: 1;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.875rem;
}
.center {
  text-align: center;
}

.logo {
  display: block;
  width: 100%;
  max-width: 280px;
  height: auto;
  margin: 4px auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.card.flush {
  padding: 0;
  overflow: hidden;
}
.big {
  font:
    800 2.4rem/1 Archivo,
    sans-serif;
  letter-spacing: 0.01em;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list > li {
  border-top: 1px solid var(--line);
}
.list > li:first-child {
  border-top: 0;
}
.item {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--tap);
  padding: 10px 16px;
  background: none;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
button.item:hover {
  background: var(--blue-50);
}
.item .end {
  color: var(--muted);
  white-space: nowrap;
  font-size: 0.875rem;
}
.empty {
  padding: 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--navy-900);
  color: #fff;
  font:
    800 1rem Manrope,
    sans-serif;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:hover {
  filter: brightness(1.08);
}
.btn[disabled],
.btn[aria-busy="true"] {
  opacity: 0.6;
  cursor: progress;
}
.btn.block {
  width: 100%;
}
.btn.go {
  background: var(--success);
  min-height: 64px;
  font-size: 1.2rem;
}
.btn.stop {
  background: var(--danger);
  min-height: 56px;
  font-size: 1.1rem;
}
.btn.gold {
  background: var(--gold-500);
  color: var(--navy-950);
}
.btn.ghost {
  background: var(--surface);
  color: var(--navy-900);
  border-color: var(--line-strong);
}
.btn.danger-ghost {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--line-strong);
}
.btn.small {
  min-height: 40px;
  padding: 0 12px;
  font-size: 0.875rem;
}
.link-btn {
  background: none;
  border: 0;
  padding: 8px 4px;
  min-height: 40px;
  color: var(--blue-600);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  background: var(--blue-50);
  color: var(--navy-900);
}
.pill.ok {
  background: var(--success-bg);
  color: var(--success);
}
.pill.warn {
  background: var(--warning-bg);
  color: var(--warning);
}
.pill.bad {
  background: var(--danger-bg);
  color: var(--danger);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font:
    800 0.9rem Manrope,
    sans-serif;
  cursor: pointer;
}
.chip[aria-pressed="true"] {
  background: var(--navy-900);
  border-color: var(--navy-900);
  color: #fff;
}

label.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}
input,
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font:
    600 16px Manrope,
    sans-serif;
}
textarea {
  min-height: 80px;
  resize: vertical;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue-600);
  outline: 2px solid var(--blue-50);
}
.fieldset {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.legend {
  font-size: 0.85rem;
  color: var(--muted);
}
.material {
  display: grid;
  grid-template-columns: 1fr 88px 44px;
  gap: 6px;
  align-items: center;
}
.icon-btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--danger);
  font:
    800 1rem Manrope,
    sans-serif;
  cursor: pointer;
}

.notice {
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--blue-50);
  font-size: 0.9rem;
}
.notice.warn {
  background: var(--warning-bg);
  color: var(--warning);
}
.notice.bad {
  background: var(--danger-bg);
  color: var(--danger);
}
.notice.ok {
  background: var(--success-bg);
  color: var(--success);
}

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  gap: 4px;
  padding: 6px 8px calc(6px + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.tabs a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  border-radius: 10px;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.9rem;
  text-decoration: none;
}
.tabs a[aria-current="page"] {
  background: var(--blue-50);
  color: var(--navy-900);
}

dialog.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 18px 18px 0 0;
  background: var(--canvas);
  color: var(--ink);
  box-shadow: var(--shadow);
}
dialog.sheet::backdrop {
  background: rgba(7, 21, 34, 0.45);
}
.sheet-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 16px calc(18px + var(--safe-bottom));
  overflow-y: auto;
  max-height: 92vh;
  max-height: 92dvh;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.close {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font:
    800 1.4rem Manrope,
    sans-serif;
  color: var(--muted);
  cursor: pointer;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(80px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 10px 12px 10px 16px;
  border-radius: var(--radius);
  background: var(--navy-950);
  color: #fff;
  box-shadow: var(--shadow);
}
.toast button {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--gold-500);
  color: var(--navy-950);
  font:
    800 0.9rem Manrope,
    sans-serif;
  cursor: pointer;
}

.diff {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  margin: 6px 0 0;
  font-size: 0.85rem;
}
.diff dt {
  color: var(--muted);
}
.diff dd {
  margin: 0;
  word-break: break-word;
}

.admin-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.admin-nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.admin-nav a {
  flex: none;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
}
.admin-nav a[aria-current="page"] {
  background: var(--blue-50);
  color: var(--navy-900);
}
.admin-side .brand-side,
.admin-side .side-foot {
  display: none;
}
.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr);
}
.panel h2 {
  margin-bottom: 8px;
}
.map {
  height: 320px;
  border-radius: 10px;
  background: var(--line);
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}
.toolbar label.field {
  min-width: 150px;
  flex: 1 1 150px;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.data th,
table.data td {
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
table.data th {
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 0;
}
.scroll {
  overflow-x: auto;
}
.deleted {
  opacity: 0.6;
  text-decoration: line-through;
}
.bar .who,
.bar .bell {
  color: #fff;
  text-decoration: none;
}
.bar .bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
}
.cols {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
.qr-canvas {
  width: 160px;
  height: 160px;
  image-rendering: pixelated;
}

@media (min-width: 720px) {
  dialog.sheet {
    margin: auto;
    border-radius: 18px;
  }
  .tabs {
    position: static;
    width: 100%;
    max-width: 560px;
    margin: 12px auto 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 4px;
  }
  .toast {
    bottom: 24px;
  }
  .page {
    padding-bottom: 32px;
  }
}

@media (min-width: 900px) {
  .page.duo {
    max-width: 1080px;
  }
  .cols {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid.two {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .grid.three {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1.3fr);
  }
  .admin-shell {
    flex-direction: row;
  }
  .admin-shell > .bar {
    display: none;
  }
  .admin-side {
    position: sticky;
    top: 0;
    height: 100vh;
    width: 220px;
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 12px;
    background: var(--navy-900);
    color: var(--on-dark);
  }
  .admin-side .brand-side,
  .admin-side .side-foot {
    display: block;
  }
  .admin-side .brand-side {
    font:
      800 1rem Archivo,
      sans-serif;
    letter-spacing: 0.04em;
    color: #fff;
    padding: 4px 8px;
  }
  .admin-side .side-foot {
    margin-top: auto;
    font-size: 0.85rem;
  }
  .admin-side .admin-nav {
    flex-direction: column;
    background: transparent;
    border: 0;
    padding: 0;
  }
  .admin-side .admin-nav a {
    color: var(--on-dark);
  }
  .admin-side .admin-nav a[aria-current="page"] {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
  }
  .admin-main {
    flex: 1;
    min-width: 0;
  }
}

@media (max-width: 1023px) {
  table.data.cards thead {
    display: none;
  }
  table.data.cards tr {
    display: block;
    border-top: 1px solid var(--line);
    padding: 6px 0;
  }
  table.data.cards td {
    display: flex;
    gap: 8px;
    border: 0;
    padding: 3px 10px;
  }
  table.data.cards td::before {
    content: attr(data-label);
    min-width: 88px;
    color: var(--muted);
    font-size: 0.8rem;
  }
}

@media (min-width: 1600px) {
  .page.wide {
    max-width: 1560px;
  }
}

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

@media print {
  .bar,
  .tabs,
  .admin-side,
  .admin-nav,
  .no-print {
    display: none !important;
  }
}

.loading {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
}
.poster-page {
  background: var(--surface);
}
.poster-tools {
  justify-content: center;
  padding: 16px;
}
.poster {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.poster-logo {
  width: 70%;
  max-width: 420px;
  height: auto;
}
.poster h1 {
  font:
    800 3rem/1.05 Archivo,
    sans-serif;
  color: var(--navy-900);
  text-transform: uppercase;
}
.poster-site {
  font:
    800 1.6rem Manrope,
    sans-serif;
  color: var(--navy-900);
}
.poster-qr {
  width: min(80vw, 120mm);
  height: auto;
  image-rendering: pixelated;
}
.poster-steps {
  text-align: left;
  font-size: 1.15rem;
  line-height: 1.6;
}
.poster-url {
  font-size: 0.95rem;
  color: var(--muted);
  word-break: break-all;
}

@page {
  size: A4 portrait;
  margin: 12mm;
}
@media print {
  .poster {
    padding: 0;
    max-width: none;
  }
  .poster-qr {
    width: 120mm;
  }
}
