/* ==========================================================================
   Badgin design system
   One stylesheet, no build step. Logical properties throughout so the
   Arabic (RTL) interface mirrors correctly.
   ========================================================================== */

:root {
  /* Neutrals carry a slight blue bias toward the brand colour. */
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --line: #e1e5ee;
  --line-strong: #c9d0de;
  --ink: #141b2d;
  --ink-2: #3c4559;
  --muted: #687389;

  --brand: #2f4fd6;
  --brand-ink: #1f38a8;
  --brand-soft: #e8edfd;

  --side-bg: #111a2e;
  --side-ink: #c4cbdb;
  --side-ink-strong: #ffffff;
  --side-hover: #1b2640;
  --side-active: #23315a;

  --ok: #11795a;   --ok-bg: #e2f4ec;
  --warn: #a35a06; --warn-bg: #fdf0dc;
  --bad: #c0331c;  --bad-bg: #fbe6e2;
  --info: #2f4fd6; --info-bg: #e8edfd;
  --neutral-bg: #eef0f5;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(20, 27, 45, .06), 0 1px 1px rgba(20, 27, 45, .04);
  --shadow-lg: 0 12px 32px rgba(20, 27, 45, .16);

  --font: "IBM Plex Sans", "IBM Plex Sans Arabic", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;

  --side-w: 248px;
  --side-w-compact: 72px;
  --top-h: 60px;
}

html[dir="rtl"] { --font: "IBM Plex Sans Arabic", "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif; }

*, *::before, *::after { box-sizing: border-box; }

body.bd {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.bd a { color: var(--brand); text-decoration: none; }
.bd a:hover { color: var(--brand-ink); }
.bd :focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.bd h1, .bd h2, .bd h3, .bd h4 { color: var(--ink); font-family: var(--font); margin: 0; line-height: 1.25; text-wrap: balance; }
.bd .num, .bd .tabular { font-variant-numeric: tabular-nums; }
.bd .mono { font-family: var(--font-mono); font-size: .92em; }
.bd .muted { color: var(--muted); }
.bd .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.bd [hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .bd *, .bd *::before, .bd *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.shell.is-compact { grid-template-columns: var(--side-w-compact) minmax(0, 1fr); }

.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--side-bg); color: var(--side-ink);
  display: flex; flex-direction: column; z-index: 40;
}
.side__brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: var(--side-ink-strong); font-weight: 700; font-size: 17px; letter-spacing: .01em; }
.side__brand:hover { color: var(--side-ink-strong); }
.side__logo { width: 32px; height: 32px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; flex: none; }
.side__logo svg { width: 18px; height: 18px; }
.side__nav { padding: 6px 10px 16px; display: grid; gap: 2px; }
.side__group { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #7f8aa3; padding: 16px 10px 6px; }
.side__link {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px;
  color: var(--side-ink); font-weight: 500; white-space: nowrap;
}
.bd .side__link { color: var(--side-ink); }
.side__link i { width: 18px; text-align: center; font-size: 15px; opacity: .85; flex: none; }
.bd .side__link:hover { background: var(--side-hover); color: var(--side-ink-strong); }
.bd .side__link.is-active { background: var(--side-active); color: var(--side-ink-strong); }
.side__link.is-active i { color: #8ea5ff; opacity: 1; }
.side__count { margin-inline-start: auto; font-size: 11.5px; background: rgba(255,255,255,.1); padding: 1px 7px; border-radius: 999px; }
.side__foot { margin-top: auto; padding: 12px 10px 16px; border-top: 1px solid rgba(255,255,255,.07); }
.side__toggle { background: none; border: 0; color: var(--side-ink); width: 100%; text-align: start; padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; gap: 12px; align-items: center; font: inherit; }
.side__toggle:hover { background: var(--side-hover); color: #fff; }

.shell.is-compact .side__label, .shell.is-compact .side__group, .shell.is-compact .side__count, .shell.is-compact .side__brand span { display: none; }
.shell.is-compact .side__link, .shell.is-compact .side__toggle { justify-content: center; }
.shell.is-compact .side__toggle i { transform: scaleX(-1); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 30; height: var(--top-h);
  display: flex; align-items: center; gap: 14px; padding-inline: 24px;
  background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.top__burger { display: none; }
.top__spacer { flex: 1; }

.event-switch { position: relative; }
.event-switch__btn {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 9px; padding: 6px 12px; cursor: pointer; font: inherit; color: var(--ink); max-width: 420px;
}
.event-switch__btn:hover { border-color: var(--line-strong); }
.event-switch__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-switch__dates { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.menu {
  position: absolute; inset-inline-start: 0; top: calc(100% + 6px); min-width: 300px; max-height: 60vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 60;
}
.menu--end { inset-inline-start: auto; inset-inline-end: 0; min-width: 220px; }
.menu__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 7px; border: 0; background: none; font: inherit; color: var(--ink); text-align: start; cursor: pointer; }
.bd .menu__item { color: var(--ink); }
.menu__item:hover, .menu__item:focus-visible { background: var(--surface-2); }
.menu__item.is-current { background: var(--brand-soft); }
.menu__sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu__label { font-size: 11.5px; color: var(--muted); padding: 8px 10px 4px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }

.user-btn { display: flex; align-items: center; gap: 10px; border: 0; background: none; cursor: pointer; font: inherit; color: var(--ink); padding: 4px 6px; border-radius: 8px; }
.user-btn:hover { background: var(--surface-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--lg { width: 44px; height: 44px; font-size: 15px; }

.content { padding: 24px 28px 48px; width: 100%; max-width: 1440px; }

@media (max-width: 991px) {
  .shell, .shell.is-compact { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(84vw, 300px); transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  html[dir="rtl"] .side { transform: translateX(100%); }
  .shell.is-open .side { transform: none; }
  .shell.is-compact .side__label, .shell.is-compact .side__group, .shell.is-compact .side__count, .shell.is-compact .side__brand span { display: revert; }
  .side__toggle { display: none; }
  .scrim { position: fixed; inset: 0; background: rgba(15, 22, 40, .45); z-index: 35; }
  .top { padding-inline: 14px; gap: 8px; }
  .top__burger { display: inline-flex; }
  .event-switch__dates { display: none; }
  .event-switch__btn { max-width: 52vw; }
  .content { padding: 18px 16px 40px; }
  .user-btn .user-name { display: none; }
}

/* --------------------------------------------------------------------------
   Page header, breadcrumbs, tabs
   -------------------------------------------------------------------------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 8px; list-style: none; padding: 0; }
.crumbs li + li::before { content: "/"; margin-inline-end: 6px; color: var(--line-strong); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; margin-bottom: 20px; }
.page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 72ch; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: thin; }
.tab { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.bd .tab { color: var(--muted); }
.bd .tab:hover { color: var(--ink); }
.bd .tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.tab .chip { margin-inline-start: 6px; }

/* --------------------------------------------------------------------------
   Surfaces & layout helpers
   -------------------------------------------------------------------------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel__head h2 { font-size: 15.5px; font-weight: 650; }
.panel__head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.panel__body { padding: 18px; }
.panel__foot { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.stack { display: grid; gap: 16px; }
.row-gap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Metrics
   -------------------------------------------------------------------------- */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.metric { background: var(--surface); padding: 14px 18px; display: grid; gap: 2px; align-content: start; }
.bd a.metric { color: inherit; }
.bd a.metric:hover { background: var(--surface-2); }
.metric__label { font-size: 12.5px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.metric__value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.metric__sub { font-size: 12.5px; color: var(--muted); }
.metric--alert .metric__value { color: var(--warn); }
.metric--bad .metric__value { color: var(--bad); }
.metric--ok .metric__value { color: var(--ok); }

.meter { height: 6px; background: var(--neutral-bg); border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.meter--ok > span { background: var(--ok); }

/* Simple bar charts (server-rendered) */
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: end; gap: 4px; height: 150px; padding-top: 8px; }
.bars__col { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 6px; min-width: 0; }
.bars__bar { align-self: end; background: var(--brand); border-radius: 4px 4px 1px 1px; min-height: 2px; position: relative; opacity: .85; }
.bars__bar.is-zero { background: var(--line); opacity: 1; }
.bars__col:hover .bars__bar { opacity: 1; }
.bars__label { font-size: 10.5px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; }
.bars__bar[data-value]:hover::after { content: attr(data-value); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 13.5px; }
.hbar .meter { grid-column: 1 / -1; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn-b {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 7px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; font-size: 14px; line-height: 1.2; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.bd .btn-b { color: var(--ink); }
.bd .btn-b:hover { background: var(--surface-2); border-color: var(--muted); color: var(--ink); }
.btn-b:disabled, .btn-b[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.bd .btn-b--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.bd .btn-b--primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.bd .btn-b--danger { background: var(--surface); border-color: #efc2b9; color: var(--bad); }
.bd .btn-b--danger:hover { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.bd .btn-b--danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.bd .btn-b--danger-solid:hover { background: #a02a16; color: #fff; }
.bd .btn-b--ghost { border-color: transparent; background: transparent; }
.bd .btn-b--ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-b--sm { min-height: 32px; padding: 5px 10px; font-size: 13px; }
.btn-b--lg { min-height: 46px; padding: 10px 20px; font-size: 15px; }
.btn-b--icon { padding: 0; width: 36px; min-height: 36px; }
.btn-b--block { width: 100%; }
@media (pointer: coarse) { .btn-b { min-height: 44px; } .btn-b--sm { min-height: 38px; } }

/* --------------------------------------------------------------------------
   Chips (status)
   -------------------------------------------------------------------------- */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; line-height: 1; padding: 5px 9px; border-radius: 999px; white-space: nowrap; background: var(--neutral-bg); color: var(--ink-2); }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.chip--plain::before { display: none; }
.chip--ok { background: var(--ok-bg); color: var(--ok); }
.chip--warn { background: var(--warn-bg); color: var(--warn); }
.chip--bad { background: var(--bad-bg); color: var(--bad); }
.chip--info { background: var(--info-bg); color: var(--info); }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label { font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.field__hint { font-size: 12.5px; color: var(--muted); }
.field__error { font-size: 12.5px; color: var(--bad); font-weight: 500; }
.req::after { content: " *"; color: var(--bad); }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 14.5px;
  transition: border-color .12s, box-shadow .12s;
}
.textarea { min-height: 96px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23687389' stroke-width='1.6' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-inline-end: 34px; }
html[dir="rtl"] .select { background-position: left 12px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 79, 214, .16); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--bad); }
.input--sm, .select--sm { min-height: 34px; padding-block: 5px; font-size: 13.5px; }
.input-icon { position: relative; }
.input-icon i { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-inline-start: 36px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.check small { display: block; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 14px; }
.fieldset legend { font-weight: 650; font-size: 15px; margin-bottom: 4px; padding: 0; }
.upload { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2); }
.upload img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }

/* --------------------------------------------------------------------------
   Filters bar
   -------------------------------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.filters .input-icon { flex: 1 1 240px; }
.filters .select { width: auto; flex: 0 1 180px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.quick a { font-size: 13px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); background: var(--surface); }
.bd .quick a { color: var(--ink-2); }
.bd .quick a.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* --------------------------------------------------------------------------
   Data table (becomes cards on phones)
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.dt { width: 100%; border-collapse: collapse; font-size: 14px; }
.dt th { text-align: start; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.dt th a { color: var(--muted); display: inline-flex; gap: 4px; align-items: center; }
.dt td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dt tr:last-child td { border-bottom: 0; }
.dt tbody tr:hover { background: #fafbfd; }
.dt tr.is-selected { background: var(--brand-soft); }
.dt .col-check { width: 44px; }
.dt .col-actions { text-align: end; white-space: nowrap; }
.dt .person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dt .person strong { display: block; font-weight: 600; }
.dt .person small { color: var(--muted); display: block; }
.dt input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--brand); }
@media (max-width: 760px) {
  .dt--cards thead { display: none; }
  .dt--cards, .dt--cards tbody, .dt--cards tr, .dt--cards td { display: block; width: 100%; }
  .dt--cards tr { border-bottom: 1px solid var(--line); padding: 10px 14px; position: relative; }
  .dt--cards td { border: 0; padding: 4px 0; }
  .dt--cards td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
  .dt--cards td.col-check { position: absolute; inset-inline-end: 12px; top: 12px; width: auto; }
  .dt--cards td.col-actions { text-align: start; padding-top: 8px; }
}

.bulkbar {
  position: sticky; bottom: 12px; z-index: 20; margin: 12px auto 0; width: fit-content; max-width: calc(100% - 24px);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px 8px 16px;
  background: var(--ink); color: #fff; border-radius: 12px; box-shadow: var(--shadow-lg);
}
.bulkbar__count { font-weight: 600; margin-inline-end: 6px; }
.bd .bulkbar .btn-b { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #fff; }
.bd .bulkbar .btn-b:hover { background: rgba(255,255,255,.16); }
.bd .bulkbar .btn-b--danger { color: #ffb4a6; }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); border-top: 1px solid var(--line); }
.pager nav { display: flex; gap: 4px; flex-wrap: wrap; }
.pager__link { min-width: 34px; height: 34px; display: inline-grid; place-items: center; padding: 0 8px; border-radius: 7px; border: 1px solid var(--line); color: var(--ink-2); background: var(--surface); }
.bd .pager__link { color: var(--ink-2); }
.pager__link.is-current { background: var(--brand); border-color: var(--brand); color: #fff; }
.bd .pager__link.is-current { color: #fff; }
.pager__link.is-disabled { opacity: .45; pointer-events: none; }

/* --------------------------------------------------------------------------
   Empty states, alerts, toasts
   -------------------------------------------------------------------------- */
.empty { text-align: center; padding: 44px 20px; display: grid; justify-items: center; gap: 8px; }
.empty__icon { width: 52px; height: 52px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 22px; margin-bottom: 6px; }
.empty h3 { font-size: 16px; }
.empty p { color: var(--muted); max-width: 52ch; margin: 0 0 8px; }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); border: 1px solid; font-size: 14px; }
.notice i { margin-top: 3px; }
.notice--info { background: var(--info-bg); border-color: #c6d2fa; color: #1f347f; }
.notice--warn { background: var(--warn-bg); border-color: #f2d3a6; color: #6e3d03; }
.notice--bad { background: var(--bad-bg); border-color: #f0c0b6; color: #7c1f0f; }
.notice--ok { background: var(--ok-bg); border-color: #b8e2cf; color: #0b4f3a; }
.notice p { margin: 2px 0 0; }

.bd-toasts { position: fixed; inset-block-end: 18px; inset-inline-end: 18px; display: grid; gap: 8px; z-index: 100; max-width: min(420px, calc(100vw - 36px)); }
.bd-toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; animation: toast-in .2s ease-out; }
.bd-toast--ok i { color: #6fe0b0; } .bd-toast--bad i { color: #ff9c8a; } .bd-toast--warn i { color: #ffcf7a; } .bd-toast--info i { color: #9db1ff; }
.bd-toast button { margin-inline-start: auto; background: none; border: 0; color: #aab3c5; cursor: pointer; font-size: 16px; line-height: 1; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* --------------------------------------------------------------------------
   Dialog
   -------------------------------------------------------------------------- */
.dialog { border: 0; padding: 0; border-radius: 14px; box-shadow: var(--shadow-lg); width: min(480px, calc(100vw - 32px)); color: var(--ink); }
.dialog::backdrop { background: rgba(15, 22, 40, .5); }
.dialog__body { padding: 22px 22px 10px; display: grid; gap: 10px; }
.dialog__body h2 { font-size: 18px; }
.dialog__body p { margin: 0; color: var(--ink-2); }
.dialog__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; flex-wrap: wrap; }
.dialog--wide { width: min(640px, calc(100vw - 32px)); }

/* --------------------------------------------------------------------------
   Checklist (event setup)
   -------------------------------------------------------------------------- */
.checklist { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.checklist li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist__dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; border: 2px solid var(--line-strong); color: var(--muted); counter-increment: step; }
.checklist__dot::before { content: counter(step); }
.checklist li.is-done .checklist__dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.checklist li.is-done .checklist__dot::before { content: "✓"; }
.checklist strong { display: block; }
.checklist small { color: var(--muted); }

/* --------------------------------------------------------------------------
   Misc
   -------------------------------------------------------------------------- */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 18px; border-bottom: 1px solid var(--line); font-size: 14px; }
.list-row:last-child { border-bottom: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot--ok { background: var(--ok); } .dot--bad { background: var(--bad); } .dot--warn { background: var(--warn); } .dot--muted { background: var(--line-strong); }
.code-chip { font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); padding: 2px 6px; border-radius: 5px; overflow-wrap: anywhere; }
.copy-field { display: flex; gap: 8px; }
.copy-field .input { font-family: var(--font-mono); font-size: 13px; }

/* --------------------------------------------------------------------------
   Auth / public pages
   -------------------------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth__side { background: var(--side-bg); color: #d5dbe8; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth__side h2 { color: #fff; font-size: 30px; font-weight: 700; max-width: 18ch; }
.auth__side p { max-width: 46ch; color: #aeb7cb; }
.auth__badge { position: absolute; inset-inline-end: -40px; bottom: 60px; width: 240px; height: 340px; border-radius: 18px; background: linear-gradient(160deg, #2a3b6e, #182544); border: 1px solid rgba(255,255,255,.08); transform: rotate(-8deg); box-shadow: var(--shadow-lg); padding: 22px; display: grid; align-content: space-between; }
.auth__badge span { display: block; height: 10px; border-radius: 5px; background: rgba(255,255,255,.14); margin-bottom: 8px; }
.auth__badge .qr { width: 86px; height: 86px; border-radius: 8px; background: repeating-conic-gradient(rgba(255,255,255,.75) 0 25%, transparent 0 50%) 0 0 / 14px 14px; justify-self: end; }
.auth__form { display: grid; place-items: center; padding: 40px 20px; background: var(--surface); }
.auth__card { width: min(400px, 100%); display: grid; gap: 18px; }
.auth__card h1 { font-size: 24px; }
@media (max-width: 900px) { .auth { grid-template-columns: minmax(0, 1fr); } .auth__side { display: none; } }

.public { min-height: 100vh; background: var(--bg); }
.public__hero { background: var(--side-bg); color: #fff; padding: 36px 20px 80px; background-size: cover; background-position: center; position: relative; }
.public__hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(17,26,46,.65), rgba(17,26,46,.9)); }
.public__hero > * { position: relative; }
.public__inner { max-width: 760px; margin: 0 auto; }
.public__hero h1 { color: #fff; font-size: clamp(24px, 4vw, 34px); }
.public__hero .meta { color: #c7cee0; display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; }
.public__card { max-width: 760px; margin: -56px auto 40px; padding: 0 16px; }
.lang-switch { display: flex; gap: 4px; justify-content: flex-end; margin-bottom: 18px; }
.bd .lang-switch a { color: #c7cee0; font-size: 13px; padding: 4px 9px; border-radius: 6px; border: 1px solid rgba(255,255,255,.18); }
.bd .lang-switch a.is-active { background: #fff; color: var(--ink); }

/* --------------------------------------------------------------------------
   Access control (scanner) — full screen, no sidebar
   -------------------------------------------------------------------------- */
body.scanner { background: #0b1222; color: #e6eaf3; min-height: 100vh; }
.sc { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.sc__top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #111a2e; border-bottom: 1px solid #1d2943; flex-wrap: wrap; }
.sc__event { font-weight: 650; color: #fff; }
.sc__sub { font-size: 12.5px; color: #93a0bb; }
.sc__top .select { background-color: #18233d; border-color: #2a3858; color: #fff; min-height: 38px; width: auto; max-width: 46vw; }
.bd .sc__top .btn-b { background: #18233d; border-color: #2a3858; color: #dbe2f1; }
.bd .sc__top .btn-b:hover { background: #22304f; color: #fff; }
.sc__stage { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; padding: 16px; min-height: 0; }
@media (max-width: 900px) { .sc__stage { grid-template-columns: minmax(0, 1fr); padding: 12px; } .sc__side { display: none; } }
.sc__cam { position: relative; background: #050a16; border-radius: 16px; overflow: hidden; min-height: 320px; display: grid; place-items: center; border: 1px solid #1d2943; }
.sc__cam #reader { width: 100%; max-width: 560px; }
.sc__cam #reader video { border-radius: 12px; }
.sc__frame { position: absolute; width: min(62vw, 280px); aspect-ratio: 1; border-radius: 18px; box-shadow: 0 0 0 9999px rgba(5,10,22,.35); pointer-events: none; outline: 3px solid rgba(255,255,255,.75); outline-offset: -3px; }
.sc__hint { position: absolute; bottom: 14px; inset-inline: 14px; text-align: center; color: #c7cee0; font-size: 14px; }
.sc__msg { max-width: 360px; text-align: center; padding: 24px; color: #c7cee0; display: grid; gap: 12px; justify-items: center; }
.sc__msg i { font-size: 34px; color: #8ea5ff; }
.sc__manual { display: flex; gap: 8px; padding: 0 16px 16px; }
.sc__manual .input { background: #111a2e; border-color: #2a3858; color: #fff; }
.sc__side { display: grid; gap: 12px; align-content: start; }
.sc__card { background: #111a2e; border: 1px solid #1d2943; border-radius: 14px; padding: 14px 16px; }
.sc__card h3 { color: #93a0bb; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; margin-bottom: 10px; }
.sc__stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sc__stat b { display: block; font-size: 26px; color: #fff; font-variant-numeric: tabular-nums; }
.sc__stat span { font-size: 12.5px; color: #93a0bb; }
.sc__recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.sc__recent li { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.sc__recent .t { color: #93a0bb; font-variant-numeric: tabular-nums; }
.sc__recent .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #e6eaf3; }
.sc__foot { padding: 8px 14px; font-size: 12px; color: #6f7c99; display: flex; gap: 12px; justify-content: space-between; flex-wrap: wrap; }

.verdict { position: fixed; inset: 0; z-index: 90; display: grid; grid-template-rows: auto 1fr auto; text-align: center; color: #fff; padding: 28px 20px calc(24px + env(safe-area-inset-bottom, 0px)); animation: verdict-in .14s ease-out; }
.verdict--ok { background: #0d7a52; }
.verdict--bad { background: #b42a15; }
.verdict--dup { background: #8a5a05; }
.verdict__word { font-size: clamp(44px, 11vw, 96px); font-weight: 800; letter-spacing: .02em; line-height: 1; }
.verdict__reason { font-size: clamp(17px, 3.4vw, 24px); margin-top: 10px; font-weight: 500; }
.verdict__person { display: grid; justify-items: center; align-content: center; gap: 10px; }
.verdict__photo { width: min(38vw, 180px); aspect-ratio: 1; border-radius: 20px; object-fit: cover; background: rgba(255,255,255,.16); display: grid; place-items: center; font-size: 48px; font-weight: 700; border: 3px solid rgba(255,255,255,.55); }
.verdict__name { font-size: clamp(22px, 5vw, 36px); font-weight: 700; }
.verdict__meta { font-size: 16px; opacity: .9; }
.verdict__chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.verdict__chips span { background: rgba(0,0,0,.2); border: 1px solid rgba(255,255,255,.25); padding: 5px 10px; border-radius: 999px; font-size: 13.5px; }
.verdict__bar { height: 4px; background: rgba(255,255,255,.3); border-radius: 2px; overflow: hidden; max-width: 320px; width: 100%; margin: 0 auto 14px; }
.verdict__bar span { display: block; height: 100%; background: #fff; transform-origin: left; animation: verdict-timer linear forwards; }
html[dir="rtl"] .verdict__bar span { transform-origin: right; }
@keyframes verdict-in { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
@keyframes verdict-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* --------------------------------------------------------------------------
   Legacy compatibility: pages that still use Argon/Bootstrap markup inside
   the new shell get the same surfaces, type and controls.
   -------------------------------------------------------------------------- */
.bd .header.bg-gradient-primary, .bd .header.bg-primary { background: transparent !important; padding: 0 !important; }
.bd .header .mask, .bd .header .container-fluid > .header-body:empty { display: none; }
.bd .container-fluid.mt--7, .bd .mt--7, .bd .mt--8, .bd .mt--6 { margin-top: 0 !important; }
.bd .container-fluid { padding-inline: 0; }
.bd .card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.bd .card-header { background: var(--surface); border-bottom: 1px solid var(--line); padding: 14px 18px; }
.bd .card-header h3, .bd .card-header .mb-0 { font-size: 16px; font-weight: 650; color: var(--ink); }
.bd .card-body { padding: 18px; }
.bd .table thead th { font-size: 12px; color: var(--muted); background: var(--surface-2); border-color: var(--line); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.bd .table td { border-color: var(--line); vertical-align: middle; }
.bd .btn { font-family: var(--font); font-weight: 600; border-radius: var(--radius-sm); box-shadow: none; text-transform: none; letter-spacing: 0; }
.bd .btn-primary { background: var(--brand); border-color: var(--brand); }
.bd .btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
.bd .form-control { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--ink); box-shadow: none; font-family: var(--font); }
.bd .form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 79, 214, .16); }
.bd .form-control-label, .bd .form-label { color: var(--ink-2); font-weight: 600; font-size: 13.5px; }
.bd .badge { font-family: var(--font); font-weight: 600; text-transform: none; letter-spacing: 0; border-radius: 999px; }
.bd .alert { border-radius: var(--radius); }
.bd .text-primary { color: var(--brand) !important; }
.bd .bg-gradient-default, .bd .bg-default { background: var(--side-bg) !important; }

/* Segmented choice (print format PDF / JPG) */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--neutral-bg); border: 1px solid var(--line); }
.seg__btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; cursor: pointer; white-space: nowrap; }
.seg__btn:hover { color: var(--ink); }
.seg__btn.is-active, .seg__btn:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg__btn:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 1px; }
.format-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 16px; }
.format-bar__label { font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
