/* Restyle of the unchanged /htm tool in the HTM-deck style: ink instead of green, paper canvas, one slim bar back to the environment. */
:root {
  --canvas: #f6f1e6; --surface-head: #fbf8f1;
  --accent: #1e1c22; --accent-deep: #000; --accent-text: #1e1c22; --accent-soft: #ece6d8; --accent-line: #b9b2a5;
  --focus: #2563eb; --focus-halo: #2563eb2e;
  --env: 38px;
}
.env-bar { height: var(--env); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; background: #1e1c22; color: #f6f1e6; font: 14px Source, sans-serif; }
.env-bar a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.env-bar img { width: 20px; height: 20px; filter: invert(1); }
.env-bar b { font: 700 15px Bricolage, sans-serif; }
.env-bar a span { color: #bfb8aa; }
.env-tools { display: flex; gap: 8px; margin-left: auto; margin-right: 16px; }
.env-tools .btn { height: 28px; padding: 0 10px; background: transparent; color: #f6f1e6; border: 1px solid #f6f1e655; }
.env-tools .btn:hover { background: #f6f1e61a; }
.env-bar a:hover span { text-decoration: underline; }
.env-stamp { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #bfb8aa; }
.app { height: calc(100% - var(--env)); grid-template-columns: minmax(0, 1fr); overflow: clip; }
body.rap .env-bar { display: none; }
#app img, #rapport img { max-width: none; }
/* app.css sets the pane label visible (against body.noside .side); in the comparison the panes are hidden, so hide the label too. */
#panes[style*="hidden"] .pdoc .side { visibility: hidden; }
/* The project name in the top bar never shrinks; below 1440 px the search button drops its shortcut hint to make room. */
.tb .proj { flex: none; }
@media (max-width: 1439px) { .tb .zoek kbd { display: none; } }
/* Narrow screens: the top bar scrolls sideways inside itself, so the page keeps the screen width. */
@media (max-width: 1279px) { .tb { overflow-x: auto; scrollbar-width: none; } }
@media (max-width: 720px) { .env-stamp { display: none; } }
/* Phone: every view stays inside the screen width, also scrolled down. Bars wrap instead of scrolling sideways,
   the two panes stack, cards take the full width. Only a drawing (.vp) pans sideways. */
@media (max-width: 720px) {
  .app { grid-template-rows: auto minmax(0, 1fr); }
  /* One row: the view tabs and "Meer" (page script). "Meer" opens the project name and the other tools below it. */
  .tb { flex-wrap: wrap; overflow-x: visible; gap: 8px; padding: 6px 10px; white-space: normal; }
  .tb:not(.more) > :not(#nav, #btnMore) { display: none; }
  .tb #nav { order: -2; flex: 1 1 0; min-width: 0; }
  .tb #nav button { flex: 1 1 auto; height: 40px; padding: 0 6px; font-size: 14px; justify-content: center; }
  #btnMore { order: -1; height: 44px; padding: 0 12px 0 8px; font-size: 14px; }
  #btnMore[aria-expanded="true"] svg { transform: rotate(180deg); }
  .tb .proj { flex: 1 1 100%; }
  .tb .grow, #btnSide { display: none; }
  .tb .ib, .tb .zoek { width: 44px; height: 44px; justify-content: center; padding: 0; }
  .tb .btn, .tb .rolsel, .tgl button { height: 40px; font-size: 14px; }
  .tb .crumb a { display: inline-block; padding-block: 10px; }
  .stage { grid-template-rows: auto minmax(0, 1fr) auto; }
  .bstrip, .bcr, .source-lane { flex-wrap: nowrap; white-space: nowrap; }
  .bstrip { padding-block: 6px; row-gap: 6px; }
  /* The strip is the switch between the sources: one screen at a time, so no screen letters and no split button. */
  .bstrip .eyebrow, #vmode, .src .pn, .src .q, .pane .pdoc .side, .etab { display: none !important; }
  .bstrip .bcr { flex: 1 1 0; order: 0; min-width: 0; gap: 4px; overflow-x: auto; scrollbar-width: none; } /* many documents: the chip row swipes sideways */
  .source-lane { gap: 4px; }
  .bstrip .arr { display: none; }
  .src:not(.act) { border-color: var(--line-default); }
  .src { height: 40px; font-size: 14px; padding: 0 10px; }
  .bstrip .ib { width: 40px; height: 40px; }
  .vp { touch-action: none; }
  /* The closed header reserves space; the full finding opens over the drawing. */
  .bbar, .bbar.inline-review { max-height: none; overflow: visible; padding: 0; }
  .sheet-hd { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 56px; padding: 8px 12px; border: 0; background: var(--surface); color: var(--text-strong); font: inherit; text-align: left; cursor: pointer; }
  .sheet-hd > b { min-width: 0; font-size: 14px; line-height: 20px; }
  .sheet-hd .st { flex: none; }
  .sheet-cue { display: inline-flex; align-items: center; flex: none; gap: 4px; margin-left: auto; font-size: 12px; }
  .sheet-hd[aria-expanded="true"] .sheet-cue svg { transform: rotate(180deg); }
  .sheet-hd:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
  .sheet-bd { padding: 8px 12px 12px; }
  .sheet-bd[hidden] { display: none; }
  .sheet-bd .inline-review-context > .badge, .sheet-bd .inline-review-context > .st { display: none; } /* the sheet header already shows them */
  .bbar.sheet-open { position: absolute; bottom: 0; left: 0; right: 0; box-shadow: 0 -8px 24px #0002; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; } /* a long finding (with the "Eerst navragen" form) scrolls only when it is taller than the stage */
  .sheet-bd .inline-review-options { grid-template-columns: 1fr; }
  .bbar .opt, .bbar .inline-text-button, .bbar button.st { min-height: 40px; }
  /* The inspector covers the whole stage. */
  .insp { top: 0; bottom: 0; width: 100%; z-index: 30; border-left: 0; }
  .ihd .ib { width: 44px; height: 44px; }
  .itabs { overflow: visible; flex-wrap: wrap; }
  .itabs button { min-height: 40px; font-size: 14px; }
  .bcr { flex-basis: 100%; order: 2; row-gap: 4px; }
  .source-lane .src { flex: none; }
  .source-lane .src b { overflow: clip; text-overflow: ellipsis; }
  .bstrip .tools { margin-left: auto; }
  .panes { flex-direction: column; }
  .pane + .pane { border-left: 0; border-top: 1px solid var(--line-strong); }
  #split { visibility: hidden; pointer-events: none; }
  /* A stacked pane is low: the zoom tools lie in one row at the bottom, so they do not cover the pane bar. */
  .zst { flex-direction: row; bottom: 8px; }
  .zst button { width: 40px; height: 40px; }
  .zst hr { border-top: 0; border-left: 1px solid var(--line-default); margin: 4px 1px; }
  .plabel { max-width: calc(100% - 16px); }
  .ovg { grid-template-columns: minmax(0, 1fr); }
  .card > h2 { flex-wrap: wrap; }
  /* A wide table (six columns or more, the source set) becomes one block per row. */
  .ovg table.tb2:has(th:nth-child(6)) thead { display: none; }
  .ovg table.tb2:has(th:nth-child(6)) tr { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-subtle); }
  .ovg table.tb2:has(th:nth-child(6)) td { padding: 0; border: 0; }
  .ovg table.tb2:has(th:nth-child(6)) td:nth-child(2) { flex-basis: 100%; order: 1; }
  .ovg table.tb2:has(th:nth-child(6)) td:nth-child(n+3) { order: 2; }
  /* Two-column tables only (label + text): the label sits above the text. */
  .ovg table.tb2:not(:has(td:nth-child(3))) td.lb, .ovg table.tb2:not(:has(td:nth-child(3))) td.lb + td { display: block; padding-inline: 0; }
  .ovg table.tb2:not(:has(td:nth-child(3))) td.lb { border: 0; padding-bottom: 2px; }
  .lleg .lg { flex-wrap: wrap; white-space: normal; border-radius: 12px; }
  .vm { grid-template-columns: minmax(0, 1fr); }
  .vmt { flex-wrap: wrap; row-gap: 8px; padding: 10px 14px; }
  .vmt .agbar { order: 3; flex-basis: 100%; }
  .agbar button { min-width: 0; pointer-events: none; }
  .vmb { display: flex; flex-direction: column; overflow: auto; padding: 14px; } /* one column; app.js sets the grid columns inline */
  .vmb > * { flex: none; }
  .vmr > div:has(> .vmimg) { grid-template-columns: minmax(0, 1fr) !important; }
  .vmr .kpi { overflow-wrap: normal; word-break: normal; hyphens: none; }
  #dfil .chip, #stfil .chip, #btnExp { min-height: 40px; }
  .vmr .kpi .nb { white-space: normal; font-size: 15px; } /* the narrow version columns wrap their long names at the hyphen */
  /* Toasts take the screen width (app.js centres them with an inline left). */
  .toasts { left: 12px !important; right: 12px; transform: none; }
  .toast { width: 100%; }
  .toast kbd { display: none; }
  .toast button { height: 40px; margin-left: auto; }
  #vmX { height: 40px; }
  #vmX kbd { display: none; }
  /* Meeting footer in three low rows: who and when, the note, the buttons. */
  .vmf { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; padding: 10px 14px; }
  .vmf .fld:has(#vmNot), .vmf .vmnav { grid-column: 1 / -1; }
  .vmf .fld { gap: 2px; }
  .vmnav { gap: 6px; }
  .vmnav .btn { padding: 0 12px; font-size: 14px; }
  #vmOk { margin-left: auto; }
}
#btnMore, .env-proj { display: none; }
@media (max-width: 720px) {
  #btnMore { display: inline-flex; }
  .env-bar { justify-content: flex-start; gap: 12px; }
  .env-home span { display: none; }
  .env-proj { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
}
@media print { .env-bar { display: none; } }

/* The existing findings list takes the main screen on a phone. */
#vmFormToggle { display: none; }
#vmChoiceError { grid-column: 1 / -1; color: var(--text-strong); }
@media (max-width: 720px) {
  body.findings-list main.mn { grid-template-columns: minmax(0, 1fr); }
  body.findings-list #side { visibility: visible; border: 0; }
  body.findings-list #stage { display: none; }
  body.findings-list .stabs { display: none; }
  #list .drow { min-height: 40px; }
  .sheet-nav { display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--surface); }
  .sheet-nav [data-list] { margin-right: auto; }
  .sheet-nav button { min-width: 40px; height: 40px; }
  .vmr { overflow: visible; padding-right: 0; }
  .vmf { position: relative; }
  #vmFormToggle { display: inline-flex; grid-column: 1 / -1; justify-content: center; min-height: 40px; }
  .vmf:not(.form-open) .fld { display: none; }
  .vmf.form-open { position: absolute; bottom: 0; left: 0; right: 0; box-shadow: 0 -8px 24px #0002; }
  .vm-save-next { display: none; }
  .vmnav .btn { padding: 0 8px; }
}
