@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/vazirmatn.woff2') format('woff2-variations'), url('/fonts/vazirmatn.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --blue: #1198f2;
  --blue-d: #0b6fd6;
  --cyan: #1ec6ea;
  --pink: #e8177e;
  --orange: #f29a00;
  --green: #15a35a;
  --green-l: #1dcb6f;

  --bg: #f4f7fb;
  --bg-grad: radial-gradient(1200px 500px at 100% -10%, rgba(30, 198, 234, .12), transparent 60%),
             radial-gradient(900px 500px at -10% 0%, rgba(232, 23, 126, .07), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --ink: #12263d;
  --ink-2: #3c536b;
  --muted: #6c8199;
  --line: #e3eaf2;
  --line-2: #eef2f7;
  --present-bg: #effbf4;
  --present-line: #bfe9d0;
  --present-ink: #0f7a43;
  --pending-bg: #fff6e8;
  --pending-ink: #9a5d00;
  --danger: #d23b5d;
  --danger-bg: #fff0f3;
  --focus: 0 0 0 4px rgba(17, 152, 242, .18);
  --shadow-sm: 0 1px 2px rgba(18, 38, 61, .05), 0 2px 8px rgba(18, 38, 61, .04);
  --shadow: 0 10px 30px rgba(18, 38, 61, .08);
  --shadow-lg: 0 24px 60px rgba(18, 38, 61, .18);
  --radius: 18px;
  --topbar-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1422;
    --bg-grad: radial-gradient(1200px 500px at 100% -10%, rgba(30, 198, 234, .10), transparent 60%),
               radial-gradient(900px 500px at -10% 0%, rgba(232, 23, 126, .08), transparent 60%);
    --surface: #121e30;
    --surface-2: #17253a;
    --ink: #e8f0fa;
    --ink-2: #c0cfdf;
    --muted: #8ba0b8;
    --line: #22334b;
    --line-2: #1c2b40;
    --present-bg: #0f2a22;
    --present-line: #1f5a40;
    --present-ink: #5fe0a0;
    --pending-bg: #2e2412;
    --pending-ink: #f5c26b;
    --danger-bg: #351a24;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 150px; }
body {
  margin: 0;
  font-family: 'Vazirmatn', Tahoma, system-ui, sans-serif;
  font-feature-settings: 'ss01';
  color: var(--ink);
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
svg { display: block; }
.c-pink { color: var(--pink); }
.c-orange { color: var(--orange); }
.c-blue { color: var(--blue); }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px; border-radius: 14px; border: 1px solid transparent;
  font-weight: 700; font-size: 15px; white-space: nowrap;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 20px; height: 20px; flex: none; }
dialog:focus, dialog:focus-visible, .sheet-inner:focus { outline: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, .icon-btn:focus-visible, .seg button:focus-visible { outline: none; box-shadow: var(--focus); }
.btn-primary { background: linear-gradient(135deg, var(--blue), var(--blue-d)); color: #fff; box-shadow: 0 8px 18px rgba(17, 152, 242, .25); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.icon-btn {
  width: 42px; height: 42px; display: inline-grid; place-items: center; flex: none;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }

.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.field input, .field textarea, .select {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); outline: none; font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 76px; resize: vertical; }
.field input:focus, .field textarea:focus, .select:focus { border-color: var(--blue); box-shadow: var(--focus); }
.form-error { color: var(--danger); font-size: 14px; margin: 0 0 10px; min-height: 0; }
.form-error:empty { display: none; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; margin: 4px 0 14px; cursor: pointer; line-height: 1.8; }
.check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--blue); flex: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

/* ---------- login ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: 28px; padding: 32px 26px 26px; box-shadow: var(--shadow); text-align: center;
}
.login-card .field { text-align: right; }
.login-logo { width: 96px; height: auto; margin: 0 auto 10px; display: block; filter: drop-shadow(0 10px 22px rgba(17, 152, 242, .18)); }
.login-title { font-size: 22px; margin: 0 0 4px; font-weight: 800; }
.login-sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line-2);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 1360px; margin: 0 auto; height: var(--topbar-h);
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 40px; height: auto; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.brand-text strong { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { font-size: 12px; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 8px; position: relative; }

.live {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px;
  border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap;
  background: var(--present-bg); color: var(--present-ink); border: 1px solid var(--present-line);
}
.live i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; position: relative; }
.live[data-state="live"] i::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid currentColor;
  animation: pulse 1.8s ease-out infinite;
}
.live[data-state="connecting"], .live[data-state="offline"] { background: var(--pending-bg); color: var(--pending-ink); border-color: transparent; }
.live[data-state="offline"] { background: var(--danger-bg); color: var(--danger); }
@keyframes pulse { from { opacity: .7; transform: scale(.6); } to { opacity: 0; transform: scale(1.6); } }

.online-avatars { display: flex; flex-direction: row-reverse; }
.online-avatars .avatar { width: 32px; height: 32px; font-size: 13px; border: 2px solid var(--surface); margin-inline-start: -8px; }
.online-avatars .more-count { background: var(--surface-2); color: var(--ink-2); }

.menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 50; min-width: 240px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 6px;
  box-shadow: var(--shadow-lg); animation: pop .14s ease-out;
}
.menu-user { padding: 10px 12px 12px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; display: flex; flex-direction: column; }
.menu-user span { font-size: 12px; color: var(--muted); text-align: right; }
.menu button {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: right;
  padding: 11px 12px; border: 0; border-radius: 10px; background: none; font-size: 14px; font-weight: 600;
}
.menu button:hover { background: var(--surface-2); }
.menu button svg { width: 18px; height: 18px; color: var(--muted); }
.menu button.danger, .menu button.danger svg { color: var(--danger); }
body:not(.is-admin) .admin-only { display: none !important; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

.offline-bar {
  position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top)); z-index: 25;
  background: var(--danger); color: #fff; text-align: center; font-size: 13px; font-weight: 600; padding: 8px 16px;
}

/* ---------- layout ---------- */
.wrap { max-width: 1360px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left)); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-main, .stat-mini {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.stat-main { display: flex; align-items: center; gap: 18px; }
.stat-main-text { flex: 1; min-width: 0; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; display: block; }
.stat-big { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.stat-big strong { font-size: 34px; font-weight: 800; color: var(--green); line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat-big span { color: var(--muted); font-size: 14px; }
.stat-big b { color: var(--ink); }
.stat-mini strong { display: block; font-size: 28px; font-weight: 800; line-height: 1.4; margin-top: 2px; font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; margin-top: 8px; }
.bar div { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--green-l), var(--green)); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.ring {
  --p: 0; width: 76px; height: 76px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--green) calc(var(--p) * 1%), var(--line-2) 0);
  transition: --p .5s;
}
.ring::before { content: ''; grid-area: 1 / 1; width: 60px; height: 60px; border-radius: 50%; background: var(--surface); }
.ring span { grid-area: 1 / 1; position: relative; font-weight: 800; font-size: 16px; }
@property --p { syntax: '<number>'; inherits: false; initial-value: 0; }

/* ---------- search ---------- */
.searchbar {
  position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top)); z-index: 20;
  margin: 0 -4px 14px; padding: 8px 4px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.search { position: relative; }
.search input {
  width: 100%; height: 56px; border-radius: 16px; border: 1.5px solid var(--line);
  background: var(--surface); padding: 0 50px 0 50px; font-size: 17px; outline: none;
  box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s;
}
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus { border-color: var(--blue); box-shadow: var(--focus); }
.search-icon { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-icon svg { width: 22px; height: 22px; }
.search-clear {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--surface-2); color: var(--ink-2);
  display: grid; place-items: center;
}
.search-clear svg { width: 18px; height: 18px; }
.filters { display: flex; gap: 10px; margin-top: 10px; align-items: center; }
.seg {
  display: flex; flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px;
  box-shadow: var(--shadow-sm); min-width: 0;
}
.seg button {
  flex: 1; border: 0; background: none; border-radius: 10px; padding: 8px 6px; font-size: 14px; font-weight: 700;
  color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .15s, color .15s;
}
.seg button b { font-size: 12px; font-weight: 700; background: var(--line-2); color: var(--ink-2); border-radius: 99px; padding: 0 7px; min-width: 22px; }
.seg button[aria-selected="true"] { background: var(--ink); color: var(--surface); }
.seg button[aria-selected="true"] b { background: rgba(255, 255, 255, .18); color: inherit; }
.select { width: auto; min-width: 150px; max-width: 220px; min-height: 46px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-sm); }

/* ---------- roster table ---------- */
.roster-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.roster-meta { padding: 10px 16px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line-2); }
.roster-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.roster { width: 100%; border-collapse: collapse; text-align: right; }
.roster th {
  font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2);
  padding: 11px 12px; white-space: nowrap; border-bottom: 1px solid var(--line);
}
.roster td { padding: 9px 12px; font-size: 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; white-space: nowrap; }
.roster tbody tr:last-child td { border-bottom: 0; }
.roster tbody tr { cursor: pointer; transition: background .2s; }
.roster tbody tr:hover td { background: var(--surface-2); }
.roster tbody tr.present td { background: var(--present-bg); }
.roster tbody tr.present:hover td { background: color-mix(in srgb, var(--present-bg) 80%, var(--green) 6%); }
.roster tbody tr.flash td { animation: rowflash 1.4s ease-out; }
@keyframes rowflash { 0% { background: color-mix(in srgb, var(--green) 30%, var(--surface)); } }
.roster .c-num { width: 1%; text-align: center; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; padding-inline: 10px 6px; }
.roster .c-name { white-space: normal; min-width: 150px; }
.roster .c-phone { direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.roster .c-course, .roster .c-status { white-space: normal; min-width: 90px; max-width: 220px; font-size: 13.5px; }
.roster .c-guests { text-align: center; }
.roster .c-time { font-variant-numeric: tabular-nums; }
.roster .c-act { width: 1%; text-align: left; }
.r-name { font-weight: 700; font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.r-sub { font-size: 12px; color: var(--muted); font-weight: 500; line-height: 1.6; }
.r-by { font-size: 12px; color: var(--present-ink); font-weight: 600; display: flex; align-items: center; gap: 4px; }
.r-by svg { width: 13px; height: 13px; flex: none; }
.dash { color: var(--line); }
.m-only { display: none; }
.roster .pill { white-space: nowrap; }
.row-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap;
  height: 38px; padding: 0 14px; border-radius: 11px; border: 0; font-weight: 800; font-size: 13.5px;
  transition: transform .12s, filter .15s;
}
.row-btn:active { transform: scale(.95); }
.row-btn svg { width: 17px; height: 17px; }
.row-go { background: linear-gradient(135deg, var(--green-l), var(--green)); color: #fff; box-shadow: 0 6px 14px rgba(21, 163, 90, .22); }
.row-go:hover { filter: brightness(1.05); }
.row-go:disabled { opacity: .6; }
.row-undo { background: var(--danger-bg); color: var(--danger); min-width: 64px; }
.tag { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); vertical-align: 2px; }
.tag-walkin { background: color-mix(in srgb, var(--cyan) 15%, var(--surface)); border-color: transparent; color: var(--blue-d); }

.avatar {
  width: 44px; height: 44px; border-radius: 14px; flex: none; display: grid; place-items: center;
  font-weight: 800; font-size: 17px; color: #fff; background: var(--av, var(--blue));
}
.avatar-lg { width: 56px; height: 56px; border-radius: 18px; font-size: 22px; }
.more { width: 100%; margin-top: 12px; }

/* ---------- empty ---------- */
.empty { text-align: center; padding: 48px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty strong { font-size: 17px; }
.empty span { color: var(--muted); font-size: 14px; max-width: 420px; }
.empty .btn { margin-top: 10px; }
.empty-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.empty-art { width: 76px; height: 76px; border-radius: 24px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--muted); margin-bottom: 6px; }
.empty-art svg { width: 34px; height: 34px; }

/* ---------- add button ---------- */
.btn-add {
  min-height: 42px; padding: 0 14px; border-radius: 12px; font-size: 14px; gap: 6px;
  background: linear-gradient(135deg, var(--pink), #c80f69); color: #fff; box-shadow: 0 6px 16px rgba(232, 23, 126, .25);
}
.btn-add .add-icon svg { width: 19px; height: 19px; }

/* ---------- dialogs / sheets ---------- */
dialog.sheet {
  border: 0; padding: 0; background: transparent; color: var(--ink);
  max-width: 100vw; max-height: 100dvh; width: 100%; margin: auto auto 0;
}
dialog.sheet::backdrop { background: rgba(8, 18, 32, .45); backdrop-filter: blur(3px); }
dialog.sheet[open] { animation: sheet-up .22s cubic-bezier(.2, .8, .2, 1); }
dialog.sheet[open]::backdrop { animation: fade .2s ease-out; }
@keyframes sheet-up { from { transform: translateY(30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.sheet-inner {
  background: var(--surface); border-radius: 26px 26px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  max-height: 92dvh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.sheet-grip { width: 42px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 10px; }
.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.sheet-head h2 { margin: 0; font-size: 19px; font-weight: 800; flex: 1; overflow-wrap: anywhere; line-height: 1.5; }
.sheet-title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.sheet-title h2 { flex: none; }
.sheet-actions { display: flex; gap: 10px; margin-top: 8px; }
.sheet-actions .btn { flex: 1; }
.sheet-small .sheet-inner h2 { margin: 6px 0 6px; font-size: 18px; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 99px; background: var(--pending-bg); color: var(--pending-ink); }
.pill.ok { background: var(--present-bg); color: var(--present-ink); }

.details { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.detail { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; min-width: 0; }
.detail span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.detail strong { display: block; font-size: 14.5px; font-weight: 700; overflow-wrap: anywhere; }
.detail a { color: var(--blue); text-decoration: none; }
.detail.wide { grid-column: 1 / -1; }
.checked-box {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; margin-bottom: 14px;
  background: var(--present-bg); border: 1px solid var(--present-line); color: var(--present-ink); font-size: 14px; font-weight: 600;
}
.checked-box svg { width: 22px; height: 22px; flex: none; }
.guest-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); }
.guest-row > div > span { display: block; font-size: 12px; color: var(--muted); }
.guest-row strong { font-size: 15px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); width: max-content; }
.stepper button { width: 46px; height: 46px; border: 0; background: var(--surface-2); font-size: 22px; font-weight: 700; color: var(--ink-2); }
.stepper button:active { background: var(--line); }
.stepper output { min-width: 48px; text-align: center; font-weight: 800; font-size: 18px; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.detail-actions .btn { flex: 1 1 140px; }
.btn-undo { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.btn-checkin-lg { background: linear-gradient(135deg, var(--green-l), var(--green)); color: #fff; box-shadow: 0 8px 18px rgba(21, 163, 90, .25); }
.link-btn { background: none; border: 0; color: var(--blue); font-weight: 700; font-size: 14px; padding: 6px 0; }
.link-btn.danger { color: var(--danger); }
.edit-grid { margin-top: 4px; }
.sub-actions { display: flex; justify-content: space-between; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-2); }

/* import */
.drop {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; cursor: pointer;
  border: 2px dashed var(--line); border-radius: 18px; padding: 26px 16px; margin-bottom: 14px; background: var(--surface-2);
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.drag { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 6%, var(--surface)); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop span { font-size: 13px; color: var(--muted); max-width: 440px; }
.drop-icon { color: var(--blue); }
.drop-icon svg { width: 34px; height: 34px; }
.preview-summary { font-size: 15px; margin: 0 0 10px; }
.preview-summary b { color: var(--green); font-size: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); }
.chip b { color: var(--blue-d); }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; }
.table-scroll table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.table-scroll th, .table-scroll td { padding: 8px 12px; text-align: right; border-bottom: 1px solid var(--line-2); }
.table-scroll th { background: var(--surface-2); color: var(--muted); font-weight: 700; }
.modes { border: 0; padding: 0; margin: 0 0 6px; }

/* toasts */
.toasts {
  position: fixed; z-index: 100; left: 50%; transform: translateX(-50%);
  bottom: calc(90px + env(safe-area-inset-bottom)); width: min(440px, calc(100vw - 24px));
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 12px; border-radius: 16px;
  background: #13263c; color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 600;
  animation: toast-in .25s cubic-bezier(.2, .8, .2, 1);
}
.toast.out { animation: toast-out .2s ease-in forwards; }
.toast .t-icon { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; flex: none; background: rgba(255, 255, 255, .12); }
.toast .t-icon svg { width: 18px; height: 18px; }
.toast.success .t-icon { background: var(--green); }
.toast.warn .t-icon { background: var(--orange); }
.toast.error .t-icon { background: var(--danger); }
.toast .t-text { flex: 1; line-height: 1.6; }
.toast button { border: 0; background: rgba(255, 255, 255, .14); color: #fff; font-weight: 800; padding: 8px 12px; border-radius: 10px; font-size: 13px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

.scrim { position: fixed; inset: 0; background: rgba(8, 18, 32, .4); z-index: 39; animation: fade .2s; }

/* ---------- responsive ---------- */
@media (min-width: 720px) {
  dialog.sheet { width: min(560px, calc(100vw - 32px)); margin: auto; }
  dialog.sheet-wide { width: min(760px, calc(100vw - 32px)); }
  dialog.sheet-small { width: min(420px, calc(100vw - 32px)); }
  dialog.sheet[open] { animation: pop .18s ease-out; }
  .sheet-inner { border-radius: 26px; padding: 22px 24px 22px; max-height: 88dvh; }
  .sheet-grip { display: none; }
}

@media (max-width: 1100px) {
  .roster .c-prov, .roster .c-status { display: none; }
}

@media (max-width: 900px) {
  .roster .c-time { display: none; }
  .roster .r-by.m-only { display: flex; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stat-main { grid-column: 1 / -1; }
}

@media (max-width: 719px) {
  :root { --topbar-h: 58px; --radius: 16px; }
  .wrap { padding-top: 12px; }
  .brand img { width: 34px; }
  .brand-text strong { font-size: 15px; }
  .online { display: none; }
  .live b { display: none; }
  .live { padding: 0; width: 32px; justify-content: center; }
  .stats { gap: 8px; margin-bottom: 6px; }
  .stat-main { padding: 10px 14px; gap: 14px; }
  .ring { width: 54px; height: 54px; }
  .ring::before { width: 42px; height: 42px; }
  .ring span { font-size: 13px; }
  .stat-label { font-size: 12px; }
  .stat-big strong { font-size: 26px; }
  .bar { margin-top: 4px; height: 6px; }
  .stat-mini { padding: 8px 12px; border-radius: 14px; }
  .stat-mini .stat-label { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stat-mini strong { font-size: 20px; line-height: 1.35; }
  .searchbar { margin-bottom: 10px; }
  .search input { height: 52px; font-size: 16px; }
  .filters { flex-direction: column; align-items: stretch; gap: 8px; }
  .select { max-width: none; width: 100%; }
  .seg button { font-size: 13px; padding: 8px 2px; gap: 4px; }
  .roster .c-phone, .roster .c-course, .roster .c-guests, .roster .c-state { display: none; }
  .roster .m-only { display: block; }
  .roster .r-by.m-only { display: flex; }
  .roster td { padding: 9px 8px; }
  .roster th { padding: 10px 8px; }
  .roster .c-num { padding-inline: 8px 2px; }
  .roster .c-name { min-width: 0; }
  .r-name { font-size: 14.5px; }
  .row-btn { height: 42px; padding: 0 12px; }
  .roster-meta { padding: 8px 12px; }
  .btn-add { width: 42px; padding: 0; }
  .btn-add .add-label { display: none; }
  .grid2 { grid-template-columns: 1fr; }
}

@media (max-width: 350px) {
  .seg button b { display: none; }
}

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