.hd-report-heading {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: 8px 16px; padding-bottom: 18px;
}
.hd-report-heading .brand { display: none; }
.hd-report-heading h1 { margin: 0; }
.hd-report-heading > p { grid-column: 1; grid-row: 2; text-align: left; font-size: .875rem; }
.hd-report-pdf {
  display: inline-flex; align-items: center; min-height: 40px; padding: 5px 10px;
  grid-column: 2; grid-row: 1 / span 2; justify-self: end;
  color: var(--green); text-decoration: none; border-radius: 8px;
  border: 1px solid #9cb9aa; font-size: .875rem; font-weight: 700; white-space: nowrap;
}
.hd-report-pdf:hover { background: #dcebe1; }
.portal-report > main { width: auto; font-family: system-ui, "Segoe UI", Arial, sans-serif; }
.portal-report > main :where(section, article, details, nav, div)[id] { scroll-margin-top: 90px; }
.portal-report > main .quick { top: 60px; }
.portal-report > main .chapter,
.portal-report > main :is(.chapter-intro, .passage p) { max-width: none; }
.portal-header {
  display: block; position: sticky; top: 0; z-index: 10; margin: 0; padding: 0 16px;
  background: #f4f6f1; border-bottom: 1px solid var(--line);
}
.portal-header-inner {
  min-height: 59px; max-width: 1200px; margin-inline: auto; padding-block: 7px;
  display: flex; align-items: center; gap: 12px 22px;
}
.portal-brand { flex: none; color: var(--green); text-decoration: none; font-size: .96rem; letter-spacing: 0; }
.header-slot { flex: 1; min-width: 0; }
.portal-menu, .portal-menu nav, .header-account, .header-actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px 10px;
}
.portal-menu { justify-content: space-between; gap: 7px 14px; }
.portal-menu nav a, .header-text-action {
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 5px 9px;
  border: 1px solid transparent; border-radius: 8px; background: transparent;
  color: var(--green); font-size: .86rem; font-weight: 680; text-decoration: none;
}
.portal-menu nav a:hover, .portal-menu nav a[aria-current], .header-text-action:hover { background: #dcebe1; }
.header-account { margin-inline-start: auto; }
.header-account label { max-width: 13rem; }
.header-account select { min-height: 36px; font-size: .86rem; }
.header-actions .secondary { white-space: nowrap; }
.menu-icon {
  width: 17px; height: 17px; flex: none; fill: none;
  stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round;
}
#share-service { gap: 8px; }
.portal-header + main :where(section, form, details)[id] { scroll-margin-top: 90px; }
.portal-icon-button {
  width: 44px; min-width: 44px; min-height: 44px; padding: 0;
  background: transparent; border-color: var(--line); color: var(--green);
}
.menu-toggle span, .menu-toggle span::before, .menu-toggle span::after {
  display: block; width: 19px; height: 2px; background: currentColor; border-radius: 2px;
}
.menu-toggle span { position: relative; }
.menu-toggle span::before, .menu-toggle span::after { content: ""; position: absolute; left: 0; }
.menu-toggle span::before { top: -6px; }
.menu-toggle span::after { top: 6px; }
.close-button { font-size: 1.55rem; font-weight: 450; line-height: 1; }
.portal-header, .portal-drawer, .portal-dialog {
  font-family: system-ui, "Segoe UI", Arial, sans-serif;
}
.portal-drawer, .portal-dialog {
  padding: 0; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
}
.portal-drawer::backdrop, .portal-dialog::backdrop { background: #142f2669; }
:is(.portal, .portal-report):has(.portal-drawer[open], .portal-dialog[open]) { overflow: hidden; }
.portal-drawer {
  position: fixed; inset: 0 auto 0 0; margin: 0; border-width: 0 1px 0 0;
  width: min(87vw, 350px); max-width: none; height: 100%; height: 100dvh; max-height: none; overflow: hidden;
}
.dialog-body { padding: 17px; }
.drawer-body { display: flex; flex-direction: column; height: 100%; }
.dialog-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dialog-toolbar-end { justify-content: flex-end; }
.portal-drawer .dialog-toolbar {
  min-height: 56px; padding: 5px 16px 6px; border-bottom: 1px solid var(--line); flex: none;
}
#drawer-slot { display: flex; flex: 1; min-height: 0; padding: 12px 16px max(16px, env(safe-area-inset-bottom)); }
.portal-dialog { width: min(480px, calc(100% - 28px)); max-height: calc(100% - 28px); border-radius: 16px; }
.portal-drawer .portal-menu {
  flex: 1; flex-flow: column nowrap; align-items: stretch; justify-content: flex-start; min-width: 0; gap: 12px;
}
.portal-drawer nav, .portal-drawer .header-account, .portal-drawer .header-actions { display: grid; width: 100%; }
.portal-drawer nav { flex: 1; align-content: start; min-height: 0; overflow-y: auto; padding: 3px; }
.portal-drawer nav a, .portal-drawer .header-text-action { min-height: 46px; }
.portal-drawer .header-account {
  margin: auto 0 0; border-top: 1px solid var(--line); padding-top: 10px; gap: 8px;
  max-height: 75%; overflow-y: auto; flex: none;
}
.portal-drawer .header-account label { max-width: none; }
.portal-drawer .header-text-action { justify-content: flex-start; }
.portal-drawer .header-actions .secondary { min-height: 44px; white-space: normal; }
.portal-title { padding-bottom: 12px; margin-bottom: 16px; }
.portal-title h1 { max-width: 24ch; }
.portal-title p { margin-bottom: 5px; }
.overview { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(150px, .7fr); gap: 16px; align-items: center; }
.overview:not(:has(img:not([hidden]))) { grid-template-columns: 1fr; }
.overview img { display: block; height: min(410px, 62vw); max-width: 100%; object-fit: contain; justify-self: center; }
.overview h2 { font-size: clamp(1.33rem, 4vw, 2rem); margin-bottom: 9px; overflow-wrap: anywhere; }
.state-mark { color: #185e4d; font-size: .82rem; font-weight: 680; margin-bottom: 5px; }
.overview .action-links, .pair-empty .action-links { margin-top: 14px; }
.minor-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 14px; font-size: .91rem; }
.minor-actions a, .portal footer a { color: #185e4d; text-underline-offset: 3px; }
.card-divider { margin-top: 17px; padding-top: 16px; border-top: 1px solid #c9d7ce; }
.card-divider h3 { margin: 0 0 5px; font-size: 1.1rem; }
.editor, .pair-question { margin-top: 16px; }
.editor-title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.editor .birth-fields, .editor #chart-field { margin-top: 12px; }
.editor-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; }
.editor .action-links { margin-top: 12px; }
.pair-question label { max-width: 660px; margin: 8px 0; }
.account-entry { max-width: 565px; }
.entry-layout:has(.account-entry:not([hidden])) {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: stretch;
}
.entry-layout:has(.account-entry:not([hidden])) .account-entry { max-width: none; }
.entry-art, .pair-art { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 14px; }
.entry-art { min-height: 0; }
.entry-layout:not(:has(.account-entry:not([hidden]))) .entry-art { display: none; }
.pair-empty { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr); gap: 20px; align-items: center; }
.pair-art { max-height: 185px; aspect-ratio: 3 / 2; }
.account-entry form, #invite-form { display: grid; gap: 10px; align-items: start; }
.account-entry form button, #invite-form button { justify-self: start; }
.account-entry .switcher { margin-top: 0; }
.password-field { display: grid; gap: 4px; }
.password-control { position: relative; }
.password-control input { min-height: 46px; padding-inline-end: 52px; }
.password-control input::-ms-reveal { display: none; }
.password-toggle {
  position: absolute; inset-block: 1px; inset-inline-end: 1px;
  width: 44px; min-height: 0; padding: 0; border: 0; border-radius: 7px;
  color: var(--green); background: transparent;
}
.password-toggle:hover { background: #e9f3ec; }
.password-toggle:focus-visible { outline-offset: -3px; }
.password-eye {
  position: relative; width: 16px; height: 16px; border: 1.7px solid currentColor;
  border-radius: 72% 8%; transform: rotate(45deg);
}
.password-eye::before, .password-eye::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  background: currentColor; border-radius: 2px;
}
.password-eye::before { width: 5px; height: 5px; border-radius: 50%; transform: translate(-50%, -50%); }
.password-eye::after {
  display: none; width: 21px; height: 2px;
  transform: translate(-50%, -50%) rotate(90deg); box-shadow: 0 0 0 1px var(--surface);
}
.password-control input[type=text] + .password-toggle .password-eye::after { display: block; }
.field-note { color: var(--muted); font-size: .82rem; font-weight: 400; }
#invite-form { margin-top: 9px; }
#pair-share-status { margin-top: 10px; }
.share-panel { margin-top: 16px; max-width: 670px; }
.share-panel input { margin-bottom: 8px; }
.share-panel h2 { margin-bottom: 8px; }
.portal-dialog .share-panel { margin: 0; padding: 0; border: 0; }
#share-status:empty { display: none; }
.portal #message { margin-top: 10px; min-height: 1.4em; }
.portal #message:empty { display: none; }
@media (max-width: 620px) {
  .entry-layout:has(.account-entry:not([hidden])), .pair-empty { display: grid; grid-template-columns: minmax(0, 1fr); }
  .entry-art, .pair-art { max-height: 145px; }
  .overview { grid-template-columns: minmax(0,1fr); }
  .overview img { height: min(290px,65vw); }
  .hd-report-pdf { min-height: 44px; }
  .hd-report-heading > div { grid-column: 1 / -1; }
  .hd-report-pdf { grid-row: 2; align-self: center; }
}
@media (max-width: 900px) {
  .portal-header-inner { min-height: 55px; padding-block: 5px; gap: 12px; }
  .header-slot { display: none; }
  .menu-toggle { margin-inline-start: auto; }
  .portal-report > main .quick { top: 56px; }
}
@media (max-width: 390px) { .editor-grid { grid-template-columns: 1fr; } }
