:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1d212b;
  --border: #272c38;
  --text: #e6e9ef;
  --muted: #8b93a7;
  --accent: #4f8cff;
  --green: #34d399;
  --gray: #4b5263;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.wm-my { color: #79c83f; }
.wm-pk { color: #4f9bff; }
.tagline { font-size: 11px; font-style: italic; color: var(--muted); }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 24px; padding: 12px 22px;
  background: var(--panel); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand .wordmark { font-weight: 800; font-size: 17px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 11px; border-radius: 7px; font-size: 13px; }
.nav a:hover { color: var(--text); background: var(--panel-2); }
.nav a.active { color: var(--text); background: var(--panel-2); }
.topright { display: flex; align-items: center; gap: 12px; }

.container { max-width: 1100px; margin: 24px auto; padding: 0 22px; }
.container.wide { max-width: 1500px; }   /* data-heavy table pages */
.container.legal { max-width: 760px; }   /* readable legal pages */
.legal-body { line-height: 1.7; }
.legal-body h2 { margin: 26px 0 8px; font-size: 16px; }
.legal-body ul { padding-left: 20px; }
.legal-body li { margin: 4px 0; }
.page-title { font-size: 20px; margin: 0 0 16px; }
.badge { display: inline-block; min-width: 20px; padding: 1px 8px; border-radius: 999px;
  background: var(--panel-2); color: var(--muted); font-size: 12px; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.card-n { font-size: 28px; font-weight: 800; }
.card-l { color: var(--muted); font-size: 13px; margin-top: 4px; }
/* A card that links into a drill-down report. */
a.card { display: block; text-decoration: none; color: var(--text); transition: border-color .12s ease, transform .12s ease; }
a.card:hover { border-color: var(--accent); transform: translateY(-1px); }
a.card .card-l::after { content: " →"; color: var(--accent); }

/* Panels + tables */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.panel.pad { padding: 18px; margin-bottom: 16px; }
.sub { font-size: 14px; margin: 0 0 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; white-space: nowrap; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tbody tr { border-top: 1px solid var(--border); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 6px; background: var(--panel-2); font-size: 12px; text-transform: capitalize; }
a.pill { text-decoration: none; color: inherit; }
a.pill:hover { background: var(--border); }
.pill-on { background: var(--accent, #4285f4); color: #fff; }
.setup-steps { margin: 8px 0; padding-left: 20px; line-height: 1.7; }
.setup-steps li { margin-bottom: 6px; }
.setup-video { margin: 14px 0; }
.video-soon { display: flex; align-items: center; justify-content: center; height: 160px; border: 1px dashed var(--border); border-radius: 10px; background: var(--panel-2); font-size: 14px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--gray); }
.dot.online { background: var(--green); box-shadow: 0 0 0 3px rgba(52,211,153,.15); }
.dot.stale { background: #f5a623; box-shadow: 0 0 0 3px rgba(245,166,35,.15); }
.dot.offline { background: #ff5b5b; box-shadow: 0 0 0 3px rgba(255,91,91,.12); }

.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 7px; padding: 5px 11px; cursor: pointer; font-size: 12px; text-decoration: none; }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }
.btn-primary { display: inline-block; padding: 11px 20px; border-radius: 9px; text-decoration: none;
  background: linear-gradient(135deg, #4f9bff, #2f7fd1); color: #fff; font-weight: 700; }
.ok { color: var(--green); }
.warn { color: #f0b34d; }
.btn { display: inline-block; padding: 10px 18px; border-radius: 9px; text-decoration: none; cursor: pointer;
  background: linear-gradient(135deg, #4f9bff, #2f7fd1); color: #fff; font-weight: 700; border: 0; }
.btn:hover { filter: brightness(1.07); }
.btn-inline { font-weight: 700; text-decoration: none; color: #f0b34d; }
.toggle { background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 20px; padding: 4px 12px; cursor: pointer; font-size: 12px; white-space: nowrap; }
.toggle:hover { border-color: var(--muted); color: var(--text); }
.toggle-on { background: rgba(52,211,153,.15); border-color: var(--green); color: var(--green); }
.locked-report { text-align: center; }
.locked-report .btn { margin-top: 8px; }
.foot { text-align: center; padding: 24px; font-size: 12px; }

/* --- Pricing page --- */
.pricing-wrap { max-width: 1040px; margin: 0 auto; padding: 8px 16px 40px; }
.pricing-head { text-align: center; margin: 12px 0 26px; }
.pricing-head h1 { font-size: 28px; margin: 0 0 10px; }
.pricing-head .lead { max-width: 640px; margin: 0 auto 18px; }
.bill-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 24px; padding: 3px; gap: 3px; }
.bt-opt { background: transparent; border: 0; color: var(--muted); border-radius: 20px; padding: 7px 16px; cursor: pointer; font-size: 13px; font-weight: 600; }
.bt-on { background: linear-gradient(135deg, #4f9bff, #2f7fd1); color: #fff; }
.pricing-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: start; }
.pcard { position: relative; border: 1px solid var(--border); border-radius: 14px; padding: 22px; background: var(--panel); }
.pcard-featured { border-color: #4f9bff; box-shadow: 0 0 0 1px #4f9bff, 0 10px 30px rgba(79,155,255,.12); }
.pcard-badge { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); background: linear-gradient(135deg, #4f9bff, #2f7fd1); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 4px 12px; border-radius: 20px; white-space: nowrap; }
.pcard-name { font-size: 18px; margin: 4px 0 6px; }
.pcard-blurb { color: var(--muted); font-size: 13px; min-height: 38px; margin: 0 0 12px; }
.pcard-price .amt { font-size: 30px; font-weight: 800; }
.pcard-price .per { color: var(--muted); font-size: 14px; }
.pcard-sub { color: var(--muted); font-size: 12px; min-height: 18px; margin: 2px 0 16px; }
.pcard-cta { display: block; text-align: center; margin-bottom: 16px; }
.pcard-feats { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.pcard-feats li { padding: 5px 0 5px 22px; position: relative; color: var(--text); }
.pcard-feats li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 700; }
.pricing-note { max-width: 720px; margin: 22px auto; font-size: 12px; text-align: center; }
.pricing-h2 { text-align: center; font-size: 20px; margin: 34px 0 16px; }
table.compare { width: 100%; border-collapse: collapse; font-size: 13px; }
table.compare th, table.compare td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: center; }
table.compare th:first-child, table.compare td:first-child { text-align: left; }
.faq { max-width: 760px; margin: 0 auto; }
.faq-item { border-bottom: 1px solid var(--border); padding: 12px 0; }
.faq-item summary { cursor: pointer; font-weight: 600; }
.faq-item p { margin: 8px 0 0; }
/* Monthly/annual toggle visibility */
.pricing-wrap[data-period="monthly"] .price-annual { display: none; }
.pricing-wrap[data-period="annual"] .price-monthly { display: none; }
@media (max-width: 820px) { .pricing-cards { grid-template-columns: 1fr; max-width: 420px; margin: 0 auto; } }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; }
table.kv { width: 100%; border-collapse: collapse; }
table.kv td { padding: 7px 8px; border-bottom: 1px solid var(--border); font-size: 14px; }
table.kv td:first-child { width: 40%; }

/* Forms */
.form-narrow { display: flex; flex-direction: column; gap: 12px; max-width: 360px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.hint { color: var(--gray); font-size: 11px; }
input { background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: 11px 12px; color: var(--text); font-size: 14px; }
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,140,255,.18); }
button { padding: 11px 14px; border: 0; border-radius: 9px; background: linear-gradient(135deg, #4f9bff, #2f7fd1); color: #fff; font-weight: 700; font-size: 14px; cursor: pointer; }

/* Landing */
.landing { display: grid; place-items: center; min-height: 100vh; text-align: center;
  background: radial-gradient(1200px 600px at 50% -10%, #1a2230, var(--bg)); }
.hero { padding: 24px; max-width: 560px; }
.hero h1 { font-size: 40px; font-weight: 800; margin: 14px 0 2px; }
.hero .lead { color: var(--muted); margin: 18px 0 24px; }

/* Auth pages */
.auth-body { display: grid; place-items: center; min-height: 100vh; margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #1a2230, var(--bg)); }
.auth-card { width: 100%; max-width: 380px; margin: 24px; padding: 28px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0,0,0,.45); display: flex; flex-direction: column; gap: 14px; }
.auth-brand { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 6px; }
.auth-brand h1 { font-size: 22px; font-weight: 800; margin: 6px 0 0; }
.auth-title { text-align: center; font-size: 15px; color: var(--muted); font-weight: 500; margin: 0; }
.auth-error { background: rgba(248,113,113,.12); border: 1px solid rgba(248,113,113,.4);
  color: #fca5a5; padding: 9px 12px; border-radius: 8px; font-size: 13px; margin: 0; }

/* --- Admin console --- */
.keybox { display: inline-block; user-select: all; padding: 10px 14px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px;
  font-size: 15px; letter-spacing: .5px; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form-row label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.form-row input { min-width: 90px; }
.form-row input[name="customer"] { min-width: 200px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 3px 0; }
.inline-form button, .inline-form input { padding: 7px 10px; font-size: 13px; font-weight: 600; }
.node-manage { white-space: nowrap; }
.node-manage .inline-form { display: flex; }
button.danger, .btn-ghost.danger { color: #ff8a8a; border-color: #5a2f2f; }
button.danger:hover, .btn-ghost.danger:hover { color: #fff; background: #7a2b2b; border-color: #7a2b2b; }

/* Wide tables scroll instead of clipping; compact node-manage column */
.node-manage { min-width: 210px; }
.node-manage .inline-form { display: flex; margin-bottom: 4px; }
.node-manage input[type="url"] { width: 150px; }

/* Tighter node-manage column so the table fits; panel scrolls if still wide */
.node-manage { min-width: 150px; }
.node-manage input[type="url"] { width: 112px; }
.node-manage .inline-form { gap: 4px; margin-bottom: 4px; }
.node-manage .inline-form button, .node-manage .inline-form input { padding: 5px 8px; font-size: 12px; font-weight: 600; }

/* Reliable horizontal scroll for wide data tables */
.table-scroll { overflow-x: auto; max-width: 100%; }

/* Node public URL shown under the name — truncate so it can't widen the column */
.node-url { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* Node links column: stack Open / Blocked sites compactly */
.node-links { white-space: nowrap; }
.node-links a { display: inline-block; margin: 0 4px 4px 0; }

/* Node manage column: compact so the table fits; table scrolls on narrow screens */
.node-manage { min-width: 0; white-space: nowrap; }
.node-manage input[type="url"] { width: 76px; }
.node-manage .inline-form { display: flex; gap: 4px; margin-bottom: 4px; }
.node-manage .inline-form button, .node-manage .inline-form input { padding: 3px 6px; font-size: 11px; font-weight: 600; }
.table-scroll table { min-width: 100%; width: max-content; }

/* Report filter bar + pagination */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 14px; }
.filters select, .filters input[type="search"] {
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 6px 10px; font: inherit; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 14px; }

/* Dashboard activity charts (server-rendered inline SVG + bars) */
.chart-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.chart-title .legend { text-transform: none; letter-spacing: 0; font-size: 12px; }
.volume-chart { width: 100%; height: 110px; display: block; }
.area-q { fill: rgba(79, 140, 255, 0.20); stroke: none; }
.line-q { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-x { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 4px; }
.chart-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 56px; align-items: center; gap: 10px; font-size: 12px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: capitalize; }
.bar-track { background: var(--bg); border: 1px solid var(--border); border-radius: 5px; height: 12px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); }
.bar-val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Bulk-select checkbox column */
.chk { width: 30px; text-align: center; }
.chk input { cursor: pointer; }

/* Social login */
.oauth-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0 10px; }
.oauth-sep::before, .oauth-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.oauth-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  background: #fff; color: #202124; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px; font-weight: 600; text-decoration: none; }
.oauth-btn:hover { background: #f1f3f4; }
.oauth-g { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
  border-radius: 3px; background: #fff; color: #4285f4; font-weight: 800; font-family: Arial, sans-serif; }
.oauth-btn + .oauth-btn { margin-top: 8px; }
.oauth-apple { background: #000; color: #fff; border-color: #000; }
.oauth-apple:hover { background: #1a1a1a; }
.oauth-a { display: inline-block; width: 15px; height: 18px; background: currentColor;
  -webkit-mask: no-repeat center/contain; mask: no-repeat center/contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 384 512'%3E%3Cpath d='M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 384 512'%3E%3Cpath d='M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z'/%3E%3C/svg%3E"); }
@media (max-width: 720px) { .chart-cols { grid-template-columns: 1fr; } }

/* --- App detection chips (apps inferred from a device's DNS) --- */
.app-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.app-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--panel-2); font-size: 13px; }
.app-chip .app-cat { color: var(--muted); font-size: 11px; text-transform: capitalize; }

/* --- Device alerts (consumer dashboard) ---------------------------------- */
/* Shown on every plan: the email_alerts entitlement gates the push, never the
   visibility. Someone whose device was just bypassed has to be able to find that
   out regardless of tier. */
.dev-alerts { border-color: rgba(248,113,113,0.35); }
.card.card-alert { border-color: rgba(248,113,113,0.35); }
.card.card-alert .card-n { color: #fca5a5; }
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.alert-row:first-child { border-top: 0; }
.alert-row .ai { flex: 0 0 auto; line-height: 1.4; }
.alert-row .ab { flex: 1 1 auto; min-width: 0; }
/* Amber vs red is a real distinction, not decoration: critical means we KNOW the
   device is bypassed; warn means we can no longer vouch for it. Don't flatten. */
.alert-row.crit > .ab > strong { color: #fca5a5; }
.alert-row.warn > .ab > strong { color: #fcd34d; }
