:root {
  --bg: #f7f9fd;
  --surface: #ffffff;
  --surface-soft: #eef4ff;
  --text: #151827;
  --muted: #667085;
  --primary: #3657d8;
  --primary-dark: #2843aa;
  --accent: #16847b;
  --success: #157a55;
  --danger: #be3455;
  --border: #e5e9f2;
  --shadow: 0 16px 40px rgba(28, 37, 64, 0.08);
  --shadow-strong: 0 24px 70px rgba(28, 37, 64, 0.13);
  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background:
    radial-gradient(circle at 18% 8%, rgba(54, 87, 216, 0.12), transparent 28rem),
    radial-gradient(circle at 86% 6%, rgba(22, 132, 123, 0.1), transparent 30rem),
    linear-gradient(180deg, #fbfdff 0%, #f5f8fe 48%, #f8fbff 100%);
  color: var(--text);
  font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html {
  overflow-x: hidden;
}

img,
svg,
canvas,
video {
  max-width: 100%;
}

button,
input,
select,
textarea {
  max-width: 100%;
}

body {
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.18) 46%, rgba(255, 255, 255, 0.58)),
    linear-gradient(180deg, rgba(248, 251, 255, 0.18), rgba(248, 251, 255, 0.72));
  pointer-events: none;
}

#med-scene {
  position: fixed;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-nav {
  display: none;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(1180px, calc(100% - 32px));
  margin: 12px auto 0;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 32px rgba(28, 33, 53, 0.08);
  backdrop-filter: blur(14px);
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
}

.site-logo-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--primary);
  color: white;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(79, 70, 229, 0.22);
}

.site-logo strong,
.site-logo small {
  display: block;
  line-height: 1.05;
}

.site-logo strong {
  font-size: 0.95rem;
}

.site-logo small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.site-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.site-links a {
  transition: color 0.2s ease;
}

.site-links a:hover,
.site-links a:focus-visible {
  color: var(--primary);
}

.nav-portal-button {
  min-width: max-content;
  min-height: auto;
  padding: 10px 14px;
}

.login-page,
.dashboard-page {
  width: min(1100px, calc(100% - 32px));
  min-height: calc(100vh - 78px);
  min-height: calc(100svh - 78px);
  margin: 0 auto;
  padding: 54px 0;
}

.login-page {
  display: grid;
  grid-template-columns: minmax(0, min(100%, 460px));
  justify-content: center;
  align-items: center;
  gap: clamp(14px, 3vw, 28px);
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(18px, 4vw, 44px) 0;
}

.login-page > *,
.dashboard-page > *,
.dashboard-grid > *,
.dashboard-stat-grid > * {
  min-width: 0;
}

.partner-cloud {
  width: 100%;
  max-width: 920px;
  min-width: 0;
  margin: 0 auto;
  padding: 0;
}

.partner-cloud-heading {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin: 0 auto 10px;
  text-align: center;
}

.partner-marquee {
  position: relative;
  overflow: hidden;
  contain: inline-size;
  width: 100%;
  min-width: 0;
  padding: 8px 0;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.44), rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.44)),
    rgba(255, 255, 255, 0.54);
  box-shadow: 0 18px 42px rgba(28, 37, 64, 0.08);
  mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent);
}

.partner-track {
  display: flex;
  width: max-content;
  gap: 18px;
  animation: partner-scroll 46s linear infinite;
  will-change: transform;
}

.partner-logo {
  display: grid;
  place-items: center;
  width: 148px;
  height: 76px;
  flex: 0 0 auto;
  background: transparent;
}

.partner-logo-wide {
  width: 148px;
}

.partner-logo img {
  max-width: 88%;
  max-height: 58px;
  object-fit: contain;
}

.dashboard-partner-cloud {
  width: 100%;
  margin: 22px 0 0;
  padding: 0;
}

.dashboard-partner-cloud .partner-marquee {
  padding: 6px 0;
  background: rgba(255, 255, 255, 0.52);
  box-shadow: 0 12px 34px rgba(28, 37, 64, 0.06);
}

.dashboard-partner-cloud .partner-logo {
  height: 62px;
}

.dashboard-partner-cloud .partner-logo img {
  max-height: 46px;
}

@keyframes partner-scroll {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(calc(-50% - 9px));
  }
}

.hidden {
  display: none !important;
}

[hidden],
.login-submit.hidden {
  display: none !important;
}

.page-exit {
  opacity: 0;
  filter: blur(6px);
  transform: translateY(-16px) scale(0.985);
  transition:
    opacity 260ms var(--ease-smooth),
    filter 260ms var(--ease-smooth),
    transform 260ms var(--ease-smooth);
}

.page-enter {
  animation: page-enter 560ms var(--ease-smooth) both;
}

.portal-loader {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(122, 112, 255, 0.2), transparent 34%),
    radial-gradient(circle at 80% 76%, rgba(54, 167, 216, 0.18), transparent 36%),
    rgba(248, 251, 255, 0.78);
  backdrop-filter: blur(18px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.portal-loader:not(.hidden) {
  opacity: 1;
}

.portal-loader-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 9px;
  min-width: min(320px, calc(100vw - 40px));
  padding: 34px 28px 30px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 30px 90px rgba(46, 65, 130, 0.18);
  color: var(--primary);
  font-weight: 900;
  animation: portal-card-arrive 560ms var(--ease-smooth) both;
}

.portal-loader-orbit {
  position: relative;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  margin-bottom: 6px;
  border-radius: 999px;
  background: conic-gradient(from 0deg, #3657d8, #8a7dff, #40b9da, #3657d8);
  box-shadow: 0 20px 44px rgba(79, 70, 229, 0.24);
  animation: portal-loader-spin 1.8s linear infinite;
}

.portal-loader-orbit::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.94);
}

.portal-loader-mark {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 21px;
  background: linear-gradient(135deg, var(--primary), #6f63ee);
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 950;
  letter-spacing: 0.1em;
  animation: portal-mark-hold 1.8s linear infinite;
}

.portal-loader p {
  margin: 0;
  color: var(--text);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.portal-loader small {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

@keyframes portal-card-arrive {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.94);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes portal-mark-hold {
  to {
    transform: rotate(-360deg);
  }
}

.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: block;
  padding: 20px;
  background: transparent;
  pointer-events: none;
  animation: tutorial-fade-in 220ms ease both;
}

.tutorial-overlay.hidden {
  display: none;
}

.tutorial-card {
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(520px, calc(100vw - 32px));
  padding: clamp(24px, 4vw, 34px);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 26px 80px rgba(24, 33, 58, 0.16);
  backdrop-filter: blur(16px);
  animation: tutorial-card-in 420ms var(--ease-smooth) both;
  transform: translate(-50%, -50%);
  transition: left 320ms var(--ease-smooth), top 320ms var(--ease-smooth), transform 320ms var(--ease-smooth);
  pointer-events: auto;
  z-index: 3;
}

.tutorial-spotlight {
  position: fixed;
  z-index: 2;
  border-radius: 22px;
  box-shadow:
    0 0 0 9999px rgba(248, 251, 255, 0.54),
    0 0 0 3px rgba(54, 87, 216, 0.26),
    0 20px 50px rgba(54, 87, 216, 0.16);
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 200ms ease,
    left 320ms var(--ease-smooth),
    top 320ms var(--ease-smooth),
    width 320ms var(--ease-smooth),
    height 320ms var(--ease-smooth);
}

.tutorial-spotlight.active {
  opacity: 1;
}

.tutorial-progress {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
}

.tutorial-progress span {
  width: 32px;
  height: 5px;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.16);
  transition: background 180ms ease, width 180ms ease;
}

.tutorial-progress span.active {
  width: 48px;
  background: var(--primary);
}

.tutorial-card h2 {
  margin: 10px 0 10px;
  font-size: clamp(1.9rem, 5vw, 2.7rem);
  line-height: 1;
}

.tutorial-card > p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.7;
}

.tutorial-action-hint {
  display: inline-flex;
  width: fit-content;
  margin-top: 16px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
  font-weight: 900;
}

.tutorial-action-hint.hidden {
  display: none;
}

.tutorial-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 28px;
}

.tutorial-actions div {
  display: flex;
  gap: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
  font-weight: 800;
}

.login-card {
  animation: auth-panel-in 520ms ease both;
}

.welcome-panel {
  display: contents;
}

.welcome-panel .brand,
.welcome-panel .eyebrow,
.welcome-panel h1,
.welcome-panel .intro,
.welcome-panel .connected-actions,
.welcome-panel .support-line {
  display: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  box-shadow: 0 10px 22px rgba(79, 70, 229, 0.24);
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
}

h1 {
  max-width: 620px;
  margin: 10px 0 16px;
  font-size: clamp(2.6rem, 4.2vw, 3.9rem);
  line-height: 1;
  letter-spacing: 0;
}

.intro {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.connected-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 24px 0 0;
}

.login-card {
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  text-shadow: 0 1px 18px rgba(255, 255, 255, 0.66);
}

.login-card h2 {
  margin: 0 0 8px;
  font-size: 1.85rem;
  letter-spacing: 0;
}

.login-card p {
  color: var(--muted);
  line-height: 1.65;
}

.support-line {
  max-width: 560px;
  margin: 26px 0 0;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.6;
}

.support-line a {
  color: var(--primary);
  font-weight: 900;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.button.primary {
  background: linear-gradient(135deg, var(--primary), #2746bd);
  color: white;
  box-shadow: 0 12px 24px rgba(54, 87, 216, 0.22);
}

.button.primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.button.secondary {
  background: rgba(54, 87, 216, 0.08);
  color: var(--primary);
}

.button.secondary:hover {
  background: rgba(54, 87, 216, 0.13);
}

.button.danger {
  min-height: 38px;
  padding: 0 14px;
  background: #fff6f8;
  color: var(--danger);
}

.button.danger:hover {
  background: rgba(190, 52, 85, 0.1);
}

.button.full {
  width: 100%;
  margin-top: 10px;
}

.login-card {
  border-radius: 0;
  padding: 0;
  margin-top: 0;
}

.login-card::before {
  content: "RSC Participant Portal";
  display: block;
  margin-bottom: 10px;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.login-card h2,
.login-card > p,
.card-badge {
  text-align: center;
}

.login-card h2 {
  font-size: clamp(2.35rem, 7vw, 3.35rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.login-card > p {
  max-width: 340px;
  margin: 0 auto 18px;
}

.login-card form {
  gap: 12px;
}

.login-step {
  display: none;
  animation: login-step-in 340ms var(--ease-smooth) both;
}

.login-step.active {
  display: grid;
  gap: 10px;
}

.inline-link {
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 850;
}

.selected-email {
  margin: 0 0 4px;
  color: var(--muted);
  font-weight: 750;
  overflow-wrap: anywhere;
}

.pin-heading {
  display: grid;
  justify-items: center;
  gap: 5px;
  margin: 2px 0 6px;
  text-align: center;
}

.pin-heading h3,
.pin-heading p {
  margin: 0;
}

.pin-heading h3 {
  color: var(--text);
  font-size: 1.28rem;
}

.pin-heading p {
  max-width: 330px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.pin-icon {
  display: grid;
  place-items: center;
  min-width: 62px;
  min-height: 42px;
  margin-bottom: 4px;
  padding: 0 10px;
  border-radius: 15px;
  background: rgba(54, 87, 216, 0.1);
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 950;
  letter-spacing: 0.14em;
}

.pin-icon-new {
  min-width: 46px;
  width: 46px;
  border-radius: 999px;
  font-size: 1.6rem;
  letter-spacing: 0;
}

.login-card .pin-input {
  padding: 0 16px;
  text-align: center;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  letter-spacing: 0.45em;
}

.pin-login-panel > .inline-link:last-child,
.pin-setup-panel > .inline-link:last-child {
  justify-self: center;
  margin-top: 3px;
}

.role-choice-panel h3 {
  margin: 2px 0 0;
  text-align: center;
  font-size: 1.2rem;
  line-height: 1.15;
}

.role-choice-panel > p:not(.selected-email) {
  margin: 0 auto 6px;
  max-width: 340px;
  text-align: center;
}

.role-choice-actions {
  display: grid;
  gap: 8px;
  margin: 12px 0 4px;
}

.role-choice-button {
  display: grid;
  position: relative;
  justify-items: start;
  min-height: 68px;
  padding: 13px 44px 13px 14px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 0 0 1px rgba(54, 87, 216, 0.08), 0 10px 24px rgba(31, 42, 68, 0.045);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.role-choice-button::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 15px;
  height: 15px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 2px rgba(54, 87, 216, 0.28);
  transform: translateY(-50%);
  transition: background 180ms ease, box-shadow 180ms ease;
}

.role-choice-button:hover {
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 0 0 1px rgba(54, 87, 216, 0.16), 0 14px 30px rgba(31, 42, 68, 0.065);
  transform: translateY(-1px);
}

.role-choice-button.selected {
  background: rgba(54, 87, 216, 0.1);
  box-shadow: inset 0 0 0 2px rgba(54, 87, 216, 0.34), 0 16px 34px rgba(54, 87, 216, 0.09);
}

.role-choice-button.selected::after {
  background: var(--primary);
  box-shadow: inset 0 0 0 4px #ffffff, 0 0 0 2px rgba(54, 87, 216, 0.34);
}

.role-choice-button strong,
.role-choice-button span {
  display: block;
}

.role-choice-button span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
  line-height: 1.35;
}

#role-choice-continue {
  margin-top: 8px;
}

#role-choice-continue:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.login-card input {
  transition:
    background 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.password-field {
  position: relative;
  display: grid;
}

.password-field input {
  padding-right: 78px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: rgba(54, 87, 216, 0.08);
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 850;
  transform: translateY(-50%);
}

.password-toggle:hover {
  background: rgba(54, 87, 216, 0.13);
}

.login-card input:focus {
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(54, 87, 216, 0.12), 0 14px 28px rgba(28, 33, 53, 0.08);
  transform: translateY(-1px);
}

.login-submit {
  position: relative;
  overflow: hidden;
  min-height: 54px;
}

.login-submit::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.28) 45%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 520ms ease;
}

.login-submit:hover::after {
  transform: translateX(120%);
}

@keyframes auth-panel-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes page-enter {
  from {
    opacity: 0;
    filter: blur(5px);
    transform: translateY(22px) scale(0.992);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1);
  }
}

@keyframes portal-loader-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes tutorial-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes tutorial-card-in {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 18px)) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes login-step-in {
  from {
    opacity: 0;
    filter: blur(4px);
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@keyframes route-in {
  from {
    opacity: 0;
    filter: blur(4px);
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@keyframes card-lift-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-page {
  display: block;
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

.dashboard-page.hidden {
  display: none;
}

#dashboard-page {
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(54, 87, 216, 0.34) transparent;
}

#dashboard-page::-webkit-scrollbar {
  width: 8px;
}

#dashboard-page::-webkit-scrollbar-track {
  background: transparent;
}

#dashboard-page::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(54, 87, 216, 0.28);
}

#dashboard-page::-webkit-scrollbar-thumb:hover {
  background: rgba(54, 87, 216, 0.46);
}

.dashboard-card {
  min-width: 0;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  padding: 92px clamp(22px, 5vw, 76px) 58px;
  border-radius: 0;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.88), rgba(247, 250, 255, 0.66) 48%, rgba(255, 255, 255, 0.76)),
    radial-gradient(circle at 78% 0%, rgba(22, 132, 123, 0.08), transparent 28rem);
  box-shadow: none;
}

.dashboard-top {
  position: fixed;
  inset: 20px 22px auto 22px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 0;
  pointer-events: none;
}

.dashboard-top .brand {
  display: none;
}

.dashboard-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  gap: 12px;
  pointer-events: none;
}

.dashboard-actions > * {
  pointer-events: auto;
}

.dashboard-top > .sidebar-toggle {
  pointer-events: auto;
}

.dashboard-actions .sidebar-toggle {
  order: 0;
  flex: 0 0 auto;
}

.dashboard-actions .ui-mode-switch {
  order: 1;
}

.dashboard-actions #logout-button,
.dashboard-actions #admin-logout-button {
  order: 2;
  margin-left: auto;
}

.ui-mode-switch {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  min-width: 206px;
  min-height: 46px;
  padding: 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, #7c3aed, #a020f0);
  box-shadow: 0 12px 26px rgba(124, 58, 237, 0.22);
}

.ui-mode-switch button {
  position: relative;
  z-index: 1;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 900;
}

.ui-mode-switch button.active {
  background: #ffffff;
  color: #7c3aed;
  box-shadow: 0 8px 18px rgba(49, 46, 129, 0.18);
}

.sidebar-toggle,
.sidebar-close {
  border: 0;
  appearance: none;
  cursor: pointer;
  font: inherit;
}

.sidebar-toggle {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  color: #111827;
  box-shadow: 0 14px 34px rgba(17, 24, 39, 0.1);
  backdrop-filter: blur(12px);
  transition: background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.sidebar-toggle:hover {
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(17, 24, 39, 0.14);
  transform: translateY(-1px);
}

.sidebar-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.portal-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: min(340px, calc(100vw - 42px));
  max-width: 100%;
  overflow-y: auto;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 255, 0.96));
  box-shadow: 26px 0 80px rgba(17, 24, 39, 0.14);
  transform: translateX(-104%);
  transition: transform 360ms var(--ease-smooth), opacity 260ms var(--ease-smooth);
  opacity: 0;
}

.portal-sidebar.open {
  transform: translateX(0);
  opacity: 1;
}

.portal-sidebar.hidden {
  display: none;
}

.portal-sidebar-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}

.portal-sidebar-top strong,
.portal-sidebar-top small {
  display: block;
}

.portal-sidebar-top strong {
  font-size: 1.1rem;
}

.portal-sidebar-top small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 750;
}

.sidebar-close {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.07);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 850;
}

.portal-switch-link,
.portal-sidebar a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 850;
  text-decoration: none;
  text-align: left;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.portal-switch-link {
  margin-top: 8px;
  background: rgba(54, 87, 216, 0.08);
  color: var(--primary);
}

.portal-switch-link::after {
  content: ">";
  margin-left: auto;
  font-weight: 900;
}

.portal-switch-link:hover,
.portal-sidebar a:hover,
.portal-sidebar a.active {
  background: rgba(54, 87, 216, 0.1);
  color: var(--primary);
  transform: translateX(3px);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  background: rgba(17, 24, 39, 0.18);
  backdrop-filter: blur(6px);
}

.sidebar-backdrop.open {
  display: block;
}

.portal-route {
  display: none;
}

.portal-route.active {
  display: block;
  grid-column: 1 / -1;
  min-width: 0;
  animation: route-in 420ms var(--ease-smooth) both;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 18px;
  margin-top: 30px;
}

.portal-route[data-portal-route="teams"] article,
.portal-route[data-portal-route="changepass"] article,
.portal-route[data-portal-route="announcements"] article,
.portal-route[data-portal-route="letters"] article,
.portal-route[data-portal-route="questions"] article,
.portal-route[data-portal-route="activity"] article {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(320px, 1.15fr);
  gap: 28px;
  align-items: start;
}

.portal-route[data-portal-route="accounts"] article,
.portal-route[data-portal-route="resources"] article {
  grid-column: 1 / -1;
}

.portal-route[data-portal-route="teams"] article > span,
.portal-route[data-portal-route="teams"] article > h2,
.portal-route[data-portal-route="teams"] article > form,
.portal-route[data-portal-route="changepass"] article > span,
.portal-route[data-portal-route="changepass"] article > h2,
.portal-route[data-portal-route="changepass"] article > p,
.portal-route[data-portal-route="changepass"] article > form,
.portal-route[data-portal-route="changepass"] article > .form-message {
  grid-column: 1;
}

.portal-route[data-portal-route="teams"] article > .record-list,
.portal-route[data-portal-route="changepass"] article > .pin-settings-card,
.portal-route[data-portal-route="announcements"] article > .announcement-manager,
.portal-route[data-portal-route="letters"] article > .announcement-manager,
.portal-route[data-portal-route="questions"] article > .question-manager,
.portal-route[data-portal-route="activity"] article > .record-list {
  grid-column: 2;
  grid-row: 1 / span 6;
  margin-top: 0;
}

.portal-route[data-portal-route="announcements"] article > form,
.portal-route[data-portal-route="letters"] article > form {
  grid-column: 1;
}

.portal-route[data-portal-route="announcements"] article > span,
.portal-route[data-portal-route="announcements"] article > h2,
.portal-route[data-portal-route="letters"] article > span,
.portal-route[data-portal-route="letters"] article > h2,
.portal-route[data-portal-route="questions"] article > span,
.portal-route[data-portal-route="questions"] article > h2,
.portal-route[data-portal-route="questions"] article > p,
.portal-route[data-portal-route="activity"] article > span,
.portal-route[data-portal-route="activity"] article > h2,
.portal-route[data-portal-route="activity"] article > p {
  grid-column: 1;
}

.dashboard-grid article {
  min-width: 0;
  min-height: 180px;
  width: 100%;
  padding: 22px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 14px 38px rgba(31, 42, 68, 0.055);
  backdrop-filter: blur(14px);
  animation: card-lift-in 460ms var(--ease-smooth) both;
  transition:
    background 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.dashboard-grid article:hover {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 20px 52px rgba(31, 42, 68, 0.085);
  transform: translateY(-2px);
}

.dashboard-grid span {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.dashboard-grid h2 {
  margin: 10px 0 6px;
  font-size: 1.25rem;
}

.dashboard-grid p {
  color: var(--muted);
  line-height: 1.55;
}

.dashboard-grid a {
  color: var(--primary);
  font-weight: 800;
}

.dashboard-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: 12px;
  margin: 22px 0 18px;
}

.dashboard-stat-grid a {
  min-height: 118px;
  padding: 18px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 14px 34px rgba(31, 42, 68, 0.055);
  color: var(--text);
  backdrop-filter: blur(14px);
  transition: background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.dashboard-stat-grid a:hover {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 20px 48px rgba(31, 42, 68, 0.085);
  transform: translateY(-2px);
}

.dashboard-stat-grid strong {
  display: block;
  color: var(--primary);
  font-size: clamp(1.9rem, 5vw, 3rem);
  line-height: 0.95;
}

.dashboard-stat-grid span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-visibility-panel {
  margin-top: 24px;
  padding-top: 8px;
}

.developer-panel {
  margin-top: 20px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(17, 24, 39, 0.055);
}

.developer-panel.hidden {
  display: none;
}

.developer-panel h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.developer-panel p {
  margin: 0 0 12px;
}

.page-visibility-panel h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.page-visibility-panel p {
  margin-top: 0;
}

.page-visibility-panel form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.visibility-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 84px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 14px 32px rgba(31, 42, 68, 0.05);
}

.role-visibility-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.role-visibility-options span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(54, 87, 216, 0.07);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 900;
}

.role-visibility-options input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--primary);
  box-shadow: none;
}

.visibility-toggle input {
  width: 22px;
  min-height: 22px;
  accent-color: var(--primary);
  box-shadow: none;
}

.visibility-toggle strong,
.visibility-toggle small {
  display: block;
}

.visibility-toggle small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 700;
}

.page-visibility-panel .form-message {
  grid-column: 1 / -1;
}

.account-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 12px 0 4px;
}

.account-summary div {
  min-width: 0;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.92);
}

.account-summary dt {
  color: var(--primary);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.account-summary dd {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 750;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.card-badge {
  display: block;
  margin-bottom: 18px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

form {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.password-change-form {
  margin-top: 18px;
}

.password-change-form.hidden {
  display: none;
}

.pin-settings-card {
  display: grid;
  gap: 10px;
  padding: 24px;
  border: 1px solid rgba(54, 87, 216, 0.12);
  border-radius: 22px;
  background:
    radial-gradient(circle at 100% 0%, rgba(118, 105, 255, 0.13), transparent 40%),
    rgba(255, 255, 255, 0.68);
  box-shadow: 0 18px 42px rgba(31, 42, 68, 0.07);
}

.pin-settings-card h3,
.pin-settings-card p {
  margin: 0;
}

.pin-settings-card > p {
  color: var(--muted);
  line-height: 1.5;
}

.pin-settings-icon {
  display: grid;
  place-items: center;
  width: fit-content;
  min-width: 66px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 14px;
  background: rgba(54, 87, 216, 0.1);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 950;
  letter-spacing: 0.14em;
}

.pin-settings-form {
  margin-top: 6px;
}

.pin-settings-form.hidden {
  display: none;
}

.pin-settings-form .pin-input {
  text-align: center;
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  letter-spacing: 0.4em;
}

label {
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 0;
  border-radius: 12px;
  color: var(--text);
  font: inherit;
}

input,
select {
  min-height: 50px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 0 0 1px rgba(226, 229, 239, 0.72);
  backdrop-filter: blur(12px);
}

textarea {
  min-height: 120px;
  padding: 14px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(99, 91, 255, 0.18);
  border-color: var(--primary);
}

.team-pill {
  display: inline-flex;
  width: fit-content;
  margin-top: 18px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary);
  font-weight: 800;
}

.team-pill.hidden {
  display: none;
}

.important-banner {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-top: 22px;
  padding: 16px 18px;
  border: 1px solid rgba(190, 52, 85, 0.25);
  border-left: 5px solid var(--danger);
  border-radius: 16px;
  background: #fff6f8;
  color: var(--text);
  cursor: pointer;
}

.important-banner.hidden {
  display: none;
}

.important-banner:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.28);
  outline-offset: 3px;
}

.important-banner > span,
.important-label {
  display: inline-flex;
  width: fit-content;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(190, 52, 85, 0.1);
  color: var(--danger);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.important-banner strong {
  display: block;
  margin-bottom: 4px;
}

.important-banner p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-wrap;
}

code {
  padding: 2px 6px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--primary);
  font-size: 0.86em;
  font-weight: 800;
}

.form-message {
  min-height: 24px;
  margin: 8px 0 0;
  font-weight: 700;
}

.small-note {
  margin: 6px 0 0;
  font-size: 0.9rem;
}

.score-generated-actions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.participant-picker-tools {
  display: grid;
  gap: 8px;
}

.participant-picker-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.participant-picker-actions .button {
  min-height: 38px;
  padding: 9px 12px;
}

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

.form-message.error {
  color: var(--danger);
}

.record-list {
  display: grid;
  gap: 8px;
  max-height: 300px;
  margin: 16px 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.record-list li {
  padding: 11px 12px;
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.92);
  color: var(--muted);
  line-height: 1.45;
}

.record-list strong {
  display: block;
  color: var(--text);
}

.record-list .record-body {
  display: block;
  white-space: pre-wrap;
}

.announcement-summary {
  display: grid;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-align: left;
  cursor: pointer;
}

.announcement-summary:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.28);
  outline-offset: 3px;
  border-radius: 8px;
}

#participant-updates-see-all {
  min-height: 42px;
  margin-top: 10px;
}

.record-list .important-label {
  margin-top: 8px;
}

.record-list time {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

.announcement-manager {
  margin-top: 22px;
  padding-top: 18px;
}

.question-manager-card {
  grid-column: span 2;
}

.question-manager {
  margin-top: 22px;
  padding-top: 18px;
}

.announcement-manager h3,
.question-manager h3 {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
}

.record-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.question-list {
  max-height: 360px;
}

.question-list li {
  background: white;
}

.question-contact {
  margin-top: 7px;
  color: var(--primary);
  font-weight: 800;
}

.question-resolved-meta {
  margin-top: 8px;
  font-size: 0.86rem;
}

.letters-card {
  overflow: hidden;
}

.letter-stack {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.letter-stack > p {
  margin: 0;
  color: var(--muted);
}

.letter-card {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  width: 100%;
  padding: 14px;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(247, 248, 251, 0.96)),
    radial-gradient(circle at top left, rgba(79, 70, 229, 0.14), transparent 42%);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(44, 37, 92, 0.08);
}

.letter-card.unread {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 247, 255, 0.98)),
    radial-gradient(circle at top left, rgba(79, 70, 229, 0.2), transparent 44%);
}

.letter-card:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.28);
  outline-offset: 3px;
}

.letter-card-envelope {
  position: relative;
  display: block;
  width: 96px;
  height: 62px;
  overflow: visible;
}

.letter-card-envelope span {
  position: absolute;
  display: block;
}

.mini-envelope-back {
  inset: 13px 4px 5px;
  z-index: 1;
  border-radius: 9px;
  background: linear-gradient(160deg, #9a93fb, #4f46e5);
  box-shadow: 0 12px 22px rgba(41, 35, 125, 0.18);
}

.mini-envelope-left {
  left: 4px;
  bottom: 5px;
  z-index: 4;
  width: calc(50% - 4px);
  height: 34px;
  clip-path: polygon(0 0, 100% 100%, 0 100%);
  border-radius: 0 0 0 9px;
  background: linear-gradient(160deg, #6f66ed, #4038bd);
}

.mini-envelope-right {
  right: 4px;
  bottom: 5px;
  z-index: 4;
  width: calc(50% - 4px);
  height: 34px;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  border-radius: 0 0 9px 0;
  background: linear-gradient(160deg, #8d85f7, #4f46e5);
}

.mini-envelope-front {
  inset: 22px 4px 5px;
  z-index: 5;
  clip-path: polygon(0 0, 50% 58%, 100% 0, 100% 100%, 0 100%);
  border-radius: 0 0 9px 9px;
  background: linear-gradient(160deg, #7c73f2, #4038bd);
}

.mini-envelope-flap {
  left: 4px;
  right: 4px;
  top: 13px;
  z-index: 6;
  height: 29px;
  clip-path: polygon(0 0, 50% 100%, 100% 0);
  border-radius: 9px 9px 0 0;
  background: linear-gradient(180deg, #dfe1ff, #7c73f2);
}

.letter-card-content {
  display: grid;
  gap: 3px;
}

.letter-card-content strong {
  color: var(--text);
}

.letter-card-content span,
.letter-card-content time {
  color: var(--muted);
  font-size: 0.9rem;
}

.unread-label {
  display: inline-flex;
  width: fit-content;
  margin-top: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.12);
  color: var(--primary);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.announcement-image {
  display: block;
  width: 100%;
  max-height: 180px;
  margin: 10px 0;
  object-fit: cover;
  border-radius: 14px;
}

.announcement-dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 32px));
  padding: 24px;
  border: 0;
  border-radius: 18px;
  background: white;
  color: var(--text);
  box-shadow: var(--shadow-strong);
}

.announcement-dialog::backdrop {
  background: rgba(23, 24, 39, 0.42);
}

.announcement-dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.announcement-dialog h2 {
  margin: 0 0 6px;
  font-size: 1.45rem;
}

.announcement-dialog time {
  display: block;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.announcement-dialog p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  white-space: pre-wrap;
}

.announcement-dialog img {
  display: block;
  width: 100%;
  max-height: 360px;
  margin-top: 18px;
  object-fit: contain;
  border-radius: 14px;
}

.letter-dialog {
  width: min(720px, calc(100vw - 32px));
  min-height: 540px;
  max-height: min(760px, calc(100vh - 32px));
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
  color: var(--text);
}

.letter-dialog::backdrop {
  background: rgba(23, 24, 39, 0.5);
}

.letter-scene {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  place-items: center;
  min-height: 540px;
  padding: 28px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 24px;
  background:
    linear-gradient(135deg, #ffffff, #eef0ff),
    radial-gradient(circle at top left, rgba(79, 70, 229, 0.2), transparent 44%);
  box-shadow: var(--shadow-strong);
}

.letter-opening-header {
  position: relative;
  z-index: 4;
  max-width: 520px;
  margin-bottom: 22px;
  text-align: center;
  transition:
    opacity 0.4s ease 0.95s,
    transform 0.4s ease 0.95s;
}

.letter-opening-header p {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.3rem, 3vw, 1.85rem);
  font-weight: 900;
  line-height: 1.25;
}

.letter-envelope {
  position: relative;
  z-index: 4;
  width: min(420px, 84vw);
  height: 270px;
  border: 0;
  background: transparent;
  cursor: pointer;
  perspective: 900px;
  transition:
    opacity 0.7s ease 1.35s,
    transform 0.9s ease 1.1s;
}

.letter-envelope:disabled {
  cursor: default;
}

.letter-envelope span {
  position: absolute;
  display: block;
}

.envelope-back {
  inset: 58px 20px 24px;
  z-index: 1;
  border-radius: 18px;
  background: linear-gradient(160deg, #9a93fb, #4f46e5);
  box-shadow: 0 28px 54px rgba(41, 35, 125, 0.24);
}

.envelope-paper {
  left: 54px;
  right: 54px;
  top: 96px;
  z-index: 2;
  display: block;
  height: 150px;
  border: 1px solid rgba(79, 70, 229, 0.22);
  border-radius: 14px;
  background:
    linear-gradient(#fffef8, #fff8df),
    repeating-linear-gradient(transparent 0 26px, rgba(79, 70, 229, 0.08) 27px);
  box-shadow: 0 14px 24px rgba(41, 35, 125, 0.14);
  opacity: 0;
  transition:
    opacity 0.5s ease 0.9s,
    top 1.2s ease 0.85s,
    transform 1.2s ease 0.85s;
}

.envelope-front {
  inset: 96px 20px 24px;
  z-index: 5;
  clip-path: polygon(0 0, 50% 58%, 100% 0, 100% 100%, 0 100%);
  border-radius: 0 0 18px 18px;
  background: linear-gradient(160deg, #7c73f2, #4038bd);
}

.envelope-left {
  left: 20px;
  bottom: 24px;
  z-index: 4;
  width: calc(50% - 20px);
  height: 150px;
  clip-path: polygon(0 0, 100% 100%, 0 100%);
  border-radius: 0 0 0 18px;
  background: linear-gradient(160deg, #6f66ed, #4038bd);
}

.envelope-right {
  right: 20px;
  bottom: 24px;
  z-index: 4;
  width: calc(50% - 20px);
  height: 150px;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  border-radius: 0 0 18px 0;
  background: linear-gradient(160deg, #8d85f7, #4f46e5);
}

.envelope-flap {
  left: 20px;
  right: 20px;
  top: 58px;
  z-index: 6;
  height: 126px;
  transform-origin: top center;
  clip-path: polygon(0 0, 50% 100%, 100% 0);
  border-radius: 18px 18px 0 0;
  background: linear-gradient(180deg, #dfe1ff, #7c73f2);
  transition:
    opacity 0.35s ease 0.86s,
    transform 1.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.letter-paper-full {
  position: absolute;
  top: 250px;
  left: 50%;
  z-index: 2;
  width: min(320px, calc(100% - 120px));
  height: 180px;
  max-height: calc(100% - 60px);
  padding: 28px;
  overflow: auto;
  border: 1px solid rgba(79, 70, 229, 0.22);
  border-radius: 20px;
  background:
    linear-gradient(#fffef8, #fff9e8),
    repeating-linear-gradient(transparent 0 31px, rgba(79, 70, 229, 0.08) 32px);
  box-shadow: 0 22px 42px rgba(44, 37, 92, 0.14);
  opacity: 0;
  transform: translate(-50%, 0) scale(0.88);
  transition:
    top 1.05s ease 0.82s,
    width 1.05s ease 1.18s,
    height 1.05s ease 1.18s,
    opacity 0.45s ease 0.72s,
    transform 1.05s ease 0.82s;
}

.letter-dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.letter-paper-full h2 {
  margin: 0 0 6px;
  font-size: 1.55rem;
}

.letter-paper-full time {
  display: block;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.letter-paper-full p {
  margin: 0;
  color: #36313d;
  line-height: 1.7;
  white-space: pre-wrap;
}

.letter-scene.opened .envelope-flap {
  opacity: 0;
  transform: rotateX(174deg);
}

.letter-scene.opened .letter-opening-header {
  opacity: 0;
  transform: translateY(-14px);
}

.letter-scene.opened .envelope-paper {
  top: -92px;
  z-index: 7;
  opacity: 1;
  transform: scale(0.92) translateY(-8px);
}

.letter-scene.opened .letter-envelope {
  opacity: 0;
  transform: translateY(148px) scale(0.86);
  pointer-events: none;
}

.letter-scene.opened .letter-paper-full {
  z-index: 3;
  top: 30px;
  width: calc(100% - 60px);
  height: calc(100% - 60px);
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.account-card-output {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.account-card-output.hidden {
  display: none;
}

.account-card-output img {
  width: 100%;
  border-radius: 18px;
  box-shadow: 0 12px 28px rgba(44, 37, 92, 0.14);
}

.account-card-actions {
  display: grid;
  gap: 10px;
}

.resource-center {
  grid-column: span 2;
}

.resource-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.resource-links a,
.table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  background: rgba(79, 70, 229, 0.08);
  color: var(--primary);
  font-weight: 900;
}

.qr-code-card {
  grid-column: span 2;
}

.qr-code-panel {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin-top: 18px;
}

.qr-code-frame {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 18px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(54, 87, 216, 0.12), 0 18px 42px rgba(28, 37, 64, 0.08);
}

.qr-code-frame img {
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.qr-code-details {
  margin: 0;
}

.qr-code-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.checkin-notice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  margin: 0 0 18px;
  padding: 16px 18px;
  border-radius: 8px;
  background: #ecfdf5;
  color: #064e3b;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.24), 0 18px 40px rgba(6, 78, 59, 0.08);
}

.checkin-notice > span {
  display: inline-grid;
  place-items: center;
  min-width: 78px;
  min-height: 34px;
  border-radius: 999px;
  background: #10b981;
  color: #ffffff;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.78rem;
}

.checkin-notice strong {
  display: block;
  font-size: 1.05rem;
}

.checkin-notice p {
  margin: 4px 0 0;
  color: #047857;
  font-weight: 700;
}

.qr-scan-card {
  grid-column: span 2;
}

.qr-scanner-layout {
  display: grid;
  grid-template-columns: minmax(260px, 440px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin-top: 18px;
}

.qr-scanner-panel {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 320px;
  overflow: hidden;
  border-radius: 8px;
  background: #0f172a;
  box-shadow: inset 0 0 0 1px rgba(54, 87, 216, 0.12), 0 18px 42px rgba(28, 37, 64, 0.08);
}

.qr-scanner-panel::after {
  content: "";
  position: absolute;
  inset: 18%;
  border: 2px dashed rgba(255, 255, 255, 0.72);
  border-radius: 14px;
  box-shadow: 0 0 0 999px rgba(15, 23, 42, 0.12);
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.qr-scanner-panel.scanner-active:not(.qr-tracking)::after {
  opacity: 0.62;
  transform: scale(1);
}

.qr-scanner-panel.qr-detected {
  box-shadow:
    inset 0 0 0 2px rgba(74, 222, 128, 0.78),
    0 0 32px rgba(34, 197, 94, 0.32);
}

.qr-scanner-panel video {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
}

.qr-tracking-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.qr-scanner-placeholder {
  position: absolute;
  inset: 18px;
  z-index: 3;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.74);
  font-weight: 800;
  text-align: center;
}

.qr-scanner-controls {
  display: grid;
  gap: 10px;
}

.qr-scan-result {
  margin-top: 20px;
  padding: 18px;
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.92);
  box-shadow: inset 0 0 0 1px rgba(54, 87, 216, 0.12);
}

.qr-scan-result h3 {
  margin: 10px 0 12px;
  font-size: 1.45rem;
}

.checkin-table-card {
  margin-top: 20px;
}

.checkin-table-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.checkin-table-heading h3 {
  margin: 0;
  font-size: 1.12rem;
}

.checkin-table-heading p {
  margin: 4px 0 0;
  color: #64748b;
  font-weight: 700;
}

.checkin-table th:nth-child(1),
.checkin-table td:nth-child(1),
.checkin-table th:nth-child(2),
.checkin-table td:nth-child(2) {
  width: 96px;
  text-align: center;
}

.checkmark-pill {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #16a34a;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 900;
}

.checkmark-empty {
  display: inline-block;
  width: 30px;
  height: 30px;
}

.checked-in-row {
  background: rgba(236, 253, 245, 0.72);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.table-delete {
  min-height: 42px;
}

.icon-action,
.account-edit-button.icon-action {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}

.participant-table-card {
  grid-column: span 2;
}

.table-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.table-controls span {
  min-width: 180px;
  color: var(--muted);
  font-weight: 800;
}

.table-controls label {
  color: var(--muted);
  font-size: 0.86rem;
}

.table-controls select {
  width: auto;
  min-width: 84px;
  min-height: 40px;
}

.table-controls .button {
  min-height: 40px;
  padding: 0 14px;
}

.table-controls .button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.table-wrap {
  max-width: 100%;
  margin-top: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
  box-shadow: 0 16px 42px rgba(17, 24, 39, 0.07);
}

.participant-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  background: white;
  font-size: 0.92rem;
}

@media (min-width: 1440px) {
  .dashboard-card {
    padding-inline: max(72px, calc((100vw - 1280px) / 2));
  }

  .dashboard-grid {
    gap: 18px;
  }
}

.participant-table th,
.participant-table td {
  padding: 12px;
  text-align: left;
  vertical-align: middle;
}

.participant-table th {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.participant-table tr:last-child td {
  border-bottom: 0;
}

.compact-select {
  min-width: 150px;
  min-height: 40px;
  padding: 0 10px;
}

.compact-input {
  width: min(220px, 100%);
  min-width: 160px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-weight: 750;
}

.compact-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(54, 87, 216, 0.12);
  outline: none;
}

.participant-table .compact-input:disabled,
.participant-table .compact-select:disabled {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  opacity: 1;
  pointer-events: none;
}

.participant-table .compact-select:disabled {
  appearance: none;
}

.participant-table tr.editing .compact-input,
.participant-table tr.editing .compact-select {
  border-color: var(--border);
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(226, 229, 239, 0.72);
  pointer-events: auto;
}

.status-pill {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(25, 122, 80, 0.1);
  color: var(--success);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: capitalize;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

@media (max-width: 1180px) {
  .dashboard-card {
    padding-inline: clamp(18px, 4vw, 44px);
  }

  .portal-route[data-portal-route="teams"] article,
  .portal-route[data-portal-route="changepass"] article,
  .portal-route[data-portal-route="announcements"] article,
  .portal-route[data-portal-route="letters"] article,
  .portal-route[data-portal-route="questions"] article,
  .portal-route[data-portal-route="activity"] article {
    grid-template-columns: minmax(240px, 0.9fr) minmax(300px, 1.1fr);
    gap: 20px;
  }
}

@media (max-width: 840px) {
  .site-links {
    justify-content: flex-start;
  }

  .nav-portal-button {
    width: 100%;
  }

  .login-page {
    grid-template-columns: 1fr;
    gap: 30px;
    padding-top: 28px;
  }

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

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

  .page-visibility-panel form {
    grid-template-columns: 1fr;
  }

  .portal-route[data-portal-route="teams"] article,
  .portal-route[data-portal-route="changepass"] article,
  .portal-route[data-portal-route="announcements"] article,
  .portal-route[data-portal-route="letters"] article,
  .portal-route[data-portal-route="questions"] article,
  .portal-route[data-portal-route="activity"] article {
    grid-template-columns: 1fr;
  }

  .portal-route[data-portal-route="teams"] article > .record-list,
  .portal-route[data-portal-route="changepass"] article > .pin-settings-card,
  .portal-route[data-portal-route="announcements"] article > .announcement-manager,
  .portal-route[data-portal-route="letters"] article > .announcement-manager,
  .portal-route[data-portal-route="questions"] article > .question-manager,
  .portal-route[data-portal-route="activity"] article > .record-list {
    grid-column: 1;
    grid-row: auto;
    margin-top: 16px;
  }


  .resource-center,
  .qr-code-card,
  .qr-scan-card,
  .participant-table-card {
    grid-column: auto;
  }

  .resource-links {
    grid-template-columns: 1fr;
  }

  .qr-code-panel {
    grid-template-columns: 1fr;
  }

  .qr-scanner-layout {
    grid-template-columns: 1fr;
  }

  .letter-dialog {
    min-height: 500px;
  }

  .letter-scene {
    min-height: 500px;
    padding: 18px;
  }

  .letter-paper-full {
    top: 230px;
    width: min(300px, calc(100% - 72px));
    height: 170px;
    max-height: calc(100% - 36px);
    padding: 22px;
  }

  .letter-scene.opened .letter-paper-full {
    top: 18px;
    width: calc(100% - 36px);
    height: calc(100% - 36px);
  }

  .brand {
    margin-bottom: 24px;
  }

  h1 {
    font-size: clamp(2.55rem, 9vw, 3.4rem);
  }

  .login-card {
    padding: 28px;
  }

  .dashboard-card {
    padding: 88px 22px 42px;
  }

  .important-banner {
    display: grid;
    gap: 10px;
  }

  .team-pill {
    max-width: 100%;
    border-radius: 12px;
    overflow-wrap: anywhere;
  }

  .support-line {
    margin-top: 20px;
  }
}

@media (max-width: 560px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
    overscroll-behavior-y: none;
    background: #f8fbff;
  }

  .login-page {
    width: min(100% - 24px, 1100px);
    gap: 10px;
    min-height: 100svh;
    padding-block: 22px;
  }

  .partner-cloud {
    padding-top: 2px;
  }

  .partner-logo {
    width: 124px;
    height: 66px;
  }

  .partner-logo-wide {
    width: 124px;
  }

  .partner-logo img {
    max-height: 48px;
  }

  .site-logo {
    min-width: 0;
  }

  .site-logo span:last-child {
    min-width: 0;
  }

  .site-logo strong,
  .site-logo small {
    overflow-wrap: anywhere;
  }

  .site-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    width: 100%;
  }

  .site-links a {
    min-height: 38px;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
    text-align: center;
  }

  .connected-actions {
    display: grid;
  }

  .button {
    width: 100%;
  }

  .dashboard-actions .button {
    width: auto;
  }

  .login-card {
    padding: 0;
    border-radius: 0;
  }

  .welcome-panel {
    padding: 0;
    border-radius: 0;
  }

  .dashboard-card {
    min-height: 100dvh;
    padding: calc(78px + env(safe-area-inset-top)) 14px calc(42px + env(safe-area-inset-bottom));
    border-radius: 0;
    background:
      linear-gradient(180deg, rgba(248, 251, 255, 0.98), rgba(255, 255, 255, 0.94)),
      radial-gradient(circle at 100% -10%, rgba(22, 132, 123, 0.12), transparent 18rem);
  }

  .dashboard-top {
    inset: 0 0 auto 0;
    display: flex;
    min-height: calc(62px + env(safe-area-inset-top));
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    gap: 12px;
    background: rgba(248, 251, 255, 0.88);
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 10px 26px rgba(17, 24, 39, 0.06);
    backdrop-filter: blur(18px);
  }

  .dashboard-top .brand {
    display: inline-flex;
    min-width: 0;
    margin: 0;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .dashboard-top .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 0.78rem;
  }

  .dashboard-actions {
    display: flex;
    grid-template-columns: none;
    justify-content: flex-end;
    width: auto;
    align-items: center;
    gap: 8px;
  }

  .ui-mode-switch {
    min-width: 162px;
    min-height: 38px;
    padding: 4px;
  }

  .ui-mode-switch button {
    min-height: 30px;
    padding: 0 9px;
    font-size: 0.74rem;
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .dashboard-actions .button {
    min-height: 38px;
    padding: 9px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
  }

  .portal-sidebar {
    inset: 0 auto 0 0;
    z-index: 70;
    display: flex;
    width: min(340px, calc(100vw - 42px));
    height: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 24px;
    overflow-x: hidden;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.94);
    border-top: 0;
    box-shadow: 26px 0 80px rgba(17, 24, 39, 0.14);
    backdrop-filter: blur(18px);
    opacity: 0;
    transform: translateX(-104%);
    transition: transform 360ms var(--ease-smooth), opacity 260ms var(--ease-smooth);
    scrollbar-width: auto;
  }

  .portal-sidebar::-webkit-scrollbar {
    display: initial;
  }

  .portal-sidebar.open {
    opacity: 1;
    transform: translateX(0);
  }

  .portal-sidebar.hidden {
    display: none;
  }

  .portal-sidebar-top {
    display: flex;
  }

  .sidebar-close {
    display: inline-flex;
  }

  .sidebar-backdrop.open {
    display: block;
  }

  .portal-sidebar a,
  .portal-switch-link {
    flex: 0 0 auto;
    min-width: 0;
    min-height: 48px;
    justify-content: flex-start;
    padding: 12px 14px;
    border-radius: 12px;
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.2;
    text-align: left;
    white-space: normal;
    transform: none;
  }

  .portal-sidebar a:hover,
  .portal-sidebar a.active,
  .portal-switch-link:hover {
    background: rgba(54, 87, 216, 0.12);
    color: var(--primary);
    transform: translateX(3px);
  }

  .portal-switch-link {
    margin-top: 8px;
  }

  .portal-switch-link::after {
    content: "";
    display: none;
  }

  .dashboard-grid article {
    min-height: 0;
    padding: 14px;
    border-radius: 8px;
  }

  .dashboard-stat-grid {
    grid-template-columns: 1fr;
  }

  .tutorial-actions,
  .tutorial-actions div {
    display: grid;
    width: 100%;
  }

  .resource-center,
  .qr-code-card,
  .qr-scan-card,
  .participant-table-card,
  .question-manager-card {
    grid-column: auto;
  }

  .resource-links {
    grid-template-columns: 1fr;
  }

  .qr-code-panel {
    grid-template-columns: 1fr;
  }

  .qr-scanner-layout {
    grid-template-columns: 1fr;
  }

  .record-list {
    max-height: none;
  }

  .important-banner {
    padding: 14px;
    border-radius: 12px;
  }

  .table-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    gap: 8px;
  }

  .table-controls span,
  .table-controls label,
  .table-controls select {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }

  .table-wrap {
    border-radius: 12px;
  }

  .participant-table {
    min-width: 680px;
    font-size: 0.86rem;
  }

  .announcement-dialog,
  .letter-dialog {
    width: calc(100% - 20px);
    max-width: calc(100% - 20px);
  }

  .announcement-dialog {
    max-height: calc(100svh - 20px);
    padding: 18px;
    overflow-y: auto;
    border-radius: 14px;
  }

  .letter-dialog {
    min-height: 0;
    max-height: calc(100svh - 20px);
    padding: 0;
    border-radius: 16px;
  }

  .letter-scene {
    min-height: min(500px, calc(100svh - 20px));
    padding: 16px;
    border-radius: 16px;
  }

  .announcement-dialog-header {
    display: grid;
    gap: 10px;
  }

  .letter-card {
    grid-template-columns: 1fr;
  }

  .letter-card-envelope {
    width: 96px;
  }

  .letter-envelope {
    width: min(330px, 82vw);
    height: 230px;
  }

  .envelope-back {
    inset: 50px 18px 22px;
  }

  .envelope-front {
    inset: 84px 18px 22px;
  }

  .envelope-left,
  .envelope-right,
  .envelope-paper {
    height: 128px;
  }

  .envelope-paper {
    left: 46px;
    right: 46px;
    top: 84px;
  }

  .envelope-flap {
    left: 18px;
    right: 18px;
    top: 50px;
    height: 110px;
  }
}

@media (max-width: 420px) {
  .login-page {
    width: min(100% - 18px, 1100px);
  }

  h1,
  .login-card h2 {
    font-size: clamp(2.15rem, 13vw, 3rem);
  }

  .dashboard-card {
    padding: calc(76px + env(safe-area-inset-top)) 12px calc(40px + env(safe-area-inset-bottom));
  }

  .dashboard-top {
    inset: 0 0 auto 0;
  }

  .portal-sidebar {
    inset: 0 auto 0 0;
    width: min(328px, calc(100vw - 36px));
    height: auto;
    padding: 22px;
  }

  .tutorial-card {
    padding: 22px 18px;
    border-radius: 22px;
  }

  .tutorial-progress span {
    width: 22px;
  }

  .tutorial-progress span.active {
    width: 34px;
  }

  .table-controls {
    grid-template-columns: 1fr;
  }

  .dashboard-actions .button {
    min-height: 38px;
    padding: 9px 12px;
  }

  .participant-table {
    min-width: 620px;
  }

  .participant-table th,
  .participant-table td {
    padding: 10px 9px;
  }
}

.login-page {
  width: min(1120px, calc(100% - clamp(24px, 5vw, 64px)));
  grid-template-columns: minmax(0, min(100%, 440px));
  align-content: center;
}

.login-card {
  width: 100%;
  max-width: 440px;
  justify-self: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.login-card::before {
  display: none;
}

.login-card h2 {
  font-size: clamp(2rem, 10vw, 2.8rem);
}

.login-card > p {
  max-width: 100%;
}

.login-card form {
  width: 100%;
}

.login-step,
.password-field,
.role-choice-actions {
  min-width: 0;
}

.login-card input,
.login-submit,
.role-choice-button {
  min-width: 0;
}

.login-page .partner-cloud {
  grid-column: 1 / -1;
  max-width: 100%;
}

@media (min-width: 900px) {
  .login-page {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
    gap: clamp(36px, 6vw, 84px);
  }

  .welcome-panel {
    display: block;
    min-width: 0;
  }

  .welcome-panel .brand,
  .welcome-panel .eyebrow,
  .welcome-panel h1,
  .welcome-panel .intro,
  .welcome-panel .connected-actions,
  .welcome-panel .support-line {
    display: revert;
  }

  .welcome-panel .brand,
  .welcome-panel .connected-actions {
    display: flex;
  }

  .login-card {
    align-self: center;
  }
}

@media (min-width: 900px) and (max-width: 1080px) {
  .login-page {
    grid-template-columns: minmax(0, 0.95fr) minmax(340px, 410px);
    gap: 32px;
  }

  h1 {
    font-size: clamp(2.4rem, 5vw, 3.25rem);
  }
}

@media (max-width: 899px) {
  .login-page {
    min-height: auto;
    align-content: start;
    padding-top: clamp(18px, 5vw, 40px);
    padding-bottom: clamp(18px, 5vw, 40px);
  }

  .login-card {
    max-width: min(100%, 460px);
  }
}

@media (max-width: 560px) {
  .login-page {
    width: min(100% - 20px, 460px);
    gap: 12px;
  }

  .login-card {
    padding: 0;
    border-radius: 0;
  }

  .login-card h2 {
    font-size: clamp(1.95rem, 12vw, 2.45rem);
    line-height: 1;
  }

  .card-badge {
    margin-bottom: 12px;
    font-size: 0.68rem;
  }
}

@media (max-width: 360px) {
  .login-page {
    width: min(100% - 14px, 460px);
  }

  .login-card {
    padding: 0;
  }

  .password-field input {
    padding-right: 70px;
  }

  .password-toggle {
    right: 8px;
    padding: 0 8px;
  }
}

@media (max-height: 620px) {
  .login-page {
    align-items: start;
    padding-top: 68px;
    padding-bottom: 28px;
  }

  .tutorial-card {
    max-height: calc(100vh - 28px);
    overflow-y: auto;
  }

  .letter-dialog {
    min-height: 0;
  }

  .letter-scene {
    min-height: calc(100svh - 28px);
  }
}

@media (max-width: 560px) {
  body:has(.login-page:not(.hidden)) {
    background:
      linear-gradient(180deg, #f8fbff 0%, #ffffff 48%, #f3f7ff 100%);
  }

  .login-page {
    width: 100%;
    min-height: 100dvh;
    align-content: start;
    align-items: start;
    gap: 18px;
    padding: calc(18px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));
  }

  .login-page::before {
    content: "RSC";
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin: 0 auto 2px;
    border-radius: 16px;
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 16px 30px rgba(54, 87, 216, 0.22);
    font-size: 0.9rem;
    font-weight: 950;
    letter-spacing: 0.08em;
  }

  .login-card {
    width: 100%;
    max-width: 420px;
    justify-self: center;
    padding: 22px 18px 18px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.84);
    box-shadow: 0 18px 45px rgba(31, 41, 55, 0.08);
    backdrop-filter: blur(18px);
    text-shadow: none;
  }

  .login-card::before {
    content: "Participant Portal";
    margin-bottom: 8px;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
  }

  .card-badge {
    display: none;
  }

  .login-card h2 {
    margin-bottom: 6px;
    font-size: clamp(2rem, 10vw, 2.55rem);
    line-height: 1;
  }

  .login-card > p {
    max-width: 280px;
    margin-bottom: 16px;
    font-size: 0.96rem;
    line-height: 1.45;
  }

  .login-step.active {
    gap: 8px;
  }

  .login-card label {
    font-size: 0.92rem;
  }

  .login-card input {
    min-height: 54px;
    border-radius: 16px;
    font-size: 1rem;
  }

  .login-submit,
  .role-choice-button,
  #role-choice-continue {
    min-height: 54px;
    border-radius: 16px;
    font-size: 1rem;
  }

  .login-page .partner-cloud {
    max-width: 420px;
    justify-self: center;
    margin-top: 0;
    padding: 14px 0 0;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
  }

  .partner-cloud-heading {
    margin-bottom: 6px;
  }

  .partner-cloud-heading .eyebrow {
    font-size: 0.68rem;
    letter-spacing: 0.16em;
  }

  .login-page .partner-marquee {
    padding: 4px 0;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.52);
    box-shadow: none;
    mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  }

  .login-page .partner-track {
    gap: 12px;
  }

  .login-page .partner-logo,
  .login-page .partner-logo-wide {
    width: 88px;
    height: 48px;
  }

  .login-page .partner-logo img {
    max-height: 34px;
  }
}

@media (pointer: coarse) {
  .button,
  .portal-sidebar a,
  input,
  select {
    min-height: 48px;
  }

  #med-scene {
    opacity: 0.72;
  }
}

body.simple-ui {
  --primary: #1f5f99;
  --primary-dark: #164a78;
  --text: #172033;
  --muted: #5c667a;
  --border: #d7dce5;
  --surface: #ffffff;
  --surface-soft: #f5f7fa;
  --success: #177245;
  --warning: #8a5a00;
  --danger: #a12b2b;
  background: #f5f7fa;
  color: var(--text);
}

body.simple-ui #med-scene,
body.simple-ui .important-banner::before,
body.simple-ui .login-page::before,
body.simple-ui .dashboard-partner-cloud,
body.simple-ui .sidebar-backdrop,
body.simple-ui .sidebar-toggle,
body.simple-ui .sidebar-close {
  display: none !important;
}

body.simple-ui *,
body.simple-ui *::before,
body.simple-ui *::after {
  background-image: none !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

body.simple-ui .dashboard-card {
  min-height: 100vh;
  padding: 76px 28px 40px 268px;
  background: #f5f7fa;
}

body.simple-ui .dashboard-top {
  inset: 0 0 auto 0;
  min-height: 56px;
  padding: 0 18px 0 18px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: auto;
}

body.simple-ui .dashboard-top .brand {
  display: inline-flex;
  color: var(--text);
  font-size: 0.95rem;
}

body.simple-ui .dashboard-actions {
  justify-content: flex-end;
  width: auto;
  margin-left: auto;
  pointer-events: auto;
}

body.simple-ui .intro {
  max-width: none;
  margin-bottom: 16px;
  color: var(--muted);
}

body.simple-ui .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #ffffff;
  box-shadow: none;
}

body.simple-ui h1,
body.simple-ui .dashboard-card > h1 {
  margin-top: 0;
  font-size: 1.45rem;
  line-height: 1.15;
}

body.simple-ui .team-pill {
  border-radius: 3px;
  background: #ffffff;
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}

body.simple-ui .dashboard-grid {
  display: block;
  gap: 0;
  max-width: 1180px;
}

body.simple-ui .portal-route.active {
  animation: none;
}

body.simple-ui .dashboard-grid article,
body.simple-ui .visibility-toggle,
body.simple-ui .record-list li,
body.simple-ui .account-summary div {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #ffffff;
  box-shadow: none;
  backdrop-filter: none;
  animation: none;
  transform: none;
}

body.simple-ui .dashboard-grid article {
  min-height: 0;
  margin: 0 0 12px;
  padding: 14px 16px;
}

body.simple-ui .dashboard-grid article:hover {
  background: #ffffff;
  box-shadow: none;
  transform: none;
}

body.simple-ui .dashboard-grid span,
body.simple-ui .account-summary dt,
body.simple-ui .card-badge {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

body.simple-ui .dashboard-grid h2 {
  margin: 4px 0 8px;
  font-size: 1rem;
}

body.simple-ui .portal-sidebar {
  position: fixed;
  inset: 56px auto 0 0;
  z-index: 35;
  display: flex;
  width: 240px;
  padding: 16px 12px;
  background: #ffffff;
  border-right: 1px solid var(--border);
  box-shadow: none;
  transform: none;
  opacity: 1;
  transition: none;
}

body.simple-ui .portal-sidebar.hidden {
  display: flex;
}

body.simple-ui .portal-sidebar-top {
  margin-bottom: 14px;
  padding: 0 8px 10px;
  border-bottom: 1px solid var(--border);
}

body.simple-ui .portal-sidebar a,
body.simple-ui .portal-switch-link {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 4px;
  color: var(--text);
  font-size: 0.86rem;
}

body.simple-ui .portal-sidebar a.active,
body.simple-ui .portal-sidebar a:hover,
body.simple-ui .portal-switch-link:hover {
  background: #e8f1fb;
  color: var(--primary-dark);
  transform: none;
}

body.simple-ui .button,
body.simple-ui .table-action {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 3px;
  box-shadow: none;
  font-size: 0.86rem;
}

body.simple-ui .button.primary {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #ffffff;
}

body.simple-ui .button.secondary {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
}

body.simple-ui .button.danger {
  border: 1px solid #e5b4b4;
  background: #ffffff;
  color: var(--danger);
}

body.simple-ui input,
body.simple-ui select,
body.simple-ui textarea,
body.simple-ui .compact-input,
body.simple-ui .compact-select {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #ffffff;
  box-shadow: none;
  backdrop-filter: none;
  font-size: 0.9rem;
}

body.simple-ui form {
  gap: 8px;
  margin-top: 10px;
}

body.simple-ui .table-wrap {
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: none;
  overflow-x: auto;
}

body.simple-ui .participant-table {
  min-width: 0;
  table-layout: fixed;
  background: #ffffff;
  font-size: 0.78rem;
}

body.simple-ui .participant-table th {
  background: #eef3f8;
  color: var(--text);
  letter-spacing: 0.03em;
}

body.simple-ui .participant-table th,
body.simple-ui .participant-table td {
  padding: 4px 5px;
  border-bottom: 1px solid #e2e6ed;
  overflow-wrap: anywhere;
  white-space: normal;
  vertical-align: middle;
}

body.simple-ui .participant-table th:nth-child(1),
body.simple-ui .participant-table td:nth-child(1) {
  width: 17%;
}

body.simple-ui .participant-table th:nth-child(2),
body.simple-ui .participant-table td:nth-child(2) {
  width: 21%;
}

body.simple-ui .participant-table th:nth-child(3),
body.simple-ui .participant-table td:nth-child(3),
body.simple-ui .participant-table th:nth-child(4),
body.simple-ui .participant-table td:nth-child(4) {
  width: 13%;
}

body.simple-ui .participant-table:not(.admin-account-table) th:nth-child(6),
body.simple-ui .participant-table:not(.admin-account-table) td:nth-child(6),
body.simple-ui .participant-table:not(.admin-account-table) th:nth-child(7),
body.simple-ui .participant-table:not(.admin-account-table) td:nth-child(7) {
  display: none;
}

body.simple-ui .participant-table th:nth-child(5),
body.simple-ui .participant-table td:nth-child(5) {
  width: 10%;
}

body.simple-ui .participant-table th:nth-child(8),
body.simple-ui .participant-table td:nth-child(8) {
  width: 9%;
}

body.simple-ui .participant-table:not(.admin-account-table) th:nth-child(1),
body.simple-ui .participant-table:not(.admin-account-table) td:nth-child(1) {
  width: 23%;
}

body.simple-ui .participant-table:not(.admin-account-table) th:nth-child(2),
body.simple-ui .participant-table:not(.admin-account-table) td:nth-child(2) {
  width: 20%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.simple-ui .participant-table:not(.admin-account-table) th:nth-child(3),
body.simple-ui .participant-table:not(.admin-account-table) td:nth-child(3),
body.simple-ui .participant-table:not(.admin-account-table) th:nth-child(4),
body.simple-ui .participant-table:not(.admin-account-table) td:nth-child(4) {
  width: 18%;
}

body.simple-ui .participant-table:not(.admin-account-table) th:nth-child(8),
body.simple-ui .participant-table:not(.admin-account-table) td:nth-child(8) {
  width: 13%;
  min-width: 116px;
  overflow: visible;
}

body.simple-ui .participant-table .table-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 3px;
  align-items: center;
  justify-content: flex-start;
}

body.simple-ui .participant-table .button,
body.simple-ui .participant-table .table-action {
  width: auto;
  min-height: 26px;
  padding: 0 6px;
  font-size: 0.76rem;
  line-height: 1.1;
}

body.simple-ui .participant-table .icon-action {
  width: 24px;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  font-size: 0.85rem;
}

body.simple-ui .admin-account-table th:nth-child(1),
body.simple-ui .admin-account-table td:nth-child(1) {
  width: 22%;
}

body.simple-ui .admin-account-table th:nth-child(2),
body.simple-ui .admin-account-table td:nth-child(2) {
  width: 30%;
}

body.simple-ui .admin-account-table th:nth-child(3),
body.simple-ui .admin-account-table td:nth-child(3),
body.simple-ui .admin-account-table th:nth-child(4),
body.simple-ui .admin-account-table td:nth-child(4) {
  width: 17%;
}

body.simple-ui .admin-account-table th:nth-child(5),
body.simple-ui .admin-account-table td:nth-child(5) {
  width: 14%;
}

body.simple-ui .status-pill,
body.simple-ui .important-label,
body.simple-ui .unread-label {
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #ffffff;
  color: var(--text);
}

body.simple-ui .ui-mode-switch {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: none;
  min-width: 176px;
  min-height: 38px;
  padding: 3px;
}

body.simple-ui .ui-mode-switch button {
  border-radius: 3px;
  min-height: 30px;
  color: var(--text);
}

body.simple-ui .ui-mode-switch button.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: none;
}

@media (max-width: 760px) {
  body.simple-ui .dashboard-card {
    padding: 70px 14px 28px;
  }

  body.simple-ui .portal-sidebar,
  body.simple-ui .portal-sidebar.hidden {
    position: static;
    display: flex;
    width: auto;
    margin: 0 0 14px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
  }

  body.simple-ui .portal-sidebar-top {
    display: none;
  }
}

body.simple-ui {
  --primary: #000000;
  --primary-dark: #000000;
  --text: #000000;
  --muted: #333333;
  --border: #999999;
  --surface: #ffffff;
  --surface-soft: #ffffff;
  font-family: "Times New Roman", Times, serif;
  font-size: 18px;
  background: #ffffff;
  color: #000000;
}

body.simple-ui .dashboard-card {
  padding: 68px 16px 32px 232px;
  background: #ffffff;
}

body.simple-ui .dashboard-top {
  min-height: 48px;
  padding: 6px 12px 6px 232px;
  border-bottom: 1px solid #999999;
  background: #ffffff;
}

body.simple-ui .dashboard-top .brand,
body.simple-ui .dashboard-actions {
  font-family: Arial, sans-serif;
}

body.simple-ui .brand-mark {
  width: auto;
  height: auto;
  padding: 1px 4px;
  border: 1px solid #000000;
  border-radius: 0;
  background: #ffffff;
  color: #000000;
}

body.simple-ui h1,
body.simple-ui .dashboard-card > h1 {
  margin: 0 0 16px;
  font-family: "Times New Roman", Times, serif;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.05;
}

body.simple-ui .eyebrow,
body.simple-ui .intro,
body.simple-ui .team-pill {
  margin: 0 0 14px;
  font-family: "Times New Roman", Times, serif;
  font-size: 1rem;
  color: #000000;
}

body.simple-ui .team-pill {
  display: block;
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body.simple-ui .portal-sidebar,
body.simple-ui .portal-sidebar.hidden {
  width: 216px;
  padding: 10px 12px;
  border-right: 1px solid #999999;
  background: #ffffff;
}

body.simple-ui .portal-sidebar-top {
  margin-bottom: 10px;
  padding: 0 0 8px;
  border-bottom: 1px solid #cccccc;
  font-family: Arial, sans-serif;
}

body.simple-ui .portal-sidebar a,
body.simple-ui .portal-switch-link {
  display: block;
  min-height: 0;
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #0000ee;
  font-family: Arial, sans-serif;
  font-size: 0.92rem;
  font-weight: 400;
  text-decoration: underline;
}

body.simple-ui .portal-sidebar a.active,
body.simple-ui .portal-sidebar a:hover,
body.simple-ui .portal-switch-link:hover {
  background: transparent;
  color: #000000;
  transform: none;
}

body.simple-ui .dashboard-grid {
  max-width: none;
  margin-top: 18px;
}

body.simple-ui .dashboard-grid article,
body.simple-ui .visibility-toggle,
body.simple-ui .record-list li,
body.simple-ui .account-summary div {
  border: 0;
  border-top: 1px solid #999999;
  border-radius: 0;
  background: transparent;
}

body.simple-ui .dashboard-grid article {
  margin: 0 0 18px;
  padding: 14px 0 0;
}

body.simple-ui .dashboard-grid h2 {
  margin: 0 0 10px;
  font-family: "Times New Roman", Times, serif;
  font-size: 1.35rem;
  font-weight: 700;
}

body.simple-ui .dashboard-grid p,
body.simple-ui .record-list,
body.simple-ui .account-summary {
  font-family: "Times New Roman", Times, serif;
}

body.simple-ui .dashboard-grid span,
body.simple-ui .account-summary dt,
body.simple-ui .card-badge {
  color: #000000;
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
}

body.simple-ui .account-summary {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

body.simple-ui .account-summary div {
  padding: 8px 0 0;
}

body.simple-ui .account-summary dd {
  font-size: 1rem;
  font-weight: 400;
}

body.simple-ui .button,
body.simple-ui .table-action,
body.simple-ui .button.primary,
body.simple-ui .button.secondary,
body.simple-ui .button.danger {
  min-height: 0;
  padding: 2px 8px;
  border: 1px solid #777777;
  border-radius: 2px;
  background: #eeeeee;
  color: #000000;
  font-family: Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 400;
}

body.simple-ui input,
body.simple-ui select,
body.simple-ui textarea,
body.simple-ui .compact-input,
body.simple-ui .compact-select {
  min-height: 0;
  padding: 2px 4px;
  border: 1px solid #777777;
  border-radius: 2px;
  background: #ffffff;
  color: #000000;
  font-family: Arial, sans-serif;
  font-size: 0.95rem;
  font-weight: 400;
}

body.simple-ui .table-wrap {
  border: 1px solid #999999;
  border-radius: 0;
  overflow-x: hidden;
}

body.simple-ui .participant-table {
  width: 100%;
  border-collapse: collapse;
  font-family: Arial, sans-serif;
  font-size: 0.74rem;
}

body.simple-ui .participant-table th {
  background: #eeeeee;
  color: #000000;
}

body.simple-ui .participant-table th,
body.simple-ui .participant-table td {
  padding: 3px 4px;
  border: 1px solid #d0d0d0;
  vertical-align: middle;
}

body.simple-ui .participant-table .table-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 3px;
  align-items: center;
}

body.simple-ui .participant-table .icon-action {
  width: 24px;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1;
}

body.simple-ui .status-pill,
body.simple-ui .important-label,
body.simple-ui .unread-label {
  padding: 1px 4px;
  border: 1px solid #999999;
  border-radius: 2px;
  background: #ffffff;
  color: #000000;
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
}

body.simple-ui .ui-mode-switch {
  min-width: 150px;
  min-height: 30px;
  padding: 2px;
  border: 1px solid #777777;
  border-radius: 2px;
  background: #ffffff;
  font-family: Arial, sans-serif;
}

body.simple-ui .ui-mode-switch button {
  min-height: 24px;
  border-radius: 1px;
  color: #000000;
  font-size: 0.78rem;
}

body.simple-ui .ui-mode-switch button.active {
  background: #dddddd;
  color: #000000;
}

@media (max-width: 760px) {
  body.simple-ui .dashboard-card {
    padding: 58px 10px 24px;
  }

  body.simple-ui .dashboard-top {
    padding: 6px 10px;
  }

  body.simple-ui .portal-sidebar,
  body.simple-ui .portal-sidebar.hidden {
    width: auto;
    margin: 0 0 14px;
    padding: 8px 0;
    border: 0;
    border-top: 1px solid #999999;
    border-bottom: 1px solid #999999;
  }
}

@media (max-width: 560px) {
  .dashboard-top .brand,
  body.simple-ui .dashboard-top .brand {
    display: none !important;
  }

  .dashboard-top .ui-mode-switch {
    display: none !important;
  }

  .dashboard-top,
  body.simple-ui .dashboard-top {
    min-height: calc(56px + env(safe-area-inset-top));
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  }

  .dashboard-card,
  body.simple-ui .dashboard-card {
    padding-top: calc(68px + env(safe-area-inset-top));
  }

  .dashboard-actions {
    margin-left: auto;
  }

  html,
  body {
    touch-action: manipulation;
  }
}

@media (min-width: 561px) and (max-width: 899px) {
  .login-page {
    grid-template-rows: minmax(0, 1fr) auto;
    min-height: 100vh;
    min-height: 100dvh;
    align-content: stretch;
    align-items: stretch;
  }

  .login-card {
    align-self: center;
  }

  .login-page .partner-cloud {
    align-self: end;
  }
}

@media (max-width: 560px) {
  .login-page {
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: 100vh;
    min-height: 100dvh;
    align-content: stretch;
    align-items: stretch;
  }

  .login-card {
    align-self: center;
  }

  .login-page .partner-cloud {
    align-self: end;
  }
}

/* Keep the spacious visual treatment focused on PIN sign-in and setup. */
.login-page[data-login-step="pin"],
.login-page[data-login-step="pin-setup"] {
  grid-template-columns: minmax(0, 480px);
  grid-template-rows: minmax(0, 1fr);
  justify-content: center;
  align-content: center;
  align-items: center;
  gap: 0;
}

.login-page[data-login-step="pin"] .welcome-panel,
.login-page[data-login-step="pin-setup"] .welcome-panel,
.login-page[data-login-step="pin"] .partner-cloud,
.login-page[data-login-step="pin-setup"] .partner-cloud {
  display: none;
}

.login-page[data-login-step="pin"] .login-card,
.login-page[data-login-step="pin-setup"] .login-card {
  position: relative;
  isolation: isolate;
  width: min(100%, 480px);
  max-width: 480px;
  padding: clamp(28px, 5vw, 44px);
  overflow: hidden;
  border: 1px solid rgba(54, 87, 216, 0.14);
  border-radius: 36px;
  background:
    radial-gradient(circle at 100% 0%, rgba(118, 105, 255, 0.16), transparent 38%),
    rgba(255, 255, 255, 0.94);
  box-shadow: 0 30px 80px rgba(31, 42, 68, 0.16);
  backdrop-filter: blur(22px);
  animation: pin-card-arrive 520ms var(--ease-smooth) both;
}

.login-page[data-login-step="pin"] .login-card::before,
.login-page[data-login-step="pin-setup"] .login-card::before {
  content: "Quick secure access";
  display: block;
  margin-bottom: 12px;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.16em;
  text-align: center;
  text-transform: uppercase;
}

.login-page[data-login-step="pin"] .login-card h2,
.login-page[data-login-step="pin-setup"] .login-card h2 {
  font-size: clamp(2.35rem, 9vw, 3.25rem);
}

.login-page[data-login-step="pin"] .selected-email,
.login-page[data-login-step="pin-setup"] .selected-email {
  justify-self: center;
  max-width: 100%;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(54, 87, 216, 0.07);
  font-size: 0.82rem;
  text-align: center;
}

.login-page[data-login-step="pin"] .pin-icon,
.login-page[data-login-step="pin-setup"] .pin-icon {
  min-width: 76px;
  min-height: 52px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(54, 87, 216, 0.14), rgba(118, 105, 255, 0.14));
  box-shadow: inset 0 0 0 1px rgba(54, 87, 216, 0.08);
}

.login-page[data-login-step="pin"] .pin-input,
.login-page[data-login-step="pin-setup"] .pin-input {
  min-height: 72px;
  border: 2px solid rgba(54, 87, 216, 0.16);
  border-radius: 21px;
  background: rgba(255, 255, 255, 0.9);
  font-size: clamp(1.35rem, 6vw, 1.7rem);
  letter-spacing: 0.5em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.login-page[data-login-step="pin"] .login-submit,
.login-page[data-login-step="pin-setup"] .login-submit {
  min-height: 58px;
  border-radius: 18px;
}

@keyframes pin-card-arrive {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 560px) {
  .login-page[data-login-step="pin"],
  .login-page[data-login-step="pin-setup"] {
    padding: calc(18px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom));
  }

  .login-page[data-login-step="pin"]::before,
  .login-page[data-login-step="pin-setup"]::before {
    display: none;
  }

  .login-page[data-login-step="pin"] .login-card,
  .login-page[data-login-step="pin-setup"] .login-card {
    align-self: center;
    padding: 28px 18px 22px;
    border-radius: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .partner-marquee {
    overflow-x: auto;
    mask-image: none;
  }

  .partner-track {
    animation: none;
  }
}
