/* ============================================================
   Device Proxy Manager — "Alienware" light theme
   Angular beveled panels · thin neon accents · hex-grid ·
   sci-fi type (Orbitron / Rajdhani). Light surfaces, cyan glow.
   ============================================================ */
:root {
  /* neon accents */
  --cyan: #00b5d8;
  --cyan-600: #008fb3;
  --cyan-400: #35d6f2;
  --blue: #2b6bff;
  --blue-400: #5f92ff;
  --violet: #7a5cff;
  --amber: #f5a623;
  --danger: #ef3e52;
  --green: #10b981;

  /* light surfaces */
  --bg: #eef2f8;
  --bg-2: #e6ecf5;
  --card: #ffffff;
  --card-2: #f7fafd;
  --line: #dbe3ef;
  --line-soft: #e9eef6;

  /* ink */
  --ink: #0d1524;
  --ink-2: #3d4a63;
  --muted: #7c88a1;
  --muted-2: #a3adc2;

  /* glow */
  --glow-cyan: 0 0 0 1px rgba(0,181,216,.35), 0 8px 30px rgba(0,181,216,.18);
  --shadow-sm: 0 1px 2px rgba(13,21,36,.05), 0 2px 8px rgba(13,21,36,.05);
  --shadow: 0 6px 22px rgba(13,21,36,.10);
  --shadow-lg: 0 24px 60px rgba(13,21,36,.22);
  --ease: cubic-bezier(.4, 0, .2, 1);

  /* beveled corner size */
  --bevel: 14px;
  --bevel-sm: 8px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  font-family: "Rajdhani", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.5;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-color: var(--bg);
  background-image:
    radial-gradient(90% 55% at 100% 0%, rgba(0,181,216,.10), transparent 60%),
    radial-gradient(80% 50% at 0% 100%, rgba(43,107,255,.08), transparent 60%),
    /* hex-ish grid */
    linear-gradient(30deg, rgba(13,21,36,.022) 1px, transparent 1px),
    linear-gradient(-30deg, rgba(13,21,36,.022) 1px, transparent 1px);
  background-size: auto, auto, 26px 46px, 26px 46px;
}
h1, h2, h3 { letter-spacing: .01em; }
svg { display: block; }
.tnum { font-variant-numeric: tabular-nums; }
.mono, .cell-strong.mono, td.mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }

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

/* ---------------- Sidebar ---------------- */
.sidebar {
  width: 268px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  color: var(--ink-2);
  background:
    linear-gradient(180deg, rgba(255,255,255,.92), rgba(247,250,253,.92));
  border-right: 1px solid var(--line);
  backdrop-filter: blur(8px);
  position: sticky;
}
.sidebar::before {
  /* neon spine */
  content: ""; position: absolute; top: 0; right: -1px; width: 2px; height: 100%;
  background: linear-gradient(180deg, transparent, var(--cyan) 20%, var(--blue) 80%, transparent);
  opacity: .55;
}
.brand { display: flex; align-items: center; gap: 13px; padding: 2px 8px 24px; }
.logo {
  width: 46px; height: 46px; flex-shrink: 0;
  display: grid; place-items: center;
  color: var(--cyan);
  filter: drop-shadow(0 0 10px rgba(0,181,216,.5));
}
.logo svg { width: 100%; height: 100%; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong {
  font-family: "Orbitron", sans-serif; color: var(--ink);
  font-size: 14px; font-weight: 800; letter-spacing: .12em;
}
.brand-text span {
  color: var(--cyan-600); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .22em; margin-top: 3px;
}

.nav-group-label {
  color: var(--muted-2); font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .2em; padding: 6px 14px 10px; margin-top: 4px;
  font-family: "Orbitron", sans-serif;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  background: transparent; border: 1px solid transparent; cursor: pointer;
  color: var(--ink-2); text-align: left; padding: 11px 14px;
  font-size: 15px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  font-family: "Rajdhani", sans-serif;
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
  position: relative;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
.nav-item svg { width: 19px; height: 19px; stroke-width: 2; flex-shrink: 0; opacity: .8; }
.nav-item:hover { background: rgba(0,181,216,.08); color: var(--ink); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(0,181,216,.16), rgba(43,107,255,.08));
  border-color: rgba(0,181,216,.35);
  color: var(--ink);
  box-shadow: inset 0 0 14px rgba(0,181,216,.12);
}
.nav-item.active svg { opacity: 1; color: var(--cyan); }
.nav-item.active::before {
  content: ""; position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 24px; background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}

.sidebar-foot { margin-top: auto; padding: 16px 6px 2px; }
.core-pill {
  display: inline-flex; align-items: center; gap: 9px;
  background: rgba(16,185,129,.10); color: #0a8f68; border: 1px solid rgba(16,185,129,.28);
  padding: 9px 14px; font-size: 12px; font-weight: 700; width: 100%;
  text-transform: uppercase; letter-spacing: .08em;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
.core-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(16,185,129,.22); animation: pulse 2s infinite; }
.core-pill.bad { background: rgba(239,62,82,.1); color: var(--danger); border-color: rgba(239,62,82,.28); }
.core-pill.bad .dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(239,62,82,.22); animation: none; }
.sidebar-foot p { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 13px 4px 0; font-weight: 500; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 3px rgba(16,185,129,.22); } 50% { box-shadow: 0 0 0 6px rgba(16,185,129,.04); } }

/* ---------------- Main ---------------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 30px; border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.7); backdrop-filter: saturate(140%) blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-family: "Orbitron", sans-serif; font-size: 20px; margin: 0; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.topbar-sub { color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 3px; text-transform: uppercase; letter-spacing: .06em; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: #fff; border: 1px solid var(--line); color: var(--ink-2);
  padding: 8px 14px; font-size: 12.5px; font-weight: 700; letter-spacing: .04em;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
.chip svg { width: 15px; height: 15px; color: var(--cyan); }
.view { padding: 26px 30px 42px; max-width: 1420px; width: 100%; }

/* ---------------- Grid + cards ---------------- */
.grid { display: grid; gap: 18px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.span-2 { grid-column: span 2; }
@media (max-width: 1180px) { .cols-4 { grid-template-columns: repeat(2, 1fr); } .cols-3, .span-2 { grid-template-columns: 1fr; grid-column: auto; } }
@media (max-width: 760px) {
  .cols-4, .cols-3, .cols-2 { grid-template-columns: 1fr; }
  .sidebar { width: 76px; padding: 20px 12px; }
  .brand-text, .sidebar-foot p, .nav-group-label, .nav-item span, .core-pill span { display: none; }
  .core-pill { justify-content: center; }
  .view, .topbar { padding-left: 18px; padding-right: 18px; }
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  clip-path: polygon(0 0, calc(100% - var(--bevel)) 0, 100% var(--bevel), 100% 100%, var(--bevel) 100%, 0 calc(100% - var(--bevel)));
  transition: box-shadow .2s var(--ease), transform .2s var(--ease), border-color .2s var(--ease);
}
.card::after {
  /* thin neon top edge */
  content: ""; position: absolute; top: 0; left: 0; right: var(--bevel); height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
  opacity: .0; transition: opacity .2s var(--ease);
}
.card.hover:hover, .table-card:hover { border-color: rgba(0,181,216,.5); box-shadow: var(--glow-cyan); transform: translateY(-2px); }
.card.hover:hover::after { opacity: .9; }
.card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title h2 { font-family: "Orbitron", sans-serif; font-size: 13.5px; margin: 0; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.card-title .card-meta { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

/* stat card */
.stat { position: relative; overflow: hidden; }
.stat .stat-top { display: flex; align-items: flex-start; justify-content: space-between; }
.stat h3 { margin: 0; font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .12em; font-family: "Orbitron", sans-serif; }
.stat .value { font-family: "Orbitron", sans-serif; font-size: 30px; font-weight: 800; margin-top: 14px; letter-spacing: -.01em; line-height: 1; }
.stat .value.sm { font-size: 20px; }
.stat .sub { color: var(--muted); font-size: 12.5px; margin-top: 9px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat .sub .up { color: var(--cyan-600); font-weight: 800; }
.stat-icon {
  width: 42px; height: 42px; display: grid; place-items: center; flex-shrink: 0;
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
}
.stat-icon svg { width: 21px; height: 21px; stroke-width: 2; }
.ic-green { background: rgba(0,181,216,.12); color: var(--cyan-600); }
.ic-blue { background: rgba(43,107,255,.12); color: var(--blue); }
.ic-amber { background: rgba(245,166,35,.14); color: #c67d0c; }
.ic-violet { background: rgba(122,92,255,.12); color: var(--violet); }

/* progress */
.metric-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 9px; }
.metric-row .lbl { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-family: "Orbitron", sans-serif; }
.metric-row .num { font-family: "Orbitron", sans-serif; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.bar { height: 8px; background: var(--bg-2); overflow: hidden; }
.bar > span { display: block; height: 100%; transition: width .5s var(--ease); background: linear-gradient(90deg, var(--cyan), var(--cyan-400)); box-shadow: 0 0 10px rgba(0,181,216,.5); }
.bar.blue > span { background: linear-gradient(90deg, var(--blue), var(--blue-400)); box-shadow: 0 0 10px rgba(43,107,255,.5); }
.metric-block + .metric-block { margin-top: 20px; }

/* traffic chart */
.chart-wrap { position: relative; height: 168px; margin: 4px -4px 0; }
.chart-wrap canvas { width: 100%; height: 100%; }
.chart-legend { display: flex; gap: 22px; margin-top: 14px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 9px; }
.legend-swatch { width: 10px; height: 10px; box-shadow: 0 0 8px currentColor; }
.legend-meta { display: flex; flex-direction: column; line-height: 1.25; }
.legend-meta .k { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.legend-meta .v { font-family: "Orbitron", sans-serif; font-size: 14px; font-weight: 700; }

/* ---------------- Toolbar + tables ---------------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.toolbar .spacer { flex: 1; }
.toolbar .count { color: var(--muted); font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

.table-card { padding: 0; overflow: hidden; transition: box-shadow .2s var(--ease), border-color .2s var(--ease); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 18px; font-size: 14.5px; border-bottom: 1px solid var(--line-soft); }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; background: var(--card-2); font-family: "Orbitron", sans-serif; }
tbody tr { transition: background .12s var(--ease); }
tbody tr:hover { background: rgba(0,181,216,.045); }
tbody tr:last-child td { border-bottom: 0; }
.mono { font-size: 12.5px; }
.muted { color: var(--muted); }
.cell-strong { font-weight: 700; }
.cell-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 5px 100%, 0 calc(100% - 5px));
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.on, .badge.ok { background: rgba(0,181,216,.12); color: var(--cyan-600); }
.badge.off { background: var(--bg-2); color: var(--muted); }
.badge.bad { background: rgba(239,62,82,.12); color: var(--danger); }
.badge.warn { background: rgba(245,166,35,.16); color: #b4740a; }
.badge.blue { background: rgba(43,107,255,.12); color: var(--blue); }
.badge.os-badge svg { width: 14px; height: 14px; stroke-width: 1.9; margin-right: 1px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 9px 16px; cursor: pointer; font-weight: 700;
  font-size: 13px; font-family: "Rajdhani", sans-serif; text-transform: uppercase; letter-spacing: .06em;
  transition: all .16s var(--ease); white-space: nowrap;
  clip-path: polygon(0 0, calc(100% - var(--bevel-sm)) 0, 100% var(--bevel-sm), 100% 100%, var(--bevel-sm) 100%, 0 calc(100% - var(--bevel-sm)));
}
.btn svg { width: 16px; height: 16px; stroke-width: 2.2; }
.btn:hover { background: var(--card-2); border-color: rgba(0,181,216,.5); color: var(--cyan-600); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--cyan), var(--blue)); border-color: transparent; color: #fff; box-shadow: 0 4px 16px rgba(0,181,216,.35); }
.btn.primary:hover { filter: brightness(1.06); color: #fff; box-shadow: 0 6px 22px rgba(0,181,216,.5); }
.btn.danger { color: var(--danger); border-color: rgba(239,62,82,.32); }
.btn.danger:hover { background: rgba(239,62,82,.07); color: var(--danger); border-color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.sm { padding: 6px 11px; font-size: 12px; --bevel-sm: 6px; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }
.proxy-cell { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
select.btn { -webkit-appearance: none; appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%237c88a1' stroke-width='2.4' viewBox='0 0 24 24'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; }

/* switch */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { display: none; }
.switch .slider { position: absolute; inset: 0; background: #cdd6e4; border-radius: 999px; transition: .22s var(--ease); cursor: pointer; }
.switch .slider::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .22s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .slider { background: linear-gradient(90deg, var(--cyan), var(--blue)); box-shadow: 0 0 12px rgba(0,181,216,.5); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* rows / lists */
.info-list { list-style: none; padding: 0; margin: 0; }
.info-list li { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line-soft); font-size: 14.5px; }
.info-list li:last-child { border-bottom: 0; }
.info-list .k { color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; font-size: 12.5px; }
.info-list .v { font-weight: 700; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.toggle-row:last-child { border-bottom: 0; }
.toggle-row .t-title { font-weight: 700; font-size: 15px; text-transform: uppercase; letter-spacing: .04em; }
.toggle-row .t-desc { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* forms */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 7px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line);
  font-size: 14.5px; font-family: inherit; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,181,216,.15); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* modal */
dialog#modal { border: 1px solid rgba(0,181,216,.4); padding: 0; width: min(540px, 92vw); box-shadow: var(--shadow-lg); color: var(--ink);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px)); background: var(--card); }
dialog#modal::backdrop { background: rgba(13,21,36,.55); backdrop-filter: blur(3px); }
.modal-body { padding: 24px 24px 6px; }
.modal-body h2 { font-family: "Orbitron", sans-serif; margin: 0 0 18px; font-size: 17px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px 22px; }

/* toast */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  display: flex; align-items: center; gap: 10px;
  background: #0d1524; color: #fff; padding: 13px 20px;
  font-size: 14px; font-weight: 600; letter-spacing: .03em; opacity: 0; pointer-events: none; transition: .28s var(--ease); z-index: 100;
  box-shadow: 0 0 0 1px rgba(0,181,216,.4), var(--shadow-lg);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { box-shadow: 0 0 0 1px rgba(239,62,82,.6), var(--shadow-lg); }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--cyan-400); box-shadow: 0 0 8px var(--cyan); }
.toast.err::before { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

.help { color: var(--muted); font-size: 13.5px; line-height: 1.65; }
.help strong { color: var(--ink-2); }
.empty { text-align: center; color: var(--muted); padding: 44px 20px; font-weight: 600; }
.skeleton { color: var(--muted-2); text-align: center; padding: 60px 20px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-family: "Orbitron", sans-serif; font-size: 13px; }

/* fade-in */
.view > * { animation: rise .35s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
