:root {
  color-scheme: dark;
  --bg: #090d14;
  --surface: #111824;
  --surface-raised: #151e2c;
  --surface-hover: #1a2535;
  --sidebar: #0c121c;
  --line: #233044;
  --line-soft: #1b2637;
  --ink: #edf2f8;
  --muted: #91a0b6;
  --muted-dim: #65738a;
  --violet: #8b82f6;
  --violet-strong: #756bea;
  --cyan: #68d8c0;
  --orange: #f1b273;
  --good: #55c9a4;
  --danger: #ef8074;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% -10%, #2a28523d 0, transparent 32rem),
    radial-gradient(circle at 42% 120%, #12384a2b 0, transparent 33rem),
    var(--bg);
  font: 14px/1.45 Manrope, Arial, sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
}

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px 1fr; }

.sidebar {
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  padding: 28px 16px 18px;
  color: var(--muted);
  background: linear-gradient(180deg, #0e1520 0%, #0a1018 100%);
  border-right: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  color: #f7f9fd;
  font: 700 22px 'Space Grotesk';
  letter-spacing: -1px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid #b8b1ff55;
  border-radius: 9px 9px 4px 9px;
  color: #fff;
  background: linear-gradient(135deg, #a79fff, #635bd3);
  box-shadow: 0 7px 22px #7167e34d;
  font-size: 15px;
}

.brand-dot { color: #aaa4ff; }
.nav { display: grid; gap: 6px; margin-top: 57px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #8f9bb0;
  font-weight: 600;
  transition: background .18s, border-color .18s, color .18s;
}

.nav-link span { width: 17px; color: #8c99ae; font-size: 17px; text-align: center; }
.nav-link b { margin-left: auto; padding: 2px 7px; border-radius: 20px; color: #c1bdff; background: #252644; font: 700 11px Manrope; }
.nav-link:hover { color: #e3e8f2; background: #151e2b; }
.nav-link.is-active { color: #f4f6fb; background: linear-gradient(90deg, #28275a, #1c2440); border-color: #5d5ab144; }
.nav-link.is-active span { color: #aaa3ff; }

.sidebar-bottom { margin-top: auto; }
.support-button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; color: #8e9ab0; background: transparent; font-weight: 600; }
.support-button:hover { color: #dce3ed; }
.support-button span { width: 18px; height: 18px; display: grid; place-items: center; border: 1px solid #66758c; border-radius: 50%; font-size: 11px; }

.profile { display: flex; align-items: center; gap: 10px; margin-top: 13px; padding: 18px 8px 0; border-top: 1px solid var(--line-soft); }
.avatar { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: linear-gradient(135deg, #cf8e76, #845a81); font-size: 10px; font-weight: 800; }
.profile strong, .profile small { display: block; }
.profile strong { color: #edf2f8; font-size: 12px; }
.profile small { margin-top: 1px; color: #75839a; font-size: 10px; }
.profile-menu { margin-left: auto; border: 0; color: #8090a6; background: transparent; letter-spacing: 1px; }

main { min-width: 0; }
.topbar {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  border-bottom: 1px solid var(--line-soft);
  background: #0d131dce;
  backdrop-filter: blur(14px);
}
.breadcrumb { color: var(--muted-dim); font-size: 12px; }
.breadcrumb i { margin: 0 9px; color: #405068; font-style: normal; }
.breadcrumb strong { color: #cbd4e0; }
.topbar-actions { display: flex; align-items: center; gap: 19px; }
.icon-button { position: relative; border: 0; color: #abb8ca; background: transparent; font-size: 19px; }
.notification-dot { position: absolute; top: 2px; right: 1px; width: 6px; height: 6px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px #0d131d; }
.add-client { padding: 11px 16px; border: 1px solid #aba5ff40; border-radius: 8px; color: #fff; background: linear-gradient(135deg, #8a81f4, #6d63de); box-shadow: 0 7px 20px #655ddd30; font-weight: 700; transition: filter .18s, transform .18s; }
.add-client:hover { filter: brightness(1.09); transform: translateY(-1px); }
.add-client span { margin-right: 6px; font-size: 19px; font-weight: 400; line-height: 0; vertical-align: -1px; }
.mobile-menu { display: none; }

.content { max-width: 1390px; margin: auto; padding: 46px 48px 65px; }
.heading-row { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 30px; }
.eyebrow { margin: 0 0 7px; color: #a9a3ff; font-size: 10px; font-weight: 800; letter-spacing: 1.25px; }
.heading-row h1 { margin: 0; color: #f1f4f9; font: 700 29px/1.2 'Space Grotesk'; letter-spacing: -.8px; }
.subheading { margin: 8px 0 0; color: var(--muted); }
.period-select { min-width: 156px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 7px; color: #adbacb; background: var(--surface); font-size: 12px; text-align: left; }
.period-select:hover { background: var(--surface-hover); }
.period-select span { float: right; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.stat-card { position: relative; overflow: hidden; padding: 19px 21px 18px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(145deg, #151e2c 0%, #101722 100%); box-shadow: 0 12px 30px #02050a24; }
.stat-card::after { position: absolute; top: -45px; right: -35px; width: 120px; height: 120px; border-radius: 50%; content: ''; opacity: .23; filter: blur(8px); }
.accent-violet::after { background: #7567ec; }
.accent-mint::after { background: #53cdb0; }
.accent-orange::after { background: #e9a363; }
.stat-card::before { position: absolute; inset: 0 auto 0 0; width: 3px; content: ''; }
.accent-violet::before { background: var(--violet); }
.accent-mint::before { background: var(--cyan); }
.accent-orange::before { background: var(--orange); }
.stat-card-top { display: flex; align-items: center; justify-content: space-between; }
.stat-icon { color: #c0cbe0; font-size: 18px; }
.stat-trend { padding: 3px 7px; border-radius: 5px; font-size: 10px; font-weight: 700; }
.positive { color: #75e0c3; background: #1c473f; }
.neutral { color: #a8b3c4; background: #253244; }
.stat-card p { margin: 17px 0 1px; color: #a3afc0; font-size: 12px; font-weight: 600; }
.stat-card strong { display: block; color: #f1f4fa; font: 700 27px 'Space Grotesk'; letter-spacing: -1px; }
.stat-card em { color: #9ca9bc; font-size: 14px; font-style: normal; }
.stat-card small { color: #76859a; font-size: 11px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(340px, .85fr); gap: 18px; margin-top: 18px; }
.panel { padding: 22px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(145deg, #131c29, #0e151f); box-shadow: 0 12px 30px #02050a1f; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; }
.panel h2 { margin: 0; color: #eaf0f8; font: 700 16px 'Space Grotesk'; letter-spacing: -.3px; }
.panel-heading p { margin: 4px 0 0; color: #7d8ba0; font-size: 11px; }
.panel-heading a { padding-top: 3px; color: #aaa5ff; font-size: 11px; font-weight: 700; }
.panel-heading a:hover { color: #d0ceff; }
.more-button, .kebab { border: 0; color: #8090a7; background: transparent; letter-spacing: 2px; }
.chart-legend { display: flex; gap: 18px; margin: 22px 0 8px 47px; color: #9ba8bb; font-size: 10px; font-weight: 600; }
.chart-legend i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; }
.legend-in { background: var(--violet); }
.legend-out { background: var(--cyan); }
.chart { display: flex; height: 246px; }
.chart-y { display: flex; flex-direction: column; justify-content: space-between; padding: 0 11px 21px 0; color: #65748a; font-size: 9px; text-align: right; }
.chart-area { position: relative; flex: 1; }
.chart-area svg { width: 100%; height: 218px; overflow: visible; }
.chart-grid line { stroke: #263347; stroke-width: 1; }
.line { fill: none; stroke-width: 3; vector-effect: non-scaling-stroke; }
.incoming { stroke: #948cff; }
.outgoing { stroke: var(--cyan); }
.focus-dot { fill: #172030; stroke: #9a93ff; stroke-width: 3; }
.tooltip { position: absolute; top: 26px; left: 70%; min-width: 95px; padding: 8px 10px; border: 1px solid #344259; border-radius: 7px; color: #e7edf6; background: #1b2636; box-shadow: 0 8px 25px #0000003d; font-size: 9px; transform: translateX(-50%); }
.tooltip strong { display: block; margin-bottom: 3px; }
.tooltip span { color: #aaa5ff; font-weight: 700; }
.tooltip i { display: inline-block; width: 5px; height: 5px; margin-right: 4px; border-radius: 50%; background: var(--violet); }
.chart-x { position: absolute; right: 0; bottom: 0; left: 0; display: flex; justify-content: space-between; color: #66758b; font-size: 9px; }

.server-list { margin-top: 19px; }
.server-row { display: flex; align-items: center; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.server-flag { font-size: 19px; }
.server-name { min-width: 0; flex: 1; }
.server-name strong, .server-name small { display: block; }
.server-name strong { color: #dae3ef; font-size: 12px; }
.server-name small { overflow: hidden; margin-top: 2px; color: #718096; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.status { padding: 4px 7px; border-radius: 5px; font-size: 9px; font-weight: 700; }
.status.online { color: #74e0c2; background: #1b453d; }
.add-server { width: 100%; margin-top: 15px; padding: 10px; border: 1px dashed #4b596e; border-radius: 7px; color: #aaa5ff; background: #171d35; font-size: 11px; font-weight: 700; }
.add-server:hover { border-color: #8179e6; background: #1e2141; }
.add-server span { font-size: 16px; vertical-align: -1px; }

.clients-panel { margin-top: 18px; }
.clients-table-wrap { overflow-x: auto; margin-top: 18px; }
table { width: 100%; min-width: 620px; border-collapse: collapse; }
th { padding: 0 10px 10px; color: #77869a; font-size: 9px; font-weight: 800; letter-spacing: .5px; text-align: left; text-transform: uppercase; }
td { padding: 12px 10px; border-top: 1px solid var(--line-soft); color: #9ba8b9; font-size: 11px; }
td:first-child { color: #e1e8f1; font-weight: 700; }
.client-cell { display: flex; align-items: center; gap: 9px; }
.client-avatar { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-size: 9px; font-weight: 800; }
.c1 { color: #c8c1ff; background: #393468; }
.c2 { color: #89e4cc; background: #1f5148; }
.c3 { color: #f7bf8a; background: #563c2a; }
.c4 { color: #9cc8ff; background: #29476e; }
.traffic-cell { color: #c1ccda; font-weight: 700; }
.offline { color: #a4afbd; background: #293241; }

dialog { width: min(420px, calc(100% - 32px)); padding: 28px; border: 1px solid #344158; border-radius: 16px; color: var(--ink); background: #151e2c; box-shadow: 0 22px 60px #00000073; }
dialog::backdrop { background: #03060dcc; backdrop-filter: blur(4px); }
dialog form { position: relative; }
dialog h2 { margin: 0; font: 700 23px 'Space Grotesk'; }
dialog form > p:not(.eyebrow) { margin: 8px 0 21px; color: #9aa8ba; font-size: 12px; }
dialog label { display: block; margin-top: 12px; color: #bdc7d4; font-size: 11px; font-weight: 700; }
dialog input, dialog select { display: block; width: 100%; margin-top: 6px; padding: 11px; border: 1px solid #39485e; border-radius: 7px; color: #eaf0f6; outline-color: var(--violet); background: #0d141e; }
.dialog-close { position: absolute; top: -10px; right: -5px; border: 0; color: #9eacbf; background: transparent; font-size: 24px; }
.dialog-submit { width: 100%; margin-top: 20px; padding: 11px; border: 1px solid #aaa5ff3f; border-radius: 8px; color: #fff; background: var(--violet-strong); font-weight: 700; }
.toast { position: fixed; bottom: 27px; left: 50%; padding: 11px 16px; border: 1px solid #344159; border-radius: 8px; color: #eaf0f7; background: #192434; box-shadow: 0 8px 20px #0000004f; font-size: 12px; opacity: 0; pointer-events: none; transform: translate(-50%, 15px); transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 76px 1fr; }
  .sidebar { padding: 27px 10px; }
  .brand { justify-content: center; padding: 0; }
  .brand > span:last-child, .nav-link { font-size: 0; }
  .nav { margin-top: 55px; }
  .nav-link { justify-content: center; padding: 12px; }
  .nav-link span { font-size: 18px; }
  .nav-link b, .sidebar-bottom { display: none; }
  .topbar, .content { padding-right: 30px; padding-left: 30px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .server-panel { min-height: 255px; }
}

@media (max-width: 650px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { min-height: 65px; padding: 0 18px; }
  .mobile-menu { display: block; border: 0; color: #b5c2d3; background: transparent; font-size: 19px; }
  .breadcrumb { display: none; }
  .content { padding: 28px 18px; }
  .heading-row { align-items: flex-start; gap: 15px; }
  .heading-row h1 { font-size: 25px; }
  .period-select { min-width: auto; font-size: 0; }
  .period-select span { font-size: 15px; }
  .stat-grid { grid-template-columns: 1fr; gap: 10px; }
  .dashboard-grid { gap: 10px; margin-top: 10px; }
  .panel { padding: 17px; }
  .chart-legend { margin-left: 39px; }
  .topbar-actions { gap: 7px; }
  .icon-button { display: none; }
  .add-client { padding: 10px; font-size: 11px; }
  .clients-panel { margin-top: 10px; }
}
