/* ============================================================
   SD RMM stylesheet — matches Tower / LLM Chat product chrome
   (deep slate, restrained accents, trust-led typography).
   ============================================================ */

/* Self-hosted brand faces. rmm.sd-techsolutions.com is its own vhost proxied to
   the app on :8087, so it cannot borrow the main site's /assets/fonts/ -- the
   same two woff2 files are copied into /opt/rmm/static/fonts/ instead. */
@font-face{
  font-family:"Inter";font-style:normal;font-weight:100 900;font-display:swap;
  src:url(/static/fonts/inter-var.woff2) format("woff2");
}
@font-face{
  font-family:"JetBrains Mono";font-style:normal;font-weight:100 800;font-display:swap;
  src:url(/static/fonts/jetbrains-mono-var.woff2) format("woff2");
}

/* 2026-08-10: surface ramp re-aligned from the console's own GREEN-tinted greys
   to the sd-techsolutions.com COOL blue-grey ramp, so the console reads as the
   same product as the website. Values lifted verbatim from site.css :root.
   The accent green (#1db74a) and the 10/14px radii were already shared.
   Semantic status colours (ok/warn/bad/info) are untouched -- operators read
   those by colour and re-hueing them would be an actual regression. */
:root {
  --bg:        #0f1217;
  --surface:   #181d25;
  --surface-2: #1d232d;
  --surface-3: #232a36;
  --line:      rgba(255, 255, 255, .09);
  --line-soft: rgba(255, 255, 255, .06);
  --ink:       #e8ecef;
  --ink-2:     #c8cfd8;
  --muted:     #8b95a2;
  --muted-2:   #6b7480;
  --accent:    #1db74a;
  --accent-soft: rgba(29, 183, 74, .14);
  --accent-ring: rgba(29, 183, 74, .35);
  --accent-ink: #08120b;
  --ok:   #4ade80;
  --warn: #fbbf24;
  --bad:  #f97373;
  --info: #60a5fa;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-1: 0 1px 2px rgba(0,0,0,.32);
  --shadow-2: 0 8px 24px rgba(0,0,0,.28);
  --header-h: 56px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font: 14.5px/1.55 var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .copy-code {
  font-family: var(--font-mono);
  font-size: .89em;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  word-break: break-all;
}
.copy-code { user-select: all; cursor: text; }

/* ---------- App bar ---------- */
.appbar {
  display: flex; align-items: center; gap: 18px;
  height: var(--header-h);
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--ink); font-weight: 700; font-size: 16px;
  text-decoration: none;
}
/* 2026-08-10: the console showed a ">_" glyph while the website leads with the
   Node-Shield mark. Swapped to the real mark here in CSS rather than in the two
   templates that print it, so it stays a one-file change. font-size:0 collapses
   the literal ">_" text node; background-size is a PERCENTAGE so the same rule
   scales for both the 28px header mark and the 40px auth-card mark. */
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: center/68% no-repeat url(/static/img/logo-mark.svg), var(--surface-2);
  border: 1px solid var(--line);
  color: transparent;
  font-family: var(--font-mono); font-weight: 700; font-size: 0;
}
.brand-text { display: inline-flex; flex-direction: column; line-height: 1.08; }
.brand-name { letter-spacing: .2px; font-size: 15px; }
.brand-sub {
  font-size: 9px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase;
  color: var(--muted); margin-top: 1px;
}
.appnav { display: flex; gap: 2px; flex-wrap: wrap; }
.appnav a {
  padding: 6px 9px; border-radius: 8px; white-space: nowrap;
  color: var(--muted); font-weight: 500; font-size: 13px;
}
.appnav a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.appnav a.is-active { color: var(--ink); background: var(--surface-2); }
.appbar-spacer { flex: 1; }
.appbar-user {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
}
.user-email { color: var(--muted); }

/* ---------- Layout ---------- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 18px 80px;
}
.page-title { font-family: var(--font-mono); font-size: 20px; font-weight: 700; margin: 0 0 18px; letter-spacing: -.2px; }
.section-title { font-size: 15px; font-weight: 600; margin: 28px 0 12px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .6px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 24px; }
.page-header .crumb { color: var(--muted); margin: 0 0 4px; font-size: 12px; }
.page-header h1 { margin: 0; }

/* ---------- Buttons + inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font: 600 13.5px/1 var(--font-sans);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
  text-decoration: none;
}
.btn-primary {
  transition: background .15s ease, box-shadow .18s ease, border-color .15s ease;
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}
/* 2026-08-10: was #d22936 -- a RED left over from an older theme, so the green
   primary button flipped to red on hover. Now uses the site's --accent-strong
   (#2bd45e) plus the same bloom the website's primary CTA has. */
.btn-primary:hover { background: #2bd45e; border-color: #2bd45e; text-decoration: none;
  box-shadow: 0 6px 20px rgba(29, 183, 74, .30); }
.btn-ghost {
  background: transparent; color: var(--ink-2); border-color: var(--line);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.btn-danger {
  background: transparent; color: var(--bad); border-color: rgba(249,115,115,.4);
}
.btn-danger:hover { background: rgba(249,115,115,.12); text-decoration: none; }
.link { background: none; border: 0; color: var(--info); cursor: pointer; padding: 0; font: inherit; }
.link:hover { text-decoration: underline; }
.inline { display: inline; }

.form { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }
.form input[type="text"], .form input[type="email"], .form input[type="password"],
.form select {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: 14.5px var(--font-sans);
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.form input:focus, .form select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.form-inline {
  flex-direction: row; flex-wrap: wrap; align-items: center;
  gap: 8px; margin-top: 14px;
}
.form-inline input, .form-inline select { flex: 1 1 180px; }
.inline-check {
  display: inline-flex; gap: 6px; align-items: center;
  font-size: 13px; color: var(--muted);
}

/* ---------- Auth pages ---------- */
/* 2026-08-10: added flex-direction:column. On the login page base.html renders
   <main> and <footer> as direct children of body.auth-page, so a ROW flex put
   the global footer beside the sign-in card instead of under it -- the card
   read as off-centre and the footer floated in empty space to the right. */
.auth-page {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100dvh; padding: 24px;
  background: radial-gradient(circle at top, #181c25, var(--bg));
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--shadow-2);
}
.auth-card--wide { max-width: 460px; }
.auth-head { text-align: center; margin-bottom: 14px; }
.auth-head .brand-mark { margin: 0 auto 10px; width: 40px; height: 40px; font-size: 18px; }
.auth-head h1 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.auth-head .sub { margin: 0; color: var(--muted); font-size: 13.5px; }
.auth-foot { text-align: center; margin: 18px 0 0; color: var(--muted); font-size: 12.5px; }
.qr-wrap {
  display: flex; justify-content: center;
  margin: 14px 0;
  background: #fff;
  border-radius: 12px;
  padding: 12px;
}
.qr-wrap svg { width: 220px; height: 220px; display: block; }
details.muted { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
details.muted summary { cursor: pointer; }
details.muted .copy-code { display: inline-block; margin-top: 8px; font-size: 13px; }

/* ---------- Alerts ---------- */
.alert {
  padding: 10px 12px; border-radius: 8px; margin-bottom: 14px;
  font-size: 13.5px;
}
.alert-error { background: rgba(249,115,115,.1); border: 1px solid rgba(249,115,115,.4); color: var(--bad); }
.alert-info  { background: rgba(96,165,250,.1); border: 1px solid rgba(96,165,250,.4); color: var(--info); }
.alert-ok    { background: rgba(74,222,128,.1); border: 1px solid rgba(74,222,128,.4); color: var(--ok); }

/* ---------- Pills + dots ---------- */
.pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font: 600 11px/1.4 var(--font-sans); letter-spacing: .3px; text-transform: uppercase;
}
.pill-ok    { background: rgba(74,222,128,.16);  color: var(--ok); }
.pill-warn  { background: rgba(251,191,36,.16);  color: var(--warn); }
.pill-bad   { background: rgba(249,115,115,.16); color: var(--bad); }
.pill-super { background: var(--accent-soft);    color: var(--accent); }
.dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle;
}
.dot-ok  { background: var(--ok); }
.dot-off { background: var(--muted-2); }

/* ---------- Tables ---------- */
.datatable {
  width: 100%; border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.datatable th, .datatable td {
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px; vertical-align: middle;
}
.datatable th {
  background: var(--surface-2);
  color: var(--muted); text-transform: uppercase;
  font: 600 11px/1.5 var(--font-sans); letter-spacing: .5px;
}
.datatable tbody tr:last-child td { border-bottom: 0; }
.datatable tbody tr:hover { background: rgba(255,255,255,.02); }

/* ---------- Card sections (admin pages) ---------- */
.card-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 22px;
}
.card-section > header h2 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }

/* ---------- Empty state ---------- */
.empty {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

/* ---------- Stat cards (agent detail) ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 14px 0 4px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-label { font: 600 11px/1.4 var(--font-sans); color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.stat-val   { font: 700 26px/1 var(--font-sans); }
.stat-val small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.stat-sub   { font-size: 12px; color: var(--muted); }
@media (max-width: 640px) { .stat-row { grid-template-columns: 1fr; } }

/* ---------- Chart ---------- */
.chart-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 14px;
}
.chart-card canvas { width: 100%; display: block; }
.legend { display: flex; gap: 16px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.legend .dot { display: inline-block; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line-soft);
  padding: 14px 18px;
  font-size: 12.5px; color: var(--muted-2);
  text-align: center;
}
.footer code { background: transparent; }
.muted { color: var(--muted); }

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .appbar { padding: 0 12px; gap: 10px; }
  .brand-text { display: none; }
  .appbar-user .user-email { display: none; }
  .container { padding: 18px 12px 60px; }
  .page-header { flex-direction: column; align-items: stretch; gap: 8px; }
  .form-inline { flex-direction: column; align-items: stretch; }
  .form-inline input, .form-inline select { flex: 1 1 auto; }
  .datatable th, .datatable td { padding: 8px 10px; font-size: 12.5px; }
}


/* ---------- Left rail (2026-07 redesign: 17 tabs -> 6 grouped sections) ---------- */
:root { --rail-w: 216px; }
.layout { display: flex; align-items: stretch; min-height: calc(100vh - var(--header-h)); }
.rail {
  width: var(--rail-w); flex: none;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 16px 10px 28px;
  position: sticky; top: 0;
  max-height: 100vh; overflow-y: auto;
}
.rail-group { margin-bottom: 16px; }
.rail-label {
  font: 600 10px var(--font-mono); text-transform: uppercase; letter-spacing: 1.6px;
  color: var(--muted-2); padding: 0 9px 6px;
}
.rail-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 9px; border-radius: 7px;
  color: var(--muted); font-weight: 500; font-size: 13px; text-decoration: none;
}
.rail-link:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.rail-link.on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content .container { width: 100%; }
.content .footer { margin-top: auto; }
.rail-toggle {
  display: none; background: none; border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); font-size: 16px; padding: 4px 10px; cursor: pointer;
}
.rail-backdrop { display: none; }
@media (max-width: 900px) {
  .rail-toggle { display: inline-flex; }
  .rail {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    max-height: none; transform: translateX(-105%);
    transition: transform .18s ease; box-shadow: var(--shadow-2);
  }
  @media (prefers-reduced-motion: reduce) { .rail { transition: none; } }
  body.rail-open .rail { transform: translateX(0); }
  body.rail-open .rail-backdrop {
    display: block; position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.5);
  }
}

/* ============================================================
   My Products mega-menu (Sophos Central-style IA, SD chrome)
   + product-page chrome — added 2026-07-15
   ============================================================ */
.prodnav { position: relative; margin-left: 14px; }
.prodnav-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  color: var(--ink-2); font: 600 13px/1 var(--font-sans);
  padding: 8px 12px; cursor: pointer;
}
.prodnav-btn:hover { background: var(--surface-2); border-color: var(--line); }
.prodnav-btn[aria-expanded="true"] { background: var(--surface-2); border-color: var(--accent-ring); color: var(--ink); }
.prodnav-btn .caret { font-size: 10px; color: var(--muted); }
.prodmenu {
  position: absolute; top: calc(100% + 10px); left: 0; z-index: 90;
  display: flex; gap: 4px; padding: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 18px 50px rgba(0,0,0,.55);
  min-width: 480px;
}
.prodmenu-col { min-width: 225px; }
.prodmenu-head {
  font: 700 10px/1 var(--font-sans); text-transform: uppercase; letter-spacing: .7px;
  color: var(--muted); margin: 12px 10px 7px;
}
.prodmenu-col > .prodmenu-head:first-child { margin-top: 2px; }
.prodmenu-col a {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 8px;
  color: var(--ink-2); text-decoration: none; font-size: 13.5px;
}
.prodmenu-col a:hover { background: var(--accent-soft); color: var(--ink); }
.pm-tag {
  margin-left: auto; font: 700 9.5px/1.6 var(--font-sans); text-transform: uppercase;
  letter-spacing: .5px; padding: 1px 7px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.pm-tag.soon { background: var(--surface-3); color: var(--muted); }
@media (max-width: 760px) {
  .prodnav { display: none; }  /* mobile keeps the rail as the nav */
}

/* ---- appbar overflow fix (2026-07-15b): the My Products entry pushed the
   user block off-screen on narrower windows; let the email shrink instead ---- */
.appbar { min-width: 0; }
.appbar .brand, .appbar .prodnav, .appbar .rail-toggle { flex: none; }
.appbar-user { min-width: 0; flex-shrink: 1; }
.appbar-user .user-email {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 240px; display: inline-block; vertical-align: middle;
}
@media (max-width: 1150px) { .appbar-user .user-email { display: none; } }
.prodmenu { max-width: calc(100vw - 24px); flex-wrap: wrap; }

/* 20260715c: the hidden attribute loses to `.prodmenu{display:flex}` (author
   display beats the UA [hidden] rule) — the menu rendered permanently open.
   Honor it explicitly. */
.prodmenu[hidden] { display: none; }

/* ===== BEGIN 2026-08-16 console polish layer (append-only; revert = delete this block) ===== */

/* Desktop: fill a demo monitor instead of a 1100px column on a data-dense console */
.container { max-width: 1360px; }

/* --- Canonical data tables ---------------------------------------------------
   The flagship pages (dashboard/security/computers/inventory/email) each ship a
   bespoke table at drifting values. Promote them ALL to the polished .datatable
   look via higher specificity (.content table.X = 0,2,0 beats a page's
   table.X = 0,0,1), so no per-page edit is needed. Structure untouched — only
   header treatment, density, borders, and hover. */
.content table.assets, .content table.feed, .content table.cp, .content table.iv,
.content table.q, .content table.dh, .content table.qz, .content table.sw {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden;
  font-size: 13.5px;
}
.content table.assets th, .content table.feed th, .content table.cp th,
.content table.iv th, .content table.q th, .content table.dh th,
.content table.qz th, .content table.sw th {
  padding: 10px 14px; text-align: left; background: var(--surface-2);
  color: var(--muted); text-transform: uppercase;
  font: 600 11px/1.5 var(--font-sans); letter-spacing: .5px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.content table.assets td, .content table.feed td, .content table.cp td,
.content table.iv td, .content table.q td, .content table.dh td,
.content table.qz td, .content table.sw td {
  padding: 10px 14px; text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--line-soft); font-size: 13.5px;
}
.content table.assets tbody tr:last-child td, .content table.feed tbody tr:last-child td,
.content table.cp tbody tr:last-child td, .content table.iv tbody tr:last-child td,
.content table.q tbody tr:last-child td, .content table.dh tbody tr:last-child td,
.content table.qz tbody tr:last-child td, .content table.sw tbody tr:last-child td { border-bottom: 0; }
.content table.assets tbody tr:hover, .content table.feed tbody tr:hover,
.content table.cp tbody tr:hover, .content table.iv tbody tr:hover,
.content table.q tbody tr:hover, .content table.dh tbody tr:hover,
.content table.qz tbody tr:hover, .content table.sw tbody tr:hover { background: rgba(255,255,255,.025); }

/* Let the DESIGNED dashed empty-state show on demo pages (beats a bare per-page override) */
.content .empty {
  background: var(--surface); border: 1px dashed var(--line);
  border-radius: var(--r-md); padding: 30px 28px; text-align: center; color: var(--muted);
}

/* --- Login page: a real first impression -------------------------------------- */
.auth-head .auth-mark { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 13px; font-size: 0; }
.auth-head h1 { font-size: 23px; font-weight: 700; letter-spacing: -.2px; }
.auth-edr { color: var(--accent); font-weight: 700; }
.auth-org { margin: 2px 0 0; font-size: 10.5px; font-weight: 700; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--muted-2); }
.auth-head .sub { margin-top: 9px; }
.auth-trust { display: flex; align-items: center; justify-content: center; gap: 9px;
  margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.auth-trust span { font-size: 11px; color: var(--muted); letter-spacing: .2px; }
.auth-trust i { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); display: inline-block; }

/* --- Mobile: contain wide tables (they were CLIPPING columns on phones) ------- */
@media (max-width: 820px) {
  .content .wrapt, .content .qz-wrap, .content .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .content table.cp, .content table.dh, .content table.qz { min-width: 760px; }
  .content table.iv, .content table.assets, .content table.feed, .content table.q { min-width: 640px; }
}
/* Mobile: 44px touch targets (the console chrome sat at 28–34px) */
@media (max-width: 900px) {
  .rail-toggle { min-height: 44px; min-width: 44px; padding: 9px 12px; }
  .rail-link { padding: 11px 12px; }
  .appicons .ic { width: 40px; height: 40px; }
  .btn { min-height: 40px; }
}
/* ===== END 2026-08-16 console polish layer ===== */
