:root {
  --blue: #1568d6;
  --blue-dark: #0b4aa8;
  --teal: #14b8b3;
  --charcoal: #34373b;
  --navy: #0f172a;
  --muted: #2f3d54;
  --line: #e2e8f0;
  --bg-soft: #f8fafc;
  color-scheme: light;
  font-family: 'Poppins', 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; color: var(--navy); }
/* theme: the supplied gradient (light blue at the top, vivid blue in the middle, deep blue at the bottom), fixed to the window on every page */
html { background: #195987 linear-gradient(180deg, #74b6e5 0%, #67ade1 10%, #58a5dc 20%, #489cd7 30%, #3993d3 40%, #2b8ace 50%, #2580c1 60%, #2276b2 70%, #1f6ca4 80%, #1c6295 90%, #195987 100%) fixed; }
body { background: transparent; }
body { min-height: 100svh; position: relative; overflow-x: hidden; font-size: 15px; line-height: 1.5; }
.glow { display: none; position: fixed; border-radius: 50%; filter: blur(120px); pointer-events: none; z-index: 0; }
.glow-left { top: -10%; left: -10%; width: 45vw; height: 45vw; background: rgba(21,104,214,.12); }
.glow-right { bottom: -15%; right: 10%; width: 35vw; height: 35vw; background: rgba(20,184,179,.10); }
#app { position: relative; z-index: 1; }

/* top bar */
.topbar { display: flex; align-items: center; gap: 28px; padding: 14px 56px; background: rgba(255,255,255,.85);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar img { height: 38px; width: auto; display: block; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { padding: 8px 16px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 15px; }
.nav a:hover { background: var(--bg-soft); color: var(--navy); }
.nav a.active { background: rgba(21,104,214,.1); color: var(--blue); }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13.5px; }
.who strong { color: var(--navy); display: block; line-height: 1.1; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: rgba(21,104,214,.1); color: var(--blue); font-size: 13px; font-weight: 600; }
.pill.teal { background: rgba(20,184,179,.12); color: #0d8a86; }
.pill.red { background: #fef2f2; color: #b91c1c; }
.pill.amber { background: #fff8ec; color: #b45309; }
.pill.gray { background: #f1f5f9; color: var(--muted); }

/* every page uses the whole window width with the same margins, so the layouts line up from page to page */
main { max-width: none; margin: 0; padding: 20px 56px 24px; }  /* side margins about the same as the space at the bottom */
h1 { margin: 0 0 4px; font-size: 28px; font-weight: 600; letter-spacing: -.3px; }
h2 { margin: 0 0 14px; font-size: 18px; font-weight: 600; }
.sub { color: var(--muted); margin: 0 0 24px; font-size: 15px; }
.row { display: flex; gap: 20px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 24px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px;
  box-shadow: 0 10px 30px rgba(25,80,110,.14); }
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat .value { font-size: 34px; font-weight: 600; color: var(--navy); line-height: 1.15; }
.stat .value.blue { color: var(--blue); } .stat .value.teal { color: #0d8a86; }
.stat .hint { color: var(--muted); font-size: 13px; }
.section { margin-bottom: 28px; }

/* buttons & forms */
button, .btn { font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--navy);
  padding: 9px 18px; border-radius: 10px; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { background: var(--bg-soft); }
button.primary, .btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
button.primary:hover { background: var(--blue-dark); }
button.small { padding: 4px 12px; font-size: 13px; }
button:disabled { opacity: .55; cursor: default; }
label { display: block; font-weight: 600; color: var(--charcoal); margin: 0 0 6px; font-size: 14px; }
input[type=text], input[type=password], input[type=number], input[type=month], input[type=date], input[type=search], select {
  font: inherit; width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: var(--navy); }
input:focus, select:focus { outline: 2px solid rgba(21,104,214,.35); border-color: var(--blue); }
.field { margin-bottom: 16px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.check input { width: 18px; height: 18px; }
.msg { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.msg.err { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.msg.ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.msg.warn { background: #fff8ec; border: 1px solid #fcd9a8; color: #92400e; }

/* table */
.tablewrap { overflow-x: auto; }
/* long lists (Peers, IP Swap) scroll inside their card with a fixed header, instead of the whole page scrolling */
.tablewrap.listscroll { overflow-x: hidden; overflow-y: auto; max-height: calc(100vh - 340px); min-height: 200px; }
.tablewrap.listscroll thead th { position: sticky; top: 0; z-index: 2; background: #fff; box-shadow: 0 1px 0 var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tr:hover td { background: var(--bg-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; background: #fff !important; }
.empty { color: var(--muted); padding: 24px; text-align: center; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #cbd5e1; margin-right: 8px; }
.dot.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.mono { font-family: inherit; font-size: 13.5px; font-variant-numeric: tabular-nums; }

/* chart */
.chart { display: flex; align-items: flex-end; gap: 14px; height: 200px; padding: 8px 4px 0; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar .fill { width: 100%; max-width: 64px; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, var(--blue), var(--teal)); min-height: 3px; }
.bar .amt { font-size: 13px; color: var(--muted); margin-bottom: 4px; white-space: nowrap; }
.bar .m { font-size: 13px; color: var(--muted); margin-top: 6px; }
.bar.cur .fill { background: linear-gradient(180deg, var(--blue-dark), var(--blue)); }

/* login */
.login-wrap { min-height: 100svh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 40px 36px;
  box-shadow: 0 20px 50px rgba(25,80,110,.2); }
.login-card img { width: 270px; max-width: 100%; height: auto; display: block; margin: 0 auto 22px; }
.login-card h1 { font-size: 24px; text-align: center; } .login-card .sub { text-align: center; margin-bottom: 24px; }
.login-card button.primary { width: 100%; padding: 12px; font-size: 15px; }

.keybox { background: var(--bg-soft); border: 1px dashed var(--blue); border-radius: 12px; padding: 14px 16px; word-break: break-all; margin: 8px 0 12px; }
ol.steps { margin: 10px 0 0; padding-left: 22px; color: var(--muted); line-height: 1.7; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; min-width: 180px; }
.modal-back { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 20px; }
.modal { background: #fff; border-radius: 16px; padding: 28px; width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; }
@media (max-width: 800px) { .topbar { padding: 12px 16px; gap: 12px; flex-wrap: wrap; } main { padding: 16px 16px 24px; } }
.print-only { display: none; }
@page { size: A4; margin: 12mm 14mm; }
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .topbar, .glow, .noprint, .hide-print { display: none !important; }
  .print-only { display: flex !important; }
  html, body { background: #fff; font-size: 13px; }
  main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; padding: 0; margin: 0; break-inside: avoid; }
  .print-head { align-items: center; gap: 18px; border-bottom: 2px solid var(--blue); padding-bottom: 12px; margin-bottom: 14px; }
  .print-head img { height: 50px; width: auto; display: block; }
  .print-head .ph-title { font-size: 24px; font-weight: 700; color: var(--navy); }
  .print-head .ph-text { color: var(--muted); font-size: 14px; }
  table { font-size: 13px; }
  th, td { padding: 6px 10px; }
  tr:hover td { background: transparent; }
}

.bar .fill { position: relative; overflow: hidden; }
.bar .fill .wgpart { position: absolute; left: 0; right: 0; bottom: 0; background: var(--teal); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 10px; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.legend .sw.nb { background: var(--blue); } .legend .sw.wg { background: var(--teal); }

.tabs { display: flex; gap: 6px; background: var(--bg-soft); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.tabs button { border: 0; background: transparent; padding: 8px 18px; border-radius: 9px; font-size: 14.5px; color: var(--muted); }
.tabs button.on { background: #fff; color: var(--blue); box-shadow: 0 2px 8px rgba(15,23,42,.1); }
.tabs button .pill { margin-left: 6px; }

/* Blue feedback: every button and option turns blue under the cursor and while it is pressed.
   The primary (already blue) buttons go a shade deeper instead. Disabled buttons do not react. */
button, .btn, .nav a, .tabs button { transition: background .12s, color .12s, border-color .12s; }
button:not(:disabled):hover, .btn:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
button:not(:disabled):active, .btn:active { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
button.primary:not(:disabled):hover, .btn.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
button.primary:not(:disabled):active, .btn.primary:active { background: #083a85; border-color: #083a85; color: #fff; }
.nav a:hover { background: var(--blue); color: #fff; }
.nav a.active { background: var(--blue); color: #fff; }
.nav a.active:hover, .nav a:active { background: var(--blue-dark); color: #fff; }
.tabs button:not(.on):hover { background: var(--blue); color: #fff; }
.tabs button:not(.on):active, .tabs button.on:active { background: var(--blue-dark); color: #fff; }
.tabs button.on { background: var(--blue); color: #fff; box-shadow: none; }
.tabs button:hover .pill, .tabs button.on .pill, .tabs button:active .pill { background: rgba(255,255,255,.25); color: #fff; }
button:focus-visible, .btn:focus-visible, .nav a:focus-visible { outline: 2px solid rgba(21,104,214,.55); outline-offset: 2px; }

/* user menu */
.usermenu { position: relative; }
.refreshbtn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; margin-right: -14px; border-radius: 8px; cursor: pointer; }
.topbar .refreshbtn { background: transparent; border: 1px solid rgba(255,255,255,.6); color: #fff; }
.topbar .refreshbtn:hover { background: #fff; border-color: #fff; color: var(--blue); }
.refreshbtn.spinning svg { animation: refreshspin .7s linear infinite; }
@keyframes refreshspin { to { transform: rotate(360deg); } }
.userbtn { background: transparent; border: 1px solid var(--line); font-weight: 500; color: var(--navy); }
.userbtn .caret { font-size: 11px; margin-left: 4px; }
.umenu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 250px; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15,23,42,.15); padding: 8px; z-index: 30; display: flex; flex-direction: column; gap: 4px; }
.umenu[hidden] { display: none; }
.umenu button { width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 12px; }
.umhead, .umrole { padding: 8px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.umlabel { font-size: 12px; color: var(--muted); font-weight: 600; }
.umuser { font-size: 12.5px; color: var(--muted); font-weight: 400; }

.golink { cursor: pointer; }
/* clickable tiles turn blue under the cursor and darker blue while pressed, like buttons */
.golink { transition: background .12s, border-color .12s, color .12s; border-radius: 12px; }
.golink:hover { background: var(--blue); border-color: var(--blue); }
.golink:active { background: var(--blue-dark); border-color: var(--blue-dark); }
.golink:hover *, .golink:active *, .golink:hover .value, .golink:hover .hint { color: #fff !important; }
div.golink:not(.card) { padding: 6px 10px; margin: -6px -10px; }
.golink:focus-visible { outline: 2px solid rgba(21,104,214,.55); outline-offset: 2px; }

/* peers list: columns hug their text; identical widths on every tab (min-widths are set from the data) */
table.peertbl { width: 100%; table-layout: fixed; }
table.peertbl td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the buttons of a row wrap inside their own column instead of being cut off */
table.peertbl td.acts { overflow: visible; white-space: normal; text-align: right; }
table.peertbl td.acts button.small { padding: 3px 9px; font-size: 12px; margin: 2px 0 2px 4px; }
table.peertbl td.acts .vpnlbl { margin-right: 4px; }

/* money amounts in the tiles are smaller than counts so long INR values fit comfortably */
.stat .value.amt { font-size: 22px; font-weight: 600; line-height: 1.6; }

@media print {
  body[data-print=stored] main { display: none !important; }
  body[data-print=stored] .modal-back { position: static; background: none; padding: 0; display: block; }
  body[data-print=stored] .modal { max-width: none; max-height: none; overflow: visible; padding: 0; border-radius: 0; }
}
@media print { body[data-print=pre] .invcard, body[data-print=inv] .precard { display: none !important; } }

/* sortable column headers */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover, th.sortable:active, th.sorted { color: var(--blue); }
th.sortable:active { color: var(--blue-dark); }

.ficon { color: var(--muted); flex: none; }

/* administration: sidebar + content */
.adminwrap { display: flex; gap: 24px; align-items: flex-start; }
.sidebar { width: 250px; flex: none; position: sticky; top: 90px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.sidebar a { padding: 10px 14px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 500; }
.sidebar a.subitem { margin-left: 12px; }
.sidebar a:hover { background: var(--blue); color: #fff; }
.sidebar a:active { background: var(--blue-dark); color: #fff; }
.sidebar a.active { background: var(--blue); color: #fff; }
.sidebar .side-title { padding: 10px 14px 4px; font-size: 12px; font-weight: 600; color: var(--navy); text-transform: uppercase; letter-spacing: .5px; }
.adminmain { flex: 1; min-width: 0; }
@media (max-width: 800px) { .adminwrap { flex-direction: column; } .sidebar { width: 100%; position: static; flex-direction: row; flex-wrap: wrap; } .sidebar .side-title { width: 100%; } }

.sidebar a.parent { display: flex; justify-content: space-between; align-items: center; }
.sidebar a.parent .caret { font-size: 11px; transition: transform .15s; }
.sidebar a.parent[aria-expanded=false] .caret { transform: rotate(-90deg); }
.sidebar a.parent.has-active { color: var(--navy); }
.sidebar .subitems { display: flex; flex-direction: column; gap: 2px; }
.sidebar .subitems[hidden] { display: none; }
.sidebar .subitems a.subitem { margin-left: 14px; }

a.admintile { text-decoration: none; color: inherit; display: block; }

.precard td.num, .precard th.num { white-space: nowrap; }

.modal td.num, .modal th.num { white-space: nowrap; }

/* invoices list: fixed columns, actions right-aligned and kept on one line */
table.invtbl { table-layout: fixed; }
table.invtbl td, table.invtbl th { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.invtbl td.acts { overflow: visible; text-overflow: clip; }
table.invtbl td.acts button { margin-left: 8px; }
/* the invoice view looks like the printed page: logo header on screen too */
.modal.docview { max-width: 780px; padding: 32px 36px; }
.modal.docview .print-head { display: flex; align-items: center; gap: 18px; border-bottom: 2px solid var(--blue); padding-bottom: 12px; margin-bottom: 14px; }
.modal.docview .print-head img { height: 50px; width: auto; display: block; }
.modal.docview .print-head .ph-title { font-size: 24px; font-weight: 700; color: var(--navy); }
.modal.docview .print-head .ph-text { color: var(--muted); font-size: 14px; }
.modal.docview .row { margin-top: 18px; gap: 10px; }

/* top bar: solid blue; its options turn white (blue text) under the cursor and when selected */
.topbar { background: var(--blue); border-bottom: 1px solid rgba(255,255,255,.25); backdrop-filter: none; box-shadow: 0 4px 16px rgba(10,60,120,.25); }
.topbar img { height: 40px; width: auto; padding: 0; background: none; border-radius: 0; display: block; }
.topbar .nav a { color: rgba(255,255,255,.94); }
.topbar .nav a:hover, .topbar .nav a.active, .topbar .nav a.active:hover { background: #fff; color: var(--blue); }
.topbar .nav a:active, .topbar .nav a.active:active { background: #e3eefc; color: var(--blue-dark); }
.topbar .nav a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.topbar .who, .topbar .who strong { color: #fff; }
.topbar .userbtn { background: transparent; border: 1px solid rgba(255,255,255,.6); color: #fff; }
.topbar .userbtn:not(:disabled):hover, .topbar .userbtn[aria-expanded="true"] { background: #fff; border-color: #fff; color: var(--blue); }
.topbar .userbtn:not(:disabled):active { background: #e3eefc; border-color: #e3eefc; color: var(--blue-dark); }
.topbar .userbtn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* narrower windows get smaller side margins; the top bar always lines up with the page content */
@media (max-width: 1200px) { main { padding-left: 32px; padding-right: 32px; } .topbar { padding-left: 32px; padding-right: 32px; } }
@media (max-width: 800px) { main { padding-left: 16px; padding-right: 16px; } .topbar { padding-left: 16px; padding-right: 16px; } }

/* dashboard: three tiles on the left half, the data-transferred graph on the right half - the same halves as the two VPN cards below */
.dashtop { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; align-items: stretch; }
.dashstats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.dashleft { display: flex; flex-direction: column; gap: 20px; }
/* tiles use the same type as the VPN cards below: 13px uppercase label over a 28px bold number, left-aligned */
.dashstats .stat { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 14px 16px; min-width: 0; }
.dashstats .stat .label { order: 1; font-size: 13px; letter-spacing: .04em; }
.dashstats .stat .value { order: 2; font-size: 28px; font-weight: 700; line-height: 1.2; text-align: left; }
.dashstats .stat .hint { order: 3; font-size: 13px; }
@media (max-width: 560px) { .dashstats { gap: 10px; } .dashstats .stat { padding: 12px; } .dashstats .stat .label { font-size: 12px; letter-spacing: .02em; } }
.vpnlogo { display: block; height: 30px; width: auto; max-width: 100%; }
.vpnlogo[alt="NetBird"] { height: 24px; }
.vpncard { min-height: 166px; box-sizing: border-box; }
.vpncard h2 { height: 34px; display: flex; align-items: center; }
.dashgraph { display: block; text-decoration: none; color: inherit; margin: 0; }
.dashgraph:hover { box-shadow: 0 12px 34px rgba(25,80,110,.24); }
.dashgraph .legend { margin-top: 4px; font-size: 12px; }
@media (max-width: 1100px) { .dashtop { grid-template-columns: 1fr; } }

/* page title and the line under it sit on the blue background: white (not the headings inside white cards) */
main > h1, main > .toolbar h1, .adminmain > .toolbar h1 { color: #fff; }
main > .sub, main > .toolbar .sub, .adminmain > .toolbar .sub { color: rgba(255,255,255,.92); }

.topbar .brand { display: flex; align-items: center; background: none; padding: 0; border-radius: 0; }
.topbar .brand:hover, .topbar .brand:focus-visible { background: none; }

.userbtn { display: inline-flex; align-items: center; gap: 6px; }
.userbtn .ubtxt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; text-align: left; }
.userbtn .ubname { font-weight: 600; font-size: 14px; }
.userbtn .ubuser { font-size: 12px; opacity: .85; }
.topbar .userbtn { padding: 2px 14px; }
.topbar .userbtn .ubname { font-size: 13.5px; }
.topbar .userbtn .ubuser { font-size: 11.5px; }

/* the menu is a white window inside the blue bar: dark text, not the bar's white */
.umenu, .umenu strong, .umenu div { color: var(--navy); }
.umenu .umuser, .umenu .umlabel { color: var(--muted); }
.umenu .pill { color: var(--blue); }
.topbar .who .umenu, .topbar .who .umenu strong, .topbar .who .umenu div { color: var(--navy); }
.topbar .who .umenu .umuser, .topbar .who .umenu .umlabel { color: var(--muted); }
.topbar .who .umenu .pill { color: var(--blue); }

table.peertbl th:last-child { text-align: right; }
