/* Track Mishnah UI 2.17.15
 * Dashboard balance + sidebar notification anchoring.
 * Presentation-only: no database/schema, assignment, reminder, permission,
 * export, or messaging-data behavior changes.
 */

@media (min-width: 1220px) {
  /* Give the left summary stack enough room to read, but keep My Learning as
   * the primary work surface. */
  body.app-theme-jewel .dashboard-primary-workspace {
    --tm-dashboard-workspace-height: clamp(620px, calc(100vh - 72px), 760px);
    grid-template-columns: minmax(360px, .78fr) minmax(0, 2.12fr);
    gap: 10px;
    align-items: stretch;
  }

  /* v2.17.7 used a wide internal two-column project-overview grid. That rule
   * is inappropriate once the overview itself becomes the narrow left rail of
   * the dashboard workspace. Reset it into the intended vertical card stack. */
  body.app-theme-jewel .dashboard-primary-workspace > .project-overview {
    min-width: 0;
    height: var(--tm-dashboard-workspace-height);
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none;
  }

  body.app-theme-jewel .dashboard-primary-workspace .project-overview-heading {
    min-width: 0;
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    justify-content: flex-start;
    gap: 7px;
    padding: 10px 11px;
    border: 1px solid var(--app-border);
    border-top: 2px solid var(--tm-memorial-gold-line);
    border-radius: 8px;
    background: var(--app-surface);
    box-shadow: var(--app-shadow-sm);
  }

  body.app-theme-jewel .dashboard-primary-workspace .project-overview-identity {
    width: 100%;
    min-width: 0;
    gap: 9px;
    align-items: flex-start;
  }

  body.app-theme-jewel .dashboard-primary-workspace .project-overview-photo {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 9px;
  }

  body.app-theme-jewel .dashboard-primary-workspace .project-overview h1 {
    font-size: clamp(1.3rem, 1.55vw, 1.58rem);
  }

  body.app-theme-jewel .dashboard-primary-workspace .project-memorial-name {
    margin-top: 2px;
    font-size: .86rem;
  }

  body.app-theme-jewel .dashboard-primary-workspace .overview-start-date,
  body.app-theme-jewel .dashboard-primary-workspace .overview-deadline {
    margin-top: 5px;
    font-size: .62rem;
    line-height: 1.4;
  }

  body.app-theme-jewel .dashboard-primary-workspace .project-overview-heading > .button {
    min-height: 32px;
    align-self: flex-start;
    padding: 5px 9px;
    font-size: .65rem;
  }

  body.app-theme-jewel .dashboard-primary-workspace .dashboard-command-grid {
    min-width: 0;
    flex: 0 0 auto;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px;
    margin: 0;
  }

  body.app-theme-jewel .dashboard-primary-workspace .dashboard-command-card {
    min-width: 0;
    min-height: 0 !important;
    gap: 5px;
    padding: 9px 10px;
  }

  body.app-theme-jewel .dashboard-primary-workspace .dashboard-card-heading {
    gap: 8px;
    margin-bottom: 2px;
    padding-bottom: 5px;
  }

  body.app-theme-jewel .dashboard-primary-workspace .dashboard-card-heading h2 {
    font-size: .88rem;
  }

  body.app-theme-jewel .dashboard-primary-workspace .dashboard-card-link-cue {
    font-size: .56rem;
  }

  body.app-theme-jewel .dashboard-primary-workspace .continue-learning-main {
    gap: 6px;
  }

  body.app-theme-jewel .dashboard-primary-workspace .continue-progress-number,
  body.app-theme-jewel .dashboard-primary-workspace .personal-progress-percent {
    font-size: 1.24rem;
  }

  body.app-theme-jewel .dashboard-primary-workspace .continue-learning-copy h3 {
    font-size: .88rem;
  }

  body.app-theme-jewel .dashboard-primary-workspace .continue-learning-copy p,
  body.app-theme-jewel .dashboard-primary-workspace .personal-progress-lead,
  body.app-theme-jewel .dashboard-primary-workspace .personal-goal-note,
  body.app-theme-jewel .dashboard-primary-workspace .progress-segment-legend,
  body.app-theme-jewel .dashboard-primary-workspace .progress-legend {
    font-size: .56rem;
  }

  body.app-theme-jewel .dashboard-primary-workspace .continue-learning-stats div,
  body.app-theme-jewel .dashboard-primary-workspace .personal-goal-stats div,
  body.app-theme-jewel .dashboard-primary-workspace .project-progress-card .progress-metrics article {
    padding: 4px 5px;
  }

  body.app-theme-jewel .dashboard-primary-workspace .continue-learning-stats dt,
  body.app-theme-jewel .dashboard-primary-workspace .personal-goal-stats dt,
  body.app-theme-jewel .dashboard-primary-workspace .project-progress-card .progress-metrics article span {
    font-size: .48rem;
  }

  body.app-theme-jewel .dashboard-primary-workspace .continue-learning-stats dd,
  body.app-theme-jewel .dashboard-primary-workspace .personal-goal-stats dd,
  body.app-theme-jewel .dashboard-primary-workspace .project-progress-card .progress-metrics article strong {
    font-size: .72rem;
  }

  body.app-theme-jewel .dashboard-primary-workspace .project-progress-card .progress-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  /* My Learning is a bounded work surface with no horizontal scrollbar. */
  body.app-theme-jewel .dashboard-primary-workspace > #my-learning {
    min-width: 0;
    height: var(--tm-dashboard-workspace-height);
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
  }

  body.app-theme-jewel .dashboard-primary-workspace > #my-learning .claim-group-card-shell {
    min-width: 0;
    max-width: 100%;
  }

  body.app-theme-jewel .dashboard-primary-workspace > #my-learning .claim-group-card-shell:not(:has(.claim-group-card[open])) {
    grid-template-columns: minmax(0, 1fr) 168px;
  }

  body.app-theme-jewel .dashboard-primary-workspace > #my-learning .claim-group-summary {
    min-width: 0;
    min-height: 68px;
    grid-template-columns: minmax(100px, .72fr) minmax(135px, 1.15fr) minmax(155px, 1.16fr) minmax(115px, .82fr) 42px;
    gap: 5px 10px;
    padding: 9px 10px;
  }

  body.app-theme-jewel .dashboard-primary-workspace > #my-learning .claim-group-portion,
  body.app-theme-jewel .dashboard-primary-workspace > #my-learning .claim-group-progress-copy,
  body.app-theme-jewel .dashboard-primary-workspace > #my-learning .claim-group-remaining {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body.app-theme-jewel .dashboard-primary-workspace > #my-learning .claim-group-portion,
  body.app-theme-jewel .dashboard-primary-workspace > #my-learning .claim-group-remaining {
    font-size: .55rem;
  }

  body.app-theme-jewel .dashboard-primary-workspace > #my-learning .claim-group-progress-copy {
    font-size: .61rem;
  }

  body.app-theme-jewel .dashboard-primary-workspace > #my-learning .claim-group-quick-actions {
    width: 168px;
    min-width: 0 !important;
    max-width: 168px;
    align-content: center;
    align-items: stretch;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 5px;
    padding: 7px;
  }

  body.app-theme-jewel .dashboard-primary-workspace > #my-learning .claim-group-quick-actions form,
  body.app-theme-jewel .dashboard-primary-workspace > #my-learning .claim-group-quick-actions .button {
    width: 100%;
  }

  body.app-theme-jewel .dashboard-primary-workspace > #my-learning .claim-group-quick-actions .button {
    min-height: 30px;
    padding: 4px 6px;
    white-space: normal;
    font-size: .58rem;
    line-height: 1.2;
  }

  /* The notification flyout is positioned by app.js from the visible sidebar
   * Notifications row. These fallbacks keep it next to the rail before JS has
   * measured the trigger. */
  body.app-theme-jewel .signed-in-site-header .notification-panel-shell {
    top: var(--tm-notification-top, auto);
    right: auto;
    bottom: var(--tm-notification-bottom, 76px);
    left: var(--tm-notification-left, calc(var(--tm-memorial-sidebar-width) + 10px));
    width: min(400px, calc(100vw - var(--tm-memorial-sidebar-width) - 30px));
  }

  body.app-theme-jewel .signed-in-site-header .notification-panel {
    max-height: min(520px, calc(100vh - 24px));
    overflow: auto;
  }
}
