/* ================================================================
   FUGU // SENSOR PLATFORM  —  paired to the defence-branch palette
   ================================================================ */

*,*::before,*::after { box-sizing: border-box; }
html,body { margin:0; padding:0; height:100%; }
img,svg { display:block; max-width:100%; }

:root {
  /* DEFENCE PALETTE (paired with fugu-website/defence) */
  --bg:        #04060B;
  --bg-1:      #07090F;
  --bg-2:      #0C111B;
  --bg-3:      #131A26;
  --bg-4:      #1A2231;

  --fg:        #E8ECF2;
  --fg-2:      rgba(232,236,242,0.62);
  --fg-3:      rgba(232,236,242,0.40);
  --fg-4:      rgba(232,236,242,0.22);

  --rule:      rgba(160,180,220,0.08);
  --rule-2:    rgba(160,180,220,0.16);
  --rule-3:    rgba(160,180,220,0.28);

  --blue:        #6B8FC9;
  --blue-bright: #8AB0F0;
  --blue-deep:   #2A3E66;
  --purple:      #7B6FB8;
  --purple-deep: #3A2F5C;
  --green:       #6FB890;    /* live / OK accent */
  --amber:       #C9A86B;    /* stale */
  --red:         #C96B7B;    /* offline */

  --grad:      linear-gradient(95deg, #6B8FC9 0%, #7B6FB8 100%);
  --grad-soft: linear-gradient(95deg, rgba(107,143,201,0.18) 0%, rgba(123,111,184,0.18) 100%);

  --display: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --tactical: 'Chakra Petch', 'Inter Tight', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --ease: cubic-bezier(.2,.7,.1,1);
}

html { background: var(--bg); }
body {
  background:
    radial-gradient(900px 600px at 10% -10%, rgba(107,143,201,0.08), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(123,111,184,0.08), transparent 60%),
    var(--bg);
  color: var(--fg);
  font-family: var(--display);
  font-feature-settings: "ss01","ss02","cv11";
  -webkit-font-smoothing: antialiased;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================ HUD ============================ */
.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px clamp(16px, 3vw, 32px);
  border-bottom: 1px solid var(--rule-2);
  background: linear-gradient(180deg, rgba(12,17,27,0.85), rgba(7,9,15,0.85));
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.hud-left, .hud-right { display:flex; align-items:center; gap:18px; }
.brand {
  display:flex; align-items:center; gap:10px;
  font-family: var(--tactical);
  letter-spacing: 0.12em;
  font-weight: 700;
}
.brand-mark {
  width: 28px; height: 28px;
  display: inline-flex; align-items:center; justify-content:center;
  background: var(--grad);
  color: #04060B;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 800;
}
.brand-text { font-size: 14px; }
.brand-text .dot { color: var(--blue); margin: 0 4px; }
.eyebrow {
  font-family: var(--tactical);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--fg-3);
  text-transform: uppercase;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  font-family: var(--tactical);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--fg-2);
  background: rgba(19,26,38,0.6);
}
.status-pill.mono { font-family: var(--mono); letter-spacing: 0.04em; }
.status-pill.ok    { color: var(--green); border-color: rgba(111,184,144,0.4); }
.status-pill.warn  { color: var(--amber); border-color: rgba(201,168,107,0.4); }
.status-pill.err   { color: var(--red);   border-color: rgba(201,107,123,0.4); }
.dot-led {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--fg-3);
  box-shadow: 0 0 6px currentColor;
}
.status-pill.ok .dot-led    { background: var(--green); }
.status-pill.warn .dot-led  { background: var(--amber); }
.status-pill.err .dot-led   { background: var(--red); }

/* ============================ GRID ============================ */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 18px clamp(16px, 3vw, 32px);
  flex: 1;
}
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; }
}
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
@media (max-width: 1100px) {
  .span-3 { grid-column: span 2; }
}
@media (max-width: 760px) {
  .span-2, .span-3 { grid-column: span 1; }
}

.card {
  background: linear-gradient(180deg, rgba(19,26,38,0.85), rgba(12,17,27,0.85));
  border: 1px solid var(--rule-2);
  border-radius: 8px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(107,143,201,0.5) 50%, transparent 100%);
}
.card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; margin-bottom: 10px;
  flex-wrap: wrap;
}
.legend {
  font-family: var(--tactical);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--fg-3);
  display: flex;
  align-items: center;
  gap: 10px;
}
.legend .sw {
  display: inline-block; width: 12px; height: 6px; border-radius: 2px; margin-right: 4px; vertical-align: middle;
}
.sw.co2  { background: var(--blue-bright); }
.sw.flow { background: var(--purple); }
.sw.ads  { background: rgba(107,143,201,0.25); }
.sw.tc1  { background: var(--blue); }
.sw.tc2  { background: var(--purple); }
.sw.p    { background: #C9A86B; }
.sw.box  { background: var(--blue); }
.sw.exh  { background: var(--purple); }

/* ============================ HEADLINE ============================ */
.headline { padding: 22px 24px; }
.headline .headline-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 6px;
}
.big-number {
  font-size: clamp(36px, 5.5vw, 64px);
  letter-spacing: -0.02em;
  font-weight: 500;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.headline .meta {
  display: flex; gap: 28px; flex-wrap: wrap;
}
.headline .meta .label {
  font-family: var(--tactical);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--fg-3);
  display: block;
}
.headline .meta .mono {
  font-size: 18px;
  color: var(--fg);
}

/* ============================ THINGS LIST ============================ */
.things {
  list-style: none;
  padding: 0;
  margin: 8px 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.things li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-family: var(--tactical);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--fg-2);
  background: rgba(7,9,15,0.4);
}
.things li .led {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--fg-4);
  box-shadow: 0 0 8px currentColor;
}
.things li.live .led  { background: var(--green); color: var(--green); }
.things li.stale .led { background: var(--amber); color: var(--amber); }
.things li.offline .led { background: var(--red); color: var(--red); }
.things li .age {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-3);
}

/* ============================ CHARTS ============================ */
.chart {
  width: 100%;
  height: 240px;
  position: relative;
}
.uplot,
.uplot * {
  font-family: var(--mono) !important;
  color: var(--fg-2) !important;
}
.uplot .u-legend { color: var(--fg-2); font-size: 11px; }
.uplot .u-axis { color: var(--fg-3); }

/* ============================ TABLE ============================ */
.table-wrap { overflow-x: auto; }
.cycles-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12px;
}
.cycles-table th, .cycles-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
.cycles-table th {
  font-family: var(--tactical);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--fg-3);
  text-transform: uppercase;
  border-bottom: 1px solid var(--rule-2);
}
.cycles-table tr:hover td { background: rgba(107,143,201,0.04); }
.cycles-table td.active { color: var(--green); }
.cycles-table td.closed { color: var(--fg-2); }

/* ============================ FOOTER ============================ */
.hud-foot {
  display: flex;
  justify-content: space-between;
  padding: 10px clamp(16px, 3vw, 32px);
  border-top: 1px solid var(--rule);
  color: var(--fg-3);
  font-size: 11px;
  letter-spacing: 0.08em;
}
