@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700;800&family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #060403;
  --panel: #100c08;
  --panel-soft: #171008;
  --ink: #fff8e1;
  --muted: #c9b77f;
  --line: #3a2a0b;
  --accent: #f1b50b;
  --accent-strong: #b07d00;
  --accent-warm: #ffd54f;
  --gold: #ffd54f;
  --danger: #ff777c;
  --warn: #f2bd61;
  --ok: #f1b50b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.62);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -12%, rgba(241, 181, 11, 0.24), transparent 34%),
    radial-gradient(circle at 88% 12%, rgba(255, 213, 79, 0.12), transparent 24%),
    linear-gradient(180deg, #100a05 0%, #060403 62%),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.public-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(18px, 5vw, 42px) 18px;
  display: grid;
  align-items: center;
}

.form-panel,
.admin-section {
  background:
    linear-gradient(180deg, rgba(255, 213, 79, 0.04), transparent 42%),
    var(--panel);
  border: 1px solid rgba(241, 181, 11, 0.28);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-panel {
  position: relative;
  overflow: hidden;
  padding: 44px;
  background:
    radial-gradient(circle at 15% 18%, rgba(255, 213, 79, 0.18), transparent 22%),
    radial-gradient(circle at 85% 12%, rgba(241, 181, 11, 0.16), transparent 24%),
    linear-gradient(180deg, rgba(255, 213, 79, 0.06), transparent 50%),
    var(--panel);
}

.form-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 8px;
  background:
    linear-gradient(90deg, #b07d00, #f1b50b, #fff8e1, #f1b50b, #b07d00);
  box-shadow: 0 0 28px rgba(241, 181, 11, 0.44);
}

.form-panel > * {
  position: relative;
  z-index: 1;
}

.brand-row,
.admin-header,
.section-head,
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.public-body .brand-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  justify-content: start;
  margin-bottom: 28px;
}

.public-body .brand-row > div {
  min-width: 0;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.app-logo {
  display: block;
  flex: 0 0 auto;
  border-radius: 8px;
  object-fit: cover;
  background: #070504;
  box-shadow: 0 0 32px rgba(241, 181, 11, 0.22);
}

.public-logo {
  width: clamp(72px, 18vw, 112px);
  height: clamp(72px, 18vw, 112px);
}

.admin-logo,
.auth-logo {
  width: 64px;
  height: 64px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 620px;
  font-size: 3rem;
  font-family: Cinzel, Georgia, serif;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 0 24px rgba(241, 181, 11, 0.28);
}

h2 {
  font-size: 1rem;
  color: #ffe9a3;
  font-weight: 800;
}

.admin-link {
  color: var(--gold);
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(241, 181, 11, 0.34);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(241, 181, 11, 0.08);
}

.raffle-strip {
  margin: 26px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.raffle-strip span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  background: rgba(241, 181, 11, 0.08);
  color: #ffe9a3;
  font-size: 0.9rem;
  font-weight: 700;
}

.raffle-strip span:first-child {
  border-color: rgba(241, 181, 11, 0.46);
  background: rgba(241, 181, 11, 0.16);
  color: var(--accent);
}

.tab-row {
  display: inline-flex;
  gap: 6px;
  margin: 0 0 14px;
  padding: 5px;
  border: 1px solid rgba(241, 181, 11, 0.24);
  border-radius: 8px;
  background: #070504;
}

.tab-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.tab-button span {
  display: inline-grid;
  min-width: 24px;
  height: 24px;
  margin-left: 8px;
  place-items: center;
  border-radius: 999px;
  background: rgba(241, 181, 11, 0.1);
  color: #ffe9a3;
  font-size: 0.82rem;
}

.tab-button.active {
  border-color: rgba(241, 181, 11, 0.46);
  background: linear-gradient(180deg, rgba(241, 181, 11, 0.22), rgba(255, 213, 79, 0.08));
  color: var(--gold);
  box-shadow: 0 0 24px rgba(241, 181, 11, 0.16);
}

.stack-form,
.settings-grid {
  display: grid;
  gap: 16px;
}

.stack-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stack-form label:nth-child(1),
.stack-form label:nth-child(4),
.stack-form .file-drop,
.stack-form .primary-button,
.stack-form + .result-box {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 8px;
  color: #ffecb3;
  font-size: 0.92rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(241, 181, 11, 0.28);
  border-radius: 8px;
  padding: 13px 14px;
  background: #070504;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(241, 181, 11, 0.18), 0 0 24px rgba(241, 181, 11, 0.18);
}

input::placeholder {
  color: #8d805f;
}

.file-drop {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  border: 1px dashed rgba(241, 181, 11, 0.52);
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(90deg, rgba(241, 181, 11, 0.12), rgba(255, 213, 79, 0.06)),
    #0b0704;
  cursor: pointer;
}

.file-drop input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.file-drop-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.file-drop strong {
  color: var(--gold);
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.file-drop small {
  color: var(--muted);
  font-weight: 700;
}

.file-preview {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(241, 181, 11, 0.32);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 213, 79, 0.14), transparent 64%),
    #070504;
  color: var(--muted);
  font-size: 1.4rem;
  font-weight: 900;
}

.file-preview.has-file {
  border-color: rgba(241, 181, 11, 0.58);
  color: var(--gold);
  font-size: 0.82rem;
}

.file-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0;
}

.primary-button {
  background: linear-gradient(180deg, #ffe9a3 0%, #ffd54f 42%, #f1b50b 100%);
  color: #160f05;
  border: 1px solid rgba(255, 248, 225, 0.45);
  box-shadow: 0 0 30px rgba(241, 181, 11, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.44);
}

.raffle-submit {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 1.02rem;
}

.button-ticket {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(7, 16, 17, 0.18);
  font-weight: 900;
}

.primary-button:hover {
  background: linear-gradient(180deg, #fff8e1 0%, #ffd54f 48%, #b07d00 100%);
  box-shadow: 0 0 46px rgba(241, 181, 11, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.secondary-button {
  background: rgba(241, 181, 11, 0.1);
  color: #ffd54f;
  border: 1px solid rgba(241, 181, 11, 0.32);
}

.danger-button {
  background: rgba(255, 119, 124, 0.14);
  color: var(--danger);
}

.icon-button {
  width: 42px;
  padding: 0;
  background: rgba(241, 181, 11, 0.1);
  border: 1px solid rgba(241, 181, 11, 0.26);
  color: var(--ink);
  font-size: 1.35rem;
}

.result-box {
  margin-top: 18px;
  border-radius: 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.result-box.approved {
  border-color: rgba(241, 181, 11, 0.44);
  background: rgba(241, 181, 11, 0.12);
  color: #ffe9a3;
}

.result-box.error {
  border-color: rgba(255, 119, 124, 0.34);
  background: rgba(255, 119, 124, 0.11);
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(13, 17, 17, 0.88);
  backdrop-filter: blur(4px);
  z-index: 10;
}

.loading-card {
  width: min(360px, calc(100% - 28px));
  display: grid;
  gap: 16px;
  justify-items: center;
  border: 1px solid rgba(241, 181, 11, 0.32);
  border-radius: 8px;
  padding: 28px 24px;
  background: #0b0704;
  box-shadow: var(--shadow);
}

.loading-spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid rgba(241, 181, 11, 0.18);
  border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
}

.loading-card strong {
  color: #fff8e1;
  font-size: 1rem;
  font-weight: 800;
  text-align: center;
}

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

.admin-body {
  background:
    radial-gradient(circle at 50% -12%, rgba(241, 181, 11, 0.22), transparent 34%),
    radial-gradient(circle at 80% 0%, rgba(255, 213, 79, 0.12), transparent 260px),
    linear-gradient(180deg, #100a05 0%, #060403 64%);
}

.admin-header {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.admin-header h1 {
  font-size: 2rem;
}

.admin-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.admin-layout {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.admin-locked .admin-header {
  display: none;
}

.admin-locked .admin-layout {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px;
  place-items: center;
}

.admin-locked .admin-section:not(#authPanel) {
  display: none;
}

.admin-locked #authPanel {
  display: block !important;
}

.auth-panel {
  width: 100%;
  padding: 0;
  border-color: rgba(241, 181, 11, 0.32);
  background:
    linear-gradient(145deg, rgba(241, 181, 11, 0.14), transparent 38%),
    linear-gradient(315deg, rgba(255, 213, 79, 0.08), transparent 34%),
    var(--panel);
}

.auth-card {
  padding: 34px;
  display: grid;
  gap: 26px;
}

.auth-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(241, 181, 11, 0.48);
  border-radius: 8px;
  background: rgba(241, 181, 11, 0.14);
  color: var(--accent);
  font-size: 1.6rem;
  font-weight: 900;
}

.auth-form {
  display: grid;
  gap: 16px;
}

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

.auth-message {
  margin: 0;
  border: 1px solid rgba(241, 181, 11, 0.28);
  border-radius: 8px;
  padding: 11px 12px;
  background: rgba(241, 181, 11, 0.08);
  color: #ffe9a3;
  font-size: 0.9rem;
  font-weight: 800;
}

.auth-message.error {
  border-color: rgba(255, 119, 124, 0.38);
  background: rgba(255, 119, 124, 0.11);
  color: var(--danger);
}

.auth-message.ok {
  border-color: rgba(241, 181, 11, 0.44);
  color: var(--gold);
}

.auth-back-link {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.admin-section {
  padding: 20px;
  box-shadow: none;
}

.command-section {
  background:
    linear-gradient(135deg, rgba(241, 181, 11, 0.12), rgba(255, 213, 79, 0.06)),
    var(--panel);
}

.command-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.command-button {
  min-height: 56px;
  justify-content: center;
}

.section-head-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(241, 181, 11, 0.32);
  border-radius: 999px;
  padding: 3px 10px;
  background: rgba(241, 181, 11, 0.10);
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-pill-on {
  border-color: rgba(120, 220, 140, 0.4);
  background: rgba(120, 220, 140, 0.12);
  color: #b9f0c2;
}

.status-pill-muted {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.history-section {
  padding: 0;
}

.history-details > .history-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  user-select: none;
}

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

.history-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--gold);
  font-size: 1.2rem;
  line-height: 1;
  transition: transform 180ms ease;
}

.history-details[open] > .history-summary .history-chevron {
  transform: rotate(90deg);
}

.history-details[open] > .history-summary {
  border-bottom: 1px solid var(--line);
}

.history-details > .history-list {
  padding: 16px 20px 20px;
}

.command-button:disabled,
.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.65);
  opacity: 0.55;
  box-shadow: none;
}

.raffle-state-card {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(2, minmax(110px, auto));
  gap: 12px;
  align-items: stretch;
}

.raffle-state-card > div,
.empty-state,
.history-card,
.history-summary-grid > div,
.winner-history-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.raffle-state-card > div {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.raffle-state-card strong,
.history-card strong,
.history-summary-grid strong,
.winner-history-card strong {
  color: #ffe9a3;
}

.raffle-state-card span,
.history-card span,
.history-summary-grid span,
.winner-history-card span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.raffle-stat {
  min-width: 120px;
  text-align: center;
}

.raffle-stat strong {
  font-size: 1.5rem;
}

.empty-state {
  padding: 16px;
  color: var(--muted);
  font-weight: 700;
}

.empty-state strong {
  display: block;
  margin-bottom: 4px;
  color: #ffe9a3;
}

.history-list {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.history-card {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
}

.history-card p {
  margin: 4px 0 0;
  color: #ffe9a3;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.history-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-card-stats span,
.winner-pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid rgba(241, 181, 11, 0.3);
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(241, 181, 11, 0.08);
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 900;
}

.settings-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
}

.dialog-form {
  padding: 18px;
}

.settings-grid .primary-button {
  align-self: end;
}

.check-row {
  display: flex;
  align-items: center;
  min-height: 44px;
  gap: 10px;
  margin-top: 22px;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.inline-form {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.status-error {
  color: var(--danger);
  font-weight: 800;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--panel-soft);
  color: #c9b77f;
  font-size: 0.82rem;
  text-transform: uppercase;
}

td {
  font-size: 0.92rem;
}

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

.sensitive-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.sensitive-value {
  min-width: 94px;
  overflow-wrap: anywhere;
  transition: color 0.18s ease, filter 0.18s ease;
}

.sensitive-wrap[data-revealed="false"] .sensitive-value {
  color: var(--muted);
}

.sensitive-wrap[data-revealed="true"] .sensitive-value {
  color: #ffe9a3;
}

.sensitive-button {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(241, 181, 11, 0.26);
  border-radius: 8px;
  background: rgba(241, 181, 11, 0.08);
  color: var(--gold);
  cursor: pointer;
}

.sensitive-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.sensitive-button:hover {
  background: rgba(241, 181, 11, 0.18);
  box-shadow: 0 0 20px rgba(241, 181, 11, 0.16);
}

.sensitive-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.reveal-pulse {
  animation: revealPulse 0.28s ease;
}

@keyframes revealPulse {
  from {
    opacity: 0;
    transform: translateY(4px);
    filter: blur(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

.draw-stage {
  height: 128px;
  margin-top: 14px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 213, 79, 0.2), transparent 54%),
    linear-gradient(135deg, rgba(241, 181, 11, 0.14), rgba(255, 213, 79, 0.08)),
    var(--panel-soft);
  font-size: 2.35rem;
  font-weight: 900;
  text-align: center;
  overflow-wrap: anywhere;
}

.draw-date {
  margin-top: 10px;
  border: 1px solid rgba(241, 181, 11, 0.24);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(241, 181, 11, 0.07);
  color: #ffe9a3;
  font-size: 0.92rem;
  font-weight: 800;
  text-align: center;
}

.draw-machine {
  margin-top: 18px;
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border: 1px solid rgba(255, 209, 102, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent),
    rgba(255, 209, 102, 0.05);
}

.draw-machine span {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #fff8d4 0 9px, transparent 10px),
    linear-gradient(145deg, var(--gold), #f08f45);
  color: #111717;
  font-size: 1.15rem;
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.35);
}

.winners-box {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.winner-item {
  border: 1px solid rgba(241, 181, 11, 0.46);
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(90deg, rgba(241, 181, 11, 0.16), rgba(255, 213, 79, 0.08));
  font-weight: 800;
}

.detail-dialog {
  width: min(920px, calc(100% - 28px));
  max-height: min(88vh, 920px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: var(--panel);
  color: var(--ink);
  overflow: hidden;
}

.settings-dialog {
  width: min(1040px, calc(100% - 28px));
}

.draw-dialog {
  width: min(860px, calc(100% - 28px));
}

.history-dialog {
  width: min(1100px, calc(100% - 28px));
}

.password-dialog {
  width: min(520px, calc(100% - 28px));
}

.password-form {
  display: grid;
  gap: 16px;
}

.detail-dialog::backdrop {
  background:
    radial-gradient(circle at 50% 18%, rgba(241, 181, 11, 0.14), transparent 34%),
    rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(14px) saturate(0.75);
  -webkit-backdrop-filter: blur(14px) saturate(0.75);
}

.dialog-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
}

.detail-content {
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  max-height: calc(88vh - 75px);
  overflow: auto;
}

.draw-dialog-body {
  padding: 18px;
  max-height: calc(88vh - 75px);
  overflow: auto;
}

.history-dialog-content {
  padding: 18px;
  display: grid;
  gap: 18px;
  max-height: calc(88vh - 75px);
  overflow: auto;
}

.history-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.history-summary-grid > div {
  display: grid;
  gap: 6px;
  padding: 12px;
}

.history-block {
  display: grid;
  gap: 12px;
}

.history-block h3 {
  margin: 0;
  color: #ffe9a3;
  font-size: 0.98rem;
}

.winner-history-list {
  display: grid;
  gap: 10px;
}

.winner-history-card {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.winner-history-card > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dialog-form {
  max-height: calc(88vh - 75px);
  overflow: auto;
}

.draw-action {
  width: 100%;
  min-height: 52px;
  margin-top: 14px;
}

.detail-content img {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.receipt-preview {
  position: relative;
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
}

.receipt-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
}

.receipt-preview img,
.receipt-preview .receipt-pdf {
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.receipt-preview:hover img,
.receipt-preview:hover .receipt-pdf,
.receipt-preview:focus-visible img,
.receipt-preview:focus-visible .receipt-pdf {
  border-color: rgba(241, 181, 11, 0.62);
  box-shadow: 0 0 28px rgba(241, 181, 11, 0.18);
  transform: translateY(-1px);
}

.receipt-preview:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  border-radius: 8px;
}

.receipt-preview-hint {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  border: 1px solid rgba(241, 181, 11, 0.42);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(7, 5, 4, 0.86);
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.receipt-pdf {
  display: block;
  width: 100%;
  height: min(70vh, 620px);
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.receipt-fullscreen-dialog {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  border: 0;
  margin: 0;
  padding: 0;
  background: rgba(0, 0, 0, 0.94);
  color: var(--ink);
}

.receipt-fullscreen-dialog::backdrop {
  background: rgba(0, 0, 0, 0.86);
  backdrop-filter: blur(16px) saturate(0.7);
  -webkit-backdrop-filter: blur(16px) saturate(0.7);
}

.receipt-fullscreen-close {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 4;
  background: rgba(7, 5, 4, 0.84);
}

.receipt-fullscreen-content {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 28px;
}

.receipt-fullscreen-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border: 1px solid rgba(241, 181, 11, 0.34);
  border-radius: 8px;
  background: #080604;
}

.receipt-fullscreen-pdf {
  width: min(1100px, 100%);
  height: 100%;
  border: 1px solid rgba(241, 181, 11, 0.34);
  border-radius: 8px;
  background: #080604;
}

.detail-list {
  display: grid;
  gap: 8px;
}

.detail-list div,
pre {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--panel-soft);
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 360px;
  overflow: auto;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: 420px;
  border-radius: 8px;
  padding: 13px 16px;
  background: #edf7f4;
  color: #0d1111;
  box-shadow: var(--shadow);
}

@media (max-width: 920px) {
  h1 {
    font-size: 2.35rem;
  }

  .settings-grid,
  .stack-form,
  .detail-content {
    grid-template-columns: 1fr;
  }

  .raffle-state-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .raffle-state-card > div:first-child {
    grid-column: 1 / -1;
  }

  .history-card,
  .history-summary-grid {
    grid-template-columns: 1fr;
  }

  .public-shell {
    align-items: start;
    padding-top: 20px;
  }

  table {
    min-width: 680px;
  }
}

@media (max-width: 560px) {
  .brand-row,
  .admin-header,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-head-title {
    width: 100%;
    justify-content: space-between;
  }

  .command-grid {
    grid-template-columns: 1fr;
  }

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

  .raffle-state-card > div:first-child {
    grid-column: 1 / -1;
    padding: 12px;
  }

  .raffle-stat {
    min-width: 0;
    text-align: center;
    padding: 10px 8px;
  }

  .raffle-stat strong {
    font-size: 1.2rem;
  }

  .raffle-stat span {
    font-size: 0.78rem;
  }

  .inline-form {
    flex-direction: column;
  }

  .tab-row {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .tab-button {
    width: 100%;
  }

  .form-panel,
  .admin-section {
    padding: 16px;
  }

  .history-section {
    padding: 0;
  }

  .history-details > .history-summary {
    padding: 14px 16px;
  }

  .history-details > .history-list {
    padding: 12px 16px 16px;
  }

  .form-panel {
    padding-top: 26px;
  }

  .public-body .brand-row {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px;
    justify-items: start;
    text-align: left;
    margin-bottom: 22px;
  }

  .public-body .eyebrow {
    margin-bottom: 4px;
    font-size: 0.72rem;
  }

  .public-body h1 {
    max-width: none;
    font-size: clamp(1.18rem, 6vw, 1.45rem);
    line-height: 1.05;
    overflow-wrap: anywhere;
  }

  .admin-header .brand-lockup {
    display: flex;
    justify-items: start;
    text-align: left;
  }

  .admin-header .eyebrow {
    font-size: 0.72rem;
  }

  .admin-header {
    width: min(100% - 24px, 1180px);
    align-items: stretch;
    gap: 12px;
    padding: 14px 0;
  }

  .admin-header-actions,
  .admin-header .secondary-button,
  .command-button,
  .draw-action,
  .raffle-submit {
    width: 100%;
  }

  .admin-header-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .admin-header h1 {
    font-size: 1.2rem;
    line-height: 1.08;
  }

  .admin-logo {
    width: 44px;
    height: 44px;
  }

  .admin-layout {
    width: min(100% - 24px, 1180px);
    gap: 12px;
  }

  .section-head h2 {
    font-size: 0.95rem;
  }

  .detail-dialog {
    width: calc(100% - 16px);
    max-height: 92vh;
  }

  .dialog-head {
    padding: 12px;
    flex-direction: row;
    align-items: center;
  }

  .dialog-form,
  .detail-content,
  .draw-dialog-body,
  .history-dialog-content {
    padding: 12px;
    max-height: calc(92vh - 66px);
  }

  .public-logo {
    width: 64px;
    height: 64px;
  }

  .auth-logo {
    width: 72px;
    height: 72px;
  }

  h1 {
    font-size: 2rem;
  }

  .draw-stage {
    font-size: 1.55rem;
  }

  .draw-machine {
    gap: 8px;
  }

  .draw-machine span {
    width: 42px;
    height: 42px;
    font-size: 0.9rem;
  }

  .auth-card {
    padding: 24px;
  }

  .section-head {
    gap: 8px;
  }

  .raffle-state-card {
    gap: 10px;
  }

  .history-card {
    gap: 10px;
    padding: 12px;
  }

  .check-row {
    margin-top: 4px;
  }

  th,
  td {
    padding: 10px 8px;
    font-size: 0.86rem;
  }

  table {
    min-width: 600px;
  }
}

@media (max-width: 380px) {
  .public-body .brand-row {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 10px;
  }

  .public-logo {
    width: 56px;
    height: 56px;
  }

  .form-panel,
  .admin-section {
    padding: 14px;
  }

  .admin-layout,
  .admin-header {
    width: min(100% - 18px, 1180px);
  }
}
