:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #142640;
  background: #f3f6fb;
  --navy: #10243e;
  --blue: #345be3;
  --muted: #5b6e88;
  --line: #dce4ef;
  --surface: #fff;
  --green: #17684d;
  --amber: #82541b;
  --red: #a73042;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.55; min-height: 100vh; display: flex; flex-direction: column; }
button, a { font: inherit; touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }
button:focus-visible, a:focus-visible { outline: 3px solid #85a0ff; outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -.6px; line-height: 1.2; margin-bottom: 8px; }
h2 { font-size: 19px; line-height: 1.3; margin-bottom: 6px; }
p { color: var(--muted); margin-bottom: 12px; }

.portal-header {
  background: var(--navy);
  color: #fff;
  border-bottom: 1px solid #223b5e;
}
.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-size: 22px;
  letter-spacing: -.5px;
}
.brand strong { font-weight: 500; color: #b9caff; }
.brand small { display: block; font-size: 9px; letter-spacing: 2px; color: #b9c8dd; font-weight: 700; }
.brand-mark { font-size: 32px; line-height: 1; color: #c3d0ff; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.partner-identity { font-size: 13px; color: #d8e3f4; overflow-wrap: anywhere; }

.portal-main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 24px 20px 44px; flex: 1; }
.status-msg { min-height: 20px; font-size: 13px; margin: 0 0 14px; color: var(--muted); }
.status-msg.error { color: var(--red); font-weight: 600; }
.status-msg.success { color: var(--green); font-weight: 600; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 20px;
  min-width: 0;
}
.auth-card { max-width: 480px; margin: 36px auto; text-align: center; padding: 30px 24px; }
.eyebrow { font-size: 10px; font-weight: 800; letter-spacing: 1.6px; color: #59708f; margin: 0 0 6px; text-transform: uppercase; }
.google-slot { display: flex; justify-content: center; align-items: center; min-height: 46px; margin: 18px 0 10px; }
.helper { font-size: 12px; color: #6c7f97; margin: 6px 0 0; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 15px;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}
.button.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.button.primary:hover:not(:disabled) { background: #294bd1; }
.button.secondary { background: #fff; color: #26405d; border-color: #cbd7e7; }
.button.secondary:hover:not(:disabled) { background: #f2f6fc; }
.button.small { min-height: 34px; padding: 6px 11px; font-size: 12px; }
.portal-header .button.secondary { background: #20395c; color: #fff; border-color: #3a5780; }
.portal-header .button.secondary:hover:not(:disabled) { background: #2b4973; }

.referral-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: #edf3fd;
  border: 1px solid #d1dff8;
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 20px;
}
.code-pill {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 16px;
  font-weight: 750;
  color: var(--navy);
  background: #fff;
  border: 1px solid #c6d6f3;
  padding: 6px 12px;
  border-radius: 8px;
  letter-spacing: .5px;
}
.link-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.link-text {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  color: #264160;
  background: #fff;
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid #d4e0f3;
  overflow-wrap: anywhere;
}

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.metric-label { font-size: 12px; font-weight: 650; color: #5c718d; margin: 0 0 8px; }
.metric-value { font-size: 28px; line-height: 1.15; font-weight: 750; color: var(--navy); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-note { font-size: 11px; color: #73869d; margin: 8px 0 0; }

.table-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
th { font-size: 10px; letter-spacing: .7px; text-transform: uppercase; color: #647892; font-weight: 750; background: #f7f9fc; padding: 11px 14px; white-space: nowrap; }
td { padding: 12px 14px; border-top: 1px solid #e6ecf4; vertical-align: top; }
.numeric { font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 20px; background: #edf2fa; color: #45607f; white-space: nowrap; }
.badge.positive { background: #e5f3ec; color: #246b50; }
.badge.warning { background: #fff2d9; color: #8a6224; }
.badge.negative { background: #fcebee; color: #a53d51; }
.badge.info { background: #e7efff; color: #2346a8; }

.empty-state { padding: 24px 14px; text-align: center; color: var(--muted); }
.portal-footer {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: #71849d;
}
.noscript { margin: 0; padding: 16px; background: #fff0d7; color: #6b4413; text-align: center; }

@media (max-width: 900px) { .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) {
  .portal-main { padding: 16px 14px 32px; }
  .panel { padding: 16px; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-value { font-size: 24px; }
}
