:root {
  --navy: #103f78;
  --navy-deep: #092b54;
  --blue: #2167b2;
  --sky: #e9f4ff;
  --yellow: #ffd84d;
  --ink: #18304b;
  --muted: #687a8f;
  --line: #dce6f0;
  --paper: #ffffff;
  --page: #f3f8fc;
  --green: #1d9b68;
  --shadow: 0 18px 50px rgba(20, 58, 96, .14);
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

button, input, a { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 34rem;
  height: 34rem;
  border-radius: 50%;
  filter: blur(4px);
  opacity: .65;
}

.ambient-a {
  top: -18rem;
  right: -9rem;
  background: radial-gradient(circle, rgba(255,216,77,.4), rgba(255,216,77,0) 70%);
}

.ambient-b {
  bottom: -20rem;
  left: -12rem;
  background: radial-gradient(circle, rgba(33,103,178,.2), rgba(33,103,178,0) 70%);
}

.login-shell {
  width: min(1100px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 54px 0;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  align-items: center;
  gap: clamp(36px, 7vw, 88px);
}

.brand-lockup {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.brand-mark, .mini-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--navy);
  background: var(--yellow);
  border: 5px solid var(--navy);
  font-weight: 900;
}

.brand-mark {
  width: 86px;
  height: 86px;
  border-radius: 24px;
  font-size: 2.35rem;
  transform: rotate(-3deg);
  box-shadow: 7px 7px 0 var(--navy);
}

.mini-mark {
  width: 44px;
  height: 44px;
  border-width: 3px;
  border-radius: 13px;
  font-size: 1.2rem;
}

.brand-kicker, .eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .15em;
}

.login-brand h1 {
  margin: 0;
  max-width: 570px;
  color: var(--navy-deep);
  font-size: clamp(2.5rem, 5vw, 4.8rem);
  line-height: .99;
  letter-spacing: -.055em;
}

.brand-copy {
  max-width: 520px;
  margin: 28px 0 0 110px;
  color: var(--muted);
  font-size: 1.06rem;
}

.brand-grid {
  margin: 38px 0 0 110px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 500px;
}

.brand-grid span {
  padding: 12px 14px;
  border-left: 5px solid var(--yellow);
  background: rgba(255,255,255,.68);
  color: var(--navy);
  font-size: .9rem;
  font-weight: 800;
}

.login-card {
  width: 100%;
  max-width: 460px;
  margin-left: auto;
  padding: clamp(28px, 4vw, 44px);
  border: 1px solid rgba(16,63,120,.11);
  border-radius: 28px;
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
}

.mobile-logo { display: none; }
.login-card h2 { margin: 0; color: var(--navy-deep); font-size: 2rem; letter-spacing: -.03em; }
.muted { margin: 6px 0 24px; color: var(--muted); }

form { display: grid; }

label {
  margin: 14px 0 7px;
  color: var(--ink);
  font-size: .9rem;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 52px;
  padding: 0 15px;
  border: 2px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: #fbfdff;
  font-size: 1rem;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(33,103,178,.12);
}

.form-error {
  min-height: 24px;
  margin: 10px 0 2px;
  color: #b3261e;
  font-size: .88rem;
  font-weight: 700;
}

.primary-button, .continue-button, .app-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: var(--navy);
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(16,63,120,.19);
}

.primary-button { padding: 0 19px; }
.primary-button:hover, .continue-button:hover, .app-button:hover { background: var(--navy-deep); }
.primary-button:disabled { cursor: wait; opacity: .65; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 25px 0 16px;
  color: #8795a5;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }

.test-button {
  width: 100%;
  min-height: 68px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 13px;
  text-align: left;
  border: 2px dashed #90afd0;
  border-radius: 14px;
  color: var(--navy);
  background: #f4f9ff;
}

.test-button:hover { border-style: solid; background: var(--sky); }
.test-button strong, .test-button small { display: block; }
.test-button strong { font-size: .98rem; }
.test-button small { margin-top: 2px; color: var(--muted); font-size: .75rem; }
.test-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--yellow); font-size: 1.2rem; }
.test-note { margin: 8px 0 0; color: #8795a5; text-align: center; font-size: .75rem; }

.admin-entry {
  display: block;
  width: fit-content;
  margin: 18px auto 0;
  color: var(--navy);
  font-size: .9rem;
  font-weight: 900;
  text-decoration: none;
}
.admin-entry:hover { text-decoration: underline; }

.portal-shell { min-height: 100vh; padding-bottom: 56px; }

.test-banner {
  min-height: 38px;
  padding: 7px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--navy-deep);
  background: var(--yellow);
  font-size: .82rem;
}

.test-banner strong { padding: 2px 8px; border-radius: 5px; color: #fff; background: var(--navy); letter-spacing: .08em; }

.portal-header {
  min-height: 78px;
  padding: 13px max(22px, calc((100% - 1160px) / 2));
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.93);
}

.portal-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--navy);
  text-decoration: none;
}

.portal-logo > span:last-child { display: flex; flex-direction: column; line-height: 1; }
.portal-logo strong { font-size: 1.25rem; letter-spacing: .04em; }
.portal-logo small { margin-top: 4px; font-size: .62rem; font-weight: 900; letter-spacing: .2em; }

.header-person { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.header-person span { color: var(--muted); font-size: .75rem; }
.header-person strong { color: var(--navy); font-size: .9rem; }

.logout-button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--navy);
  background: #fff;
  font-weight: 800;
}

.welcome-row, .continue-card, .apps-section, .notice-card {
  width: min(1160px, calc(100% - 36px));
  margin-left: auto;
  margin-right: auto;
}

.welcome-row {
  padding: 42px 0 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.welcome-row h1 { margin: 0; color: var(--navy-deep); font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.04em; }
.welcome-row .muted { margin: 5px 0 0; }

.license-badge {
  min-width: 190px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid #bfe5d5;
  border-radius: 15px;
  background: #f0fbf7;
}

.license-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(29,155,104,.12); }
.license-badge span:last-child { display: flex; flex-direction: column; }
.license-badge small { color: #4a7566; }
.license-badge strong { color: #116344; }
.license-badge.expired { border-color: #efc2bf; background: #fff3f2; }
.license-badge.expired .license-dot { background: #c43a32; }
.license-badge.expired strong { color: #a42c25; }

.continue-card {
  padding: 22px 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(115deg, var(--navy-deep), var(--navy) 64%, #1d5fa7);
  box-shadow: 0 16px 34px rgba(9,43,84,.22);
}

.continue-symbol { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; color: var(--navy); background: var(--yellow); }
.continue-card .eyebrow { color: #9fc9f6; }
.continue-card h2 { margin: 0; font-size: 1.25rem; }
.continue-card p:last-child { margin: 4px 0 0; color: #c9ddf1; font-size: .88rem; }
.continue-button { min-width: 130px; padding: 0 17px; color: var(--navy-deep); background: var(--yellow); box-shadow: none; }
.continue-button:hover { background: #ffe374; }
.continue-card.expired {
  background: linear-gradient(115deg, #7a2622, #a73730 64%, #c65349);
}
.continue-card.expired .continue-symbol {
  color: #7a2622;
  background: #fff1d5;
}
.continue-card.expired .eyebrow { color: #ffd9d5; }
.continue-card.expired p:last-child { color: #ffe7e4; }

.apps-section { padding-top: 38px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; color: var(--navy-deep); font-size: 1.45rem; }
.overall-progress { color: var(--muted); font-size: .85rem; font-weight: 800; }

.app-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }

.app-card {
  --accent: #2167b2;
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 330px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--accent);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(20,58,96,.07);
}

.app-card:nth-child(2) { --accent: #e28b25; }
.app-card:nth-child(3) { --accent: #2b9a69; }
.app-card:nth-child(4) { --accent: #7653b5; }
.app-top { display: flex; justify-content: space-between; align-items: center; }
.app-number { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: #fff; background: var(--accent); font-weight: 900; }
.app-status { padding: 4px 8px; border-radius: 99px; color: #31664e; background: #eaf8f1; font-size: .68rem; font-weight: 900; }
.app-family { margin: 18px 0 1px; color: var(--accent); font-size: .72rem; font-weight: 900; letter-spacing: .11em; }
.app-title { margin: 0; color: var(--navy-deep); font-size: 1.2rem; line-height: 1.2; }
.app-description { min-height: 58px; margin: 9px 0 16px; color: var(--muted); font-size: .83rem; }
.progress-row { display: flex; justify-content: space-between; margin-top: auto; font-size: .78rem; }
.progress-row strong { color: var(--accent); }
.progress-track { height: 7px; margin: 7px 0 17px; overflow: hidden; border-radius: 99px; background: #e8eef4; }
.progress-fill { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .5s ease; }
.app-button { min-height: 44px; padding: 0 13px; justify-content: space-between; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, white); background: #fff; box-shadow: none; font-size: .83rem; }
.app-button:hover { color: #fff; background: var(--accent); }
.app-card.locked { opacity: .62; }
.app-card.locked .app-button { pointer-events: none; color: var(--muted); border-color: var(--line); }

.notice-card {
  margin-top: 24px;
  padding: 19px 22px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border: 1px solid #c9def2;
  border-radius: 16px;
  background: #eef7ff;
}

.notice-icon { display: grid; place-items: center; flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; color: #fff; background: var(--blue); font-weight: 900; }
.notice-card h2 { margin: 0; color: var(--navy); font-size: .95rem; }
.notice-card p { margin: 3px 0 0; color: #526c85; font-size: .86rem; }

@media (max-width: 920px) {
  .login-shell { grid-template-columns: 1fr; width: min(560px, calc(100% - 28px)); padding: 30px 0; }
  .login-brand { display: none; }
  .login-card { max-width: none; margin: 0; }
  .mobile-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; color: var(--navy); font-size: 1.15rem; }
  .app-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  .portal-header { grid-template-columns: 1fr auto; min-height: 68px; gap: 12px; padding: 10px 16px; }
  .header-person { display: none; }
  .welcome-row { padding-top: 28px; align-items: stretch; flex-direction: column; }
  .license-badge { width: 100%; }
  .continue-card { grid-template-columns: auto 1fr; padding: 18px; }
  .continue-button { grid-column: 1 / -1; width: 100%; }
  .app-grid { grid-template-columns: 1fr; }
  .app-card { min-height: 0; }
  .app-description { min-height: 0; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .test-banner { align-items: flex-start; gap: 6px; flex-direction: column; }
}

@media (max-width: 390px) {
  .login-shell { width: calc(100% - 20px); padding: 10px 0; }
  .login-card { padding: 22px 18px; border-radius: 20px; }
  .welcome-row, .continue-card, .apps-section, .notice-card { width: calc(100% - 24px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
