:root {
  color-scheme: dark;
  --bg: #0d0d10;
  --surface: #18181b;
  --surface-2: #212126;
  --surface-3: #292930;
  --text: #f5f5f7;
  --muted: #949499;
  --line: rgba(255, 255, 255, .085);
  --primary: #6194ff;
  --primary-2: #24c4c8;
  --primary-soft: rgba(97, 148, 255, .16);
  --ok: #34d39a;
  --warn: #f4bc61;
  --danger: #ff6474;
  --shadow: 0 18px 46px rgba(0, 0, 0, .28);
  --radius: 24px;
  --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px));
  --content-safe-top: max(var(--tg-content-safe-area-inset-top, 0px), 12px);
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --safe-left: max(env(safe-area-inset-left, 0px), var(--tg-safe-area-inset-left, 0px));
  --safe-right: max(env(safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px));
  --app-height: 100dvh;
  --nav-h: 78px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); }
body { font: 15px/1.38 -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; touch-action:manipulation; }
button, input { font: inherit; color: inherit; }
button { border: 0; cursor:pointer; }
svg { display:block; }
.app-shell { height: var(--app-height); overflow: hidden; position: relative; }
.app { height: 100%; display: flex; flex-direction: column; }
.topbar { flex: none; padding: calc(var(--safe-top) + var(--content-safe-top) + 12px) calc(var(--safe-right) + 20px) 16px calc(var(--safe-left) + 20px); display:flex; justify-content:space-between; align-items:center; }
.brand { display:flex; align-items:baseline; }
.brand > div { display:flex; align-items:baseline; gap:9px; }
.brand h1 { margin:0; color:var(--primary); font-size:22px; line-height:1; font-weight:850; letter-spacing:-.045em; }
.brand p { margin:0; color:var(--muted); font-size:10px; font-weight:700; letter-spacing:.12em; }
.avatar { width:42px; height:42px; border-radius:15px; border:1px solid var(--line); background:var(--surface); display:grid; place-items:center; font-weight:750; color:var(--primary-2); }
.viewport { flex:1; min-height:0; position:relative; overflow:hidden; }
.screen { position:absolute; inset:0; overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; padding:6px calc(var(--safe-right) + 18px) calc(var(--nav-h) + var(--safe-bottom) + 40px) calc(var(--safe-left) + 18px); opacity:0; pointer-events:none; transform:translateX(10px); transition:.22s ease; }
.screen.active { opacity:1; pointer-events:auto; transform:none; }
.screen-inner { max-width:560px; margin:0 auto; }
.hero { margin:4px 0 22px; display:flex; align-items:flex-end; justify-content:space-between; gap:12px; }
.hero h2 { margin:0; font-size:34px; line-height:1.05; font-weight:780; letter-spacing:-.045em; }
.hero p { margin:6px 0 0; color:var(--muted); }
.count { min-width:34px; height:26px; padding:0 9px; display:grid; place-items:center; border-radius:99px; color:var(--primary); background:var(--primary-soft); font-weight:750; font-size:12px; }
.card { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); }
.dashboard { margin:2px 0 27px; padding:18px; border:1px solid var(--line); border-radius:26px; background:var(--surface); box-shadow:var(--shadow); }
.dashboard-head { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.live-label { display:inline-flex; align-items:center; gap:7px; color:var(--muted); font-size:10px; font-weight:750; letter-spacing:.13em; }
.live-label i { width:7px; height:7px; border-radius:50%; background:var(--ok); box-shadow:0 0 0 5px rgba(52,211,154,.1); }
.health-badge { min-width:48px; height:27px; display:grid; place-items:center; padding:0 10px; border-radius:99px; background:rgba(255,100,116,.13); color:var(--danger); font-size:10px; font-weight:750; }
.health-badge.ok { color:var(--ok); background:rgba(52,211,154,.13); }
.dashboard-title { display:flex; align-items:flex-end; gap:11px; margin:15px 0 14px; }
.dashboard-title > b { font-size:52px; line-height:.84; letter-spacing:-.07em; color:var(--text); font-variant-numeric:tabular-nums; }
.dashboard-title h2 { margin:0; font-size:19px; line-height:1.1; letter-spacing:-.025em; }
.dashboard-title p { margin:4px 0 0; color:var(--muted); font-size:11px; }
.dash-stats { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; }
.dash-stats > div { min-width:0; padding:10px; border-radius:16px; background:var(--surface-2); }
.dash-stats span { color:var(--primary); }
.dash-stats svg { width:15px; height:15px; }
.dash-stats b,.dash-stats em { display:block; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.dash-stats b { margin-top:5px; font-size:14px; letter-spacing:-.02em; }
.dash-stats em { margin-top:1px; color:var(--muted); font-size:8.5px; font-style:normal; }
.online-list { display:flex; align-items:center; gap:6px; margin-top:11px; min-width:0; overflow:hidden; }
.online-chip { display:inline-flex; align-items:center; min-width:0; max-width:145px; gap:6px; padding:6px 9px; border-radius:99px; background:rgba(52,211,154,.08); color:#b9c0c0; font-size:9px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.online-chip i { width:6px; height:6px; flex:none; border-radius:50%; background:var(--ok); }
.online-more { flex:none; color:var(--muted); font-size:10px; font-weight:700; }
.online-empty { color:var(--muted); font-size:10px; }
.section-head { margin:0 2px 15px; display:flex; align-items:flex-end; justify-content:space-between; gap:12px; }
.section-head h2 { margin:0; font-size:28px; line-height:1.05; letter-spacing:-.04em; }
.section-head p { margin:5px 0 0; color:var(--muted); font-size:13px; }
.toolbar { display:flex; gap:8px; margin-bottom:12px; }
.search-box { flex:1; min-width:0; height:50px; display:flex; align-items:center; gap:10px; padding:0 14px; border:1px solid var(--line); background:var(--surface); border-radius:18px; color:var(--muted); }
.search-box:focus-within { border-color:rgba(97,148,255,.5); box-shadow:0 0 0 3px rgba(97,148,255,.08); }
.search-box svg { width:20px; height:20px; flex:none; }
.search { flex:1; min-width:0; height:100%; border:0; background:transparent; padding:0; outline:none; }
.search::placeholder { color:var(--muted); }
.icon-btn { width:42px; height:42px; align-self:center; flex:none; border-radius:14px; background:var(--primary-soft); color:var(--primary); display:grid; place-items:center; }
.icon-btn svg { width:21px; height:21px; }
.user-list { display:flex; flex-direction:column; gap:10px; }
.swipe-wrap { position:relative; border-radius:22px; overflow:hidden; background:var(--surface-2); }
.swipe-actions { position:absolute; inset:0 0 0 auto; display:flex; align-items:stretch; }
.swipe-actions button { width:58px; padding:0; color:var(--primary); background:var(--surface-2); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; font-size:8px; font-weight:650; }
.swipe-actions button svg { width:20px; height:20px; }
.swipe-actions .danger { background:var(--danger); }
.swipe-actions .danger { color:#fff; }
.user-row { position:relative; z-index:1; width:100%; min-height:88px; padding:14px; display:flex; align-items:center; gap:12px; text-align:left; background:var(--surface); border:1px solid var(--line); border-radius:22px; touch-action:pan-y; transition:transform .28s cubic-bezier(.25,1,.5,1); }
.user-row:active { background:var(--surface-2); }
.user-icon { width:46px; height:46px; flex:none; border-radius:15px; display:grid; place-items:center; background:var(--surface-2); color:var(--muted); border:1px solid var(--line); }
.user-icon svg { width:23px; height:23px; }
.user-main { flex:1; min-width:0; }
.user-main b { display:block; overflow:hidden; text-overflow:ellipsis; font-size:15px; font-weight:680; }
.user-main span { display:block; color:var(--muted); font-size:12px; margin-top:3px; }
.protocols { display:flex!important; flex-wrap:wrap; gap:4px; margin-top:6px!important; }
.proto { display:inline-flex!important; width:auto; margin:0!important; padding:2px 7px; border-radius:99px; background:var(--surface-3); color:var(--muted)!important; font-size:9px!important; font-weight:700; }
.proto.primary-proto { color:var(--primary-2)!important; background:rgba(36,196,200,.11); }
.row-tail { display:flex; align-items:center; gap:9px; color:#5e5e65; }
.row-tail > svg { width:16px; height:16px; }
.dot { width:9px; height:9px; border-radius:50%; background:var(--muted); box-shadow:0 0 0 5px rgba(141,155,170,.08); }
.dot.online { background:var(--ok); box-shadow:0 0 0 5px rgba(57,217,138,.1); }
.dot.disabled { background:var(--danger); }
.primary { min-height:54px; width:100%; border-radius:18px; background:var(--primary); color:#fff; font-weight:750; }
.primary:active { transform:scale(.985); }
.secondary { min-height:50px; border-radius:17px; background:var(--surface-2); color:var(--text); font-weight:650; }
.form-card { padding:18px; overflow:hidden; }
.form-card label { display:block; color:var(--muted); font-size:12px; margin:0 0 7px 2px; }
.field { display:block; width:100%; min-width:0; max-width:100%; height:54px; padding:0 15px; border:1px solid var(--line); border-radius:17px; background:var(--surface-2); outline:none; margin-bottom:14px; }
.field[type="date"] { -webkit-appearance:none; appearance:none; }
.field:focus { border-color:var(--primary); }
.field-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:10px; width:100%; }
.field-grid > * { min-width:0; max-width:100%; overflow:hidden; }
.form-note { display:flex; gap:10px; margin:16px 2px 0; color:var(--muted); font-size:12px; }
.service-list { display:flex; flex-direction:column; overflow:hidden; }
.service { display:flex; align-items:center; gap:12px; min-height:65px; padding:12px 15px; border-bottom:1px solid var(--line); }
.service:last-child { border-bottom:0; }
.service-state { width:38px; height:38px; border-radius:13px; display:grid; place-items:center; color:var(--ok); background:rgba(57,217,138,.11); }
.service-state.bad { color:var(--danger); background:rgba(255,101,119,.11); }
.service div:nth-child(2) { flex:1; }
.service b, .service small { display:block; }
.service small { color:var(--muted); margin-top:2px; }
.service time { color:var(--muted); font-size:11px; }
.mini-action { min-height:38px; padding:0 13px; border-radius:13px; background:var(--primary-soft); color:var(--primary); font-size:12px; font-weight:700; }
.section-title { margin:22px 4px 10px; font-size:13px; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; }
.audit-list { overflow:hidden; }
.audit-row { min-height:60px; padding:11px 14px; display:flex; align-items:center; gap:11px; border-bottom:1px solid var(--line); }
.audit-row:last-child { border-bottom:0; }
.audit-icon { width:34px; height:34px; border-radius:12px; display:grid; place-items:center; color:var(--primary); background:var(--primary-soft); font-weight:800; }
.audit-row div { min-width:0; }
.audit-row b,.audit-row small { display:block; }
.audit-row small { margin-top:2px; color:var(--muted); }
.nav-shell { position:absolute; z-index:10; left:0; right:0; bottom:0; padding:8px calc(var(--safe-right) + 14px) calc(var(--safe-bottom) + 10px) calc(var(--safe-left) + 14px); pointer-events:none; }
.nav { width:min(100%,520px); height:var(--nav-h); margin:0 auto; padding:6px; display:grid; grid-template-columns:repeat(4,1fr); border:1px solid rgba(255,255,255,.12); border-radius:30px; background:rgba(28,28,31,.92); box-shadow:0 16px 44px rgba(0,0,0,.42); backdrop-filter:blur(22px) saturate(1.25); -webkit-backdrop-filter:blur(22px) saturate(1.25); pointer-events:auto; }
.nav > button { min-width:0; border-radius:24px; background:none; color:var(--muted); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; font-size:9px; font-weight:600; }
.nav > button svg { width:22px; height:22px; }
.nav > button.active { color:var(--primary); background:rgba(97,148,255,.18); box-shadow:inset 0 0 0 1px rgba(97,148,255,.22); }
.bs-root { position:fixed; inset:0; z-index:50; pointer-events:none; overflow:hidden; }
.bs-backdrop { position:absolute; inset:0; background:#000; opacity:0; pointer-events:auto; touch-action:none; will-change:opacity; }
.bs-root.closing .bs-backdrop { pointer-events:none; }
.bs-sheet { position:absolute; left:0; right:0; bottom:0; margin:0 auto; width:100%; max-width:560px; background:var(--surface); color:var(--text); border:1px solid rgba(255,255,255,.09); border-bottom:0; border-radius:32px 32px 0 0; box-shadow:0 -16px 60px rgba(0,0,0,.48); pointer-events:auto; will-change:transform; transform:translate3d(0,110vh,0); contain:layout style; display:flex; flex-direction:column; overflow:hidden; }
.bs-handle { flex:none; height:27px; display:grid; place-items:center; cursor:grab; touch-action:none; }
.bs-handle span { width:38px; height:5px; border-radius:99px; background:var(--muted); opacity:.38; }
.bs-scroll { flex:none; overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; touch-action:pan-y; }
.bs-inner { padding:0 18px calc(var(--safe-bottom) + 22px); }
.bs-footer-spacer { height:0; }
.bs-footer-box { position:absolute; left:0; right:0; bottom:0; will-change:transform; }
.bs-footer { padding:10px 18px calc(var(--safe-bottom) + 14px); background:rgba(24,24,27,.96); box-shadow:0 -1px 0 var(--line); backdrop-filter:blur(18px); }
.bs-sheet.kb .bs-inner { padding-bottom:20px; }
.bs-sheet.kb .bs-footer { padding-bottom:10px; }
.bs-scroll.has-footer .bs-inner { padding-bottom:8px; }
.bs-sheet h3 { margin:2px 0 4px; font-size:22px; letter-spacing:-.03em; }
.sheet-sub { color:var(--muted); margin:0 0 16px; }
.qr { display:block; width:min(78vw,320px); aspect-ratio:1; padding:12px; margin:14px auto; border-radius:20px; background:#fff; }
.sheet-title-row { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.sheet-protocols { margin:0 0 8px!important; }
.detail-stats { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; margin:12px 0; }
.detail-stats span { min-width:0; padding:10px; border-radius:15px; background:var(--surface-2); }
.detail-stats b,.detail-stats small { display:block; overflow:hidden; text-overflow:ellipsis; }
.detail-stats b { font-size:13px; white-space:nowrap; }
.detail-stats small { margin-top:3px; color:var(--muted); font-size:10px; }
.action-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:12px; }
.advanced { margin:14px 0 2px; border-top:1px solid var(--line); }
.advanced summary { padding:14px 2px; color:var(--muted); font-weight:650; cursor:pointer; }
.advanced button { width:100%; min-height:46px; margin:3px 0; border-radius:14px; background:var(--surface-2); text-align:left; padding:0 14px; }
.advanced .danger-text { color:var(--danger); }
.sheet-form label { display:block; margin:0 0 6px 2px; color:var(--muted); font-size:12px; }
.empty { padding:36px 22px; text-align:center; color:var(--muted); }
.skeleton { height:76px; border-radius:20px; background:linear-gradient(90deg,var(--surface) 25%,var(--surface-2) 50%,var(--surface) 75%); background-size:200% 100%; animation:shimmer 1.3s infinite; }
.toast { position:fixed; z-index:80; left:50%; bottom:calc(var(--nav-h) + var(--safe-bottom) + 14px); transform:translateX(-50%); max-width:calc(100vw - 32px); padding:11px 15px; border-radius:14px; background:var(--text); color:var(--bg); box-shadow:var(--shadow); white-space:nowrap; animation:toast-in .2s ease; }
.toast.error { background:var(--danger); color:#fff; }
@media (max-width:370px) {
  .dashboard { padding:15px; }
  .dash-stats > div { padding:9px 8px; }
  .dashboard-title > b { font-size:46px; }
  .field-grid { grid-template-columns:1fr; gap:0; }
}
@keyframes shimmer { to { background-position:-200% 0; } }
@keyframes fade { from { opacity:0; } }
@keyframes toast-in { from { opacity:0; transform:translate(-50%,8px); } }
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { animation-duration:.01ms!important; transition-duration:.01ms!important; } }

/* ===== v5: INCY-style refresh ===== */
:root {
  --bg: #0e0e11;
  --surface: #161619;
  --surface-2: #1d1d21;
  --surface-3: #26262b;
  --line: rgba(255,255,255,.07);
  --line-strong: rgba(255,255,255,.11);
  --primary: #5b8cff;
  --primary-tint: #1a2337;
  --primary-tint-2: #202c46;
  --primary-line: rgba(91,140,255,.42);
  --violet: #a78bfa;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}
.mono { font-family: var(--mono); font-feature-settings: "zero" 1; letter-spacing: -.01em; }

/* header */
.brand { align-items: baseline; gap: 10px; }
.brand h1 { font-size: 26px; font-weight: 850; letter-spacing: -.04em; }
.brand-ver { color: var(--muted); font-size: 14px; font-weight: 450; letter-spacing: 0; }
.avatar { width: 46px; height: 46px; border-radius: 14px; background: var(--surface-2); border-color: var(--line); color: var(--primary); }

/* 1. tinted buttons */
.primary { display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--primary-tint); color: var(--primary); border: 1px solid rgba(91,140,255,.16); font-weight: 650; font-size: 16px; }
.primary svg { width: 20px; height: 20px; }
.primary:active { background: var(--primary-tint-2); }
.primary:disabled { opacity: .55; }
.secondary { background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; }
.secondary:active { background: var(--surface-3); }
.mini-action, .icon-btn { background: var(--primary-tint); color: var(--primary); }

/* 2. colored icon tiles */
.tile { --c: var(--primary); width: 38px; height: 38px; flex: none; border-radius: 12px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 15%, #141418); border: 1px solid color-mix(in srgb, var(--c) 24%, transparent); }
.tile svg { width: 20px; height: 20px; }
.tile-blue { --c: #5b8cff; } .tile-violet { --c: #a78bfa; } .tile-green { --c: #34d39a; } .tile-teal { --c: #22c3c9; }
.tile-orange { --c: #f5a54a; } .tile-red { --c: #ff6474; } .tile-gray { --c: #8e8e96; }

/* 3. grouped lists */
.list-group { margin-bottom: 22px; }
.group-head { display: flex; align-items: center; gap: 10px; margin: 0 4px 10px; }
.group-head > div { flex: 1; min-width: 0; }
.group-head h3 { margin: 0; color: var(--muted); font-size: 12.5px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; }
.group-head p { margin: 3px 0 0; color: #6f6f76; font-size: 13px; }
.inset-list { display: flex; flex-direction: column; overflow: hidden; border-radius: 22px; }
.list-row { width: 100%; min-height: 66px; display: flex; align-items: center; gap: 13px; padding: 12px 14px 12px 15px; background: none; text-align: left; position: relative; }
.list-row + .list-row::before { content: ""; position: absolute; top: 0; left: 66px; right: 0; height: 1px; background: var(--line); }
button.list-row:active { background: var(--surface-2); }
.list-row > svg { width: 16px; height: 16px; color: #5e5e65; flex: none; }
.list-main { flex: 1; min-width: 0; }
.list-main b { display: block; font-size: 15.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-main small { display: block; margin-top: 2px; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.value { flex: none; color: var(--muted); font-size: 13px; }
.value.accent { color: var(--primary); font-size: 14px; }
.state { flex: none; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.state i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(52,211,154,.1); }
.state.bad { color: var(--danger); } .state.bad i { background: var(--danger); box-shadow: 0 0 0 4px rgba(255,100,116,.12); }
.hero-actions { display: flex; gap: 8px; }
.hero { align-items: center; }

/* users group (INCY "Мои серверы") */
.search-box { height: 52px; border-radius: 20px; margin-bottom: 16px; background: var(--surface); }
.group { padding: 12px 10px 10px; border: 1px solid var(--line); border-radius: 26px; background: rgba(255,255,255,.012); }
.group > .group-head { margin: 0 4px 12px 8px; }
.group > .group-head > div { flex: none; }
.group > .group-head h3 { color: var(--text); font-size: 17px; letter-spacing: -.01em; text-transform: none; font-weight: 650; }
.badge { min-width: 24px; height: 24px; padding: 0 7px; display: inline-grid; place-items: center; border-radius: 99px; background: rgba(167,139,250,.16); color: var(--violet); font-size: 12px; font-weight: 750; font-variant-numeric: tabular-nums; }
.group-actions { margin-left: auto; display: flex; gap: 6px; }
.section-head { margin-bottom: 14px; }
.count { display: none; }

/* 7. round icon buttons */
.round-btn { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); color: #b4b4bb; }
.round-btn svg { width: 18px; height: 18px; }
.round-btn:active { background: var(--surface-3); color: var(--text); }
.hero-actions .round-btn { width: 46px; height: 46px; border-radius: 15px; }
.hero-actions .round-btn svg { width: 21px; height: 21px; }

/* user rows: icon without plate, 4. selected/online highlight */
.user-list { gap: 8px; }
.swipe-wrap { border-radius: 20px; }
.user-row { min-height: 80px; padding: 13px 14px 13px 12px; border-radius: 20px; background: var(--surface-2); border-color: var(--line); }
.user-row:active { background: var(--surface-3); }
.user-row.is-online { background: #181f2f; border-color: var(--primary-line); }
.user-icon { width: 40px; height: 40px; border: 0; background: none; color: #8e8e96; border-radius: 0; }
.user-row.is-online .user-icon { color: var(--primary); }
.user-icon svg { width: 26px; height: 26px; }
.user-main b { font-size: 16px; font-weight: 600; }
.user-main > span:not(.protocols) { font-size: 12.5px; }
.proto { font-size: 10px!important; padding: 2px 7px; }

/* dashboard tiles */
.dash-stats .tile { width: 30px; height: 30px; border-radius: 10px; }
.dash-stats .tile svg { width: 16px; height: 16px; }
.dash-stats b { margin-top: 8px; }
.dash-stats em { font-size: 10px; }

/* form */
.form-note { align-items: center; }
.form-note .tile { width: 32px; height: 32px; border-radius: 10px; }
.form-note .tile svg { width: 17px; height: 17px; }

/* liquid-glass tab bar */
.nav {
  position: relative; isolation: isolate; overflow: hidden;
  background: linear-gradient(180deg, rgba(48,48,54,.52), rgba(26,26,30,.46));
  border: 1px solid rgba(255,255,255,.13);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), inset 0 -1px 0 rgba(0,0,0,.35), inset 0 0 0 .5px rgba(255,255,255,.04), 0 18px 44px rgba(0,0,0,.5), 0 2px 8px rgba(0,0,0,.25);
  backdrop-filter: blur(26px) saturate(1.9) brightness(1.06);
  -webkit-backdrop-filter: blur(26px) saturate(1.9) brightness(1.06);
}
.nav::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit;
  background: radial-gradient(120% 70% at 50% -20%, rgba(255,255,255,.14), transparent 60%), linear-gradient(90deg, rgba(255,255,255,.05), transparent 30%, transparent 70%, rgba(255,255,255,.05)); }
.nav > button { font-size: 11.5px; font-weight: 550; gap: 4px; color: #a3a3aa; transition: color .2s, background .25s; }
.nav > button svg { width: 24px; height: 24px; }
.nav > button.active { color: var(--primary); background: linear-gradient(180deg, rgba(91,140,255,.26), rgba(91,140,255,.14)); box-shadow: inset 0 0 0 1px rgba(91,140,255,.38), inset 0 1px 0 rgba(255,255,255,.12); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .nav { background: rgba(28,28,31,.96); } }

/* ===== v5.1: refractive lens tab bar (WebKit-safe: transform/filter/mask only) ===== */
.nav.has-lens { background: transparent; }
.nav.has-lens::before { display: none; }
.lens { position: absolute; inset: 0; z-index: 0; border-radius: inherit; overflow: hidden; pointer-events: none; background: #141418; contain: strict; }
.lens-layer { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; }
.lens-layer > .screen-inner { position: absolute; left: 0; top: 0; margin: 0; max-width: none; pointer-events: none; user-select: none; will-change: transform; }
/* center: slightly magnified, soft — like looking through thick glass */
.lens-base > .screen-inner { transform: translate3d(var(--lx), var(--ly), 0) scale(1.06); filter: blur(2.2px) saturate(1.6) brightness(1.12); }
/* rim: content from outside bent inward (minified), sharper — the refraction ring */
.lens-edge > .screen-inner { transform: translate3d(var(--lx), var(--ly), 0) scale(.82); filter: blur(.6px) saturate(1.7) brightness(1.08); }
.lens-edge {
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  padding: 9px;
}
/* tint + specular highlights above the lens, below the buttons */
.nav.has-lens::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; border-radius: inherit;
  background:
    radial-gradient(130% 80% at 50% -30%, rgba(255,255,255,.16), transparent 58%),
    linear-gradient(180deg, rgba(44,44,52,.16), rgba(20,20,24,.26));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), inset 0 -1px 0 rgba(255,255,255,.06), inset 1px 0 0 rgba(255,255,255,.07), inset -1px 0 0 rgba(255,255,255,.07); }
.nav.has-lens > button { position: relative; z-index: 2; }

/* ===== v6: iOS 26 tab bar — sizes, pill, drag lens, minimize ===== */
:root { --nav-h: 62px; --ios-inset: 21px; }
.nav-shell { padding: 0 calc(var(--safe-right) + var(--ios-inset)) max(calc(var(--safe-bottom) - 13px), 14px) calc(var(--safe-left) + var(--ios-inset)); display: flex; justify-content: flex-start; }
.nav { display: flex; width: 100%; max-width: 520px; height: var(--nav-h); margin: 0; padding: 4px; gap: 0; border-radius: 999px;
  transition: width .5s cubic-bezier(.32,.72,0,1), max-width .5s cubic-bezier(.32,.72,0,1); }
.nav.has-lens { overflow: visible; }
.nav.has-lens::after { border-radius: 999px; }
.lens { border-radius: 999px; }
.nav > button { flex: 1 1 0; min-width: 0; height: 100%; padding: 0; border-radius: 999px; gap: 1px; background: none!important; box-shadow: none!important;
  color: rgba(255,255,255,.94); font-size: 10px; font-weight: 600; letter-spacing: .01em; line-height: 12px;
  transition: color .2s, opacity .3s, flex-basis .5s cubic-bezier(.32,.72,0,1), flex-grow .5s cubic-bezier(.32,.72,0,1), scale .35s cubic-bezier(.34,1.56,.64,1); }
.nav > button svg { width: 26px; height: 26px; stroke-width: 1.9; }
.nav > button span { white-space: nowrap; transition: opacity .25s, max-height .3s; max-height: 14px; }
.nav > button.active { color: var(--primary); }
/* selection pill (resting): white @ 15% in dark */
.tab-pill { position: absolute; z-index: 1; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 999px; pointer-events: none;
  background: rgba(255,255,255,.15); box-shadow: inset 0 .5px 0 rgba(255,255,255,.18);
  transition: translate .55s cubic-bezier(.34,1.32,.5,1), width .4s cubic-bezier(.32,.72,0,1), scale .35s cubic-bezier(.34,1.56,.64,1), background .25s, box-shadow .25s, top .3s, bottom .3s; }
.nav > button { position: relative; z-index: 2; }
/* press / drag: pill becomes a clear liquid droplet, larger than the bar */
.nav.pressing .tab-pill { background: rgba(255,255,255,.07);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.34), inset 0 1.5px 1px rgba(255,255,255,.55), inset 0 -1px 2px rgba(255,255,255,.12), 0 8px 24px rgba(0,0,0,.38); }
.nav.pressing > button.hover { scale: 1.08; color: var(--primary); }
.nav.pressing > button.active:not(.hover) { color: rgba(255,255,255,.94); }
.screen { padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 34px); }

/* ===== v6.4: performance + native-feeling motion ===== */
:root { --spring: cubic-bezier(.34,1.32,.5,1); --ease-ios: cubic-bezier(.32,.72,0,1); }
@supports (transition-timing-function: linear(0, 1)) {
  :root { --spring: linear(0.0, 0.0259, 0.0911, 0.1801, 0.281, 0.3852, 0.4865, 0.5809, 0.666, 0.7406, 0.8043, 0.8575, 0.9009, 0.9354, 0.9622, 0.9824, 0.9971, 1.0073, 1.014, 1.0178, 1.0196, 1.0199, 1.0191, 1.0176, 1.0157, 1.0137, 1.0116, 1.0096, 1.0078, 1.0062, 1.0048, 1.0036, 1); }
}
/* the lens is opaque, so the system backdrop blur under it is pure cost */
.nav.has-lens { backdrop-filter: none; -webkit-backdrop-filter: none; }
/* blur only the 351×62 window, not the whole copied page */
.lens-base { filter: blur(2.2px) saturate(1.6) brightness(1.12); }
.lens-edge { filter: blur(.6px) saturate(1.7) brightness(1.08); }
.lens-base > .screen-inner, .lens-edge > .screen-inner { filter: none; backface-visibility: hidden; }
.lens-base > .screen-inner { transform: translate3d(var(--lx), var(--ly), 0) scale(1.06); }
.lens-edge > .screen-inner { transform: translate3d(var(--lx), var(--ly), 0) scale(.82); }
/* tab switch is instant on iOS: no slide, just a very short fade */
.screen { transform: none; transition: opacity .12s linear; }
/* one spring for every tab-bar motion */
.nav > button { transition: color .18s ease, opacity .25s ease, scale .5s var(--spring); }
.tab-pill { transition: background .25s ease, box-shadow .25s ease; will-change: translate, scale; }
.nav.pressing > button.hover { scale: 1.08; }
.lens-layer > .screen-inner[hidden] { display: none; }

/* ===== v6.5: no long-press selection, artifact-free glass ===== */
html, body, .app-shell { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, .field, .search { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
img, svg { -webkit-user-drag: none; }
/* glass body = native backdrop blur: exact and lag-free on iOS */
.nav.has-lens { background: rgba(30,30,34,.38); backdrop-filter: blur(18px) saturate(1.8) brightness(1.08); -webkit-backdrop-filter: blur(18px) saturate(1.8) brightness(1.08); }
.lens { background: transparent; contain: layout paint; }
.lens-base { display: none; }
/* only a soft refraction rim from the copy: subtle minify, feathered both ways */
.lens-edge { filter: blur(.8px) saturate(1.5); opacity: .55; padding: 5px; }
.lens-edge > .screen-inner { transform: translate3d(var(--lx), var(--ly), 0) scale(.95); }
.nav.has-lens::after { background: radial-gradient(130% 80% at 50% -30%, rgba(255,255,255,.12), transparent 58%); }

/* ===== v6.6: native iOS 26 metrics (measured from a native tab bar) and faster springs ===== */
:root { --nav-h: 56px; }
.nav-shell { padding-bottom: max(calc(var(--safe-bottom) + 2px), 14px); }
.nav > button svg { width: 24px; height: 24px; }
.nav > button { gap: 2px; font-size: 10px; transition: color .15s ease, opacity .2s ease, scale .32s var(--spring); }
.screen { padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 30px); }
