/* ============================================================
   Панель аренды серверов — дизайн-система
   ============================================================ */

:root {
  /* поверхности */
  --bg:            #080a0f;
  --bg-glow-a:     rgba(99, 102, 241, .16);
  --bg-glow-b:     rgba(34, 211, 238, .10);
  --surface:       #10141c;
  --surface-2:     #161b25;
  --surface-3:     #1c2230;
  --sidebar:       #0c0f16;

  /* линии */
  --line:          rgba(255, 255, 255, .07);
  --line-strong:   rgba(255, 255, 255, .13);
  --inset:         inset 0 1px 0 rgba(255, 255, 255, .045);

  /* текст */
  --text:          #e9edf5;
  --text-dim:      #a6b0c2;
  --muted:         #7c879b;

  /* акценты */
  --accent:        #6d7cff;
  --accent-2:      #a06bff;
  --accent-ink:    #0a0d18;
  --accent-soft:   rgba(109, 124, 255, .13);
  --accent-line:   rgba(109, 124, 255, .35);
  --grad:          linear-gradient(135deg, #6d7cff 0%, #a06bff 100%);

  --good:          #3ddc97;
  --good-soft:     rgba(61, 220, 151, .12);
  --warn:          #ffc453;
  --warn-soft:     rgba(255, 196, 83, .12);
  --bad:           #ff6b72;
  --bad-soft:      rgba(255, 107, 114, .12);

  /* геометрия */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --r-xl: 20px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow:    0 4px 16px -4px rgba(0, 0, 0, .5);
  --shadow-lg: 0 18px 48px -12px rgba(0, 0, 0, .65);
  --glow:      0 6px 24px -8px rgba(109, 124, 255, .6);

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(900px 520px at 12% -8%, var(--bg-glow-a), transparent 65%),
    radial-gradient(760px 440px at 96% 4%, var(--bg-glow-b), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  font-feature-settings: "cv02", "cv03", "cv04", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: #9aa5ff; text-decoration: none; }

h1, h2, h3 { margin: 0; font-weight: 640; letter-spacing: -.018em; line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.05rem; letter-spacing: -.012em; }
h3 { font-size: .875rem; color: var(--text-dim); font-weight: 600; }
p  { margin: 0 0 .6rem; }

::selection { background: rgba(109, 124, 255, .32); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .1); border-radius: 20px;
  border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .2); background-clip: content-box; }

/* ============================================================
   Каркас
   ============================================================ */

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

.sidebar {
  width: 248px; flex: 0 0 248px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .022), transparent 220px), var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 20px 14px 28px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 20px; }
.brand-logo {
  width: 36px; height: 36px; flex: none; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--grad); color: #fff; font-size: 17px;
  box-shadow: var(--glow), var(--inset);
}
.brand-name { font-weight: 640; font-size: 14.5px; letter-spacing: -.01em; }
.brand-sub  { font-size: 11px; color: var(--muted); letter-spacing: .01em; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; font-weight: 600;
  color: var(--muted); padding: 18px 12px 7px;
}
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--text-dim); font-size: 13.5px; font-weight: 500;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav a .ico { flex: none; opacity: .75; transition: opacity .15s var(--ease); }
.nav a span.txt { flex: 1; min-width: 0; }
.nav a:hover { background: rgba(255, 255, 255, .045); color: var(--text); }
.nav a:hover .ico { opacity: 1; }
.nav a.active {
  background: linear-gradient(90deg, var(--accent-soft), rgba(160, 107, 255, .07));
  color: #ffffff; box-shadow: var(--inset);
}
.nav a.active .ico { opacity: 1; color: var(--accent); }
.nav a.active::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--grad);
}
.nav .count {
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--text-dim); background: rgba(255, 255, 255, .06);
  border-radius: 20px; padding: 1px 8px; min-width: 22px; text-align: center;
}
.nav .count.alert { color: var(--bad); background: var(--bad-soft); }
.nav-spacer { flex: 1; min-height: 12px; }

.main { flex: 1; min-width: 0; padding: 26px 30px 72px; }
.main-inner { max-width: 1480px; margin: 0 auto; animation: rise .35s var(--ease) both; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .main-inner { animation: none; }
  * { transition: none !important; }
}

.topbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 22px; flex-wrap: wrap;
}
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 5px; }
.topbar h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

@media (max-width: 980px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-group { display: none; }
  .nav-spacer { display: none; }
  .main { padding: 18px 16px 48px; }
}

/* ============================================================
   Сетка и карточки
   ============================================================ */

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side   { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.grid > .stack { display: flex; flex-direction: column; gap: 16px; }
/* внутри сетки отступы задаёт gap — собственный margin карточек только сбивает ряды */
.grid > .card, .grid > .stack > .card { margin-bottom: 0; }

@media (max-width: 1280px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1080px) {
  .grid.cols-2, .grid.cols-3, .grid.side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) { .grid.cols-4 { grid-template-columns: minmax(0, 1fr); } }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow), var(--inset);
}
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 16px 20px 12px; margin-bottom: 0; }
.card.tinted { background: linear-gradient(180deg, rgba(255, 255, 255, .026), transparent 70%), var(--surface); }
.card.alarm { border-color: rgba(255, 107, 114, .3); box-shadow: 0 0 0 1px rgba(255,107,114,.06), var(--shadow); }

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 14px; flex-wrap: wrap;
}
.card-head .titles { min-width: 0; }
.card-head .sub { color: var(--muted); font-size: 12px; margin-top: 3px; }

.section-title { display: flex; align-items: center; gap: 9px; }
.section-title .ico { color: var(--muted); flex: none; }

/* ============================================================
   Метрики
   ============================================================ */

.stat {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, .03), transparent 60%), var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px 18px;
  box-shadow: var(--shadow), var(--inset);
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.stat:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.stat::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 2px;
  background: var(--grad); opacity: .55;
}
.stat.good::after { background: linear-gradient(90deg, var(--good), #2fb9a0); }
.stat.bad::after  { background: linear-gradient(90deg, var(--bad), #d94a72); }
.stat.neutral::after { background: linear-gradient(90deg, #4a5468, #2c3242); }

.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.stat .label {
  color: var(--muted); font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .09em;
}
.stat .chip {
  width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); box-shadow: var(--inset);
}
.stat.good .chip { background: var(--good-soft); color: var(--good); }
.stat.bad  .chip { background: var(--bad-soft);  color: var(--bad); }
.stat.neutral .chip { background: rgba(255, 255, 255, .06); color: var(--text-dim); }
.stat .value {
  font-size: 27px; font-weight: 680; margin-top: 10px;
  letter-spacing: -.028em; font-variant-numeric: tabular-nums; line-height: 1.15;
}
.stat .value.sm { font-size: 20px; letter-spacing: -.02em; }
.stat.good .value { color: var(--good); }
.stat.bad  .value { color: var(--bad); }
.stat .hint { color: var(--muted); font-size: 12px; margin-top: 6px; min-height: 18px; }

/* ============================================================
   Таблицы
   ============================================================ */

.table-wrap { overflow-x: auto; border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .085em;
  padding: 10px 14px; white-space: nowrap;
  background: rgba(255, 255, 255, .022);
  border-bottom: 1px solid var(--line);
}
th:first-child { border-top-left-radius: var(--r-sm); }
th:last-child  { border-top-right-radius: var(--r-sm); }
td {
  padding: 12px 14px; border-bottom: 1px solid rgba(255, 255, 255, .045);
  vertical-align: middle;
}
tbody tr { transition: background .13s var(--ease); }
tbody tr:hover { background: rgba(255, 255, 255, .028); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); text-align: center; padding: 38px 16px; font-size: 13.5px; }
.empty a { font-weight: 500; }

.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* строки-списки (компактные карточки вместо таблицы) */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid rgba(255, 255, 255, .045);
}
.list-row:last-child { border-bottom: 0; }
.list-row .lr-main { min-width: 0; }
.list-row .lr-side { text-align: right; flex: none; }
.list-row.stacked { flex-direction: column; align-items: stretch; gap: 10px; }
.list-row.bare { padding: 0; border-bottom: 0; }

/* ============================================================
   Бейджи и теги
   ============================================================ */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 560; white-space: nowrap;
  border: 1px solid transparent; line-height: 1.5;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }
.badge.good  { color: var(--good); background: var(--good-soft); border-color: rgba(61, 220, 151, .26); }
.badge.warn  { color: var(--warn); background: var(--warn-soft); border-color: rgba(255, 196, 83, .26); }
.badge.bad   { color: var(--bad);  background: var(--bad-soft);  border-color: rgba(255, 107, 114, .28); }
.badge.muted { color: var(--text-dim); background: rgba(255, 255, 255, .05); border-color: var(--line); }
.badge.accent{ color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.badge.plain::before { display: none; }
.badge.lg { padding: 5px 12px; font-size: 12px; }

.tag {
  font-size: 11px; font-weight: 500; color: var(--text-dim);
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line);
  padding: 2px 8px; border-radius: 6px; white-space: nowrap;
  font-family: var(--mono);
}

/* ============================================================
   Кнопки
   ============================================================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text);
  font-family: inherit; font-size: 13px; font-weight: 540; line-height: 1.2;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  box-shadow: var(--shadow-sm), var(--inset);
  transition: background .15s var(--ease), border-color .15s var(--ease),
              transform .12s var(--ease), box-shadow .15s var(--ease), color .15s var(--ease);
}
.btn:hover { background: var(--surface-3); border-color: rgba(255, 255, 255, .2); color: var(--text); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn .ico { flex: none; opacity: .85; }

.btn.primary {
  background: var(--grad); border-color: transparent; color: #fff; font-weight: 600;
  box-shadow: var(--glow), var(--inset);
}
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 10px 30px -8px rgba(109, 124, 255, .75); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text-dim); box-shadow: none; }
.btn.ghost:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.btn.ghost.on { background: var(--accent-soft); border-color: var(--accent-line); color: #c3caff; }
.btn.danger { color: var(--bad); border-color: rgba(255, 107, 114, .3); background: rgba(255, 107, 114, .06); }
.btn.danger:hover { background: rgba(255, 107, 114, .14); border-color: rgba(255, 107, 114, .5); }
.btn.small { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn.icon-only { padding: 6px 9px; }
.btn[disabled] { opacity: .42; cursor: not-allowed; pointer-events: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent); }

.actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.actions.end { justify-content: flex-end; }
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2);
       border: 1px solid var(--line); border-radius: 12px; }
.seg .btn { border: 0; background: transparent; box-shadow: none; color: var(--muted); }
.seg .btn:hover { background: rgba(255, 255, 255, .06); color: var(--text); transform: none; }
.seg .btn.on { background: var(--accent-soft); color: #c3caff; }
form.inline { display: inline-flex; }

/* ============================================================
   Формы
   ============================================================ */

label {
  display: block; font-size: 11.5px; font-weight: 550; color: var(--muted);
  margin-bottom: 6px; letter-spacing: .01em;
}
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=month], input[type=email], select, textarea {
  width: 100%;
  background: #0b0e14;
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 12px;
  font-family: inherit; font-size: 13.5px; line-height: 1.4;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
input::placeholder, textarea::placeholder { color: #56607280; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237c879b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 11px center;
  padding-right: 34px; cursor: pointer;
}
option { background: #10141c; color: var(--text); }
textarea {
  resize: vertical; min-height: 78px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
}
input:hover, select:hover, textarea:hover { border-color: rgba(255, 255, 255, .2); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); background: #0d1119;
  box-shadow: 0 0 0 3px var(--accent-soft), inset 0 1px 2px rgba(0, 0, 0, .3);
}
input[type=date], input[type=month] { cursor: text; }
::-webkit-calendar-picker-indicator { filter: invert(.62) sepia(.1) saturate(.4); cursor: pointer; }

.field { margin-bottom: 14px; min-width: 0; }
.field .help { color: var(--muted); font-size: 11.5px; margin-top: 6px; line-height: 1.45; }
.field .help.warn { color: var(--warn); }

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
@media (max-width: 900px) {
  .form-grid, .form-grid.cols-2, .form-grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2, .form-grid .span-all { grid-column: auto; }
}

.checkbox {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: rgba(255, 255, 255, .022);
}
.checkbox input { width: 17px; height: 17px; flex: none; margin-top: 1px; accent-color: var(--accent); cursor: pointer; }
.checkbox label { margin: 0; color: var(--text-dim); font-size: 13px; font-weight: 450; cursor: pointer; }

/* выбор из нескольких вариантов с пояснением */
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 900px) { .choices { grid-template-columns: minmax(0, 1fr); } }
.choice {
  display: flex; align-items: flex-start; gap: 11px; margin: 0; cursor: pointer;
  padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--r);
  background: rgba(255, 255, 255, .022); color: var(--text);
  font-size: 13px; font-weight: 400; text-transform: none; letter-spacing: 0;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.choice:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, .04); }
.choice:has(input:checked) {
  border-color: var(--accent-line); background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-line);
}
.choice input { width: 17px; height: 17px; flex: none; margin-top: 1px; accent-color: var(--accent); }
.choice b { display: block; font-weight: 600; margin-bottom: 3px; }
.choice em { display: block; font-style: normal; color: var(--muted); font-size: 12px;
  line-height: 1.5; }

.filters { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 170px; }
.filters .search { min-width: 250px; }

/* ============================================================
   Флеш-сообщения
   ============================================================ */

.flashes { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.flash {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 16px; border-radius: var(--r);
  font-size: 13.5px; line-height: 1.5;
  border: 1px solid var(--line); background: var(--surface);
  box-shadow: var(--shadow-sm), var(--inset);
  animation: rise .3s var(--ease) both;
}
.flash .ico { flex: none; margin-top: 1px; }
.flash.ok    { border-color: rgba(61, 220, 151, .3);  background: linear-gradient(90deg, var(--good-soft), transparent 60%), var(--surface); }
.flash.ok .ico { color: var(--good); }
.flash.error { border-color: rgba(255, 107, 114, .34); background: linear-gradient(90deg, var(--bad-soft), transparent 60%), var(--surface); }
.flash.error .ico { color: var(--bad); }

/* ============================================================
   Типографика и утилиты
   ============================================================ */

code, .mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: -.01em; }
pre {
  background: #080a10; border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; overflow-x: auto; margin: 0;
  font-family: var(--mono); font-size: 12px; line-height: 1.6; color: #c9d3e3;
}
.label {
  color: var(--muted); font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .09em; margin-bottom: 7px;
}
.muted { color: var(--muted); }
.dim   { color: var(--text-dim); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num-font { font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--line); margin: 18px 0; border: 0; }
.mt { margin-top: 14px; }
.mb0 { margin-bottom: 0; }
.grow { flex: 1; min-width: 0; }

.kv { display: grid; grid-template-columns: minmax(120px, 168px) 1fr; gap: 11px 16px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; min-width: 0; word-break: break-word; }

.copybox { display: flex; gap: 8px; align-items: stretch; }
.copybox input { font-family: var(--mono); font-size: 12px; }
.copybox .btn { flex: none; }

details.raw {
  border: 1px solid var(--line); border-radius: var(--r);
  background: rgba(255, 255, 255, .018); margin-bottom: 10px; overflow: hidden;
}
details.raw > summary {
  cursor: pointer; color: var(--text-dim); font-size: 12.5px; font-weight: 500;
  padding: 11px 14px; list-style: none; display: flex; align-items: center; gap: 9px;
  transition: background .15s var(--ease), color .15s var(--ease);
}
details.raw > summary::-webkit-details-marker { display: none; }
details.raw > summary::before {
  content: "›"; font-size: 16px; line-height: 1; color: var(--muted);
  transition: transform .18s var(--ease); display: inline-block;
}
details.raw[open] > summary::before { transform: rotate(90deg); }
details.raw > summary:hover { background: rgba(255, 255, 255, .035); color: var(--text); }
details.raw > pre { border: 0; border-top: 1px solid var(--line); border-radius: 0; }
details.raw[open] > summary { border-bottom: 1px solid transparent; }

/* ============================================================
   График
   ============================================================ */

.chart {
  display: flex; align-items: flex-end; gap: 8px;
  height: 168px; padding: 14px 2px 0;
  border-bottom: 1px solid var(--line);
}
.chart .bar {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  justify-content: flex-end; align-items: center; gap: 8px; height: 100%;
}
.chart .fill {
  width: 100%; max-width: 54px; border-radius: 7px 7px 3px 3px; min-height: 4px;
  background: linear-gradient(180deg, #8b93ff, #5a5fe0);
  box-shadow: 0 -2px 14px -4px rgba(109, 124, 255, .7);
  transition: filter .18s var(--ease), transform .18s var(--ease);
}
.chart .bar:hover .fill { filter: brightness(1.2); transform: scaleY(1.015); }
.chart .val {
  font-size: 11.5px; font-weight: 600; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.chart-legend {
  display: flex; gap: 8px; padding-top: 9px;
}
.chart-legend .cap {
  flex: 1; min-width: 0; text-align: center;
  font-size: 11px; color: var(--muted); white-space: nowrap;
}

/* ============================================================
   Схема трафика
   ============================================================ */

.flow {
  display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap;
}
.flow .node {
  flex: 1 1 170px; min-width: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .04), transparent), var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 14px; box-shadow: var(--inset);
}
.flow .node .t {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .085em;
  color: var(--muted); font-weight: 600; margin-bottom: 5px;
}
.flow .node .v { font-size: 13.5px; font-weight: 550; }
.flow .node .m { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.flow .arrow {
  display: grid; place-items: center; color: var(--accent); flex: none;
  font-size: 11px; letter-spacing: .04em; opacity: .8; padding: 0 2px;
}
@media (max-width: 900px) { .flow .arrow { transform: rotate(90deg); padding: 6px 0; } }

/* ============================================================
   QR и вход
   ============================================================ */

.qr-card {
  background: #fff; padding: 10px; border-radius: var(--r);
  width: 168px; flex: none; box-shadow: var(--shadow);
}
.qr-card img { width: 100%; display: block; }
.access { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.access .kv { flex: 1; min-width: 250px; }

/* ============================================================
   Личная страница клиента (/r/<токен>)
   ============================================================ */

.portal { min-height: 100vh; padding: 34px 20px 56px; }
.portal-inner { max-width: 760px; margin: 0 auto; animation: rise .35s var(--ease) both; }
.portal-brand { justify-content: center; padding: 0 0 24px; }
.portal-desc { font-size: 14px; color: var(--text-dim); margin-top: 6px; line-height: 1.55; }
.portal-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 26px; }
.portal-contact { text-align: center; color: var(--text-dim); font-size: 13px; margin-top: -4px; }
.btn-wide { width: 100%; padding: 13px 18px; font-size: 14.5px; }
@media (max-width: 720px) {
  .portal .grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
}

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 384px; }
.login-card .card { padding: 24px; margin-bottom: 0; box-shadow: var(--shadow-lg), var(--inset); }
.login-card .brand { justify-content: center; padding: 0 0 22px; }
.login-hint { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }
