/* Simple VPN — Parker Data Link, LLC
   Palette taken from the PDL mark: deep navy ground, chrome text, the two
   blues out of the logo's circuitry. */

:root {
  --bg:          #0b101a;
  --bg-raised:   #131b29;
  --bg-sunken:   #080c14;
  --line:        #1f2b3d;
  --line-strong: #2c3b52;

  --ink:         #eef3fa;
  --ink-dim:     #9fb0c6;
  --ink-faint:   #66788f;

  --brand:       #2b8ae6;   /* the P */
  --brand-lift:  #4aa8ff;
  --accent:      #4fd2f7;   /* the circuit nodes */

  --good:        #2fc98a;
  --warn:        #f0b545;
  --bad:         #f06a6a;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;

  --shadow: 0 18px 40px -22px rgba(0, 0, 0, .95);
  --tap: 44px;               /* minimum comfortable touch target */
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(1100px 620px at 50% -12%, #16243a 0%, transparent 62%),
    var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.view[hidden], [hidden] { display: none !important; }

.shell {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.shell--narrow { max-width: 420px; justify-content: center; min-height: 100dvh; }

/* ─────────────────────────────── brand ─────────────────────────────── */

.brand { text-align: center; margin-bottom: 4px; }
.brand__mark { width: 160px; height: auto; display: block; margin: 0 auto 10px; }
.brand__name {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 650;
  letter-spacing: -.02em;
}
.brand__by { margin: 2px 0 0; font-size: .82rem; color: var(--ink-faint); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar__brand img { display: block; width: 120px; height: auto; }

/* ─────────────────────────────── cards ─────────────────────────────── */

.card, .panel, .status, .meters {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.card   { padding: 20px; }
.panel  { padding: 18px; }
.meters { padding: 16px 18px; }

/* ─────────────────────────────── tabs ──────────────────────────────── */

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  background: var(--bg-sunken);
  border-radius: var(--r-md);
}
.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  font-weight: 550;
  font-size: .92rem;
  padding: 10px 8px;
  min-height: var(--tap);
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tab.is-active { background: var(--bg-raised); color: var(--ink); }
.tab:focus-visible { outline: 2px solid var(--brand-lift); outline-offset: 2px; }

/* ────────────────────────────── fields ─────────────────────────────── */

.field { display: block; margin-bottom: 14px; }
.field__label {
  display: block;
  font-size: .8rem;
  font-weight: 550;
  color: var(--ink-dim);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  min-height: var(--tap);
  padding: 11px 13px;
  background: var(--bg-sunken);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  color: var(--ink);
  font: inherit;
  font-size: 16px;            /* anything smaller makes iOS zoom on focus */
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: var(--ink-faint); }
.field input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(43, 138, 230, .22);
}
.field__hint { display: block; margin-top: 6px; font-size: .78rem; color: var(--ink-faint); }

/* ────────────────────────────── buttons ────────────────────────────── */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 11px 18px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: .94rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform .08s, filter .15s, background .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--brand-lift); outline-offset: 2px; }
.btn[disabled], .btn.is-busy { opacity: .55; pointer-events: none; }

.btn--primary {
  background: linear-gradient(180deg, var(--brand-lift), var(--brand));
  color: #fff;
  box-shadow: 0 8px 20px -10px rgba(43, 138, 230, .9);
}
.btn--primary:hover { filter: brightness(1.06); }

.btn--ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink-dim);
}
.btn--ghost:hover { border-color: var(--brand); color: var(--ink); }

.btn--danger { background: transparent; border-color: transparent; color: var(--bad); }
.btn--danger:hover { border-color: var(--bad); }

.btn--block { width: 100%; }
.btn--small { min-height: 38px; padding: 8px 14px; font-size: .86rem; }

.linkish {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: .84rem;
  color: var(--ink-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.linkish:hover { color: var(--ink); }

.iconbtn {
  appearance: none;
  background: none;
  border: 0;
  color: var(--ink-dim);
  font-size: 1.7rem;
  line-height: 1;
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  cursor: pointer;
}
.iconbtn:hover { color: var(--ink); background: var(--bg-sunken); }

/* ────────────────────────────── status ─────────────────────────────── */

.status { padding: 30px 20px; text-align: center; }

.status__dot {
  width: 14px;
  height: 14px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--ink-faint);
  box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
}
.status.is-on  .status__dot {
  background: var(--good);
  animation: pulse 2.4s ease-out infinite;
}
.status.is-off .status__dot { background: var(--ink-faint); }
.status.is-bad .status__dot { background: var(--bad); }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0   rgba(47, 201, 138, .55); }
  70%  { box-shadow: 0 0 0 14px rgba(47, 201, 138, 0); }
  100% { box-shadow: 0 0 0 0   rgba(47, 201, 138, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .status.is-on .status__dot { animation: none; }
}

.status__headline {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: -.015em;
}
.status__detail { margin: 6px 0 0; font-size: .88rem; color: var(--ink-dim); }

/* ────────────────────────────── meters ─────────────────────────────── */

.meter + .meter { margin-top: 14px; }
.meter__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 7px;
}
.meter__label { font-size: .82rem; color: var(--ink-dim); }
.meter__value { font-size: .82rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.bar {
  height: 7px;
  border-radius: 99px;
  background: var(--bg-sunken);
  overflow: hidden;
}
.bar__fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transition: width .4s ease;
}
.bar__fill.is-high { background: linear-gradient(90deg, var(--warn), #f5894a); }
.bar__fill.is-full { background: linear-gradient(90deg, var(--bad), #d94b6a); }

.plan-line {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: .78rem;
  color: var(--ink-faint);
}

/* ────────────────────────────── devices ────────────────────────────── */

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel__title { margin: 0; font-size: 1rem; font-weight: 600; }

.devices { list-style: none; margin: 0; padding: 0; }

/* Two rows on a phone - name above, buttons below - so a long device name is
   never squeezed into a two-word column by the action buttons. One row as soon
   as there is width for it. */
.device {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "dot body"
    ".   actions";
  align-items: center;
  column-gap: 12px;
  row-gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.devices .device:first-child { border-top: 0; }

.device__dot {
  grid-area: dot;
  align-self: start;
  margin-top: 7px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink-faint);
}
.device.is-on .device__dot { background: var(--good); }

.device__body { grid-area: body; min-width: 0; }
.device__name {
  font-weight: 550;
  font-size: .94rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.device__meta {
  font-size: .76rem;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device__actions { grid-area: actions; display: flex; gap: 6px; }

@media (min-width: 430px) {
  .device {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "dot body actions";
    row-gap: 0;
  }
  .device__dot { align-self: center; margin-top: 0; }
  .device__actions { justify-content: flex-end; }
}

.empty {
  margin: 4px 0 0;
  padding: 18px 4px;
  text-align: center;
  font-size: .88rem;
  color: var(--ink-faint);
}

/* ─────────────────────────────── ad slot ───────────────────────────── */

.adslot {
  position: relative;
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: var(--bg-sunken);
}
.adslot__tag {
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ─────────────────────────────── alerts ────────────────────────────── */

.alert {
  margin: 0 0 14px;
  padding: 11px 13px;
  border-radius: var(--r-md);
  background: rgba(240, 106, 106, .12);
  border: 1px solid rgba(240, 106, 106, .35);
  color: #ffc9c9;
  font-size: .86rem;
}

.warn {
  margin: 14px 0 0;
  padding: 11px 13px;
  border-radius: var(--r-md);
  background: rgba(240, 181, 69, .1);
  border: 1px solid rgba(240, 181, 69, .3);
  color: #f6d79a;
  font-size: .82rem;
}

.fineprint {
  margin: 16px 0 0;
  text-align: center;
  font-size: .76rem;
  color: var(--ink-faint);
}

/* ─────────────────────────────── sheets ────────────────────────────── */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(4, 7, 12, .72);
  backdrop-filter: blur(3px);
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }

.sheet__panel {
  width: 100%;
  max-width: 480px;
  max-height: 92dvh;
  overflow-y: auto;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  animation: rise .22s cubic-bezier(.2, .8, .3, 1);
}
@keyframes rise { from { transform: translateY(18px); } }

@media (min-width: 560px) {
  .sheet { align-items: center; }
  .sheet__panel { border-radius: var(--r-lg); }
}
@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet__panel { animation: none; }
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.sheet__head h2 { margin: 0; font-size: 1.12rem; font-weight: 640; }
.sheet__actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

.steps { margin: 0 0 16px; padding-left: 1.25em; font-size: .9rem; }
.steps li { margin-bottom: 9px; }
.steps__note { display: block; font-size: .8rem; color: var(--ink-faint); }

.prose { margin: 0 0 12px; font-size: .9rem; color: var(--ink-dim); }

.qr {
  display: flex;
  justify-content: center;
  padding: 14px;
  background: #fff;          /* scanners want maximum contrast */
  border-radius: var(--r-md);
}
.qr img { display: block; width: 100%; max-width: 268px; height: auto; }

/* ─────────────────────────────── footer ────────────────────────────── */

.foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: .78rem;
  color: var(--ink-faint);
}
.foot__sep { opacity: .5; }

/* People who prefer light still get a readable page rather than a broken one,
   but the dark treatment is the intended look. */
@media (prefers-color-scheme: light) {
  :root { color-scheme: dark; }
}
