:root {
  --bg: #f6f5f9;
  --card: #ffffff;
  --ink: #211c2c;
  --muted: #746d80;
  --accent: #6425e6;
  --espresso: #24105f;
  --line: #e4e0eb;
  --green: #247a4c;
  --red: #b5384a;
  --gold: #a96912;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
[hidden] { display: none !important; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #f3f1f7; }
.login-panel { width: min(390px, 100%); padding: 30px; border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 8px; background: #fff; box-shadow: 0 20px 50px rgba(36, 16, 95, .13); }
.login-logo { display: block; width: 112px; height: 112px; object-fit: contain; margin: 0 auto 14px; border-radius: 22px; }
.login-panel h1 { margin: 0; color: var(--espresso); font: 700 28px/1.15 Fraunces, Georgia, serif; text-align: center; }
.login-panel .eyebrow, .login-copy { text-align: center; }
.login-copy { margin: 8px 0 22px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.login-panel label { display: block; margin-top: 14px; color: var(--accent); font-size: 13px; font-weight: 800; }
.login-panel input { width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fff; color: var(--ink); }
.password-field { display: flex; align-items: center; margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.password-field input { margin: 0; border: 0; border-radius: 0; }
.password-field button { align-self: stretch; border: 0; border-left: 1px solid var(--line); padding: 0 13px; background: #f5f2fb; color: var(--accent); cursor: pointer; font-weight: 800; }
.login-error { min-height: 20px; margin: 10px 0 0; color: var(--red); font-size: 13px; line-height: 1.45; }
button, input, select { font: inherit; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 18px; padding: 13px 22px; background: var(--espresso); color: #fff; box-shadow: 0 4px 20px rgba(36, 16, 95, .24); }
.brand { display: inline-flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; white-space: nowrap; font: 700 17px Inter, sans-serif; }
.brand img { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; }
.brand em { color: #cbb8ff; font-style: italic; }
.tabs { display: flex; align-items: center; gap: 7px; overflow: auto; scrollbar-width: none; }
.tab, .ghost { border: 1px solid transparent; background: transparent; color: #d9cefa; border-radius: 20px; padding: 9px 13px; cursor: pointer; white-space: nowrap; font-size: 13px; font-weight: 700; }
.tab:hover, .tab.active, .ghost:hover { background: #fff; color: var(--espresso); }
.account { margin-left: auto; display: flex; gap: 6px; }
.admin-name { align-self: center; max-width: 140px; overflow: hidden; color: #fff; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.wrap { width: min(1220px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 54px; }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.hero h1, h2, h3 { font-family: Fraunces, Georgia, serif; color: var(--espresso); }
.hero h1 { margin: 0; font-size: 30px; line-height: 1.1; }
.eyebrow, #eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.hero-actions, .actions, .toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.primary, .secondary, .danger { border: 1px solid var(--line); border-radius: 9px; padding: 10px 14px; cursor: pointer; font-weight: 800; font-size: 13px; }
button:disabled { cursor: not-allowed; opacity: .5; }
.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent); border-color: var(--accent); }
.secondary { background: var(--card); color: var(--ink); }
.secondary:hover { background: #f0ebfa; border-color: #cfc3e8; }
.danger { background: var(--red); border-color: var(--red); color: #fff; }
.wide { width: 100%; margin-top: 14px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric, .card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 2px 12px rgba(36, 16, 95, .06); }
.metric { padding: 16px; }
.metric .label { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric .value { margin-top: 5px; font-size: 27px; font-weight: 900; }
.metric .delta { margin-top: 5px; color: var(--green); font-size: 12px; font-weight: 700; }
.metric .delta.bad { color: var(--red); }
.split { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; margin-top: 16px; }
.card { padding: 16px; }
.card h2, .card h3 { margin: 0 0 12px; font-size: 18px; }
.booth-grid, .event-grid, .frame-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.booth { border-left: 4px solid #c9c3d2; padding: 14px; background: var(--card); border-radius: 8px; box-shadow: 0 2px 12px rgba(36, 16, 95, .06); }
.booth.online { border-left-color: var(--green); }
.booth.warning { border-left-color: var(--gold); }
.booth.offline { border-left-color: #aaa3b4; }
.booth strong, .event-card strong { display: block; overflow-wrap: anywhere; }
.booth small, .event-card small, .frame-card small, .hint { color: var(--muted); font-size: 12px; line-height: 1.55; }
.state { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; border-radius: 18px; padding: 5px 9px; background: #eee9fa; color: var(--accent); font-size: 12px; font-weight: 800; }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.state.online, .badge.active { background: #e3f2e8; color: var(--green); }
.state.warning { background: #f8ecd4; color: var(--gold); }
.state.offline, .badge.suspended, .badge.closed { background: #efedf2; color: #6f6878; }
.toolbar { margin-bottom: 14px; }
.search, .select, dialog input, dialog select { display: block; width: 270px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); padding: 10px 12px; }
.table-wrap { overflow: auto; padding: 0; }
table { min-width: 720px; width: 100%; border-collapse: collapse; text-align: left; }
th { background: #f5f2fa; color: var(--muted); font-size: 11px; padding: 12px 14px; }
td { border-top: 1px solid var(--line); padding: 12px 14px; font-size: 13px; vertical-align: middle; }
.badge { display: inline-flex; border-radius: 18px; padding: 5px 9px; font-size: 12px; font-weight: 800; }
.event-card { overflow: hidden; padding: 0; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.event-card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(36, 16, 95, .15); }
.cover { display: grid; place-items: center; width: 100%; aspect-ratio: 3 / 4; background: #32118a; color: #fff; font: 700 24px Fraunces, Georgia, serif; text-align: center; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.event-card .meta { padding: 13px 14px; }
.event-card.read-only { cursor: default; }
.event-card.read-only:hover { transform: none; box-shadow: 0 2px 12px rgba(36, 16, 95, .06); }
.source-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.source-label, .read-only-label { color: var(--accent); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.read-only-label { color: var(--muted); text-transform: none; }
.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.icon-delete { flex: 0 0 30px; width: 30px; height: 30px; padding: 0; border-radius: 6px; font-size: 20px; line-height: 1; }
.event-card .meta p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.frame-card .preview { aspect-ratio: 1.6; border-radius: 6px; display: grid; place-items: center; margin-bottom: 12px; background: #5121bd; color: #fff; text-align: center; font: 700 22px Fraunces, Georgia, serif; padding: 10px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 10px; margin-top: 15px; max-height: 48vh; overflow: auto; }
.media-grid figure { position: relative; margin: 0; }
.media-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: zoom-in; background: #ebe7f2; }
.delete-image { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; padding: 0; border-radius: 6px; font-size: 18px; }
.button-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.frame-card .actions { margin-top: 12px; }
.settings-card { max-width: 760px; }
.data-section { margin-top: 22px; }
.data-section h2 { margin: 0 0 10px; color: var(--espresso); font: 700 20px Fraunces, Georgia, serif; }
.voucher-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.empty { padding: 36px 14px; text-align: center; color: var(--muted); }
.toast { visibility: hidden; position: fixed; right: 22px; bottom: 22px; z-index: 50; background: var(--espresso); color: #fff; padding: 13px 16px; border-radius: 8px; box-shadow: 0 12px 30px rgba(36, 16, 95, .28); font-size: 13px; }
.toast.show { visibility: visible; animation: toast 3s; }
@keyframes toast { 0%, 100% { opacity: 0; transform: translateY(6px); } 12%, 88% { opacity: 1; transform: translateY(0); } }
dialog { border: 0; border-radius: 8px; padding: 0; width: min(470px, calc(100vw - 28px)); background: var(--card); color: var(--ink); box-shadow: 0 24px 70px rgba(30, 14, 72, .35); }
dialog::backdrop { background: rgba(25, 17, 45, .58); }
dialog form { padding: 24px; position: relative; }
dialog h2 { margin: 0 0 15px; font-size: 24px; }
dialog label { display: block; margin: 12px 0; font-size: 12px; font-weight: 800; color: var(--accent); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
dialog input, dialog select { width: 100%; margin-top: 6px; background: #fff; }
.close, .close-lightbox { position: absolute; right: 14px; top: 10px; border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 28px; }
.lightbox { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(0, 0, 0, .88); padding: 28px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 96vw; max-height: 92vh; object-fit: contain; }
.close-lightbox { color: #fff; font-size: 34px; }
@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-wrap: wrap; padding: 12px 14px; }
  .tabs { order: 3; width: 100%; }
  .account { margin-left: 0; }
  .wrap { width: calc(100% - 24px); padding-top: 16px; }
  .hero { align-items: flex-start; flex-direction: column; }
  .hero h1 { font-size: 23px; }
  .metrics, .split, .voucher-metrics { grid-template-columns: 1fr; }
  .booth-grid, .event-grid, .frame-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; }
  .search, .select { width: 100%; }
  .hero-actions, .toolbar { width: 100%; }
  .primary, .secondary, .danger { flex: 1 1 45%; }
}
