.journal-panel[ihb-journal-shell] {
  position: fixed;
  left: 18px;
  top: 102px;
  width: 320px;
  max-height: calc(100dvh - 164px);
  overflow: auto;
  z-index: 700;
  padding: 24px;
  background: var(--glass);
  backdrop-filter: blur(18px);
  border: 1px solid var(--surface-border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.journal-summary[ihb-journal-shell] {
  display: none;
}

@media(max-width:850px) {
  .journal-panel[ihb-journal-shell] {
    width: 270px;
  }
}

@media(max-width:600px) {
  .journal-panel[ihb-journal-shell] {
    top: auto;
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: 10px;
    right: 10px;
    width: auto;
    max-height: none;
    overflow: hidden;
    padding: 0;
    border-radius: 20px;
  }

  .journal-summary[ihb-journal-shell] {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 24px;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    list-style: none;
    cursor: pointer;
    touch-action: manipulation;
  }

  .journal-summary[ihb-journal-shell]::-webkit-details-marker {
    display: none;
  }

  .journal-summary[ihb-journal-shell]::marker {
    content: "";
  }

  .journal-summary:focus-visible[ihb-journal-shell] {
    outline: 2px solid var(--focus);
    outline-offset: -4px;
    border-radius: 18px;
  }

  .journal-metrics[ihb-journal-shell] {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    text-align: center;
  }

  .journal-metrics>span+span[ihb-journal-shell] {
    border-left: 1px solid var(--line);
  }

  .journal-metrics strong[ihb-journal-shell] {
    display: block;
    color: var(--text);
    font-size: 24px;
    font-weight: 500;
    line-height: 1.15;
  }

  .journal-metrics span>span[ihb-journal-shell] {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.4;
    color: var(--muted);
  }

  .journal-chevron[ihb-journal-shell] {
    color: var(--muted);
    font-size: 22px;
    text-align: center;
    line-height: 1;
  }

  .journal-panel[open][data-journal-ready] .journal-chevron[ihb-journal-shell] {
    transform: rotate(180deg);
  }

  .journal-panel[open] .journal-summary[ihb-journal-shell] {
    border-bottom: 1px solid var(--line);
  }

  .journal-panel[open][ihb-journal-shell] {
    z-index: 720;
  }

  .journal-content[ihb-journal-shell] {
    padding: 20px;
    max-height: calc(100dvh - 132px - var(--journal-card-height, 80px) - env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  /* Keep the first mobile paint compact before the native disclosure is initialized. */
  .journal-panel:not([data-journal-ready]) .journal-content[ihb-journal-shell] {
    display: none;
  }

  .journal-content[ihb-journal-shell]  .stats {
    display: none;
  }
}
