﻿/* ------------------------------------------------------------------
   VPN Admin - design tokens and components on top of Bootstrap 5.
   Light, calm and dense enough for an operations panel.
   ------------------------------------------------------------------ */
:root {
  --ap-bg: #f4f6fb;
  --ap-surface: #ffffff;
  --ap-border: #e6e9f0;
  --ap-text: #1f2937;
  --ap-muted: #6b7280;
  --ap-brand: #2563eb;
  --ap-brand-600: #1d4ed8;
  --ap-brand-soft: #e8efff;
  --ap-sidebar-bg: #0f172a;
  --ap-sidebar-text: #cbd5e1;
  --ap-sidebar-muted: #7c8aa5;
  --ap-sidebar-hover: rgba(255, 255, 255, .07);
  --ap-radius: 12px;
  --ap-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --ap-sidebar-w: 260px;
  --ap-topbar-h: 64px;
}

html { font-size: 15px; }
body {
  background: var(--ap-bg);
  color: var(--ap-text);
  font-family: "Segoe UI", system-ui, -apple-system, Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ap-brand); text-decoration: none; }
a:hover { color: var(--ap-brand-600); }
h1, h2, h3, h4, h5 { letter-spacing: -.01em; }

/* Icons: inline SVG sprite, stroke follows text colour */
.icon { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.15em; flex-shrink: 0; }
.icon-lg { width: 1.5rem; height: 1.5rem; }

/* ---------------------------------------------------------------- shell */
.ap-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--ap-sidebar-w);
  background: var(--ap-sidebar-bg); color: var(--ap-sidebar-text);
  display: flex; flex-direction: column; z-index: 1040;
  transition: transform .2s ease;
}
.ap-brand { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1.25rem 1rem; color: #fff; font-weight: 600; font-size: 1.05rem; line-height: 1.15; }
.ap-brand:hover { color: #fff; }
.ap-brand-mark { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, #3b82f6, #6366f1); display: grid; place-items: center; color: #fff; box-shadow: 0 6px 16px rgba(59, 130, 246, .35); flex-shrink: 0; }
.ap-brand small { display: block; font-weight: 500; font-size: .68rem; color: var(--ap-sidebar-muted); letter-spacing: .08em; text-transform: uppercase; margin-top: .15rem; }
.ap-nav { padding: .25rem .75rem; display: flex; flex-direction: column; gap: 2px; }
.ap-nav-label { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ap-sidebar-muted); padding: 1rem .75rem .35rem; }
.ap-nav a { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border-radius: 8px; color: var(--ap-sidebar-text); font-weight: 500; font-size: .92rem; }
.ap-nav a .icon { width: 1.15rem; height: 1.15rem; opacity: .85; }
.ap-nav a:hover { background: var(--ap-sidebar-hover); color: #fff; }
.ap-nav a.active { background: var(--ap-brand); color: #fff; box-shadow: 0 6px 14px rgba(37, 99, 235, .35); }
.ap-nav a.active .icon { opacity: 1; }
.ap-sidebar-footer { margin-top: auto; padding: 1rem 1.25rem; border-top: 1px solid rgba(255, 255, 255, .06); font-size: .78rem; color: var(--ap-sidebar-muted); line-height: 1.5; }

.ap-main { margin-left: var(--ap-sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.ap-topbar {
  height: var(--ap-topbar-h); background: var(--ap-surface); border-bottom: 1px solid var(--ap-border);
  display: flex; align-items: center; gap: 1rem; padding: 0 1.5rem;
  position: sticky; top: 0; z-index: 1020;
}
.ap-topbar h1 { font-size: 1.15rem; font-weight: 650; margin: 0; }
.ap-subtitle { font-size: .8rem; color: var(--ap-muted); margin: 0; }
.ap-user { display: flex; align-items: center; gap: .7rem; margin-left: auto; }
.ap-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ap-brand-soft); color: var(--ap-brand-600); display: grid; place-items: center; font-weight: 700; font-size: .9rem; }
.ap-user .name { font-weight: 600; font-size: .86rem; line-height: 1.1; }
.ap-user .role { font-size: .72rem; color: var(--ap-muted); }
.ap-content { padding: 1.5rem; width: 100%; max-width: 1480px; }
.ap-footer { padding: 1rem 1.5rem; font-size: .76rem; color: var(--ap-muted); margin-top: auto; }
.ap-menu-btn { display: none !important; }
.ap-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .55); z-index: 1035; }

@media (max-width: 991.98px) {
  .ap-sidebar { transform: translateX(-100%); }
  body.ap-sidebar-open .ap-sidebar { transform: none; }
  body.ap-sidebar-open .ap-backdrop { display: block; }
  .ap-main { margin-left: 0; }
  .ap-menu-btn { display: inline-flex !important; }
  .ap-subtitle { display: none; }
  .ap-content { padding: 1rem; }
  .ap-topbar { padding: 0 1rem; }
}

/* ---------------------------------------------------------------- cards */
.card { border: 1px solid var(--ap-border); border-radius: var(--ap-radius); box-shadow: var(--ap-shadow); background: var(--ap-surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--ap-border); padding: .9rem 1.25rem; font-weight: 600; display: flex; align-items: center; gap: .6rem; border-radius: var(--ap-radius) var(--ap-radius) 0 0 !important; }
.card-header > .icon { color: var(--ap-brand); }
.card-header .hint { margin-left: auto; font-weight: 400; font-size: .78rem; color: var(--ap-muted); }
.card-body { padding: 1.25rem; }
.card-footer { background: transparent; border-top: 1px solid var(--ap-border); padding: .75rem 1.25rem; font-size: .86rem; }
.card-table .table-responsive { border-radius: 0 0 var(--ap-radius) var(--ap-radius); }

/* stat cards */
.stat-card .card-body { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.stat-icon .icon { width: 1.4rem; height: 1.4rem; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: .78rem; color: var(--ap-muted); margin-top: .15rem; }

/* soft colour tones (badges, stat icons) */
.tone-brand   { background: var(--ap-brand-soft); color: var(--ap-brand-600); }
.tone-success { background: #e7f6ee; color: #15803d; }
.tone-warning { background: #fff4e0; color: #b45309; }
.tone-danger  { background: #fdecec; color: #b91c1c; }
.tone-violet  { background: #efeaff; color: #6d28d9; }
.tone-slate   { background: #eef1f6; color: #475569; }

/* ---------------------------------------------------------------- tables */
.table { margin-bottom: 0; --bs-table-bg: transparent; }
.table > :not(caption) > * > * { padding: .7rem 1rem; }
.table thead th { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ap-muted); font-weight: 600; border-bottom: 1px solid var(--ap-border); background: #fafbfd; white-space: nowrap; }
.table tbody td { border-bottom: 1px solid var(--ap-border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover tbody tr:hover { background: #f7f9ff; }
tr.is-muted td { color: var(--ap-muted); }
tr.is-muted .cell-title { color: var(--ap-muted); }
.cell-title { font-weight: 600; color: var(--ap-text); }
.cell-sub { font-size: .76rem; color: var(--ap-muted); }
.cell-sub code { font-size: .9em; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
code { font-size: .82em; color: #334155; background: #f1f5f9; padding: .12rem .4rem; border-radius: 5px; }

/* badges */
.badge-soft { font-weight: 600; font-size: .7rem; padding: .32em .65em; border-radius: 999px; display: inline-flex; align-items: center; gap: .4em; white-space: nowrap; }
.badge-soft.dot::before { content: ""; width: .5em; height: .5em; border-radius: 50%; background: currentColor; opacity: .85; }

/* load bars */
.progress { height: 8px; border-radius: 999px; background: #e9edf5; }
.progress-bar { border-radius: 999px; }
.load { display: flex; align-items: center; gap: .6rem; min-width: 150px; }
.load .progress { flex: 1; }
.load span { font-size: .76rem; color: var(--ap-muted); width: 3em; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- controls */
.btn { border-radius: 8px; font-weight: 500; }
.btn-primary { background: var(--ap-brand); border-color: var(--ap-brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--ap-brand-600); border-color: var(--ap-brand-600); }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; }
.btn-icon .icon { width: 1rem; height: 1rem; }
.btn-toggle { border-radius: 999px; font-size: .72rem; font-weight: 600; padding: .28rem .75rem; line-height: 1.2; }
.actions { display: flex; gap: .35rem; justify-content: flex-end; }

.form-control, .form-select { border-radius: 8px; border-color: #d9dee8; }
.form-control:focus, .form-select:focus { border-color: var(--ap-brand); box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .15); }
.form-label { font-size: .8rem; font-weight: 600; color: #374151; margin-bottom: .3rem; }
.form-text { color: var(--ap-muted); }
.form-check-input:checked { background-color: var(--ap-brand); border-color: var(--ap-brand); }
.form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .15); }
.field-validation-error { display: block; font-size: .76rem; margin-top: .25rem; }
.input-validation-error { border-color: #dc2626 !important; }
.input-group .btn { border-radius: 0 8px 8px 0; }

.empty { text-align: center; color: var(--ap-muted); padding: 2.5rem 1rem; }
.empty .icon { width: 2rem; height: 2rem; opacity: .45; display: block; margin: 0 auto .5rem; }

.alert { border-radius: 10px; }

@media (min-width: 992px) { .sticky-lg { position: sticky; top: calc(var(--ap-topbar-h) + 1.5rem); } }

/* ---------------------------------------------------------------- auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: 100%; overflow-x: hidden; }
.auth-brand {
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(99, 102, 241, .35), transparent 60%),
    radial-gradient(700px 400px at 90% 90%, rgba(37, 99, 235, .25), transparent 60%),
    linear-gradient(160deg, #0b1220 0%, #101a33 60%, #0f172a 100%);
  color: #e2e8f0; display: flex; flex-direction: column; justify-content: space-between; padding: 3rem;
}
.auth-brand h2 { font-weight: 700; font-size: 2.1rem; color: #fff; line-height: 1.2; }
.auth-brand p { color: #a5b4cf; max-width: 40ch; }
.auth-brand ul { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .8rem; }
.auth-brand li { display: flex; align-items: center; gap: .7rem; color: #cbd5e1; }
.auth-brand li .icon { color: #60a5fa; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; background: var(--ap-bg); min-width: 0; }
.auth-card { width: 100%; max-width: 440px; min-width: 0; }
@media (max-width: 991.98px) { .auth { grid-template-columns: minmax(0, 1fr); } .auth-brand { display: none; } }