@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #050507;
  --bg-2: #0a0c12;
  --panel: #0e1016;
  --panel2: #13161f;
  --line: rgba(255, 255, 255, .06);
  --line-strong: rgba(255, 255, 255, .12);
  --text: #f8f8fa;
  --muted: #9ca3af;
  --accent: #00d4aa;
  --accent-2: #6366f1;
  --accent-3: #8b5cf6;
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
  --shadow: 0 25px 60px rgba(0, 0, 0, .6);
  --shadow-glow: 0 8px 32px rgba(0, 212, 170, .15);
  --radius: 16px;
  --radius-lg: 24px;
  --tap: 44px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --glass-bg: rgba(14, 16, 22, .7);
  --glass-border: rgba(255, 255, 255, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(0, 212, 170, .08) 0%, transparent 50%),
    radial-gradient(ellipse at 100% 0%, rgba(99, 102, 241, .06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(139, 92, 246, .04) 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.spread { justify-content: space-between; }

/* ——— Auth / install ——— */
.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(20px + var(--safe-t)) 18px calc(20px + var(--safe-b));
}
.auth-stage {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
}
.auth-brand {
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 6px;
}
.auth-brand .logo {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  margin-bottom: 4px;
  animation: float 4s ease-in-out infinite;
}
.auth-brand h1 {
  font-size: clamp(22px, 5.6vw, 30px);
  line-height: 1.12;
  margin: 0;
  letter-spacing: -.03em;
}
.auth-brand p {
  margin: 0;
  max-width: 34ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.auth-card {
  width: 100%;
  position: relative;
  overflow: hidden;
  padding: 28px 24px 32px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255,255,255,.08) 0%, rgba(255,255,255,.02) 50%, var(--panel) 100%);
  border: 1px solid var(--glass-border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .12),
    0 32px 80px rgba(0, 0, 0, .55),
    0 0 0 1px rgba(0, 212, 170, .05),
    0 8px 24px rgba(0, 212, 170, .08);
  backdrop-filter: blur(24px) saturate(1.2);
}
.auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 170, .6), transparent);
}
.auth-card::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 50% 0%, rgba(0, 212, 170, .03) 0%, transparent 50%);
  pointer-events: none;
}
.auth-card .form { margin-top: 14px; gap: 14px; }
.auth-card .btn { width: 100%; min-height: 48px; }
.auth-foot {
  text-align: center;
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}
.auth-side {
  padding: 56px;
  background:
    linear-gradient(160deg, rgba(46, 230, 200, .12), transparent 42%),
    linear-gradient(180deg, #101318, #09090b);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line);
}
.auth-side h1 { font-size: clamp(28px, 4vw, 42px); line-height: 1.08; margin: 14px 0 10px; letter-spacing: -.03em; }
.auth-side p { color: var(--muted); max-width: 380px; }
.auth-box { display: grid; place-items: center; padding: 32px 20px calc(32px + var(--safe-b)); }
.install-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px calc(24px + var(--safe-b));
}
.install-card,
.card {
  width: min(420px, 100%);
  background:
    linear-gradient(135deg, rgba(255,255,255,.04) 0%, rgba(255,255,255,.01) 40%, var(--panel) 100%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow:
    var(--shadow),
    0 0 0 1px rgba(0, 212, 170, .03);
  backdrop-filter: blur(20px);
}
.install-card { width: min(460px, 100%); }
.card.auth-card {
  width: 100%;
  padding: 28px 24px 32px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255,255,255,.08) 0%, rgba(255,255,255,.02) 50%, var(--panel) 100%);
  border: 1px solid var(--glass-border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .12),
    0 32px 80px rgba(0, 0, 0, .55),
    0 0 0 1px rgba(0, 212, 170, .05),
    0 8px 24px rgba(0, 212, 170, .08);
  backdrop-filter: blur(24px) saturate(1.2);
}
.logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background:
    linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 50%, var(--accent-3) 100%);
  color: #04131a;
  box-shadow:
    0 8px 24px rgba(0, 212, 170, .3),
    0 0 0 1px rgba(0, 212, 170, .2);
  transition: transform .2s ease, box-shadow .2s ease;
  animation: border-glow 3s ease-in-out infinite;
}
.logo:hover {
  transform: scale(1.05);
  box-shadow:
    0 12px 32px rgba(0, 212, 170, .4),
    0 0 0 1px rgba(0, 212, 170, .3);
  animation: none;
}

.form { display: grid; gap: 14px; margin-top: 16px; }
.form-section {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(19, 22, 31, .8) 0%, rgba(14, 16, 22, .9) 100%);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, .2),
    0 2px 8px rgba(0, 0, 0, .1);
  transition: all .2s ease;
}
.form-section:hover {
  border-color: rgba(0, 212, 170, .1);
}
.form-section h3 {
  margin: 0;
  font-size: 15px;
  color: var(--text);
  font-weight: 700;
}
label { font-size: 13px; color: #d4d4d8; display: grid; gap: 6px; font-weight: 600; }
input, select, textarea {
  width: 100%;
  min-height: var(--tap);
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(135deg, rgba(255,255,255,.02) 0%, rgba(11, 12, 16, .8) 100%);
  color: #fff;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  transition: all .25s cubic-bezier(.4, 0, .2, 1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .3);
}
input:hover, select:hover, textarea:hover {
  border-color: rgba(0, 212, 170, .25);
  background:
    linear-gradient(135deg, rgba(255,255,255,.03) 0%, rgba(11, 12, 16, .9) 100%);
}
input:focus, select:focus, textarea:focus, button:focus-visible, .chip:focus-visible {
  outline: none;
  border-color: var(--accent);
  background:
    linear-gradient(135deg, rgba(0, 212, 170, .05) 0%, rgba(11, 12, 16, .95) 100%);
  box-shadow:
    0 0 0 3px rgba(0, 212, 170, .15),
    0 4px 12px rgba(0, 212, 170, .1),
    inset 0 1px 2px rgba(0, 0, 0, .2);
}
input.is-invalid, select.is-invalid, textarea.is-invalid {
  border-color: var(--bad);
  background:
    linear-gradient(135deg, rgba(239, 68, 68, .05) 0%, rgba(11, 12, 16, .8) 100%);
  box-shadow:
    0 0 0 3px rgba(239, 68, 68, .12),
    inset 0 1px 2px rgba(0, 0, 0, .3);
  animation: shake .3s ease;
}
input.is-invalid:focus, select.is-invalid:focus, textarea.is-invalid:focus {
  border-color: var(--bad);
  background:
    linear-gradient(135deg, rgba(239, 68, 68, .08) 0%, rgba(11, 12, 16, .95) 100%);
  box-shadow:
    0 0 0 3px rgba(239, 68, 68, .18),
    0 4px 12px rgba(239, 68, 68, .1),
    inset 0 1px 2px rgba(0, 0, 0, .2);
}
.field-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(251, 113, 133, .1);
  border: 1px solid rgba(251, 113, 133, .22);
  color: #ffb4bc;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  animation: up .2s ease;
}
.field-hint-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(251, 113, 133, .22);
  font-size: 11px;
  font-weight: 800;
}

/* ——— Buttons ——— */
.btn {
  --glow: rgba(0, 212, 170, .35);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--tap);
  border: 0;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -.01em;
  border-radius: 12px;
  padding: 12px 20px;
  color: #031f1a;
  background:
    linear-gradient(135deg, #00f5d4 0%, var(--accent) 50%, #00b894 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .4),
    0 4px 16px var(--glow),
    0 0 0 1px rgba(0, 212, 170, .1);
  transition: all .25s cubic-bezier(.4, 0, .2, 1);
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% -20%, rgba(255,255,255,.5), transparent 70%);
  pointer-events: none;
  opacity: .8;
  transition: opacity .25s ease;
}
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,.2) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform .4s ease;
  pointer-events: none;
}
.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .5),
    0 8px 24px var(--glow),
    0 0 0 1px rgba(0, 212, 170, .2);
}
.btn:hover::after {
  transform: translateX(100%);
}
.btn:active {
  transform: translateY(0) scale(.98);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .3),
    0 2px 8px var(--glow);
}
.btn.ghost {
  --glow: transparent;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .05) 0%, rgba(255, 255, 255, .02) 100%);
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: none;
  filter: none;
}
.btn.ghost::before { opacity: .12; }
.btn.ghost:hover {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .08) 0%, rgba(255, 255, 255, .04) 100%);
  border-color: rgba(255, 255, 255, .2);
  transform: translateY(-1px);
}
.btn.blue {
  --glow: rgba(99, 102, 241, .35);
  background:
    linear-gradient(135deg, #818cf8 0%, var(--accent-2) 50%, #4f46e5 100%);
  color: #0a0e1a;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .4),
    0 4px 16px var(--glow),
    0 0 0 1px rgba(99, 102, 241, .1);
}
.btn.blue:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .5),
    0 8px 24px var(--glow),
    0 0 0 1px rgba(99, 102, 241, .2);
}
.btn.danger {
  --glow: rgba(239, 68, 68, .25);
  background:
    linear-gradient(135deg, #f87171 0%, var(--bad) 50%, #dc2626 100%);
  color: #fef2f2;
  border: 1px solid rgba(239, 68, 68, .3);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .2),
    0 4px 16px var(--glow);
}
.btn.danger:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .3),
    0 8px 24px var(--glow);
  transform: translateY(-1px);
}
.btn:disabled, .btn.is-loading {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(.3);
  pointer-events: none;
}
.btn.mini { min-height: 36px; padding: 7px 11px; font-size: 12px; }
.btn.icon {
  min-width: var(--tap);
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

/* ——— Segmented ——— */
.seg {
  display: flex;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .02) 0%, rgba(11, 12, 16, .9) 100%);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 5px;
  gap: 5px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .3);
}
.seg button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  min-height: 40px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s cubic-bezier(.4, 0, .2, 1);
}
.seg button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .04);
}
.seg button.on {
  background:
    linear-gradient(135deg, rgba(0, 212, 170, .15) 0%, rgba(0, 212, 170, .05) 100%);
  color: var(--accent);
  box-shadow:
    0 2px 8px rgba(0, 212, 170, .15),
    inset 0 1px 0 rgba(255, 255, 255, .1);
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: calc(14px + var(--safe-t)) 24px 14px;
  background:
    linear-gradient(180deg, rgba(5, 5, 7, .9) 0%, rgba(9, 9, 11, .85) 100%);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(24px) saturate(1.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, .3);
}
.page {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 28px 16px calc(70px + var(--safe-b));
  display: grid;
  gap: 16px;
}
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tile, .proxy {
  background:
    linear-gradient(135deg, rgba(255,255,255,.03) 0%, rgba(255,255,255,.005) 50%, var(--panel) 100%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, .25),
    0 0 0 1px rgba(0, 212, 170, .02);
  backdrop-filter: blur(16px);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.tile:hover, .proxy:hover {
  border-color: rgba(0, 212, 170, .15);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, .35),
    0 0 0 1px rgba(0, 212, 170, .08);
}
.stat {
  font-size: 32px;
  font-weight: 800;
  margin-top: 10px;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  background:
    linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px rgba(0, 212, 170, .3);
}
.muted { color: var(--muted); font-size: 13px; line-height: 1.45; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
h1, h2 {
  margin: 0 0 10px;
  letter-spacing: -.02em;
  background:
    linear-gradient(135deg, var(--text) 0%, rgba(255, 255, 255, .8) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: .03em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}
.on {
  background:
    linear-gradient(135deg, rgba(16, 185, 129, .18) 0%, rgba(16, 185, 129, .08) 100%);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, .25);
}
.off {
  background:
    linear-gradient(135deg, rgba(239, 68, 68, .18) 0%, rgba(239, 68, 68, .08) 100%);
  color: #fda4af;
  border: 1px solid rgba(239, 68, 68, .25);
}
.warn {
  background:
    linear-gradient(135deg, rgba(245, 158, 11, .18) 0%, rgba(245, 158, 11, .08) 100%);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, .25);
}
.chip {
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .03) 0%, rgba(21, 24, 33, .8) 100%);
  color: var(--muted);
  border-radius: 12px;
  min-height: 40px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 700;
  transition: all .2s cubic-bezier(.4, 0, .2, 1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .2);
}
.chip:hover {
  color: var(--text);
  border-color: rgba(0, 212, 170, .2);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .05) 0%, rgba(21, 24, 33, .9) 100%);
  transform: translateY(-1px);
}
.chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background:
    linear-gradient(135deg, rgba(0, 212, 170, .12) 0%, rgba(0, 212, 170, .05) 100%);
  box-shadow:
    0 0 0 3px rgba(0, 212, 170, .15),
    0 4px 12px rgba(0, 212, 170, .1);
}

.create-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
  align-items: stretch;
}
.create-grid .chip {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  text-align: center;
}
.cost-pill {
  border: 1px solid rgba(0, 212, 170, .3);
  background:
    linear-gradient(135deg, rgba(0, 212, 170, .12) 0%, rgba(99, 102, 241, .08) 100%);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .1),
    0 4px 12px rgba(0, 212, 170, .1);
  transition: all .2s ease;
}
.cost-pill:hover {
  border-color: rgba(0, 212, 170, .5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .15),
    0 6px 16px rgba(0, 212, 170, .15);
  transform: translateY(-1px);
}
.cost-pill span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
}
.cost-pill strong {
  display: block;
  margin-top: 4px;
  color: var(--accent);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}
.create-btn {
  min-height: 58px;
  border-radius: 12px;
  font-size: 15px;
  white-space: nowrap;
}
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.action-box {
  border: 1px solid var(--glass-border);
  background:
    linear-gradient(135deg, rgba(11, 12, 16, .8) 0%, rgba(14, 16, 22, .9) 100%);
  border-radius: 14px;
  padding: 18px;
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, .2),
    0 4px 12px rgba(0, 0, 0, .15);
  transition: all .2s ease;
}
.action-box:hover {
  border-color: rgba(0, 212, 170, .15);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, .2),
    0 6px 16px rgba(0, 0, 0, .2);
}
.action-box h3 {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--text);
  font-weight: 700;
}
.spaced-action { margin-top: 12px; }

.proxy {
  transition: all .25s cubic-bezier(.4, 0, .2, 1);
}
.proxy:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 212, 170, .2);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, .4),
    0 0 0 1px rgba(0, 212, 170, .1);
}
.proxy-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.proxy-conn { font-size: 14px; margin-bottom: 6px; word-break: break-all; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .01) 0%, transparent 100%);
  border-radius: 12px;
  border: 1px dashed var(--line);
}
.empty::before {
  content: "📭";
  display: block;
  font-size: 32px;
  margin-bottom: 12px;
  opacity: .5;
}

/* ——— Tables ——— */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(11, 12, 16, .8) 0%, rgba(14, 16, 22, .9) 100%);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, .3),
    0 4px 16px rgba(0, 0, 0, .2);
}
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 14px 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}
.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  background:
    linear-gradient(180deg, rgba(20, 23, 30, .98) 0%, rgba(14, 16, 22, .98) 100%);
  white-space: nowrap;
  font-weight: 700;
  border-bottom: 1px solid var(--line-strong);
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr {
  transition: all .2s cubic-bezier(.4, 0, .2, 1);
}
.data-table tbody tr:hover {
  background:
    linear-gradient(135deg, rgba(0, 212, 170, .03) 0%, rgba(255, 255, 255, .02) 100%);
}
.data-table td.num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent);
}
.data-table td.actions .row { justify-content: flex-end; }
.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  padding-right: 32px;
  transition: color .2s ease;
}
.data-table th.sortable:hover {
  color: var(--text);
}
.data-table th.sortable::after {
  content: "↕";
  float: right;
  margin-left: 8px;
  opacity: .4;
  font-size: 10px;
  transition: opacity .2s ease, color .2s ease;
}
.data-table th.sort-asc::after,
.data-table th.sort-desc::after {
  opacity: 1;
  color: var(--accent);
}
.data-table th.sort-asc::after { content: "↑"; }
.data-table th.sort-desc::after { content: "↓"; }

.manual-pane {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  animation: up .3s cubic-bezier(.2, .8, .2, 1);
  background:
    linear-gradient(180deg, rgba(0, 212, 170, .02) 0%, transparent 100%);
}
.manual-pane input {
  min-height: 48px;
  border-color: rgba(0, 212, 170, .3);
}

.dt { display: grid; gap: 12px; }
.dt-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.dt-search {
  flex: 1 1 220px;
  max-width: 340px;
  min-height: 44px;
  margin: 0;
}
.dt-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.dt-filter {
  width: auto;
  min-width: 160px;
  min-height: 44px;
  margin: 0;
}
.dt-sort-mobile { display: none; }
.dt-length {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin: 0;
}
.dt-length select {
  width: auto;
  min-height: 44px;
  margin: 0;
}
.dt-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.dt-info { margin: 0; }
.dt-pager { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.dt-pager button {
  min-height: 38px;
  min-width: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(135deg, rgba(21, 24, 33, .9) 0%, rgba(14, 16, 22, .9) 100%);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: all .2s cubic-bezier(.4, 0, .2, 1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .2);
}
.dt-pager button:hover:not(:disabled):not(.current) {
  border-color: rgba(0, 212, 170, .2);
  background:
    linear-gradient(135deg, rgba(21, 24, 33, .95) 0%, rgba(14, 16, 22, .95) 100%);
  transform: translateY(-1px);
}
.dt-pager button.current {
  background:
    linear-gradient(135deg, rgba(0, 212, 170, .15) 0%, rgba(0, 212, 170, .08) 100%);
  color: var(--accent);
  border-color: rgba(0, 212, 170, .4);
  box-shadow:
    0 2px 8px rgba(0, 212, 170, .15),
    inset 0 1px 0 rgba(255, 255, 255, .1);
}
.dt-pager button:disabled {
  opacity: .4;
  cursor: not-allowed;
  transform: none;
}
.dt-gap { color: var(--muted); padding: 0 4px; font-weight: 700; }

/* ——— Toasts ——— */
.toast-wrap {
  position: fixed;
  right: 20px;
  bottom: calc(20px + var(--safe-b));
  z-index: 90;
  display: grid;
  gap: 12px;
  width: min(400px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  padding: 16px 18px 18px;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(14, 16, 22, .95) 0%, rgba(19, 22, 31, .95) 100%);
  border: 1px solid var(--glass-border);
  box-shadow:
    var(--shadow),
    0 0 0 1px rgba(0, 212, 170, .05);
  backdrop-filter: blur(24px) saturate(1.2);
  animation: toast-in .4s cubic-bezier(.2, .8, .2, 1);
}
.toast::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .1), transparent);
}
.toast-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  margin-top: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}
.toast.ok .toast-icon {
  background:
    linear-gradient(135deg, rgba(16, 185, 129, .2) 0%, rgba(16, 185, 129, .1) 100%);
  color: var(--ok);
  border: 1px solid rgba(16, 185, 129, .3);
}
.toast.err .toast-icon {
  background:
    linear-gradient(135deg, rgba(239, 68, 68, .2) 0%, rgba(239, 68, 68, .1) 100%);
  color: var(--bad);
  border: 1px solid rgba(239, 68, 68, .3);
}
.toast-msg {
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text);
}
.toast-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  transform-origin: left;
  animation: toast-bar 3.4s linear forwards;
  border-radius: 0 0 16px 16px;
}
.toast.ok .toast-bar {
  background:
    linear-gradient(90deg, var(--ok), rgba(16, 185, 129, .6));
}
.toast.err .toast-bar {
  background:
    linear-gradient(90deg, var(--bad), rgba(239, 68, 68, .6));
}
.toast.out {
  animation: toast-out .3s cubic-bezier(.4, 0, 1, 1) forwards;
}

/* ——— Loader ——— */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at center, rgba(0, 0, 0, .8) 0%, rgba(5, 5, 7, .9) 100%);
  backdrop-filter: blur(16px) saturate(1.1);
  animation: fade .3s ease;
}
.page-loader-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(19, 22, 31, .95) 0%, rgba(14, 16, 22, .95) 100%);
  border: 1px solid var(--glass-border);
  box-shadow:
    var(--shadow),
    0 0 0 1px rgba(0, 212, 170, .05),
    0 0 40px rgba(0, 212, 170, .08);
  font-weight: 700;
  font-size: 14px;
  backdrop-filter: blur(20px);
}
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .15);
  border-top-color: var(--accent);
  animation: spin .6s linear infinite;
  flex: 0 0 18px;
  box-shadow: 0 0 8px rgba(0, 212, 170, .2);
}
.spinner.lg {
  width: 22px;
  height: 22px;
  flex-basis: 22px;
  border-width: 2.5px;
}
.skeleton {
  border-radius: 10px;
  background:
    linear-gradient(90deg, rgba(23, 26, 38, .8) 25%, rgba(34, 38, 50, .9) 50%, rgba(23, 26, 38, .8) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease infinite;
  height: 14px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  padding-bottom: calc(20px + var(--safe-b));
  background:
    radial-gradient(ellipse at center, rgba(0, 0, 0, .8) 0%, rgba(5, 6, 10, .9) 100%);
  backdrop-filter: blur(16px) saturate(1.1);
  animation: fade .3s ease;
}
.modal-card {
  width: min(500px, 100%);
  max-height: min(88vh, 880px);
  overflow: auto;
  background:
    linear-gradient(135deg, rgba(19, 22, 31, .98) 0%, rgba(14, 16, 22, .98) 100%);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 24px;
  box-shadow:
    var(--shadow),
    0 0 0 1px rgba(0, 212, 170, .05),
    0 0 60px rgba(0, 212, 170, .08);
  backdrop-filter: blur(24px);
  animation: modal-in .4s cubic-bezier(.2, .8, .2, 1);
}
.modal-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 170, .3), transparent);
  border-radius: 20px 20px 0 0;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.modal-actions .btn { flex: 1 1 140px; }
.proxy-detail-grid { display: grid; grid-template-columns: 1fr 120px; gap: 10px; margin: 14px 0 10px; }
.detail-card {
  border: 1px solid var(--glass-border);
  background:
    linear-gradient(135deg, rgba(11, 12, 16, .8) 0%, rgba(14, 16, 22, .9) 100%);
  border-radius: 14px;
  padding: 14px;
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, .2),
    0 2px 8px rgba(0, 0, 0, .1);
  transition: all .2s ease;
}
.detail-card:hover {
  border-color: rgba(0, 212, 170, .15);
}
.detail-card span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 6px;
  font-weight: 700;
}
.detail-card strong {
  font-size: 15px;
  word-break: break-all;
  color: var(--text);
  font-weight: 600;
}
.conn-box {
  margin: 16px 0;
  padding: 16px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(0, 212, 170, .05) 0%, rgba(9, 9, 11, .9) 100%);
  border: 1px dashed rgba(0, 212, 170, .4);
  color: var(--accent);
  word-break: break-all;
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, .2),
    0 0 0 1px rgba(0, 212, 170, .05);
  transition: all .2s ease;
}
.conn-box:hover {
  border-color: rgba(0, 212, 170, .6);
  background:
    linear-gradient(135deg, rgba(0, 212, 170, .08) 0%, rgba(9, 9, 11, .95) 100%);
}
.err, .ok {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .15);
}
.err {
  background:
    linear-gradient(135deg, rgba(239, 68, 68, .12) 0%, rgba(239, 68, 68, .06) 100%);
  color: #ffb4bc;
  border: 1px solid rgba(239, 68, 68, .2);
}
.ok {
  background:
    linear-gradient(135deg, rgba(16, 185, 129, .12) 0%, rgba(16, 185, 129, .06) 100%);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, .2);
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes toast-bar { to { transform: scaleX(0); } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(0, 212, 170, .3); }
  50% { box-shadow: 0 0 30px rgba(0, 212, 170, .5); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes border-glow {
  0%, 100% { border-color: rgba(0, 212, 170, .2); }
  50% { border-color: rgba(0, 212, 170, .4); }
}

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

@media (max-width: 720px) {
  .table-wrap { overflow: visible; border: 0; background: transparent; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: var(--panel);
  }
  .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
  }
  .data-table td:last-child { border-bottom: 0; }
  .data-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    flex: 0 0 auto;
  }
  .data-table td.actions {
    display: block;
  }
  .data-table td.actions .row {
    width: 100%;
  }
  .data-table td.actions .btn { flex: 1 1 calc(50% - 8px); }
  .data-table tr.dt-empty td::before { display: none; }
  .data-table tr.dt-empty td { display: block; }
  .dt-search, .dt-filter, .dt-length { max-width: none; flex: 1 1 100%; }
  .dt-length select, .dt-filter { width: 100%; }
  .dt-sort-mobile { display: block; }
  .dt-foot { flex-direction: column; align-items: stretch; }
  .dt-pager { justify-content: center; }
}

@media (max-width: 560px) {
  .page { padding: 16px 14px calc(48px + var(--safe-b)); gap: 12px; }
  .grid { gap: 10px; }
  .grid .tile { min-height: 88px; padding: 16px; }
  .grid .tile .muted { font-size: 12px; }
  .grid .tile .stat { font-size: 24px; margin-top: 6px; }
  .tile { padding: 18px; }
  .tile h2 { font-size: 18px; }
  .top { padding: calc(12px + var(--safe-t)) 16px 12px; }
  .top .btn { min-height: 42px; }
  .proxy-top { flex-direction: column; }
  .proxy-top .row { width: 100%; }
  .proxy-top .btn { flex: 1; }
  .create-grid { gap: 10px; }
  .create-grid .chip, .cost-pill, .create-btn { min-height: 54px; }
  .filters { width: 100%; }
  .filters .chip { flex: 1 1 calc(50% - 8px); text-align: center; }
  .proxy-detail-grid { grid-template-columns: 1fr; }
  .card, .install-card { padding: 24px; }
  .auth-card { padding: 24px 20px 28px; border-radius: 20px; }
  .toast-wrap {
    left: 16px;
    right: 16px;
    bottom: calc(16px + var(--safe-b));
    width: auto;
  }
  .seg { overflow-x: auto; }
  .seg button { white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
