:root {
  color-scheme: light;
  --field: #f4f4f5;
  --accent: #0a84ff;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(70% 42% at 50% -8%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 68%),
    var(--field);
  color: #1d1d1f;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.rotate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 5;
  place-items: center;
  text-align: center;
  padding: 24px;
  background: #000;
}
.rotate h2 { margin: 0 0 8px; font-size: 28px; letter-spacing: -0.03em; }
.rotate p { margin: 0; color: #98989d; }
@media (orientation: landscape) and (max-height: 500px) {
  body.is-card .rotate { display: grid; }
  body.is-card .stage, body.is-card .foot { display: none; }
}

.stage {
  width: min(768px, 100%);
  margin: 0 auto;
  padding: 28px 0 18px;
}
.pass {
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --row: #f5f5f7;
  --sep: rgba(60, 60, 67, 0.18);
  background: var(--card);
  color: var(--text);
  border-radius: 0 0 28px 28px;
  overflow: hidden;
  padding-bottom: 22px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
}
.pass.paper {
  --card: #fff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --row: #f2f2f7;
  --sep: rgba(60, 60, 67, 0.29);
}
.cover {
  position: relative;
  aspect-ratio: 21 / 9;
  background:
    radial-gradient(90% 120% at 100% 0%, color-mix(in srgb, var(--accent) 78%, white), transparent 58%),
    radial-gradient(80% 100% at 0% 110%, color-mix(in srgb, var(--accent) 42%, #000), transparent 60%),
    #dfe5ef;
}
.cover::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 46%;
  background: linear-gradient(to bottom, transparent, var(--card));
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.identity { margin-top: -58px; padding: 0 24px; text-align: center; position: relative; }
.avatar {
  width: 108px;
  height: 108px;
  margin: 0 auto;
  padding: 3px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 0 0 3px var(--accent);
}
.avatar img, .avatar span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: color-mix(in srgb, var(--accent) 16%, var(--row));
  color: var(--accent);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.04em;
}
h1 {
  margin: 16px 0 0;
  font-size: clamp(40px, 6vw, 58px);
  line-height: 1.02;
  font-weight: 600;
  letter-spacing: -0.045em;
}
.profile-meta { display: grid; gap: 8px; justify-items: center; margin-top: 12px; }
.role, .where { display: inline-flex; align-items: center; gap: 7px; margin: 0; letter-spacing: -0.02em; }
.role { color: var(--accent); font-size: 18px; font-weight: 650; }
.where { color: var(--muted); font-size: 15px; }
.meta-icon { display: inline-grid; place-items: center; width: 24px; height: 24px; flex: 0 0 24px; }
.meta-icon svg,
.meta-icon svg.icon { display: block; width: 18px !important; height: 18px !important; max-width: 18px; max-height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.actions { display: flex; gap: 8px; padding: 22px 20px 0; }
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 18px;
  border-radius: 999px;
  border: 0;
  text-decoration: none;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  cursor: pointer;
}
.pill svg,
.pill svg.icon { display: block; width: 18px !important; height: 18px !important; max-width: 18px; max-height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pill.solid { flex: 1; background: var(--accent); color: #fff; }
.pill.ghost {
  color: var(--text);
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--sep);
  min-width: 78px;
}
.pill svg.qr-icon { width: 21px !important; height: 21px !important; max-width: 21px; max-height: 21px; stroke-width: 2.2; }
.pass section { padding: 22px 16px 0; }
.pass h2 {
  margin: 0 8px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: -0.01em;
}
.group { background: var(--row); border-radius: 14px; overflow: hidden; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 8px 14px;
  text-decoration: none;
  color: inherit;
}
.social-row { min-height: 68px; transition: background-color .2s ease, transform .2s ease; }
.social-row:hover { background: color-mix(in srgb, var(--accent) 7%, var(--row)); transform: translateX(2px); }
.arrow { margin-left: auto; color: var(--muted); font-size: 20px; }
.row + .row { box-shadow: inset 0 0.5px 0 var(--sep); }
.mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}
.mark svg,
.mark svg.icon { display: block; width: 18px !important; height: 18px !important; max-width: 18px; max-height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.copy { display: grid; min-width: 0; }
.kicker { color: var(--muted); font-size: 12px; }
.value {
  font-size: 16px;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.foot { text-align: center; padding: 8px 0 28px; }
.foot a { color: #98989d; font-size: 13px; text-decoration: none; }
.qr-pass, .missing { padding: 28px 8px 22px; text-align: center; }
.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}
.qr-pass h1, .missing h1 { font-size: 32px; }
.qr {
  width: min(280px, 78%);
  margin: 22px auto 0;
  display: block;
  background: #fff;
  border-radius: 18px;
  padding: 12px;
}
.qr-pass .where { word-break: break-all; padding: 0 20px; color: var(--muted); }

.sheet-wrap { width: min(560px, calc(100% - 24px)); margin: 0 auto; padding: 28px 0 40px; }
.sheet {
  display: grid;
  gap: 14px;
  background: #1c1c1e;
  border-radius: 28px;
  padding: 28px 22px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.sheet h1 { font-size: 34px; }
.lede, .hint { margin: 0; color: #98989d; font-size: 14px; line-height: 1.4; }
.banner {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 69, 58, 0.16);
  color: #ffb4ab;
  font-size: 15px;
}
.banner.ok { background: rgba(48, 209, 88, 0.16); color: #b6f2c4; }
.url-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #2c2c2e;
  font-size: 14px;
}
.url-row a { color: var(--accent); text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
.field { display: grid; gap: 6px; color: #98989d; font-size: 13px; font-weight: 600; }
.field input, .field input[type="file"] {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #000;
  color: #f5f5f7;
  padding: 0 14px;
  font-size: 17px;
  font-weight: 400;
}
.field input[type="file"] { padding: 12px 14px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 10px;
}
legend { color: #f5f5f7; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; padding: 0; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; }
.choice span {
  display: grid;
  gap: 2px;
  min-height: 64px;
  align-content: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: #000;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.choice strong { color: #f5f5f7; font-size: 16px; }
.choice small { color: #98989d; font-size: 13px; }
.choice input:checked + span { box-shadow: inset 0 0 0 2px var(--accent); }
.color-field input { padding: 6px; height: 48px; }
.check { display: flex; gap: 10px; align-items: flex-start; color: #f5f5f7; font-size: 15px; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.sheet .pill { width: 100%; }

.dashboard-wrap { width: min(980px, calc(100% - 32px)); margin: 0 auto; padding: 44px 0 64px; }
.is-admin { --admin-bg: #f3f5f8; --admin-surface: #ffffff; --admin-surface-soft: #f8fafc; --admin-text: #18212f; --admin-muted: #687386; --admin-border: #e2e7ef; --admin-shadow: 0 14px 40px rgba(26, 39, 61, .08); background: radial-gradient(80% 60% at 50% -20%, rgba(37, 111, 235, .10), transparent 70%), var(--admin-bg); color: var(--admin-text); }
.is-admin .dashboard-wrap { width: min(1180px, calc(100% - 48px)); padding: 34px 0 72px; }
.dashboard-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.dashboard-head h1 { margin: 6px 0 0; color: var(--admin-text); font-size: clamp(34px, 5vw, 52px); }
.dashboard-head .actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.is-admin .pill { min-height: 42px; border-radius: 10px; font-size: 14px; }
.is-admin .pill.solid { background: #1769e8; box-shadow: 0 8px 18px rgba(23, 105, 232, .18); }
.is-admin .pill.ghost { color: var(--admin-text); background: var(--admin-surface); border: 1px solid var(--admin-border); box-shadow: 0 1px 2px rgba(20, 32, 50, .03); }
.is-admin .pill:hover { transform: translateY(-1px); filter: brightness(.98); }
.is-admin .pill svg { width: 16px; height: 16px; }
.logout-form { display: inline-flex; }
.card-list { display: grid; gap: 10px; }
.card-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 14px; padding: 18px 20px; border: 1px solid var(--admin-border); border-radius: 16px; background: var(--admin-surface); box-shadow: var(--admin-shadow); }
.card-row:hover { border-color: color-mix(in srgb, #1769e8 30%, var(--admin-border)); }
.card-row-main { display: grid; gap: 4px; min-width: 0; }
.card-row-main strong { color: var(--admin-text); font-size: 16px; }
.card-slug, .card-owner { color: var(--admin-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-badge, .homepage-mark { display: inline-flex; align-items: center; min-height: 30px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.status-draft { background: #edf0f4; color: #586579; } .status-pending { background: #fff3d6; color: #956000; } .status-approved { background: #dcf7e6; color: #197044; } .status-rejected, .status-suspended { background: #ffe5e2; color: #b0342a; }
.homepage-mark { background: #e5efff; color: #155db4; } .homepage-mark.muted { background: transparent; color: var(--admin-muted); }
.card-edit { min-width: 96px; min-height: 40px; background: transparent; }
.status-filter { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; color: var(--admin-muted); font-size: 13px; font-weight: 700; }
.status-filter select { min-height: 40px; padding: 0 12px; border: 1px solid var(--admin-border); border-radius: 10px; background: var(--admin-surface); color: var(--admin-text); }
.inline-create { display: grid; gap: 12px; margin-top: 28px; padding: 22px; border: 1px solid var(--admin-border); border-radius: 16px; background: var(--admin-surface); box-shadow: var(--admin-shadow); }
.inline-create h2 { margin: 0 0 4px; color: var(--admin-text); }
.inline-create .pill { margin-top: 4px; }
.empty-state { padding: 42px 30px; color: var(--admin-muted); text-align: center; background: var(--admin-surface); border: 1px dashed var(--admin-border); border-radius: 16px; }
.is-admin .table-wrap { margin-top: 22px; padding: 6px 16px; border: 1px solid var(--admin-border); border-radius: 16px; background: var(--admin-surface); box-shadow: var(--admin-shadow); }
.is-admin table { color: var(--admin-text); }
.is-admin th { color: var(--admin-muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.is-admin th, .is-admin td { border-bottom-color: var(--admin-border); }
.is-admin .field { color: var(--admin-muted); }
.is-admin .field input, .is-admin .field input[type="file"] { border-color: var(--admin-border); background: var(--admin-surface); color: var(--admin-text); }
.is-admin .sheet { background: var(--admin-surface); border: 1px solid var(--admin-border); box-shadow: var(--admin-shadow); }
.is-admin .sheet h1, .is-admin legend { color: var(--admin-text); }
.is-admin .lede, .is-admin .hint { color: var(--admin-muted); }
.is-admin .choice span { background: var(--admin-surface-soft); box-shadow: inset 0 0 0 1px var(--admin-border); }
.is-admin .choice strong { color: var(--admin-text); }
.is-admin .choice small { color: var(--admin-muted); }

@media (max-width: 640px) {
  h1 { font-size: 34px; }
  .pair, .choices { grid-template-columns: 1fr; }
  .stage { padding-top: 0; }
  .is-admin .dashboard-wrap { width: min(100% - 24px, 560px); padding-top: 24px; }
  .dashboard-head { align-items: flex-start; flex-direction: column; }
  .dashboard-head .pill { width: 100%; }
  .card-row { grid-template-columns: 1fr; gap: 10px; }
  .card-row-main { grid-column: 1 / -1; }
  .status-badge, .homepage-mark, .card-edit { grid-column: 1; grid-row: auto; justify-self: start; }
  .card-edit { width: 100%; }
}
@media (prefers-color-scheme: dark) {
  .is-admin { --admin-bg: #10141b; --admin-surface: #171d27; --admin-surface-soft: #1d2531; --admin-text: #edf2f8; --admin-muted: #9ba8ba; --admin-border: #2a3545; --admin-shadow: 0 18px 48px rgba(0, 0, 0, .22); background: radial-gradient(80% 60% at 50% -20%, rgba(57, 124, 241, .18), transparent 70%), var(--admin-bg); }
  .is-admin .pill.ghost, .is-admin .status-filter select { background: var(--admin-surface); color: var(--admin-text); }
  .status-draft { background: #29313d; color: #c1cad7; } .status-pending { background: #44351e; color: #f3c66d; } .status-approved { background: #193d2a; color: #8de0a9; } .status-rejected, .status-suspended { background: #482725; color: #ffaaa2; }
  .homepage-mark { background: #203958; color: #a7ccff; }
}
@media (prefers-reduced-motion: no-preference) {
  .pass { animation: rise 0.45s ease both; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.table-wrap { overflow-x: auto; margin-top: 1.5rem; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .85rem .6rem; border-bottom: 1px solid var(--line, #d9d9d9); vertical-align: middle; }
.inline-form { display: inline-block; margin: .15rem .25rem .15rem 0; }
