/* =========================================================================
   VPN Chevnet — Clean Light Minimal Design System (rebuilt from scratch)
   Style language: Linear / Notion — quiet surfaces, hairline borders,
   one calm accent, generous whitespace. Bootstrap 5 is loaded first; this
   file overrides it to flatten and calm the look.
   ========================================================================= */

:root {
  /* Surfaces */
  --bg:        #f7f8fa;   /* app background */
  --surface:   #ffffff;   /* cards, panels */
  --surface-2: #fbfcfd;   /* subtle raised / table head */
  --sidebar:   #ffffff;   /* sidebar is light too */

  /* Lines & shadows */
  --line:      #ebedf0;   /* hairline border */
  --line-2:    #e1e4e8;   /* slightly stronger */
  --ring:      rgba(37, 99, 235, .14);
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, .08);

  /* Text */
  --text:      #1a1f29;   /* primary */
  --text-2:    #4a5365;   /* secondary */
  --muted:     #8a93a5;   /* tertiary / hints */

  /* Single calm accent */
  --accent:        #2563eb;
  --accent-hover:  #1d4ed8;
  --accent-soft:   #eef3ff;
  --accent-text:   #2563eb;

  /* Semantic (muted, flat) */
  --green:   #15924f;  --green-soft:  #e9f7ef;
  --amber:   #b7791f;  --amber-soft:  #fbf4e6;
  --red:     #d1453b;  --red-soft:    #fdeceb;
  --slate:   #5b6577;  --slate-soft:  #eef0f3;

  --radius:    10px;
  --radius-sm: 8px;
  --radius-lg: 14px;

  --sidebar-w:        240px;
  --sidebar-w-collapsed: 64px;
  --topbar-h:         60px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { text-decoration: none; color: var(--accent); transition: color .15s ease; }
a:hover { color: var(--accent-hover); }

code, pre, .mono { font-family: 'JetBrains Mono', 'SFMono-Regular', ui-monospace, 'Courier New', monospace; }
code { color: var(--text-2); font-size: .86em; }

::selection { background: var(--ring); }

/* ===================== App shell layout ===================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns .2s ease;
}
.app.is-collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

@media (max-width: 991.98px) {
  .app, .app.is-collapsed { grid-template-columns: 1fr; }
}

/* ===================== Sidebar ===================== */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  overflow-x: hidden;
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 14px;
  margin-bottom: 8px;
  white-space: nowrap;
}
.sidebar__logo {
  width: 32px; height: 32px;
  flex: 0 0 32px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-size: 1rem;
}
.sidebar__title { line-height: 1.1; }
.sidebar__title b { font-size: .98rem; font-weight: 650; color: var(--text); display: block; }
.sidebar__title small { font-size: .72rem; color: var(--muted); }

.sidebar__section {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 10px 6px;
}

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: .9rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background .12s ease, color .12s ease;
}
.nav-item i { font-size: 1.05rem; width: 20px; text-align: center; flex: 0 0 20px; color: var(--muted); transition: color .12s ease; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item:hover i { color: var(--text-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-item.active i { color: var(--accent-text); }

.sidebar__footer {
  margin-top: auto;
  padding: 12px 10px 4px;
  border-top: 1px solid var(--line);
  font-size: .72rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Collapsed state: hide labels, center icons */
.app.is-collapsed .sidebar__title,
.app.is-collapsed .sidebar__section,
.app.is-collapsed .sidebar__footer,
.app.is-collapsed .nav-item span { display: none; }
.app.is-collapsed .sidebar__brand { justify-content: center; padding-left: 0; padding-right: 0; }
.app.is-collapsed .nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
.app.is-collapsed .nav-item i { width: auto; flex-basis: auto; }

/* ===================== Topbar ===================== */
.topbar {
  height: var(--topbar-h);
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
}
.topbar__toggle {
  width: 34px; height: 34px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
  flex: 0 0 auto;
}
.topbar__toggle:hover { background: var(--surface-2); color: var(--text); }
.topbar__spacer { flex: 1; }

.topbar__user { display: flex; align-items: center; gap: 10px; }
.topbar__user .meta { text-align: right; line-height: 1.2; }
.topbar__user .meta b { font-size: .86rem; font-weight: 600; color: var(--text); display: block; }
.topbar__user .meta small { font-size: .74rem; color: var(--muted); }
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  display: grid; place-items: center;
  font-weight: 600;
  font-size: .9rem;
  flex: 0 0 auto;
}

/* ===================== Main content ===================== */
.content { min-width: 0; }
main.page {
  padding: 26px 28px 60px;
  max-width: 1320px;
  margin: 0 auto;
}
@media (max-width: 991.98px) { main.page { padding: 18px 16px 48px; } }

/* Page header */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-header h1 {
  font-size: 1.45rem;
  font-weight: 680;
  letter-spacing: -.01em;
  color: var(--text);
  margin: 0;
}
.page-header .sub { color: var(--muted); font-size: .88rem; margin-top: 3px; }

/* ===================== Cards ===================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  font-weight: 600;
  font-size: .92rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-header i { color: var(--muted); }
.card-body { padding: 18px; }

/* ===================== Stat tiles ===================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow-xs);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.stat:hover { border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.stat .ico {
  width: 40px; height: 40px;
  flex: 0 0 40px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-text);
  display: grid; place-items: center;
  font-size: 1.15rem;
}
.stat .ico.green { background: var(--green-soft); color: var(--green); }
.stat .ico.amber { background: var(--amber-soft); color: var(--amber); }
.stat .ico.slate { background: var(--slate-soft); color: var(--slate); }
.stat .ico.red   { background: var(--red-soft);   color: var(--red); }
.stat .hint { color: var(--muted); font-size: .8rem; font-weight: 500; }
.stat .val { font-size: 1.6rem; font-weight: 700; color: var(--text); line-height: 1.2; margin-top: 2px; letter-spacing: -.02em; }

/* Metric (KPI) tile — flat, no gradients */
.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-xs);
}
.metric .top { display: flex; align-items: flex-start; justify-content: space-between; }
.metric .label { color: var(--muted); font-size: .8rem; font-weight: 500; }
.metric .value { font-size: 1.5rem; font-weight: 700; color: var(--text); margin-top: 6px; letter-spacing: -.02em; }
.metric .foot { color: var(--muted); font-size: .76rem; margin-top: 8px; }
.metric .badge-ico {
  width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center; font-size: 1.05rem;
  background: var(--accent-soft); color: var(--accent-text);
}
.metric.green  .badge-ico { background: var(--green-soft); color: var(--green); }
.metric.amber  .badge-ico { background: var(--amber-soft); color: var(--amber); }
.metric.red    .badge-ico { background: var(--red-soft);   color: var(--red); }
.metric.slate  .badge-ico { background: var(--slate-soft); color: var(--slate); }

/* ===================== Tables ===================== */
.table { border-collapse: separate; border-spacing: 0; margin: 0; color: var(--text); }
.table thead th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: .7rem;
  letter-spacing: .5px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  border-top: none;
  white-space: nowrap;
}
.table tbody td {
  vertical-align: middle;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: .88rem;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .1s ease; }
.table tbody tr:hover { background: var(--surface-2); }
.table.table-sm tbody td, .table.table-sm thead th { padding-top: 8px; padding-bottom: 8px; }

/* ===================== Buttons ===================== */
.btn {
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-weight: 550;
  font-size: .87rem;
  border: 1px solid transparent;
  transition: background .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn-sm { padding: 5px 10px; font-size: .8rem; border-radius: 7px; }

.btn-primary, .btn-brand { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover, .btn-brand:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #0f7a41; border-color: #0f7a41; color: #fff; }
.btn-warning { background: var(--amber); border-color: var(--amber); color: #fff; }
.btn-warning:hover { background: #9c6815; border-color: #9c6815; color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #b53a32; border-color: #b53a32; color: #fff; }
.btn-secondary { background: var(--slate-soft); border-color: var(--slate-soft); color: var(--text-2); }
.btn-secondary:hover { background: #e3e6eb; color: var(--text); }
.btn-light { background: var(--surface); border-color: var(--line-2); color: var(--text-2); }
.btn-light:hover { background: var(--surface-2); color: var(--text); }

.btn-outline-primary   { color: var(--accent); border-color: var(--line-2); background: var(--surface); }
.btn-outline-primary:hover   { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-outline-secondary { color: var(--text-2); border-color: var(--line-2); background: var(--surface); }
.btn-outline-secondary:hover { background: var(--surface-2); color: var(--text); }
.btn-outline-info      { color: var(--accent); border-color: var(--line-2); background: var(--surface); }
.btn-outline-info:hover      { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); }
.btn-outline-danger    { color: var(--red); border-color: var(--line-2); background: var(--surface); }
.btn-outline-danger:hover    { background: var(--red); color: #fff; border-color: var(--red); }

.btn-group .btn { border-radius: var(--radius-sm); }
.btn-group > .btn:not(:first-child) { margin-left: 6px; }

/* ===================== Forms ===================== */
.form-label { font-weight: 550; color: var(--text-2); margin-bottom: 6px; font-size: .82rem; }
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  padding: 8px 12px;
  font-size: .88rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.form-control::placeholder { color: var(--muted); }
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
  outline: none;
}
.form-text { color: var(--muted); font-size: .78rem; }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--ring); border-color: var(--accent); }

.input-group-text {
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.input-group > .form-control { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ===================== Badges ===================== */
.badge {
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: .72rem;
  letter-spacing: .2px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1.3;
}
.badge.bg-primary   { background: var(--accent-soft) !important; color: var(--accent-text) !important; }
.badge.bg-success   { background: var(--green-soft) !important;  color: var(--green) !important; }
.badge.bg-warning   { background: var(--amber-soft) !important;  color: var(--amber) !important; }
.badge.bg-danger    { background: var(--red-soft) !important;    color: var(--red) !important; }
.badge.bg-info      { background: var(--accent-soft) !important; color: var(--accent-text) !important; }
.badge.bg-secondary { background: var(--slate-soft) !important;  color: var(--slate) !important; }
.badge.bg-light     { background: var(--surface-2) !important;   color: var(--text-2) !important; border: 1px solid var(--line); }
.badge.bg-warning-subtle { background: var(--amber-soft) !important; }
.badge.bg-primary-subtle { background: var(--accent-soft) !important; }
.badge.text-warning { color: var(--amber) !important; }
.badge.text-primary { color: var(--accent-text) !important; }
.badge.text-dark    { color: var(--text-2) !important; }
.text-primary { color: var(--accent-text) !important; }
.text-warning { color: var(--amber) !important; }
.text-danger  { color: var(--red) !important; }
.text-muted   { color: var(--muted) !important; }

/* Pill helper for accent chips that used inline gradients */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent-soft); color: var(--accent-text);
  border-radius: 999px; padding: 3px 9px; font-size: .72rem; font-weight: 600;
}

/* ===================== Alerts ===================== */
.alert {
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 12px 15px;
  font-weight: 500;
  font-size: .88rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-success { background: var(--green-soft); color: #0f6b3a; border-color: #cfeede; }
.alert-danger  { background: var(--red-soft);   color: #a8362e; border-color: #f6d4d1; }
.alert-warning { background: var(--amber-soft); color: #8a5d12; border-color: #f0e2c2; }
.alert-info    { background: var(--accent-soft); color: var(--accent-hover); border-color: #d6e2ff; }

/* ===================== List groups ===================== */
.list-group { border-radius: 0; }
.list-group-item {
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 13px 18px;
  background: transparent;
  color: var(--text);
}
.list-group-item:last-child { border-bottom: none; }
.list-group-item-action:hover { background: var(--surface-2); }
.list-group-item.active {
  background: var(--accent-soft) !important;
  border-color: var(--accent-soft) !important;
  color: var(--accent-text) !important;
}

/* Quick action row */
.qa { display: flex; align-items: center; gap: 12px; }
.qa .qa-ico {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 9px;
  background: var(--accent-soft); color: var(--accent-text);
  display: grid; place-items: center; font-size: 1rem;
}
.qa .qa-ico.green { background: var(--green-soft); color: var(--green); }
.qa .qa-ico.amber { background: var(--amber-soft); color: var(--amber); }
.qa .qa-ico.slate { background: var(--slate-soft); color: var(--slate); }
.qa b { font-weight: 600; color: var(--text); font-size: .88rem; display: block; }
.qa small { color: var(--muted); font-size: .78rem; }

/* ===================== Modals ===================== */
.modal-content { border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.modal-header { border-bottom: 1px solid var(--line); padding: 16px 20px; }
.modal-header.bg-danger { background: var(--red) !important; }
.modal-title { font-size: 1rem; font-weight: 650; }
.modal-body { padding: 20px; }
.modal-footer { border-top: 1px solid var(--line); padding: 14px 20px; }

/* ===================== Code / terminal blocks ===================== */
.code-block {
  background: #11151c;
  color: #d6deea;
  padding: 16px 18px;
  border-radius: var(--radius);
  font-family: 'JetBrains Mono', ui-monospace, 'Courier New', monospace;
  font-size: 12.5px;
  position: relative;
  overflow: auto;
}
.code-block pre { margin: 0; color: inherit; white-space: pre-wrap; word-wrap: break-word; }
.code-copy {
  position: absolute; top: 10px; right: 10px;
}
.kv {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.kv small { color: var(--muted); font-size: .74rem; }

/* ===================== Auth (login / setup) ===================== */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(900px 500px at 50% -10%, var(--accent-soft), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 32px;
}
.auth-logo {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-size: 1.4rem;
  margin: 0 auto 16px;
}

/* ===================== Utilities ===================== */
.muted-strong { color: var(--text-2); font-weight: 600; }
.divider { height: 1px; background: var(--line); border: 0; margin: 18px 0; }
.empty-state { text-align: center; color: var(--muted); padding: 36px 16px; }
.empty-state i { font-size: 2rem; opacity: .35; display: block; margin-bottom: 8px; }

/* Make Bootstrap row gaps comfortable */
.shadow-sm { box-shadow: var(--shadow-xs) !important; }
.border-0 { border: 1px solid var(--line) !important; }
.bg-white { background: transparent !important; }

/* Toggle-password button */
.toggle-password { cursor: pointer; line-height: 1; }
.password-text {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: .78rem;
  color: var(--text-2);
}

/* fade-in for content */
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
main.page > * { animation: fadeUp .3s ease both; }
