/* Consumption accounts (admin/reports.html, admin/report.html; admin/reports/). Scoped under
   the page classes; everything else comes from components.css and admin-lists.css. */

/* Statement flags: small tags that wrap inside their cell. */
.pg-report .flags { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px 0; }
/* The "adjusted" tag inside the aconto line of a medium cell. */
.pg-report .dg .second .tag { height: 16px; line-height: 16px; padding: 0 4px; }
.pg-report .dg td.two .second { overflow: visible; }

/* Totals row of the statements. */
.pg-report .dg tfoot tr.total th, .pg-report .dg tfoot tr.total td {
  background: var(--colorNeutralBackground2); border-top: 1px solid var(--colorNeutralStroke1); border-bottom: 0;
  font-weight: var(--fontWeightSemibold);
}
.pg-report .dg tfoot tr.total .second { font-weight: var(--fontWeightRegular); }

/* Formula page (admin/report_formula.html, static/js/formula.js). */
.pg-formula .formula-edit { position: relative; max-width: 56rem; }
.pg-formula .formula-edit textarea {
  width: 100%; font-family: var(--fontFamilyMonospace); font-size: var(--fontSizeBase300);
  line-height: var(--lineHeightBase300); resize: vertical;
}
/* The autocomplete popup under the textarea. */
.pg-formula ul.ac {
  position: absolute; z-index: 10; left: 0; top: 100%; margin: 2px 0 0; padding: 4px 0; list-style: none;
  min-width: 16rem; max-height: 16rem; overflow-y: auto;
  background: var(--colorNeutralBackground1); border: 1px solid var(--colorNeutralStroke1);
  border-radius: var(--borderRadiusMedium); box-shadow: var(--shadow16);
}
.pg-formula ul.ac li { padding: 4px 12px; cursor: pointer; font-family: var(--fontFamilyMonospace); font-size: var(--fontSizeBase200); }
.pg-formula ul.ac li[aria-selected="true"] { background: var(--colorNeutralBackground1Selected); }
.pg-formula ul.ac li:hover { background: var(--colorNeutralBackground1Hover); }
.pg-formula .templates { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 8px; }
/* Identifiers: monospace buttons that insert themselves at the caret. */
.pg-formula button.ident, .formula-lines code {
  font-family: var(--fontFamilyMonospace); font-size: var(--fontSizeBase200);
}
.pg-formula button.ident {
  border: 0; background: transparent; padding: 2px 0; color: var(--colorBrandForeground1); cursor: pointer; text-align: left;
}
.pg-formula button.ident:hover { text-decoration: underline; }
.pg-formula button.ident:focus-visible { outline: 2px solid var(--colorStrokeFocus2); border-radius: 2px; }
.pg-formula .alias { display: block; color: var(--colorNeutralForeground3); font-family: var(--fontFamilyMonospace); font-size: var(--fontSizeBase100); }
.pg-formula .form-actions, .pg-formula .field { margin-top: 8px; }
.pg-formula .field { max-width: 56rem; }
/* "Sådan deles udgifterne": the split per medium, parts indented under their group (.split-head also
   heads the media of "Variabler der skal defineres"). */
.pg-formula .split-head h3 { margin: 0 0 4px; }
.pg-formula .split-head p { margin: 4px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.pg-formula .split .explain { display: block; max-width: 40rem; font-size: var(--fontSizeBase200); color: var(--colorNeutralForeground3); white-space: normal; }
.pg-formula .split-head .explain { flex-basis: 100%; }
.pg-formula .split td.wrap { min-width: 15rem; }
.pg-formula .split tr.lvl1 td:first-child { font-weight: var(--fontWeightSemibold); }
.pg-formula .split tr.lvl1 td:first-child .explain { font-weight: var(--fontWeightRegular); }
.pg-formula .split tr.lvl2 td:first-child { padding-left: 44px; }
.pg-formula .split .rest { color: var(--colorNeutralForeground3); font-style: italic; }

/* Move-in / move-out (admin/tenancy_step.html): the inspection matrix, one collapsible block
   per room (admin/_step_room.html) with a line per surface. */
.pg-step .room { border-top: 1px solid var(--fm-row-stroke); }
.pg-step .room > summary { display: flex; align-items: center; gap: 8px; padding: 12px 20px; cursor: pointer; list-style: none; font-weight: var(--fontWeightSemibold); }
.pg-step .room > summary::-webkit-details-marker { display: none; }
.pg-step .room > summary:hover { background: var(--colorSubtleBackgroundHover); }
.pg-step .room > summary:focus-visible { outline: 2px solid var(--colorBrandStroke1); outline-offset: -2px; }
.pg-step .room > summary .i { transition: transform .1s; }
.pg-step .room[open] > summary .i { transform: rotate(90deg); }
.pg-step .room-acts { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 20px 8px; }
.pg-step .room-acts form { display: flex; gap: 4px; }
.pg-step .room .table-wrap { overflow-x: auto; }
.pg-step .matrix { width: 100%; border-collapse: collapse; margin-bottom: 8px; font-size: var(--fontSizeBase200); }
.pg-step .matrix th, .pg-step .matrix td { padding: 4px 6px; vertical-align: top; text-align: left; font-weight: var(--fontWeightRegular); }
.pg-step .matrix tr + tr > * { border-top: 1px solid var(--fm-row-stroke); }
.pg-step .matrix th { width: 12rem; padding: 8px 6px 4px 20px; }
.pg-step .matrix td { padding-right: 20px; }
.pg-step .matrix select, .pg-step .room-acts select, .pg-step .remarks {
  font: inherit; color: var(--colorNeutralForeground1); background: var(--colorNeutralBackground1);
  border: 1px solid var(--colorNeutralStroke1); border-radius: var(--borderRadiusMedium); padding: 3px 4px;
}
.pg-step .matrix select { width: 100%; min-width: 0; text-overflow: ellipsis; }
.pg-step .matrix select:focus-visible, .pg-step .room-acts select:focus-visible, .pg-step .remarks:focus-visible { outline: 2px solid var(--colorBrandStroke1); outline-offset: 1px; }
.pg-step .room-acts select { color: var(--colorNeutralForeground2); }
/* Move-out: condition, action and note on one line; move-in: condition and note. The marker
   goes below. */
.pg-step .cell-form { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 13rem) minmax(0, 1fr); gap: 3px 6px; padding: 2px; border-radius: var(--borderRadiusMedium); }
.pg-step .cell-form:has(.mark.changed) { background: var(--colorStatusWarningBackground1); box-shadow: inset 3px 0 0 var(--colorStatusWarningForeground3); }
.pg-step .cell-form.failed { background: var(--colorStatusDangerBackground1); box-shadow: inset 3px 0 0 var(--colorStatusDangerForeground1); }
.pg-step .matrix [aria-invalid="true"] { border-color: var(--colorStatusDangerBorder1); }
.pg-step .cell-form > .mark { grid-column: 1 / -1; }
.pg-step .cell-form:not(:has([name=action])) { grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); }
.pg-step .cell-form .mark { color: var(--colorNeutralForeground3); font-size: var(--fontSizeBase100); padding-left: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pg-step .cell-form .mark:empty { display: none; }
.pg-step .matrix input[type=text] { font: inherit; width: 100%; min-width: 0; color: var(--colorNeutralForeground1); background: var(--colorNeutralBackground1); border: 1px solid var(--colorNeutralStroke2); border-radius: var(--borderRadiusMedium); padding: 2px 4px; }
.pg-step .matrix input[type=text]:focus-visible { outline: 2px solid var(--colorBrandStroke1); outline-offset: 1px; }
.pg-step .room-acts button { font: inherit; cursor: pointer; color: var(--colorNeutralForeground1); background: var(--colorNeutralBackground2); border: 1px solid var(--colorNeutralStroke1); border-radius: var(--borderRadiusMedium); padding: 3px 8px; }
.pg-step .room-acts button:hover { background: var(--colorNeutralBackground2Hover); }
.pg-step .room-acts button:focus-visible { outline: 2px solid var(--colorBrandStroke1); outline-offset: 1px; }
.pg-step .remarks { width: 100%; max-width: 60rem; resize: vertical; }
/* Photos of a cell (admin/_step_photos.html): thumbnails that open the photo, each with a
   delete button in its corner, and "Tilføj foto" (the file input inside the label is
   visually hidden but focusable; on a phone it offers the camera and the library). */
.pg-step .photos { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 2px 2px; }
.pg-step .photos:not(:has(li, form, .photo-error)) { display: none; }
.pg-step .photo-list { display: contents; list-style: none; }
.pg-step .photo-list li { position: relative; }
.pg-step .photo-list img { display: block; width: 64px; height: 64px; object-fit: cover; border-radius: var(--borderRadiusMedium); border: 1px solid var(--colorNeutralStroke2); background: var(--colorNeutralBackground3); }
.pg-step .photo-list a:focus-visible img { outline: 2px solid var(--colorBrandStroke1); outline-offset: 1px; }
.pg-step .photo-list form { position: absolute; top: -6px; right: -6px; }
.pg-step .photo-del { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; cursor: pointer; border-radius: 50%; color: var(--colorNeutralForeground1); background: var(--colorNeutralBackground1); border: 1px solid var(--colorNeutralStroke1); }
.pg-step .photo-del:hover { color: var(--colorStatusDangerForeground1); }
.pg-step .photo-del:focus-visible { outline: 2px solid var(--colorBrandStroke1); outline-offset: 1px; }
.pg-step .photo-add { display: flex; align-items: center; gap: 6px; }
.pg-step .photo-pick { position: relative; display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 3px 8px; cursor: pointer; color: var(--colorNeutralForeground2); border: 1px dashed var(--colorNeutralStroke1); border-radius: var(--borderRadiusMedium); }
.pg-step .photo-pick:hover { background: var(--colorSubtleBackgroundHover); }
.pg-step .photo-pick:focus-within { outline: 2px solid var(--colorBrandStroke1); outline-offset: 1px; }
.pg-step .photo-pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.pg-step .photo-add.busy .photo-pick { pointer-events: none; opacity: .6; }
.pg-step .photo-send { font: inherit; padding: 3px 8px; }
.pg-step .photo-status { color: var(--colorNeutralForeground3); font-size: var(--fontSizeBase100); }
.pg-step .photo-error { flex-basis: 100%; color: var(--colorStatusDangerForeground1); font-size: var(--fontSizeBase200); }
/* Touch screens (phones and tablets, whatever their width): bigger thumbnails and targets. */
@media (pointer: coarse) {
  .pg-step .photo-list img { width: 80px; height: 80px; }
  .pg-step .photo-del { width: 32px; height: 32px; }
  .pg-step .photo-pick { min-height: 44px; padding: 6px 12px; font-size: var(--fontSizeBase300); }
}
.pg-step .empty .acts { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
/* "Gør endelig" (admin/tenancy_step.html, CONTRACTS.md §19.1 "Signatures"): a modal dialog
   with a white signature pad per signer, side by side, stacked on a phone. The pads keep
   their 3:1 drawing area (600 × 200 canvas pixels) at any width. */
.sign-dialog { width: min(46rem, calc(100vw - 24px)); padding: 20px; color: var(--colorNeutralForeground1); background: var(--colorNeutralBackground1, canvas); border: 1px solid var(--colorNeutralStroke2, currentColor); border-radius: var(--borderRadiusMedium); }
.sign-dialog::backdrop { background: rgb(0 0 0 / .4); }
.sign-dialog h2 { margin: 0 0 var(--spacingVerticalM); }
.sign-dialog p { margin: 0 0 var(--spacingVerticalM); overflow-wrap: anywhere; }
.sign-dialog .hint { color: var(--colorNeutralForeground3); font-size: var(--fontSizeBase200); }
.sign-pads { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: var(--spacingVerticalL); }
.sign-pad { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.sign-label { font-weight: var(--fontWeightSemibold); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sign-pad canvas { display: block; width: 100%; aspect-ratio: 3 / 1; touch-action: none; cursor: crosshair; background: #fff; border: 1px solid var(--colorNeutralStroke1); border-bottom: 2px solid var(--colorNeutralForeground3); border-radius: var(--borderRadiusMedium); }
.sign-dialog .acts { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 599px) {
  .sign-pads { grid-template-columns: minmax(0, 1fr); }
}
/* Phones: every surface a block, its name above its controls; condition and action side by
   side, the note below. */
@media (max-width: 767px) {
  .pg-step .room > summary { padding: 12px 16px; }
  .pg-step .room-acts { flex-wrap: nowrap; padding: 0 16px 8px; }
  .pg-step .room-acts form.fill { flex: 1 1 auto; min-width: 0; }
  .pg-step .room-acts form.fill select { flex: 1; min-width: 0; }
  .pg-step .matrix, .pg-step .matrix tbody, .pg-step .matrix tr, .pg-step .matrix th, .pg-step .matrix td { display: block; }
  .pg-step .matrix tr { padding: 6px 0; }
  .pg-step .matrix tr + tr { border-top: 1px solid var(--fm-row-stroke); }
  .pg-step .matrix tr + tr > *, .pg-step .matrix th, .pg-step .matrix td { width: auto; border-top: 0; padding: 2px 16px; }
  .pg-step .matrix th { font-weight: var(--fontWeightSemibold); color: var(--colorNeutralForeground2); }
  .pg-step .matrix { font-size: var(--fontSizeBase300); }
  .pg-step .matrix select, .pg-step .matrix input[type=text], .pg-step .room-acts select, .pg-step .room-acts button { min-height: 36px; font-size: var(--fontSizeBase300); }
  .pg-step .cell-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pg-step .cell-form > input[type=text] { grid-column: 1 / -1; }
  .pg-step .cell-form:not(:has([name=action])) { grid-template-columns: minmax(0, 1fr); }
  .pg-step .cell-form .mark { white-space: normal; }
}
/* The step header carries up to four buttons: let them wrap instead of squeezing the title. */
.pg-step .page-head .acts { flex-wrap: wrap; }
@media (min-width: 768px) { .pg-step .page-head .acts { justify-content: flex-end; max-width: 60%; } }
@media (max-width: 767px) {
  .pg-step .page-head .acts { flex-direction: column; align-items: stretch; }
  .pg-step .page-head .acts > :not(fluent-menu) { flex: none; }
}
