:root {
  --ink: #121626;
  --muted: #647084;
  --surface: #ffffff;
  --surface-soft: #f6f7f9;
  --line: #dce3ee;
  --blue: #2f3191;
  --blue-deep: #172167;
  --cyan: #017c94;
  --teal: #00a883;
  --green: #23a455;
  --gold: #c98916;
  --red: #c94343;
  --shadow: 0 18px 48px rgba(17, 24, 39, 0.08);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--surface-soft);
  color: var(--ink);
}

body {
  min-height: 100vh;
  margin: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

svg {
  display: block;
}

.site-shell {
  min-height: 100vh;
}

.auth-view {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), transparent 42%),
    linear-gradient(135deg, rgba(0, 168, 131, 0.08), transparent 38%),
    linear-gradient(225deg, rgba(47, 49, 145, 0.1), transparent 42%),
    var(--surface-soft);
}

.brand-strip {
  position: absolute;
  inset: auto 0 0;
  height: 8px;
  background: linear-gradient(90deg, var(--cyan), var(--teal), var(--blue));
}

.auth-stage {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 34px 0 52px;
  display: flex;
  flex-direction: column;
}

.brand-header {
  display: flex;
  align-items: center;
}

.brand-logo {
  width: min(360px, 72vw);
  height: auto;
}

.auth-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 430px);
  gap: clamp(36px, 7vw, 88px);
  align-items: center;
}

.portal-copy {
  max-width: 720px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--cyan);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

.portal-copy h1,
.portal-intro h1 {
  margin-bottom: 20px;
  color: var(--blue-deep);
  font-size: clamp(2.5rem, 6.4vw, 5.35rem);
  line-height: 1;
  letter-spacing: 0;
}

.portal-copy p,
.portal-intro p {
  max-width: 640px;
  color: #4c5870;
  font-size: clamp(1.05rem, 2vw, 1.22rem);
  line-height: 1.6;
}

.trust-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 42px 0 0;
}

.trust-list div {
  border-top: 1px solid rgba(1, 124, 148, 0.28);
  padding-top: 16px;
}

.trust-list dt {
  color: var(--ink);
  font-weight: 800;
}

.trust-list dd {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.login-panel,
.access-panel {
  border: 1px solid rgba(220, 227, 238, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.login-panel {
  padding: clamp(24px, 4vw, 34px);
}

.panel-header h2,
.access-panel h2,
.section-heading h2 {
  margin: 0;
  color: var(--blue-deep);
  font-size: 1.45rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.login-form {
  margin-top: 30px;
}

.login-form label {
  display: block;
  margin-bottom: 10px;
  color: var(--ink);
  font-weight: 750;
}

.auth-step + .auth-step {
  margin-top: 18px;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  min-height: 56px;
  border: 1px solid #ccd5e1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.input-row:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(47, 49, 145, 0.12);
}

.input-row input {
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 0 16px;
  color: var(--ink);
  outline: 0;
}

.input-row input::placeholder {
  color: #96a1b3;
}

.icon-submit,
.icon-button {
  display: inline-grid;
  place-items: center;
  border: 0;
  color: var(--surface);
  background: var(--blue);
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.icon-submit:hover,
.icon-button:hover {
  background: var(--blue-deep);
}

.icon-submit:active,
.icon-button:active {
  transform: translateY(1px);
}

.icon-submit svg,
.icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.form-message {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--red);
  font-size: 0.94rem;
  line-height: 1.35;
}

.form-message.is-success {
  color: var(--green);
}

.text-button {
  border: 0;
  margin: 14px 0 0;
  padding: 0;
  color: var(--blue);
  background: transparent;
  font-size: 0.92rem;
  font-weight: 800;
}

.text-button:hover {
  color: var(--blue-deep);
}

.portal-view {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(47, 49, 145, 0.06), transparent 360px),
    var(--surface-soft);
}

.portal-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 86px;
  padding: 14px clamp(20px, 4vw, 54px);
  border-bottom: 1px solid rgba(220, 227, 238, 0.82);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}

.topbar-brand {
  display: inline-flex;
  min-width: 0;
}

.topbar-brand img {
  width: min(280px, 50vw);
  height: auto;
}

.session-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.user-pill {
  max-width: min(34vw, 360px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  color: #344054;
  background: var(--surface);
  font-size: 0.92rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: var(--radius);
}

.portal-main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(32px, 4.8vw, 52px) 0 64px;
}

.portal-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: clamp(28px, 5vw, 72px);
  align-items: end;
}

.portal-intro h1 {
  max-width: 760px;
  font-size: clamp(2.2rem, 5vw, 4.45rem);
}

.access-panel {
  padding: 24px;
}

.role-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(1, 124, 148, 0.24);
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--cyan);
  background: rgba(1, 124, 148, 0.08);
  font-size: 0.82rem;
  font-weight: 800;
}

.apps-section {
  margin-top: clamp(38px, 6vw, 70px);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.app-card {
  position: relative;
  display: grid;
  min-height: 252px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  overflow: hidden;
  color: inherit;
  background: var(--surface);
  box-shadow: 0 10px 34px rgba(17, 24, 39, 0.06);
  text-decoration: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.app-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--app-accent, var(--blue));
}

.app-card[href]:hover {
  border-color: rgba(47, 49, 145, 0.35);
  box-shadow: 0 18px 50px rgba(17, 24, 39, 0.12);
  transform: translateY(-2px);
}

.app-card.is-disabled {
  color: #667085;
  background: #f8fafc;
  border-color: #e4e7ec;
  box-shadow: none;
  cursor: not-allowed;
}

.app-card.is-disabled::before {
  background: #d0d5dd;
}

.app-card.is-disabled .app-icon {
  color: #98a2b3;
  background: #eef2f6;
}

.app-card.is-disabled .status-pill {
  border-color: #d0d5dd;
  color: #667085;
  background: #f2f4f7;
}

.app-card.is-disabled h3,
.app-card.is-disabled p,
.app-card.is-disabled .app-meta {
  color: #667085;
}

.app-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.app-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: var(--radius);
  color: var(--app-accent, var(--blue));
  background: color-mix(in srgb, var(--app-accent, var(--blue)) 12%, white);
}

.app-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--app-accent, var(--blue)) 24%, white);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--app-accent, var(--blue));
  background: color-mix(in srgb, var(--app-accent, var(--blue)) 8%, white);
  font-size: 0.75rem;
  font-weight: 850;
}

.app-card h3 {
  margin: 28px 0 10px;
  color: var(--blue-deep);
  font-size: 1.35rem;
  letter-spacing: 0;
}

.app-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.app-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  color: #4f5b70;
  font-size: 0.88rem;
  font-weight: 800;
}

.app-meta svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.empty-state {
  border: 1px dashed #b7c3d4;
  border-radius: var(--radius);
  padding: 34px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

[hidden] {
  display: none !important;
}

@supports not (background: color-mix(in srgb, red 10%, white)) {
  .app-icon,
  .status-pill {
    background: #f4f7fb;
  }
}

@media (max-width: 980px) {
  .auth-layout,
  .portal-intro {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .auth-layout {
    padding-top: 54px;
  }

  .trust-list {
    grid-template-columns: 1fr;
  }

  .app-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .auth-stage,
  .portal-main {
    width: min(100% - 28px, 1180px);
  }

  .auth-stage {
    padding-top: 24px;
  }

  .auth-layout {
    gap: 30px;
    padding-top: 38px;
  }

  .portal-copy h1,
  .portal-intro h1 {
    line-height: 1;
  }

  .login-panel {
    padding: 22px;
  }

  .portal-topbar {
    align-items: flex-start;
    flex-direction: column;
    min-height: auto;
    padding: 16px 14px;
  }

  .session-actions {
    width: 100%;
    justify-content: space-between;
  }

  .user-pill {
    max-width: calc(100% - 58px);
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .app-grid {
    grid-template-columns: 1fr;
  }

  .app-card {
    min-height: 228px;
  }
}
