/* =============================================================
   Hyper Scale — Performance Dashboard
   style.css — all styling
   ============================================================= */

:root {
  --navy:      #152D47;
  --blue:      #2150FE;
  --dk-blue:   #1A3A7A;
  --green:     #1E7A3E;
  --lt-green:  #E6F4EC;
  --amber:     #E67E22;
  --lt-amber:  #FEF4E7;
  --teal:      #148F77;
  --red:       #C0392B;
  --lt-red:    #FDECEA;
  --grey:      #4C4C4D;
  --lt-grey:   #F5F5F6;
  --silver:    #D5D8DC;
  --white:     #FFFFFF;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--grey);
  background: var(--lt-grey);
  -webkit-font-smoothing: antialiased;
}

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

/* ===================== OVERLAYS (loading / error / no data) ===================== */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.overlay-inner { text-align: center; padding: 24px; }
.overlay-logo { max-height: 56px; margin-bottom: 24px; }
.overlay-logo-text {
  color: var(--white);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin-bottom: 24px;
}
.overlay-label { color: var(--white); font-size: 18px; font-weight: 600; }
.overlay-sub { color: #AACCFF; font-size: 14px; margin-top: 10px; }
.overlay-sub a { color: #AACCFF; text-decoration: underline; }

.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 1; }
}

/* ===================== HEADER (6.1) ===================== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
  background: var(--navy);
}
.header-inner {
  max-width: 1400px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.header-left { display: flex; align-items: center; flex: 0 0 auto; }
.header-logo { max-height: 40px; }
.header-logo-text {
  color: var(--white);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.1em;
}
.header-centre {
  flex: 1 1 auto;
  text-align: center;
  color: #AACCFF;
  font-size: 16px;
  font-weight: 400;
}
.header-right {
  flex: 0 0 auto;
  color: var(--silver);
  font-size: 12px;
  font-style: italic;
}

/* ===================== PERIOD BAR (6.2) ===================== */
.period-bar {
  position: sticky;
  top: 64px;
  z-index: 99;
  height: 40px;
  background: var(--dk-blue);
}
.period-inner {
  max-width: 1400px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.month-selector { display: flex; align-items: center; gap: 12px; }
.month-arrow {
  background: rgba(255,255,255,0.12);
  color: var(--white);
  border: none;
  border-radius: 4px;
  width: 26px; height: 26px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}
.month-arrow:hover:not(:disabled) { background: rgba(255,255,255,0.28); }
.month-arrow:disabled { opacity: 0.3; cursor: not-allowed; }
.month-label {
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
  min-width: 120px;
  text-align: center;
}
.period-credit { color: #AACCFF; font-size: 11px; }

/* ===================== PAGE ===================== */
.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px;
}
.section { margin-bottom: 32px; }
.section:last-child { margin-bottom: 0; }

.card {
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  padding: 20px 24px;
}

.section-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--navy);
  margin-bottom: 14px;
}
.section-sublabel {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--navy);
  margin-top: 14px;
}

/* ===================== KPI TILES (6.3 / 6.4) ===================== */
.tile-grid { display: grid; gap: 16px; }
.tile-grid-6 { grid-template-columns: repeat(6, 1fr); }
.tile-grid-5 { grid-template-columns: repeat(5, 1fr); }

.tile {
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  padding: 20px 24px;
  border-top: 3px solid var(--silver);
}
.tile-value {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.05;
  color: var(--navy);
  letter-spacing: -0.01em;
}
.tile-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey);
  margin-top: 8px;
}
.tile-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 10px;
}
.tile-trend.up   { color: var(--green); }
.tile-trend.down { color: var(--red); }
.tile-trend.flat { color: var(--silver); }
.tile-subnote { font-size: 11px; color: var(--grey); margin-top: 6px; }

/* ===================== FUNNEL (6.5) ===================== */
.funnel {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex-wrap: wrap;
}
.funnel-stage {
  flex: 1 1 0;
  min-width: 120px;
  color: var(--white);
  border-radius: 8px;
  padding: 18px 16px;
  text-align: center;
}
.funnel-stage.s-navy  { background: var(--navy); }
.funnel-stage.s-blue  { background: var(--blue); }
.funnel-stage.s-green { background: var(--green); }
.funnel-stage.greyed  { background: var(--silver); color: var(--grey); }
.funnel-stage-value { font-size: 30px; font-weight: 700; }
.funnel-stage-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-top: 6px;
}
.funnel-arrow {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  min-width: 96px;
}
.funnel-arrow-sym { font-size: 22px; color: var(--silver); line-height: 1; }
.funnel-arrow-rate {
  font-size: 12px; font-weight: 700; color: var(--navy); margin-top: 6px;
  text-align: center;
}
.funnel-summary {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--lt-grey);
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
}

/* ===================== CHARTS (6.6) ===================== */
.chart-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.chart-card { padding: 16px 18px; }
.chart-title {
  font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 10px;
}
.chart-wrap { position: relative; height: 240px; }

/* ===================== YEAR TO DATE (6.7) ===================== */
.ytd {
  background: var(--navy);
  border-radius: 8px;
  padding: 24px 28px;
}
.ytd-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: #AACCFF; margin-bottom: 16px;
}
.ytd-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 24px; }
.ytd-stat { color: var(--white); }
.ytd-value { font-size: 28px; font-weight: 700; line-height: 1.1; }
.ytd-statlabel {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: #AACCFF; margin-top: 6px;
}

/* ===================== DATA TABLE (6.8) ===================== */
.table-toggle {
  background: var(--white);
  border: 1px solid var(--silver);
  border-radius: 8px;
  color: var(--navy);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.15s;
}
.table-toggle:hover { background: var(--lt-grey); }
.table-wrap { margin-top: 16px; overflow-x: auto; padding: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: right;
  padding: 12px 14px;
  background: var(--navy);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.data-table th:first-child,
.data-table td:first-child { text-align: left; }
.data-table td {
  text-align: right;
  padding: 10px 14px;
  border-bottom: 1px solid var(--lt-grey);
  white-space: nowrap;
}
.data-table tbody tr:nth-child(even) { background: var(--lt-grey); }
.data-table td.notes-cell {
  text-align: left;
  white-space: normal;
  min-width: 160px;
  color: var(--grey);
}

/* ===================== FOOTER (6.9) ===================== */
.footer { background: var(--navy); }
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-left, .footer-right {
  color: var(--silver);
  font-size: 8px;
  font-style: italic;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1023px) {
  .tile-grid-6, .tile-grid-5 { grid-template-columns: repeat(3, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
  .ytd-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 767px) {
  .header-centre { font-size: 13px; }
  .header-right { display: none; }
  .tile-grid-6, .tile-grid-5 { grid-template-columns: repeat(2, 1fr); }
  .tile-value { font-size: 28px; }
  .ytd-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-wrap { height: 200px; }
  .period-credit { display: none; }
  .funnel { flex-direction: column; }
  .funnel-arrow { flex-direction: row; padding: 8px 0; gap: 10px; }
  .funnel-arrow-sym { transform: rotate(90deg); }
}

/* ===================== PRINT ===================== */
@media print {
  body { background: var(--white); }
  .header, .period-bar { position: static; }
  .table-toggle { display: none; }
  #tableWrap { display: block !important; }
  .card, .tile, .chart-card { box-shadow: none !important; border: 1px solid var(--silver); }
  .section { break-inside: avoid; }
  .chart-grid { grid-template-columns: repeat(3, 1fr); }
}
