/* QRV node dashboard theme - mirrors qrvnet web/assets/style.css.
   Loaded after the upstream XLX layout.css; overrides the stock light skin
   without changing any of the table-rendering PHP. */
:root {
  --brand: #FF6A13;
  --ink: #0B0B0F;
  --on-brand: #0B0B0F;
  --surface: #141418;
  --surface-hi: #1E1E24;
  --surface-low: #101014;
  --amber: #FFB547;
  --rx: #3DDC97;
  --tx: #FF4D5E;
  --info: #6CB8FF;
  --dmr: #8F7CFF;
  --ysf: #38C6F4;
  --muted: #9A9AA2;
  --outline: #8E8E98;
  --outline-variant: #3A3A44;
  --text: #ECECF2;
  --bg: var(--ink);
  --shadow: 0 18px 48px rgba(0, 0, 0, .38);
  --radius-card: 18px;
  --radius-chip: 10px;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #F4F4F6;
  --surface: #ECECEF;
  --surface-hi: #E4E4E8;
  --surface-low: #F2F2F4;
  --text: #17171B;
  --muted: #6E6E76;
  --outline: #6E6E76;
  --outline-variant: #C8C8CE;
  --shadow: 0 18px 44px rgba(20, 20, 30, .10);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { line-height: 1.18; letter-spacing: -.025em; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; }
h2 { font-size: clamp(1.3rem, 2.4vw, 1.8rem); font-weight: 750; }
h3 { font-size: 1.1rem; font-weight: 700; }
.id-sep { color: var(--muted); font-weight: 500; }
p { margin: 0 0 1rem; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--brand); color: var(--on-brand); padding: .6rem 1rem; z-index: 100; }
.skip-link:focus { left: 1rem; top: 1rem; }

/* Banner / header */
#app-header {
  position: sticky; top: 0; z-index: 40; min-height: 80px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--outline-variant);
}
.faceplate { background: transparent; border-bottom: 0; }
.faceplate-row {
  max-width: 1600px; margin: 0 auto; min-height: 64px;
  display: flex; align-items: center; gap: .4rem; padding: .3rem 1rem;
  flex-wrap: nowrap;
}
.wordmark { display: flex; align-items: center; gap: .45rem; color: var(--text); flex: 0 0 auto; }
.wordmark:hover { text-decoration: none; }
.wordmark img { width: 40px; height: 40px; border-radius: 10px; }
.wordmark strong { font-size: .95rem; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.site-nav { display: flex; align-items: center; gap: 0; margin-left: .5rem; flex-wrap: nowrap; }
.nav-link {
  display: inline-flex; align-items: center; gap: .3rem;
  color: var(--muted); padding: .3rem .45rem; border-radius: var(--radius-chip);
  font-size: .78rem; font-weight: 650; white-space: nowrap;
}
.nav-link:hover, .nav-link.is-active { color: var(--text); background: var(--surface-hi); text-decoration: none; }
.nav-link.is-active { color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); }
.faceplate-tools { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.status-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  color: var(--rx); border: 1px solid color-mix(in srgb, var(--rx) 40%, transparent);
  background: color-mix(in srgb, var(--rx) 10%, transparent);
  border-radius: 999px; padding: .2rem .5rem; font-size: .66rem; font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dot, var(--rx)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--dot, var(--rx)) 14%, transparent); }
.theme-toggle {
  background: transparent; color: var(--muted); border: 1px solid var(--outline-variant);
  border-radius: var(--radius-chip); padding: .25rem .45rem; font-size: .74rem; cursor: pointer;
  line-height: 1;
}
.theme-toggle:hover { background: var(--surface-hi); color: var(--text); }
.nav-toggle { display: none; background: var(--surface-hi); color: var(--text); border: 1px solid var(--outline-variant); border-radius: var(--radius-chip); padding: .4rem .7rem; }
.nav-backdrop { display: none; }
.hamburger, .hamburger::before, .hamburger::after {
  display: block; width: 18px; height: 2px; border-radius: 2px; background: currentColor;
  transition: transform .2s ease, opacity .2s ease;
}
.hamburger { position: relative; }
.hamburger::before, .hamburger::after { content: ""; position: absolute; left: 0; }
.hamburger::before { top: -6px; }
.hamburger::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .hamburger { background: transparent; }
.nav-toggle[aria-expanded="true"] .hamburger::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .hamburger::after { transform: translateY(-6px) rotate(-45deg); }

/* Main / stat strip */
#main { max-width: 1400px; margin: 0 auto; padding: 1.75rem 1rem 2rem; }
.kicker { color: var(--brand); font-weight: 800; letter-spacing: .16em; text-transform: uppercase; font-size: .72rem; margin-bottom: .4rem; }
.lead { color: var(--muted); font-size: 1rem; max-width: 68ch; margin: 0 0 1.25rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; margin: 0 0 1.75rem; }
.stat { background: var(--surface); border: 1px solid var(--outline-variant); border-radius: var(--radius-card); padding: .9rem 1.05rem; }
.stat .num { display: block; font-size: 1.7rem; font-weight: 800; letter-spacing: -.04em; line-height: 1.2; }
.stat .label { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; }
#suptime { font-size: 1.05rem; text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stat.good .num { color: var(--rx); }
.stat.warn .num { color: var(--amber); }
.stat.bad .num { color: var(--tx); }
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin: 1.75rem 0 .8rem; }
.section-head h2 { margin: 0; }

/* Upstream tables, restyled */
#content { position: static; width: auto; min-width: 0; margin: 0; padding: 0; text-align: left; overflow-x: auto; }
#content > table[border="0"] { width: 100%; border: 0; margin: 0; }
.listingtable, .reflector-table {
  margin: .35rem 0 1.5rem;
  width: 100%;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-card);
  background: var(--surface);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  font-size: .88rem;
}
.listingtable .listingtable { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.listingtable th, .reflector-table th {
  background: var(--surface-hi);
  color: var(--brand);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .7rem .75rem;
  text-align: center;
  border-bottom: 1px solid var(--outline-variant);
}
.listingtable td, .reflector-table td {
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--outline-variant);
  color: var(--text);
  white-space: nowrap;
}
.listingtable tr:last-child td, .reflector-table tr:last-child td { border-bottom: 0; }
.listingtable tr, .listingtable tr[bgcolor] { background: var(--surface) !important; }
.listingtable tr:hover, .listingtable tr[bgcolor]:hover { background: var(--surface-hi) !important; }
.listingtable th .listingtable { background: transparent; }
.pl, .listinglink, .smalllink { color: var(--brand); text-decoration: none; }
.pl:hover, .listinglink:hover, .smalllink:hover { text-decoration: underline; }
.pl { font-size: inherit; }
.listinglink { font-size: inherit; }
.smalllink { font-size: .82rem; font-weight: 650; }
.error {
  background: color-mix(in srgb, var(--amber) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent);
  border-left: 3px solid var(--amber);
  border-radius: 12px;
  color: var(--text);
  padding: .8rem 1rem;
  margin: 0 0 1rem;
  width: auto;
  font-weight: 500;
}
.FilterField, .FilterSubmit {
  background: var(--surface-hi);
  color: var(--text);
  border: 1px solid var(--outline-variant);
  border-radius: 10px;
  padding: .45rem .7rem;
  height: auto;
  font: inherit;
  font-size: .85rem;
}
.FilterField { width: 170px; }
.FilterField:focus, .FilterSubmit:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.FilterSubmit { cursor: pointer; }
.FilterSubmit:hover { border-color: var(--brand); }
a.tip { text-decoration: none; }
a.tip:hover span {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--outline-variant);
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: .78rem;
  padding: .35rem .6rem;
  margin: 0;
}
.listingtable img[src$="up.png"] { filter: grayscale(1) sepia(1) hue-rotate(80deg) saturate(3) brightness(.95); }
.listingtable img[src$="down.png"] { filter: grayscale(1) sepia(1) hue-rotate(310deg) saturate(3) brightness(.95); }

/* QRV Directory page */
.qrv-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: .7rem;
  background: linear-gradient(100deg, color-mix(in srgb, var(--brand) 16%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent);
  border-radius: var(--radius-card);
  padding: .9rem 1.1rem;
  margin: 0 0 1.25rem;
}
.qrv-banner strong { color: var(--brand); letter-spacing: .06em; }
.qrv-banner .button { margin-left: auto; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: var(--brand); color: var(--on-brand); border: 1px solid var(--brand);
  border-radius: var(--radius-chip); padding: .5rem .85rem; font-weight: 750; cursor: pointer;
  font-size: .85rem;
}
.button:hover { filter: brightness(1.08); text-decoration: none; }
.button-quiet { background: var(--surface-hi); color: var(--text); border-color: var(--outline-variant); }
.pill {
  display: inline-flex; align-items: center; border-radius: var(--radius-chip);
  padding: .2rem .55rem; font-size: .72rem; font-weight: 750; letter-spacing: .02em;
  background: var(--surface-hi); color: var(--muted); border: 1px solid var(--outline-variant);
}
.pill-now { color: var(--rx); border-color: color-mix(in srgb, var(--rx) 40%, transparent); background: color-mix(in srgb, var(--rx) 10%, transparent); }
.pill-soon { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, transparent); }
.table-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 0 0 .8rem; }
.table-tools input { width: min(320px, 70vw); }
.reflector-name { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; font-weight: 650; }
.host-cell { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); font-size: .8rem; }
.details-toggle { background: var(--surface-hi); color: var(--brand); border: 1px solid var(--outline-variant); border-radius: 8px; padding: .25rem .55rem; font-size: .75rem; font-weight: 700; cursor: pointer; }
.details-toggle:hover { border-color: var(--brand); }
.details-toggle::marker { color: var(--brand); }
.detail-panel { padding: .6rem .2rem .2rem; }
.detail-section { color: var(--brand); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; margin: .4rem 0; }
.bridge-grid { display: grid; grid-template-columns: minmax(9rem, 12rem) minmax(0, 1fr); gap: .4rem 1rem; align-items: start; }
.bridge-row { display: contents; }
.bridge-label { color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding-top: .15rem; }
.bridge-value { font-size: .85rem; overflow-wrap: anywhere; }
.detail-line { font-family: var(--mono); font-size: .78rem; }

/* Upstream / check-in diagnostics */
.mono-cell { font-family: var(--mono); font-size: .8rem; }
.up-table { min-width: 860px; }
.up-table td { white-space: normal; vertical-align: top; }
.panel, .up-panel {
  background: var(--surface); border: 1px solid var(--outline-variant);
  border-radius: var(--radius-card); padding: 1.1rem 1.25rem; margin: 0 0 1.25rem;
}
.up-panel p:last-child { margin-bottom: 0; }
.panel .mono, .up-panel .mono { color: var(--brand); }
.detail-lines { display: flex; flex-direction: column; gap: .3rem; margin-top: .5rem; }
.xml-preview {
  margin: .75rem 0 0; padding: 1rem; overflow-x: auto;
  background: var(--surface-low); border: 1px solid var(--outline-variant);
  border-radius: 12px; color: var(--rx); font-family: var(--mono); font-size: .78rem;
  line-height: 1.6;
}

/* Footer */
.footer-inner {
  max-width: 1400px; margin: 0 auto; padding: 1.25rem 1rem 2rem;
  color: var(--muted); font-size: .8rem; border-top: 1px solid var(--outline-variant);
}
.footer-inner p { margin: 0 0 .4rem; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--brand); }

/* Mobile navigation */
@media (max-width: 1199px) {
  .faceplate-row { min-height: 64px; gap: .4rem; }
  .wordmark img { width: 36px; height: 36px; border-radius: 9px; }
  .faceplate-tools { display: none !important; }
  .nav-toggle {
    order: 3; margin-left: auto; position: relative; width: 42px; height: 42px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center; border-radius: 12px;
  }
  .site-nav {
    display: flex; flex-direction: column; align-items: stretch; gap: .25rem;
    position: fixed; top: 64px; left: 0; right: 0; z-index: 60;
    max-height: calc(100dvh - 64px); overflow-y: auto;
    margin: 0; padding: .8rem 1rem 1.2rem;
    background: var(--surface); border-bottom: 1px solid var(--outline-variant);
    border-radius: 0 0 20px 20px; box-shadow: var(--shadow);
    opacity: 0; transform: translateY(-12px); pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
  }
  .site-nav.is-open { opacity: 1; transform: none; pointer-events: auto; }
  .site-nav .nav-link { padding: .65rem .8rem; font-size: .9rem; border-radius: 12px; }
  .nav-divider { height: 1px; background: var(--outline-variant); margin: .6rem .2rem; }
  .nav-theme { width: 100%; text-align: left; justify-content: flex-start; }
  .nav-backdrop {
    display: block; position: fixed; inset: 64px 0 0; z-index: 50;
    background: rgba(4, 4, 8, .55); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  .nav-backdrop.is-open { opacity: 1; pointer-events: auto; }
  body.menu-open { overflow: hidden; }
}
@media (max-width: 760px) {
  #main { padding: 1.25rem .75rem 2rem; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .listingtable, .reflector-table { min-width: 640px; }
  .bridge-grid { grid-template-columns: 1fr; }
  .qrv-banner .button { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
