:root {
  color-scheme: light;
  --ink: #17181a;
  --muted: #626873;
  --paper: #f3f4f5;
  --surface: #ffffff;
  --line: #d8dce1;
  --line-strong: #b9bec6;
  --black: #0b0c0e;
  --red: #e2212f;
  --red-dark: #a80f1d;
  --cyan: #00a9c7;
  --cyan-dark: #00758b;
  --green: #197448;
  --amber: #9c5b00;
  --radius: 6px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: inherit; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button, .button {
  align-items: center;
  background: var(--black);
  border: 1px solid var(--black);
  border-radius: var(--radius);
  color: white;
  cursor: pointer;
  display: inline-flex;
  font-weight: 750;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  text-decoration: none;
}
button:hover, .button:hover { background: #292b2f; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(0, 169, 199, .35); outline-offset: 2px; }
button.secondary, .button.secondary { background: white; border-color: var(--line-strong); color: var(--ink); }
button.danger { background: var(--red-dark); border-color: var(--red-dark); }
button.small, .button.small { min-height: 34px; padding: 0 11px; font-size: .82rem; }
button:disabled { cursor: wait; opacity: .58; }
input, textarea, select {
  background: white;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  min-height: 44px;
  padding: 10px 11px;
  width: 100%;
}
textarea { resize: vertical; }
label > span { color: #42464d; display: block; font-size: .82rem; font-weight: 720; margin-bottom: 6px; }
.stack { display: grid; gap: 16px; }
.brand-mark {
  align-items: center;
  background: var(--red);
  border-radius: 2px;
  color: white;
  display: inline-flex;
  font-size: .78rem;
  font-weight: 900;
  height: 30px;
  justify-content: center;
  width: 42px;
}
.section-label { color: var(--cyan-dark); font-size: .7rem; font-weight: 850; margin: 0 0 6px; text-transform: uppercase; }
.notice { border-left: 4px solid var(--line-strong); display: grid; gap: 4px; padding: 12px 14px; }
.notice.danger { background: #fff0f1; border-color: var(--red); color: #74111a; }
.notice.success { background: #eaf7f0; border-color: var(--green); color: #125435; }

.auth-shell { align-items: center; background: var(--black); display: grid; min-height: 100vh; padding: 24px; }
.auth-panel { background: white; border-top: 5px solid var(--red); margin: auto; padding: 30px; width: min(100%, 440px); }
.auth-brand { align-items: center; display: flex; font-weight: 850; gap: 10px; margin-bottom: 38px; }
.auth-panel h1 { font-size: 1.65rem; margin: 0 0 10px; }
.auth-panel > p:not(.section-label) { color: var(--muted); line-height: 1.5; margin: 0 0 24px; }

.admin-shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.admin-sidebar { background: var(--black); color: #f7f8f9; display: flex; flex-direction: column; padding: 22px 16px; position: sticky; top: 0; height: 100vh; }
.admin-brand { align-items: center; display: flex; font-weight: 850; gap: 10px; margin-bottom: 34px; text-decoration: none; }
.admin-sidebar nav { display: grid; gap: 4px; }
.admin-sidebar nav a { border-left: 3px solid transparent; color: #aeb3bb; padding: 11px 12px; text-decoration: none; }
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { background: #1d1f23; border-left-color: var(--cyan); color: white; }
.admin-identity { border-top: 1px solid #32353a; display: grid; gap: 3px; margin-top: auto; padding: 18px 10px 0; }
.admin-identity span { color: #989ea8; font-size: .75rem; text-transform: capitalize; }
.admin-identity form { margin-top: 8px; }
.text-button { background: transparent; border: 0; color: #cfd3d9; justify-content: flex-start; min-height: 30px; padding: 0; }
.text-button:hover { background: transparent; color: white; }
.danger-text { color: var(--red-dark); }
.admin-main { min-width: 0; padding: 30px 34px 60px; }
.page-header { align-items: center; display: flex; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-header h1 { font-size: 1.9rem; margin: 0; }
.event-header > div:first-child { align-items: center; display: flex; flex-wrap: wrap; gap: 10px; }
.event-header .back-link { flex-basis: 100%; color: var(--muted); font-size: .82rem; text-decoration: none; }
.header-actions, .inline-actions, .media-actions, .actions-cell { align-items: center; display: flex; gap: 9px; }
.inline-actions { margin-top: 14px; }
.metrics-strip { background: var(--black); color: white; display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 24px; }
.metrics-strip div { border-right: 1px solid #33363c; display: grid; gap: 2px; padding: 18px 22px; }
.metrics-strip div:last-child { border: 0; }
.metrics-strip strong { font-size: 1.7rem; }
.metrics-strip span { color: #adb2bb; font-size: .76rem; }
.table-section, .form-section, .moderation-section, .theme-section, .ai-section, .integration-section, .terms-admin-section { background: var(--surface); border: 1px solid var(--line); padding: 20px; }
.compact-section { margin: 22px 0; }
.section-heading { align-items: center; display: flex; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-heading h2 { font-size: 1.05rem; margin: 0; text-transform: capitalize; }
.section-heading span { color: var(--muted); font-size: .8rem; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; min-width: 680px; width: 100%; }
th { color: var(--muted); font-size: .68rem; font-weight: 800; padding: 10px; text-align: left; text-transform: uppercase; }
td { border-top: 1px solid var(--line); padding: 14px 10px; vertical-align: middle; }
.event-link, .compact-link { font-weight: 750; text-decoration: none; }
.event-link:hover, .compact-link:hover { color: var(--cyan-dark); text-decoration: underline; }
.subtle { color: var(--muted); display: block; font-size: .72rem; margin-top: 3px; }
.empty-cell, .empty-state { color: var(--muted); padding: 34px 12px; text-align: center; }
.status { border: 1px solid currentColor; border-radius: 3px; display: inline-flex; font-size: .65rem; font-weight: 850; padding: 3px 6px; text-transform: uppercase; }
.status.live, .status.approved { color: var(--green); }
.status.paused, .status.denied { color: var(--muted); }
.status.scheduled { color: var(--cyan-dark); }
.status.closed { color: var(--red-dark); }
.status.pending, .status.processing, .status.uploaded { color: var(--amber); }
.status.quarantined, .status.processing_failed { color: var(--red-dark); }
.event-control-band { background: var(--black); color: white; display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr) 170px; padding: 24px; }
.event-copy p:not(.section-label) { color: #d8dce2; margin: 0 0 12px; }
.event-copy code { color: #8de4f4; overflow-wrap: anywhere; }
.qr-panel { align-items: center; background: white; color: var(--ink); display: grid; gap: 7px; justify-items: center; padding: 12px; }
.qr-panel img { height: 130px; width: 130px; }
.qr-panel span { font-size: .72rem; font-weight: 800; }
.theme-section { margin-top: 22px; }
.theme-layout { align-items: start; display: grid; gap: 24px; grid-template-columns: minmax(280px, .9fr) minmax(300px, 1.1fr); }
.theme-preview { aspect-ratio: 16 / 9; background: #080a0d; isolation: isolate; min-height: 220px; overflow: hidden; position: relative; }
.theme-preview__background, .theme-preview__shade { height: 100%; inset: 0; position: absolute; width: 100%; }
.theme-preview__background { object-fit: cover; }
.theme-preview__shade { background: linear-gradient(180deg, rgba(5, 6, 8, .12), rgba(5, 6, 8, .82)); z-index: 1; }
.theme-preview__logo { height: 44%; left: 20px; object-fit: contain; object-position: left center; position: absolute; top: 14px; width: min(44%, 180px); z-index: 2; }
.theme-preview__copy { bottom: 18px; color: white; display: grid; gap: 3px; left: 20px; max-width: calc(100% - 40px); position: absolute; z-index: 2; }
.theme-preview__copy strong { font-size: 1.15rem; overflow-wrap: anywhere; }
.theme-preview__copy span { font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.theme-form small { color: var(--muted); display: block; font-size: .7rem; line-height: 1.35; margin-top: 5px; }
.colour-controls { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.colour-controls input[type="color"] { cursor: pointer; height: 46px; padding: 4px; }
.ai-section { margin-top: 22px; }
.ai-layout { align-items: start; display: grid; gap: 24px; grid-template-columns: minmax(250px, .8fr) minmax(320px, 1.2fr); }
.provider-statuses { align-items: center; display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.policy-guardrails { background: #111317; border-left: 4px solid var(--cyan); color: white; display: grid; gap: 10px; padding: 18px; }
.policy-guardrails strong { font-size: .92rem; }
.policy-guardrails p { color: #d0d4da; font-size: .79rem; line-height: 1.55; margin: 0; }
.policy-guardrails span { color: #8de4f4; font-size: .72rem; line-height: 1.4; }
.ai-section form small { color: var(--muted); display: block; font-size: .7rem; line-height: 1.35; margin-top: 5px; }
.terms-admin-section { margin: 22px 0; }
.legal-form { grid-template-columns: minmax(220px, 1fr) minmax(240px, 1fr) auto; align-items: end; }
.schedule-fields { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.schedule-fields small { color: var(--muted); display: block; font-size: .68rem; margin-top: 4px; }
.schedule-summary { display: block; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.segmented { border-bottom: 1px solid var(--line); display: flex; gap: 4px; margin: 0 0 18px; overflow-x: auto; }
.segmented a { border-bottom: 3px solid transparent; color: var(--muted); flex: 0 0 auto; font-size: .76rem; font-weight: 750; padding: 9px 12px; text-decoration: none; text-transform: capitalize; }
.segmented a.active { border-bottom-color: var(--red); color: var(--ink); }
.moderation-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.media-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.media-preview { aspect-ratio: 4 / 3; background: #111; overflow: hidden; }
.media-preview img, .media-preview video { height: 100%; object-fit: cover; object-position: var(--focus-x) var(--focus-y); width: 100%; }
.media-meta { align-items: start; display: flex; gap: 8px; justify-content: space-between; padding: 12px; }
.media-meta strong, .media-meta span { display: block; }
.media-meta > div span { color: var(--muted); font-size: .7rem; margin-top: 3px; }
.failure-note { color: var(--red-dark); font-size: .75rem; margin: 0; padding: 0 12px 12px; }
.ai-review { border-top: 1px solid var(--line); display: grid; gap: 6px; padding: 10px 12px; }
.ai-review > div { align-items: center; display: flex; gap: 8px; justify-content: space-between; }
.ai-review strong { font-size: .72rem; }
.ai-review span { color: var(--muted); font-size: .66rem; }
.ai-review p { color: var(--muted); font-size: .72rem; line-height: 1.4; margin: 0; }
.ai-review.approve { border-left: 3px solid var(--green); }
.ai-review.review, .ai-review.error { border-left: 3px solid var(--amber); }
.focus-form { border-top: 1px solid var(--line); display: grid; gap: 8px; padding: 10px 12px; }
.focus-form label > span { font-size: .68rem; margin: 0; }
.focus-form input { min-height: 24px; padding: 0; }
.media-actions { border-top: 1px solid var(--line); padding: 10px 12px; }
.media-actions form { flex: 1; }
.media-actions button { width: 100%; }
.narrow-form { max-width: 480px; }
.form-section h2 { margin-top: 0; }
.integration-section { margin-bottom: 22px; }
.integration-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.integration-panel { border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 16px; padding: 16px; }
.integration-heading { align-items: start; display: flex; gap: 12px; justify-content: space-between; }
.integration-heading strong, .integration-heading span { display: block; }
.integration-heading > div > span { color: var(--muted); font-size: .7rem; margin-top: 4px; }
.integration-panel > form:last-child { margin-top: -6px; }
.integration-panel .text-button { color: var(--red-dark); }
.integration-note { color: var(--muted); font-size: .72rem; line-height: 1.5; margin: 16px 0 0; }
.account-password { margin-top: 22px; }
.account-notice { margin-bottom: 22px; }

dialog { border: 0; border-radius: var(--radius); box-shadow: 0 24px 80px rgba(0, 0, 0, .3); max-height: 90vh; overflow: auto; padding: 24px; width: min(calc(100% - 30px), 520px); }
dialog::backdrop { background: rgba(5, 6, 8, .72); }
.dialog-heading { align-items: start; display: flex; justify-content: space-between; gap: 20px; }
.dialog-heading h2 { font-size: 1.25rem; margin: 0; }
.icon-close { background: transparent; border: 0; color: var(--ink); font-size: 1.6rem; line-height: 1; min-height: 32px; padding: 0 4px; }
.check-row, .consent-row { align-items: start; display: grid; gap: 9px; grid-template-columns: 20px 1fr; }
.check-row input, .consent-row input { height: 18px; min-height: 0; margin-top: 2px; width: 18px; }
.check-row span, .consent-row span { margin: 0; }
.full-width { margin-top: 16px; width: 100%; }

.upload-page { background: var(--black); color: white; height: 100vh; height: 100dvh; overflow: hidden; }
.upload-shell { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; isolation: isolate; overflow: hidden; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); position: relative; }
.upload-theme-background, .upload-theme-shade { height: 100%; inset: 0; position: absolute; width: 100%; }
.upload-theme-background { object-fit: cover; z-index: -2; }
.upload-theme-shade { background: linear-gradient(90deg, rgba(5, 6, 8, .96), rgba(5, 6, 8, .7) 55%, rgba(5, 6, 8, .86)); z-index: -1; }
.upload-header { align-items: center; border-bottom: 1px solid rgba(255, 255, 255, .18); border-top: 4px solid var(--red); display: flex; font-size: .76rem; font-weight: 850; gap: 12px; min-height: 64px; padding: 9px 22px; }
.upload-header::after { background: var(--cyan); content: ""; height: 4px; position: absolute; right: env(safe-area-inset-right); top: env(safe-area-inset-top); width: 24%; }
.upload-event-logo { display: block; height: 40px; max-width: 130px; object-fit: contain; object-position: left center; width: auto; }
.upload-workspace { display: grid; grid-template-columns: minmax(0, .9fr) minmax(360px, 1.1fr); height: 100%; margin: auto; max-width: 1100px; min-height: 0; padding: 18px 22px; width: 100%; }
.upload-copy { align-self: center; min-width: 0; padding: 30px 44px 30px 0; }
.upload-copy h1 { font-size: 4.6rem; line-height: .94; margin: 0 0 22px; max-width: 520px; }
.upload-copy > p:not(.section-label) { color: #d8dde4; line-height: 1.5; max-width: 480px; }
.upload-copy dl { border-top: 1px solid rgba(255, 255, 255, .22); margin-top: 30px; }
.upload-copy dl div { border-bottom: 1px solid rgba(255, 255, 255, .22); display: grid; gap: 12px; grid-template-columns: 80px 1fr; padding: 11px 0; }
.upload-copy dt { color: white; font-size: .78rem; font-weight: 800; }
.upload-copy dd { color: #b9c0c9; font-size: .78rem; margin: 0; }
.upload-form-panel { align-self: center; background: rgba(255, 255, 255, .97); border-top: 5px solid var(--red); color: var(--ink); max-height: 100%; overflow: auto; padding: 26px 28px; }
.upload-form-panel #uploadButton, .upload-success .button { background: var(--red); border-color: var(--red); }
.upload-form-panel #uploadButton:hover, .upload-success .button:hover { filter: brightness(.88); }
.file-drop { border: 2px dashed var(--line-strong); cursor: pointer; display: grid; gap: 5px; min-height: 150px; place-content: center; text-align: center; }
.file-drop:hover { border-color: var(--cyan); background: #f4fbfc; }
.file-drop input { height: 1px; opacity: 0; overflow: hidden; padding: 0; position: absolute; width: 1px; }
.file-command { color: var(--ink); font-size: 1rem; font-weight: 800; margin: 0; }
#fileSummary { color: var(--muted); font-size: .76rem; font-weight: 500; margin: 0; max-width: 300px; overflow-wrap: anywhere; }
.privacy-note { color: var(--muted); font-size: .7rem; line-height: 1.45; margin: 0; text-align: center; }
.consent-row a { color: var(--cyan); font-weight: 800; }
.upload-success { display: grid; gap: 12px; text-align: center; }
.upload-success strong { font-size: 1.5rem; }
.upload-success span { color: var(--muted); }

.message-shell { align-items: center; background: var(--black); color: white; display: grid; min-height: 100vh; padding: 24px; }
.message-shell section { border-left: 5px solid var(--red); max-width: 540px; padding: 12px 24px; }
.message-shell h1 { font-size: 2rem; margin: 20px 0 8px; }
.message-shell p { color: #b7bdc5; line-height: 1.5; margin-bottom: 22px; }

.terms-page { background: var(--paper); }
.terms-shell { margin: 0 auto; max-width: 920px; padding: 36px 24px 64px; }
.terms-header { align-items: center; border-bottom: 1px solid var(--line-strong); display: flex; gap: 14px; padding-bottom: 22px; }
.terms-header h1 { font-size: 2rem; margin: 0; }
.terms-intro { background: var(--black); color: white; margin: 24px 0 0; padding: 22px; }
.terms-intro p { color: #bfc4cb; margin-top: 0; }
.terms-intro strong { color: #8de4f4; }
.terms-shell > section:not(.terms-intro) { border-bottom: 1px solid var(--line); padding: 26px 0; }
.terms-shell h2 { font-size: 1.08rem; margin: 0 0 12px; }
.terms-shell p { color: #444951; line-height: 1.62; margin: 10px 0; }
.terms-shell a { color: var(--cyan-dark); }
.terms-schedule { border-top: 1px solid var(--line); }
.terms-schedule > div { align-items: start; border-bottom: 1px solid var(--line); display: grid; gap: 12px; grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(180px, 1fr); padding: 13px 0; }
.terms-schedule span { color: var(--muted); font-size: .78rem; }

@media (max-width: 820px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { align-items: center; flex-direction: row; height: auto; padding: 10px 14px; position: static; }
  .admin-brand { margin: 0 auto 0 0; }
  .admin-sidebar nav { display: flex; }
  .admin-sidebar nav a { border-bottom: 3px solid transparent; border-left: 0; padding: 9px; }
  .admin-sidebar nav a.active { border-bottom-color: var(--cyan); border-left: 0; }
  .admin-identity { border: 0; margin: 0 0 0 8px; padding: 0; }
  .admin-identity strong, .admin-identity span { display: none; }
  .admin-identity form { margin: 0; }
  .admin-main { padding: 22px 16px 50px; }
  .upload-theme-shade { background: linear-gradient(180deg, rgba(5, 6, 8, .72), rgba(5, 6, 8, .94) 48%, rgba(5, 6, 8, .98)); }
  .upload-header { min-height: 52px; padding: 6px 14px; }
  .upload-event-logo { height: 34px; max-width: 112px; }
  .upload-workspace { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); padding: 0 12px 12px; }
  .upload-copy { align-self: end; padding: 12px 4px 10px; }
  .upload-copy .section-label { font-size: .62rem; margin-bottom: 3px; }
  .upload-copy h1 { font-size: 2.2rem; line-height: .96; margin: 0 0 7px; }
  .upload-copy > p:not(.section-label) { display: -webkit-box; font-size: .78rem; line-height: 1.3; margin: 0; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .upload-copy dl { display: none; }
  .upload-form-panel { align-self: start; margin: 0; min-height: 0; padding: 13px 14px; width: 100%; }
  .upload-form-panel .stack { gap: 8px; }
  .upload-form-panel label > span { font-size: .72rem; margin-bottom: 3px; }
  .upload-form-panel input { min-height: 40px; padding: 7px 9px; }
  .upload-form-panel .file-drop { min-height: 78px; }
  .upload-form-panel .file-drop input { min-height: 0; padding: 0; }
  .upload-form-panel .file-command { font-size: .88rem; }
  .upload-form-panel #fileSummary { font-size: .66rem; }
  .upload-form-panel .consent-row { gap: 7px; grid-template-columns: 18px 1fr; }
  .upload-form-panel .consent-row input { height: 16px; margin-top: 1px; min-height: 0; width: 16px; }
  .upload-form-panel .consent-row span { font-size: .67rem; line-height: 1.25; }
  .upload-form-panel button { min-height: 41px; }
  .upload-form-panel .privacy-note { font-size: .58rem; line-height: 1.25; }
  .theme-layout { grid-template-columns: 1fr; }
  .ai-layout { grid-template-columns: 1fr; }
  .legal-form { grid-template-columns: 1fr; }
}

@media (max-width: 580px) {
  .page-header { align-items: stretch; flex-direction: column; }
  .page-header > button, .header-actions, .header-actions .button, .header-actions button { width: 100%; }
  .metrics-strip { grid-template-columns: 1fr; }
  .metrics-strip div { border-bottom: 1px solid #33363c; border-right: 0; grid-template-columns: 54px 1fr; align-items: center; }
  .event-control-band { grid-template-columns: 1fr; }
  .colour-controls { grid-template-columns: 1fr; }
  .qr-panel { justify-self: stretch; }
  .qr-panel img { height: 170px; width: 170px; }
  .moderation-grid { grid-template-columns: 1fr; }
  .integration-grid { grid-template-columns: 1fr; }
  .schedule-fields { grid-template-columns: 1fr; }
  .terms-schedule > div { grid-template-columns: 1fr; gap: 4px; }
}

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