:root {
  --bg: #0A0A0C;
  --bg-2: #0F0F12;
  --surface: #141416;
  --surface-2: #1B1B1F;
  --surface-3: #232328;
  --line: #2A2A30;
  --line-2: #36363D;
  --text: #F6F1E7;
  --text-2: #C9C2B6;
  --muted: #8E887E;
  --gold: #F59E0B;
  --gold-2: #FBBF24;
  --gold-3: #FCD34D;
  --ember: #EA580C;
  --gold-soft: rgba(245, 158, 11, .12);
  --gold-line: rgba(245, 158, 11, .35);
  --ok: #22C55E;
  --ok-soft: rgba(34, 197, 94, .13);
  --bad: #EF4444;
  --bad-soft: rgba(239, 68, 68, .13);
  --info: #60A5FA;
  --info-soft: rgba(96, 165, 250, .13);
  --warn: #F59E0B;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 20px 50px rgba(0, 0, 0, .45);
  --font: 'IBM Plex Sans Arabic', 'Archivo', system-ui, sans-serif;
  --font-num: 'Archivo', 'IBM Plex Sans Arabic', sans-serif;
  --sidebar: 268px;
  --bottom-nav: 72px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  max-width: 100%;
  overflow-x: clip;
  overflow-wrap: break-word;
}
a { color: var(--gold-2); text-decoration: none; }
a:hover { color: var(--gold-3); }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 700; }
p { margin: 0; }
.ic { flex-shrink: 0; }
[hidden] { display: none !important; }
::selection { background: var(--gold); color: #0A0A0C; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.gold { color: var(--gold-2); }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.nowrap { white-space: nowrap; }

.shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 0 0 auto;
  width: var(--sidebar);
  background: linear-gradient(180deg, #0E0E11 0%, #0A0A0C 100%);
  border-inline-start: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 26px 16px 18px;
  z-index: 40;
  overflow-y: auto;
}
.brand { display: block; padding: 4px 12px 6px; }
.brand img { display: block; height: 52px; width: auto; }
.sidebar-role {
  margin: 10px 12px 22px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .02em;
}
.side-nav, .side-foot { display: flex; flex-direction: column; gap: 4px; }
.side-nav a, .side-foot a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  color: var(--text-2);
  font-weight: 500;
  transition: background .18s, color .18s;
}
.side-nav a:hover, .side-foot a:hover { background: var(--surface); color: var(--text); }
.side-nav a.is-active {
  background: var(--gold-soft);
  color: var(--gold-2);
  box-shadow: inset 0 0 0 1px var(--gold-line);
}
.side-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); }
.sidebar-scrim { display: none; }
.sidebar .sidebar-close { display: none; }
.side-logout { color: #FCA5A5 !important; }

.main { flex: 1; min-width: 0; margin-inline-start: var(--sidebar); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 18px 32px;
  background: rgba(10, 10, 12, .82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-title h1 { font-size: 22px; }
.topbar-title p { color: var(--muted); font-size: 13px; }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 14px; }
.me { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; padding-inline-start: 14px; border-inline-start: 1px solid var(--line); }
.me-name { font-weight: 600; }
.me-role { font-size: 12px; color: var(--muted); }
.content { padding: 28px 32px 48px; width: 100%; max-width: 1400px; }
.page-title { margin-bottom: 18px; }
.page-title h1 { font-size: 22px; }
.page-title p { color: var(--muted); font-size: 13px; }
.only-mobile { display: none !important; }

.icon-btn {
  position: relative;
  display: inline-grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: border-color .18s, color .18s;
}
.icon-btn:hover { color: var(--gold-2); border-color: var(--gold-line); }

.bell { position: relative; }
.bell-count {
  position: absolute; top: -6px; left: -6px;
  min-width: 21px; height: 21px; padding: 0 6px;
  border-radius: 999px;
  background: var(--bad);
  color: #fff;
  font: 700 11px/21px var(--font-num);
  text-align: center;
  box-shadow: 0 0 0 3px var(--bg);
}
.bell-panel {
  position: absolute; top: calc(100% + 10px); left: 0;
  width: 360px; max-width: calc(100vw - 24px);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 60;
}
.bell-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.bell-list { max-height: 380px; overflow-y: auto; }
.bell-item { display: block; padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--text); }
.bell-item:hover { background: var(--surface-2); color: var(--text); }
.bell-item.is-unread { background: linear-gradient(90deg, transparent, var(--gold-soft)); }
.bell-item strong { display: block; font-size: 14px; }
.bell-item p { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.bell-item time { font-size: 11px; color: var(--muted); }
.bell-empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.bell-all { display: block; text-align: center; padding: 12px; font-weight: 600; }
.link-btn { background: none; border: 0; color: var(--gold-2); font: inherit; font-size: 12px; cursor: pointer; padding: 6px; }

.bottom-nav { display: none; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mt { margin-top: 18px; }
.mt-lg { margin-top: 28px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 17px; }
.card-head p { color: var(--muted); font-size: 13px; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-head { padding: 20px 22px 0; }
.card-gold {
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(245, 158, 11, .16), transparent 55%),
    var(--surface);
  border-color: var(--gold-line);
}

.stat {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
}
.stat-icon {
  width: 50px; height: 50px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--gold-soft);
  color: var(--gold-2);
}
.stat.ok .stat-icon { background: var(--ok-soft); color: var(--ok); }
.stat.bad .stat-icon { background: var(--bad-soft); color: var(--bad); }
.stat.info .stat-icon { background: var(--info-soft); color: var(--info); }
.stat-body { display: flex; flex-direction: column; min-width: 0; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font: 800 26px/1.2 var(--font-num); letter-spacing: -.01em; }
.stat-hint { font-size: 12px; color: var(--text-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font: 600 14px/1 var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s, background .18s, border-color .18s, color .18s;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-gold { background: linear-gradient(135deg, var(--gold-2), var(--gold) 55%, var(--ember)); color: #0A0A0C; }
.btn-gold:hover { color: #0A0A0C; filter: brightness(1.06); }
.btn-ghost { background: var(--surface-2); border-color: var(--line-2); color: var(--text); }
.btn-ghost:hover { border-color: var(--gold-line); color: var(--gold-2); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { color: #fff; filter: brightness(1.08); }
.btn-ok { background: var(--ok); color: #05210F; }
.btn-ok:hover { color: #05210F; filter: brightness(1.06); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-warn { background: var(--gold-soft); color: var(--gold-2); }
.badge-muted { background: var(--surface-3); color: var(--text-2); }

.alert { padding: 14px 18px; border-radius: 14px; margin-bottom: 18px; font-weight: 500; border: 1px solid; }
.alert-success { background: var(--ok-soft); color: #86EFAC; border-color: rgba(34, 197, 94, .3); }
.alert-error { background: var(--bad-soft); color: #FCA5A5; border-color: rgba(239, 68, 68, .3); }
.alert-info { background: var(--info-soft); color: #BFDBFE; border-color: rgba(96, 165, 250, .3); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: start;
  font-weight: 600; font-size: 12px;
  color: var(--muted);
  padding: 12px 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255, 255, 255, .015); }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.who { display: flex; align-items: center; gap: 12px; min-width: 180px; }
.who strong { display: block; font-weight: 600; }
.who span { font-size: 12px; color: var(--muted); }

.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--surface-3); }
.avatar-fallback {
  display: inline-grid; place-items: center;
  background: linear-gradient(135deg, #2A2318, #1A1610);
  color: var(--gold-2);
  font: 700 14px var(--font-num);
  border: 1px solid var(--gold-line);
}
.avatar-lg { width: 88px; height: 88px; font-size: 26px; }

.form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field label, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field small { color: var(--muted); font-size: 12px; }
.input, .select, .textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  color: var(--text);
  font: 500 15px var(--font);
  transition: border-color .18s, box-shadow .18s;
}
.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='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238E887E' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-left: 38px;
}
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
.input[type=file] { padding: 9px; }
.input::file-selector-button {
  margin-inline-end: 10px; padding: 6px 12px;
  border-radius: 8px; border: 0;
  background: var(--surface-3); color: var(--text); font: inherit; cursor: pointer;
}
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }
.form-actions { display: flex; gap: 10px; justify-content: flex-start; flex-wrap: wrap; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar .input, .toolbar .select { min-height: 44px; width: auto; flex: 1 1 200px; }
.search { position: relative; flex: 1 1 260px; }
.search .ic { position: absolute; top: 50%; right: 14px; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-right: 42px; }

.tabs { display: flex; gap: 6px; padding: 5px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); width: fit-content; max-width: 100%; overflow-x: auto; margin-bottom: 18px; }
.tabs a { padding: 8px 16px; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: 14px; white-space: nowrap; }
.tabs a.is-active { background: var(--surface-3); color: var(--gold-2); }
.photo-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); gap: 14px; }
.photo-compare figure { margin: 0; text-align: center; }
.photo-compare img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); display: block; }
.photo-compare figure:last-child img { border-color: var(--gold-line); }
.photo-compare figcaption { margin-top: 8px; font-size: 13px; color: var(--text-2); }
.pkg-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 18px; }
.pkg-split a { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: 13px; min-width: 0; }
.pkg-split a strong { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1.1; }
.pkg-split a.is-active { border-color: var(--gold-line); background: var(--gold-soft); color: var(--gold-2); }
.pkg-split a.is-active strong { color: var(--gold-2); }

.bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--ember), var(--gold-2)); }
.bar.ok > span { background: linear-gradient(90deg, #15803D, var(--ok)); }
.bar.bad > span { background: var(--bad); }

.ring { position: relative; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--surface-3); stroke-width: 10; }
.ring-fill { fill: none; stroke: var(--gold); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset .8s ease; }
.ring-ok .ring-fill { stroke: var(--gold-2); }
.ring-warn .ring-fill { stroke: var(--ember); }
.ring-bad .ring-fill { stroke: var(--bad); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring-center strong { font: 800 34px/1 var(--font-num); }
.ring-center span { font-size: 12px; color: var(--muted); margin-top: 4px; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item strong { display: block; font-weight: 600; }
.list-item small { color: var(--muted); font-size: 12px; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 40px 16px; color: var(--muted); }
.empty .ic { color: var(--gold); opacity: .8; }
.empty strong { color: var(--text); font-size: 16px; }

.pager { display: flex; gap: 6px; justify-content: center; padding: 18px; flex-wrap: wrap; }
.pager a { min-width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); color: var(--text-2); font-family: var(--font-num); font-weight: 600; }
.pager a.is-current { background: var(--gold); color: #0A0A0C; }
.pager-gap { padding: 8px 4px; color: var(--muted); }

.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .72); backdrop-filter: blur(6px); animation: fade .18s ease; }
.modal-card { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: 22px; padding: 26px; box-shadow: var(--shadow); animation: pop .22s ease; }
.modal-sm { max-width: 420px; }
.modal-card h3 { font-size: 19px; margin-bottom: 8px; }
.modal-card > p { color: var(--text-2); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

.stars { display: inline-flex; gap: 2px; color: var(--surface-3); vertical-align: middle; }
.stars .star.on, .stars .star.half { color: var(--gold-2); }
.stars .star.on .ic { fill: currentColor; }
.stars .star.half { opacity: .6; }
.stars .star.half .ic { fill: currentColor; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

.locked { position: relative; }
.locked-overlay {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center; padding: 20px;
  background: rgba(10, 10, 12, .78);
  backdrop-filter: grayscale(1) blur(3px);
  -webkit-backdrop-filter: grayscale(1) blur(3px);
}
body.is-locked .bottom-nav, body.is-locked .sidebar { filter: grayscale(1); }
.locked-card { max-width: 440px; text-align: center; background: var(--surface); border: 1px solid var(--line-2); border-radius: 24px; padding: 34px 28px; box-shadow: var(--shadow); }
.locked-card .lock-ic { width: 72px; height: 72px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 50%; background: var(--bad-soft); color: var(--bad); }
.locked-card h2 { font-size: 22px; margin-bottom: 8px; }
.locked-card p { color: var(--text-2); }

.auth {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(245, 158, 11, .14), transparent 70%),
    var(--bg);
}
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 34px 28px; box-shadow: var(--shadow); }
.auth-logo { display: block; margin: 0 auto 8px; width: 210px; }
.auth-sub { text-align: center; color: var(--muted); margin-bottom: 26px; font-size: 14px; }
.auth-back { display: block; text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }

.barcode-box { background: #fff; padding: 6px 8px; border-radius: 14px; line-height: 0; max-width: 100%; overflow: hidden; display: inline-block; }
.barcode-box, .barcode-box svg { direction: ltr; }
.barcode-box svg { display: block; max-width: 100%; height: auto; }
.qr-stage .barcode-box { box-shadow: 0 0 0 6px var(--gold-soft); border-radius: 18px; padding: 10px 12px; }
.qr-box { background: #fff; padding: 14px; border-radius: 16px; display: inline-block; line-height: 0; }
.qr-box canvas, .qr-box img { display: block; }

.member-card {
  position: relative;
  aspect-ratio: 85.6 / 54;
  width: 100%; max-width: 480px;
  border-radius: 22px;
  padding: 22px 24px;
  background:
    radial-gradient(110% 120% at 100% 0%, rgba(245, 158, 11, .22), transparent 55%),
    linear-gradient(160deg, #17171B, #0A0A0C);
  border: 1px solid var(--gold-line);
  box-shadow: 0 30px 60px rgba(0, 0, 0, .5);
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden;
}
.member-card::after {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(115deg, transparent 0 22px, rgba(255, 255, 255, .018) 22px 23px);
  pointer-events: none;
}
.member-card .mc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; position: relative; z-index: 1; }
.member-card .mc-top img { width: 38%; }
.member-card .mc-tag { font: 700 11px var(--font-num); letter-spacing: .25em; color: var(--gold-2); padding-top: 6px; }
.member-card .mc-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; position: relative; z-index: 1; }
.member-card .mc-name { font-size: 19px; font-weight: 700; line-height: 1.3; }
.member-card .mc-sub { font-size: 12px; color: var(--muted); }
.member-card .qr-box { padding: 7px; border-radius: 12px; }

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1023px) {
  .only-mobile { display: initial !important; }
  .only-desktop { display: none !important; }
  .icon-btn.only-mobile { display: inline-grid !important; }
  .sidebar {
    top: 0; bottom: auto;
    height: 100vh;
    height: 100dvh;
    z-index: 70;
    transform: none;
    clip-path: inset(0 0 0 100%);
    visibility: hidden;
    pointer-events: none;
    transition: clip-path .26s ease, visibility 0s linear .26s;
    box-shadow: var(--shadow);
    width: min(310px, 86vw);
    padding: 18px 14px calc(28px + env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar > * { flex-shrink: 0; }
  .sidebar .sidebar-close { display: inline-grid; position: absolute; top: 14px; left: 14px; width: 40px; height: 40px; }
  .side-foot { margin-top: 18px; }
  .side-nav a, .side-foot a { min-height: 48px; }
  body.sidebar-open .sidebar { clip-path: inset(0); visibility: visible; pointer-events: auto; transition: clip-path .26s ease; }
  body.sidebar-open .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(0, 0, 0, .66); touch-action: none; }
  html.sidebar-open, html.sidebar-open body { overflow: hidden; }
  .main { margin-inline-start: 0; }
  .topbar { padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); }
  .topbar-logo { margin-inline-end: auto; }
  .topbar-logo img { display: block; height: 30px; width: auto; }
  .topbar-actions { gap: 8px; }
  .content { padding: 18px 16px calc(var(--bottom-nav) + 28px + env(safe-area-inset-bottom)); }
  .page-title { display: block !important; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }

  .bottom-nav {
    position: fixed; z-index: 45;
    left: 12px; right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    height: var(--bottom-nav);
    display: flex; align-items: stretch; justify-content: space-around;
    padding: 6px;
    border-radius: 24px;
    background: rgba(20, 20, 22, .88);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--line-2);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .55);
  }
  .bottom-nav a, .bottom-nav button {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border-radius: 18px;
    color: var(--muted);
    font: 600 11px var(--font);
    background: none; border: 0; cursor: pointer;
    position: relative;
    transition: color .18s, background .18s;
  }
  .bottom-nav a.is-active { color: var(--gold-2); background: var(--gold-soft); }
  .bottom-nav a.is-active::before {
    content: ''; position: absolute; top: 4px;
    width: 18px; height: 3px; border-radius: 3px;
    background: var(--gold-2);
    box-shadow: 0 0 12px var(--gold);
  }
}

@media (max-width: 640px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 18px; border-radius: 16px; }
  .stat { flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; }
  .stat-icon { width: 42px; height: 42px; }
  .stat-value { font-size: 22px; }
  .table-cards thead { display: none; }
  .table-cards tr { display: block; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table-cards td { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border: 0; }
  .table-cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; }
  .table-cards td.td-main { display: block; padding-bottom: 8px; }
  .table-cards td.td-main::before { display: none; }
  .table-cards .actions { justify-content: flex-start; }
  .bell-panel { position: fixed; top: 70px; left: 12px; right: 12px; width: auto; }
  .modal { align-items: end; padding: 0; }
  .modal-card { border-radius: 24px 24px 0 0; max-height: 90vh; max-height: 88dvh; padding-bottom: calc(26px + env(safe-area-inset-bottom)); overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .form-actions .btn, .modal-actions .btn { flex: 1 1 auto; }
  .toolbar .btn { flex: 1 1 auto; }
  .tabs { width: 100%; }
  .pkg-split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pkg-split a { padding: 10px 12px; }
  .kv { grid-template-columns: minmax(0, auto) minmax(0, 1fr); }
  .who { min-width: 0; }
  .copy-box strong { font-size: 16px; word-break: break-all; }
}

@media print {
  .sidebar, .topbar, .bottom-nav, .no-print { display: none !important; }
  .main { margin: 0; }
  body { background: #fff; }
}

.toasts { position: fixed; z-index: 200; top: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 24px)); pointer-events: none; }
.toast { padding: 13px 18px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-weight: 600; animation: pop .2s ease; transition: opacity .4s, transform .4s; }
.toast.out { opacity: 0; transform: translateY(-8px); }
.toast-ok { border-color: rgba(34, 197, 94, .45); color: #86EFAC; }
.toast-bad { border-color: rgba(239, 68, 68, .45); color: #FCA5A5; }
.toast-gold { border-color: var(--gold-line); color: var(--gold-3); }

.gym-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.gym-tile { display: flex; flex-direction: column; gap: 16px; color: var(--text); transition: border-color .2s, transform .2s; }
.gym-tile:hover { color: var(--text); border-color: var(--gold-line); transform: translateY(-2px); }
.gym-tile.is-off { opacity: .55; }
.gym-tile-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gym-tile-nums div { display: flex; flex-direction: column; }
.gym-tile-nums span { font-size: 12px; }
.gym-tile-nums strong { font-size: 24px; font-weight: 800; line-height: 1.2; }

.hours { display: flex; align-items: flex-end; gap: 4px; height: 130px; }
.hour { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; }
.hour-bar { width: 100%; border-radius: 6px 6px 3px 3px; background: linear-gradient(0deg, var(--ember), var(--gold-2)); min-height: 4px; }
.hour small { font-size: 10px; color: var(--muted); }

.chart-box { position: relative; height: 260px; }
.mini-ring-row { display: flex; align-items: center; gap: 14px; }
.contract-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) auto; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); color: var(--text); }
.contract-row:last-child { border-bottom: 0; }
.contract-row:hover { color: var(--text); }
.contract-row strong { display: block; }
.contract-row small { color: var(--muted); }
@media (max-width: 640px) {
  .contract-row { grid-template-columns: 1fr auto; }
  .contract-row .bar-col { grid-column: 1 / -1; order: 3; }
}

.heat { display: flex; flex-direction: column; gap: 4px; overflow-x: auto; }
.heat-row { display: grid; grid-template-columns: 64px repeat(18, minmax(14px, 1fr)); gap: 4px; align-items: center; min-width: 440px; }
.heat-row span { font-size: 12px; color: var(--muted); }
.heat-row i { display: block; aspect-ratio: 1; border-radius: 4px; background: var(--gold); }
.heat-head small { font-size: 10px; color: var(--muted); text-align: center; }
.rank { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); font-weight: 800; font-size: 13px; flex-shrink: 0; }
.rank-1 { background: linear-gradient(135deg, var(--gold-3), var(--gold)); color: #0A0A0C; }
.rank-2 { background: #C9C2B6; color: #0A0A0C; }
.rank-3 { background: #B4723C; color: #0A0A0C; }
.chip.gold { border-color: var(--gold-line); color: var(--gold-2); }

.member-hero { display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.member-hero-main { flex: 1; min-width: 240px; }
.member-hero-ring { margin-inline: auto; }
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.quick a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: 13px; transition: border-color .2s, transform .2s; }
.quick a:hover { color: var(--text); border-color: var(--gold-line); transform: translateY(-2px); }
.quick span { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 16px; background: var(--gold-soft); color: var(--gold-2); }
.card-screen { display: flex; flex-direction: column; align-items: center; gap: 26px; max-width: 520px; margin: 0 auto; }
.member-card.big { max-width: 520px; }
.qr-stage { display: flex; flex-direction: column; align-items: center; width: 100%; padding: 26px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); }
.qr-stage .qr-box { padding: 18px; border-radius: 22px; box-shadow: 0 0 0 6px var(--gold-soft); }
.rate-stars { display: flex; gap: 6px; justify-content: center; direction: ltr; }
.rate-stars input { position: absolute; opacity: 0; pointer-events: none; }
.rate-stars label { cursor: pointer; color: var(--surface-3); transition: color .15s, transform .15s; }
.rate-stars label:hover { transform: scale(1.12); }
.rate-stars label .ic { width: 40px; height: 40px; }
.rate-stars label.on { color: var(--gold-2); }
.rate-stars label.on .ic { fill: currentColor; }
.pkg-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.pkg-pick label { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 18px; border-radius: 18px; background: var(--bg-2); border: 1.5px solid var(--line-2); cursor: pointer; transition: border-color .2s, background .2s; }
.pkg-pick input { position: absolute; opacity: 0; }
.pkg-pick label:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); }
.pkg-pick label:has(input:focus-visible) { box-shadow: 0 0 0 4px var(--gold-soft); }
.pkg-pick strong { font-size: 16px; }
.pkg-pick .price-big { font: 900 26px var(--font-num); margin-top: 6px; }
.copy-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-radius: 14px; background: var(--bg-2); border: 1px dashed var(--gold-line); }
.copy-box strong { font: 800 20px var(--font-num); direction: ltr; }
@media (max-width: 640px) {
  .quick { gap: 8px; }
  .quick a { padding: 12px 4px; font-size: 12px; }
  .quick span { width: 42px; height: 42px; }
  .member-hero { flex-direction: column-reverse; align-items: stretch; }
}

.perm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 10px; }
.perm-chips .chip { font-size: 12px; padding: 4px 10px; }
.perm-group { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 14px; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.perm-group legend { padding: 0 8px; font-size: 13px; font-weight: 700; color: var(--gold-2); }
.perm-group .check { font-size: 14px; align-items: flex-start; }
.perm-group .check input { margin-top: 3px; flex-shrink: 0; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.photo-item { position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--surface-3); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-item form { position: absolute; top: 6px; left: 6px; }
.photo-item button { width: 34px; height: 34px; border-radius: 10px; border: 0; display: grid; place-items: center; background: rgba(10, 10, 12, .8); color: #FCA5A5; cursor: pointer; }

.gym-slider { position: relative; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; height: 190px; background: #1A1A1E; }
.gym-slider::-webkit-scrollbar { display: none; }
.gym-slider img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: center; }
.gym-slider-empty { display: grid; place-items: center; color: var(--gold); }
.gym-slider-count { position: sticky; left: 10px; align-self: flex-end; margin: 0 0 10px -60px; padding: 3px 10px; border-radius: 999px; background: rgba(10, 10, 12, .75); font-size: 12px; font-weight: 700; flex-shrink: 0; height: fit-content; }
.gym-hours { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 2px 0; font-size: 13px; padding: 10px 12px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.gym-hours dt { color: var(--gold-2); font-weight: 600; }
.gym-hours dd { margin: 0; color: var(--text-2); }

.support-bar { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 18px; background: rgba(37, 211, 102, .08); border: 1px solid rgba(37, 211, 102, .35); color: var(--text); }
.support-bar:hover { color: var(--text); background: rgba(37, 211, 102, .13); }
.support-bar > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; line-height: 1.4; }
.support-bar small { color: var(--text-2); font-size: 12px; }
.support-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: #25D366; color: #06240F; flex-shrink: 0; }
.btn-wa-solid { background: #25D366; color: #06240F; }
.btn-wa-solid:hover { color: #06240F; filter: brightness(1.06); }
.or-line { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.total-row td { background: var(--bg-2); border-top: 1px solid var(--line-2); }
.cam-view { width: 100%; max-width: 340px; margin: 14px auto; border-radius: 16px; overflow: hidden; background: #000; min-height: 240px; }
.cam-view video { width: 100% !important; display: block; }
.offline-bar { position: fixed; z-index: 300; top: 0; left: 0; right: 0; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: #B91C1C; color: #fff; text-align: center; font-weight: 700; font-size: 14px; }

input, select, textarea { min-width: 0; max-width: 100%; }
.toolbar > * { min-width: 0; }
.toolbar .search .input { width: 100%; }
.search { min-width: 0; }
.card-head > * { min-width: 0; }
.row > .input, .row > .select { flex: 1 1 160px; }

@media (max-width: 1023px) {
  .toolbar { align-items: stretch; }
  .toolbar .input, .toolbar .select, .toolbar .search { flex: 1 1 100%; width: 100%; }
  .toolbar > p { flex: 1 1 100% !important; }
  .content { overflow-x: clip; }
  .table-wrap { max-width: 100%; }
}
@media (max-width: 640px) {
  .table-cards { display: block; width: 100%; }
  .table-cards tbody { display: block; width: 100%; }
  .table-cards td { min-width: 0; overflow-wrap: anywhere; }
  .table-cards td > * { min-width: 0; }
  .table-cards td.nowrap { white-space: normal; }
  .perm-group { grid-template-columns: minmax(0, 1fr); }
  .gym-grid { grid-template-columns: minmax(0, 1fr); }
  .card-head { align-items: flex-start; }
  .contract-row > div:first-child { min-width: 0; }
  .who { min-width: 0; }
  .who > div { min-width: 0; }
  .stat-value { font-size: 20px; overflow-wrap: anywhere; }
  .kv dd { overflow-wrap: anywhere; min-width: 0; }
  .pkg-pick { grid-template-columns: minmax(0, 1fr); }
  .heat-row { min-width: 0; grid-template-columns: 52px repeat(18, minmax(0, 1fr)); gap: 2px; }
  .heat-row span { font-size: 10px; }
  .heat-head small { font-size: 8px; }
}
.side-install { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; border: 1px dashed var(--gold-line); background: var(--gold-soft); color: var(--gold-2); font: 600 14px var(--font); cursor: pointer; text-align: start; }
