/* ============================================================
   QLine IT — shared dashboard branding
   Served at /static/qline-brand.css by server.js.

   Link this from any view and add the .qbrand header block, and the
   dashboard is branded. New dashboards inherit it for free.

   Deliberately does NOT touch the KPI / band / status colours. On these
   wall monitors red means flagged and amber means mismatched — repainting
   those in brand colours would destroy the meaning people read at a glance.
   ============================================================ */

:root {
  --q-teal: #058181;          /* exact brand */
  --q-orange: #F08100;        /* exact brand */
  --q-on-orange: #0b0b0b;     /* white on orange is 2.68:1 and fails; this is 7.35:1 */
  --q-on-teal: #ffffff;       /* 4.7:1, matches the logo lockup */
  --q-teal-bright: #0FA3A2;   /* validated step for marks on a dark surface */
  --q-link: #4fc9c8;
}

/* ---- brand bar -------------------------------------------------------
   The page templates put 24px padding on <body>, so the bar pulls itself
   back out to sit full-bleed. If a future view uses different padding,
   override --q-bleed on that page. */
.qbrand {
  --q-bleed: 24px;
  background: var(--q-teal);
  margin: calc(var(--q-bleed) * -1) calc(var(--q-bleed) * -1) 18px;
  padding: 11px var(--q-bleed);
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: nowrap;
}
.qbrand img.qlogo {
  height: 38px;
  width: auto;
  display: block;
  flex: none;
}
.qbrand .qtitles { min-width: 0; }
.qbrand .qtitle {
  color: var(--q-on-teal);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.qbrand .qsub {
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qbrand .qspacer { flex: 1; }

/* The status stamp keeps its own .sub class because the page JavaScript
   reassigns className ('sub' / 'sub err') on every refresh — styling it by
   that class means the script can keep doing exactly what it already does. */
.qbrand .qright,
.qbrand #stamp.sub {
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
  margin-top: 0;
}
.qbrand .qright.err,
.qbrand #stamp.sub.err { color: #ffd7d7; font-weight: 600; }
.qbrand a {
  color: var(--q-on-teal);
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  padding: 6px 12px;
}
.qbrand a:hover { background: rgba(255, 255, 255, 0.16); text-decoration: none; }

/* The strapline is the first thing to give way when space is tight —
   it's the least useful element in the bar. */
@media (max-width: 1100px) { .qbrand .qsub { display: none; } }
@media (max-width: 820px)  { .qbrand .qright { display: none; } }

/* ---- brand accents on existing components ---------------------------- */

/* Selected tab on the billing view (was #2563eb). */
.tab.on {
  background: var(--q-teal) !important;
  border-color: var(--q-teal) !important;
  color: var(--q-on-teal) !important;
}

/* Body links, e.g. the daily-report list (was #38bdf8). */
a { color: var(--q-link); }

/* Primary action — login. Dark ink on orange, never white. */
button.qprimary,
#login button {
  background: var(--q-orange) !important;
  color: var(--q-on-orange) !important;
  font-weight: 700 !important;
}
#login button:hover { filter: brightness(1.08); }

/* Focus ring, so keyboard users get a brand-coloured cue that still shows
   against the dark slate background. */
:focus-visible {
  outline: 2px solid var(--q-teal-bright);
  outline-offset: 2px;
}

/* ---- login page -------------------------------------------------------
   No body padding there, so the logo sits above the card rather than in a
   full-bleed bar. */
.qlogin-logo {
  display: block;
  margin: 0 auto 18px;
  height: 54px;
  width: auto;
  border-radius: 8px;
}

/* ============================================================
   LIGHT THEME
   ------------------------------------------------------------
   The views were built dark (slate #0f172a). Rather than rewrite four
   files, this section overrides them from here — it loads after each
   page's inline <style>, so equal-specificity rules win on order alone
   and !important is needed only where a colour is set in a style=""
   attribute by the page's own JavaScript.

   The saturated KPI, band and token colours are left exactly as they
   are: they're dark fills with white text, which read correctly on a
   light page, and they carry meaning people scan for.
   ============================================================ */

:root {
  --q-page: #f9f9f7;
  --q-surface: #ffffff;
  --q-ink: #0b0b0b;
  --q-ink-2: #52514e;
  --q-muted: #6f6d68;
  --q-line: #e1e0d9;
  --q-line-soft: #eceae3;
  --q-red: #b3261e;      /* readable on white, unlike the dark theme's #f87171 */
  --q-amber: #8a5a00;
  --q-violet: #5b3fb5;
  /* The link colour declared further up is stepped for a dark surface and
     measures under 2:1 on white. This is the light-surface step. */
  --q-link: #046b6b;

  /* The views' own tokens, repointed. */
  --bg: #f9f9f7;
  --card: #ffffff;
  --ink: #0b0b0b;
  --muted: #52514e;
  --line: #e1e0d9;
}

body {
  background: var(--q-page);
  color: var(--q-ink);
}

/* --- shared bits --- */
.sub { color: var(--q-ink-2); }
.legend { color: var(--q-ink-2); }
.muted { color: var(--q-muted); }
.panel {
  background: var(--q-surface);
  border: 1px solid var(--q-line);
}
table th { background: var(--q-page); color: var(--q-ink-2); }
td { border-bottom: 1px solid var(--q-line-soft); }
.val { color: var(--q-ink); }
.n { color: var(--q-ink-2); }
tr.hd td { color: var(--q-ink-2); border-bottom: 1px solid var(--q-line); }

/* --- billing view --- */
th { border-bottom: 1px solid var(--q-line); }
tr.client td {
  background: #f2f1ec;
  border-top: 2px solid var(--q-line);
  border-bottom: 1px solid var(--q-line);
  color: var(--q-ink);
}
tr.client .pill { background: #fbe3e1; color: var(--q-red); }
td.item { color: var(--q-ink); }
.na { color: #b5b3ac; }
tr.bad { background: rgba(179, 38, 30, 0.055); }
tr.bad td.num { color: var(--q-red); }
tr.bad td.item { color: var(--q-red); }
#stamp.err { color: var(--q-red); }
.tab {
  background: var(--q-surface);
  border: 1px solid var(--q-line);
  color: var(--q-ink);
}
#search {
  background: var(--q-surface);
  border: 1px solid var(--q-line);
  color: var(--q-ink);
}
#search::placeholder { color: var(--q-muted); }

/* Panels the billing script builds inline. The background and border come
   from var(--card)/var(--line) so they follow automatically; these two
   colours are written straight into style="" and need forcing. */
#bdwaste [style*="color:#fbbf24"],
#bdblocked [style*="color:#fbbf24"] { color: var(--q-amber) !important; }
#bdwaste [style*="color:#c4b5fd"],
#bdwaste b[style*="#c4b5fd"] { color: var(--q-violet) !important; }

/* --- reports (lib/report.js) --- */
.red { background: #fbe3e1; color: var(--q-red); }
.top { color: var(--q-red); }
.big[style*="color:#f87171"] { color: var(--q-red) !important; }

/* --- login --- */
#login {
  background: var(--q-surface);
  border: 1px solid var(--q-line);
  box-shadow: 0 1px 3px rgba(11, 11, 11, 0.06);
}
#login h2 { color: var(--q-ink); }
#login input {
  background: var(--q-surface);
  border: 1px solid var(--q-line);
  color: var(--q-ink);
}
#login input::placeholder { color: var(--q-muted); }
#err { color: var(--q-red); }

/* --- the warning banner keeps its red, it's an alarm --- */
#warn { color: #fff; }
