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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  background: #05070d;
  color: #e8eeff;
  min-height: 100vh;
}

/* ── Auth gate ─────────────────────────────────────────── */

.gate {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  text-align: center;
  color: #fff;
  padding: 40px;
}

.gate h2 { font-size: 20px; font-weight: 600; }
.gate p  { font-size: 14px; color: rgba(255,255,255,0.6); }

.signin-btn {
  margin-top: 8px;
  padding: 11px 36px;
  background: #0071e3;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.signin-btn:hover { background: #0077ed; }

.gate-back {
  margin-top: 4px;
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  text-decoration: none;
}
.gate-back:hover { color: #fff; }

/* ── Header ────────────────────────────────────────────── */

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 90px;
  background-image: url("../Images/header.png");
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.18);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-link { text-decoration: none; color: inherit; }

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  height: 75px;
  width: auto;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-size: 22px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.2px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.brand-tagline {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: 0.1px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* ── Nav ───────────────────────────────────────────────── */

.dash-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav-link {
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.15s;
}
.nav-link:hover { color: #fff; }
.nav-link.active {
  color: #4ade80;
  font-weight: 600;
}

.refresh-btn {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  padding: 0;
  line-height: 1;
}
.refresh-btn:hover { background: rgba(255,255,255,0.22); }

/* ── Main layout ───────────────────────────────────────── */

main {
  padding: 14px 28px 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 10px;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.last-updated {
  font-size: 12px;
  color: rgba(255,255,255,0.38);
}

/* ── KPI strip ─────────────────────────────────────────── */

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.kpi-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 14px;
  padding: 12px 20px;
  text-align: center;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: #4ade80;
  letter-spacing: -0.01em;
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.50);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Panel grid ────────────────────────────────────────── */

.upper-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1.4fr;
  gap: 10px;
  margin-bottom: 10px;
}

.lower-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 10px;
}

.panel {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Panel title row (title + info button) ─────────────── */

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

/* ── Info button ───────────────────────────────────────── */

.info-btn {
  flex-shrink: 0;
  background: none;
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.38);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  font-style: italic;
  font-weight: 700;
  font-family: Georgia, serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: color 0.15s, border-color 0.15s;
}
.info-btn:hover  { color: rgba(255,255,255,0.75); border-color: rgba(255,255,255,0.35); }
.info-btn.active { color: #4ade80;               border-color: rgba(74,222,128,0.55); }

/* KPI card position */
.kpi-card { position: relative; }
.kpi-info-btn {
  position: absolute;
  top: 10px;
  right: 10px;
}

/* ── Info callout ──────────────────────────────────────── */

.info-callout {
  font-size: 12px;
  line-height: 1.6;
  color: rgba(255,255,255,0.55);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 0 12px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.22s ease, padding 0.22s ease, margin 0.22s ease;
  margin: 0;
}
.info-callout.open {
  max-height: 140px;
  padding: 10px 12px;
  margin-bottom: 2px;
}

.panel-sub {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255,255,255,0.40);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Hero logo ─────────────────────────────────────────── */

.panel-hero {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0 4px;
}

.panel-hero-logo {
  height: 80px;
  width: auto;
  opacity: 0.85;
}

/* ── Charts ────────────────────────────────────────────── */

.chart-wrap {
  position: relative;
  flex: 1;
  min-height: 110px;
}

.chart-wrap canvas {
  width: 100% !important;
}

/* ── Tables ────────────────────────────────────────────── */

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.dash-table thead th {
  padding: 5px 8px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(255,255,255,0.09);
}

.dash-table tbody td {
  padding: 6px 8px;
  color: #d0d4e0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  vertical-align: middle;
}

.dash-table tbody tr:last-child td {
  border-bottom: none;
}

.dash-table tbody tr:hover td {
  background: rgba(255,255,255,0.03);
}

.table-empty {
  text-align: center;
  color: rgba(255,255,255,0.30);
  padding: 24px 0 !important;
}

/* ── Badges ────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-active {
  background: rgba(74, 222, 128, 0.18);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.35);
}

.badge-inactive {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.40);
  border: 1px solid rgba(255,255,255,0.12);
}

/* ── GAAP Audit Records section ────────────────────────── */

.gaap-section {
  margin-top: 10px;
}

.gaap-vertical-badge {
  background: rgba(26, 86, 219, 0.18);
  color: #93c5fd;
  border: 1px solid rgba(26, 86, 219, 0.30);
  border-radius: 20px;
  padding: 2px 9px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-style: normal;
}

.gaap-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gaap-project-select {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  color: #e8eaf0;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  min-width: 180px;
}
.gaap-project-select option { background: #1a2638; }

.gaap-load-btn {
  background: rgba(74, 222, 128, 0.14);
  border: 1px solid rgba(74, 222, 128, 0.35);
  color: #4ade80;
  border-radius: 8px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.gaap-load-btn:hover { background: rgba(74, 222, 128, 0.24); }

/* Confidence badges */

.conf-high   { color: #4ade80; font-weight: 600; }
.conf-medium { color: #fbbf24; font-weight: 600; }
.conf-low    { color: #f87171; font-weight: 600; }

.gaap-hash {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.35);
}

.gaap-replay-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.55);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.gaap-replay-btn:hover { color: #93c5fd; border-color: rgba(147, 197, 253, 0.45); }

/* Replay inline panel */

.gaap-replay-panel {
  background: rgba(26, 86, 219, 0.07);
  border: 1px solid rgba(26, 86, 219, 0.22);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 4px;
}

.gaap-replay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.gaap-replay-label {
  font-size: 12px;
  font-weight: 600;
  color: #93c5fd;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.gaap-replay-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.38);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  transition: color 0.15s;
}
.gaap-replay-close:hover { color: #fff; }

.gaap-replay-content {
  font-size: 12px;
  line-height: 1.6;
  color: rgba(255,255,255,0.70);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
}

.gaap-replay-field { display: flex; flex-direction: column; gap: 2px; }
.gaap-replay-field-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.gaap-replay-field-value { color: #e8eaf0; font-size: 12px; }
.gaap-replay-field.full  { grid-column: 1 / -1; }

.gaap-drift-yes {
  display: inline-block;
  background: rgba(248,113,113,0.15);
  color: #f87171;
  border: 1px solid rgba(248,113,113,0.35);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 600;
}
.gaap-drift-no {
  display: inline-block;
  background: rgba(74,222,128,0.12);
  color: #4ade80;
  border: 1px solid rgba(74,222,128,0.28);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 600;
}

/* ── Responsive ────────────────────────────────────────── */

@media (max-width: 960px) {
  .upper-grid { grid-template-columns: 1fr; }
  .lower-grid { grid-template-columns: 1fr; }
  .kpi-strip  { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 600px) {
  main { padding: 16px 16px 40px; }
  .dash-header { padding: 0 16px; height: 72px; }
  .kpi-strip { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 28px; }
}
