@font-face {
  font-family: Pretendard;
  src: url('/static/fonts/Pretendard-Regular.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap
}

@font-face {
  font-family: Pretendard;
  src: url('/static/fonts/Pretendard-SemiBold.woff2') format('woff2');
  font-style: normal;
  font-weight: 500 600;
  font-display: swap
}

@font-face {
  font-family: Pretendard;
  src: url('/static/fonts/Pretendard-Bold.woff2') format('woff2');
  font-style: normal;
  font-weight: 700 900;
  font-display: swap
}

/* One quiet blue system: a pale canvas, white cards and a single action colour. */
:root {
  --canvas: #EFF4FD;
  --surface: #FFFFFF;
  --surface-alt: #F6F8FC;
  --ink: #17233B;
  --muted: #627086;
  --subtle: #8A96A8;
  --rule: #E3E9F2;
  --rule-strong: #D3DCE8;
  --action: #2F7CF6;
  --action-hover: #1D69DC;
  --action-soft: #EAF2FF;
  --success: #1F7A57;
  --success-soft: #E7F5EE;
  --warning: #8A6116;
  --warning-soft: #FFF5E3;
  --danger: #B03A4C;
  --danger-soft: #FDEEF0;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px #17233b0a, 0 8px 24px #17233b08;
  font-family: Pretendard, 'Noto Sans KR', system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%
}

*,
*::before,
*::after {
  box-sizing: border-box
}

body {
  margin: 0;
  background: var(--canvas);
  font-size: 14px;
  line-height: 1.5;
  word-break: keep-all;
  overflow-wrap: break-word
}

[hidden] {
  display: none !important
}

a {
  color: inherit;
  text-decoration: none
}

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

button {
  cursor: pointer
}

h1,
h2,
h3,
p {
  margin: 0
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0
}

/* ---------- Form controls ---------- */

input,
textarea,
select {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s
}

textarea {
  resize: vertical;
  line-height: 1.5
}

input::placeholder,
textarea::placeholder {
  color: #9AA5B5
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--action);
  box-shadow: 0 0 0 3px #2f7cf61f
}

input[type=file] {
  padding: 9px 12px;
  background: var(--surface-alt)
}

button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 2px
}

.field {
  position: relative;
  display: block
}

.field>svg {
  position: absolute;
  left: 15px;
  top: 50%;
  width: 17px;
  height: 17px;
  transform: translateY(-50%);
  color: var(--action);
  pointer-events: none
}

.field input {
  min-height: 48px;
  padding-left: 43px
}

.field input:has(+ .field-action) {
  padding-right: 48px
}

.field-action {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--subtle)
}

.field-action:hover {
  color: var(--ink)
}

.field-action svg {
  width: 18px;
  height: 18px
}

.field-action[aria-pressed=true] .eye-open,
.field-action[aria-pressed=false] .eye-closed {
  display: none
}

.label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 7px
}

.form-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 14px
}

.stack-form label,
.field-grid label,
.inline-form label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  font-weight: 600
}

.check-label,
.stack-form .check-label,
.field-grid .check-label,
.inline-form .check-label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  cursor: pointer
}

.check-label input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--action)
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px
}

.field-grid .span-2 {
  grid-column: span 2
}

.inline-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap
}

.inline-form label {
  flex: 1;
  min-width: 140px
}

.inline-form .check-label {
  flex: 0 0 auto;
  min-width: 0;
  min-height: 46px
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap
}

.field-grid .form-actions {
  grid-column: 1 / -1
}

/* ---------- Buttons ---------- */

.primary-button,
.secondary-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s
}

.primary-button {
  background: var(--action);
  color: #fff
}

.primary-button:hover {
  background: var(--action-hover)
}

.secondary-button {
  background: var(--surface);
  border-color: var(--rule-strong);
  color: var(--ink)
}

.secondary-button:hover {
  border-color: var(--action);
  color: var(--action)
}

.button-sm {
  min-height: 38px;
  padding: 0 13px;
  font-size: 13px
}

.full {
  width: 100%
}

.text-button {
  border: 0;
  background: none;
  padding: 6px 2px;
  color: var(--action);
  font-size: 13px;
  font-weight: 600
}

.text-button:hover {
  text-decoration: underline
}

.text-button.danger,
.danger-button {
  color: var(--danger)
}

.danger-button {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid #F1C9CF;
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600
}

.danger-button:hover {
  background: var(--danger-soft)
}

button[aria-busy=true] {
  pointer-events: none;
  opacity: .75
}

button[aria-busy=true]::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

/* ---------- Feedback ---------- */

.notice {
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  border: 1px solid transparent
}

.notice.error {
  background: var(--danger-soft);
  border-color: #F6D5DA;
  color: var(--danger)
}

.notice.warning {
  background: var(--warning-soft);
  border-color: #F4E2BE;
  color: var(--warning)
}

.notice.success {
  background: var(--success-soft);
  border-color: #CBE9DA;
  color: var(--success)
}

.notice.info {
  background: var(--action-soft);
  border-color: #D4E4FD;
  color: #1D5CBF
}

.badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 99px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap
}

.badge.muted,
.status-pill.paused {
  background: #EEF1F5;
  color: #667385
}

.badge.blue {
  background: var(--action-soft);
  color: var(--action-hover)
}

.badge.danger {
  background: var(--danger-soft);
  color: var(--danger)
}

.badge.warning {
  background: var(--warning-soft);
  color: var(--warning)
}

.empty-state {
  padding: 32px 16px;
  color: var(--subtle);
  text-align: center;
  font-size: 13px
}

.usage-track {
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: #E8EEF7;
  overflow: hidden
}

.usage-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--action);
  transition: width .35s ease
}

/* ---------- Centered card pages (student, login, errors) ---------- */

.auth-shell {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px calc(40px + env(safe-area-inset-bottom))
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink)
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--action);
  color: #fff;
  font-size: 14px;
  font-weight: 800
}

.brand-dot {
  color: var(--subtle);
  font-weight: 500
}

.auth-card {
  width: min(100%, 400px);
  margin-top: 26px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow)
}

.auth-card.wide {
  width: min(100%, 440px)
}

.card-head {
  text-align: center;
  margin-bottom: 26px
}

.card-head h1 {
  font-size: 22px;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -.03em
}

.card-head p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6
}

.card-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: 14px;
  background: var(--action-soft);
  color: var(--action)
}

.card-icon svg {
  width: 24px;
  height: 24px
}

.card-icon.muted {
  background: #EEF1F5;
  color: #667385
}

.card-icon.warning {
  background: var(--warning-soft);
  color: var(--warning)
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px
}

.auth-form .primary-button {
  min-height: 48px;
  margin-top: 6px
}

.auth-card>.notice,
.card-notice {
  margin-bottom: 16px
}

.card-note {
  margin-top: 16px;
  text-align: center
}

.card-head+.card-note {
  margin-top: 0
}

.auth-foot.tight {
  margin-top: 6px
}

.primary-button svg,
.secondary-button svg {
  flex: none;
  width: 18px;
  height: 18px
}

.auth-foot {
  margin-top: 26px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6
}

.auth-foot a,
.auth-foot strong {
  color: var(--action);
  font-weight: 600
}

.auth-foot small {
  display: block;
  margin-top: 4px;
  color: var(--subtle);
  font-size: 12px
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px
}

.steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-alt);
  font-size: 14px
}

.steps b {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--action);
  color: #fff;
  font-size: 12px
}

/* ---------- Result ticket ---------- */

.result-shell {
  justify-content: flex-start;
  padding-top: 40px
}

.ticket {
  width: min(100%, 400px);
  margin-top: 26px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow)
}

.ticket-body {
  padding: 30px 28px 26px;
  text-align: center
}

.ticket-body h1 {
  margin-top: 14px;
  font-size: 24px;
  line-height: 1.35;
  letter-spacing: -.035em
}

.ticket-body>p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6
}

.result-image {
  display: block;
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 10px;
  margin: 0 0 20px
}

.ticket-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 22px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  text-align: left
}

.ticket-details div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 16px
}

.ticket-details div+div {
  border-left: 1px solid var(--rule)
}

.ticket-details span {
  font-size: 12px;
  color: var(--subtle)
}

.ticket-details strong {
  font-size: 15px
}

.ticket-cut {
  position: relative;
  height: 1px;
  margin: 0 18px;
  border-top: 1.5px dashed var(--rule-strong)
}

.ticket-cut::before,
.ticket-cut::after {
  content: '';
  position: absolute;
  top: -11px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--canvas);
  border: 1px solid var(--rule)
}

.ticket-cut::before {
  left: -29px;
  clip-path: inset(0 0 0 50%)
}

.ticket-cut::after {
  right: -29px;
  clip-path: inset(0 50% 0 0)
}

.ticket-code {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 22px 24px 26px
}

.ticket-code span {
  font-size: 12px;
  color: var(--subtle)
}

.ticket-code strong {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 22px;
  letter-spacing: .08em;
  color: var(--ink)
}

.ticket-code small {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  line-height: 1.55
}

.sticky-action {
  position: sticky;
  bottom: 0;
  width: min(100%, 400px);
  margin-top: 18px;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, #eff4fd00, var(--canvas) 28%)
}

.sticky-action .primary-button {
  min-height: 50px
}

/* ---------- Admin layout ---------- */

.admin-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100svh
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100svh;
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  background: var(--surface);
  border-right: 1px solid var(--rule)
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  font-size: 15px;
  font-weight: 700
}

.sidebar-brand small,
.mobile-menu-heading small {
  display: block;
  margin-top: 1px;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 500
}

.sidebar nav,
.mobile-menu nav {
  display: flex;
  flex-direction: column;
  gap: 2px
}

.sidebar nav {
  margin-top: 30px
}

.sidebar nav a,
.mobile-menu nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  color: #4F5D72;
  font-size: 14px;
  font-weight: 600
}

.sidebar nav a svg,
.mobile-menu nav a svg {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--subtle)
}

.sidebar nav a:hover,
.mobile-menu nav a:hover {
  background: var(--surface-alt);
  color: var(--ink)
}

.sidebar nav a[aria-current=page],
.mobile-menu nav a[aria-current=page] {
  background: var(--action-soft);
  color: var(--action-hover)
}

.sidebar nav a[aria-current=page] svg,
.mobile-menu nav a[aria-current=page] svg {
  color: var(--action)
}

.sidebar-bottom,
.mobile-menu-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding: 16px 8px 0;
  border-top: 1px solid var(--rule);
  font-size: 13px
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 600
}

.user-chip span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--action-soft);
  color: var(--action);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase
}

.admin-main {
  min-width: 0
}

.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
  color: var(--subtle)
}

.admin-top-actions {
  display: flex;
  align-items: center;
  gap: 14px
}

.mobile-brand {
  display: none
}

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: var(--surface);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink)
}

.menu-open {
  overflow: hidden
}

.mobile-menu,
.mobile-menu-backdrop {
  display: none
}

.live-notice {
  display: block;
  width: 100%;
  padding: 10px 20px;
  border: 0;
  border-bottom: 1px solid #D4E4FD;
  background: var(--action-soft);
  color: #1D5CBF;
  font-size: 13px;
  font-weight: 600;
  text-align: center
}

.live-notice:hover {
  background: #DFEBFF
}

.admin-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 32px 80px
}

.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  transition: opacity .3s
}

.flash button {
  border: 0;
  background: none;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  padding: 2px 4px;
  opacity: .7
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 24px
}

.page-heading h1 {
  font-size: 24px;
  letter-spacing: -.035em;
  line-height: 1.3
}

.page-heading p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6
}

.heading-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap
}

.panel {
  min-width: 0;
  margin-bottom: 16px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px
}

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

.panel-heading h2 {
  font-size: 16px;
  letter-spacing: -.02em
}

.panel-heading>a {
  color: var(--action);
  font-size: 13px;
  font-weight: 600
}

.panel-heading>span {
  color: var(--subtle);
  font-size: 12px
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px
}

.stat-card {
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px
}

.stat-card>span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600
}

.stat-card strong {
  margin: 12px 0 4px;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -.03em
}

.stat-card strong.stat-word {
  font-size: 20px
}

.stat-card small {
  color: var(--subtle);
  font-size: 12px
}

.stats-grid.stats-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr))
}

.page-notice {
  margin-bottom: 16px
}

.page-notice-top {
  margin-top: 16px
}

.notice a {
  white-space: nowrap
}

.notice a strong {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px
}

.account-row {
  flex-wrap: wrap
}

.account-row .edit-details[open] {
  flex-basis: 100%
}

.add-admin {
  margin-top: 16px
}

.admin-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  align-items: start
}

.admin-grid>.panel {
  margin-bottom: 0
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14px
}

.list-row:last-child {
  border-bottom: 0;
  padding-bottom: 0
}

.list-row:first-child {
  padding-top: 0
}

.list-row>div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0
}

.list-row span {
  color: var(--subtle);
  font-size: 12px
}

.list-row b {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap
}

.stock-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule)
}

.stock-row:first-child {
  padding-top: 0
}

.stock-row:last-child {
  border-bottom: 0;
  padding-bottom: 0
}

.stock-row strong {
  font-size: 14px;
  font-weight: 600
}

.stock-row b {
  font-size: 13px;
  font-weight: 600;
  text-align: right
}

.stock-row b small {
  color: var(--subtle);
  font-weight: 500
}

.stock-row .usage-track {
  grid-column: 1 / -1
}

.stock-row.low .usage-track span {
  background: #E39A2B
}

.quick-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px
}

.quick-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  transition: border-color .15s, background .15s
}

.quick-links a:hover {
  border-color: var(--action);
  background: var(--action-soft)
}

.quick-links svg {
  width: 18px;
  height: 18px;
  color: var(--action)
}

/* Collapsible editors read as buttons so they are easy to find and tap. */
.edit-details>summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none
}

.edit-details>summary::-webkit-details-marker {
  display: none
}

.edit-details>summary::after {
  content: '';
  width: 7px;
  height: 7px;
  margin-left: 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .15s
}

.edit-details[open]>summary {
  border-color: var(--action);
  color: var(--action)
}

.edit-details[open]>summary::after {
  transform: translateY(1px) rotate(-135deg)
}

.edit-details>summary:hover {
  border-color: var(--action)
}

.edit-body {
  margin-top: 12px;
  padding: 18px;
  border-radius: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 16px
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  color: var(--muted)
}

.danger-zone form {
  margin-left: auto
}

/* ---------- Prizes ---------- */

.tier-panel .panel-heading>div {
  display: flex;
  align-items: center;
  gap: 10px
}

.tier-number {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--action-soft);
  color: var(--action);
  font-size: 12px;
  font-weight: 700
}

.tier-tools {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--rule)
}

.tier-tools .edit-details[open] {
  flex-basis: 100%;
  order: 1
}

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

.prize-list>.prize-card:first-child>.edit-details>summary {
  top: 8px
}

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

.prize-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap
}

.prize-card-head>div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 160px
}

.prize-card-head strong {
  font-size: 14px;
  font-weight: 600
}

.prize-card-head>div>span {
  font-size: 12px;
  color: var(--subtle)
}

.prize-card {
  position: relative
}

.prize-card .edit-details {
  margin-top: 10px
}

/* On wider screens the edit toggle sits on the prize row itself. */
@media (min-width: 431px) {
  .prize-card-head {
    padding-right: 112px
  }

  .prize-card .edit-details {
    margin-top: 0
  }

  .prize-card .edit-details>summary {
    position: absolute;
    top: 18px;
    right: 0
  }

  .prize-card .edit-details[open] .edit-body {
    margin-top: 14px
  }
}

.prize-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--rule)
}

.prize-thumb.placeholder {
  display: grid;
  place-items: center;
  background: var(--surface-alt);
  color: var(--subtle)
}

.prize-thumb.placeholder svg {
  width: 18px;
  height: 18px
}

/* ---------- Entries & verify ---------- */

.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px
}

.search-bar .field {
  flex: 1;
  max-width: 520px
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px
}

.result-meta a {
  color: var(--action);
  font-weight: 600
}

.entry-card {
  margin-bottom: 10px
}

.entry-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px
}

.entry-main h2 {
  margin: 4px 0;
  font-size: 16px;
  letter-spacing: -.02em
}

.entry-who {
  font-size: 14px;
  font-weight: 600
}

.entry-meta {
  color: var(--subtle);
  font-size: 12px
}

.entry-code {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  letter-spacing: .04em
}

.entry-client {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-top: 6px;
  color: var(--subtle);
  font-size: 12px
}

.entry-client a {
  color: var(--action);
  font-weight: 600
}

.entry-client .badge {
  padding: 2px 8px;
  font-size: 11px
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--rule)
}

.entry-actions details {
  flex-basis: 100%
}

.entry-actions details:not([open]) {
  flex-basis: auto
}

.entry-card.cancelled {
  background: var(--surface-alt)
}

.entry-card.cancelled h2 {
  color: var(--muted);
  text-decoration: line-through
}

.entry-cancel-note {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  color: var(--danger);
  font-size: 13px
}

.cancel-zone {
  flex-direction: column;
  align-items: stretch
}

.cancel-zone form {
  margin-left: 0
}

.result-notice {
  width: min(100%, 400px);
  margin-top: 20px
}

.ticket-body .card-icon+.badge {
  margin-top: 0
}

.verify-wrap {
  max-width: 560px
}

.verify-form {
  display: flex;
  gap: 8px
}

.verify-form .field {
  flex: 1
}

.verify-form input {
  min-height: 52px;
  font-size: 17px;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  letter-spacing: .06em;
  text-transform: uppercase
}

.verify-form input::placeholder {
  font-family: Pretendard, sans-serif;
  letter-spacing: 0;
  text-transform: none;
  font-size: 15px
}

.verify-form .primary-button {
  min-height: 52px
}

.verify-panel {
  margin-top: 16px;
  padding: 24px
}

.verify-panel h2 {
  margin: 12px 0 4px;
  font-size: 20px;
  letter-spacing: -.03em
}

.verify-panel .ticket-details {
  margin: 18px 0
}

.verify-panel .primary-button {
  min-height: 50px
}

.verify-panel.used {
  background: var(--surface-alt)
}

/* ---------- QR ---------- */

.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px
}

.qr-card {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 16px
}

.qr-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 14px
}

.qr-card img {
  display: block;
  width: 100%;
  max-width: 150px;
  margin: 12px auto 8px
}

.qr-usage {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--muted)
}

.qr-actions {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-top: auto
}

.qr-actions .edit-details[open] {
  flex-basis: 100%
}

.qr-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px
}

.chip-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap
}

.chip {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 99px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600
}

.chip b {
  margin-left: 2px;
  color: inherit
}

.chip[aria-pressed=true] {
  border-color: var(--action);
  background: var(--action-soft);
  color: var(--action-hover)
}

.select-all {
  display: inline-flex;
  font-size: 13px;
  color: var(--muted)
}

.selection-bar {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid #D4E4FD;
  border-radius: 12px;
  background: var(--action-soft);
  box-shadow: var(--shadow);
  font-size: 14px
}

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

.qr-select {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  cursor: pointer
}

.qr-select input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--action)
}

.qr-card:has([data-qr-select]:checked) {
  border-color: var(--action);
  box-shadow: 0 0 0 2px #2f7cf633
}

.qr-actions .button-sm {
  flex: 1;
  padding: 0 8px
}

/* ---------- Dialogs ---------- */

.modal {
  width: min(560px, calc(100% - 32px));
  max-height: min(86vh, 860px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 60px #17233b33
}

.modal::backdrop {
  background: #17233b66
}

.modal[open] {
  display: flex;
  flex-direction: column
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--rule)
}

.modal-head h2 {
  font-size: 18px;
  letter-spacing: -.02em
}

.modal-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px
}

.modal-close {
  flex: none;
  width: 36px;
  height: 36px;
  margin: -6px -8px 0 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1
}

.modal-close:hover {
  background: var(--surface-alt);
  color: var(--ink)
}

.modal-body {
  overflow-y: auto;
  padding: 20px 22px 24px
}

.modal-body>section+section {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--rule)
}

.modal-body h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 14px
}

.modal-body h3 .count {
  padding: 1px 8px;
  border-radius: 99px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 12px
}

.participant-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13px
}

.participant-row:last-child {
  border-bottom: 0
}

.participant-row>div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0
}

.participant-row span {
  color: var(--subtle);
  font-size: 12px
}

.participant-row>a {
  color: var(--action);
  font-weight: 600;
  white-space: nowrap
}

.participant-row.cancelled strong {
  color: var(--muted);
  text-decoration: line-through
}

.danger-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule)
}

.danger-item:last-child {
  border-bottom: 0;
  padding-bottom: 0
}

.danger-item>div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px
}

.danger-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5
}

.danger-button:disabled,
.secondary-button:disabled,
.primary-button:disabled {
  opacity: .45;
  cursor: not-allowed
}

/* ---------- System ---------- */

.log-row {
  display: grid;
  grid-template-columns: 82px 110px minmax(0, 1fr);
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 12px;
  overflow-wrap: anywhere
}

.log-row:last-child {
  border-bottom: 0
}

.log-row time {
  color: var(--subtle)
}

.log-row span {
  color: var(--muted)
}

.resource-section {
  margin: 8px 0 24px
}

.resource-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 12px
}

.resource-heading h2 {
  margin-bottom: 4px;
  font-size: 17px;
  letter-spacing: -.02em
}

.resource-heading p {
  color: var(--muted);
  font-size: 13px
}

.resource-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 12px
}

.resource-status strong {
  color: var(--success)
}

.resource-status time {
  color: var(--muted)
}

.resource-section[data-status=stale] .resource-status strong {
  color: var(--warning)
}

.resource-section[data-status=unavailable] .resource-status strong {
  color: var(--danger)
}

.resource-section[data-status=stale] .resource-grid,
.resource-section[data-status=stale] .resource-disks {
  opacity: .68
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px
}

.resource-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px
}

.resource-card>span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600
}

.resource-card>strong {
  margin: 12px 0;
  font-size: 28px;
  line-height: 1;
  letter-spacing: -.03em
}

.resource-card small,
.disk-row small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px
}

.resource-disks {
  margin-bottom: 0
}

.disk-row {
  padding: 12px 0;
  border-top: 1px solid var(--rule)
}

.disk-row:first-child {
  border-top: 0;
  padding-top: 0
}

.disk-row-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 9px;
  font-size: 13px
}

.disk-row-heading strong {
  overflow-wrap: anywhere
}

.disk-row-heading span {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap
}

.back-link {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600
}

.audit-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 10px
}

.audit-filter .field {
  flex: 1;
  max-width: 520px
}

.audit-filter select {
  width: auto;
  min-width: 160px
}

.audit-list {
  padding-top: 8px;
  padding-bottom: 8px
}

.audit-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13px
}

.audit-row:last-child {
  border-bottom: 0
}

.audit-row time {
  color: var(--subtle);
  font-variant-numeric: tabular-nums
}

.audit-row strong {
  margin-right: 6px
}

.audit-actor {
  padding: 1px 8px;
  border-radius: 99px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 12px
}

.audit-row p {
  margin-top: 4px;
  color: var(--muted);
  overflow-wrap: anywhere;
  line-height: 1.55
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .admin-layout {
    grid-template-columns: 76px minmax(0, 1fr)
  }

  .sidebar {
    padding: 18px 10px;
    align-items: center
  }

  .sidebar-brand>span:last-child,
  .sidebar nav a span,
  .sidebar-bottom .user-chip span:last-child,
  .sidebar-bottom form {
    display: none
  }

  .sidebar-brand {
    padding: 0
  }

  .sidebar nav a {
    justify-content: center;
    width: 48px;
    padding: 0
  }

  .sidebar-bottom {
    padding: 14px 0 0;
    justify-content: center;
    width: 100%
  }

  .admin-content {
    padding: 28px 24px 72px
  }

  .stats-grid,
  .stats-grid.stats-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }

  .admin-grid {
    grid-template-columns: 1fr
  }
}

@media (max-width: 720px) {
  .admin-layout {
    display: block
  }

  .sidebar {
    display: none
  }

  .admin-top {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 56px;
    padding: 0 16px
  }

  .desktop-breadcrumb,
  .admin-top .user-chip {
    display: none
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    font-size: 15px;
    font-weight: 700
  }

  .mobile-brand .brand-mark {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    font-size: 12px
  }

  .menu-toggle {
    display: flex
  }

  .mobile-menu-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: #17233b66
  }

  .mobile-menu {
    display: flex;
    flex-direction: column;
    position: fixed;
    z-index: 41;
    inset: 0 0 0 auto;
    width: min(300px, 86vw);
    max-height: 100dvh;
    overflow-y: auto;
    padding: 18px 14px max(18px, env(safe-area-inset-bottom));
    background: var(--surface);
    box-shadow: -16px 0 35px #17233b16
  }

  .mobile-menu-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 4px 16px;
    border-bottom: 1px solid var(--rule);
    font-size: 15px;
    font-weight: 700
  }

  .menu-close {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    font-size: 26px;
    line-height: 1
  }

  .mobile-menu nav {
    padding: 14px 0
  }

  .mobile-menu nav a {
    min-height: 48px;
    font-size: 15px
  }

  .admin-content {
    padding: 22px 16px 64px
  }

  .page-heading {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 18px
  }

  .page-heading h1 {
    font-size: 22px
  }

  .heading-actions>* {
    flex: 1
  }

  .stats-grid {
    gap: 8px
  }

  .stat-card {
    padding: 14px 16px
  }

  .stat-card strong {
    font-size: 24px
  }

  .panel {
    padding: 18px 16px
  }

  .field-grid {
    grid-template-columns: 1fr
  }

  .field-grid .span-2 {
    grid-column: auto
  }

  .qr-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px
  }

  .qr-card {
    padding: 12px
  }

  .log-row {
    grid-template-columns: auto 1fr
  }

  .log-row span {
    grid-column: span 2
  }

  .resource-heading {
    flex-direction: column;
    align-items: flex-start
  }

  .resource-status {
    align-items: flex-start
  }
}

@media (max-width: 430px) {
  .auth-card,
  .ticket-body {
    padding: 26px 20px
  }

  .auth-shell {
    padding-top: 28px
  }

  .quick-links {
    grid-template-columns: 1fr
  }

  .inline-form {
    flex-direction: column;
    align-items: stretch
  }

  .inline-form label {
    width: 100%
  }

  .entry-main {
    flex-direction: column
  }

  .verify-form,
  .search-bar,
  .audit-filter {
    flex-direction: column
  }

  .audit-filter select {
    width: 100%
  }

  .audit-row {
    grid-template-columns: 1fr;
    gap: 4px
  }

  .search-bar .field {
    max-width: none
  }

  .resource-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px
  }

  .resource-card {
    padding: 14px
  }

  .resource-card>strong {
    font-size: 24px
  }

  .qr-card-head {
    flex-direction: column;
    align-items: flex-start
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    transition-duration: .01ms !important
  }
}
