@font-face {
  font-family: 'Sharp Grotesk';
  src: local('Sharp Grotesk Bold 14'),
       local('SharpGroteskBold-14'),
       url('SharpGroteskBold14.woff2') format('woff2'),
       url('1789419795569_Sharp_Grotesk_Bold14.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('InterVariable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

body,
.container-fluid,
.tab-content,
div, span, p, td, th, label, button, input, select {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-optical-sizing: auto;
}

.navbar .navbar-brand,
.br-headline,
.modal-title {
  font-family: 'Sharp Grotesk', -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
  font-weight: 700;
}

/* Bootstrap 5 drives navbar color through CSS vars, so set those as well as
   the plain properties. */
.navbar {
  --bs-navbar-color: rgba(255, 255, 255, 0.75);
  --bs-navbar-hover-color: #FFFFFF;
  --bs-navbar-active-color: #000533;
  --bs-navbar-brand-color: #FFFFFF;
  --bs-navbar-brand-hover-color: #FFFFFF;
  background-color: #000533 !important;
  border-color: #000533 !important;
}

.navbar .navbar-brand,
.navbar .navbar-brand:hover,
.navbar .navbar-brand:focus {
  color: #FFFFFF !important;
  font-size: 22px;
  height: 76px;
  padding-top: 0;
  padding-bottom: 0;
  display: flex;
  align-items: center;
}

.navbar .navbar-header,
.navbar > .container-fluid,
.navbar .container-fluid > .navbar-header {
  display: flex;
  align-items: center;
}

/* Taller bar */
.navbar,
.navbar .navbar-header,
.navbar .nav > li > a,
.navbar .navbar-nav .nav-link {
  min-height: 76px;
}

.navbar .nav > li > a,
.navbar .navbar-nav .nav-link {
  display: flex;
  align-items: center;
}

.br-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.br-brand img {
  height: 30px;
  width: auto;
  display: block;
}

.navbar .nav > li > a,
.navbar .navbar-nav > li > a,
.navbar .navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.75) !important;
}

.navbar .nav > li > a:hover,
.navbar .navbar-nav .nav-link:hover {
  color: #FFFFFF !important;
}

.navbar .nav > .active > a,
.navbar .navbar-nav > .active > a,
.navbar .navbar-nav .nav-link.active {
  color: #FFFFFF !important;
  background-color: #FF28C8 !important;
}

.br-totals {
  position: relative;
  border-radius: 12px;
  padding: 1.25rem;
}

.br-overlay {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(0, 5, 51, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.br-overlay-panel {
  position: relative;
  background: #FFFFFF;
  color: #000533;
  border: 4px solid #EAFF00;
  border-radius: 12px;
  padding: 1.75rem 2rem;
  width: min(760px, 100%);
  max-height: 85vh;
  overflow-y: auto;
}

.br-corner-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: 0;
  padding: 4px 6px;
  font-size: 20px;
  line-height: 1;
  color: #000533;
  cursor: pointer;
  opacity: 0.65;
}

.br-corner-btn:hover {
  opacity: 1;
}

.br-totals-charts {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(0, 5, 51, 0.2);
  font-size: 13px;
  opacity: 0.6;
  min-height: 180px;
}

/* ---- Monitoring layout ---------------------------------------------- */

.br-filter-row { margin: 4px 0 18px; }
.br-loading { padding: 0 0 12px; font-size: 14px; color: #000533; }

.br-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.br-stat {
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 2px 10px rgba(0, 5, 51, 0.10);
}
.br-stat-label { font-size: 12px; opacity: 0.8; }
.br-stat-value { font-size: 28px; line-height: 1.15; margin-top: 2px; }
.br-stat-sub   { font-size: 11px; opacity: 0.7; margin-top: 2px; }

.br-panel {
  background: #FFFFFF;
  border-radius: 12px;
  padding: 16px 18px 14px;
  margin-bottom: 18px;
  box-shadow: 0 2px 12px rgba(0, 5, 51, 0.10);
  height: calc(100% - 18px);
}
.br-panel-title { font-size: 15px; margin-bottom: 4px; }
.br-panel-note  { font-size: 12px; color: rgba(0, 5, 51, 0.6); margin-bottom: 10px; }
.br-empty       { font-size: 13px; color: rgba(0, 5, 51, 0.5); padding: 8px 0; }

.br-panel table { width: 100%; margin-bottom: 0; }
.br-panel table th { font-weight: 600; font-size: 12px; border-bottom: 1px solid rgba(0,5,51,0.15); }
.br-panel table td { font-size: 13px; padding: 6px 8px; }

.br-btn {
  background: #000533;
  color: #FFFFFF;
  border: 0;
  border-radius: 8px;
  padding: 6px 14px;
}
.br-btn:hover { background: #FF28C8; color: #FFFFFF; }
.br-sub-ok { font-size: 12px; color: #00A87A; margin-top: 8px; }

/* ---- Heartbeat ------------------------------------------------------- */

.br-ecg-list { display: flex; flex-direction: column; gap: 14px; }
.br-ecg-row  { display: flex; align-items: center; gap: 14px; }
.br-ecg-meta { flex: 0 0 150px; }
.br-ecg-label { font-size: 13px; font-weight: 600; }
.br-ecg-time  { font-size: 12px; color: rgba(0, 5, 51, 0.6); }
.br-ecg-side  { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }

.br-ecg {
  flex: 1;
  height: 40px;
  overflow: hidden;
}
.br-ecg path {
  stroke-dasharray: 240;
  stroke-dashoffset: 240;
  animation: br-ecg-draw 2.4s linear infinite;
}
.br-ecg.stale path { animation-duration: 4.8s; }
.br-ecg.dead  path { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; }

@keyframes br-ecg-draw {
  from { stroke-dashoffset: 240; }
  to   { stroke-dashoffset: 0; }
}

/* ---- Refresh row ------------------------------------------------------ */

.br-filter-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 4px 0 18px; }
.br-refresh { display: flex; align-items: center; gap: 10px; font-size: 12px; color: rgba(0,5,51,0.7); }

/* .br-panel needs relative positioning for the corner-expand button to sit
   inside it (previously only .br-totals had this). */
.br-panel { position: relative; }

/* ---- Infographic tiles (bigger) ---------------------------------------- */

.br-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}
.br-tile {
  border-radius: 14px;
  padding: 1.6rem 1.7rem 1.4rem;
  box-shadow: 0 2px 12px rgba(0, 5, 51, 0.12);
}
.br-tile-ticker { font-size: 40px; line-height: 1.05; }
.br-tile-name   { font-size: 16px; margin-bottom: 16px; }
.br-tile-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  font-size: 16px;
  padding: 3px 0;
}
.br-tile-head { font-size: 13px; opacity: 0.7; padding-bottom: 6px; }
.br-tile-rowlabel { opacity: 0.8; }
.br-tile-val { font-weight: 500; min-width: 52px; text-align: right; }
.br-totals { position: relative; border-radius: 14px; padding: 1.6rem 1.7rem 1.4rem;
             box-shadow: 0 2px 12px rgba(0, 5, 51, 0.12); }

/* ---- Global loading overlay --------------------------------------------- */

.br-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1060;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 5, 51, 0.30);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease 0.35s;  /* delay so fast recalcs don't flash */
}
html.shiny-busy .br-loading-overlay {
  opacity: 1;
  pointer-events: auto;
}
.br-loading-box {
  background: #FFFFFF;
  color: #000533;
  border: 4px solid #EAFF00;
  border-radius: 12px;
  padding: 1.5rem 2.5rem;
  text-align: center;
}

/* ---- Title casing for panel + tile headings ---------------------------- */

.br-panel-title,
.br-tile-name,
.br-stat-label {
  text-transform: capitalize;
}

/* ---- More dimension on the sector tiles -------------------------------- */

.br-tile,
.br-totals {
  box-shadow: 0 6px 18px rgba(0, 5, 51, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.br-tile:hover,
.br-totals:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 26px rgba(0, 5, 51, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* Separator above the metric rows adds a little depth inside the tile */
.br-tile-head {
  border-bottom: 1px solid rgba(0, 5, 51, 0.18);
  margin-bottom: 6px;
}

/* ---- Totals expand arrow: pulse to draw the eye ------------------------ */

.br-totals .br-corner-btn {
  border-radius: 50%;
  background: rgba(0, 5, 51, 0.10);
  animation: br-pulse 2.2s ease-in-out infinite;
  opacity: 1;
}
.br-totals .br-corner-btn:hover {
  animation: none;
  background: rgba(0, 5, 51, 0.20);
}

@keyframes br-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 5, 51, 0.35); }
  50%      { box-shadow: 0 0 0 9px rgba(0, 5, 51, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .br-totals .br-corner-btn { animation: none; }
}

/* ---- Centre tables inside panels --------------------------------------- */

.br-panel table {
  margin-left: auto;
  margin-right: auto;
  width: auto;
  min-width: 70%;
}
.br-panel .table-responsive { display: flex; justify-content: center; }

/* Totals overlay charts sit one above the other with room to breathe */
.br-totals-charts > div + div { margin-top: 18px; }

/* ---- Explainer line above the tile grid -------------------------------- */

.br-explainer {
  font-size: 13px;
  color: rgba(0, 5, 51, 0.7);
  margin: -4px 0 16px;
  max-width: 820px;
}
.br-explainer strong { color: #000533; font-weight: 600; }

/* ---- Panel alignment ---------------------------------------------------- */

/* Notes vary between one and two lines, which pushed tables out of line
   across a row. Reserve two lines so panel bodies start at the same height. */
.br-panel-note {
  min-height: 34px;
}

.br-panel {
  display: flex;
  flex-direction: column;
}
.br-panel > .shiny-html-output,
.br-panel > .table-responsive,
.br-panel > .shiny-plot-output,
.br-panel > .plotly {
  margin-top: auto;
  margin-bottom: auto;
}

/* ---- Breathing room at the bottom of every tab -------------------------- */

.tab-content > .tab-pane {
  padding-bottom: 48px;
}

/* ---- Bigger chart / panel titles --------------------------------------- */

.br-panel-title { font-size: 19px; margin-bottom: 5px; }
.br-panel-note  { font-size: 13px; }
.br-stat-label  { font-size: 13px; }

/* ---- Deeper, more dimensional sector tiles ------------------------------ */

/* Flat brand colour, exactly as the kiosk screen. Depth comes from the drop
   shadow only -- no gradients or inset highlights, they muddy the palette. */
.br-tile,
.br-totals {
  position: relative;
  background-image: none;
  border-radius: 20px;
  box-shadow: 0 10px 22px rgba(0, 5, 51, 0.20), 0 2px 4px rgba(0, 5, 51, 0.12);
}

.br-tile::before,
.br-totals::before { content: none; }

.br-tile:hover,
.br-totals:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 32px rgba(0, 5, 51, 0.26), 0 3px 6px rgba(0, 5, 51, 0.14);
}

/* Ticker dominates the tile the way it does on the kiosk */
.br-tile-ticker { font-size: 52px; line-height: 0.95; letter-spacing: -0.01em; }
.br-tile-name   { font-size: 15px; margin-bottom: 18px; }
.br-tile-head   { border-bottom-color: rgba(0, 5, 51, 0.22); }

/* ---- Totals overlay: wider, sectioned ----------------------------------- */

.br-overlay-panel { width: min(1100px, 100%); }
.br-overlay-section + .br-overlay-section {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid rgba(0, 5, 51, 0.12);
}

/* ---- Section headings ---------------------------------------------------- */

.br-section {
  margin: 10px 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(0, 5, 51, 0.12);
}
.br-section-title { font-size: 24px; line-height: 1.2; }
.br-section-note  { font-size: 13px; color: rgba(0, 5, 51, 0.6); margin-top: 2px; }

/* First section sits tight under the stat row; later ones get clear air */
.br-section + .row { margin-bottom: 4px; }
.row + .br-section { margin-top: 30px; }

/* ---- Equal-height panels across a row ---------------------------------- */

.tab-pane .row {
  display: flex;
  flex-wrap: wrap;
}
.tab-pane .row > [class*="col-"] {
  display: flex;
  flex-direction: column;
}
.tab-pane .row > [class*="col-"] > .br-panel {
  flex: 1 1 auto;
}
/* Two lines of note reserved so table headers line up across a row */
.br-panel-note { min-height: 40px; }

/* ---- Totals overlay: brighter ------------------------------------------ */

.br-overlay-title { font-size: 34px; line-height: 1.05; }
.br-overlay-sub   { font-size: 14px; opacity: 0.65; margin-bottom: 18px; }
.br-overlay-panel .br-stat-row { margin-bottom: 22px; }
.br-overlay-panel .br-tile-row { font-size: 17px; }

/* ---- Schema drift panel ------------------------------------------------- */

.br-ok-note    { font-size: 13px; color: #00815E; }
.br-drift-label { font-size: 12px; font-weight: 600; margin-top: 8px; opacity: 0.7; }
.br-drift-list  { font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
                  word-break: break-word; }