:root {
  --bg-0: #f4f8ff;
  --bg-1: #eef4ff;
  --ink-0: #1c2a3d;
  --ink-1: #344964;
  --line: #d7e1ee;
  --card: #ffffff;
  --accent: #1259c6;
  --accent-2: #0a8a54;
  --warn: #9e6a02;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink-0);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 10% -10%, #d8e7ff 0%, transparent 40%),
    radial-gradient(circle at 85% -15%, #e8fff3 0%, transparent 38%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(6px);
}

.brand {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.nav {
  display: flex;
  gap: 14px;
}

.nav a,
.auth-link a {
  color: var(--ink-1);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

.nav a:hover,
.auth-link a:hover {
  color: var(--accent);
}

.page-wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px;
}

.wrap,
.team-wrap {
  max-width: 1200px;
  margin: 8px auto 30px;
}

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.head h1,
.team-wrap h1,
.login-wrap h1 {
  margin: 0;
  font-size: 28px;
}

.mode-chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #b9c9df;
  color: #46607f;
  background: #edf3fc;
  font-size: 12px;
  font-weight: 600;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-top: 14px;
  box-shadow: 0 9px 20px rgba(18, 34, 60, 0.08);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.toolbar .status {
  color: #5e7592;
  font-size: 13px;
}

.chart-toolbar {
  justify-content: flex-start;
}

.toolbar button,
.password-form button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 9px 14px;
  font-weight: 700;
  cursor: pointer;
}

.isolation-info {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: #41526b;
  background: #f7f9fc;
}

.isolation-info.on {
  color: var(--warn);
  border-color: #f2cf92;
  background: #fff8e8;
}

.isolation-info.off {
  color: #1d6b39;
  border-color: #bce3c7;
  background: #effcf3;
}

table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  margin-top: 10px;
}

.table-wrap {
  overflow-x: auto;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  font-size: 14px;
}

th {
  color: #607892;
  font-weight: 700;
}

input[type=number] {
  width: 100px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

input[disabled] {
  opacity: 0.7;
}

.rates {
  white-space: nowrap;
}

.charts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.range-switch {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7faff;
}

.range-btn {
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  background: transparent;
  color: #59708c;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.range-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 14px rgba(18, 89, 198, 0.18);
}

.chart-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 9px 20px rgba(18, 34, 60, 0.08);
}

.chart-metric + .chart-metric {
  margin-top: 12px;
}

.chart-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin: 10px 0 6px;
  font-size: 12px;
  color: #5d738e;
}

.chart-head span:first-child {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-1);
}

.chart-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid #c9d8ec;
  border-radius: 999px;
  background: linear-gradient(180deg, #fafdff, #edf4ff);
  color: #234567;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.chart-badge-time {
  color: #617b97;
  font-weight: 600;
}

.chart-title {
  margin: 0 0 8px;
  font-size: 14px;
  color: #5d738e;
}

canvas {
  width: 100%;
  height: 160px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 12px;
  color: #607892;
  gap: 8px;
}

.chart-tooltip {
  position: fixed;
  z-index: 50;
  min-width: 180px;
  max-width: 260px;
  padding: 9px 11px;
  border: 1px solid rgba(28, 42, 61, 0.12);
  border-radius: 10px;
  background: rgba(28, 42, 61, 0.94);
  color: #f7fbff;
  box-shadow: 0 14px 28px rgba(18, 34, 60, 0.24);
  pointer-events: none;
}

.chart-tooltip.hidden {
  display: none;
}

.chart-tooltip-value {
  font-size: 13px;
  font-weight: 700;
}

.chart-tooltip-time {
  margin-top: 4px;
  font-size: 12px;
  color: #cad7e6;
}

.login-wrap {
  max-width: 420px;
  margin: 32px auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 22px rgba(16, 32, 56, 0.11);
  padding: 20px;
}

.telegram-box {
  margin-top: 12px;
}

.telegram-login-button {
  display: inline-block;
  border: 1px solid #9db8df;
  border-radius: 10px;
  background: #eaf2ff;
  color: #123764;
  text-decoration: none;
  font-weight: 700;
  padding: 10px 12px;
  font-size: 14px;
}

.telegram-login-button:hover {
  background: #dce9ff;
  border-color: #86a6d8;
}

.telegram-code-line {
  margin: 10px 0 0;
  font-size: 13px;
  color: #4d6079;
}

.login-note {
  margin-top: 12px;
  color: #7d3f00;
  font-size: 14px;
}

.small-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 12px;
  color: #4f6d92;
}

.password-form {
  margin-top: 12px;
}

.password-form.hidden {
  display: none;
}

.password-form label {
  display: block;
  margin-top: 10px;
  font-size: 14px;
  color: #334;
}

.password-form input {
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.login-error {
  margin-top: 10px;
  color: #b42318;
  font-size: 13px;
  min-height: 18px;
}

.team-panel p {
  margin: 8px 0;
}

.vpn-list {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vpn-list a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #f6f9ff;
  color: var(--ink-0);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.vpn-list a:hover {
  border-color: #96afd2;
  background: #ebf2ff;
}

@media (max-width: 800px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .nav {
    flex-wrap: wrap;
  }

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

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

  .range-switch {
    width: 100%;
    justify-content: space-between;
  }

  th:nth-child(3),
  td:nth-child(3) {
    display: none;
  }
}
