/* ===========================================================================
   Bluerydge AI Hub — brand design system (mirrors the intranet globals.css)
   Dark, mission-focused theme with cyan + magenta accents.
   =========================================================================== */
:root {
  --bg: #060a12;
  --bg-2: #080d17;
  --surface: #0c1320;
  --surface-2: #0f1828;
  --border: #1b2940;
  --border-soft: #15212f;

  --ink: #e8eef7;
  --ink-muted: #8b9bb1;
  --ink-dim: #5d6b80;

  --cyan: #25d3ec;
  --cyan-soft: #4fdcf0;
  --magenta: #f0245f;
  --magenta-soft: #ff4f80;

  --up: #2ad19b;
  --warn: #f5b942;
  --down: #f0245f;

  /* Chart series (validated deeper steps of the brand hues for dark surface) */
  --s-cyan: #0d93aa;
  --s-magenta: #e01d55;
  --s-green: #158a66;
  --s-amber: #b8821c;
  --s-deemph: #5d6b80;

  --radius: 16px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  background-image:
    radial-gradient(900px 500px at 78% -8%, rgba(37, 211, 236, 0.10), transparent 60%),
    radial-gradient(700px 500px at -5% 8%, rgba(240, 36, 95, 0.07), transparent 55%);
  background-attachment: fixed;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

button, a, [role="button"] {
  transition: color .18s ease, background-color .18s ease, border-color .18s ease,
    transform .12s ease, box-shadow .18s ease, opacity .18s ease;
}

/* --- layout ------------------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(6, 10, 18, .82);
  backdrop-filter: blur(16px);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 14px; height: 64px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand img { width: 38px; height: 38px; }
.brand .word { font-weight: 800; letter-spacing: .06em; font-size: 1.02rem; }
.brand .word em { color: var(--cyan); font-style: normal; }
.brand .sub { font-size: .62rem; letter-spacing: .22em; color: var(--ink-dim); text-transform: uppercase; display: block; margin-top: 1px; }

nav.tabs { display: flex; gap: 2px; margin-left: 12px; overflow-x: auto; scrollbar-width: none; }
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs a {
  padding: 8px 13px; border-radius: 8px; font-size: .875rem; font-weight: 500;
  color: var(--ink-muted); white-space: nowrap;
}
nav.tabs a:hover { background: var(--surface); color: var(--ink); text-decoration: none; }
nav.tabs a.active { background: rgba(37, 211, 236, .1); color: var(--cyan); }
nav.tabs a .badge {
  background: var(--magenta); color: #fff; border-radius: 999px;
  font-size: .66rem; padding: 1px 6px; margin-left: 6px; font-weight: 700;
}

.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.intranet-link {
  font-size: .8rem; color: var(--ink-muted); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 999px;
}
.intranet-link:hover { color: var(--cyan); border-color: rgba(37,211,236,.4); text-decoration: none; }
/* Embedded inside the intranet (BOS AI Hub app) — the back-link is redundant. */
.embedded .intranet-link { display: none; }
.userchip {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 12px 4px 4px; font-size: .8rem; color: var(--ink-muted);
}
.userchip .avatar {
  width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--cyan), var(--magenta));
  color: #04121a; font-weight: 800; font-size: .7rem;
}

main { max-width: 1240px; margin: 0 auto; padding: 26px 20px 80px; }

.eyebrow {
  color: var(--cyan); letter-spacing: .18em; text-transform: uppercase;
  font-weight: 600; font-size: .72rem; margin: 0 0 6px;
}
h1.page { font-size: 1.5rem; font-weight: 800; margin: 0 0 4px; }
p.lede { color: var(--ink-muted); margin: 0 0 22px; font-size: .92rem; }

/* --- cards & grids --------------------------------------------------------------- */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,0));
  background-color: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}
.card.hoverable:hover {
  border-color: color-mix(in srgb, var(--cyan) 45%, var(--border));
  box-shadow: 0 12px 40px -18px rgba(37, 211, 236, .35);
}
a.card { display: block; color: inherit; }
a.card:hover { text-decoration: none; }
a.card:active { transform: scale(.99); }

.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); margin-bottom: 22px; }
.cards-2 { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.cards-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* Stat tile: label · value · delta · sparkline */
.stat { padding: 16px 18px; }
.stat .label { font-size: .74rem; color: var(--ink-muted); margin-bottom: 6px; }
.stat .value { font-size: 1.55rem; font-weight: 650; line-height: 1.1; }
.stat .hint { font-size: .72rem; color: var(--ink-dim); margin-top: 5px; }
.stat .value.accent { color: var(--cyan); }
.stat .value.warn { color: var(--warn); }

/* --- heartbeat ------------------------------------------------------------------- */
.hb { display: inline-flex; align-items: center; gap: 7px; font-size: .76rem; font-weight: 600; }
.hb .dot { width: 9px; height: 9px; border-radius: 999px; position: relative; flex: none; }
.hb.alive { color: var(--up); }
.hb.alive .dot { background: var(--up); }
.hb.alive .dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 999px;
  border: 2px solid var(--up); opacity: .6; animation: hb-ping 1.6s cubic-bezier(0,0,.2,1) infinite;
}
.hb.quiet { color: var(--warn); } .hb.quiet .dot { background: var(--warn); }
.hb.offline { color: var(--down); } .hb.offline .dot { background: var(--down); }
.hb.never { color: var(--ink-dim); } .hb.never .dot { background: var(--ink-dim); }
@keyframes hb-ping { 0% { transform: scale(.6); opacity: .7; } 80%, 100% { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .hb.alive .dot::after { animation: none; } }

/* --- buttons & forms --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  border-radius: 10px; padding: 8px 16px; font-size: .85rem; font-weight: 600;
  border: 1px solid var(--border); background: transparent; color: var(--ink);
  font-family: var(--font);
}
.btn:hover { border-color: rgba(37,211,236,.45); color: var(--cyan); }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--cyan), #15b6d6);
  color: #04121a; border: none;
  box-shadow: 0 10px 30px -10px rgba(37,211,236,.6);
}
.btn-primary:hover { transform: translateY(-1px); color: #04121a; box-shadow: 0 16px 36px -10px rgba(37,211,236,.75); }
.btn-outline { border: 1px solid var(--magenta); background: rgba(240,36,95,.06); }
.btn-outline:hover { background: rgba(240,36,95,.16); color: var(--ink); border-color: var(--magenta); }
.btn-sm { padding: 5px 11px; font-size: .78rem; border-radius: 8px; }

input, select, textarea {
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 12px; font-size: .88rem; font-family: var(--font);
  width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--cyan) 70%, transparent); outline-offset: 2px;
}
label.field { display: block; font-size: .76rem; color: var(--ink-muted); margin-bottom: 12px; }
label.field span { display: block; margin-bottom: 5px; }

/* --- tables ----------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .84rem; }
th { text-align: left; color: var(--ink-dim); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); color: var(--ink-muted); vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: rgba(255,255,255,.015); }
td .strong { color: var(--ink); font-weight: 600; }

/* --- status chips ------------------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px;
  font-size: .7rem; font-weight: 700; padding: 3px 10px; white-space: nowrap;
  border: 1px solid transparent;
}
.chip.low, .chip.completed, .chip.deployed, .chip.paid { color: var(--up); background: rgba(42,209,155,.1); border-color: rgba(42,209,155,.25); }
.chip.medium, .chip.awaiting_approval, .chip.review, .chip.quiet, .chip.draft { color: var(--warn); background: rgba(245,185,66,.1); border-color: rgba(245,185,66,.25); }
.chip.high, .chip.rejected, .chip.failed, .chip.offline { color: var(--magenta-soft); background: rgba(240,36,95,.1); border-color: rgba(240,36,95,.3); }
.chip.received, .chip.triaging, .chip.queued, .chip.approved, .chip.dispatched, .chip.coding, .chip.issued { color: var(--cyan); background: rgba(37,211,236,.08); border-color: rgba(37,211,236,.25); }
.chip.neutral, .chip.cancelled, .chip.never, .chip.void { color: var(--ink-dim); background: rgba(93,107,128,.12); border-color: rgba(93,107,128,.3); }

/* --- request progress ------------------------------------------------------------------ */
.progress { height: 7px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > div {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), #15b6d6);
  transition: width .6s ease;
}
.progress.done > div { background: var(--up); }
.progress.bad > div { background: var(--magenta); }

/* --- charts ------------------------------------------------------------------------- */
.chart-card { padding: 18px; }
.chart-card h3 { margin: 0 0 2px; font-size: .95rem; }
.chart-card .sub { color: var(--ink-dim); font-size: .74rem; margin: 0 0 12px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin: 10px 2px 0; font-size: .74rem; color: var(--ink-muted); }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; }
svg text { font-family: var(--font); }

#tooltip {
  position: fixed; z-index: 100; pointer-events: none; display: none;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; font-size: .76rem; color: var(--ink-muted);
  box-shadow: 0 12px 32px -12px rgba(0,0,0,.7); max-width: 260px;
}
#tooltip .t-title { color: var(--ink); font-weight: 600; margin-bottom: 3px; }
#tooltip .t-row { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-variant-numeric: tabular-nums; }
#tooltip .t-row .swatch { width: 8px; height: 8px; border-radius: 2px; flex: none; }

/* --- misc ---------------------------------------------------------------------------- */
.section { margin-top: 30px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 1.05rem; margin: 0; }
.section-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.muted { color: var(--ink-muted); } .dim { color: var(--ink-dim); }
.small { font-size: .78rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8em; }
code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--surface-2); border-radius: 6px;
}
code { padding: 2px 6px; font-size: .8em; }
pre { padding: 14px; overflow-x: auto; font-size: .76rem; line-height: 1.55; border: 1px solid var(--border-soft); color: var(--ink-muted); }
.empty { text-align: center; color: var(--ink-dim); padding: 40px 20px; font-size: .88rem; }
.divider { border: none; border-top: 1px solid var(--border-soft); margin: 18px 0; }

.gate { min-height: 80vh; display: grid; place-items: center; }
.gate .card { max-width: 440px; text-align: center; padding: 44px 38px; }
.gate img { width: 62px; height: 62px; margin-bottom: 14px; }
.gate h1 { font-size: 1.2rem; margin: 0 0 8px; }
.gate p { color: var(--ink-muted); font-size: .88rem; line-height: 1.6; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--ink);
  border-radius: 12px; padding: 12px 20px; font-size: .85rem;
  box-shadow: 0 16px 40px -12px rgba(0,0,0,.8); display: none;
}
.toast.error { border-color: var(--magenta); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4,7,12,.72); z-index: 150;
  display: none; place-items: center; padding: 20px; backdrop-filter: blur(4px);
}
.modal-backdrop.open { display: grid; }
.modal { width: 100%; max-width: 560px; padding: 26px; max-height: 88vh; overflow-y: auto; }
.modal h2 { margin: 0 0 16px; font-size: 1.05rem; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; border-left: 1px solid var(--border-soft); margin-left: 6px; }
.timeline li::before {
  content: ""; position: absolute; left: -4.5px; top: 4px; width: 8px; height: 8px;
  border-radius: 999px; background: var(--cyan);
}
.timeline li:last-child { border-left-color: transparent; }
.timeline .when { font-size: .7rem; color: var(--ink-dim); }
.timeline .what { font-size: .82rem; color: var(--ink-muted); margin-top: 1px; }

@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 14px; }
  nav.tabs { order: 3; width: 100%; margin-left: 0; }
  .userchip .uname { display: none; }
}
