/* Authoritative account control loaded after the legacy stylesheet. */
body.dashboard-active .account-bar > div.account-menu {
  position: relative;
  display: block;
  box-sizing: border-box;
  width: 46px !important;
  min-width: 46px !important;
  height: 44px;
  min-height: 44px;
  flex: 0 0 46px;
  padding: 0 !important;
  border: 0;
  background: transparent;
}

body.dashboard-active .account-bar > div.account-menu::before,
body.dashboard-active .account-bar > div.account-menu::after {
  display: none !important;
  content: none !important;
}

body.dashboard-active #account-button {
  position: relative;
  display: grid;
  box-sizing: border-box;
  width: 46px;
  min-width: 46px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  overflow: hidden;
  font-size: 0;
}

body.dashboard-active #account-button::before {
  position: absolute;
  top: calc(50% + 1px);
  left: calc(50% + 1px);
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #102d3c;
  font-size: 0.65rem;
  font-weight: 900;
  line-height: 1;
  transform: translate(-50%, -50%);
  content: attr(data-initials);
}

body.dashboard-active #account-menu-panel {
  top: calc(100% + 10px);
  right: 0;
  left: auto;
}

/* Production-ready product guide: clear hierarchy, resilient sizing, and readable controls. */
body.dashboard-active .help-assistant-panel {
  width: min(440px, calc(100vw - 36px));
  max-height: min(700px, calc(100dvh - 36px));
  border: 1px solid rgba(13, 115, 110, 0.24);
  border-radius: 18px;
  background: #fffefa;
  box-shadow: 0 24px 70px rgba(7, 42, 51, 0.25);
}

body.dashboard-active .help-assistant-header {
  align-items: center;
  padding: 18px;
  background: linear-gradient(135deg, #0a4852, #12354d);
}

body.dashboard-active .help-assistant-header .eyebrow {
  margin-bottom: 3px;
  color: #74dfd0;
}

body.dashboard-active .help-assistant-header h2 {
  margin: 0;
  font-size: 1.35rem;
}

body.dashboard-active .help-assistant-header .quiet-button {
  min-height: 40px;
  padding: 9px 13px;
  border-radius: 10px;
}

body.dashboard-active .help-assistant-messages {
  min-height: 230px;
  padding: 16px;
  background: linear-gradient(180deg, #f5fbfa 0%, #fffefa 100%);
  scrollbar-gutter: stable;
}

body.dashboard-active .help-message {
  border-radius: 14px;
  font-weight: 650;
  box-shadow: 0 5px 18px rgba(16, 45, 60, 0.06);
}

body.dashboard-active .help-assistant-prompts {
  padding: 2px 16px 14px;
  background: #fffefa;
}

body.dashboard-active .help-assistant-prompts button {
  min-height: 42px;
  border-radius: 10px;
  font-weight: 800;
}

body.dashboard-active .help-assistant-form {
  align-items: start;
  padding: 14px 16px 16px;
  background: #fff;
}

body.dashboard-active .help-assistant-form input {
  min-width: 0;
  min-height: 44px;
}

body.dashboard-active .help-assistant-form > button {
  min-height: 44px;
}

body.dashboard-active .help-assistant-disclaimer {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  color: #60717a;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.4;
}

body.dashboard-active .help-assistant-disclaimer a {
  color: #086c68;
  font-weight: 850;
}

/*
 * Focused desktop workspaces.
 * Keep the application shell stable and let only the selected workspace scroll.
 * On the Queue route, setup/demo cards no longer sit above the repair list and
 * create a multi-screen page.
 */
@media (min-width: 761px) {
  body.dashboard-active .dashboard[data-view="queue"] > .onboarding-wizard,
  body.dashboard-active .dashboard[data-view="queue"] > .rehearsal-card,
  body.dashboard-active .dashboard[data-view="queue"] > .demo-tour {
    display: none !important;
  }

  body.dashboard-active .dashboard[data-view] > .dashboard-grid,
  body.dashboard-active .dashboard[data-view] > .dashboard-card-grid {
    min-height: 0;
    max-height: calc(100dvh - 430px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  body.dashboard-active .dashboard[data-view] > .dashboard-grid:focus-within,
  body.dashboard-active .dashboard[data-view] > .dashboard-card-grid:focus-within {
    outline: 2px solid rgba(13, 115, 110, 0.16);
    outline-offset: 2px;
  }
}

@media (min-width: 1180px) {
  body.dashboard-active .dashboard-jump-nav {
    grid-row: 2 / span 2;
  }

  body.dashboard-active .dashboard[data-view] > .dashboard-grid,
  body.dashboard-active .dashboard[data-view] > .dashboard-card-grid {
    max-height: calc(100dvh - 250px);
  }
}

/* Authoritative mobile dashboard layout loaded after the legacy stylesheet. */
@media (max-width: 520px) {
  body.dashboard-active .app-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 11px;
    min-height: 0;
    padding: 12px;
  }

  body.dashboard-active .app-brand .eyebrow {
    display: none;
  }

  body.dashboard-active .dashboard-lockup img {
    width: 38px;
    height: 38px;
  }

  body.dashboard-active .dashboard-lockup strong {
    font-size: 1.38rem;
  }

  body.dashboard-active .account-bar {
    display: grid;
    width: 100%;
    grid-template-columns: auto 42px minmax(0, 1fr) 42px;
    gap: 8px;
    align-items: center;
  }

  body.dashboard-active .account-bar > .shop-menu {
    grid-column: 1 / -1;
    width: 100%;
  }

  body.dashboard-active #shop-menu-toggle {
    width: 100%;
    min-width: 0;
    min-height: 48px;
  }

  body.dashboard-active #plan-pill {
    grid-column: 1;
    min-height: 40px;
  }

  body.dashboard-active .account-bar > .notification-center {
    grid-column: 2;
    width: 42px;
    min-width: 42px;
  }

  body.dashboard-active #notification-toggle.header-alert {
    width: 42px;
    min-width: 42px;
    height: 42px;
  }

  body.dashboard-active #help-assistant-button {
    grid-column: 3;
    width: 100%;
    min-width: 0;
    min-height: 42px;
    white-space: nowrap;
  }

  body.dashboard-active .account-bar > div.account-menu {
    box-sizing: border-box;
    grid-column: 4;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px;
    padding: 0 !important;
  }

  body.dashboard-active #account-button {
    display: grid;
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    place-items: center;
    overflow: hidden;
    font-size: 0;
  }

  body.dashboard-active #account-button::before {
    position: absolute;
    top: calc(50% + 1px);
    left: calc(50% + 1px);
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 50%;
    background: #fff;
    color: #102d3c;
    font-size: 0.65rem;
    font-weight: 900;
    transform: translate(-50%, -50%);
    content: attr(data-initials);
  }

  body.dashboard-active .help-assistant-panel {
    inset: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
    width: auto;
    max-height: none;
    border-radius: 18px;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
  }

  body.dashboard-active .help-assistant-header {
    padding: 14px;
  }

  body.dashboard-active .help-assistant-messages {
    min-height: 0;
    padding: 14px;
  }

  body.dashboard-active .help-assistant-prompts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 14px 12px;
  }

  body.dashboard-active .help-assistant-form {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px 14px max(12px, env(safe-area-inset-bottom));
  }

  body.dashboard-active .dashboard-jump-nav {
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  body.dashboard-active .dashboard-jump-nav::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 360px) {
  body.dashboard-active .help-assistant-prompts,
  body.dashboard-active .help-assistant-form {
    grid-template-columns: 1fr;
  }
}
