.portal {
  --portal-glass: #ffffffa8;
  --portal-mint: #e5f2e8;
  display: grid;
  gap: clamp(18px, 2.5vw, 34px);
  min-width: 0;
}

main:has(#page > .portal) {
  background: radial-gradient(ellipse at right top, #deeee5 0, transparent 65%), var(--background);
}

.portal-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px 24px;
  flex-wrap: wrap;
  padding: clamp(18px, 3.5vw, 48px) 0 clamp(4px, 1vw, 14px);
}

.portal-heading h1 { font-size: clamp(37px, 6vw, 74px); }
.project-screen .portal-tile { display: grid; align-content: start; gap: 14px; background: #fbfdfbef; }
.project-screen form, .issue-list li a { display: grid; gap: 12px; }
.project-screen form .button { justify-self: start; }
.issue-edit summary { cursor: pointer; color: var(--green); margin-block: 8px; }
.project-screen pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.overview-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px,1fr)); gap: 16px; }
.overview-counts a { display: grid; gap: 6px; text-decoration: none; }
.overview-counts strong { font: 500 2.4rem var(--display-font); }
.issue-list { list-style: none; margin: 0; padding: 0; }
.issue-list a { padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.issue-list small { color: var(--muted); }
.issue-list a:hover strong, .overview-counts a:hover { text-decoration: underline; }
.policy-tools { margin-block: 10px; }
main.garden-home:has(.project-screen) { background: var(--background) url("/glass-garden.webp") no-repeat left bottom / cover; }
#menu-toggle { display: none; }
.workflow:has(.gate) .node.gate { grid-row: 1; grid-column: 4; }
.workflow:has(.gate) .node.deliver { grid-row: 2; grid-column: 4; }
@media (max-width: 690px) {
  .masthead:has(.workspace-controls:not([hidden])) { grid-template-columns: minmax(0, 1fr) auto; }
  #menu-toggle:not([hidden]) { display: inline-flex; grid-row: 1; grid-column: 2; }
  .masthead:has(.workspace-controls:not([hidden])) nav:not(.menu-open) { display: none; }
  .masthead:has(.workspace-controls:not([hidden])) .workspace-controls { grid-column: 1/-1; grid-row: 2; justify-content: start; }
  .masthead:has(.workspace-controls:not([hidden])) nav.menu-open { grid-row: 3; grid-column: 1/-1; }
  .masthead:has(.workspace-controls:not([hidden])) .reader-mode { grid-row: 4; }
  .workspace-controls #sign-out { display: none; }
  .workflow:has(.gate) .node.gate { grid-row: 4; grid-column: 1; }
  .workflow:has(.gate) .node.deliver { grid-row: 4; grid-column: 2; }
}
.portal-heading p { margin-top: .65rem; color: var(--muted); line-height: 1.6; max-width: 58ch; }
.portal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.portal-actions .button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.portal-tile {
  min-width: 0;
  background: var(--portal-glass);
  border: 1px solid var(--line);
  border-radius: clamp(14px, 1.6vw, 23px);
  box-shadow: 0 8px 35px #173d2c09, inset 0 1px #ffffffd4;
  padding: clamp(16px, 2.6vw, 32px);
  overflow-wrap: anywhere;
}

.portal-tile h2, .portal-tile h3 { font-family: var(--display-font); font-weight: 500; line-height: 1.14; color: var(--forest); }
.portal-tile h2 { font-size: clamp(23px, 2.8vw, 36px); letter-spacing: -.026em; }
.portal-tile h3 { font-size: clamp(19px, 2.1vw, 27px); }
.portal-tile p { line-height: 1.6; }
.portal-tile-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 16px; }
.portal-muted { font-size: .875rem; color: var(--muted); }
.portal-empty { padding: 12px 0; line-height: 1.6; color: var(--muted); }
.portal-empty[role="alert"] { color: var(--high); }
.portal-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; align-content: start; }
.portal-two-col { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: clamp(15px, 2vw, 28px); align-items: start; }
.portal-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: clamp(10px, 1.4vw, 20px); margin: 0; }
.portal-metric { padding: clamp(14px, 2vw, 27px); }
.portal-metric dt { color: var(--muted); font-size: .92rem; }
.portal-metric dd { margin: 7px 0 0; color: var(--forest-dark); font: 500 clamp(30px, 5vw, 53px)/1 var(--display-font); font-variant-numeric: lining-nums tabular-nums; }
.portal-table { width: 100%; min-width: 0; }
.portal .table-wrap { min-width: 0; }
.portal-table th, .portal-table td { padding: 12px 10px; vertical-align: middle; }
.portal-table th { background: transparent; }
.portal-table th:first-child, .portal-table td:first-child { padding-left: 0; }
.portal-table th:last-child, .portal-table td:last-child { padding-right: 0; }
.portal-table time, .portal-nowrap { white-space: nowrap; }
.portal-table .button { min-height: 33px; padding: 5px 9px; font-size: .83rem; }
.portal-chart { display: grid; gap: .9rem; margin: 10px 0 0; padding: 0; list-style: none; }
.portal-chart li { display: grid; grid-template-columns: minmax(118px, 1.6fr) minmax(50px, 4fr) minmax(32px, auto); align-items: center; gap: 10px; color: var(--forest); font-size: .9rem; }
.portal-chart-record { border: 0; height: 11px; width: 100%; appearance: none; background: var(--portal-mint); border-radius: 10px; overflow: hidden; }
.portal-chart-record::-webkit-progress-bar { background: var(--portal-mint); }
.portal-chart-record::-webkit-progress-value { background: #3c8b72; border-radius: 10px; }
.portal-chart-record::-moz-progress-bar { background: #3c8b72; border-radius: 10px; }
.portal-chart-value { text-align: right; font-variant-numeric: tabular-nums; }
.portal-day-plot { list-style: none; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(49px, 1fr); gap: 7px; overflow-x: auto; margin: 0; padding: 3px 3px 10px; }
.portal-day-plot:focus-visible { outline: 2px solid #2b8669; border-radius: 6px; }
.portal-day-plot li { display: grid; justify-items: center; align-content: end; gap: 5px; padding: 0 4px; color: var(--muted); font-size: .74rem; white-space: nowrap; }
.portal-day-bar { position: relative; width: 22px; height: 122px; }
.portal-day-bar .portal-chart-record { position: absolute; width: 122px; height: 18px; top: 52px; left: -50px; transform: rotate(-90deg); }
.portal-day-plot strong { color: var(--forest); font-variant-numeric: tabular-nums; }
.portal-list { list-style: none; margin: 0; padding: 0; min-width: 0; }
.portal-list > li { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 9px 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.portal-list > li:first-child { border-top: 0; padding-top: 0; }
.portal-list > li:last-child { padding-bottom: 0; }
.portal-list p { margin: 2px 0 0; }
.portal-card-name { display: block; font-size: 1.02rem; color: var(--forest-dark); }
.portal-label-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.portal-label-inline select { width: auto; min-width: min(100%, 190px); }
.portal-post { max-width: 840px; }
.portal-feed { width: min(100%, 840px); }
.portal-post .portal-tile-head { align-items: flex-start; }
.portal-post-meta { display: flex; align-items: center; gap: 5px 10px; flex-wrap: wrap; margin-top: 5px; }
.portal-post-body, .portal-comment p:not(.portal-muted) { white-space: pre-wrap; overflow-wrap: anywhere; }
.portal-post-body { max-width: 76ch; margin-top: 13px; }
.portal-post-link { display: inline-block; margin-top: 10px; font-weight: 650; overflow-wrap: anywhere; }
.portal-comments { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 14px; }
.portal-comment { padding: 9px 0 9px 13px; border-left: 2px solid #b8d5c4; }
.portal-comment + .portal-comment { margin-top: 8px; }
.portal-comment .portal-actions { margin-top: 5px; }
.portal-comments > .portal-actions { margin-top: 12px; }
.portal-footer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.portal-thread .portal-comment { max-width: 100%; }
.portal-dialog { width: min(600px, calc(100vw - 24px)); max-height: min(92dvh, 800px); background: var(--surface); border-radius: 22px; }
.portal-dialog[open] { box-shadow: 0 20px 65px #0c292254; }
.portal-dialog::backdrop { background: #102a237d; backdrop-filter: blur(3px); }
.portal-dialog-header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: clamp(14px, 3vw, 25px); border-bottom: 1px solid var(--line); }
.portal-dialog-header h2 { color: var(--forest); font: 500 30px/1.15 var(--display-font); letter-spacing: -.02em; }
.portal-dialog-header button { min-width: 40px; min-height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--background); color: var(--forest); font-size: 21px; }
.portal-dialog .dialog-body { padding: clamp(14px, 3vw, 25px); }
.portal-dialog textarea { font: inherit; min-height: 110px; }
.portal-dialog [hidden] { display: none; }
.portal-cap { max-width: 62ch; }
.portal-dialog [role="alert"]:empty { display: none; }
.portal-dialog [role="alert"] { color: var(--high); }

@media (max-width: 780px) {
  .portal-two-col { grid-template-columns: minmax(0, 1fr); }
  .portal-heading { align-items: flex-start; }
  .portal-table:has(th:nth-child(4)) { min-width: 510px; }
}

@media (max-width: 460px) {
  .portal-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-list > li { align-items: start; }
  .portal-head-actions { width: 100%; }
}
