:root {
  --navy: #00275c;
  --navy-deep: #001230;
  --ink: #0d1526;
  --title: #00173a;
  --muted: #4a5468;
  --line: #c3c9d4;
  --rule: #e3e6eb;
  --ground: #eceef1;
  --tint: #ebf0f8;
  --blue: #1d5bb0;
  --error: #b42318;
  --error-bg: #fef3f2;
  --error-line: #f3b4ad;
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: 'Figtree', ui-sans-serif, system-ui, sans-serif;
}

a { color: var(--navy); }
a:hover { color: var(--blue); }

.page {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 clamp(20px, 6vw, 96px) 56px;
  display: flex;
  flex-direction: column;
}

/* Header */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 40px;
  padding: 36px 0 44px;
}
.top a { display: flex; align-items: center; min-height: 44px; }
.top img { height: 40px; width: auto; display: block; }
.top nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 40px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.top nav a { text-decoration: none; }

/* Layout */
.row {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: stretch;
}

/* Login card */
.card {
  flex: 1 1 380px;
  max-width: 460px;
  min-width: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.card form {
  padding: 48px 40px 40px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}
.card h1 {
  margin: 0;
  text-align: center;
  font-family: 'Bricolage Grotesque', 'Figtree', sans-serif;
  font-weight: 400;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--title);
}
.card h1 strong { font-weight: 700; color: var(--navy); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 500; color: var(--muted); }
.field .control { position: relative; display: flex; }
.field input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 44px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  font-size: 18px;
  color: var(--ink);
}
.field input:focus {
  outline: none;
  border-bottom-color: var(--navy);
  box-shadow: 0 1px 0 0 var(--navy);
}
.field input[aria-invalid="true"] {
  border-bottom-color: var(--error);
  box-shadow: 0 1px 0 0 var(--error);
}
.field input#password { padding-right: 64px; }
.show {
  position: absolute;
  right: 0;
  top: 0;
  height: 44px;
  min-width: 48px;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--navy);
  cursor: pointer;
  text-align: right;
}

.remember {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--navy);
  cursor: pointer;
}
.remember input { width: 22px; height: 22px; margin: 0; accent-color: var(--navy); }

.actions { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.primary {
  width: 220px;
  max-width: 100%;
  height: 54px;
  border: 0;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: background .15s ease;
}
.primary:hover { background: var(--navy-deep); }
.primary[aria-busy="true"] { cursor: progress; background: var(--navy); }
.primary:focus-visible, .show:focus-visible, .foot a:focus-visible, .top a:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 3px;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
}

/* Incorrect email / password */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
  padding: 14px 16px;
  background: var(--error-bg);
  border: 1px solid var(--error-line);
  color: var(--error);
  font-size: 15px;
  line-height: 1.45;
}
.alert[hidden] { display: none; }
.alert svg { flex: none; margin-top: 1px; }
.alert strong { display: block; font-weight: 700; }
.alert span { color: #7a271a; }

.foot { border-top: 1px solid var(--rule); font-size: 15px; font-weight: 700; letter-spacing: 0.02em; }
.foot a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 68px;
  padding: 0 12px;
  text-align: center;
  text-decoration: none;
}
.foot a:hover { background: #f6f7f9; }

/* Feature panel */
.panel {
  flex: 999 1 520px;
  min-width: 0;
  min-height: 600px;
  position: relative;
  overflow: hidden;
}
.panel .deco { position: absolute; }
.panel .note {
  position: absolute;
  top: clamp(32px, 5vw, 72px);
  right: 0;
  width: min(470px, 88%);
  background: var(--navy);
  color: #fff;
  padding: 40px 44px 44px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.panel .note h2 {
  margin: 0;
  font-family: 'Bricolage Grotesque', 'Figtree', sans-serif;
  font-weight: 400;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.panel .note p { margin: 0; font-size: 17px; line-height: 1.6; color: #dbe4f2; overflow-wrap: anywhere; }
.panel .name {
  position: absolute;
  left: clamp(24px, 4vw, 52px);
  font-family: 'Bricolage Grotesque', 'Figtree', sans-serif;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--navy);
}

/* Online panel */
.page-online .panel { background: #dbe4f2; }
.page-online .deco.rings-a {
  width: 1500px; height: 1500px; left: -520px; bottom: -900px; border-radius: 50%;
  background: repeating-radial-gradient(circle, rgba(0,39,92,0) 0 25px, rgba(0,39,92,0.16) 25px 26px);
}
.page-online .deco.rings-b {
  width: 900px; height: 900px; right: -380px; top: -520px; border-radius: 50%;
  background: repeating-radial-gradient(circle, rgba(29,91,176,0) 0 17px, rgba(29,91,176,0.24) 17px 18px);
}
.page-online .panel .name { bottom: 36px; font-size: clamp(72px, 9.5vw, 136px); line-height: 0.9; }

/* Research Portal panel */
.page-portal .panel { background: #f7f8fa; }
.page-portal .deco.grid-fine {
  inset: 0;
  background-image: linear-gradient(rgba(0,39,92,0.1) 1px, rgba(0,39,92,0) 1px), linear-gradient(90deg, rgba(0,39,92,0.1) 1px, rgba(0,39,92,0) 1px);
  background-size: 32px 32px;
}
.page-portal .deco.grid-major {
  inset: 0;
  background-image: linear-gradient(rgba(0,39,92,0.16) 1px, rgba(0,39,92,0) 1px), linear-gradient(90deg, rgba(0,39,92,0.16) 1px, rgba(0,39,92,0) 1px);
  background-size: 160px 160px;
}
.page-portal .deco.chart { inset: 0; width: 100%; height: 100%; }
.page-portal .panel .name {
  bottom: 40px;
  background: #fff;
  padding: 26px 36px 30px 32px;
  max-width: calc(100% - 48px);
  font-size: clamp(34px, 5.2vw, 76px);
  line-height: 1;
}

/* Page footer */
.bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 32px;
  padding-top: 28px;
  font-size: 13px;
  color: var(--muted);
}
.bottom nav { display: flex; flex-wrap: wrap; gap: 4px 24px; }
.bottom a { display: flex; align-items: center; min-height: 44px; }

@media (max-width: 960px) {
  .card { max-width: none; }
  .panel { min-height: 460px; }
}
@media (max-width: 520px) {
  .top { padding: 20px 0 24px; }
  .top img { height: 34px; }
  .top nav { gap: 0 24px; font-size: 12px; }
  .card form { padding: 36px 24px 32px; }
  .card h1 { font-size: 26px; }
  .panel .note { padding: 28px 24px 30px; }
  .panel .note h2 { font-size: 26px; }
  .primary { width: 100%; }
}

.nowrap { white-space: nowrap; }
