:root {
  --bg: #f2f6f9;
  --surface: #ffffff;
  --surface-soft: #f8fbfc;
  --ink: #132033;
  --muted: #657387;
  --line: #dfe7ed;
  --line-strong: #cbd7df;
  --primary: #00bde6;
  --primary-dark: #0096b8;
  --primary-soft: #e4f9fd;
  --accent: #dbfc01;
  --sidebar: #07111f;
  --sidebar-soft: #101d2c;
  --danger: #d33b4b;
  --success: #0d9f6e;
  --warning: #d18a00;
  --shadow: 0 12px 34px rgba(13, 35, 55, 0.08);
  --shadow-lg: 0 22px 60px rgba(13, 35, 55, 0.14);
  --radius: 16px;
  --sidebar-width: 264px;
  --sidebar-collapsed: 82px;
}

* { box-sizing: border-box; }
html {
  font-family: "Lexend", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}
body { margin: 0; min-height: 100vh; background: var(--bg); }
a { color: #087b98; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.icon { width: 1.15em; height: 1.15em; display: block; flex: 0 0 auto; }
.hidden { display: none !important; }

/* App shell and sidebar */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  color: #dce8ef;
  background:
    radial-gradient(circle at 20% 0%, rgba(0, 189, 230, 0.14), transparent 31%),
    var(--sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transition: width 180ms ease, transform 180ms ease;
}
.sidebar-header {
  min-height: 78px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--primary), #66def5);
  color: #00151b;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(0, 189, 230, 0.22);
}
.brand-mark.large { width: 64px; height: 64px; font-size: 2rem; }
.brand-copy, .user-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-copy strong { font-size: 1.08rem; letter-spacing: 0.08em; }
.brand-copy small, .user-copy small { color: #8fa3b1; font-size: 0.68rem; }
.sidebar-collapse { margin-left: auto; color: #aabac5; }
.sidebar-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 18px 12px; }
.nav-section-label {
  margin: 8px 12px 8px;
  color: #708594;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}
.nav-section-label:not(:first-child) { margin-top: 24px; }
.side-nav { display: flex; flex-direction: column; gap: 5px; }
.side-nav a, .side-nav-button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #b9c8d2;
  font-size: 0.87rem;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.side-nav a:hover, .side-nav-button:hover { background: rgba(255, 255, 255, 0.055); color: #fff; text-decoration: none; }
.side-nav a.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(0, 189, 230, 0.23), rgba(0, 189, 230, 0.07));
  box-shadow: inset 3px 0 0 var(--primary);
}
.side-nav a.active .nav-icon { color: var(--primary); }
.nav-icon { width: 20px; display: grid; place-items: center; flex: 0 0 20px; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.user-summary { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.user-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 10px;
  color: #00212a;
  background: var(--accent);
  font-size: 0.83rem;
  font-weight: 800;
}
.user-copy strong { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; font-size: 0.78rem; }
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  color: inherit;
  background: transparent;
  cursor: pointer;
}
.icon-button:hover { background: rgba(255, 255, 255, 0.08); }
.logout-button { color: #9eb0bc; }
.app-main { min-height: 100vh; margin-left: var(--sidebar-width); transition: margin-left 180ms ease; }
.mobile-topbar { display: none; }
.sidebar-overlay { display: none; }
body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
body.sidebar-collapsed .app-main { margin-left: var(--sidebar-collapsed); }
body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-section-label,
body.sidebar-collapsed .user-copy { display: none; }
body.sidebar-collapsed .sidebar-header { justify-content: center; padding-inline: 12px; }
body.sidebar-collapsed .sidebar-collapse { margin: 0; position: absolute; right: -16px; background: var(--sidebar-soft); box-shadow: 0 8px 24px rgba(0,0,0,.25); }
body.sidebar-collapsed .side-nav a,
body.sidebar-collapsed .side-nav-button { justify-content: center; padding-inline: 10px; }
body.sidebar-collapsed .sidebar-footer { justify-content: center; flex-direction: column; }
body.sidebar-collapsed .user-summary { flex: 0; }
body.sidebar-collapsed .side-nav a::after,
body.sidebar-collapsed .side-nav-button::after {
  content: attr(aria-label);
  position: fixed;
  left: 72px;
  z-index: 120;
  opacity: 0;
  pointer-events: none;
  padding: 7px 10px;
  border-radius: 8px;
  color: #fff;
  background: #142233;
  box-shadow: var(--shadow-lg);
  font-size: 0.76rem;
  transition: opacity 100ms ease;
}
body.sidebar-collapsed .side-nav a:hover::after,
body.sidebar-collapsed .side-nav-button:hover::after { opacity: 1; }

/* Content */
.container { width: min(1220px, calc(100% - 44px)); margin: 0 auto; padding: 34px 0 64px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 22px; }
.page-heading h1 { margin: 2px 0 5px; font-size: clamp(1.75rem, 4vw, 2.55rem); line-height: 1.1; letter-spacing: -0.035em; }
.page-heading p { max-width: 720px; }
.eyebrow { margin: 0; color: #0087a5; text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.68rem; font-weight: 800; }
.muted { color: var(--muted); }
.page-helper, .section-helper { margin: 5px 0 0; color: var(--muted); font-size: 0.86rem; line-height: 1.55; }
.helper-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid #c9e9f0;
  border-radius: 12px;
  color: #315966;
  background: #eefafd;
  font-size: 0.82rem;
  line-height: 1.5;
}
.helper-box .icon { margin-top: 2px; color: #0087a5; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.subcard { border: 1px solid var(--line); background: var(--surface-soft); border-radius: 12px; padding: 16px; }
.card-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.card h2, .card-heading h2 { margin: 0; font-size: 1.1rem; letter-spacing: -0.015em; }
.card-heading > div p { margin: 4px 0 0; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #fff, #f8fbfd);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.stat > span:not(.stat-icon) { display: block; color: var(--muted); font-size: 0.78rem; margin-bottom: 7px; }
.stat strong { font-size: 2rem; letter-spacing: -0.045em; }
.stat-icon { position: absolute; right: 15px; top: 15px; display: grid; place-items: center; width: 35px; height: 35px; border-radius: 10px; color: #007e9b; background: var(--primary-soft); }
.small-strong { font-size: 1.2rem !important; }
.compact-stats { grid-template-columns: repeat(2, 1fr); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 22px; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.list-row:last-child { border: 0; }
.list-row div { display: flex; flex-direction: column; min-width: 0; }
.list-row span, .list-row time { color: var(--muted); font-size: 0.78rem; }
.list-row strong, .list-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-title { display: flex; align-items: center; gap: 12px; }
.entity-title img, .avatar { width: 50px; height: 50px; border-radius: 12px; object-fit: cover; }
.avatar { display: grid; place-items: center; background: #dff7fc; color: #006c83; font-weight: 800; font-size: 1.3rem; }
.entity-title h2 { margin: 0; }
.entity-title p { margin: 3px 0; color: var(--muted); }
dl { margin: 18px 0; }
dl > div { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line); }
dt { color: var(--muted); }
dd { margin: 0; text-align: right; }
.detail-list > div { display: block; }
.detail-list dd { text-align: left; margin-top: 5px; }
.event-card { display: block; color: var(--ink); transition: 150ms transform, 150ms box-shadow, 150ms border-color; }
.event-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 16px 40px rgba(13, 35, 55, 0.13); border-color: #b9dfe7; }
.event-card h2 { font-size: 1.3rem; margin: 14px 0 4px; }
.event-card p { margin: 0; color: var(--muted); }

/* Controls */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; border: 1px solid transparent; border-radius: 10px; padding: 9px 15px; font-weight: 650; font-size: 0.84rem; cursor: pointer; text-decoration: none; white-space: nowrap; transition: 140ms transform, 140ms background, 140ms border-color; }
.button:hover { text-decoration: none; transform: translateY(-1px); }
.button-primary { background: var(--primary); color: #00171d; }
.button-primary:hover { background: var(--primary-dark); color: #fff; }
.button-secondary { background: #fff; color: var(--ink); border-color: #ccd8e0; }
.button-secondary:hover { border-color: #9db0bc; }
.button-danger { background: var(--danger); color: #fff; }
.button-danger-outline { background: #fff; color: var(--danger); border-color: #efb5bc; }
.button-small { min-height: 34px; padding: 6px 10px; font-size: 0.76rem; }
.button-block { width: 100%; }
.actions, .form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-actions { justify-content: flex-end; margin-top: 20px; }
.sticky-actions { position: sticky; bottom: 12px; padding: 12px; background: rgba(242, 246, 249, 0.92); backdrop-filter: blur(10px); border: 1px solid rgba(203, 215, 223, 0.7); border-radius: 14px; z-index: 10; }
.toolbar, .bulkbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .form-control:first-child { flex: 1; min-width: 220px; }
.bulkbar { background: #e8f8fc; border: 1px solid #b5e9f4; padding: 12px; border-radius: 12px; }
.bulkbar .muted { margin-left: auto; }
.link-button { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; color: #087b98; padding: 0; cursor: pointer; font-weight: 550; }
.link-button:hover { text-decoration: underline; }

/* Forms */
.form-card { max-width: 900px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.form-grid, .filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.filter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.form-grid .field { margin-bottom: 0; }
.field label { font-size: 0.8rem; font-weight: 650; }
.field small, .privacy { color: var(--muted); font-size: 0.72rem; line-height: 1.45; }
.field small::before { content: ""; }
.field-check { flex-direction: row; align-items: center; flex-wrap: wrap; min-height: 42px; }
.field-check label { order: 2; }
.field-check input { order: 1; }
.field-check small { order: 3; width: 100%; padding-left: 25px; }
.form-control { width: 100%; min-height: 43px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; color: var(--ink); padding: 9px 11px; outline: none; transition: border-color 140ms, box-shadow 140ms; }
.form-control:hover { border-color: #aebdc7; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 189, 230, 0.15); }
textarea.form-control { resize: vertical; }
.compact { width: auto; min-width: 120px; }
.error { color: var(--danger); font-size: 0.78rem; }
.alert { padding: 13px 16px; border-radius: 11px; background: #eaf5f8; border: 1px solid #cce9ef; margin-bottom: 16px; }
.alert-success { background: #e8f8f1; border-color: #b9e8d5; }
.alert-error, .alert-danger { background: #fff0f2; border-color: #f0b9c0; }

/* Badges and tables */
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; background: #eef2f5; color: #536174; padding: 5px 9px; font-size: 0.66rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.04em; }
.badge-active, .badge-success { background: #ddf7ed; color: #087b56; }
.badge-draft { background: #edf0f3; color: #657080; }
.badge-cancelled, .badge-closed { background: #ffe9ec; color: #a92938; }
.badge-warning { background: #fff3d8; color: #8f5b00; }
.table-card { padding: 0; overflow: hidden; }
.table-wrap { width: 100%; max-height: min(64vh, 680px); overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.table-wrap::-webkit-scrollbar-thumb { background: #c4d0d8; border: 2px solid #f7fafb; border-radius: 999px; }
.table-wrap::-webkit-scrollbar-track { background: #f7fafb; }
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 780px; }
th, td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { position: sticky; top: 0; z-index: 5; background: #f7fafb; color: #586679; box-shadow: 0 1px 0 var(--line); font-size: 0.69rem; text-transform: uppercase; letter-spacing: 0.055em; }
td { font-size: 0.83rem; }
td small { display: block; color: var(--muted); }
tbody tr:hover td { background: #fbfdfe; }
.empty { text-align: center; color: var(--muted); padding: 26px; }
.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; color: var(--muted); font-size: 0.8rem; }
.pagination > div { display: flex; gap: 8px; }

/* Filters and utilities */
.advanced { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.advanced summary { cursor: pointer; font-weight: 650; font-size: 0.83rem; }
.advanced-head { display: flex; align-items: center; justify-content: space-between; margin: 14px 0; }
.rule-row { display: grid; grid-template-columns: 1fr 1fr 1.3fr auto; gap: 8px; margin: 8px 0; }
.code-box { width: 100%; min-height: 150px; background: var(--sidebar); color: #c8f6ff; border: 0; border-radius: 10px; padding: 14px; font-family: ui-monospace, monospace; font-size: 0.76rem; }
.danger-zone { text-align: right; margin-top: 24px; }
.danger-zone a { color: var(--danger); }
.narrow { max-width: 580px; margin: 60px auto; }
.danger-card { border-color: #f0b9c0; }
.error-list { max-height: 300px; overflow: auto; color: var(--danger); }

/* Toasts */
.toast-region { position: fixed; z-index: 300; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; width: min(390px, calc(100% - 30px)); pointer-events: none; }
.toast { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 11px; padding: 13px 13px 13px 14px; border: 1px solid #c7dce3; border-radius: 13px; color: var(--ink); background: rgba(255, 255, 255, 0.98); box-shadow: 0 18px 55px rgba(13, 35, 55, 0.2); pointer-events: auto; animation: toast-in 180ms ease-out; }
.toast.toast-hiding { animation: toast-out 160ms ease-in forwards; }
.toast-symbol { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: #087b98; background: #e4f8fc; }
.toast-success .toast-symbol { color: var(--success); background: #e3f7ee; }
.toast-error .toast-symbol, .toast-danger .toast-symbol { color: var(--danger); background: #ffeaed; }
.toast-copy { min-width: 0; }
.toast-copy strong { display: block; margin: 1px 0 3px; font-size: 0.78rem; }
.toast-copy p { margin: 0; color: var(--muted); font-size: 0.75rem; line-height: 1.45; }
.toast-close { display: grid; place-items: center; width: 29px; height: 29px; padding: 0; border: 0; border-radius: 8px; color: #778591; background: transparent; cursor: pointer; }
.toast-close:hover { background: #eef3f5; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(18px) scale(.98); } }

/* Auth and public surfaces */
.auth-body, .public-body, .ticket-body { display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at top, #e8fbff, #f2f6f9 55%); min-height: 100vh; }
.auth-card, .public-card, .ticket { width: min(100%, 540px); background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 28px; box-shadow: 0 24px 80px rgba(10, 38, 56, 0.15); }
.auth-logo { display: flex; align-items: center; gap: 12px; }
.auth-logo h1 { margin: 0; }
.auth-card p { margin-top: 4px; }
.auth-card form p { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.auth-card label { font-size: 0.8rem; font-weight: 650; }
.auth-card input { width: 100%; min-height: 44px; border: 1px solid var(--line-strong); border-radius: 9px; padding: 10px; }
.public-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--muted); }
.public-brand img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.public-card h1 { font-size: clamp(1.7rem, 7vw, 2.5rem); margin-bottom: 8px; letter-spacing: -0.035em; }
.event-meta { color: #007f9d; font-weight: 600; }
.center { text-align: center; }
.success-icon { display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto; border-radius: 50%; background: #dcf9ec; color: var(--success); font-size: 2.4rem; font-weight: 900; }
.ticket-summary { display: flex; flex-direction: column; gap: 5px; background: #f3f7f9; border-radius: 12px; padding: 16px; margin: 20px 0; }
.ticket { text-align: center; }
.ticket .public-brand { justify-content: center; }
.ticket .qr { width: min(100%, 300px); display: block; margin: 22px auto; }
.ticket code { display: inline-block; padding: 8px 12px; background: #eef3f5; border-radius: 8px; }

/* Scanner */
.scanner-grid { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 20px; margin-bottom: 20px; }
.scanner-card { padding: 12px; }
.scanner-actions { display: flex; gap: 10px; padding: 12px 8px 4px; }
.scanner-card .muted { padding: 0 8px; }
.scanner-card video { width: 100%; max-height: 62vh; object-fit: cover; border-radius: 12px; background: var(--sidebar); }
.camera-placeholder, #reader:empty { min-height: 380px; display: grid; place-items: center; background: var(--sidebar); color: #bcd0dc; border-radius: 12px; }
.result-card { display: grid; place-items: center; text-align: center; min-height: 300px; }
.result-placeholder span, .result-symbol { font-size: 3rem; color: #789; }
.result-content strong { font-size: 1.35rem; }
.result-success { background: #e8f9f1; border-color: #8edcba; }
.result-warning { background: #fff7e4; border-color: #efcc7d; }
.result-error { background: #fff0f2; border-color: #eaa7b0; }

@media (max-width: 1000px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-grid { grid-template-columns: repeat(2, 1fr); }
  .scanner-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .sidebar { width: min(286px, calc(100vw - 48px)); transform: translateX(-102%); box-shadow: var(--shadow-lg); }
  .app-main, body.sidebar-collapsed .app-main { margin-left: 0; }
  body.sidebar-collapsed .sidebar { width: min(286px, calc(100vw - 48px)); }
  body.sidebar-collapsed .brand-copy,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .nav-section-label,
  body.sidebar-collapsed .user-copy { display: flex; }
  body.sidebar-collapsed .nav-section-label { display: block; }
  body.sidebar-collapsed .sidebar-header { justify-content: initial; padding: 16px; }
  body.sidebar-collapsed .sidebar-collapse { display: none; }
  body.sidebar-collapsed .side-nav a,
  body.sidebar-collapsed .side-nav-button { justify-content: flex-start; padding-inline: 12px; }
  body.sidebar-collapsed .sidebar-footer { justify-content: initial; flex-direction: row; }
  body.sidebar-collapsed .user-summary { flex: 1; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-collapse { display: none; }
  .sidebar-overlay { position: fixed; inset: 0; z-index: 90; display: block; border: 0; opacity: 0; visibility: hidden; background: rgba(2, 11, 20, 0.56); backdrop-filter: blur(2px); transition: opacity 180ms, visibility 180ms; }
  body.sidebar-open .sidebar-overlay { opacity: 1; visibility: visible; }
  .mobile-topbar { position: sticky; top: 0; z-index: 70; display: flex; align-items: center; min-height: 62px; padding: 0 14px; color: #fff; background: rgba(7, 17, 31, 0.96); backdrop-filter: blur(12px); box-shadow: 0 5px 20px rgba(0,0,0,.12); }
  .mobile-brand { display: flex; align-items: center; gap: 9px; margin-left: 7px; color: #fff; }
  .mobile-brand:hover { text-decoration: none; }
  .mobile-brand .brand-mark { width: 32px; height: 32px; flex-basis: 32px; border-radius: 9px; }
  .mobile-brand strong { font-size: 0.9rem; letter-spacing: 0.08em; }
  .mobile-spacer { flex: 1; }
  .container { width: min(100% - 24px, 1220px); padding-top: 22px; }
}

@media (max-width: 700px) {
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading > .actions { width: 100%; }
  .page-heading > .actions .button { flex: 1; }
  .grid-2, .card-grid { grid-template-columns: 1fr; }
  .form-grid, .filter-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .stat-grid { gap: 9px; }
  .stat { padding: 14px; }
  .stat strong { font-size: 1.55rem; }
  .card { padding: 17px; }
  .rule-row { grid-template-columns: 1fr 1fr; }
  .rule-row input { grid-column: span 2; }
  .rule-row button { grid-column: span 2; }
  .bulkbar .muted { width: 100%; margin-left: 0; }
  .pagination { align-items: flex-start; gap: 12px; }
  .public-card, .auth-card, .ticket { padding: 22px; border-radius: 18px; }
  .camera-placeholder, #reader:empty { min-height: 300px; }
  .table-wrap { max-height: 58vh; }
  .toast-region { right: 15px; bottom: max(15px, env(safe-area-inset-bottom)); }
}

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

/* Loading skeletons */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.skeleton {
  display: block;
  overflow: hidden;
  border-radius: 8px;
  background: #e5ebef;
  position: relative;
}
.skeleton::after,
.skeleton-table-head span::after,
.skeleton-table-row span::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.72), transparent);
  animation: skeleton-shimmer 1.25s infinite;
}
@keyframes skeleton-shimmer { 100% { transform: translateX(100%); } }
.page-loading-shell {
  position: fixed;
  inset: 0 0 0 var(--sidebar-width);
  z-index: 80;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  background: var(--bg);
  transition: opacity 120ms ease, visibility 120ms ease;
}
body.sidebar-collapsed .page-loading-shell { left: var(--sidebar-collapsed); }
body.is-page-loading .page-loading-shell { visibility: visible; opacity: 1; pointer-events: auto; }
.page-loading-content { width: min(1220px, calc(100% - 44px)); margin: 0 auto; padding: 38px 0 64px; }
.skeleton-eyebrow { width: 92px; height: 10px; margin-bottom: 13px; }
.skeleton-title { width: min(360px, 58%); height: 38px; margin-bottom: 12px; }
.skeleton-subtitle { width: min(640px, 82%); height: 15px; margin-bottom: 28px; }
.skeleton-card-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.skeleton-card { min-height: 116px; padding: 19px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.skeleton-label { width: 58%; height: 12px; margin-bottom: 20px; }
.skeleton-number { width: 34%; height: 31px; }
.skeleton-panel { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.skeleton-panel-title { width: 185px; height: 18px; margin-bottom: 22px; }
.skeleton-line { display: grid; grid-template-columns: 1.1fr 1.7fr .8fr; gap: 18px; padding: 15px 0; border-bottom: 1px solid #edf1f4; }
.skeleton-line:last-child { border-bottom: 0; }
.skeleton-line .skeleton { height: 13px; }
.table-card { position: relative; }
.table-skeleton {
  position: absolute;
  inset: 0;
  z-index: 14;
  visibility: hidden;
  opacity: 0;
  padding: 0 14px;
  background: rgba(255,255,255,.98);
  transition: opacity 100ms ease, visibility 100ms ease;
}
[data-table-shell].is-table-loading .table-skeleton { visibility: visible; opacity: 1; }
.skeleton-table-head,
.skeleton-table-row {
  display: grid;
  grid-template-columns: 38px 1.25fr 1.2fr 1.5fr 1fr 1fr;
  gap: 18px;
  align-items: center;
  min-width: 760px;
  border-bottom: 1px solid var(--line);
}
.skeleton-table-head { height: 47px; background: #f7fafb; }
.skeleton-table-row { height: 62px; }
.skeleton-table-head span,
.skeleton-table-row span { position: relative; overflow: hidden; display: block; height: 12px; border-radius: 6px; background: #e5ebef; }
.skeleton-table-head span { height: 9px; }
.skeleton-table-row span:first-child { width: 18px; height: 18px; border-radius: 4px; }

/* Registration filter drawer */
.filter-trigger { position: relative; }
.filter-count {
  display: inline-grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  margin-left: 2px;
  border-radius: 999px;
  color: #00171d;
  background: var(--accent);
  font-size: .68rem;
  font-weight: 800;
}
.filter-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: -5px 0 18px;
  padding: 11px 13px;
  border: 1px solid #b9e7f0;
  border-radius: 12px;
  background: #eafafd;
}
.filter-summary > div { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; }
.filter-summary-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px; color: #007e9b; background: #d4f4fa; }
.filter-summary span > strong,
.filter-summary span > small { display: block; }
.filter-summary span > strong { font-size: .78rem; }
.filter-summary span > small { margin-top: 2px; color: var(--muted); font-size: .7rem; }
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 210;
  visibility: hidden;
  opacity: 0;
  border: 0;
  background: rgba(4, 14, 25, .5);
  backdrop-filter: blur(2px);
  transition: opacity 180ms ease, visibility 180ms ease;
}
.filter-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 220;
  width: min(460px, 100vw);
  visibility: hidden;
  transform: translateX(102%);
  color: var(--ink);
  background: #fff;
  box-shadow: -24px 0 70px rgba(7, 25, 40, .22);
  transition: transform 200ms ease, visibility 200ms ease;
}
body.filter-drawer-open { overflow: hidden; }
body.filter-drawer-open .drawer-overlay { visibility: visible; opacity: 1; }
body.filter-drawer-open .filter-drawer { visibility: visible; transform: translateX(0); }
.drawer-form { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-height: 104px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--line);
}
.drawer-header h2 { margin: 3px 0 5px; font-size: 1.4rem; letter-spacing: -.025em; }
.drawer-header p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.drawer-close { flex: 0 0 auto; color: #647487; background: #f1f5f7; }
.drawer-close:hover { color: var(--ink); background: #e7edf1; }
.drawer-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 20px 22px 30px; }
.drawer-helper { margin-bottom: 20px; }
.drawer-form .filter-grid { grid-template-columns: 1fr; gap: 0; }
.drawer-form .field { margin-bottom: 17px; }
.drawer-form .advanced { margin-top: 7px; }
.drawer-form .advanced-head { align-items: flex-end; gap: 12px; }
.drawer-form .advanced-head label { display: flex; flex-direction: column; gap: 6px; font-size: .78rem; font-weight: 650; }
.drawer-form .rule-row { grid-template-columns: 1fr 1fr; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); }
.drawer-form .rule-row input { grid-column: span 2; }
.drawer-form .rule-row button { grid-column: span 2; justify-self: end; }
.drawer-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 22px max(15px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  box-shadow: 0 -10px 30px rgba(13,35,55,.06);
}
.drawer-footer .button-primary { min-width: 140px; }

@media (max-width: 1000px) {
  .skeleton-card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .page-loading-shell,
  body.sidebar-collapsed .page-loading-shell { inset: 62px 0 0 0; }
  .page-loading-content { width: min(100% - 24px, 1220px); padding-top: 24px; }
}
@media (max-width: 700px) {
  .skeleton-card-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .skeleton-card { min-height: 96px; padding: 15px; }
  .skeleton-line { grid-template-columns: 1fr 1.2fr; }
  .skeleton-line span:last-child { display: none; }
  .filter-summary { align-items: flex-start; flex-wrap: wrap; }
  .filter-summary > div { width: 100%; }
  .filter-summary .link-button { margin-left: 44px; }
  .filter-drawer { width: 100vw; }
  .drawer-header { padding: 18px 16px 15px; }
  .drawer-scroll { padding: 16px 16px 25px; }
  .drawer-footer { padding-inline: 16px; }
  .drawer-footer .button { flex: 1; }
}
