:root {
  --iq-navy: #0D2137;
  --iq-navy2: #16314f;
  --iq-primary: #0E7C7B;
  --iq-primary2: #5ED4D3;
  --piq-red: #C0392B;
}

body {
  background: var(--iq-navy);
  color: #eaf2f7;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ── Login page ─────────────────────────────────────────────── */
.login-root { display: flex; min-height: 100vh; }
.login-panel {
  position: relative; flex: 1.2; padding: 56px 64px; overflow: hidden;
  background: linear-gradient(160deg, var(--iq-navy) 0%, var(--iq-navy2) 100%);
  display: none;
}
@media (min-width: 900px) { .login-panel { display: block; } }
.login-panel-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; }
.brand-badge {
  display: inline-block; background: var(--iq-primary); color: #fff;
  font-weight: 700; letter-spacing: 1px; border-radius: 8px;
  padding: 6px 12px; position: relative;
}
.login-wordmark { font-size: 44px; font-weight: 800; margin-top: 18px; position: relative; }
.login-tagline { font-size: 20px; color: var(--iq-primary2); position: relative; }
.login-subhead { color: rgba(255, 255, 255, 0.75); max-width: 560px; position: relative; }
.login-features { margin-top: 32px; position: relative; }
.login-features .feature { display: flex; gap: 14px; margin-bottom: 18px; max-width: 560px; }
.login-features i { color: var(--iq-primary2); font-size: 20px; margin-top: 4px; width: 26px; }
.login-features strong { display: block; }
.login-features span { color: rgba(255, 255, 255, 0.65); font-size: 14px; }
.login-stats { display: flex; gap: 40px; margin-top: 36px; position: relative; }
.login-stats strong { font-size: 26px; display: block; color: var(--iq-primary2); }
.login-stats span { color: rgba(255, 255, 255, 0.6); font-size: 13px; }
.login-form-side { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-form-card {
  background: #fff; color: #1c2b36; border-radius: 12px; padding: 36px;
  width: 100%; max-width: 400px; box-shadow: 0 18px 60px rgba(0, 0, 0, 0.4);
}
.demo-login-link { color: var(--iq-primary); font-size: 14px; }
.powered-by-footnote { text-align: center; color: #9ab; font-size: 12px; margin-top: 22px; }

/* ── Hub page ───────────────────────────────────────────────── */
.hub-main { max-width: 1100px; margin: 0 auto; padding: 32px 24px; }
.hub-lede { color: rgba(255, 255, 255, 0.75); max-width: 760px; font-size: 16px; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-top: 24px; }
.hub-card {
  display: block; background: var(--iq-navy2); border-radius: 12px; padding: 22px;
  color: #eaf2f7; text-decoration: none; border: 1px solid rgba(94, 212, 211, 0.15);
  transition: border-color 0.15s, transform 0.15s;
}
.hub-card:hover { border-color: var(--iq-primary2); color: #fff; text-decoration: none; transform: translateY(-2px); }
.hub-card i { color: var(--iq-primary2); font-size: 26px; }
.hub-card h5 { margin-top: 12px; }
.hub-card p { color: rgba(255, 255, 255, 0.65); font-size: 14px; }
.hub-card-next { opacity: 0.75; }
.hub-chip {
  font-size: 12px; color: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 999px; padding: 3px 10px;
}
.hub-chip.live { color: var(--iq-primary2); border-color: var(--iq-primary); }
.hub-back { color: rgba(255, 255, 255, 0.75); font-size: 14px; margin-right: 4px; }
.hub-back:hover { color: #fff; text-decoration: none; }
.synthetic-chip { color: #f0c674; border-color: #8a7a3b; }

/* ── Demo page ──────────────────────────────────────────────── */
.piq-nav {
  background: var(--iq-navy2); padding: 12px 24px;
  display: flex; align-items: center; gap: 14px;
}
.piq-nav .wordmark { font-weight: 800; font-size: 20px; color: #fff; }
.piq-nav .model-chip {
  font-size: 12px; color: var(--iq-primary2);
  border: 1px solid var(--iq-primary); border-radius: 999px; padding: 3px 10px;
}
.piq-nav .spacer { flex: 1; }
.piq-nav .logout { color: rgba(255, 255, 255, 0.7); font-size: 14px; cursor: pointer; }

.demo-main { display: grid; grid-template-columns: 1.5fr 1fr; gap: 22px; padding: 24px; }
@media (max-width: 900px) { .demo-main { grid-template-columns: 1fr; } }

.monitor-controls { display: flex; align-items: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.monitor-note { color: rgba(255, 255, 255, 0.5); font-size: 13px; }

.clip-section h5 { color: var(--iq-primary2); margin: 18px 0 10px; }
.clip-card {
  background: var(--iq-navy2); border-radius: 10px; padding: 12px 16px;
  display: flex; align-items: center; gap: 14px; margin-bottom: 10px; flex-wrap: wrap;
}
.clip-card .clip-name { font-family: ui-monospace, monospace; font-size: 13px; min-width: 210px; }
.clip-card audio { height: 32px; flex: 1; min-width: 180px; }
.score-btn {
  background: var(--iq-primary); border: none; color: #fff;
  border-radius: 6px; padding: 6px 16px; font-size: 14px;
}
.score-btn:disabled { opacity: 0.6; }
.score-badge {
  font-weight: 700; border-radius: 6px; padding: 4px 10px; font-size: 14px;
  min-width: 118px; text-align: center;
}
.score-badge.normal { background: rgba(14, 124, 123, 0.25); color: var(--iq-primary2); }
.score-badge.anomalous { background: rgba(192, 57, 43, 0.25); color: #ff8a7a; }

/* Feed rows are one line each — drop the clip-card badge's block sizing. */
.sim-reading .score-badge { min-width: 0; padding: 1px 7px; font-size: 12px; margin-right: 6px; }

.detail-toggle { color: var(--iq-primary2); font-size: 13px; cursor: pointer; white-space: nowrap; }
.detail-toggle:hover { text-decoration: underline; }
.detail-panel { flex-basis: 100%; max-height: 260px; overflow-y: auto; margin-top: 8px; }
.detail-table { width: 100%; font-size: 12.5px; color: #dbe7ef; }
.detail-table th {
  color: rgba(255, 255, 255, 0.55); text-transform: uppercase; font-size: 11px;
  letter-spacing: 0.5px; padding: 4px 10px 4px 0; border-bottom: 1px solid rgba(94, 212, 211, 0.25);
  position: sticky; top: 0; background: var(--iq-navy2);
}
.detail-table td { padding: 4px 10px 4px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); font-family: ui-monospace, monospace; }

.mini-dash { display: flex; flex-direction: column; gap: 18px; }
.dash-card { background: var(--iq-navy2); border-radius: 10px; padding: 16px 18px; }
.dash-card h6 { color: rgba(255, 255, 255, 0.6); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.dash-stats { display: flex; gap: 26px; }
.dash-stats strong { font-size: 26px; display: block; color: var(--iq-primary2); }
.dash-stats .flagged strong { color: #ff8a7a; }
.dash-stats span { font-size: 12px; color: rgba(255, 255, 255, 0.6); }
.dash-figure img { width: 100%; border-radius: 6px; background: #fff; }
.dash-figure .placeholder { color: rgba(255, 255, 255, 0.45); font-size: 14px; }
.agent-model-chip {
  font-size: 11px; color: var(--iq-primary2); border: 1px solid var(--iq-primary);
  border-radius: 999px; padding: 1px 8px; margin-left: 8px; text-transform: none;
}
.agent-feed { max-height: 200px; overflow-y: auto; margin-bottom: 12px; }
.agent-feed .placeholder { color: rgba(255, 255, 255, 0.45); font-size: 13px; }
.agent-obs { font-size: 13px; margin-bottom: 8px; line-height: 1.5; }
.agent-obs .obs-time { color: rgba(255, 255, 255, 0.45); font-size: 11px; font-family: ui-monospace, monospace; margin-right: 6px; }
.agent-ask { display: flex; gap: 8px; }
.agent-ask input {
  background: var(--iq-navy); border: 1px solid rgba(94, 212, 211, 0.3);
  color: #eaf2f7;
}
.agent-ask input:focus { background: var(--iq-navy); color: #eaf2f7; border-color: var(--iq-primary2); box-shadow: none; }
.agent-answer { font-size: 13px; margin-top: 10px; color: var(--iq-primary2); line-height: 1.5; white-space: pre-wrap; }

.tm-console {
  font-family: ui-monospace, monospace; font-size: 12px; line-height: 1.7;
  max-height: 320px; overflow-y: auto;
}
.tm-console .anomalous { color: #ff8a7a; }
.tm-console .normal { color: var(--iq-primary2); }
