:root {
  --dash-bg: #f6f9ff;
  --dash-surface: rgba(255, 255, 255, 0.86);
  --dash-solid: #ffffff;
  --dash-soft: #eef5ff;
  --dash-ink: #152033;
  --dash-muted: #728099;
  --dash-line: rgba(116, 135, 166, 0.18);
  --dash-brand: #4f8cff;
  --dash-mint: #24c99a;
  --dash-rose: #fb7185;
  --dash-amber: #f5b83d;
  --dash-shadow: 0 22px 70px rgba(59, 82, 120, 0.12);
}

html {
  scrollbar-width: thin;
  scrollbar-color: rgba(79, 140, 255, 0.46) rgba(232, 240, 252, 0.36);
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: rgba(232, 240, 252, 0.34);
}

::-webkit-scrollbar-thumb {
  border: 2px solid rgba(232, 240, 252, 0.34);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(104, 163, 255, 0.92), rgba(79, 140, 255, 0.7));
}

::-webkit-scrollbar-thumb:hover {
  background:
    linear-gradient(180deg, rgba(79, 140, 255, 1), rgba(42, 104, 230, 0.9));
}

::-webkit-scrollbar-corner {
  background: transparent;
}

body.is-dashboard-open {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(208, 231, 255, 0.9), transparent 34%),
    linear-gradient(135deg, #ffffff 0%, var(--dash-bg) 58%, #f7fff9 100%);
}

html.is-auth-open,
body.is-auth-open {
  height: 100% !important;
  overflow: hidden !important;
  overscroll-behavior: none;
}

body.is-auth-open {
  touch-action: none;
}

body.is-auth-open .auth-modal {
  overscroll-behavior: contain;
}

body.is-auth-open .auth-dialog {
  touch-action: pan-y;
  overscroll-behavior: contain;
}

body.is-dashboard-open .site-header,
body.is-dashboard-open main#top,
body.is-dashboard-open .footer,
body.is-dashboard-open .audit-toast {
  display: none !important;
}

body.is-dashboard-open {
  overflow: hidden;
}

.auth-modal[hidden],
.dashboard-app[hidden] {
  display: none !important;
}

.dashboard-app {
  position: fixed;
  inset: 0;
  z-index: 900;
  overflow: hidden;
  background: #f7f8fb;
}

.dashboard-frame-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100%;
  background: #f7f8fb;
}

.dashboard-frame-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid #e0e5eb;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  box-shadow: 0 14px 42px rgba(20, 30, 42, 0.08);
}

.dashboard-frame-top strong,
.dashboard-frame-top span {
  display: block;
}

.dashboard-frame-top strong {
  color: #101317;
  font-size: 15px;
}

.dashboard-frame-top span {
  margin-top: 2px;
  color: #68717d;
  font-size: 12px;
}

.dashboard-frame-shell iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #f7f8fb;
}

.dashboard-logout {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #d8e0ea;
  border-radius: 14px;
  background: #ffffff;
  color: #101317;
  font-weight: 800;
  cursor: pointer;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 22px;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 17, 28, 0.42);
  backdrop-filter: blur(18px);
}

.auth-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  max-height: min(760px, calc(100vh - 44px));
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--dash-line);
  border-radius: 30px;
  background:
    radial-gradient(circle at 100% 0%, rgba(79, 140, 255, 0.16), transparent 34%),
    #ffffff;
  box-shadow: 0 34px 110px rgba(16, 31, 58, 0.26);
  animation: auth-pop 360ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.auth-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 14px;
  background: #f3f7ff;
  color: var(--dash-ink);
  font-size: 22px;
  font-weight: 800;
}

.auth-copy {
  display: grid;
  gap: 10px;
  padding-right: 38px;
}

.auth-copy h2 {
  margin: 0;
  color: var(--dash-ink);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
  letter-spacing: -0.045em;
}

.auth-copy p,
.auth-message {
  margin: 0;
  color: var(--dash-muted);
  line-height: 1.55;
}

.auth-tabs,
.social-grid {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.auth-tabs {
  grid-template-columns: 1fr 1fr;
  padding: 5px;
  border-radius: 18px;
  background: #f0f5ff;
}

.auth-tabs button,
.social-grid button {
  min-height: 42px;
  border-radius: 14px;
  background: transparent;
  color: var(--dash-muted);
  font-weight: 800;
}

.auth-tabs button.active,
.social-grid button:hover {
  background: #ffffff;
  color: var(--dash-ink);
  box-shadow: 0 10px 26px rgba(79, 140, 255, 0.12);
}

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

.social-grid button {
  border: 1px solid var(--dash-line);
  background: rgba(255, 255, 255, 0.74);
}

.social-grid button:disabled,
.social-grid button.is-disabled {
  cursor: not-allowed;
  opacity: 0.48;
  filter: grayscale(0.25);
  box-shadow: none;
}

.auth-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.auth-form label,
.auth-message,
.auth-submit {
  grid-column: 1 / -1;
}

.auth-form label:nth-of-type(4),
.auth-form label:nth-of-type(6) {
  grid-column: auto;
}

.auth-form span {
  display: block;
  margin: 0 0 7px;
  color: var(--dash-muted);
  font-size: 12px;
  font-weight: 800;
}

.auth-form input,
.auth-form select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--dash-line);
  border-radius: 15px;
  background: #ffffff;
  color: var(--dash-ink);
  font: inherit;
  outline: 0;
}

.auth-password-field {
  position: relative;
  display: block;
}

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

.auth-password-field button {
  position: absolute;
  top: 50%;
  right: 8px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(50, 110, 230, 0.18);
  border-radius: 11px;
  background: #f4f8ff;
  color: #244066;
  font-size: 12px;
  font-weight: 850;
  transform: translateY(-50%);
}

.auth-form input:focus,
.auth-form select:focus {
  border-color: rgba(79, 140, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(79, 140, 255, 0.12);
}

.auth-form input.is-valid {
  border-color: rgba(31, 167, 118, 0.48);
  box-shadow: 0 0 0 3px rgba(31, 167, 118, 0.1);
}

.auth-form input.is-invalid {
  border-color: rgba(223, 101, 79, 0.55);
  box-shadow: 0 0 0 3px rgba(223, 101, 79, 0.1);
}

.dashboard-app {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  gap: 18px;
  padding: 18px;
  color: var(--dash-ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  animation: dash-in 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.dash-sidebar,
.dash-hero,
.dash-panel,
.dash-metrics button,
.dash-account-card {
  border: 1px solid var(--dash-line);
  border-radius: 20px;
  background: var(--dash-surface);
  box-shadow: var(--dash-shadow);
  backdrop-filter: blur(20px);
}

.dash-sidebar {
  position: sticky;
  top: 18px;
  align-self: start;
  display: flex;
  min-height: calc(100vh - 36px);
  flex-direction: column;
  gap: 18px;
  padding: 18px;
}

.dash-brand,
.dash-topbar,
.dash-actions,
.dash-panel-head,
.dash-score-card,
.dash-account-card {
  display: flex;
  align-items: center;
}

.dash-brand {
  gap: 12px;
}

.dash-brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(135deg, #6da7ff, #356fe8);
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 18px 38px rgba(79, 140, 255, 0.24);
}

.dash-brand strong,
.dash-brand small,
.dash-project span,
.dash-project small,
.dash-account-card span,
.dash-account-card small {
  display: block;
}

.dash-brand strong,
.dash-project b,
.dash-account-card strong {
  color: var(--dash-ink);
}

.dash-brand small,
.dash-project small,
.dash-account-card span,
.dash-account-card small,
.dash-topbar p,
.dash-hero p,
.dash-panel p,
.dash-issues small,
.dash-ai-card p {
  color: var(--dash-muted);
}

.dash-project {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 66px;
  padding: 12px 14px;
  border-radius: 18px;
  background: #ffffff;
  color: var(--dash-ink);
  text-align: left;
  box-shadow: inset 0 0 0 1px var(--dash-line);
}

.dash-project em,
.dash-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #edf6ff;
  color: #3f72d9;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.dash-nav {
  display: grid;
  gap: 8px;
}

.dash-nav button {
  min-height: 46px;
  padding: 0 13px;
  border-radius: 15px;
  background: transparent;
  color: #526174;
  font-weight: 800;
  text-align: left;
}

.dash-nav button.active,
.dash-nav button:hover {
  background: #ffffff;
  color: var(--dash-ink);
  box-shadow: inset 0 0 0 1px rgba(79, 140, 255, 0.18), 0 10px 28px rgba(79, 140, 255, 0.12);
}

.dash-account-card {
  align-items: stretch;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding: 14px;
  box-shadow: none;
}

.dash-account-card button {
  min-height: 38px;
  border-radius: 13px;
  background: #f0f5ff;
  color: var(--dash-ink);
  font-weight: 900;
}

.dash-workspace {
  min-width: 0;
  padding: 8px 8px 28px;
}

/* v145: match the crisp bordered card style used by the landing and panel. */
.dashboard-app,
.dashboard-app * {
  text-rendering: optimizeLegibility !important;
}

.dash-sidebar,
.dash-hero,
.dash-panel,
.dash-metrics button,
.dash-account-card,
.dash-project,
.dash-nav button,
.dashboard-logout {
  border-color: rgba(103, 160, 239, 0.62) !important;
  background: #ffffff !important;
  color: var(--dash-ink) !important;
  box-shadow: 0 12px 28px rgba(57, 90, 132, 0.10) !important;
}

.dash-nav button:hover,
.dash-nav button.active,
.dashboard-logout:hover,
.dash-account-card button:hover {
  border-color: rgba(63, 130, 246, 0.62) !important;
  background: #ffffff !important;
  color: #1d4ed8 !important;
  transform: none !important;
}

.dash-account-card span,
.dash-account-card small,
.dash-brand small,
.dash-project small {
  color: #53657e !important;
  font-weight: 750 !important;
}

.dash-account-card strong,
.dash-brand strong,
.dash-project b {
  color: #111827 !important;
  font-weight: 900 !important;
}

.dash-topbar {
  justify-content: space-between;
  gap: 20px;
  margin: 6px 0 18px;
}

.dash-topbar h1 {
  max-width: 850px;
  margin: 8px 0 10px;
  color: var(--dash-ink);
  font-size: clamp(32px, 4.2vw, 64px);
  line-height: 0.94;
  letter-spacing: -0.06em;
}

.dash-topbar p {
  max-width: 720px;
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
}

.dash-eyebrow {
  color: #4f8cff;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dash-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.dash-soft,
.dash-primary {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 15px;
  font-weight: 900;
}

.dash-soft {
  background: #ffffff;
  color: var(--dash-ink);
  box-shadow: inset 0 0 0 1px var(--dash-line);
}

.dash-primary {
  background: linear-gradient(135deg, #67a4ff, #346ee8);
  color: #ffffff;
  box-shadow: 0 16px 34px rgba(79, 140, 255, 0.24);
}

.dash-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 18px;
  padding: 22px;
}

.dash-score-card {
  gap: 18px;
}

.dash-score-ring {
  display: grid;
  width: 138px;
  height: 138px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #ffffff 58%, transparent 59%),
    conic-gradient(var(--dash-brand) var(--score-deg, 0deg), #dbe7f7 0);
  box-shadow: inset 0 0 0 1px var(--dash-line), 0 18px 42px rgba(79, 140, 255, 0.16);
}

.dash-score-ring strong {
  color: var(--dash-ink);
  font-size: 38px;
  line-height: 1;
}

.dash-score-ring span {
  margin-top: -42px;
  color: var(--dash-muted);
  font-size: 12px;
  font-weight: 800;
}

.dash-hero h2 {
  margin: 12px 0 8px;
  color: var(--dash-ink);
  font-size: clamp(26px, 3vw, 42px);
  line-height: 1;
  letter-spacing: -0.045em;
}

.dash-checklist {
  display: grid;
  gap: 10px;
}

.dash-checklist div {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 1px var(--dash-line);
}

.dash-checklist span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  background: #f0f6ff;
  color: #3f72d9;
  font-weight: 900;
}

.dash-checklist strong,
.dash-checklist small {
  display: block;
}

.dash-checklist small {
  color: var(--dash-muted);
}

.dash-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.dash-metrics button {
  display: grid;
  gap: 6px;
  min-height: 118px;
  padding: 18px;
  color: var(--dash-ink);
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.dash-metrics button:hover,
.dash-metrics button.active {
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 1px rgba(79, 140, 255, 0.24), 0 18px 48px rgba(79, 140, 255, 0.16);
}

.dash-metrics span,
.dash-metrics small {
  color: var(--dash-muted);
  font-size: 12px;
  font-weight: 800;
}

.dash-metrics strong {
  color: var(--dash-ink);
  font-size: 32px;
  line-height: 1;
}

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
  margin-bottom: 18px;
}

.dash-grid-bottom {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.7fr);
}

.dash-panel {
  padding: 18px;
}

.dash-panel-head {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.dash-panel-head h3 {
  margin: 4px 0 0;
  color: var(--dash-ink);
  font-size: 22px;
  letter-spacing: -0.025em;
}

.dash-segmented {
  display: flex;
  gap: 5px;
  padding: 5px;
  border-radius: 15px;
  background: #eef5ff;
}

.dash-segmented button {
  min-height: 34px;
  padding: 0 11px;
  border-radius: 11px;
  background: transparent;
  color: var(--dash-muted);
  font-weight: 900;
}

.dash-segmented button.active {
  background: #ffffff;
  color: var(--dash-ink);
}

#dashChart {
  width: 100%;
  height: 300px;
  min-height: 300px;
  overflow: visible;
}

.dash-grid-line {
  stroke: rgba(116, 135, 166, 0.2);
  stroke-width: 1;
}

.dash-line-path {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dash-point {
  stroke: #ffffff;
  stroke-width: 4;
}

.dash-issues {
  display: grid;
  gap: 10px;
}

.dash-issue {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--dash-ink);
  text-align: left;
  box-shadow: inset 0 0 0 1px var(--dash-line);
}

.dash-issue i {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 13px;
  background: #f2f7ff;
  color: #3f72d9;
  font-style: normal;
  font-weight: 900;
}

.dash-issue strong,
.dash-issue small {
  display: block;
}

.dash-issue strong {
  color: var(--dash-ink);
}

.dash-table-wrap {
  overflow-x: auto;
}

.dash-table-wrap table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

.dash-table-wrap th,
.dash-table-wrap td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--dash-line);
  text-align: left;
}

.dash-table-wrap th {
  color: var(--dash-muted);
  font-size: 12px;
  font-weight: 900;
}

.dash-table-wrap td {
  color: var(--dash-ink);
}

.dash-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef6ff;
  color: #4777d9;
  font-size: 12px;
  font-weight: 900;
}

.dash-ai-card,
.dash-plan {
  display: grid;
  gap: 12px;
}

.dash-ai-card {
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 248, 255, 0.78));
  box-shadow: inset 0 0 0 1px var(--dash-line);
}

.dash-ai-card h4 {
  margin: 0;
  color: var(--dash-ink);
  font-size: 20px;
  letter-spacing: -0.02em;
}

.dash-ai-card p {
  margin: 0;
  line-height: 1.55;
}

.dash-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dash-tags span,
.dash-plan div {
  border-radius: 999px;
  background: #eef6ff;
  color: #4777d9;
  font-size: 12px;
  font-weight: 900;
}

.dash-tags span {
  padding: 7px 9px;
}

.dash-plan {
  margin-top: 12px;
}

.dash-plan div {
  padding: 12px;
  border-radius: 15px;
  color: var(--dash-ink);
}

.full {
  width: 100%;
}

.compact {
  min-height: 36px;
}

@keyframes auth-pop {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes dash-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1120px) {
  .dashboard-app {
    grid-template-columns: 1fr;
  }

  .dash-sidebar {
    position: static;
    min-height: auto;
  }

  .dash-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dash-hero,
  .dash-grid,
  .dash-grid-bottom {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .social-grid,
  .auth-form,
  .dash-metrics,
  .dash-nav {
    grid-template-columns: 1fr;
  }

  .auth-form label:nth-of-type(4),
  .auth-form label:nth-of-type(6) {
    grid-column: 1 / -1;
  }

  .dashboard-app {
    padding: 10px;
  }

  .dash-topbar,
  .dash-score-card,
  .dash-panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .dash-actions {
    justify-content: stretch;
    width: 100%;
  }

  .dash-actions button {
    flex: 1 1 170px;
  }
}

/* Hide native scrollbars completely while keeping wheel/touch scrolling. */
html,
body,
* {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}

/* Final dashboard handoff: after auth the real panel must fill the screen,
   not inherit the old embedded landing dashboard grid. */
body.is-dashboard-open .dashboard-app.dashboard-frame-host {
  display: block !important;
  grid-template-columns: none !important;
  gap: 0 !important;
  min-height: 100vh;
  padding: 0 !important;
  overflow: hidden;
  background:
    radial-gradient(circle at 8% 0%, rgba(205, 226, 255, 0.92), transparent 34%),
    radial-gradient(circle at 94% 8%, rgba(214, 242, 231, 0.72), transparent 28%),
    linear-gradient(135deg, #f8fbff 0%, #eef5ff 48%, #f7fbff 100%);
}

body.is-dashboard-open .dashboard-app.dashboard-frame-host .dashboard-frame-shell {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  background: transparent;
}

body.is-dashboard-open .dashboard-app.dashboard-frame-host .dashboard-frame-top {
  position: relative;
  z-index: 2;
  min-height: 64px;
  padding: 12px 22px;
  border-bottom: 1px solid rgba(116, 135, 166, 0.18);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
}

body.is-dashboard-open .dashboard-app.dashboard-frame-host iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #f8fbff;
}

/* Auth and dashboard cleanup */
.auth-modal {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  align-items: center;
  justify-items: center;
}

.auth-backdrop {
  position: fixed !important;
  inset: 0 !important;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% 20%, rgba(79, 140, 255, 0.18), transparent 34%),
    rgba(13, 22, 34, 0.54);
}

.auth-dialog {
  width: min(440px, calc(100vw - 28px));
  max-height: calc(100dvh - 32px);
  border-radius: 26px;
}

.social-grid {
  display: none !important;
}

.auth-copy h2 {
  font-size: clamp(30px, 5vw, 42px);
}

.auth-tabs {
  margin-top: 16px;
}

body.is-dashboard-open .dashboard-frame-top {
  display: none !important;
}

body.is-dashboard-open,
body.is-auth-open {
  overflow: hidden !important;
}

html {
  scroll-behavior: smooth;
}

body,
body * {
  -webkit-user-select: none;
  user-select: none;
}

input,
textarea,
select,
.auth-dialog input,
.auth-dialog textarea,
.auth-dialog select {
  -webkit-user-select: text;
  user-select: text;
}

.dashboard-app,
.dashboard-app * {
  -webkit-user-select: none !important;
  user-select: none !important;
}

.dashboard-app:not(.dashboard-frame-host) {
  display: none !important;
}

/* Patch v40: lock public shell while auth/dashboard overlays are active */
html.is-auth-open,
html.is-dashboard-open {
  overflow: hidden !important;
  height: 100% !important;
  overscroll-behavior: none !important;
}

html.is-dashboard-open body,
html.is-auth-open body {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

body.is-dashboard-open .site-shell {
  pointer-events: none !important;
}

body.is-dashboard-open .dashboard-app.dashboard-frame-host {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
  max-height: 100dvh !important;
  z-index: 1200 !important;
  display: block !important;
  overflow: hidden !important;
}

body.is-dashboard-open .dashboard-app.dashboard-frame-host .dashboard-frame-shell {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  display: block !important;
}

body.is-dashboard-open .dashboard-app.dashboard-frame-host iframe {
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  display: block !important;
}

.auth-modal {
  display: grid !important;
  place-items: center !important;
}

.auth-modal[hidden] {
  display: none !important;
}

.auth-dialog {
  overflow: auto !important;
  overscroll-behavior: contain !important;
}

@media (max-width: 620px) {
  .auth-dialog {
    width: min(420px, calc(100vw - 20px)) !important;
    max-height: calc(100dvh - 20px) !important;
  }
}

/* Product stability pass: explicit auth, loading, and dashboard transition states. */
.auth-dialog {
  padding-bottom: max(24px, env(safe-area-inset-bottom, 0px) + 20px) !important;
}

.auth-form {
  align-items: start;
}

.auth-message {
  display: none;
  min-height: 0;
  margin: 2px 0 0 !important;
  padding: 12px 14px;
  border: 1px solid rgba(50, 110, 230, 0.2);
  border-radius: 14px;
  background: rgba(50, 110, 230, 0.07);
  color: #244066 !important;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45 !important;
  overflow-wrap: anywhere;
}

.auth-message.is-visible {
  display: block;
}

.auth-message.error {
  border-color: rgba(223, 101, 79, 0.28);
  background: rgba(223, 101, 79, 0.09);
  color: #8f2d1f !important;
}

.auth-form input:disabled {
  color: #6b7480;
  background: #f5f8fc;
  cursor: wait;
}

.auth-submit {
  position: relative;
  gap: 10px;
  min-height: 48px;
}

.auth-submit:disabled {
  cursor: wait;
  opacity: 0.78;
  transform: none !important;
}

.auth-submit.is-loading::before,
.bridge-transition__spinner {
  content: "";
  display: inline-block;
  width: 17px;
  height: 17px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: bridge-spin 0.75s linear infinite;
}

.bridge-transition {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: none;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 20%, rgba(50, 110, 230, 0.2), transparent 34%),
    rgba(247, 250, 255, 0.94);
  backdrop-filter: blur(20px);
}

body.is-bridge-transition .bridge-transition {
  display: grid;
}

.bridge-transition__card,
.dashboard-frame-loading {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(440px, calc(100vw - 32px));
  padding: 26px;
  border: 1px solid rgba(50, 110, 230, 0.14);
  border-radius: 24px;
  background: #ffffff;
  color: #101317;
  text-align: center;
  box-shadow: 0 28px 80px rgba(20, 30, 42, 0.14);
}

.bridge-transition__card strong,
.dashboard-frame-loading strong {
  font-size: 20px;
  line-height: 1.2;
}

.bridge-transition__card p,
.dashboard-frame-loading p {
  margin: 0;
  color: #596574;
  font-size: 14px;
  line-height: 1.55;
}

.bridge-transition__card a {
  max-width: 100%;
  color: #245bd8;
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.dashboard-frame-shell {
  position: relative;
}

.dashboard-frame-loading {
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 0;
  transform: translate(-50%, -50%);
}

.dashboard-frame-shell iframe {
  position: relative;
  z-index: 1;
}

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

@media (max-width: 560px) {
  .auth-modal {
    padding: 10px !important;
  }

  .auth-dialog {
    width: calc(100vw - 20px) !important;
    border-radius: 22px !important;
    padding: 20px !important;
  }

  .auth-copy {
    padding-right: 44px;
  }

  .auth-copy h2 {
    font-size: 30px !important;
    line-height: 1.05 !important;
  }

  .auth-tabs {
    border-radius: 15px;
  }

  .auth-tabs button,
  .auth-submit {
    min-height: 46px;
  }
}
