/* shmormakom eventer admin — dark, blue accent, RTL-safe (logical properties).
   Refreshed: Inter-led type, layered surfaces, motion (entrance / hover / draw-in).
   All animation is gated behind prefers-reduced-motion: no-preference. */

:root {
  --ink:    #0B0E14;   /* page plane */
  --ink-2:  #12161F;   /* card surface */
  --ink-3:  #1A2030;   /* raised / hover surface */
  --line:   #232A38;   /* hairline */
  --line-2: #2C3444;   /* hover hairline */
  --paper:  #EDEFF4;   /* primary ink */
  --muted:  #8B94A7;   /* secondary ink */
  --accent: #3987E5;   /* series-1 blue, validated on --ink-2 */
  --accent-2: #66A9FF;
  --accent-soft: rgba(57, 135, 229, .16);
  --accent-line: rgba(57, 135, 229, .35);
  --aqua:   #199E70;   /* series-2 (online / positive), validated on --ink-2 */
  --aqua-soft: rgba(25, 158, 112, .16);
  --amber:  #C98500;   /* series-3 (pending), validated on --ink-2 */
  --amber-soft: rgba(201, 133, 0, .16);
  --ok: #2E9E5B;
  --ok-text: #6FD49A;
  --warn: #C77B1E;
  --warn-text: #E8B96A;
  --bad: #D64545;
  --bad-text: #E88;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --ease: cubic-bezier(.22, .65, .35, 1);
}

* { box-sizing: border-box; }
/* Author display rules must never resurrect an element the JS hid via the attribute */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(57, 135, 229, .07), transparent 60%),
    radial-gradient(900px 400px at 0% 110%, rgba(25, 158, 112, .05), transparent 60%),
    var(--ink);
  color: var(--paper);
  font: 15px/1.55 'Inter', 'Heebo', 'IBM Plex Sans Arabic', -apple-system, "Segoe UI", Arial, "Noto Sans Hebrew", "Noto Sans Arabic", sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 2px solid var(--ink); }
::-webkit-scrollbar-track { background: transparent; }

a { color: #7FB5F5; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 800; letter-spacing: -.01em; margin: 0 0 8px; }
h2 { font-size: 13px; margin: 0 0 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
h2.mt { margin-top: 22px; }
p.lead { color: var(--muted); margin-top: 0; }
.muted { color: var(--muted); font-size: 13px; }
.mono { font-family: "SF Mono", ui-monospace, Menlo, monospace; letter-spacing: .05em; }
.mt { margin-top: 16px; }

/* ── Motion: entrance cascade ─────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  @keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
  }
  .wrap > * { animation: rise .5s var(--ease) both; }
  .wrap > *:nth-child(1) { animation-delay: .02s; }
  .wrap > *:nth-child(2) { animation-delay: .08s; }
  .wrap > *:nth-child(3) { animation-delay: .14s; }
  .wrap > *:nth-child(4) { animation-delay: .20s; }
  .wrap > *:nth-child(5) { animation-delay: .26s; }
  .wrap > *:nth-child(6) { animation-delay: .32s; }
  .wrap > *:nth-child(7) { animation-delay: .38s; }
  .wrap > *:nth-child(8) { animation-delay: .44s; }
  @keyframes badge-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(57, 135, 229, .45); }
    50%      { box-shadow: 0 0 0 5px rgba(57, 135, 229, 0); }
  }
  .badge {
    animation: badge-pulse 2.2s ease-out infinite;
  }
  @keyframes flash-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: none; }
  }
  .flash { animation: flash-in .35s var(--ease) both; }
}

/* ── Shell: sidebar + content ────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 216px; flex: none;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 18px;
  padding: 20px 14px; box-sizing: border-box;
  background: color-mix(in srgb, var(--ink) 88%, #fff 4%);
  border-inline-end: 1px solid var(--line);
  z-index: 30;
  transition: width .28s var(--ease), padding .28s var(--ease), opacity .28s var(--ease), transform .28s var(--ease);
  overflow: hidden;
}
.main-col { flex: 1; min-width: 0; }

.side-head { display: flex; align-items: center; gap: 8px; }
.side-head .brand { flex: 1; min-width: 0; }
.side-collapse {
  flex: none; width: 26px; height: 26px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--line); color: var(--muted); cursor: pointer;
  transition: color .15s, border-color .15s, transform .28s var(--ease);
}
.side-collapse:hover { color: var(--paper); border-color: var(--line-2); background: var(--ink-3); }

.nav-ic { width: 19px; height: 19px; flex: none; }
.side-nav a .badge { margin-inline-start: auto; }
.side-nav a, .side-end .btn { transition: background .15s, color .15s; }
.side-nav .nav-text, .brand-sub, .lang-btn .lang-cur, .lang-btn .caret { transition: opacity .2s; }

/* Icon rail */
.shell[data-side="rail"] .side { width: 62px; padding: 20px 9px; }
.shell[data-side="rail"] .brand { align-items: center; padding: 2px 0; }
.shell[data-side="rail"] .brand { padding: 0; }
.shell[data-side="rail"] .brand-text { display: none; }
.shell[data-side="rail"] .nav-text,
.shell[data-side="rail"] .lang-cur,
.shell[data-side="rail"] .lang-btn .caret { display: none; }
.shell[data-side="rail"] .lang-btn { justify-content: center; padding: 7px 0; }
.shell[data-side="rail"] .side-nav a { justify-content: center; padding: 9px 0; position: relative; }
.shell[data-side="rail"] .side-nav a .badge {
  position: absolute; inset-block-start: 2px; inset-inline-end: 4px;
  padding: 0 5px; font-size: 10px;
}
.shell[data-side="rail"] .side-end .btn--wide { width: 100%; padding-inline: 0; }
.shell[data-side="rail"] .side-collapse { transform: scaleX(-1); }
[dir='rtl'] .shell[data-side="rail"] .side-collapse { transform: none; }
[dir='rtl'] .side-collapse { transform: scaleX(-1); }

.side-fab, .side-backdrop { display: none; }

@media (prefers-reduced-motion: reduce) {
  .side, .side-collapse { transition: none; }
}

.brand { display: flex; flex-direction: row; align-items: center; gap: 9px; line-height: 1.15; padding: 2px 8px; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 32px; height: 32px; border-radius: 9px; flex: none; box-shadow: 0 3px 10px rgba(20,20,20,.18); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-mark { font-weight: 900; font-size: 16px; letter-spacing: .01em; }
.brand-mark::first-letter { color: var(--accent-2); }
.brand-sub { font-size: 11px; color: var(--muted); }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 600;
  display: flex; align-items: center; gap: 8px; font-size: 14px;
  transition: color .15s, background .15s, transform .15s;
}
@media (hover: hover) {
  .side-nav a:hover { color: var(--paper); text-decoration: none; background: var(--ink-3); transform: translateX(0); }
}
[dir='rtl'] .side-nav a:hover { transform: none; }
.side-nav a.on { color: var(--paper); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.badge {
  background: var(--accent); color: #fff; border-radius: 99px;
  font-size: 11px; padding: 1px 7px; font-weight: 700;
}
.side-end { margin-block-start: auto; display: flex; flex-direction: column; gap: 10px; padding: 2px 8px; }
/* Language picker: icon button + dropdown, styled like the ctx chips */
.lang-menu { position: relative; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 7px;
  width: 100%; padding: 7px 10px;
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 13px; cursor: pointer;
}
.lang-btn svg { width: 17px; height: 17px; flex: none; }
.lang-btn .caret { width: 13px; height: 13px; margin-inline-start: auto; }
.lang-btn:hover { color: var(--paper); border-color: var(--accent-line); }
.lang-drop {
  position: absolute; inset-inline-start: 0; inset-block-end: calc(100% + 6px);
  min-width: 130px; padding: 5px;
  background: var(--ink-2, #141a26); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); z-index: 50;
}
.lang-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 8px;
  color: var(--paper); text-decoration: none; font-size: 13px;
}
.lang-row:hover { background: var(--accent-soft); }
.lang-row .check { width: 14px; height: 14px; margin-inline-start: auto; color: var(--accent); }
.btn--wide { width: 100%; }

/* Narrow screens: sidebar folds into a top strip */
@media (max-width: 900px) {
  body { overflow-x: clip; }
  .shell { flex-direction: column; }

  /* Sidebar becomes an off-canvas drawer, opened by the hamburger FAB */
  .shell[data-side] .side {
    width: min(78vw, 300px); height: 100dvh; position: fixed; inset-block: 0;
    inset-inline-start: 0; top: 0;
    flex-direction: column; gap: 18px;
    padding: 20px 14px; opacity: 1; pointer-events: auto;
    background: color-mix(in srgb, var(--ink) 96%, #fff 4%);
    border-inline-end: 1px solid var(--line);
    box-shadow: var(--shadow);
    z-index: 70;
    transform: translateX(-105%);
    transition: transform .3s var(--ease);
  }
  [dir='rtl'] .shell[data-side] .side { transform: translateX(105%); }
  .shell[data-side].nav-open .side { transform: none; }
  .side-collapse { display: none; }

  /* Hamburger + backdrop */
  .side-fab {
    display: inline-flex;
    position: fixed; inset-block-start: 12px; inset-inline-start: 12px; z-index: 60;
    width: 38px; height: 38px; border-radius: 11px;
    align-items: center; justify-content: center;
    background: var(--ink-2); border: 1px solid var(--line-2); color: var(--muted);
    cursor: pointer; box-shadow: var(--shadow);
    transition: color .15s, transform .15s;
  }
  .side-fab:hover { color: var(--paper); }
  .side-fab:active { transform: scale(.94); }
  .side-backdrop {
    display: block;
    position: fixed; inset: 0; z-index: 65;
    background: rgba(5, 7, 11, .55);
    opacity: 0; pointer-events: none;
    transition: opacity .3s var(--ease);
  }
  .shell[data-side].nav-open .side-backdrop { opacity: 1; pointer-events: auto; }

  .side-head { flex: none; }
  .brand { padding: 2px 8px; }
  .brand-mark { display: initial; }
  .side-nav { flex-direction: column; gap: 2px; overflow: visible; }
  .side-nav a { padding: 8px 12px; }
  .side-end { margin-block-start: auto; flex-direction: column; gap: 10px; padding: 2px 8px; }
  .btn--wide { width: 100%; }

  /* Floating bar: hamburger space then context chips */
  .ctxbar { padding: 16px 14px 0; padding-inline-start: 58px; }
  .ctx-value { max-width: 150px; }
  .wrap { padding: 16px 14px 50px; }

  /* Wide children scroll inside their card instead of stretching the page */
  .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .splitbar, .hbar-track { min-width: 0; }
  .quickfacts { grid-template-columns: repeat(2, 1fr); }
}

/* ── Context bar: org + event switcher chips ─────────────── */
.ctxbar {
  padding: 14px 26px 0;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  position: relative; z-index: 40;
}
.ctx-menu { position: relative; }
.ctx-sep { width: 13px; height: 13px; color: var(--line-2); flex: none; }
[dir='rtl'] .ctx-sep { transform: scaleX(-1); }

.ctx-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: 99px; padding: 5px 12px;
  font: inherit; color: var(--paper); cursor: pointer;
  transition: border-color .18s, background .18s, transform .18s;
}
.ctx-chip:hover {
  border-color: var(--accent-line); background: var(--accent-soft);
  transform: translateY(-1px);
}
.ctx-chip--static { cursor: default; }
.ctx-chip--static:hover { border-color: var(--line); background: var(--ink-2); transform: none; }

.ctx-label {
  color: var(--muted); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
}
.ctx-value {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; max-width: 260px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ctx-value--empty { color: var(--muted); font-weight: 500; }
.caret { width: 13px; height: 13px; color: var(--muted); flex: none; transition: transform .18s var(--ease); }
.ctx-chip[aria-expanded="true"] .caret { transform: rotate(180deg); }
.ctx-chip[aria-expanded="true"] { border-color: var(--accent-line); }

/* Dropdown card */
.ctx-drop {
  position: absolute; inset-inline-start: 0; margin-block-start: 6px;
  min-width: 260px; max-height: 320px; overflow-y: auto;
  background: var(--ink-2); border: 1px solid var(--line-2);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 6px; z-index: 50;
  animation: drop-in .18s var(--ease);
}
@keyframes drop-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) { .ctx-drop { animation: none; } }

.ctx-drop form { margin: 0; }
.ctx-row {
  display: flex; align-items: center; gap: 9px; width: 100%;
  background: none; border: 0; border-radius: 9px;
  padding: 9px 10px; font: inherit; font-size: 13.5px;
  color: var(--paper); text-align: start; cursor: pointer;
  transition: background .14s;
}
.ctx-row:hover { background: var(--ink-3); }
.ctx-row.on { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.ctx-row-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-row-meta { color: var(--muted); font-size: 12px; flex: none; }
.check { width: 14px; height: 14px; color: var(--accent-2); flex: none; }

/* Status dots */
.ctx-dot {
  width: 8px; height: 8px; border-radius: 99px; flex: none;
  display: inline-block; background: var(--line-2);
}
.ctx-dot--on_sale { background: var(--aqua); box-shadow: 0 0 6px color-mix(in srgb, var(--aqua) 55%, transparent); }
.ctx-dot--doors_open { background: var(--accent); box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 55%, transparent); }
.ctx-dot--draft { background: var(--muted); opacity: .65; }
.ctx-dot--closed { background: var(--bad); opacity: .8; }

.wrap { max-width: 1160px; margin: 0 auto; padding: 26px 20px 60px; }
.foot { text-align: center; color: var(--line-2); font-size: 12px; padding: 24px; }

/* ── Cards / layout ──────────────────────────────────────── */
.card {
  background: linear-gradient(180deg, var(--ink-2), color-mix(in srgb, var(--ink-2) 92%, #fff 8%));
  border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-block-end: 18px;
  position: relative;
  transition: border-color .2s, box-shadow .2s;
}
@media (hover: hover) {
  .card:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
}
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-block-end: 18px; }
.page-head h1 { margin: 0; }
.page-head .muted { width: 100%; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }
.grid { display: grid; gap: 14px; }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-block-end: 18px; }

/* ── Stat tiles (label · value · delta · trend) ───────────── */
.stat { padding: 16px 18px 14px; overflow: hidden; }
.stat::before {
  content: ""; position: absolute; inset-block-start: 0; inset-inline: 0; height: 2px;
  background: var(--line);
}
.stat--accent::before { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.stat--aqua::before { background: linear-gradient(90deg, var(--aqua), #2E9E5B); }
.stat--warn::before { background: var(--warn); }
.stat-num {
  font-size: 32px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1;
  margin-block-end: 2px; font-variant-numeric: normal;
}
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .07em; margin-block-end: 8px; font-weight: 700; }
.stat-sub { color: var(--muted); font-size: 12px; }
.stat--warn .stat-num { color: var(--warn-text); }
.stat a { font-size: 12px; }
.delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 700; border-radius: 99px; padding: 2px 8px;
  background: var(--ink-3); margin-inline-end: 6px;
}
.delta--up { color: var(--ok-text); background: var(--aqua-soft); }
.delta--down { color: var(--bad-text); background: rgba(214, 69, 69, .14); }
.delta--flat { color: var(--muted); }
.delta svg { width: 11px; height: 11px; }
.stat-spark { margin-block-start: 8px; opacity: .9; }

/* ── Charts ──────────────────────────────────────────────── */
.split--wide-left { grid-template-columns: 3fr 2fr; }
@media (max-width: 820px) { .split--wide-left { grid-template-columns: 1fr; } }
.chart { width: 100%; height: auto; display: block; }
.chart-box { position: relative; }
.chart-hit { cursor: crosshair; }
.chart-dot { transition: r .1s; }
.chart-line { }  /* draw-in animation applied by /charts.js */
.chart-tip {
  position: absolute; transform: translate(-50%, -100%);
  background: var(--ink-3); border: 1px solid var(--accent-line); border-radius: var(--radius-sm);
  padding: 6px 11px; font-size: 12px; white-space: nowrap; pointer-events: none;
  box-shadow: var(--shadow); z-index: 5; color: var(--paper);
}
.chart-tip strong { font-variant-numeric: tabular-nums; }
.chart-foot { margin-block-start: 10px; font-size: 13px; }
.chart-foot strong { color: var(--paper); font-variant-numeric: tabular-nums; }

.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar-row { display: grid; grid-template-columns: 92px 1fr auto; gap: 10px; align-items: center; }
.hbar-label { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { background: var(--ink-3); border-radius: 4px; height: 12px; overflow: hidden; }
.hbar-fill {
  display: block; height: 100%; min-width: 2px;
  border-start-end-radius: 4px; border-end-end-radius: 4px;
  width: 0; transition: width .8s var(--ease);
}
.hbars.is-in .hbar-fill { width: var(--w); }
.hbar-value { font-size: 12px; color: var(--paper); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Meters & split bars (attendance, cash vs online) ─────── */
.meter { background: var(--ink-3); border-radius: 4px; height: 12px; overflow: hidden; }
.meter-fill {
  display: block; height: 100%; width: 0;
  border-start-end-radius: 4px; border-end-end-radius: 4px;
  background: var(--accent); transition: width .9s var(--ease);
}
.meter-fill--ok { background: linear-gradient(90deg, var(--aqua), #2E9E5B); }
.meters .is-in .meter-fill { width: var(--w); }
.meter-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.meter-row + .meter-row { margin-block-start: 10px; }
.meter-row .muted { font-size: 12px; }
.meters { display: flex; flex-direction: column; }

.splitbar { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; }
.splitbar span { display: block; transition: width .9s var(--ease); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-block-start: 10px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend .linekey { display: inline-block; width: 14px; height: 2px; border-radius: 2px; }

/* ── Tables ──────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: start; color: var(--muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: .07em; font-weight: 700; padding: 8px 10px; border-block-end: 1px solid var(--line);
}
.table td { padding: 11px 10px; border-block-end: 1px solid var(--line); vertical-align: top; }
.table tbody tr, .table tr { transition: background .12s; }
@media (hover: hover) {
  .table tr:hover { background: rgba(57, 135, 229, .05); }
}
.table--card { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.table.kv th { width: 140px; border-block-end: 1px solid var(--line); }
.table.kv td { border-block-end: none; }
.row--current { background: var(--accent-soft); }
.row--muted { opacity: .5; }
.row--in td:first-child { border-inline-start: 3px solid var(--ok); }
.actions-cell { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ── Tags / dots ─────────────────────────────────────────── */
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600; background: var(--ink-3); color: var(--muted);
}
.tag--draft { background: var(--ink-3); color: var(--muted); }
.tag--on_sale { background: var(--accent-soft); color: #7FB5F5; }
.tag--doors_open { background: var(--aqua-soft); color: var(--ok-text); }
.tag--closed { background: rgba(214, 69, 69, .16); color: var(--bad-text); }
.tag--approved { background: var(--aqua-soft); color: var(--ok-text); }
.tag--pending { background: var(--amber-soft); color: var(--warn-text); }
.tag--cash { background: var(--accent-soft); color: #7FB5F5; }
.tag--online { background: var(--aqua-soft); color: var(--ok-text); }
.tag--in { background: var(--aqua-soft); color: var(--ok-text); }
.tag--super { background: var(--accent); color: #fff; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 99px; background: var(--ink-3); }
.dot--sent { background: var(--ok); }
.dot--failed { background: var(--bad); }
.dot--skipped { background: var(--ink-3); }
.dot--pending { background: var(--warn); }

/* ── Buttons / forms ─────────────────────────────────────── */
.btn {
  display: inline-block; padding: 8px 16px; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--ink-3); color: var(--paper); border: 1px solid var(--line-2);
  font: inherit; font-weight: 600; text-decoration: none;
  transition: border-color .15s, background .15s, transform .06s, box-shadow .15s;
}
.btn:hover { border-color: var(--muted); text-decoration: none; }
/* Keep breathing room between a form's action button and the link after it */
.form .btn + a { margin-inline-start: 12px; display: inline-block; vertical-align: middle; }
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: linear-gradient(180deg, #4A94EE, var(--accent));
  border-color: var(--accent); color: #fff;
  box-shadow: 0 4px 14px rgba(57, 135, 229, .25);
}
.btn--primary:hover { background: linear-gradient(180deg, #5BA0F2, #3E8BE8); }
.btn--ghost { background: transparent; }
.btn--danger { background: transparent; border-color: var(--bad); color: var(--bad-text); }
.btn--danger:hover { background: rgba(214, 69, 69, .12); }
.btn--sm { padding: 4px 11px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-block: 12px; }
.btn-row form { margin: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

form { margin: 0; }
.stack > * + * { margin-block-start: 14px; }
.stack label, .form label { display: block; font-size: 13px; color: var(--muted); }
.form label.pill-check { display: inline-flex; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 620px) { .form-row { grid-template-columns: 1fr; } }

input, select, textarea {
  width: 100%; margin-block-start: 5px; padding: 9px 11px;
  background: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--paper); font: inherit;
  resize: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.code-input { font-size: 26px; letter-spacing: .4em; text-align: center; }
.field-err { color: var(--bad-text); font-size: 12px; margin-block-start: 4px; }
.perms { border: 0; padding: 0; margin: 0; }
.perms legend { color: var(--muted); font-size: 13px; padding-inline: 0; margin-block-end: 8px; }

/* Permission toggle chips — checkbox visually hidden, pill carries the state */
.perm-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill-check { position: relative; display: inline-flex; }
.pill-check input {
  position: absolute; inset: 0; opacity: 0; margin: 0;
  width: 100%; height: 100%; cursor: pointer;
}
.pill-face {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 99px;
  border: 1px solid var(--line-2); background: var(--ink-2); color: var(--muted);
  font-size: 13px; font-weight: 600; pointer-events: none;
  transition: color .15s, background .15s, border-color .15s, box-shadow .15s;
}
.pill-ic { width: 14px; height: 14px; opacity: 0; transform: scale(.5); transition: opacity .15s, transform .18s var(--ease); }
.pill-check input:hover + .pill-face { color: var(--paper); border-color: var(--line-2); background: var(--ink-3); }
.pill-check input:focus-visible + .pill-face { box-shadow: 0 0 0 3px var(--accent-soft); }
.pill-check input:checked + .pill-face {
  color: #7FB5F5; background: var(--accent-soft); border-color: var(--accent-line);
}
.pill-check input:checked + .pill-face .pill-ic { opacity: 1; transform: none; }
.perm-pills--sm .pill-face { padding: 4px 11px; font-size: 12px; }
.perm-pills--sm .pill-ic { width: 12px; height: 12px; }

.inline-form { display: inline-flex; gap: 4px; align-items: center; }
.inline-form input { width: 150px; margin: 0; padding: 4px 8px; font-size: 12px; }
.perms-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── Search / results / flash ────────────────────────────── */
.searchbar { display: flex; gap: 8px; margin-block-end: 14px; }
.searchbar input { margin: 0; }
.searchbar .btn { flex: none; }
.manual-code { max-width: 480px; margin-block-start: 18px; }

.flash {
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: var(--radius); padding: 10px 14px; margin-block-end: 16px; font-size: 14px;
}
.flash--err { background: rgba(214, 69, 69, .12); border-color: var(--bad); }

.result { border-radius: var(--radius); padding: 16px; margin-block: 14px; display: flex; gap: 14px; align-items: center; font-size: 18px; font-weight: 700; }
.result--ok { background: var(--aqua-soft); border: 1px solid var(--ok); color: var(--ok-text); }
.result--warn { background: var(--amber-soft); border: 1px solid var(--warn); color: var(--warn-text); }
.result--none { background: var(--ink-3); border: 1px solid var(--line); color: var(--muted); }
.result .mono { font-size: 14px; font-weight: 400; }

.doors { margin-inline-start: auto; }

/* ── Range pills (dashboard time filter) ─────────────────── */
.rangebar { display: flex; gap: 6px; font-size: 13px; }
.rangebar a {
  padding: 4px 12px; border-radius: 99px; color: var(--muted);
  border: 1px solid var(--line); font-weight: 600;
  transition: color .12s, background .12s, border-color .12s;
}
.rangebar a:hover { color: var(--paper); text-decoration: none; border-color: var(--line-2); }
.rangebar a.on { color: var(--paper); background: var(--accent-soft); border-color: var(--accent-line); }

/* ── Event info / countdown ─────────────────────────────── */
.quickfacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; margin-block-end: 4px; }
.qfact { display: grid; gap: 3px; }
.qfact-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 700; }
.qfact-value { font-weight: 700; font-size: 14px; }
.qfact-value.big { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.qfact-value.big small { font-size: 13px; font-weight: 600; color: var(--muted); }

/* ── Auth / scanner ──────────────────────────────────────── */
.auth-card { max-width: 420px; margin: 60px auto; }
.scanner { max-width: 520px; margin-block: 14px; }
.scanner video { border-radius: var(--radius); }
#banner .result { max-width: 520px; }

@media (prefers-reduced-motion: no-preference) {
  .btn, .nav a, input, select, textarea { transition-duration: .15s; }
}
/* ── Organizations ──────────────────────────────────────── */
.org-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.org-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.org-card-actions { display: flex; gap: 8px; }
.org-swatch {
  width: 14px; height: 14px;
  border-radius: 4px;
  flex: none;
  box-shadow: 0 0 0 1px rgba(255,255,255,.15);
}
.org-swatch--lg { width: 20px; height: 20px; border-radius: 6px; display: inline-block; vertical-align: -4px; }
/* Org logo shown in place of the color swatch when one is set */
.org-avatar {
  width: 20px; height: 20px;
  border-radius: 5px;
  object-fit: cover;
  flex: none;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(255,255,255,.22);
  vertical-align: -5px;
}
.org-avatar--lg { width: 28px; height: 28px; border-radius: 8px; vertical-align: -7px; }
/* Image previews in the org branding form */
.img-preview {
  margin: 4px 0 2px;
  border: 1px dashed var(--line, #3a3a3a);
  border-radius: 10px;
  padding: 8px;
  background: rgba(255,255,255,.03);
}
.img-preview img {
  width: 72px; height: 72px;
  object-fit: cover; border-radius: 8px; display: block;
  background: #fff;
}
.img-preview--wide img { width: 100%; height: 150px; object-fit: cover; }
.img-preview--bad { opacity: .55; border-style: solid; }
/* Image upload widget */
.img-upload { margin-bottom: 14px; }
.img-upload__label { display: block; font-size: 13px; margin-bottom: 6px; }
.img-upload__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.img-upload__btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px dashed var(--line-2, #4a4a4a); border-radius: 9px;
  padding: 8px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .15s;
}
.img-upload__btn:hover { background: rgba(255,255,255,.05); }
.img-upload__btn svg { width: 16px; height: 16px; }
.img-upload__remove {
  background: none; border: 0; color: #e57373;
  font: inherit; font-size: 13px; cursor: pointer; padding: 4px;
}
.img-upload__remove:hover { text-decoration: underline; }
.img-upload__status { font-size: 12.5px; color: var(--muted); }
.img-upload__status--err { color: #e57373; }
/* Checkbox rows (event settings) */
.check-row { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; cursor: pointer; }
.check-row input { width: auto; margin-top: 3px; }

/* ── Toggle switch (replaces the default checkbox) ────────── */
.form label.switch-line, .stack label.switch-line {
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; width: fit-content; margin-block-end: 14px; color: var(--paper);
}
.switch-line input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch {
  flex: none; position: relative;
  width: 44px; height: 26px; border-radius: 999px;
  background: #d1d5db;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.18);
  transition: background .2s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,.3);
  transition: transform .2s cubic-bezier(.4,0,.2,1);
}
.switch-line input:checked ~ .switch { background: #34c759; }
.switch-line input:checked ~ .switch::after { transform: translateX(18px); }
[dir="rtl"] .switch-line input:checked ~ .switch::after { transform: translateX(-18px); }
.switch-line input:focus-visible ~ .switch { box-shadow: 0 0 0 4px rgba(52,199,89,.3); }
.switch-label { display: grid; gap: 2px; font-size: 13.5px; }
.switch-hint { font-size: 12px; opacity: .6; max-width: 55ch; }
/* Approvals page: empty state + off notice */
.approvals-empty { text-align: center; padding: 44px 24px; }
.approvals-empty__icon {
  width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 50%;
  background: rgba(46, 127, 208, .12); color: #2e7fd0;
  display: grid; place-items: center;
}
.approvals-empty__icon svg { width: 30px; height: 30px; }
.approvals-empty h2 { font-size: 18px; margin: 0 0 6px; }
.approvals-empty p { max-width: 46ch; margin: 0 auto; }
.approvals-off { border-inline-start: 3px solid #2e7fd0; padding: 14px 18px; margin-bottom: 18px; }
.approvals-off p { margin: 4px 0 0; }
/* Thumbnail next to the event name in the events list */
.ev-row { display: flex; align-items: flex-start; gap: 10px; }
.ev-thumb {
  width: 44px; height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex: none;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(255,255,255,.14);
}

/* Public event page link on the events list */
.public-link { color: #7FB5F5; font-size: 12px; direction: ltr; unicode-bidi: embed; }
/* Texts in other languages: spacing between add buttons, panels, and hint text */
fieldset [data-i18n-show] { margin-block-end: 10px; }
.i18n-panel { margin-block-end: 18px; padding-block-end: 6px; border-block-end: 1px solid var(--line); }
.i18n-panel:last-child { margin-block-end: 0; }

/* Ticket tier rows: 3 fields + compact remove button on one line */
.tier-row { grid-template-columns: 1.2fr 0.7fr 0.7fr 1.1fr auto auto; align-items: end; }
.tier-row .tier-remove { margin-block-end: 2px; }
.tier-active { display: flex; align-items: center; gap: 8px; padding-block: 8px; cursor: pointer; }
.tier-active input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.tier-active .tier-active-label { font-size: 12px; white-space: nowrap; opacity: .75; }

/* Per-tier enable switch: checked colors (same look as the approvals switch) */
.tier-active input:checked ~ .switch { background: #34c759; }
.tier-active input:checked ~ .switch::after { transform: translateX(18px); }
[dir="rtl"] .tier-active input:checked ~ .switch::after { transform: translateX(-18px); }

/* Event link row on the overview: URL + copy button inline */
.qfact--link .event-link-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.event-link { font-size: 13px; word-break: break-all; }
.copy-btn { flex: none; }

/* ── Payments-pending banner (self-serve orgs awaiting approval) ── */
.pay-banner {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 20px 0; padding: 10px 14px;
  border: 1px solid #e0b25c; border-radius: var(--radius);
  background: #fdf3df; color: #7a5518; font-size: 13px; font-weight: 500;
}
.pay-banner svg { width: 18px; height: 18px; flex: none; }
.flash--warn {
  border: 1px solid #e0b25c; background: #fdf3df; color: #7a5518;
}
.tag--approved { background: #e2f3e6; color: #1d7a36; }
.tag--pending { background: #fdf3df; color: #7a5518; }
.btn-row { display: flex; gap: 8px; align-items: center; }

/* ── Onboarding wizard stepper ── */
.wizard { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; }
.wizard-step { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; }
.wizard-num {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; flex: none;
  background: var(--line-1, #2a3441); color: var(--ink, #e8e8e8);
}
.wizard-step.is-active .wizard-num { background: var(--accent, #3b82f6); color: #fff; }
.wizard-step.is-done { color: var(--ok-text, #7bc98a); }
.wizard-step.is-done .wizard-num { background: var(--ok-text, #7bc98a); color: #0f1720; }
.wizard-step.is-dim { opacity: .45; }
.wizard-label { white-space: nowrap; }
.wizard-bar { flex: 1; height: 2px; background: var(--line-1, #2a3441); border-radius: 2px; }

/* ── Confirm dialog ──────────────────────────────────────────────────────
   In-page confirmation for one-way actions (opening/closing doors), in
   place of the browser's window.confirm. Driven by data-confirm on a form;
   see the handler in partials/foot.ejs. */
.cfm[hidden] { display: none; }
.cfm {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center; padding: 20px;
  background: rgba(5, 7, 11, .66);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: cfm-fade .14s var(--ease);
}
.cfm-card {
  width: 100%; max-width: 430px;
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 22px 18px;
  animation: cfm-pop .18s var(--ease);
}
.cfm-head { display: flex; align-items: flex-start; gap: 13px; }
.cfm-icon {
  flex: none; display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(214, 69, 69, .14); color: var(--bad-text);
}
.cfm-icon svg { width: 20px; height: 20px; }
.cfm-title { font-size: 16px; font-weight: 700; color: var(--paper); line-height: 1.35; overflow-wrap: anywhere; }
.cfm-msg { margin-block-start: 11px; font-size: 13.5px; line-height: 1.65; color: var(--muted); }
.cfm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-block-start: 20px; }
@media (max-width: 420px) {
  .cfm-actions { flex-direction: column-reverse; }
  .cfm-actions .btn { width: 100%; text-align: center; }
}
@keyframes cfm-fade { from { opacity: 0; } }
@keyframes cfm-pop { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@media (prefers-reduced-motion: reduce) {
  .cfm, .cfm-card { animation: none; }
}

/* Phones zoom in on any field under 16px when it's tapped; keep them at 16px. */
@media (max-width: 900px) {
  input:not(.code-input):not(.otp-input), select, textarea { font-size: 16px !important; }
}

/* Ticket tiers on a phone: the six-column row is unusable below ~760px
   (30px-wide inputs, the date field off-screen). Each tier becomes a card:
   name and expiry full width, price and quota side by side, the enable
   switch and the remove button on a line of their own. */
@media (max-width: 760px) {
  .tier-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    align-items: start;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--ink-3);
    margin-block-end: 12px;
  }
  .tier-f--name, .tier-f--expires { grid-column: 1 / -1; }
  .tier-row .tier-active { grid-column: 1; padding-block: 0; align-self: center; }
  .tier-row .tier-remove { grid-column: 2; justify-self: end; align-self: center; margin: 0; }
  .tier-row input[type="datetime-local"] { min-width: 0; }
}

.nowrap { white-space: nowrap; }
