:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --panel: #ffffff;
  --ink: #0f172a;
  --text: #1e293b;
  --muted: #5b6b82;
  --faint: #7b8ba3;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --navy: #07111f;
  --navy-2: #0e1b2e;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #ecfdf8;
  --blue: #1d4ed8;
  --success: #15803d;
  --warning: #b45309;
  --danger: #b91c1c;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(15 23 42 / 0.04), 0 10px 28px rgb(15 23 42 / 0.05);
  --font: "Segoe UI", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

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

.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  background: var(--bg);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 0 14px 18px;
  background: var(--navy);
  color: #d7e2ee;
}

.brand {
  margin: 0 -14px;
  padding: 20px 18px 16px;
  background: #000;
  border-bottom: 1px solid #1c2838;
}

.logo {
  width: 100%;
  height: auto;
  display: block;
}

.brand .kicker {
  margin-top: 12px;
  color: #93c5fd;
}

.kicker {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sidebar nav { display: grid; gap: 4px; }

.nav-item,
.nav-current {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #c5d2e2;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover { background: rgb(255 255 255 / 0.06); color: #fff; }

.nav-current {
  background: rgb(20 184 166 / 0.16);
  color: #99f6e4;
  box-shadow: inset 3px 0 0 #2dd4bf;
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid #1c2838;
}

.identity { display: grid; gap: 2px; }
.identity strong { color: #fff; font-size: 14px; }
.identity span { color: #93a4b8; font-size: 12px; }

.workspace {
  min-width: 0;
  max-width: 100%;
  background:
    radial-gradient(900px 280px at 100% 0%, rgb(15 118 110 / 0.08), transparent 55%),
    var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 12px 28px;
  background: rgb(243 246 251 / 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar h1 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

main {
  display: grid;
  gap: 16px;
  width: min(1180px, 100%);
  min-width: 0;
  padding: 24px 28px 56px;
}

.gate-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 12px 28px;
  background: #000;
  border-bottom: 1px solid #1c2838;
}

.gate-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.gate-logo {
  width: min(190px, 42vw);
  height: auto;
  display: block;
}

.gate-brand span {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.gate-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.gate-link,
.gate-current {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #d7e2ee;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.gate-link:hover { background: rgb(255 255 255 / 0.08); color: #fff; }

.gate-current {
  border-color: rgb(45 212 191 / 0.45);
  background: rgb(15 118 110 / 0.35);
  color: #ccfbf1;
}

#gate {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.gate-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 460px);
  align-items: stretch;
  width: 100%;
  min-height: 0;
}

.gate-visual {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  background: #06101c;
}

.gate-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, transparent 40%, #06101c 66%);
  pointer-events: none;
}

.gate-hero {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 70%;
  object-fit: cover;
  object-position: center 36%;
}

.gate-caption {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 28px 40px 36px;
}

.gate-caption .kicker { color: #7dd3fc; }

.gate-caption h1 {
  margin: 8px 0 0;
  max-width: 14em;
  color: #fff;
  font-size: 32px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.about-points, .contact-list {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.about-points li, .contact-list li {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  color: var(--text);
}

.contact-list li {
  display: grid;
  gap: 2px;
}

.contact-list span {
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.contact-list a { color: var(--accent-strong); font-weight: 600; }

.gate-forms {
  display: flex;
  align-items: safe center;
  justify-content: center;
  overflow: auto;
  padding: 40px 36px;
  background: #f7f9fc;
  border-left: 1px solid #e6edf5;
}

.gate-forms .login-card {
  width: min(100%, 380px);
  padding: 8px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.gate-forms .login-card h2 {
  font-size: 28px;
  letter-spacing: -0.035em;
}

.gate-forms .muted { margin-bottom: 4px; font-size: 14.5px; line-height: 1.55; }

.gate-forms .btn-primary { width: 100%; min-height: 44px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.panel h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-transform: none;
}

.panel-head h2 { margin: 0; }

.login-card {
  width: 100%;
  padding: 28px 26px 24px;
}

.login-card h2 {
  margin-bottom: 6px;
  font-size: 24px;
  letter-spacing: -0.03em;
}

.muted { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }

.accounts, .row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.login-grid, .admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px 12px;
  align-items: end;
  margin-top: 16px;
}

.admin-grid > label { min-width: 0; }

input[type="date"] { min-width: 0; }

.form-actions {
  display: flex;
  margin-top: 14px;
}

.login-card .login-grid { grid-template-columns: 1fr; }

label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
}

input, select {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.6);
}

select {
  appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position: calc(100% - 18px) 18px, calc(100% - 12px) 18px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

input:focus, select:focus {
  outline: none;
  border-color: #0f766e;
  box-shadow: 0 0 0 4px rgb(15 118 110 / 0.15);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  width: fit-content;
}

.btn:hover { background: #f8fafc; }

.btn-primary {
  border-color: var(--accent-strong);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 1px rgb(15 23 42 / 0.08);
}

.btn-primary:hover { background: var(--accent-strong); }

.btn-ghost { background: transparent; color: var(--text); }

.btn-danger {
  border-color: #fecaca;
  background: #fff1f2;
  color: var(--danger);
}

.sidebar .btn-ghost {
  width: 100%;
  border-color: #243044;
  color: #e2e8f0;
}

.sidebar .btn-ghost:hover { background: rgb(255 255 255 / 0.06); }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.split > * { min-width: 0; }

table { width: 100%; border-collapse: collapse; }

#seats td:first-child { overflow-wrap: anywhere; }
#seats td:nth-child(2),
#seats td:nth-child(3) { white-space: nowrap; width: 1%; }
.pill { white-space: nowrap; }

th {
  padding: 10px 12px;
  text-align: left;
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #f8fafc;
}

td {
  padding: 12px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}

tbody tr:hover td { background: #f8fafc; }

#desk,
#desk > section {
  min-width: 0;
  max-width: 100%;
}

#record-form .admin-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
}

.sheet-wrap {
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.sheet { min-width: 1100px; }
.sheet td, .sheet th { white-space: nowrap; }
.sheet th:first-child { border-top-left-radius: 12px; }
.sheet th:last-child { border-top-right-radius: 12px; }

.list-card {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.list-card:first-child { border-top: 0; padding-top: 4px; }

.name { color: var(--ink); font-weight: 600; }
.seat { color: var(--text); }

.pill, .badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
}

.pill.open, .badge.open {
  color: #166534;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.pill.filled {
  color: #1e3a8a;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.rank-block { margin-top: 14px; }
.rank-block h3 { margin: 0 0 8px; color: var(--ink); font-size: 14px; }
.rank-block ol { margin: 0; padding-left: 20px; }
.rank-block li { margin: 10px 0; color: var(--text); }
.rank-block li .row-actions { margin-top: 8px; }
.rank-block input { width: min(360px, 100%); }

.list-head h3 { margin: 0 0 4px; color: var(--ink); font-size: 16px; letter-spacing: -0.02em; }

.flash {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.flash.error {
  border-color: #fecaca;
  background: #fff1f2;
  color: #9f1239;
}

.flash.warn {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.move {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.move:first-child { border-top: 0; padding-top: 0; }
.move strong { color: var(--ink); }

ol.steps {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 10px;
}

ol.steps li {
  position: relative;
  margin: 0;
  padding: 12px 14px 12px 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  color: var(--text);
}

ol.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 12px;
  top: 12px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

ul.steps {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

ul.steps li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 8px 6px 12px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 600;
}

.status-layout { display: flex; gap: 22px; align-items: center; }
.status-layout h2 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 28px;
  letter-spacing: -0.03em;
}
.status-portrait { width: 148px; height: 186px; }
.photo-thumb, .avatar {
  width: 44px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  background: #e8eef6;
  border: 1px solid var(--line);
  color: var(--accent-strong);
  display: grid;
  place-items: center;
  font-weight: 700;
}
.status-photo, .avatar-lg {
  width: 148px;
  height: 186px;
  border-radius: 16px;
  font-size: 40px;
  background: linear-gradient(180deg, #ecfeff, #e2e8f0);
}
.photo-cell { display: grid; gap: 6px; justify-items: start; }
.photo-add input { display: none; }

@media (max-width: 800px) {
  .gate-bar { align-items: flex-start; flex-direction: column; }
  .gate-body { grid-template-columns: 1fr; }
  .gate-visual { min-height: 280px; height: 38vh; }
  .gate-caption { padding: 20px 20px 22px; }
  .gate-caption h1 { font-size: 24px; }
  .gate-forms { border-left: 0; padding: 28px 20px 48px; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { border-bottom: 1px solid #1c2838; }
  .sidebar-foot { margin-top: 0; }
  .split { grid-template-columns: 1fr; }
  .logo { max-width: 220px; }
  main, .topbar { padding-left: 16px; padding-right: 16px; }
}

.qr-frame {
  display: grid;
  place-items: center;
  width: fit-content;
  padding: 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
}
.qr-frame svg { width: 196px; height: 196px; }
.secret-line, .backup-codes {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.04em;
  word-break: break-all;
  white-space: pre-wrap;
}

@media print {
  body * { visibility: hidden; }
  #transfer-sheet, #transfer-sheet * { visibility: visible; }
  #transfer-sheet {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    color: #111;
    background: #fff;
  }
}
