@font-face { font-family: "Golos Text"; src: url("fonts/golos.woff") format("woff"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrainsmono.woff") format("woff"); font-weight: 100 800; font-display: swap; }

:root {
  --bg: #F3F4F6; --card: #FFFFFF; --ink: #111418; --muted: #5B616B; --muted2: #3D434C;
  --line: #E2E5EA; --line2: #D3D7DE; --soft: #EEF0F3; --field: #F7F8FA;
  --accent: #1F4FD1; --accent-ink: #FFFFFF; --accent-soft: #EEF3FF; --accent-line: #C9D6F7;
  --good: #1E7F4F; --good-soft: #E7F4EC; --good-ink: #1A5E3B;
  --warn-soft: #FFF4E5; --warn-line: #F2D2A2; --warn-ink: #6E3000;
  --bad: #A1251A; --bad-soft: #FBEAE8; --bad-line: #E8B4AE;
  --dark: #111418; --dark-ink: #FFFFFF;
  --shadow: 0 1px 2px rgba(17,20,24,.04), 0 8px 24px rgba(17,20,24,.06);
  --radius: 16px;
  --ease: cubic-bezier(.2,.8,.2,1);
  --spring: cubic-bezier(.34,1.56,.64,1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1013; --card: #171A1F; --ink: #ECEEF1; --muted: #9AA1AB; --muted2: #B8BEC7;
    --line: #262A31; --line2: #323741; --soft: #20242B; --field: #1C2026;
    --accent: #5B82F0; --accent-ink: #0B1020; --accent-soft: #19223A; --accent-line: #2C3B66;
    --good: #3FB27A; --good-soft: #15281F; --good-ink: #7FD4A8;
    --warn-soft: #2A2012; --warn-line: #4D3A1C; --warn-ink: #F2C27E;
    --bad: #F08A80; --bad-soft: #2C1715; --bad-line: #5A2B27;
    --dark: #ECEEF1; --dark-ink: #0E1013;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
/* an open window: the page behind does not move (lockScroll in common.js) */
html.locked, html.locked body { overflow: hidden; }
.scrim, .lightbox, .sheet { overscroll-behavior: contain; }
.scrim, .lightbox { touch-action: none; }
.sheet { touch-action: pan-y; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px; line-height: 1.4; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg:not([width]) { width: 18px; height: 18px; flex-shrink: 0; }
.person > svg { color: var(--muted); align-self: center; }

.page { max-width: 480px; margin: 0 auto; padding: 28px 20px calc(40px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 20px; min-height: 100dvh; }
.page.admin { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; }
.mark { width: 32px; height: 32px; border-radius: 9px; background: var(--dark); color: var(--dark-ink); display: grid; place-items: center; }
.mark svg { width: 18px; height: 18px; }

h1 { margin: 0; font-size: 30px; line-height: 1.15; font-weight: 600; letter-spacing: -.01em; }
h2 { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.lead { margin: 6px 0 0; color: var(--muted); font-size: 15px; line-height: 1.45; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.list { padding: 0; }
.card.list > * + * { border-top: 1px solid var(--line); }

.badge { width: 44px; height: 44px; border-radius: 12px; background: var(--soft); display: grid; place-items: center; font-family: "JetBrains Mono", monospace; font-size: 15px; flex-shrink: 0; }
.badge.sm { width: 40px; height: 40px; border-radius: 10px; font-size: 14px; }
.title { font-size: 17px; font-weight: 600; }
.sub { font-size: 13px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--good); flex-shrink: 0; }
.dot.off { background: var(--line2); }
.dot.via { background: var(--warn-ink); }
.warnline { color: var(--warn-ink); }

.btn {
  height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card);
  font-weight: 600; font-size: 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .15s var(--ease), background .2s, opacity .2s; user-select: none; text-decoration: none; color: var(--ink);
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.dark { background: var(--dark); color: var(--dark-ink); border-color: transparent; }
.btn.danger { color: var(--bad); border-color: var(--bad-line); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: transparent; }
.btn.block { width: 100%; }
.btn.sm { height: 40px; font-size: 14px; font-weight: 500; padding: 0 14px; border-radius: 10px; }
.btn.icon { width: 44px; padding: 0; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn.busy svg.spin { animation: spin .8s linear infinite; }

.linkrow { min-height: 52px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; color: var(--ink); font-size: 15px; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; }
.linkrow svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }

.banner { border-radius: var(--radius); padding: 16px; display: flex; gap: 12px; background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--warn-ink); }
.banner svg { width: 22px; height: 22px; flex-shrink: 0; margin-top: 1px; }
.banner b { display: block; font-size: 16px; margin-bottom: 4px; }
.banner p { margin: 0; font-size: 14px; line-height: 1.45; }
.banner ol { margin: 6px 0 0; padding-left: 18px; font-size: 14px; line-height: 1.6; }
.banner.info { background: var(--accent-soft); border-color: var(--accent-line); color: var(--ink); }

.chip { display: inline-block; font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.chip.on { background: var(--good-soft); color: var(--good-ink); }
.chip.wait { background: var(--warn-soft); color: var(--warn-ink); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted2); }
.input { height: 48px; border: 1px solid var(--line2); border-radius: 12px; padding: 0 14px; background: var(--card); font-size: 16px; width: 100%; transition: border-color .2s, box-shadow .2s; }
.input:focus, textarea.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { height: auto; min-height: 88px; padding: 12px 14px; resize: vertical; line-height: 1.45; }
.input.mono { font-size: 13px; }
.codebox { font-family: "JetBrains Mono", monospace; font-size: 13px; background: var(--card); border: 1px solid var(--accent-line); border-radius: 10px; padding: 12px; overflow-wrap: anywhere; user-select: all; }

.seg { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 4px; background: var(--soft); border-radius: 12px; padding: 4px; }
.seg button { height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted2); cursor: pointer; font-size: 14px; transition: background .2s, color .2s; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; counter-reset: s; }
.steps li { display: flex; gap: 14px; counter-increment: s; }
.steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 14px; background: var(--dark); color: var(--dark-ink); font-size: 14px; font-weight: 600; display: grid; place-items: center; flex-shrink: 0; }
.steps .t { font-size: 16px; font-weight: 600; line-height: 28px; }
.steps .d { font-size: 14px; line-height: 1.5; color: var(--muted); }
.path { margin: 4px 0 0; padding-left: 18px; font-size: 15px; line-height: 1.7; }

.foot { margin-top: auto; text-align: center; font-size: 12px; color: var(--muted); }

/* ---- toast & sheets ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); width: min(440px, calc(100% - 40px));
  transform: translate(-50%, 140%); background: var(--dark); color: var(--dark-ink); border-radius: 12px; padding: 14px 16px;
  display: flex; align-items: center; gap: 10px; font-size: 14px; line-height: 1.35; z-index: 50;
  transition: transform .45s var(--spring), opacity .3s; opacity: 0; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.admin-body .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; color: #7FD4A8; }
.toast svg path { stroke-dasharray: 24; stroke-dashoffset: 24; }
.toast.show svg path { animation: draw .45s .15s var(--ease) forwards; }
.toast.err svg { color: #F08A80; }

.scrim { position: fixed; inset: 0; background: rgba(10,12,15,.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .25s; }
.scrim.show { opacity: 1; }
.sheet { width: min(520px, 100%); background: var(--card); border-radius: 20px 20px 0 0; padding: 24px 20px calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; transform: translateY(100%); transition: transform .4s var(--ease); max-height: 90dvh; overflow: auto; }
.scrim.show .sheet { transform: translateY(0); }
.sheet h3 { margin: 0; font-size: 20px; font-weight: 600; }
.sheet p { margin: 0; font-size: 15px; line-height: 1.45; color: var(--muted); }
.sheet .acts { display: flex; gap: 10px; margin-top: 8px; }
.sheet .acts .btn { flex: 1; }
@media (min-width: 720px) {
  .scrim { align-items: center; }
  .sheet { border-radius: 20px; transform: translateY(24px) scale(.97); opacity: 0; transition: transform .35s var(--ease), opacity .25s; }
  .scrim.show .sheet { transform: none; opacity: 1; }
}

/* swipe to dismiss: banners sideways, toasts sideways or down */
.swipeable { touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; }
.swipeable a, .swipeable button, .swipeable .codebox { cursor: auto; user-select: text; -webkit-user-select: text; }
.swiping { transition: none !important; cursor: grabbing; }
.swipe-out { transition: transform .22s var(--ease), opacity .22s !important; opacity: 0 !important; }
.appear { animation: fadein .3s var(--ease) both; }

/* ---- motion ---- */
.enter { animation: rise .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
.pop { animation: pop .45s var(--spring); }
.swap { animation: fadein .35s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.94); } 100% { transform: scale(1); } }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: -200px 0; } 100% { background-position: 200px 0; } }
.skeleton { height: 128px; border-radius: var(--radius); background: linear-gradient(90deg, var(--soft) 0, var(--card) 50%, var(--soft) 100%) var(--soft); background-size: 400px 100%; animation: shimmer 1.2s linear infinite; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}

/* ---- admin ---- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); padding-bottom: env(safe-area-inset-bottom); z-index: 30; }
.tabbar a { white-space: nowrap; height: 68px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: var(--muted); font-size: 12px; transition: color .2s; }
.tabbar a svg { width: 22px; height: 22px; transition: transform .3s var(--spring); }
.tabbar a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.tabbar a[aria-current="page"] svg { transform: translateY(-2px); }
.person { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 14px; transition: transform .15s var(--ease), border-color .2s; }
.person:active { transform: scale(.985); }
.person.sel { border: 2px solid var(--accent); padding: 13px 15px; }
.person .n { font-size: 17px; font-weight: 600; }
.person .chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.person.blocked .n { color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.tile { background: var(--field); border-radius: 10px; padding: 10px 12px; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-size: 15px; font-weight: 600; }
.keyrow { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.dev { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.dev .h { display: flex; align-items: center; gap: 12px; }
.dev .keys { display: flex; flex-direction: column; gap: 8px; }
.dev .k1 { display: flex; align-items: center; gap: 10px; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; text-decoration: none; color: var(--ink); font-size: 15px; align-self: flex-start; }
.back svg { width: 18px; height: 18px; }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; font-size: 14px; }

.desk-nav { display: none; }
@media (min-width: 900px) {
  .page.admin { max-width: 1080px; padding-bottom: 48px; }
  .tabbar { display: none; }
  .desk-nav { display: flex; gap: 4px; }
  .desk-nav a { padding: 10px 14px; border-radius: 10px; color: var(--muted2); text-decoration: none; font-size: 15px; }
  .desk-nav a[aria-current="page"] { background: var(--soft); color: var(--ink); font-weight: 600; }
  .split { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 24px; align-items: start; }
  .split .detail-pane { position: sticky; top: 20px; }
  .admin-body .toast { bottom: 24px; }
}
@media (max-width: 899px) {
  .split.has-detail .list-pane { display: none; }
  .split:not(.has-detail) .detail-pane { display: none; }
}

/* ---- login ---- */
.login { max-width: 420px; margin: 0 auto; min-height: 100dvh; padding: 28px 20px; display: flex; flex-direction: column; justify-content: center; gap: 24px; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }



/* ---- keys board ---- */
.board { display: flex; flex-direction: column; gap: 16px; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; align-items: start; }
.holder { padding: 12px; display: flex; flex-direction: column; gap: 8px; transition: opacity .2s, box-shadow .15s, border-color .15s; }
.holder .hh { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.holder .title { text-decoration: none; color: var(--ink); font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.holder.system { background: var(--field); }
.zone { border: 1.5px dashed var(--line2); border-radius: 12px; padding: 6px 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-height: 40px; transition: border-color .15s, background .15s, opacity .2s; }
.zone .zl { flex: 1 1 100%; font-size: 12px; color: var(--muted); padding: 0 2px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zone.vacant .zl { flex: 1 1 auto; }
.zone .zsub { color: var(--muted); }
.zone .zc { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 100%; }
.zone.vacant .zc { flex: 0 0 auto; }
.zone .zempty { font-size: 12px; color: var(--muted); padding: 2px 4px; }
.pool .zone { min-height: 64px; }
.pool .zone.vacant .zc { flex: 1 1 100%; justify-content: center; }
/* a key in hand: where it fits is framed, the rest fades */
.picking .zone.can { border-color: var(--accent); background: var(--accent-soft); cursor: pointer; }
.picking .zone.no { opacity: .4; }
.picking .holder.no { opacity: .5; }
.picking .holder.can { cursor: pointer; border-color: var(--accent-line); }
.zone.over, .holder.over { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); opacity: 1; }
.holder.over { background: var(--card); }
.zone.bad, .holder.bad { border-color: var(--bad); background: var(--bad-soft); opacity: 1; }
.keybar .kb { font-size: 12px; background: var(--soft); border-radius: 6px; padding: 3px 6px; }
.keybar .small { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.keybar .sub { font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.keybar .btn.icon.sm { width: 40px; padding: 0; }
.keysview .gtoggle { margin-top: 4px; }
.kchip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); box-shadow: var(--shadow); cursor: grab; max-width: 100%; transition: opacity .15s, box-shadow .2s, border-color .2s, transform .3s var(--ease); }
.kchip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kchip.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.kchip.dragging { opacity: .3; }
.kchip .kb { font-size: 12px; background: var(--soft); border-radius: 6px; padding: 3px 6px; }
.kchip .kt { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.kchip .kn { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.kchip .ki { font-size: 11px; color: var(--muted); }
.kchip .ksug { border: 0; background: var(--good-soft); color: var(--good-ink); border-radius: 8px; padding: 6px 8px; font-size: 12px; font-weight: 600; cursor: pointer; }
.ghost { position: fixed !important; left: 0; top: 0; margin: 0 !important; z-index: 60; pointer-events: none; cursor: grabbing; box-shadow: 0 14px 36px rgba(17,20,24,.22) !important; transition: none !important; animation: none !important; opacity: .97; }
.trash { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translate(-50%, 160%); display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-radius: 14px; background: var(--bad-soft); border: 1.5px dashed var(--bad); color: var(--bad); font-weight: 600; font-size: 14px; z-index: 55; opacity: 0; visibility: hidden; transition: transform .35s var(--spring), opacity .2s, visibility .2s; }
body.is-dragging .trash { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.trash.over { background: var(--bad); color: #fff; }
body.is-dragging { cursor: grabbing; }
@media (min-width: 900px) {
  .board { display: grid; grid-template-columns: 280px 1fr; align-items: start; }
  .pool { position: sticky; top: 20px; max-height: calc(100dvh - 40px); overflow: auto; }
  .trash { bottom: 32px; }
}

/* ---- server access toggles ---- */
.togs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.togs.sm { gap: 6px; }
.tog { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line2); background: var(--card); color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; transition: background .2s, color .2s, border-color .2s, transform .15s var(--ease); }
.tog:active { transform: scale(.96); }
.tog svg { width: 16px; height: 16px; }
.tog[aria-pressed="true"] { background: var(--good-soft); color: var(--good-ink); border-color: transparent; }
.tog[aria-pressed="false"] { text-decoration: line-through; }
.togs.sm .tog { min-height: 34px; padding: 0 10px; font-size: 13px; }
.tog .ownmark { color: var(--accent); font-weight: 700; text-decoration: none; }
.k1.denied > .badge, .k1.denied > .grow { opacity: .5; }
.picker { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card); }
.picker .keyrow { padding: 10px 14px; cursor: pointer; }
.picker .keyrow + .keyrow { border-top: 1px solid var(--line); }
.picker .keyrow.off .badge, .picker .keyrow.off .title { opacity: .5; }
.sheet .picker { margin-top: 4px; }
.chip.no { text-decoration: line-through; opacity: .75; }

/* ---- switch, choices ---- */
.switch { position: relative; width: 52px; height: 32px; border-radius: 999px; border: 0; background: var(--line2); cursor: pointer; flex-shrink: 0; transition: background .2s; padding: 0; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .25s var(--spring); }
.switch[aria-checked="true"] { background: var(--good); }
.switch[aria-checked="true"] .knob { transform: translateX(20px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card); cursor: pointer; transition: border-color .2s, background .2s; }
.choice.on { border: 2px solid var(--accent); padding: 13px 15px; background: var(--accent-soft); }
.choice[disabled] { opacity: .5; cursor: not-allowed; }
.choice .ct { display: block; font-size: 16px; font-weight: 600; }
.choice .cs { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.choice svg { color: var(--accent); }
.sub.exc { color: var(--accent); }
.keyrow .title.small { font-size: 15px; }
.k1.wrap { flex-wrap: wrap; }
.k1.wrap .acts { display: flex; gap: 8px; width: 100%; padding-left: 50px; }
.k1.wrap .acts .btn:first-child { flex: 1; }
.btn.sm { white-space: nowrap; }

.linkrow .lt { display: block; }
.linkrow .ls { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---- dragging (keys and people) ---- */
.can-drag { touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.can-drag.holding { transform: scale(.96); transition: transform .33s var(--ease); }
body.is-dragging, body.is-dragging * { user-select: none !important; -webkit-user-select: none !important; cursor: grabbing !important; }
body.is-dragging .person:not(.ph):not(.ghost):hover { border-color: var(--line); }

/* ---- people & groups ---- */
.groups { display: flex; flex-direction: column; gap: 12px; }
.group { display: flex; flex-direction: column; gap: 8px; border-radius: 16px; transition: background .15s, box-shadow .15s; }
.group.over { background: var(--accent-soft); box-shadow: 0 0 0 6px var(--accent-soft); }
.ghead { display: flex; align-items: center; gap: 6px; min-height: 40px; }
.gtoggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 2px; border: 0; background: none; cursor: pointer; text-align: left; color: var(--muted); }
.gtoggle h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gtoggle svg { width: 16px; height: 16px; transition: transform .2s var(--ease); }
.gtoggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.gcount { font-size: 13px; color: var(--muted); }
.btn.gedit { width: 40px; height: 40px; border-color: transparent; background: none; color: var(--muted); }
.btn.gedit svg { width: 16px; height: 16px; }
.seg.wrap { display: flex; flex-wrap: wrap; }
.seg.wrap button { flex: 1 1 auto; padding: 0 12px; }
.btn.gedit:hover { background: var(--soft); }
.plist { display: flex; flex-direction: column; gap: 8px; min-height: 8px; border-radius: 14px; }
.pempty { border: 1.5px dashed var(--line2); border-radius: 14px; padding: 14px; text-align: center; font-size: 13px; color: var(--muted); }
.dropmark { position: absolute; z-index: 58; pointer-events: none; border-radius: 4px; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); transition: left .08s, top .08s, width .08s, height .08s; }
.dropmark.box { background: var(--accent-soft); border: 2px dashed var(--accent); box-shadow: none; border-radius: 14px; }
.dropmark[hidden] { display: none; }
.person.dragging { opacity: .35; border-style: dashed; box-shadow: none; }
.person.pop { animation: pop .45s var(--spring); border-color: var(--accent); }
.person.picked { border: 2px solid var(--accent); padding: 13px 15px; background: var(--accent-soft); }
.tick { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line2); flex-shrink: 0; display: grid; place-items: center; transition: background .15s, border-color .15s; }
.tick.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tick svg { width: 14px; height: 14px; }
.selbar { position: fixed; left: 0; right: 0; margin: 0 auto; bottom: calc(80px + env(safe-area-inset-bottom)); width: min(520px, calc(100% - 24px)); z-index: 35;
  display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line2);
  box-shadow: 0 10px 30px rgba(17,20,24,.16); font-size: 15px; font-weight: 600; animation: rise .3s var(--ease) both; }
.has-selbar .page.admin { padding-bottom: calc(180px + env(safe-area-inset-bottom)); }
.has-selbar .toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
.choice.danger .ct, .choice.danger svg { color: var(--bad); }
.choice > svg:first-child { color: var(--muted); }
h2.kgroup { margin-top: 6px; }

.group.zero-empty { display: none; }
body.is-dragging .group.zero-empty { display: flex; }

@media (min-width: 900px) {
  .split.wide { grid-template-columns: 1fr; }
  .split.wide .detail-pane { display: none; }
  .split.wide .view-tiles .plist { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); grid-auto-rows: 1fr; gap: 12px; }
  /* wide grid: title, search and buttons on one line */
  .split.wide .phead { flex-wrap: nowrap; }
  .split.wide .phead .pfind { order: 0; flex: 0 1 360px; margin-left: auto; }
  .split.wide .phead .pcount { margin-right: 0; }
  .split.wide .phead .vseg { order: 0; }
  .selbar { bottom: 24px; }
  .has-selbar .toast { bottom: 96px; }
  .has-selbar .page.admin { padding-bottom: 110px; }
  .person:hover { border-color: var(--line2); }
}

/* red dot on «Серверы» in the menu */
.ndot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); margin-left: 6px; vertical-align: 2px; }
.tabbar a { position: relative; }
.tabbar .ndot { position: absolute; top: 12px; left: calc(50% + 9px); margin: 0; box-shadow: 0 0 0 2px var(--card); }
.msgtext { white-space: pre-line; overflow-wrap: anywhere; }
.banner .sub { margin-top: 6px; }
.banner.closable { position: relative; padding-right: 48px; }
.bclose { position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; border: 0; border-radius: 10px; background: none; color: inherit; opacity: .6; cursor: pointer; display: grid; place-items: center; }
.bclose:hover { opacity: 1; background: rgba(127,127,127,.12); }
.bclose svg { width: 18px; height: 18px; margin: 0; }

/* redraws of the same screen: no entrance animation, no flicker */
.still .enter, .still.swap, .still .swap { animation: none; }

/* people header: title · count · (search) · buttons */
.phead { flex-wrap: wrap; row-gap: 12px; }
.phead .pcount { margin-right: auto; }
.phead .pfind { order: 10; flex: 1 1 160px; }
.phead .vseg { order: 11; }
.btn.icon.sm { width: 40px; }
.person .tick { align-self: center; }
.pback { display: none; }
@media (min-width: 900px) {
  .detail-pane .back { display: none; }
  .pback { display: inline-flex; flex-shrink: 0; padding-left: 10px; }
}

/* ---- people: name line, and the three views ---- */
.person .n { display: flex; align-items: center; gap: 8px; min-width: 0; }
.person .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .chip.adm { flex-shrink: 0; font-weight: 500; }
.person .chips { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }
.person .chips .sub { overflow: hidden; text-overflow: ellipsis; }
.vseg { display: inline-flex; grid-template-columns: none; padding: 3px; gap: 2px; border-radius: 11px; flex-shrink: 0; }
.vseg button { width: 36px; height: 34px; display: grid; place-items: center; padding: 0; border-radius: 8px; }
.vseg button svg { width: 17px; height: 17px; }

/* small tiles: name and servers only, many in a row */
.view-small .plist { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); grid-auto-rows: 1fr; gap: 8px; }
.view-small .person { padding: 10px 12px; gap: 8px; border-radius: 12px; }
.view-small .person.sel, .view-small .person.picked { padding: 9px 11px; }
.view-small .person .n { font-size: 15px; }
.view-small .person .chip.adm { display: none; }
.view-small .person .chips { margin-top: 5px; gap: 4px; }
.view-small .person .chips .sub { display: none; }
.view-small .person .chip { font-size: 11px; padding: 2px 6px; }
.view-small .person > svg:last-child { display: none; }
.view-small .pempty { grid-column: 1 / -1; }

/* list: dense rows inside one card */
.view-list .plist { gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.view-list .plist:empty, .view-list .plist:has(> .pempty:only-child) { background: none; border: 0; box-shadow: none; }
.view-list .person { border: 0; border-radius: 0; padding: 10px 16px; align-items: center; box-shadow: none; background: none; }
.view-list .person + .person { border-top: 1px solid var(--line); }
.view-list .person.sel, .view-list .person.picked { border: 0; padding: 10px 16px; background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.view-list .person + .person.sel, .view-list .person + .person.picked { border-top: 1px solid var(--line); }
.view-list .person .grow { display: flex; align-items: center; gap: 12px; }
.view-list .person .n { flex: 0 0 38%; font-size: 15px; }
.view-list .person .chips { margin-top: 0; flex: 1; }
.view-list .person:active { transform: none; background: var(--soft); }
@media (min-width: 900px) { .split.wide .view-list .person .n { flex-basis: 260px; } }

/* ---- XRay block ---- */
.hscroll { overflow-x: auto; white-space: nowrap; overflow-wrap: normal; user-select: all; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.codebox.hscroll { padding: 12px; }
.codebox.pre { white-space: pre; margin: 0; max-height: 260px; overflow: auto; user-select: text; }
.xray .steps { gap: 16px; }
.xkeys { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.xkey { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; min-width: 0; }
.xkey + .xkey { border-top: 1px solid var(--line); }
.xkey .xname { flex: 1; min-width: 0; font-size: 15px; font-weight: 500; user-select: text; padding: 6px 0; }
.xkey .btn { flex-shrink: 0; }
.linkrow.inset { border: 1px solid var(--line); border-radius: 12px; }
.xcheck { overflow-wrap: anywhere; }
.xcheck.ok { color: var(--good-ink); }
.xcheck.bad { color: var(--bad); }
textarea.input.mono { font-size: 12px; line-height: 1.5; }

/* rows that lead somewhere: icon tile · title · line · chevron */
.navrow { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 64px; text-decoration: none; color: var(--ink); transition: background .15s; }
.navrow:active { background: var(--soft); }
.navrow .ni { width: 38px; height: 38px; border-radius: 10px; background: var(--soft); color: var(--ink); display: grid; place-items: center; flex-shrink: 0; }
.navrow .ni svg { width: 20px; height: 20px; }
.navrow .nt { display: block; font-size: 15px; font-weight: 600; line-height: 1.3; }
.navrow .ns { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.navrow > svg:last-child { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.navbox { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.navbox .navrow { padding: 10px 12px; min-height: 60px; }
@media (hover: hover) { .navrow:hover { background: var(--field); } }
.xwatch { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.xw { display: flex; align-items: center; gap: 10px; padding: 10px 14px; font-size: 15px; }
.xw + .xw { border-top: 1px solid var(--line); }
.xw.changed { background: var(--warn-soft); color: var(--warn-ink); }
.xw.changed .sub { color: var(--warn-ink); font-weight: 600; }
.row.wraprow { flex-wrap: wrap; gap: 8px; }
.row.wraprow > .btn { flex: 1 1 auto; }
.inbox { gap: 8px; }
.inbox .sub { margin-top: 0; }
.inboxlist { gap: 10px; }
@media (min-width: 900px) { .split.wide .inboxlist { max-width: 720px; } }

/* «Серверы» → settings rows; a row that needs attention */
.navlist .navrow + .navrow { border-top: 1px solid var(--line); }
.navrow.warn .ns { color: var(--bad); }
.navrow.warn .ni { background: var(--bad-soft, var(--soft)); color: var(--bad); }
.setpage { max-width: 720px; }
.linkish { background: none; border: 0; padding: 0; text-align: left; color: inherit; font: inherit; cursor: pointer; min-width: 0; }
.keyrow .linkish .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.pair > .btn { flex: 1 1 0; min-width: 0; }
.row.pair:empty { display: none; }
.xhead { width: 100%; }
.fold svg { width: 20px; height: 20px; color: var(--muted); transform: rotate(90deg); transition: transform .2s; }
.fold.open svg { transform: rotate(-90deg); }
.srvgrid { display: grid; gap: 12px; }
@media (min-width: 900px) { .srvgrid { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); align-items: start; } }
.inboxmore .btn svg { transform: rotate(90deg); }

/* instruction pages: photos and collages */
.gal { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.gimgs { display: grid; gap: 8px; align-items: start; }
.gal.n2 .gimgs, .gal.n4 .gimgs { grid-template-columns: repeat(2, minmax(0,1fr)); }
.gal.n3 .gimgs { grid-template-columns: repeat(3, minmax(0,1fr)); }
.gimg { padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--soft); cursor: zoom-in; display: block; width: 100%; }
.gimg img { display: block; width: 100%; height: auto; }
.gal.n1 .gimg { width: auto; max-width: 100%; justify-self: start; }
.gal.n1 .gimg img { max-height: min(70vh, 640px); width: auto; max-width: 100%; }
.gal figcaption { font-size: 13px; color: var(--muted); line-height: 1.4; }
.pstep > .t + .d { margin-top: -12px; }
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.92); display: grid; place-items: center; padding: 48px 12px 56px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.lightbox button { position: absolute; border: 0; background: rgba(255,255,255,.14); color: #fff; width: 44px; height: 44px; border-radius: 22px; display: grid; place-items: center; cursor: pointer; }
.lightbox button svg { width: 22px; height: 22px; }
.lbclose { top: max(12px, env(safe-area-inset-top)); right: 12px; }
.lbnav.prev { left: 12px; top: 50%; } .lbnav.next { right: 12px; top: 50%; }
.lbcap { position: absolute; left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); color: #eee; text-align: center; font-size: 14px; }
.lbcount { position: absolute; top: max(22px, env(safe-area-inset-top)); left: 0; right: 0; text-align: center; color: #ccc; font-size: 14px; pointer-events: none; }


/* XRay traffic */
.usage { font-size: 13px; color: var(--muted); margin-top: 4px; display: flex; flex-direction: column; gap: 5px; }
.usage.bad { color: var(--bad); font-weight: 600; }
.usage.warn { color: var(--warn-ink, var(--bad)); }
.ubar { display: block; height: 4px; border-radius: 2px; background: var(--soft); overflow: hidden; max-width: 220px; }
.ubar > span { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.usage.warn .ubar > span { background: var(--bad); }
.sub.ubad { color: var(--bad); }
.keyrow .linkish .sub + .sub { white-space: normal; }
/* «Проверка серверов»: button + sheet with a slider and quick picks */
.pollbtn { flex-shrink: 0; gap: 4px; padding: 0 10px 0 14px; font-variant-numeric: tabular-nums; }
.pollbtn svg { width: 16px; height: 16px; color: var(--muted); transform: rotate(90deg); }
.pollbody { gap: 14px; margin-top: 4px; }
.pollval { text-align: center; font-size: 17px; color: var(--muted); }
.pollval b { display: block; font-size: 52px; line-height: 1.05; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 32px; background: transparent; margin: 0; cursor: pointer; --fill: 0%; }
.range:focus { outline: none; }
.range::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--fill), var(--soft) var(--fill)); }
.range::-moz-range-track { height: 8px; border-radius: 4px; background: var(--soft); }
.range::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--accent); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0,0,0,.3), 0 0 0 1px rgba(0,0,0,.06); transition: transform .15s; }
.range::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.range:active::-webkit-slider-thumb { transform: scale(1.1); }
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-soft), 0 1px 4px rgba(0,0,0,.3); }
.pscale { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: -10px; }
.pchips { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.pchip { height: 40px; border-radius: 10px; border: 1px solid var(--line2); background: var(--card); color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; font-variant-numeric: tabular-nums; transition: background .15s, border-color .15s, color .15s; padding: 0 2px; white-space: nowrap; }
.pchip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
@media (hover: hover) { .pchip:not([aria-pressed="true"]):hover { background: var(--field); } }
