/* 1ST VPN · админка. Стиль iOS/Telegram: серый фон, белые сгруппированные блоки, синий акцент, SF Pro + SF Mono. */
:root {
  --bg: oklch(0.995 0.002 250);
  --card: oklch(0.966 0.004 250);
  --fill: oklch(0.948 0.005 250);
  --fill-2: oklch(0.925 0.006 250);
  --line: oklch(0.91 0.006 250);
  --text: oklch(0.21 0.01 250);
  --muted: oklch(0.56 0.012 250);
  --blue: oklch(0.63 0.155 250);
  --blue-2: oklch(0.57 0.155 250);
  --blue-tint: oklch(0.63 0.155 250 / 0.11);
  --blue-tint-2: oklch(0.63 0.155 250 / 0.18);
  --red: oklch(0.6 0.19 25);
  --red-tint: oklch(0.6 0.19 25 / 0.11);
  --green: oklch(0.6 0.14 150);
  --green-tint: oklch(0.6 0.14 150 / 0.13);
  --orange: oklch(0.68 0.15 60);
  --orange-tint: oklch(0.72 0.15 70 / 0.16);
  --on-accent: oklch(0.99 0.003 250);
  --head: oklch(0.995 0.002 250 / 0.85);
  --shade: oklch(0.2 0.01 250 / 0.32);
  --dark: oklch(0.24 0.01 250);
  --shadow: none;
  --shadow-lg: 0 24px 64px oklch(0.2 0.02 250 / 0.22);
  --r: 18px;
  --r-s: 12px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(0.155 0.006 250);
    --card: oklch(0.215 0.008 250);
    --fill: oklch(0.265 0.009 250);
    --fill-2: oklch(0.31 0.01 250);
    --line: oklch(0.295 0.009 250);
    --text: oklch(0.95 0.004 250);
    --muted: oklch(0.68 0.01 250);
    --blue: oklch(0.68 0.145 250);
    --blue-2: oklch(0.74 0.13 250);
    --blue-tint: oklch(0.68 0.145 250 / 0.16);
    --blue-tint-2: oklch(0.68 0.145 250 / 0.26);
    --red: oklch(0.68 0.18 25);
    --red-tint: oklch(0.68 0.18 25 / 0.16);
    --green: oklch(0.72 0.15 150);
    --green-tint: oklch(0.72 0.15 150 / 0.16);
    --orange: oklch(0.76 0.14 65);
    --orange-tint: oklch(0.76 0.14 65 / 0.16);
    --head: oklch(0.155 0.006 250 / 0.8);
    --shade: oklch(0.05 0.005 250 / 0.6);
    --dark: oklch(0.93 0.005 250);
    --shadow: none;
    --shadow-lg: 0 24px 64px oklch(0 0 0 / 0.5);
  }
  input[type=date], input[type=datetime-local] { color-scheme: dark; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
input, textarea, .note, .sel { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-2); }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.red { color: var(--red); } .green { color: var(--green); } .orange { color: var(--orange); }
:focus-visible { outline: 3px solid var(--blue-tint-2); outline-offset: 2px; }

h1 { font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -0.025em; margin: 6px 0 20px; }
h1 .muted { font-weight: 500; }
/* подписи секций как в iOS: мелко, заглавными, над блоком */
h2 { font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 32px 16px 8px; }
h2 .muted { text-transform: none; letter-spacing: 0; }
.card h2 { font-size: 17px; font-weight: 600; text-transform: none; letter-spacing: -0.01em; color: var(--text); margin: 0 0 6px; }

/* ---------- шапка ---------- */
header { position: sticky; top: 0; z-index: 5; background: var(--head); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); }
.bar { max-width: 1120px; margin: 0 auto; padding: 10px 24px; display: flex; gap: 18px; align-items: center; }
.brand { color: var(--text); font-weight: 600; white-space: nowrap; display: flex; align-items: center; gap: 9px; letter-spacing: -0.01em; }
.brand:hover { color: var(--text); }
.logo { background: var(--dark); color: var(--bg); border-radius: 50%; width: 30px; height: 30px; display: inline-grid; place-items: center; font-size: 10px; font-weight: 800; letter-spacing: 0.02em; }
nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
nav::-webkit-scrollbar { display: none; }
nav a { color: var(--text); font-size: 14px; padding: 6px 11px; border-radius: 999px; white-space: nowrap; transition: background-color 0.15s var(--ease), color 0.15s var(--ease); }
nav a:hover { background: var(--fill-2); color: var(--text); }
nav a.on { background: var(--blue); color: var(--on-accent); }
.searchbtn { margin-left: auto; background: var(--card); color: var(--muted); font-weight: 400; display: flex; gap: 10px; align-items: center; padding: 7px 10px 7px 14px; }
.searchbtn:hover { background: var(--fill-2); color: var(--text); }
.kbd { font: 11px var(--mono); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; color: var(--muted); }
main { max-width: 1120px; margin: 0 auto; padding: 22px 24px 96px; }

/* ---------- блоки ---------- */
.card { background: var(--card); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); }
/* группа плиток: один блок с тонкими разделителями, а не россыпь одинаковых карточек */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.grid { padding: 4px 0; }
.grid > .card { border-radius: 0; box-shadow: none; background: none; padding: 12px 18px; }
.grid2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font: 600 26px/1.15 var(--mono); margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.stat .s { color: var(--muted); font-size: 13px; margin-top: 3px; }
.rows > div { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rows > div:last-child { border-bottom: 0; }
.rows > div > span:first-child { color: var(--muted); white-space: nowrap; }
.rows > div > span:last-child { text-align: right; word-break: break-word; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.bar-line { height: 6px; border-radius: 3px; background: var(--fill-2); overflow: hidden; margin: 10px 0 2px; }
.bar-line i { display: block; height: 100%; background: var(--blue); border-radius: 3px; transition: width 0.4s var(--ease); }
.bar-line i.full { background: var(--red); }

/* ---------- таблицы ---------- */
.table { background: var(--card); border-radius: var(--r); overflow-x: auto; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 16px; white-space: nowrap; vertical-align: middle; }
td { border-top: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 12px; padding-top: 12px; padding-bottom: 8px; }
tr.link { cursor: pointer; }
tr.link td { transition: background-color 0.12s var(--ease); }
tr.link:hover td { background: var(--fill); }
tr.link:active td { background: var(--fill-2); }
td.wrap { white-space: normal; min-width: 220px; }
.empty { color: var(--muted); padding: 28px 20px; text-align: center; }

/* ---------- кнопки ---------- */
button, .btn {
  font: 500 15px/1.2 var(--sans); border: 0; border-radius: 999px; padding: 9px 17px; cursor: pointer; white-space: nowrap;
  background: var(--blue-tint); color: var(--blue); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease), transform 0.12s var(--ease), opacity 0.15s;
}
button:hover, .btn:hover { background: var(--blue-tint-2); color: var(--blue); }
button:active, .btn:active { transform: scale(0.97); }
button.primary { background: var(--blue); color: var(--on-accent); }
button.primary:hover { background: var(--blue-2); }
button.danger { background: var(--red-tint); color: var(--red); }
button.danger:hover { background: oklch(0.6 0.19 25 / 0.18); }
button.small, .btn.small { padding: 6px 12px; font-size: 13px; }
button.ghost { background: none; padding: 6px 8px; }
button.ghost:hover { background: var(--blue-tint); }
button:disabled { opacity: 0.45; cursor: default; transform: none; }

/* ---------- поля ---------- */
input, select, textarea { font: 15px var(--sans); width: 100%; border: 1px solid transparent; background: var(--card); border-radius: var(--r-s); padding: 10px 12px; color: var(--text); outline: none; transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
input:focus, select:focus, textarea:focus { background: var(--bg); border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint); }
input[type=file] { padding: 7px 8px; font-size: 13px; }
input[type=file]::file-selector-button { font: 500 13px var(--sans); border: 0; border-radius: 999px; padding: 6px 12px; margin-right: 10px; background: var(--blue-tint); color: var(--blue); cursor: pointer; }
textarea { min-height: 140px; resize: vertical; line-height: 1.45; }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 2px 6px; }
label.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 15px; cursor: pointer; }
label.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--blue); flex: none; }
.card input, .card select, .card textarea { background: var(--bg); }
.form { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); align-items: end; }

/* ---------- панели фильтров ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar input { max-width: 360px; border-radius: 999px; padding-left: 16px; }
.toolbar input:focus { box-shadow: 0 0 0 3px var(--blue-tint); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { background: var(--card); color: var(--text); border-radius: 999px; padding: 6px 13px; cursor: pointer; font-size: 14px; box-shadow: var(--shadow); transition: background-color 0.15s var(--ease), color 0.15s var(--ease); }
.chip:hover { background: var(--fill-2); color: var(--text); }
.chip b { font: 500 12px var(--mono); color: var(--muted); margin-left: 5px; }
.chip.on { background: var(--blue); color: var(--on-accent); }
.chip.on b { color: var(--on-accent); opacity: 0.75; }
a.chip { color: var(--blue); }
.pill { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 500; background: var(--fill-2); color: var(--muted); vertical-align: 1px; }
.pill.active, .pill.paid, .pill.done { background: var(--green-tint); color: var(--green); }
.pill.expired, .pill.banned, .pill.canceled, .pill.failed, .pill.rejected, .pill.stopped, .pill.interrupted { background: var(--red-tint); color: var(--red); }
.pill.pending, .pill.new, .pill.soon, .pill.scheduled, .pill.running { background: var(--orange-tint); color: var(--orange); }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 16px; }
.seg { display: inline-flex; background: var(--card); border-radius: 999px; padding: 3px; margin-bottom: 14px; }
.seg span { padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: 14px; white-space: nowrap; transition: background-color 0.18s var(--ease), color 0.18s var(--ease); }
.seg span.on { background: var(--bg); box-shadow: 0 1px 3px oklch(0.2 0.02 250 / 0.14); }
.tag { display: inline-block; background: var(--blue-tint); color: var(--blue); border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 500; margin-right: 3px; }
.copy { cursor: copy; }
.note { white-space: pre-wrap; }

/* ---------- график ---------- */
.chartcard { padding: 16px 18px 18px; }
.chhead { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }
.chhead .seg { background: var(--bg); margin-bottom: 4px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.chhead .seg::-webkit-scrollbar { display: none; }
.chhead .seg span.on { background: var(--blue); color: var(--on-accent); box-shadow: none; }
.chtitle { font-weight: 600; text-align: center; margin-top: 14px; letter-spacing: -0.01em; }
#chtotal { text-align: center; font-size: 13px; margin-bottom: 8px; }
.chmain { position: relative; height: 230px; touch-action: pan-y; }
.chart { display: block; }
.chart text { font: 11px var(--mono); fill: var(--muted); }
.chart .g { stroke: var(--line); stroke-width: 1; }
.chart .b { fill: var(--blue); transition: opacity 0.12s; }
.chart .b.dim { opacity: 0.3; }
.chart .cur { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tip { position: absolute; top: 0; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-s); padding: 7px 11px; font-size: 13px; pointer-events: none; box-shadow: var(--shadow-lg); white-space: nowrap; }
.tip b { font: 600 16px var(--mono); }
.chnav { position: relative; height: 44px; margin-top: 10px; border-radius: 10px; overflow: hidden; background: var(--bg); touch-action: none; }
.chnav svg { display: block; }
.chnav svg rect { fill: var(--blue); opacity: 0.5; }
.chnav .shade { position: absolute; top: 0; bottom: 0; background: var(--card); opacity: 0.75; }
.chnav .shade.l { left: 0; }
.chnav .win { position: absolute; top: 0; bottom: 0; border: 2px solid var(--blue); border-left-width: 10px; border-right-width: 10px; border-radius: 10px; cursor: grab; }
.chnav .win:active { cursor: grabbing; }
.chnav .h { position: absolute; top: 0; bottom: 0; width: 22px; cursor: ew-resize; }
.chnav .h.l { left: -16px; } .chnav .h.r { right: -16px; }

/* ---------- вход ---------- */
.login { max-width: 380px; margin: 10vh auto 0; text-align: center; animation: rise 0.4s var(--ease); }
.login .logos { display: flex; justify-content: center; margin-bottom: 26px; }
.login .logos span { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; border: 4px solid var(--bg); }
.login .logos .tg { background: var(--blue); margin-right: -16px; z-index: 1; }
.login .logos .tg svg { width: 44px; height: 44px; fill: var(--on-accent); margin-left: -4px; }
.login .logos .me { background: var(--dark); color: var(--bg); font-size: 21px; }
.login h1 { font-size: 28px; margin: 0 0 8px; }
.login p { color: var(--muted); margin: 0 0 28px; }
.login .card { padding: 4px 18px; text-align: left; }
.login .card input { border: 0; background: none; padding: 15px 0; font-size: 17px; box-shadow: none; }
.login .card input.code { font: 600 28px var(--mono); letter-spacing: 0.35em; text-align: center; }
.login button.primary { width: 100%; padding: 15px; font-size: 17px; margin-top: 24px; }
.login button.primary svg { width: 20px; height: 20px; fill: var(--on-accent); }
.login .err { color: var(--red); min-height: 22px; margin-top: 12px; font-size: 14px; }
.login .ghost { margin-top: 10px; }

/* ---------- диалог (на телефоне лист снизу), уведомления ---------- */
dialog { background: var(--bg); color: var(--text); border: 0; border-radius: 22px; padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
dialog[open] { animation: rise 0.28s var(--ease); }
dialog::backdrop { background: var(--shade); animation: fade 0.2s var(--ease); }
dialog form { padding: 22px; max-height: calc(100dvh - 40px); overflow-y: auto; }
dialog h3 { margin: 0 0 4px; font-size: 19px; letter-spacing: -0.015em; }
dialog .hint { color: var(--muted); font-size: 13px; margin-top: 5px; }
dialog .actions { justify-content: flex-end; margin-top: 22px; }
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40; max-width: calc(100vw - 32px);
  padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--text);
  background: color-mix(in oklch, var(--card) 72%, transparent); border: 1px solid color-mix(in oklch, var(--line) 80%, transparent);
  backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  box-shadow: 0 8px 28px oklch(0.2 0.02 250 / 0.14); animation: toast 0.3s var(--ease); }
#toast.err { color: var(--red); background: color-mix(in oklch, var(--red) 14%, color-mix(in oklch, var(--card) 72%, transparent)); border-color: color-mix(in oklch, var(--red) 25%, transparent); }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(0.985); } }
@keyframes fade { from { opacity: 0; } }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- загрузка ---------- */
.skel { display: grid; gap: 14px; }
.skel i { display: block; border-radius: var(--r); background: linear-gradient(90deg, var(--card) 0%, var(--fill-2) 50%, var(--card) 100%) 0 0 / 200% 100%; animation: shimmer 1.3s linear infinite; }
.skel i:first-child { height: 34px; width: 220px; border-radius: 10px; }
.skel i:nth-child(2) { height: 96px; }
.skel i:nth-child(3) { height: 260px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- поиск ⌘K ---------- */
#pal { position: fixed; inset: 0; background: var(--shade); z-index: 30; display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; animation: fade 0.15s var(--ease); }
#pal[hidden] { display: none; }
#pal .box { background: var(--bg); width: min(580px, calc(100vw - 24px)); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; animation: rise 0.22s var(--ease); }
#pal input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 17px 20px; font-size: 17px; box-shadow: none; background: var(--bg); }
#pal .res { max-height: 52vh; overflow: auto; padding: 6px; }
#pal .it { display: flex; gap: 12px; align-items: baseline; padding: 10px 14px; border-radius: 11px; cursor: pointer; }
#pal .it .muted:first-child { width: 72px; flex: none; font-size: 13px; }
#pal .it.on { background: var(--blue); color: var(--on-accent); }
#pal .it.on .muted { color: var(--on-accent); opacity: 0.75; }
#pal .it .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pal .hint { color: var(--muted); font-size: 12px; padding: 9px 20px; border-top: 1px solid var(--line); }

/* ---------- телефон ---------- */
@media (max-width: 700px) {
  .bar { flex-wrap: wrap; gap: 8px 10px; padding: 10px 14px 8px; }
  nav { order: 3; width: 100%; margin: 0 -4px; }
  .searchbtn { padding: 6px 12px; }
  .searchbtn .kbd { display: none; }
  main { padding: 16px 14px 80px; }
  h1 { font-size: 26px; margin-bottom: 16px; }
  h2 { margin-left: 14px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .grid > .card { padding: 13px 14px 14px; }
  .stat .v { font-size: 21px; }
  .grid2 { grid-template-columns: 1fr; }
  .toolbar input { max-width: none; flex: 1 1 100%; }
  .seg span { padding: 6px 11px; }
  th, td { padding: 10px 12px; }
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 22px 22px 0 0; }
  dialog form { padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); max-height: 88dvh; }
  dialog[open] { animation: sheet 0.32s var(--ease); }
  dialog .actions button { flex: 1; padding: 13px; }
  #pal { padding-top: 8px; }
}
@keyframes sheet { from { transform: translateY(100%); } }
@media (pointer: coarse) {
  button, .btn { min-height: 40px; }
  button.small, .btn.small { min-height: 34px; }
  .chip { padding: 8px 14px; }
  nav a { padding: 8px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
.login .card input:focus { border-color: transparent; box-shadow: none; background: none; }
.login .card:focus-within { box-shadow: 0 0 0 3px var(--blue-tint); }
/* у полей своя подсветка фокуса: общий контур не нужен (давал двойную рамку) */
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
.login .card { overflow: hidden; }
/* без стрелок у числовых полей */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
/* списки настроек: подпись слева, поле с единицей справа */
.list { padding-top: 6px; padding-bottom: 14px; }
.lsub { font-size: 13px; color: var(--muted); margin: 12px 0 2px; }
.lsub:first-child { margin-top: 4px; }
.lrow { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.lrow:last-of-type { border-bottom: 0; }
.lrow > span:first-child { min-width: 0; }
.lrow small { display: block; font-size: 13px; color: var(--muted); margin-top: 1px; }
.lval { display: flex; align-items: center; gap: 8px; flex: none; }
.lval input { width: 82px; text-align: right; font-family: var(--mono); padding: 8px 10px; }
.lval i { font-style: normal; color: var(--muted); font-size: 14px; min-width: 44px; }
.lval input + i + input { margin-left: -4px; }
.list .actions { margin-top: 10px; }
/* всплывашки: календарь и меню */
.pop { position: fixed; z-index: 60; background: color-mix(in oklch, var(--bg) 88%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 10px; animation: rise 0.18s var(--ease); }
.dpick, .spick { width: 100%; justify-content: space-between; background: var(--card); color: var(--text); font-weight: 400; border-radius: var(--r-s); padding: 10px 12px; min-height: 42px; text-align: left; }
.card .dpick, .card .spick, dialog .dpick, dialog .spick { background: var(--card); }
.card .dpick, .card .spick { background: var(--bg); }
.dpick:hover, .spick:hover { background: var(--fill); color: var(--text); }
.dpick:active, .spick:active { transform: none; }
.spick svg { color: var(--muted); flex: none; }
.segpick { display: flex; width: 100%; margin: 0; }
.segpick span { flex: 1; text-align: center; }
.cal-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 8px; }
.cal-head b { font-size: 15px; }
.cal-head button { font-size: 20px; padding: 2px 10px; min-height: 0; line-height: 1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 38px); gap: 2px; }
.cal-grid.wk i { font-style: normal; font-size: 12px; color: var(--muted); text-align: center; padding: 2px 0 4px; }
.cal-grid span { height: 38px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; font-size: 15px; font-variant-numeric: tabular-nums; transition: background-color 0.12s; }
.cal-grid span:hover { background: var(--fill-2); }
.cal-grid span.out { color: var(--muted); opacity: 0.45; cursor: default; }
.cal-grid span.out:hover { background: none; }
.cal-grid span.today { color: var(--blue); font-weight: 600; }
.cal-grid span.sel { background: var(--blue); color: var(--on-accent); font-weight: 600; }
.cal-time { display: flex; align-items: center; gap: 6px; padding: 10px 4px 2px; border-top: 1px solid var(--line); margin-top: 8px; }
.cal-time .muted { flex: 1; }
.cal-time input { width: 56px; text-align: center; font-family: var(--mono); padding: 7px 6px; }
.cal-foot { display: flex; justify-content: space-between; padding-top: 8px; }
.menu { min-width: 200px; max-height: 50vh; overflow: auto; }
.menu div { display: flex; align-items: center; gap: 8px; padding: 9px 12px 9px 8px; border-radius: 10px; cursor: pointer; }
.menu div:hover { background: var(--fill-2); }
.menu .ck { width: 16px; color: var(--blue); visibility: hidden; font-weight: 600; }
.menu div.on .ck { visibility: visible; }
@media (max-width: 700px) { .cal-grid { grid-template-columns: repeat(7, 40px); } .cal-grid span { height: 40px; } }
/* предпросмотр сообщения как в Telegram */
.msgcard { display: flex; flex-direction: column; }
.msghead { margin-bottom: 10px; }
.tgmsg { background: var(--bg); border-radius: 14px; overflow: hidden; max-width: 420px; }
.tgmsg img { display: block; width: 100%; max-height: 260px; object-fit: cover; }
.tgtext { padding: 10px 12px; white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.4; -webkit-user-select: text; user-select: text; }
.tgtext blockquote { margin: 4px 0; padding: 2px 0 2px 10px; background: var(--blue-tint); border-radius: 6px; }
.tgtext code, .tgtext pre { font-family: var(--mono); font-size: 13px; }
.tgtext .spoiler { background: var(--fill-2); color: transparent; border-radius: 4px; }
.cemoji { border-bottom: 1px dotted var(--blue); }
.tgbtns { max-width: 420px; display: grid; gap: 4px; margin-top: 4px; }
.tgbtns div { display: flex; gap: 4px; }
.tgbtns span { flex: 1; text-align: center; background: var(--bg); border-radius: 10px; padding: 7px 8px; font-size: 13px; }
.msgcard .actions { margin-top: auto; padding-top: 14px; }
.bkrow { border-bottom: 1px solid var(--line); padding: 8px 0 10px; }
.bkbtn { display: grid; grid-template-columns: 1.3fr 1fr 1.3fr 0.8fr auto; gap: 6px; margin: 6px 0; align-items: center; }
.bkbtn .spick, .bkbtn .segpick { min-height: 40px; }
@media (max-width: 700px) { .bkbtn { grid-template-columns: 1fr 1fr; } }
dialog:has(.bkrow) { width: min(760px, calc(100vw - 32px)); }
/* перетаскивание строк */
td.drag { width: 28px; padding-right: 0; color: var(--muted); cursor: grab; touch-action: none; font-size: 18px; line-height: 1; }
td.drag:active { cursor: grabbing; }
tr.dragging td { background: var(--blue-tint); }
tr.dragging { box-shadow: 0 6px 20px oklch(0.2 0.02 250 / 0.15); }
/* список серверов */
.srvname { display: flex; align-items: center; gap: 8px; }
.srvsub { font-size: 12px; color: var(--muted); margin-top: 2px; }
td.srvst { text-align: right; width: 70px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--green); } .dot.bad { background: var(--red); } .dot.wait { background: var(--muted); animation: fade 0.8s infinite alternate; }
.srvlist td { white-space: normal; }
.srvlist td:nth-child(2) { width: 100%; }
/* iPhone увеличивает страницу при фокусе на поле со шрифтом меньше 16px */
@media (pointer: coarse) { input, select, textarea { font-size: 16px !important; } .login .card input.code { font-size: 28px !important; } }
body.sorting, body.sorting * { cursor: grabbing !important; }
body.sorting { touch-action: none; overscroll-behavior: none; }
/* доводка */
.bar { max-width: 1240px; gap: 14px; }
main { max-width: 1240px; }
.searchbtn { padding: 7px 9px 7px 11px; gap: 7px; flex: none; }
.grid2 { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.whosub { color: var(--muted); font-size: 13px; margin-left: 2px; }
.whosub .mono { font-size: 12px; }
td .tag { vertical-align: 1px; }
dialog .rows > div { padding: 9px 0; }
/* плитки статистики: равные колонки на всю ширину, крупные цифры SF Pro (как в iOS) */
.grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); padding: 6px 4px; }
.grid > .card { padding: 14px 18px; }
.stat .k { font-size: 13px; letter-spacing: 0; }
.stat .v { font: 600 30px/1.1 var(--sans); letter-spacing: -0.025em; font-variant-numeric: tabular-nums; margin-top: 6px; }
.stat .v .num { font: inherit; letter-spacing: inherit; }
.stat .v small { font-size: 0.6em; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stat .s { font-size: 13px; margin-top: 4px; min-height: 18px; }
@media (max-width: 700px) { .stat .v { font-size: 24px; } .grid > .card { padding: 12px 14px; } }
/* меню: активный пункт подчёркнут полоской на нижней границе шапки, полоска переезжает при переходе */
.bar { padding-top: 0; padding-bottom: 0; min-height: 54px; align-items: stretch; }
.brand, .searchbtn { align-self: center; }
nav { position: relative; align-self: stretch; gap: 2px; }
nav a { display: flex; align-items: center; padding: 0 11px; border-radius: 0; color: var(--muted); font-weight: 500; background: none !important; transition: color 0.15s var(--ease); }
nav a:hover { color: var(--text); }
nav a.on { color: var(--blue); background: none; }
#navline { position: absolute; left: 0; bottom: 0; height: 3px; width: 100px; border-radius: 3px 3px 0 0; background: var(--blue);
  transform-origin: 0 0; transition: transform 0.35s var(--ease), opacity 0.2s; pointer-events: none; opacity: 0; }
@media (max-width: 700px) {
  .bar { padding: 8px 14px 0; min-height: 0; }
  nav { height: 42px; margin: 2px -14px 0; padding: 0 8px; width: calc(100% + 28px); }
  nav a { padding: 0 10px; }
}
@media (pointer: coarse) { nav a { padding: 0 12px; } }
@media (max-width: 700px) { .grid { grid-template-columns: repeat(2, 1fr); } }
/* панель партнёра */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--blue); color: var(--on-accent); border-radius: var(--r); padding: 20px 22px; }
.hero .k { font-size: 13px; opacity: 0.8; }
.hero .v { font: 700 40px/1.1 var(--sans); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.hero .v small { font-size: 0.55em; font-weight: 600; opacity: 0.75; margin-left: 4px; }
.hero .s { font-size: 13px; opacity: 0.85; margin-top: 6px; }
.hero .btn { background: var(--on-accent); color: var(--blue); flex: none; }
.hero .btn.off { opacity: 0.6; }
.up { color: var(--green); } .down { color: var(--red); }
@media (max-width: 700px) { .hero { flex-direction: column; align-items: stretch; } .hero .v { font-size: 34px; } .hero .btn { text-align: center; } }
/* насыщенность шрифтов: мягче, как в Telegram/iOS (700 в тёмной теме выглядит тяжело) */
b, strong { font-weight: 600; }
h1 { font-weight: 650; letter-spacing: -0.022em; }
.login h1 { font-weight: 600; font-size: 30px; letter-spacing: -0.02em; margin-bottom: 10px; }
.login p { font-size: 16px; line-height: 1.45; }
.login p b { font-weight: 500; color: var(--text); }
.login button.primary { font-weight: 500; letter-spacing: -0.005em; }
.login .card input { font-weight: 400; }
.login .logos .me, .logo { font-weight: 700; }
button, .btn { font-weight: 500; }
nav a { font-weight: 500; }
.card h2, dialog h3 { font-weight: 600; }
.stat .v { font-weight: 600; }
.hero .v { font-weight: 650; }
th { font-weight: 500; }
td b { font-weight: 600; }
.brand { font-weight: 600; }
@media (prefers-color-scheme: dark) {
  /* светлый текст на тёмном читается жирнее: на полшага тоньше */
  h1 { font-weight: 600; }
  .login h1 { font-weight: 590; }
  b, strong, td b, .card h2, dialog h3 { font-weight: 590; }
  .stat .v { font-weight: 590; }
}
/* SF Mono в полужирном слишком тяжёлый: цифры в выделенном тексте средние */
b .num, b.num, b .mono, b.mono, .mono b, td b .num { font-weight: 500; }
.tip b, .chip b { font-weight: 500; }
.login .card input.code { font-weight: 500; }
.rows > div > span:last-child b { font-weight: 600; }
#pal .it .t { font-weight: 500; }
.srvname b, .msghead b { font-weight: 600; }
@media (prefers-color-scheme: dark) {
  b .num, b.num, b .mono, b.mono, .mono b, td b .num, .tip b { font-weight: 450; }
  .srvname b, .msghead b, .rows > div > span:last-child b { font-weight: 560; }
  nav a { font-weight: 450; }
}
/* поле на экране входа: рамка, контраст в тёмной теме, заметный фокус */
.login .card { padding: 0 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), background-color 0.15s; }
.login .card input { height: 56px; padding: 0; font-size: 17px; }
.login .card input::placeholder { color: var(--muted); opacity: 1; }
.login .card:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-tint); background: var(--bg); }
.login .card input.code { height: 64px; }
@media (prefers-color-scheme: dark) {
  .login .card { background: var(--fill); border-color: oklch(0.34 0.01 250); }
  .login .card:focus-within { background: var(--fill); }
  .login .card input::placeholder { color: oklch(0.62 0.01 250); }
}
/* поле входа компактнее */
.login .card { padding: 0 14px; border-radius: 12px; }
.login .card input { height: 44px; font-size: 16px; }
.login .card input.code { height: 52px; font-size: 24px; }
.login .card:focus-within { box-shadow: 0 0 0 3px var(--blue-tint); }
.login button.primary { padding: 12px; font-size: 16px; margin-top: 16px; }
.login .card { border-radius: 999px; padding: 0 18px; }
/* экран входа по центру экрана */
.login { margin: 0 auto; min-height: calc(100dvh - 40px); display: flex; flex-direction: column; justify-content: center; padding-bottom: 6vh; }
.login form, .login .ghost { width: 100%; }
/* логотип */
.logo { color: var(--bg); }
.logo svg { width: 18px; height: auto; margin: 1px 0 0 1px; }
.login .logos .me { color: var(--bg); }
.login .logos .me svg { width: 50px; height: auto; margin: 4px 0 0 2px; }
/* настоящий логотип Telegram */
.login .logos .tg { background: none; padding: 0; overflow: hidden; }
.login .logos .tg svg { width: 100%; height: 100%; margin: 0; fill: initial; }
.login button.primary svg { width: 18px; height: 18px; }
/* свой логотип без круга */
.logo { background: none !important; color: var(--text); width: auto; height: auto; border-radius: 0; }
.logo svg { width: 30px; margin: 0; display: block; }
.login .logos { align-items: center; gap: 18px; }
.login .logos .tg { margin-right: 0; }
.login .logos .me { background: none !important; border: 0; color: var(--text); width: auto; height: auto; border-radius: 0; }
.login .logos .me svg { width: 92px; margin: 0; display: block; }
#toast { width: max-content; max-width: min(520px, calc(100vw - 32px)); text-align: center; white-space: normal; }
