﻿/* ============================================================
   KPI Signal Board - design tokens
   ============================================================ */
:root {
  --bg: #0F1E19;
  --bg-vignette: radial-gradient(circle at 15% 0%, #16281f 0%, #0F1E19 55%);
  --panel: #152720;
  --panel-raised: #1A2F27;
  --hairline: rgba(234, 240, 234, 0.11);
  --hairline-strong: rgba(234, 240, 234, 0.22);

  --ink: #EAF0EA;
  --ink-muted: #8FA79C;
  --ink-faint: #5D7269;

  --brass: #C89B5B;
  --brass-soft: rgba(200, 155, 91, 0.16);
  --jade: #5FA37C;
  --jade-soft: rgba(95, 163, 124, 0.16);
  --rust: #C1543A;
  --rust-soft: rgba(193, 84, 58, 0.16);
  --slate: #4C7A8C;
  --slate-soft: rgba(76, 122, 140, 0.16);

  --radius: 7px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-vignette), var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  min-height: 100vh;
}

/* faint fixed scanline texture - instrument-glass feel, kept very quiet */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: repeating-linear-gradient(
    180deg,
    rgba(255,255,255,0.012) 0px,
    rgba(255,255,255,0.012) 1px,
    transparent 1px,
    transparent 3px
  );
}

code {
  font-family: var(--font-mono);
  background: var(--panel-raised);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

/* ============================================================
   Header
   ============================================================ */
.board-header {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  flex-wrap: wrap;
  padding: 2.75rem clamp(1.25rem, 4vw, 3.5rem) 1.75rem;
  border-bottom: 1px solid var(--hairline);
}

.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 0.6rem;
}

.board-header h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  margin: 0 0 0.4rem;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.95rem;
  max-width: 46ch;
}

.board-header__controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
}

.week-picker {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.week-picker__label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

#week-select {
  appearance: none;
  background: var(--panel-raised);
  border: 1px solid var(--hairline-strong);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 0.55rem 2.2rem 0.55rem 0.9rem;
  border-radius: var(--radius);
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--brass) 50%), linear-gradient(135deg, var(--brass) 50%, transparent 50%);
  background-position: calc(100% - 15px) center, calc(100% - 10px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

#week-select:disabled { color: var(--ink-faint); cursor: default; }

.last-scraped {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.logout-button {
  background: none;
  border: none;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  padding: 0;
}
.logout-button:hover { color: var(--ink-muted); }

/* ============================================================
   Layout shell
   ============================================================ */
main {
  position: relative;
  z-index: 1;
  padding: 2rem clamp(1.25rem, 4vw, 3.5rem) 3rem;
  max-width: 1180px;
  margin: 0 auto;
}

.empty-state {
  text-align: center;
  padding: 5rem 1.5rem;
  color: var(--ink-muted);
}
.empty-state__glyph {
  display: block;
  width: 40px;
  height: 40px;
  margin: 0 auto 1rem;
  border: 2px dashed var(--brass);
  border-radius: 50%;
  opacity: 0.7;
}
.empty-state h2 {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0 0 0.5rem;
}
.empty-state p { max-width: 42ch; margin: 0 auto; }

/* ============================================================
   Stat readout cards
   ============================================================ */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem 1.3rem;
}

/* corner-bracket bezel - the recurring instrument motif */
.stat-card::before,
.stat-card::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: var(--brass);
  opacity: 0.55;
}
.stat-card::before {
  top: -1px; left: -1px;
  border-top: 2px solid var(--brass);
  border-left: 2px solid var(--brass);
}
.stat-card::after {
  bottom: -1px; right: -1px;
  border-bottom: 2px solid var(--brass);
  border-right: 2px solid var(--brass);
}

.stat-card__label {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin: 0 0 0.5rem;
  line-height: 1.35;
}

.stat-card__value {
  font-family: var(--font-mono);
  font-size: 2.1rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1;
}

.stat-card__value--rust { color: var(--rust); }

/* ============================================================
   Panels
   ============================================================ */
.panel-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 860px) {
  .panel-grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem 1.6rem;
  margin-bottom: 1rem;
}

.panel__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1.1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.panel__head h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
}

.panel__hint {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}

.chart-wrap { position: relative; height: 240px; }
.chart-wrap--tall { height: 320px; }

/* ============================================================
   Quality gauge
   ============================================================ */
.gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

#quality-gauge { width: 100%; max-width: 220px; height: auto; }

.gauge-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.gauge-legend li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.gauge-legend .swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 0.55rem;
}

.gauge-legend .name { display: flex; align-items: center; }

.gauge-legend .count {
  font-family: var(--font-mono);
  color: var(--ink);
}

/* ============================================================
   Watch list
   ============================================================ */
.panel--watchlist { transition: border-color 0.25s ease, background 0.25s ease; }

.watchlist-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
}

.watch-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: var(--panel-raised);
}

.watch-item--alert {
  border-color: rgba(193, 84, 58, 0.4);
  background: var(--rust-soft);
}

.watch-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--jade);
  flex-shrink: 0;
}

.watch-item--alert .watch-dot {
  background: var(--rust);
  animation: pulse 2.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(193, 84, 58, 0.5); }
  50% { box-shadow: 0 0 0 5px rgba(193, 84, 58, 0); }
}

.watch-item__text { display: flex; flex-direction: column; gap: 0.15rem; }
.watch-item__label { font-size: 0.82rem; color: var(--ink-muted); }
.watch-item__value { font-family: var(--font-mono); font-size: 1.05rem; }
.watch-item--alert .watch-item__value { color: var(--rust); }

/* ============================================================
   Login page
   ============================================================ */
.login-body {
  display: flex;
  min-height: 100vh;
}

.login-shell {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 2.25rem 2rem 2rem;
}

.login-card::before,
.login-card::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--brass);
  opacity: 0.55;
}
.login-card::before { top: -1px; left: -1px; border-top: 2px solid var(--brass); border-left: 2px solid var(--brass); }
.login-card::after { bottom: -1px; right: -1px; border-bottom: 2px solid var(--brass); border-right: 2px solid var(--brass); }

.login-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.55rem;
  margin: 0 0 0.4rem;
  letter-spacing: -0.01em;
}

.login-subtitle {
  margin: 0 0 1.75rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.login-field {
  display: block;
  margin-bottom: 1.1rem;
}

.login-field__label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.5rem;
}

.login-field input {
  width: 100%;
  background: var(--panel-raised);
  border: 1px solid var(--hairline-strong);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius);
}

.login-field input:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
}

.login-error {
  color: var(--rust);
  background: var(--rust-soft);
  border: 1px solid rgba(193, 84, 58, 0.35);
  border-radius: var(--radius);
  font-size: 0.85rem;
  padding: 0.6rem 0.8rem;
  margin: 0 0 1.1rem;
}

.login-button {
  width: 100%;
  background: var(--brass);
  color: #1a1409;
  border: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.login-button:hover { opacity: 0.9; }
.login-button:disabled { opacity: 0.6; cursor: default; }
.login-button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ============================================================
   Footer
   ============================================================ */
.board-footer {
  position: relative;
  z-index: 1;
  padding: 1.25rem clamp(1.25rem, 4vw, 3.5rem) 2rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  max-width: 1180px;
  margin: 0 auto;
  word-break: break-all;
}

