/* Wallboard TV — mode sombre uniquement, Chrome ~75 (pas clamp, pas gap flex) */

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b1120;
}

.wallboard {
  --bg: #0b1120;
  --surface: #151f32;
  --surface-elevated: #1c2942;
  --border-subtle: #334155;
  --border-strong: #475569;
  --text: #f8fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #cbd5e1;
  --line: rgba(56, 189, 248, 0.35);
  --good: #6ee7b7;
  --good-muted: #34d399;
  --warn: #fcd34d;
  --bad: #fca5a5;
  --neutral: #e2e8f0;

  box-sizing: border-box;
  min-height: 100%;
  max-height: 100%;
  padding: 12px 16px;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wallboard > * + * {
  margin-top: 12px;
}

.head {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.head-left {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
}

.head-left > * + * {
  margin-left: 14px;
}

.brand {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.02em;
}

.brand span {
  color: #7dd3fc;
}

.window-tag {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #38bdf8;
  background: #0c4a6e;
  color: #e0f2fe;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.head-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.head-right > * + * {
  margin-left: 16px;
}

.clock {
  font-size: 36px;
  font-weight: 800;
  color: #38bdf8;
  font-variant-numeric: tabular-nums;
}

.sync {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-bar,
.ok-bar,
.banner {
  flex-shrink: 0;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.alert-bar {
  border: 1px solid #f87171;
  background: #450a0a;
  color: #fecaca;
}

.alert-bar strong {
  color: #ffffff;
}

.alert-bar-pulse {
  animation: alertBarGlow 2s ease-in-out infinite;
}

@keyframes alertBarGlow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.2);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.12);
  }
}

.ok-bar {
  border: 1px solid #4ade80;
  background: #052e16;
  color: #d1fae5;
}

.banner {
  border: 1px solid #f472b6;
  background: #500724;
  color: #fce7f3;
}

.grid22 {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  grid-gap: 14px;
}

.section {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 2px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}

.section-head {
  flex-shrink: 0;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border-subtle);
}

.did-title {
  margin: 0;
  font-size: 52px;
  line-height: 1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.did-hint {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}

.kpi-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  grid-gap: 8px;
  padding: 10px;
  background: var(--surface-elevated);
}

.metric {
  min-height: 0;
  border: 2px solid var(--border-strong);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: var(--text);
}

.metric > * + * {
  margin-top: 8px;
}

.metric-plain {
  border-color: var(--border-strong);
  background: #0f172a;
}

.metric-top-plain {
  justify-content: flex-start;
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-label {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.status-chip {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chip-good {
  color: #ecfdf5;
  background: #047857;
}

.chip-warn {
  color: #1c1917;
  background: #fcd34d;
}

.chip-bad {
  color: #ffffff;
  background: #b91c1c;
}

.chip-neutral {
  color: #f8fafc;
  background: #475569;
}

.metric-value {
  font-size: 44px;
  font-weight: 900;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.metric-value-lg {
  font-size: 56px;
  font-weight: 900;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.value-good {
  color: var(--good);
}

.value-warn {
  color: var(--warn);
}

.value-bad {
  color: var(--bad);
}

.value-neutral {
  color: var(--neutral);
}

.value-plain {
  color: var(--text);
}

.metric-box-good {
  border-color: #34d399;
  background: #022c22;
  color: var(--text);
}

.metric-box-neutral {
  border-color: var(--border-strong);
  background: #1e293b;
  color: var(--text);
}

.metric-box-warn {
  border: 2px solid #fb923c;
  background: #431407;
  color: #ffedd5;
}

.metric-box-bad {
  border: 2px solid #f87171;
  background: #450a0a;
  color: #fecaca;
}

.err-box {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 16px;
  color: #fecaca;
  font-size: 16px;
  font-weight: 700;
  background: #1e293b;
}

@media (orientation: portrait) and (min-height: 1100px) {
  .grid22 {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, minmax(0, 1fr));
  }

  .kpi-grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, minmax(0, 1fr));
  }

  .did-title {
    font-size: 64px;
  }
}

@media (max-width: 760px) {
  .wallboard {
    max-height: none;
    overflow: auto;
  }

  .grid22 {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }
}
