@font-face {
  font-family: Outfit;
  src: url('/assets/brand/outfit-light.ttf') format('truetype');
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: Outfit;
  src: url('/assets/brand/outfit-regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --canvas: #0a0e17;
  --rail: #0d1320;
  --surface: #101827;
  --field: #0b131f;
  --lift: #162232;
  --stroke: #28384b;
  --control-border: #52677d;
  --paper: #f3f6fb;
  --soft: #b5c0d0;
  --muted: #a2b1c4;
  --accent: #62d4ef;
  --on-accent: #08202c;
  --active: #82dbb4;
  --paused: #f5c385;
  --danger: #ffd0cc;
  --radius: 14px;
  font: 400 16px/1.45 Outfit, system-ui, sans-serif;
  color: var(--paper);
  background: var(--canvas);
  scrollbar-color: #52677d var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body { margin: 0; min-width: 300px; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ol, ul, dl, dd { margin: 0; }
h1, h2, h3, strong { font-weight: 500; }
h1 { font-size: 2.85rem; line-height: 1.05; letter-spacing: -.035em; overflow-wrap: anywhere; }
h2 { font-size: 1.33rem; line-height: 1.25; letter-spacing: -.02em; }
h3 { font-size: 1rem; }
small { font-size: .8125rem; }
svg { flex: none; vertical-align: middle; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip-link {
  position: fixed;
  inset: .75rem auto auto .75rem;
  z-index: 5;
  padding: .65rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 6px;
  transform: translateY(-150%);
}

.skip-link:focus { transform: none; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.workspace { display: grid; grid-template-columns: 236px minmax(0, 1fr); }

.rail {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 26px 16px 18px;
  background: var(--rail);
  border-right: 1px solid var(--stroke);
}

.brand { display: inline-flex; width: fit-content; align-items: center; gap: 12px; color: var(--paper); font-size: 1.21rem; letter-spacing: .02em; }
.rail .brand { margin: 0 11px 38px; }
.brand img { display: block; width: 35px; height: auto; }
.brand strong { color: var(--accent); }
.rail nav { display: grid; gap: 5px; }

.rail nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--soft);
  white-space: nowrap;
}

.rail nav a:hover { color: var(--paper); background: var(--lift); }
.rail nav a[aria-current] { background: #142534; border-color: #2e4d60; color: var(--accent); }

.account {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  min-width: 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--stroke);
}

.avatar { display: grid; place-items: center; width: 35px; height: 35px; flex: none; border: 1px solid #456273; border-radius: 50%; color: var(--accent); background: #192a3a; }
.account > div { min-width: 0; }
.account strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .9rem; }
.account small { display: block; color: var(--muted); }
.account form { margin-left: auto; }

.main { width: min(100%, 1320px); margin-inline: auto; padding: 55px 48px 64px; min-width: 0; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 30px; }
.page-header p { margin-top: 10px; color: var(--soft); max-width: 65ch; }
.page-header > a { flex-shrink: 0; }
.back { display: inline-flex; gap: 8px; align-items: center; margin-bottom: 17px; color: var(--soft); font-size: .9rem; }
.back:hover { color: var(--accent); }

.button, .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1.15;
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 42px;
  white-space: nowrap;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}

.button { padding: 9px 14px; }
.button.primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); font-weight: 600; }
.button.primary:hover { background: #a2ecff; border-color: #a2ecff; }
.button.secondary { background: var(--lift); border-color: var(--control-border); color: var(--paper); }
.button.secondary:hover { background: #213044; border-color: #7492a9; }
.icon-button { width: 36px; min-height: 36px; padding: 0; color: var(--soft); background: transparent; }
.icon-button:hover { background: var(--lift); color: var(--accent); }
.text-button { display: inline-flex; align-items: center; width: fit-content; min-height: 36px; border: 0; background: transparent; padding: 0; color: var(--accent); }
.text-button:hover, .share-field a:hover { text-decoration: underline; text-underline-offset: 4px; }

.panel, .list-panel, .form-panel { background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--radius); }
.panel, .form-panel { padding: 24px; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px; }
.search { position: relative; flex: 1 1 210px; min-width: 190px; }
.search svg { position: absolute; left: 12px; top: 12px; pointer-events: none; color: var(--muted); }
.search input[type='search'] { padding-left: 39px; }
input:not([type='radio']), textarea, select {
  min-width: 0;
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--field);
  caret-color: var(--accent);
}

input:not([type='radio']), textarea { width: 100%; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:not([type='radio']):focus, textarea:focus, select:focus { border-color: var(--accent); }
select { max-width: 175px; padding-right: 25px; }
textarea { resize: vertical; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { padding: 13px 12px; border-top: 1px solid var(--stroke); vertical-align: middle; }
th { font-weight: 400; font-size: .85rem; color: var(--soft); text-wrap: nowrap; background: #0d1624; }
td { font-size: .94rem; }
.list-panel :is(th, td):first-child { padding-left: 17px; }
.list-panel :is(th, td):last-child { padding-right: 15px; }
td small { display: block; color: var(--muted); }
tbody tr:hover { background: #141f30; }
.code-cell { display: flex; align-items: flex-start; gap: 11px; }
.code-label { min-width: 0; }
.code-label > a { display: inline-block; overflow-wrap: anywhere; }
.code-label > a:hover { color: var(--accent); }
.code-label > small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 36ch; }
.type-label { white-space: nowrap; }
.type-icon, .gate-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  color: var(--accent);
  border-radius: 8px;
  background: #1b3043;
}

.status, .updated, .number { white-space: nowrap; }
.number { font-variant-numeric: tabular-nums; }
.row-end { width: 1px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; list-style: none; padding: 0; }
.tags li, .state, .current {
  display: inline-flex;
  align-items: center;
  border-radius: 5px;
  padding: 2px 6px;
  background: #1b2a3d;
  color: var(--soft);
  line-height: 1.45;
  font-size: .77rem;
  overflow-wrap: anywhere;
}
.state { gap: 5px; white-space: nowrap; }
.state::before { content: ''; width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.state.active { color: var(--active); background: #172f30; }
.state.paused { color: var(--paused); background: #342921; }
.table-foot { padding: 12px 17px; border-top: 1px solid var(--stroke); color: var(--muted); font-size: .85rem; }

.empty {
  min-height: 360px;
  border-top: 1px solid var(--stroke);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 11px;
  padding: 34px 20px;
  text-align: center;
}

.empty .button { margin-top: 7px; }
.empty p { color: var(--soft); }
.qr-art { position: relative; width: 83px; height: 83px; display: grid; place-items: center; color: var(--accent); }
.qr-art span { position: absolute; width: 17px; height: 17px; border: 1px solid #578497; }
.qr-art span:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.qr-art span:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.qr-art span:nth-child(3) { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.qr-art span:nth-child(4) { bottom: 0; left: 0; border-right: 0; border-top: 0; }

.editor-layout, .detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(275px, 345px);
  gap: 22px;
  align-items: start;
}
.editor { display: grid; gap: 25px; min-width: 0; }
fieldset { min-width: 0; border: 0; margin: 0; padding: 0; }
legend { padding: 0; margin-bottom: 10px; font-size: 1.02rem; color: var(--paper); }
.type-picker, .choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice { position: relative; display: block; min-width: 0; cursor: pointer; }
.choice input { position: absolute; left: 13px; top: 13px; width: 1px; height: 1px; opacity: 0; }

.choice > span {
  display: flex;
  align-items: center;
  height: 100%;
  min-height: 46px;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--field);
  color: var(--soft);
  font-size: .9rem;
}
.choice > span > span { flex: 1; min-width: 0; }
.choice > span::after {
  content: '';
  width: 13px;
  height: 13px;
  flex: none;
  border: 1px solid var(--control-border);
  border-radius: 50%;
  padding: 2px;
  background-clip: content-box;
}
.choice input:checked + span::after { border-color: var(--accent); background-color: var(--accent); }
.choice > span small { display: block; color: var(--soft); font-size: .78rem; margin-top: 2px; }
.choice:hover > span { background: var(--lift); color: var(--paper); }
.choice input:checked + span { border-color: var(--accent); background: #162a39; color: var(--accent); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }
.field-stack { display: grid; gap: 13px; }
.field-stack label { display: grid; gap: 5px; min-width: 0; color: var(--paper); font-size: .9rem; }
.field-stack small { color: var(--muted); }
.field-stack label span small { margin-left: 4px; }
.form-actions { display: flex; align-items: center; gap: 16px; padding-top: 17px; border-top: 1px solid var(--stroke); }
.mode-note { display: flex; align-items: center; gap: 10px; color: var(--accent); }
.mode-note small { display: block; color: var(--soft); }

.preview { position: sticky; top: 24px; display: grid; gap: 14px; min-width: 0; }
.preview-stage {
  background: var(--field);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  min-width: 0;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.preview-stage img { display: block; width: min(85%, 224px); height: auto; border-radius: 2px; image-rendering: pixelated; }
.preview p { color: var(--soft); font-size: .88rem; }
.preview-link { overflow-wrap: anywhere; }
.downloads { display: grid; gap: 7px; }
.downloads label { color: var(--soft); font-size: .88rem; }
.downloads select { max-width: none; width: 100%; }
.download-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.download-row .button { padding-inline: 5px; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--soft); margin-top: 10px; }
.detail-main { min-width: 0; display: grid; gap: 22px; }
.share-field { display: grid; gap: 3px; min-width: 0; }
.share-field > div { display: flex; align-items: center; justify-content: space-between; gap: 5px; padding: 3px 4px 3px 10px; border: 1px solid var(--control-border); border-radius: 7px; background: var(--field); }
.share-field a { color: var(--accent); font-size: .83rem; overflow-wrap: anywhere; }
.copy-feedback { color: var(--active); font-size: .83rem; }
.copy-feedback:empty { display: none; }
.pause-form { border-top: 1px solid var(--stroke); padding-top: 13px; }
.pause-form .button { width: 100%; }
.stats { display: flex; flex-wrap: wrap; gap: 12px 40px; padding: 13px 0 14px; margin-top: 8px; border-bottom: 1px solid var(--stroke); }
.stats dt { color: var(--soft); }
.stats dd { font-size: 2.1rem; font-variant-numeric: tabular-nums; }
.activity h3 { margin-top: 14px; }
.activity h3 small { margin-left: 8px; color: var(--muted); font-weight: 400; }
.micro { color: var(--soft); font-size: .83rem; margin-top: 10px; }
.chart { margin-top: 14px; }
.chart svg { width: 100%; display: block; height: 116px; fill: var(--accent); }
.chart svg path { fill: none; stroke: var(--control-border); }
.chart-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: .78rem; }
.chart-empty { padding: 20px 0 12px; color: var(--soft); font-size: .9rem; }
.chart-data { margin-top: 8px; }
summary { cursor: pointer; color: var(--accent); font-size: .86rem; width: fit-content; }
summary:hover { text-decoration: underline; text-underline-offset: 3px; }
.chart-data table, .revision-fields { margin-top: 9px; }
.chart-data th, .chart-data td { padding-block: 5px; }
.versions { list-style: none; margin-top: 13px; padding: 0; }
.versions li { display: grid; gap: 8px; border-top: 1px solid var(--stroke); padding: 13px 0; }
.versions li:last-child { padding-bottom: 0; }
.version-head { display: flex; align-items: baseline; gap: 8px 14px; justify-content: space-between; }
.version-head p, .version-counts { color: var(--soft); font-size: .83rem; margin-top: 3px; }
.version-counts { white-space: nowrap; font-variant-numeric: tabular-nums; }
.version-counts strong { color: var(--paper); }
.current { margin-left: 2px; color: var(--accent); }
.revision-fields > div { display: grid; grid-template-columns: 115px minmax(0, 1fr); gap: 6px; font-size: .86rem; }
.revision-fields dt, .restore small { color: var(--muted); }
.revision-fields dd { white-space: pre-wrap; overflow-wrap: anywhere; }
.restore { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 10px; margin-top: 12px; }

.notice { padding: 8px 12px; border: 1px solid #a67272; border-radius: 7px; background: #3a262e; color: var(--danger); font-size: .9rem; }
.notice.success { background: #172f30; color: var(--active); border-color: #538d80; }
.main > .notice { margin-bottom: 15px; }

.public-main { min-height: 100dvh; display: grid; place-items: center; padding: 25px 18px; }
.sign-in-layout, .gate-layout { background: radial-gradient(ellipse at 75% 22%, #172c3f 0%, var(--canvas) 48%); }
.sign-in { display: grid; grid-template-columns: 1.08fr .92fr; width: min(100%, 940px); min-height: 480px; border: 1px solid var(--stroke); border-radius: 16px; overflow: hidden; background: var(--surface); }
.sign-in-copy { display: flex; align-items: flex-start; flex-direction: column; justify-content: center; padding: 42px; }
.sign-in-copy .brand { margin-bottom: 34px; }
.sign-in-copy p { margin-top: 15px; color: var(--soft); max-width: 34ch; }
.sign-in-copy > small { margin-top: 10px; color: var(--muted); }
.sign-in-copy .google { margin-top: 25px; }
.button.google { background: #f6f8fd; color: #152031; border-color: #f6f8fd; font-weight: 600; }
.button.google:hover { background: #d7edfc; border-color: #d7edfc; }
.sign-in-visual { display: grid; place-items: center; background: radial-gradient(ellipse at center, #244a60, #111c2e 65%); border-left: 1px solid var(--stroke); }
.sign-in-visual .qr-art { width: 190px; height: 190px; }
.sign-in-visual .qr-art svg { width: 106px; height: 106px; }
.sign-in-visual .qr-art span { width: 28px; height: 28px; }
.demo { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding-top: 9px; margin-top: 13px; border-top: 1px solid var(--stroke); color: var(--muted); font-size: .85rem; }

.gate-card {
  width: min(100%, 460px);
  display: grid;
  justify-items: start;
  gap: 13px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 32px;
}
.gate-logo { display: block; object-fit: contain; margin-bottom: 9px; }
.gate-card h1 { font-size: 2.6rem; }
.gate-card p { color: var(--soft); overflow-wrap: anywhere; }
.gate-card form, .gate-card > .button { width: 100%; margin-top: 9px; }
.gate-card .button { min-height: 48px; justify-content: space-between; }
.gate-card form button { width: 100%; }
.destination { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.destination svg { color: var(--accent); }
.public-text { white-space: pre-wrap; }
.public-contact { max-width: 100%; }
.problem { margin: auto; }

@media (max-width: 1120px) {
  .main { padding: 39px 28px 55px; }
  .workspace { grid-template-columns: 190px minmax(0, 1fr); }
  .editor-layout, .detail-layout { grid-template-columns: minmax(0, 1fr) minmax(220px, 30%); gap: 15px; }
  .panel, .form-panel { padding: 17px; }
}

@media (max-width: 890px) {
  .workspace { display: block; }
  .rail { position: static; height: auto; display: grid; grid-template-columns: 1fr auto; padding: 10px 18px 8px; gap: 10px; border-right: 0; border-bottom: 1px solid var(--stroke); }
  .rail .brand { margin: 0; }
  .rail .brand img { width: 30px; }
  .rail nav { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: wrap; }
  .rail nav a { padding: 7px 9px; }
  .account { padding: 0; border: 0; align-self: center; }
  .main { padding-top: 30px; }
}

@media (max-width: 620px) {
  h1 { font-size: 2.2rem; }
  .main { padding: 25px 14px 40px; }
  .page-header { align-items: flex-start; margin-bottom: 19px; }
  .page-header p { font-size: .9rem; }
  .page-header .button { margin-top: 1px; padding-inline: 9px; font-size: .88rem; }
  .editor-layout, .detail-layout { grid-template-columns: 1fr; }
  .preview { position: static; }
  .editor-layout .preview { margin-top: 6px; }
  .preview-stage { max-height: 250px; }
  input:not([type="radio"]), textarea, select { font-size: 1rem; }
  .table-wrap { overflow-x: auto; }
  .list-panel th, .list-panel td { padding: 10px 7px; }
  .list-panel :is(th, td):first-child { padding-left: 10px; }
  .list-panel :is(th, td):last-child { padding-right: 8px; }
  .code-cell { gap: 6px; }
  .code-label > small { max-width: 16ch; }
  .type-icon { display: none; }
  .updated { display: none; }
  .filters { padding: 10px; }
  .search { flex-basis: 100%; }
  select { max-width: 135px; }
  .account { gap: 5px; }
  .account .avatar { display: none; }
  .account > div { max-width: 94px; }
  .account small { font-size: .72rem; }
  .sign-in { min-height: 0; grid-template-columns: 1fr; }
  .sign-in-copy { padding: 27px 22px; }
  .sign-in-copy .brand { margin-bottom: 27px; }
  .sign-in-visual { display: none; }
  .gate-card { padding: 24px; }
  .gate-card h1 { font-size: 2.1rem; }
  .version-head { flex-wrap: wrap; }
}

@media (forced-colors: active) {
  .choice > span::after { border-color: CanvasText; }
  .choice input:checked + span::after { forced-color-adjust: none; border-color: Highlight; background-color: Highlight; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}
