:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172026;
  --muted: #65717d;
  --line: #dfe5eb;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --secondary: #334155;
  --danger: #b42318;
  --warning: #b45309;
  --success: #067647;
  --info: #1d4ed8;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.site-header {
  background: #10201f;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.site-header__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  min-height: 40px;
  border-radius: 8px;
  background: #e8fffb;
  color: #0f3f3b;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0;
}

.header-title span,
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.site-header .header-title span {
  color: #9fb3b1;
}

.header-title h1 {
  margin: 0.1rem 0 0;
  font-size: 1.2rem;
  line-height: 1.2;
}

main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 1rem;
}

.user-layout main {
  width: min(680px, 100%);
  padding-top: 1.25rem;
}

.panel,
.ticket-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.check-panel,
.issue-panel,
.login-panel {
  margin-top: 0.75rem;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head h2,
.panel h2,
.ticket-card h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.35;
}

.lead {
  color: var(--muted);
  margin: 0 0 1rem;
}

.form-card {
  display: grid;
  gap: 0.75rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem 1rem;
}

.form-inline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  align-items: end;
}

.form-inline input,
.form-inline select {
  min-width: 0;
  margin-top: 0;
}

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

label {
  display: block;
  color: #26323d;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 0.75rem 0.85rem;
  margin-top: 0.35rem;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 1rem;
}

input[type="date"],
input[type="time"],
.form-inline select {
  min-height: 42px;
  padding: 0.62rem 0.75rem;
  border-radius: 7px;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.form-inline select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.2rem;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  opacity: 0.58;
  cursor: pointer;
}

input:focus,
select:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--primary);
}

.button,
.button.secondary,
.button.small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.7rem 1rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
}

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

.button.secondary {
  background: #fff;
  color: var(--secondary);
  border-color: #cbd5e1;
}

.button.secondary:hover {
  background: #f1f5f9;
}

.button.danger {
  background: #fff;
  color: var(--danger);
  border-color: #f3b3ad;
}

.button.danger:hover {
  background: #fff1f1;
}

.button.subtle {
  background: #f8fafc;
  color: #475569;
  border-color: #cbd5e1;
}

.button.subtle:hover {
  background: #eef2f7;
}

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

.button.small {
  min-height: 34px;
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
}

button {
  border: none;
}

.toolbar,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.actions {
  margin-top: 1rem;
}

.alert {
  background: #fff1f1;
  color: #9f1b1b;
  border: 1px solid #ffc9c9;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-weight: 700;
}

.notice {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-weight: 800;
}

.field-help {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

dl {
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

dd {
  margin: 0.1rem 0 0;
  font-size: 1rem;
}

.meta-grid,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.meta-grid > div,
.stats-grid > div {
  background: var(--surface-soft);
  border: 1px solid #e6edf3;
  border-radius: 8px;
  padding: 0.85rem;
}

.stats-grid dd {
  font-size: 1.45rem;
  font-weight: 800;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  border: 1px solid transparent;
}

.badge-success {
  background: #e8f7ef;
  color: var(--success);
  border-color: #b7e4c7;
}

.badge-warning {
  background: #fff7ed;
  color: var(--warning);
  border-color: #fed7aa;
}

.badge-danger {
  background: #fff1f1;
  color: var(--danger);
  border-color: #ffc9c9;
}

.badge-info {
  background: #eff6ff;
  color: var(--info);
  border-color: #bfdbfe;
}

.badge-neutral,
.badge-muted {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

.ticket-card {
  border-left: 6px solid var(--primary);
}

.ticket-number,
.passcode {
  display: block;
  width: 100%;
  margin: 0.35rem 0 1rem;
  padding: 0.85rem;
  border-radius: 8px;
  background: #0f172a;
  color: #fff;
  font-size: clamp(1.7rem, 7vw, 2.6rem);
  font-weight: 900;
  text-align: center;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.status {
  margin: 0.5rem 0 1rem;
}

.notes {
  margin: 1rem 0;
  padding: 0.85rem 1rem 0.85rem 2rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  line-height: 1.7;
}

.disabled,
.muted {
  color: var(--muted);
}

.issue-share {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1rem;
  align-items: start;
}

.qr-box {
  width: 240px;
  padding: 0.6rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qr-box img {
  display: block;
  width: 220px;
  height: 220px;
}

.url-box input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #475569;
  background: #f8fafc;
  font-size: 0.82rem;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

.empty-state {
  display: grid;
  place-items: start;
  gap: 0.75rem;
  padding: 2rem;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
}

.admin-hero,
.ops-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.admin-hero h2,
.ops-summary h2 {
  margin: 0.1rem 0;
  font-size: 1.6rem;
}

.event-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

.event-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.event-card__head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.event-card h3 {
  margin: 0.45rem 0 0;
  font-size: 1.1rem;
}

.event-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

.event-metrics div {
  background: var(--surface-soft);
  border: 1px solid #e6edf3;
  border-radius: 8px;
  padding: 0.65rem;
}

.event-metrics dd {
  font-size: 1.35rem;
  font-weight: 800;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.card-actions form {
  margin: 0;
}

.ops-summary {
  grid-template-columns: minmax(0, 1fr) 380px;
}

.ops-summary__side {
  background: var(--surface-soft);
  border: 1px solid #e6edf3;
  border-radius: 8px;
  padding: 1rem;
}

.summary-strip {
  display: grid;
  grid-template-columns: 2fr repeat(4, minmax(90px, 1fr));
  gap: 0.65rem;
}

.summary-strip div {
  background: var(--surface-soft);
  border: 1px solid #e6edf3;
  border-radius: 8px;
  padding: 0.75rem;
}

.summary-strip dd {
  font-weight: 800;
}

.back-link {
  color: var(--primary);
  display: inline-block;
  font-weight: 700;
  margin-bottom: 0.75rem;
  text-decoration: none;
}

.copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: end;
}

.compact-toolbar {
  margin-top: 0.75rem;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0 0 1rem;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.9rem;
  color: #475569;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  font-weight: 800;
  white-space: nowrap;
}

.tabs a.active {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.filter-bar a {
  color: #475569;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.9rem;
}

.filter-bar a.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.operation-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.operation-list form {
  margin: 0;
}

.maintenance-box {
  margin-top: 1.2rem;
  background: #f8fafc;
}

.maintenance-box summary {
  color: #475569;
}

.maintenance-box form {
  margin-top: 0.85rem;
}

.maintenance-meta {
  grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr);
}

.maintenance-meta dd {
  font-size: 0.95rem;
  font-weight: 600;
}

.qr-operation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 1.5rem;
  align-items: start;
}

.qr-print-card {
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 1.25rem;
}

.qr-print-card img {
  display: block;
  width: 320px;
  height: 320px;
  margin: 0 auto 0.75rem;
}

.qr-print-card p {
  margin: 0;
  font-weight: 900;
  font-size: 1.1rem;
}

details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.8rem;
  background: #fff;
}

/* ticket state cards */
.ticket-card.status-pending {
  background: #f1f5f9;
  border-left: 6px solid #60a5fa;
}
.ticket-card.status-success {
  background: #ecfdf5;
  border-left: 6px solid var(--success);
}
.ticket-card.status-warning {
  background: #fff7ed;
  border-left: 6px solid var(--warning);
}
.ticket-card.status-expired {
  background: #fff1f2;
  border-left: 6px solid var(--danger);
  color: #7f1d1d;
}
.ticket-card.status-purchased {
  background: #f0fdf4;
  border-left: 6px solid var(--success);
}
.ticket-card.status-muted {
  background: #f8fafc;
  border-left: 6px solid #cbd5e1;
}

.result-credentials {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.result-credentials div {
  padding: 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}

.result-credentials dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.result-credentials dd {
  margin: 0.2rem 0 0;
  color: #172026;
  font-size: 1.18rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.result-event-name {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 0.35rem;
  padding: 0.28rem 0.6rem;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #334155;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.winner-card__header .result-event-name {
  margin-bottom: 0.1rem;
  color: #7c2d12;
}

.winner-card {
  display: grid;
  gap: 1rem;
}

.winner-card--celebration {
  position: relative;
  overflow: hidden;
  border: 2px solid #f59e0b;
  border-left: 8px solid #f59e0b;
  background:
    linear-gradient(135deg, #fff7ad 0%, #ffd6e7 45%, #c7f9e9 100%);
  box-shadow: 0 18px 44px rgba(217, 119, 6, 0.22);
}

.winner-card--celebration::before {
  content: "WIN";
  position: absolute;
  top: 0.75rem;
  right: -0.35rem;
  padding: 0.25rem 0.85rem;
  transform: rotate(10deg);
  border-radius: 999px;
  background: #ffffff;
  color: #be123c;
  font-size: 0.85rem;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14);
}

.winner-card__header {
  display: grid;
  gap: 0.45rem;
  position: relative;
  z-index: 1;
}

.winner-card__header h2 {
  font-size: 2.65rem;
  line-height: 1.05;
  color: #9f1239;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.85);
}

.winner-card.status-expired .winner-card__header h2 {
  color: #991b1b;
}

.winner-card__header p,
.button-note {
  margin: 0;
  color: #26323d;
  font-weight: 700;
}

.winner-card__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 32px;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: #be123c;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
}

.winner-card__badge.expired {
  background: #991b1b;
}

.winner-ticket-number {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.35rem;
  padding: 1.1rem;
  border: 3px solid #f59e0b;
  border-radius: 8px;
  background: #ffffff;
  text-align: center;
  box-shadow: inset 0 0 0 3px #fff7ed, 0 10px 22px rgba(15, 23, 42, 0.12);
}

.winner-ticket-number span {
  color: #be123c;
  font-size: 0.9rem;
  font-weight: 900;
}

.winner-ticket-number strong {
  color: #0f172a;
  font-size: 2.55rem;
  line-height: 1;
  overflow-wrap: anywhere;
}

.winner-card__times {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.6rem;
  margin: 0;
}

.winner-card__times div {
  display: grid;
  gap: 0.15rem;
  padding: 0.8rem;
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.winner-card__times dt {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.winner-card__times dd {
  margin: 0;
  color: #172026;
  font-size: 1.05rem;
  font-weight: 800;
}

.staff-instruction {
  position: relative;
  z-index: 1;
  padding: 1rem;
  border-radius: 8px;
  background: #be123c;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 10px 22px rgba(190, 18, 60, 0.22);
}

.button-note {
  position: relative;
  z-index: 1;
  padding: 0.85rem;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
}

.button-note.strong {
  border-color: #fecaca;
  background: #fff1f2;
  color: #991b1b;
}

.button-caution {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0.75rem 0 0;
  padding: 0.8rem;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  background: #fff7f7;
  color: #9f1239;
  font-size: 0.95rem;
  font-weight: 700;
}

.button-caution span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 900;
  line-height: 1;
}


.privacy-note {
  margin: 2rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

summary {
  cursor: pointer;
  font-weight: 900;
  color: #26323d;
}

details .form-grid {
  margin-top: 0.9rem;
}

.quick-set {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.45rem;
  padding: 0.55rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.quick-set span {
  color: #475569;
  font-size: 0.86rem;
  font-weight: 900;
  margin-right: 0.25rem;
}

.quick-set button {
  min-height: 30px;
  padding: 0.3rem 0.58rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.8rem;
  line-height: 1.2;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.04);
}

.quick-set button:hover {
  border-color: var(--primary);
  background: #ecfdf5;
  color: var(--primary-dark);
}

.quick-set button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media print {
  .site-header,
  .ops-summary,
  .tabs,
  .panel:not(.qr-operation) {
    display: none !important;
  }

  body {
    background: #fff;
  }

  main {
    max-width: none;
  }

  .qr-operation {
    display: block;
    box-shadow: none;
    border: none;
  }

  .qr-operation > div:first-child {
    display: none;
  }
}

@media (max-width: 760px) {
  .site-header__inner,
  main {
    padding: 0.85rem;
  }

  .site-header__inner,
  .section-head,
  .toolbar,
  .actions,
  .admin-hero,
  .ops-summary,
  .qr-operation {
    align-items: stretch;
  }

  .section-head,
  .toolbar,
  .actions,
  .issue-share,
  .admin-hero,
  .ops-summary,
  .qr-operation,
  .copy-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .panel,
  .ticket-card {
    padding: 1rem;
  }

  .form-grid,
  .form-inline,
  .meta-grid,
  .result-credentials,
  .stats-grid,
  .summary-strip,
  .event-metrics {
    grid-template-columns: 1fr;
  }

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

  .button,
  .button.secondary,
  .button.small {
    width: 100%;
  }

  .winner-card__header h2 {
    font-size: 2rem;
  }

  .winner-ticket-number strong {
    font-size: 2rem;
  }

  .qr-box {
    width: 100%;
    max-width: 240px;
  }

  .table-wrap {
    border: none;
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    margin-bottom: 0.8rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
  }

  td {
    border-bottom: 1px solid #edf2f7;
  }

  td:last-child {
    border-bottom: none;
  }
}
