:root {
  --bg: #08090d;
  --bg-soft: #0d0f16;
  --panel: #12141c;
  --panel-2: #171a24;
  --line: #242835;
  --line-soft: #1c1f2a;
  --text: #e9ecf5;
  --muted: #8c93a7;
  --muted-2: #626a7d;
  --accent: #f5c451;
  --accent-ink: #171205;
  --ok: #34d399;
  --ok-bg: rgba(52, 211, 153, 0.12);
  --warn: #f7b955;
  --warn-bg: rgba(247, 185, 85, 0.12);
  --bad: #ff6b6b;
  --bad-bg: rgba(255, 107, 107, 0.12);
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body { height: 100%; }
html { background: #08090d; color-scheme: dark; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 520px at 50% -220px, rgba(245, 196, 81, 0.12), transparent 70%),
    linear-gradient(180deg, #0a0c12 0%, var(--bg) 45%);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
p { margin: 0; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 32px 20px 80px; }
.wrap-narrow { max-width: 720px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
}
.brand .dot {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(140deg, var(--accent), #b98a19);
  display: grid; place-items: center;
  color: #191203; font-size: 14px;
}

.orgbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 26px;
}
.org-chip {
  display: grid;
  place-items: center;
  background: #fff;
  border-radius: 12px;
  padding: 7px 11px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}
.org-logo { display: block; height: 36px; width: auto; }

.hero { padding: 8px 0 26px; }
.hero .kicker {
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 12px;
}
.hero h1 { font-size: clamp(30px, 6vw, 48px); font-weight: 800; }
.hero .sub { color: var(--muted); margin-top: 12px; max-width: 60ch; font-size: 15px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 13px;
  color: var(--text);
}
.chip.muted { color: var(--muted); }
.chip .k { color: var(--muted-2); }

.grid { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; background: var(--panel); }
.card h2 { font-size: 18px; font-weight: 700; }
.card .hint { color: var(--muted); font-size: 13px; margin-top: 6px; }

.field { margin-top: 18px; }
.field label {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 8px;
}
.field label .opt { text-transform: none; letter-spacing: 0; color: var(--muted-2); font-weight: 500; }

.input, select.input, textarea.input {
  width: 100%;
  padding: 13px 14px;
  background: #0b0d13;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: #4d5566; }
.input:focus {
  border-color: rgba(245, 196, 81, 0.6);
  box-shadow: 0 0 0 3px rgba(245, 196, 81, 0.12);
}
.input[type="file"] { padding: 10px; font-size: 13px; color: var(--muted); }
textarea.input { resize: vertical; min-height: 76px; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Day Scholar / Hostellite segmented choice */
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.choice label {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 14px; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.02);
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  text-transform: none; letter-spacing: 0; white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}
.choice label:hover { border-color: rgba(255, 255, 255, 0.24); }
.choice input { accent-color: #e9bd62; margin: 0; }
.choice label:has(input:checked) {
  border-color: rgba(233, 189, 98, 0.55);
  background: rgba(233, 189, 98, 0.1);
}
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.05s, background 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:hover { background: #1d2130; border-color: #303647; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #ffd875, var(--accent));
  color: var(--accent-ink);
  border-color: #d8a92f;
  font-weight: 700;
}
.btn-primary:hover { background: linear-gradient(180deg, #ffdf8c, #f0bd42); }
.btn-ok { background: rgba(52, 211, 153, 0.14); border-color: rgba(52, 211, 153, 0.4); color: #7ef0bb; }
.btn-ok:hover { background: rgba(52, 211, 153, 0.2); }
.btn-danger { background: rgba(255, 107, 107, 0.1); border-color: rgba(255, 107, 107, 0.35); color: #ff9c9c; }
.btn-danger:hover { background: rgba(255, 107, 107, 0.16); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 9px; }

.notice {
  margin-top: 16px;
  padding: 13px 15px;
  border-radius: 11px;
  font-size: 13.5px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
}
.notice.bad { border-color: rgba(255, 107, 107, 0.4); background: var(--bad-bg); color: #ffc2c2; }
.notice.ok { border-color: rgba(52, 211, 153, 0.4); background: var(--ok-bg); color: #a6f5d2; }
.notice.warn { border-color: rgba(247, 185, 85, 0.4); background: var(--warn-bg); color: #ffdca4; }
.hidden { display: none !important; }

.steps { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 14px; }
.steps li { display: flex; gap: 12px; font-size: 13.5px; color: var(--muted); }
.steps .num {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 8px;
  background: rgba(245, 196, 81, 0.12);
  border: 1px solid rgba(245, 196, 81, 0.3);
  color: var(--accent);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
}
.steps strong { color: var(--text); font-weight: 600; }

.price-tag { display: flex; align-items: baseline; gap: 8px; margin-top: 14px; }
.price-tag .amount { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; }
.price-tag .cur { color: var(--muted); font-size: 13px; letter-spacing: 0.1em; }

/* admin shell */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
  padding: 15px 16px;
}
.stat .n { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.stat .l { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 18px; }
.tab {
  padding: 9px 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.03); }
.tab.active { background: var(--panel-2); border-color: var(--line); color: var(--text); }

.reg-list { display: grid; gap: 12px; }
.reg {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
}
.reg-head {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 17px;
  cursor: pointer;
}
.reg-head:hover { background: rgba(255, 255, 255, 0.015); }
.avatar {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: rgba(245, 196, 81, 0.1);
  border: 1px solid rgba(245, 196, 81, 0.25);
  color: var(--accent);
  font-weight: 700; font-size: 14px;
}
.reg-main { min-width: 0; flex: 1; }
.reg-name { font-weight: 650; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reg-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; display: flex; gap: 10px; flex-wrap: wrap; }
.reg-body { border-top: 1px solid var(--line-soft); padding: 16px 17px; background: #0b0d13; display: none; }
.reg.open .reg-body { display: block; }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge.pending { color: #ffd28a; border-color: rgba(247, 185, 85, 0.35); background: var(--warn-bg); }
.badge.verified, .badge.active, .badge.valid { color: #8af0c4; border-color: rgba(52, 211, 153, 0.35); background: var(--ok-bg); }
.badge.rejected, .badge.revoked, .badge.invalid { color: #ffabab; border-color: rgba(255, 107, 107, 0.35); background: var(--bad-bg); }
.badge.used, .badge.already_used { color: #ffd28a; border-color: rgba(247, 185, 85, 0.35); background: var(--warn-bg); }

.proof-thumb {
  width: 108px; height: 108px; border-radius: 10px;
  object-fit: cover; border: 1px solid var(--line); background: #000;
}

.actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 16px; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; color: var(--muted); font-weight: 600;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 10px 10px; border-bottom: 1px solid var(--line);
}
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.scroll-x { overflow-x: auto; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login { width: 100%; max-width: 380px; }

/* ticket */
.ticket-page { display: grid; place-items: center; min-height: 100vh; padding: 24px 16px 48px; }
.ticket {
  width: 100%; max-width: 400px;
  background: linear-gradient(180deg, #15181f, #0e1016);
  border: 1px solid #2b3040;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.ticket-top { padding: 22px 24px 18px; border-bottom: 1px dashed #313747; position: relative; }
.ticket-top::before, .ticket-top::after {
  content: ""; position: absolute; bottom: -11px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg); border: 1px solid #2b3040;
}
.ticket-top::before { left: -12px; }
.ticket-top::after { right: -12px; }
.ticket-event { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.ticket-name { font-size: 24px; font-weight: 800; margin-top: 8px; letter-spacing: -0.02em; }
.ticket-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.qr-box { padding: 22px 24px; display: grid; place-items: center; }
.qr-box svg { width: 100%; max-width: 240px; height: auto; border-radius: 12px; background: #fff; padding: 10px; }
.qr-box img { width: 100%; max-width: 240px; height: auto; border-radius: 12px; background: #fff; padding: 10px; }
.ticket-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.16em; font-size: 15px; color: var(--text); text-align: center;
}
.ticket-bottom { padding: 18px 24px 24px; border-top: 1px dashed #313747; }
.ticket-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; font-size: 12.5px; }
.ticket-meta .k { color: var(--muted-2); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; }
.ticket-status {
  margin: 0 0 4px; text-align: center; font-weight: 800; letter-spacing: 0.06em;
  font-size: 13px; padding: 10px; border-radius: 10px;
}
.ticket-status.active { background: var(--ok-bg); color: #8af0c4; }
.ticket-status.used, .ticket-status.revoked { background: var(--bad-bg); color: #ffabab; }

/* scanner */
.scanner {
  min-height: 100vh; display: flex; flex-direction: column;
  background: #000; color: #fff;
}
.scan-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; background: #0a0b10; border-bottom: 1px solid #1c1f2a;
}
.scan-bar .title { font-weight: 700; font-size: 14px; letter-spacing: 0.02em; }
.scan-stage { position: relative; flex: 1; min-height: 0; background: #000; overflow: hidden; }
#video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.scan-overlay {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
}
.scan-frame {
  width: min(70vw, 280px); aspect-ratio: 1; border-radius: 20px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(245, 196, 81, 0.75);
  position: relative;
}
.scan-frame::after {
  content: ""; position: absolute; left: 8%; right: 8%; top: 50%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: sweep 2.4s ease-in-out infinite;
}
@keyframes sweep {
  0%, 100% { transform: translateY(-56px); opacity: 0.2; }
  50% { transform: translateY(56px); opacity: 1; }
}
.scan-hint {
  position: absolute; left: 0; right: 0; bottom: 18px; text-align: center;
  font-size: 12.5px; color: #c8cede; text-shadow: 0 1px 8px #000;
}
.scan-panel { padding: 14px 16px 22px; background: #0a0b10; border-top: 1px solid #1c1f2a; }
.manual-row { display: flex; gap: 8px; }

.result {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  padding: 24px; text-align: center;
  backdrop-filter: blur(6px);
  animation: pop 0.18s ease-out;
}
.result.valid { background: rgba(6, 46, 32, 0.93); }
.result.already_used { background: rgba(58, 38, 4, 0.94); }
.result.invalid, .result.revoked { background: rgba(58, 10, 10, 0.94); }
.result-icon { font-size: 64px; line-height: 1; margin-bottom: 14px; }
.result-title { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.result-msg { margin-top: 8px; color: rgba(255, 255, 255, 0.78); max-width: 30ch; }
.result-detail {
  margin-top: 18px; padding: 14px 18px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.08); font-size: 13.5px;
}
.result-detail .who { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
@keyframes pop { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }

.small { font-size: 12px; color: var(--muted); }
.footer { margin-top: 34px; text-align: center; color: var(--muted-2); font-size: 12px; }
.footer a { color: var(--muted); }
.spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
