/* Track Mishnah UI 2.17.18
 * Matched dashboard height, centered memorial pop-out, polished public/auth
 * shell, and signed-in-only release notes.
 * No database/schema, assignment, reminder, or messaging-data changes.
 */

@media (min-width: 1220px) {
  /* Match the visual height of the dashboard summary stack to My Learning.
   * The stack stays fully visible; the added height is distributed through
   * the three summary cards rather than creating another scrollbar. */
  body.app-theme-jewel .dashboard-primary-workspace > .project-overview {
    height: var(--tm-dashboard-workspace-height);
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 7px;
    overflow: hidden !important;
  }

  body.app-theme-jewel .dashboard-primary-workspace .dashboard-command-grid {
    min-height: 0;
    grid-template-rows: repeat(3, minmax(0, 1fr));
    align-items: stretch;
  }

  body.app-theme-jewel .dashboard-primary-workspace .dashboard-command-card {
    height: 100%;
    align-content: center;
  }

  /* Memorial is now a compact rail control that opens into a parchment
   * flyout. Keep the trigger centered vertically in the sidebar on ordinary
   * desktop heights, independent of the project/account utility cluster. */
  body.app-theme-jewel .tm-sidebar-memorial-popout {
    position: absolute;
    top: 50%;
    right: 12px;
    left: 12px;
    z-index: 35;
    margin: 0;
    transform: translateY(-50%);
  }

  body.app-theme-jewel .tm-sidebar-memorial-popout > summary {
    min-height: 42px;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    color: #f4ead7;
    border: 1px solid rgb(196 163 90 / 48%);
    border-radius: 7px;
    background: #0a4736;
    font-family: var(--serif);
    font-size: .76rem;
    font-weight: 750;
    list-style: none;
    cursor: pointer;
  }

  body.app-theme-jewel .tm-sidebar-memorial-popout > summary::-webkit-details-marker { display: none; }
  body.app-theme-jewel .tm-sidebar-memorial-popout > summary:hover,
  body.app-theme-jewel .tm-sidebar-memorial-popout[open] > summary {
    color: #fff8ea;
    border-color: var(--tm-memorial-gold-line);
    background: #0b513d;
  }

  body.app-theme-jewel .tm-sidebar-memorial-trigger-mark {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
  }

  body.app-theme-jewel .tm-sidebar-memorial-trigger-mark img {
    width: 19px;
    height: 19px;
    filter: sepia(1) saturate(5) hue-rotate(345deg) brightness(1.35);
  }

  body.app-theme-jewel .tm-sidebar-memorial-trigger-chevron {
    color: var(--tm-memorial-gold-line);
    font-size: 1rem;
    transition: transform .16s ease;
  }

  body.app-theme-jewel .tm-sidebar-memorial-popout[open] .tm-sidebar-memorial-trigger-chevron { transform: rotate(90deg); }

  body.app-theme-jewel .tm-sidebar-memorial-panel {
    position: absolute;
    top: 50%;
    left: calc(100% + 10px);
    width: min(310px, calc(100vw - var(--tm-memorial-sidebar-width) - 28px));
    min-height: 220px;
    display: grid;
    place-items: center;
    padding: 34px 24px 24px;
    color: var(--app-text);
    border: 1px solid var(--tm-memorial-gold-line);
    border-top-width: 2px;
    border-radius: 9px;
    background: var(--app-surface);
    box-shadow: 0 18px 44px rgb(28 42 36 / 22%);
    transform: translateY(-50%);
  }

  body.app-theme-jewel .tm-sidebar-memorial-panel::before {
    content: "";
    position: absolute;
    inset: 5px;
    pointer-events: none;
    border: 1px solid color-mix(in srgb, var(--tm-memorial-gold-line) 45%, transparent);
    border-radius: 5px;
  }

  body.app-theme-jewel .tm-sidebar-memorial-panel .tm-sidebar-memorial-mark {
    top: -19px;
    background: var(--tm-memorial-chrome);
  }

  body.app-theme-jewel .tm-sidebar-memorial-content {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 9px;
    min-height: 150px;
    text-align: center;
  }

  body.app-theme-jewel .tm-sidebar-memorial-panel .tm-sidebar-memorial-kicker { color: var(--tm-memorial-gold); }
  body.app-theme-jewel .tm-sidebar-memorial-panel .tm-sidebar-memorial-hebrew {
    color: var(--app-primary-ink);
    font-size: 1.02rem;
  }
  body.app-theme-jewel .tm-sidebar-memorial-panel .tm-sidebar-memorial-copy {
    color: var(--app-text-soft);
    font-size: .74rem;
  }

  /* Once the memorial leaves document flow, the utility area remains pinned
   * low and does not get pushed around by the flyout. */
  body.app-theme-jewel .tm-sidebar-utilities { margin-top: auto; }
}

@media (min-width: 1220px) and (max-height: 759px) {
  body.app-theme-jewel .tm-sidebar-memorial-popout {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    margin-top: 8px;
    transform: none;
  }
  body.app-theme-jewel .tm-sidebar-memorial-panel {
    top: 50%;
    transform: translateY(-50%);
  }
}

/* Public/signed-out shell: keep it compact and visually related to the signed
 * in rail without exposing private navigation. */
body.app-theme-jewel .public-site-header {
  border-bottom-color: var(--tm-memorial-gold-line);
  background: color-mix(in srgb, var(--app-surface) 96%, transparent);
  box-shadow: 0 5px 18px rgb(28 42 36 / 7%);
}

body.app-theme-jewel .public-header-inner {
  min-height: 62px;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 24px;
}

body.app-theme-jewel .public-header-inner .brand {
  color: var(--app-primary-ink);
}

body.app-theme-jewel .public-header-inner .brand-mark {
  color: var(--app-primary);
  background: transparent;
  box-shadow: none;
}

body.app-theme-jewel .public-header-inner .brand-mark img {
  width: 31px;
  height: 31px;
}

body.app-theme-jewel .public-header-inner .public-nav {
  justify-self: end;
  gap: 4px;
}

body.app-theme-jewel .public-header-inner .public-nav > a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  color: var(--app-text-soft);
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 700;
  text-decoration: none;
}

body.app-theme-jewel .public-header-inner .public-nav > a:hover,
body.app-theme-jewel .public-header-inner .public-nav > a[aria-current="page"] {
  color: var(--app-primary-ink);
  border-color: var(--app-border);
  background: var(--app-surface-soft);
}

/* Rebuilt sign-in experience: one centered split panel instead of a page-wide
 * intro and a card pushed against the far-right edge. */
body.app-theme-jewel.auth-page {
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--app-text);
  background: var(--app-bg);
}

body.app-theme-jewel.auth-page .auth-backdrop { display: none; }

body.app-theme-jewel.auth-page .auth-shell,
body.app-theme-jewel.auth-page .auth-shell-compact {
  width: min(1060px, calc(100% - 48px));
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr);
  align-items: stretch;
  gap: 0;
  margin: clamp(28px, 6vh, 72px) auto 48px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--tm-memorial-gold-line);
  border-radius: 14px;
  background: var(--app-surface);
  box-shadow: 0 24px 60px rgb(28 42 36 / 15%);
}

body.app-theme-jewel.auth-page .auth-intro {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 54px 58px;
  color: #f4ead7;
  background: var(--tm-memorial-chrome);
}

body.app-theme-jewel.auth-page .auth-intro .brand { color: #fff8ea; }
body.app-theme-jewel.auth-page .auth-intro .brand-mark { background: transparent; box-shadow: none; }
body.app-theme-jewel.auth-page .auth-intro .brand-mark img { filter: sepia(1) saturate(5) hue-rotate(345deg) brightness(1.35); }
body.app-theme-jewel.auth-page .auth-intro .brand small { color: #c9b993; }
body.app-theme-jewel.auth-page .auth-intro .eyebrow { margin: 42px 0 8px; color: #e0b84a; }
body.app-theme-jewel.auth-page .auth-intro h1 {
  max-width: 520px;
  margin: 0 0 16px;
  color: #fff8ea;
  font-size: clamp(2.2rem, 4vw, 3.35rem);
}
body.app-theme-jewel.auth-page .auth-intro > p:not(.eyebrow) {
  max-width: 500px;
  margin-bottom: 0;
  color: #d7c9aa;
  font-size: .94rem;
  line-height: 1.62;
}

body.app-theme-jewel.auth-page .auth-intro-points {
  display: grid;
  gap: 8px;
  margin-top: 32px;
}
body.app-theme-jewel.auth-page .auth-intro-points span {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  padding-top: 8px;
  border-top: 1px solid rgb(196 163 90 / 28%);
}
body.app-theme-jewel.auth-page .auth-intro-points strong { color: #e9c96d; font-family: var(--serif); font-size: .86rem; }
body.app-theme-jewel.auth-page .auth-intro-points small { color: #d7c9aa; font-size: .68rem; line-height: 1.45; }

body.app-theme-jewel.auth-page .auth-card,
body.app-theme-jewel.auth-page .auth-shell .auth-card {
  width: auto;
  max-width: none;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  justify-self: stretch;
  padding: 48px 46px;
  border: 0;
  border-radius: 0;
  background: var(--app-surface);
  box-shadow: none;
}

body.app-theme-jewel.auth-page .auth-card-heading { margin-bottom: 24px; }
body.app-theme-jewel.auth-page .auth-card-heading h2 { margin-bottom: 8px; color: var(--app-primary-ink); font-size: 2rem; }
body.app-theme-jewel.auth-page .auth-card .stack-form { gap: 15px; }
body.app-theme-jewel.auth-page .auth-card input {
  min-height: 44px;
  border-color: var(--app-border-strong);
  background: var(--app-surface-soft);
}
body.app-theme-jewel.auth-page .auth-card input:focus { border-color: var(--app-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--app-primary) 15%, transparent); }
body.app-theme-jewel.auth-page .auth-card .button-primary { min-height: 44px; margin-top: 2px; }
body.app-theme-jewel.auth-page .auth-theme-toggle {
  position: fixed;
  top: auto;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  color: var(--app-primary-ink);
  border-color: var(--tm-memorial-gold-line);
  background: var(--app-surface);
  box-shadow: var(--app-shadow-sm);
}
body.app-theme-jewel.auth-page .service-notice-inner { padding-right: 0; }

@media (max-width: 900px) {
  body.app-theme-jewel .public-header-inner { grid-template-columns: 1fr; gap: 6px; padding-block: 8px; }
  body.app-theme-jewel .public-header-inner .public-nav { width: 100%; justify-self: stretch; justify-content: flex-start; overflow-x: auto; }

  body.app-theme-jewel.auth-page .auth-shell,
  body.app-theme-jewel.auth-page .auth-shell-compact {
    width: min(680px, calc(100% - 28px));
    min-height: 0;
    grid-template-columns: 1fr;
    margin-block: 24px 42px;
  }
  body.app-theme-jewel.auth-page .auth-intro { padding: 34px 30px; }
  body.app-theme-jewel.auth-page .auth-intro .eyebrow { margin-top: 26px; }
  body.app-theme-jewel.auth-page .auth-intro h1 { font-size: clamp(2rem, 8vw, 2.7rem); }
  body.app-theme-jewel.auth-page .auth-card,
  body.app-theme-jewel.auth-page .auth-shell .auth-card { padding: 34px 30px; }
}

@media (max-width: 520px) {
  body.app-theme-jewel.auth-page .auth-shell,
  body.app-theme-jewel.auth-page .auth-shell-compact { width: calc(100% - 20px); border-radius: 10px; }
  body.app-theme-jewel.auth-page .auth-intro { padding: 28px 22px; }
  body.app-theme-jewel.auth-page .auth-intro-points { display: none; }
  body.app-theme-jewel.auth-page .auth-card,
  body.app-theme-jewel.auth-page .auth-shell .auth-card { padding: 28px 22px 32px; }
  body.app-theme-jewel.auth-page .auth-theme-toggle { right: 10px; bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  body.app-theme-jewel .tm-sidebar-memorial-trigger-chevron { transition-duration: .01ms !important; }
}

@media (min-width: 1220px) {
  /* The flyout lives outside the rail's box, so the desktop rail must not clip
   * it. All ordinary rail content already fits without a rail scrollbar. */
  body.app-theme-jewel .tm-memorial-sidebar { overflow: visible !important; }
}

body.app-theme-jewel.auth-page .auth-intro img.brand-mark {
  width: 40px;
  height: 40px;
  padding: 3px;
  border: 1px solid rgb(196 163 90 / 46%);
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  filter: sepia(1) saturate(5) hue-rotate(345deg) brightness(1.35);
}
