@font-face {
  font-family: 'Golos Text';
  src: url('/fonts/golos-variable.woff2') format('woff2-variations');
  font-weight: 300 900;
  font-display: swap;
}

@font-face {
  font-family: 'Monaspace Neon';
  src: url('/fonts/monaspace-neon.woff2') format('woff2-variations');
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --bg: #07080b;
  --bg-elev: #0a0c11;
  --text: #eef1f6;
  --text-dim: #98a1b2;
  --text-faint: #6b7484;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);
  --accent: #4c8dff;
  --accent-soft: rgba(76, 141, 255, 0.14);
  --ok: #38d39f;
  --warn: #f3b13c;
  --danger: #ff5f6d;
  --font: 'Golos Text', -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Monaspace Neon', ui-monospace, 'SF Mono', Menlo, monospace;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(1100px 620px at 12% -12%, rgba(76, 141, 255, 0.13), transparent 62%),
    radial-gradient(900px 620px at 96% 4%, rgba(51, 214, 196, 0.06), transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--text-dim);
}

.small {
  font-size: 11.5px;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

::selection {
  background: rgba(76, 141, 255, 0.32);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.09);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
  background-clip: content-box;
}

/* ---------- brand ---------- */

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #9dc0ff;
  background: linear-gradient(160deg, rgba(76, 141, 255, 0.3), rgba(76, 141, 255, 0.05));
  border: 1px solid rgba(76, 141, 255, 0.32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 10px 26px -16px rgba(76, 141, 255, 0.9);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.brand-sub {
  font-size: 10.5px;
  color: var(--text-faint);
  letter-spacing: 0.05em;
}

/* ---------- shell ---------- */

.app {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), transparent 42%);
  z-index: 20;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  opacity: 0.7;
  flex: none;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
}

.nav-item.is-active {
  color: #fff;
  border-color: rgba(76, 141, 255, 0.24);
  background: linear-gradient(90deg, rgba(76, 141, 255, 0.18), rgba(76, 141, 255, 0.03));
}

.nav-item.is-active svg {
  color: #8fb6ff;
  opacity: 1;
}

.nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.018);
}

.engine-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-dim);
}

.main {
  min-width: 0;
  padding: 26px 30px 70px;
  max-width: 1460px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar h1 {
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.022em;
}

.topbar p {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 3px;
  max-width: 62ch;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
}

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.seg button {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.seg button:hover {
  color: var(--text);
}

.seg button.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(56, 211, 159, 0.22);
  background: rgba(56, 211, 159, 0.07);
  color: #8defc8;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
  flex: none;
}

.dot-live {
  background: var(--ok);
  animation: pulse 2.6s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(56, 211, 159, 0.14);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(56, 211, 159, 0.04);
  }
}

.view {
  animation: fade 0.22s ease;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- metrics ---------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(208px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 122px;
  padding: 16px 18px 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background:
    radial-gradient(120% 130% at 0% 0%, rgba(76, 141, 255, 0.1), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.metric-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.metric-value {
  font-family: var(--mono);
  font-size: 29px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-top: 7px;
}

.metric-hint {
  font-size: 11px;
  color: var(--text-faint);
}

.spark {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 38px;
  opacity: 0.65;
  pointer-events: none;
}

/* ---------- panels ---------- */

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.031), rgba(255, 255, 255, 0.009));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 24px 60px -46px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 20px 13px;
}

.panel-head h2 {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel-head p {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 2px;
}

.panel-head-row {
  align-items: center;
  flex-wrap: wrap;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
  align-items: stretch;
}

.grid-access {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  margin-bottom: 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

/* ---------- chart ---------- */

.panel-chart {
  display: flex;
  flex-direction: column;
}

.chart-body {
  flex: 1;
  min-height: 214px;
  padding: 0 8px 10px;
}

#traffic {
  width: 100%;
  height: 100%;
  display: block;
}

.legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
  color: var(--text-dim);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 14px;
  height: 3px;
  border-radius: 2px;
}

.swatch-req {
  background: linear-gradient(90deg, #4c8dff, #7fb0ff);
}

.swatch-tok {
  background: linear-gradient(90deg, #33d6c4, #7ff0e4);
}

/* ---------- pool list ---------- */

.pool-list {
  max-height: 258px;
  overflow-y: auto;
  padding: 0 8px 10px;
}

.pool-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  padding: 9px 10px;
  border-radius: 9px;
}

.pool-row + .pool-row {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.pool-name {
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pool-meta {
  grid-column: 1 / 2;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  color: var(--text-faint);
  font-family: var(--mono);
}

.pool-share {
  grid-row: 1 / 3;
  grid-column: 2 / 3;
  align-self: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  min-width: 84px;
}

.bar {
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  margin-top: 5px;
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #4c8dff, #6fd1ff);
  transition: width 0.4s ease;
}

.bar > i.is-warn {
  background: linear-gradient(90deg, #f3b13c, #ffd08a);
}

.bar > i.is-danger {
  background: linear-gradient(90deg, #ff5f6d, #ff9aa3);
}

/* ---------- table ---------- */

.table-wrap {
  overflow: auto;
  max-height: 520px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 8px 14px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  background: rgba(10, 12, 17, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
  vertical-align: middle;
  white-space: nowrap;
}

.table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.022);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.td-key {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-dim);
}

.td-actions {
  display: flex;
  gap: 6px;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: 1px;
  background: var(--text-faint);
  flex: none;
}

.status-dot.is-ok {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(56, 211, 159, 0.12);
}

.status-dot.is-warn {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(243, 177, 60, 0.12);
}

.status-dot.is-off {
  background: var(--text-faint);
}

.cell-label {
  display: flex;
  align-items: center;
  font-weight: 500;
}

.cell-sub {
  font-size: 10.5px;
  color: var(--text-faint);
  margin-left: 15px;
  margin-top: 1px;
}

.btn-icon.is-loading svg {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.empty {
  padding: 26px 20px 30px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-faint);
}

/* ---------- chips / buttons ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 21px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.chip-ok {
  color: #8defc8;
  background: rgba(56, 211, 159, 0.09);
  border-color: rgba(56, 211, 159, 0.24);
}

.chip-warn {
  color: #ffd08a;
  background: rgba(243, 177, 60, 0.09);
  border-color: rgba(243, 177, 60, 0.24);
}

.chip-err {
  color: #ffa5ad;
  background: rgba(255, 95, 109, 0.1);
  border-color: rgba(255, 95, 109, 0.26);
}

.chip-mut {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
}

.chip-accent {
  color: #a9c6ff;
  background: rgba(76, 141, 255, 0.1);
  border-color: rgba(76, 141, 255, 0.26);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 35px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.032);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.07);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  color: #fff;
  border-color: rgba(122, 168, 255, 0.5);
  background: linear-gradient(180deg, #5c97ff, #3a73e2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 12px 28px -16px rgba(76, 141, 255, 0.95);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #6ba2ff, #4480ee);
}

.btn-danger {
  color: #fff;
  border-color: rgba(255, 130, 140, 0.45);
  background: linear-gradient(180deg, #ff6b78, #dc4351);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-danger:hover {
  background: linear-gradient(180deg, #ff7d88, #e8515e);
}

.btn-danger-ghost {
  color: #ff9aa3;
  border-color: rgba(255, 95, 109, 0.28);
  background: rgba(255, 95, 109, 0.05);
}

.btn-danger-ghost:hover {
  background: rgba(255, 95, 109, 0.12);
}

.btn-sm {
  height: 27px;
  padding: 0 9px;
  font-size: 11px;
  border-radius: 7px;
}

.btn-icon {
  width: 28px;
  height: 27px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
}

.btn-icon svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.btn-fit {
  width: auto;
  align-self: flex-start;
  justify-self: start;
}

.btn-block {
  width: 100%;
}

/* ---------- forms ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > span {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-dim);
}

.field small {
  font-size: 10.5px;
  color: var(--text-faint);
  line-height: 1.4;
}

.field-action {
  justify-content: flex-end;
}

input,
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: rgba(8, 10, 14, 0.9);
  color: var(--text);
  font-size: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: #4d5563;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(76, 141, 255, 0.62);
  box-shadow: 0 0 0 3px rgba(76, 141, 255, 0.13);
}

textarea {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.65;
  resize: vertical;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #8b94a6 50%),
    linear-gradient(135deg, #8b94a6 50%, transparent 50%);
  background-position: calc(100% - 16px) 51%, calc(100% - 11px) 51%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

input[type='number'] {
  font-family: var(--mono);
}

.search {
  width: 200px;
  height: 32px;
  padding: 0 11px;
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 14px;
  padding: 0 20px 18px;
}

.form-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding-top: 16px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 20px 20px;
}

.form-stack .form-grid {
  padding: 0;
}

.panel > .field {
  padding: 0 20px 12px;
}

.panel > .btn {
  margin: 0 20px 20px;
}

.panel > .btn-block {
  width: calc(100% - 40px);
}

/* ---------- keys view ---------- */

.keys-layout {
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.panel-import {
  position: sticky;
  top: 16px;
}

.panel-import .field {
  padding: 0 20px 12px;
}

.panel-import .form-grid {
  padding: 0 20px 12px;
}

.panel-import .form-grid .field {
  padding: 0;
}

.settings-grid .panel > .field,
.settings-grid .panel > .btn {
  margin-left: 20px;
  margin-right: 20px;
}

.settings-grid .panel > .field {
  padding: 0;
  margin-bottom: 12px;
}

/* ---------- access ---------- */

.client-list {
  display: flex;
  flex-direction: column;
  padding: 0 12px 12px;
  max-height: 620px;
  overflow-y: auto;
}

.client {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.015);
}

.client + .client {
  margin-top: 8px;
}

.client-name {
  font-size: 13px;
  font-weight: 600;
}

.client-key {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 7px 9px;
  overflow: hidden;
}

.client-key span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-stats {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.client-actions {
  display: flex;
  gap: 6px;
}

/* ---------- login ---------- */

.login {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(820px 520px at 50% -8%, rgba(76, 141, 255, 0.16), transparent 64%),
    var(--bg);
  z-index: 60;
}

.login-card {
  position: relative;
  width: min(408px, 100%);
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 28px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 50px 130px -50px rgba(0, 0, 0, 0.95);
  animation: rise 0.3s ease;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.login-card h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 6px;
}

.login-card > p {
  font-size: 12.5px;
}

.login-card .brand {
  margin-bottom: 6px;
}

.login-error {
  min-height: 16px;
  font-size: 12px;
  color: #ff9aa3;
}

.login-hint {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.5;
}

/* ---------- modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 5, 8, 0.66);
  backdrop-filter: blur(6px);
  z-index: 80;
}

.modal-card {
  width: min(400px, 100%);
  padding: 22px;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #101420, #0b0e15);
  box-shadow: 0 40px 100px -40px #000;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: rise 0.18s ease;
}

.modal-card p {
  font-size: 13.5px;
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- toasts ---------- */

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 90;
  pointer-events: none;
}

.toast {
  min-width: 200px;
  max-width: 340px;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(16, 20, 28, 0.96);
  box-shadow: 0 20px 50px -24px #000;
  font-size: 12.5px;
  animation: rise 0.2s ease;
}

.toast-ok {
  border-color: rgba(56, 211, 159, 0.3);
}

.toast-err {
  border-color: rgba(255, 95, 109, 0.34);
  color: #ffc3c8;
}

/* ---------- responsive ---------- */

@media (max-width: 1180px) {
  .keys-layout {
    grid-template-columns: 1fr;
  }

  .panel-import {
    position: static;
  }
}

@media (max-width: 1024px) {
  .grid-2,
  .settings-grid,
  .grid-access {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 880px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: auto 0 0 0;
    height: auto;
    width: 100%;
    flex-direction: row;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--line);
    background: rgba(9, 11, 16, 0.94);
    backdrop-filter: blur(16px);
  }

  .sidebar .brand,
  .sidebar-foot {
    display: none;
  }

  .nav {
    flex-direction: row;
    width: 100%;
    gap: 2px;
    overflow-x: auto;
  }

  .nav-item {
    flex: 1 0 auto;
    width: auto;
    flex-direction: column;
    gap: 3px;
    font-size: 10px;
    padding: 6px 8px;
    justify-content: center;
    text-align: center;
  }

  .main {
    padding: 18px 14px 104px;
  }

  .topbar {
    flex-direction: column;
    gap: 12px;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .search {
    width: 100%;
  }

  .head-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .form-grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
/* ---------- v1.1 additions ---------- */

.metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metrics-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.grid-play {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 20px 20px;
}

.panel-body .field {
  padding: 0;
}

.panel-actions {
  display: flex;
  gap: 8px;
  padding: 0 20px 20px;
}

.head-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.select-sm {
  width: auto;
  height: 32px;
  padding: 0 28px 0 10px;
  font-size: 12px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  width: fit-content;
}

.tabs button {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tabs button:hover {
  color: var(--text);
}

.tabs button.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.tabs button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.bulkbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 16px 12px;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid rgba(76, 141, 255, 0.24);
  background: rgba(76, 141, 255, 0.08);
  font-size: 12px;
}

.bulkbar-actions {
  display: flex;
  gap: 6px;
}

.th-check {
  width: 34px;
  padding-left: 14px;
}

input[type='checkbox'] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

.table-keys tbody tr.is-selected td {
  background: rgba(76, 141, 255, 0.06);
}

.check-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 6px 0;
  cursor: pointer;
}

.check-row span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
}

.check-row small {
  color: var(--text-faint);
  font-size: 11px;
}

.list {
  display: flex;
  flex-direction: column;
  padding: 0 16px 14px;
  max-height: 340px;
  overflow-y: auto;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 12.5px;
}

.list-row:last-child {
  border-bottom: 0;
}

.list-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-count {
  color: var(--text-dim);
  font-size: 12px;
}

.bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 20px 16px;
}

.pbar {
  display: grid;
  grid-template-columns: 46px 1fr 78px;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.pbar-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.pbar-value {
  text-align: right;
  font-size: 12px;
  color: var(--text-dim);
}

.play-out {
  padding: 0 20px 20px;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow: auto;
  max-height: 460px;
  color: #dbe3ef;
}

.docs-code {
  align-items: flex-start;
}

pre {
  width: 100%;
  margin: 0;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.34);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  overflow: auto;
  white-space: pre;
  color: #cfe0ff;
}

.copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}

.copy-row:last-child {
  border-bottom: 0;
}

.copy-label {
  font-size: 11.5px;
  color: var(--text-dim);
}

.copy-row code {
  grid-column: 1 / 2;
  font-family: var(--mono);
  font-size: 11.5px;
  color: #a9c6ff;
  overflow: auto;
  white-space: nowrap;
}

.copy-row button {
  grid-row: 1 / 3;
  grid-column: 2 / 3;
}

.data-actions {
  display: grid;
  gap: 16px;
}

.data-actions > div {
  display: grid;
  gap: 6px;
  justify-items: start;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-actions > div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.data-actions b {
  font-size: 13px;
  font-weight: 600;
}

.data-actions small {
  color: var(--text-faint);
  font-size: 11.5px;
}

.err-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 5px;
  border-radius: 50%;
  background: var(--danger);
  vertical-align: middle;
}

.err-text {
  color: #ff9aa3;
}

.pill-paused {
  border-color: rgba(243, 177, 60, 0.3);
  background: rgba(243, 177, 60, 0.08);
  color: #ffd08a;
}

.pill-paused .dot {
  background: var(--warn);
  animation: none;
}

.modal-form {
  width: min(560px, 100%);
  gap: 12px;
}

.modal-form h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-form .form-grid {
  padding: 0;
}

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

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .grid-play,
  .metrics-3 {
    grid-template-columns: 1fr;
  }

  .grid-3 {
    grid-template-columns: 1fr;
  }
}

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

  .metric-value {
    font-size: 24px;
  }

  .pbar {
    grid-template-columns: 42px 1fr 64px;
    gap: 8px;
  }

  .tabs {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .bulkbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------- v1.1 polish ---------- */

.tab-panel .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.code-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.table-docs tbody td {
  white-space: normal;
  vertical-align: top;
}

.table-docs tbody td:first-child {
  width: 64px;
}

.table-docs tbody td.mono {
  width: 36%;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .tab-panel .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .tab-panel .form-grid {
    grid-template-columns: 1fr;
  }
}
