/* Only the grid takes the whole screen; every other page of the work area keeps its column and its heading. */
.app-page:has([data-opg-root]) { max-width: none; margin: 10px auto 0; padding: 0 12px; }
body:has([data-opg-root]) header.top { display: none; }
.opg-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; margin: 0 0 .5rem; }
.app-page .opg-head h1 { margin: 0; font-size: 1.6rem; }
.opg-intro { margin: 0; color: #5b665a; font-size: .85rem; }
.opg-compact .opg-intro { display: none; }
.opg-controls {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 0 0 0 auto;
}
.opg-controls label { display: grid; gap: .1rem; font-weight: 700; font-size: .8rem; }
.opg-controls input { min-height: 2.25rem; }
.opg-controls .secondary { min-height: 2.25rem; padding: .35rem .8rem; display: inline-flex; align-items: center; text-decoration: none; color: inherit; }
.opg-controls [aria-pressed="true"] { background: #35634e; border-color: #35634e; color: #fff; }
.opg-card { padding: 0; margin-bottom: 0; overflow: hidden; }
.opg-counts { display: flex; flex-wrap: wrap; gap: .3rem 1rem; min-height: 2.5rem; padding: .4rem .75rem .1rem; align-items: center; }
.opg-counts strong { font-size: 1rem; }
.opg-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem; padding: .2rem .75rem .45rem; }
.opg-selection, .opg-active, .opg-bulk-scope { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
/* The last line of the bar keeps its room also when it is empty: a filter chip or a message must not push the rows down. */
.opg-notes { display: flex; flex: 1 1 100%; flex-wrap: wrap; align-items: center; gap: .3rem 1rem; min-height: 1.7rem; }
.opg-bulk { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem; }
.opg-bulk label { display: grid; gap: .1rem; font-size: .8rem; }
.opg-bulk .opg-include { display: inline-flex; align-items: center; gap: .3rem; }
.opg-bulk input, .opg-bulk select, .opg-bulk textarea { height: 2rem; max-width: 14rem; font: inherit; }
.opg-bulk .opg-include input { height: auto; }
.opg-bulk button[type="submit"], .opg-editor button { border: 1px solid #35634e; border-radius: .4rem; padding: .3rem .7rem; background: #fff; font-weight: 700; }
.opg-bulk button[type="submit"], .opg-editor button[type="submit"] { background: #35634e; color: #fff; }
.opg-bulk button[disabled] { opacity: .5; cursor: not-allowed; }
.opg-hint { display: block; max-width: 22rem; color: #5b665a; font-size: .75rem; font-weight: 400; line-height: 1.25; }
.opg-chip { border: 1px solid #aebfb0; border-radius: 999px; padding: .1rem .6rem; background: #fff; color: inherit; font: inherit; font-size: .8rem; }
.opg-chip:hover, .opg-chip:focus-visible { background: #edf5ec; }
.opg-chip[aria-pressed="true"] { background: #8a421e; border-color: #8a421e; color: #fff; }
.opg-chip-strong { font-weight: 700; }
.opg-status { flex: 1 1 12rem; margin: 0; color: #35634e; font-size: .85rem; }
.opg-status-error { color: #8a3f1d; font-weight: 700; }
.opg-select { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; }
.opg-select input { width: 1rem; height: 1rem; }
.opg-warning { color: #8a421e; font-weight: 700; }
.opg-scroll { max-height: min(70vh, 48rem); overflow: auto; border-block: 1px solid #d9e0d7; }
.opg-scroll:focus-visible { outline: 3px solid #35634e; outline-offset: -3px; }
.opg-table { table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: .875rem; }
.opg-table th { position: sticky; top: 0; z-index: 2; overflow: hidden; background: #f4f7f2; box-shadow: 0 1px 0 #cbd6ca; text-align: left; vertical-align: top; }
.opg-table th:first-child, .opg-table td:first-child { position: sticky; left: 0; z-index: 3; background: #fff; }
.opg-table th:first-child { z-index: 4; background: #f4f7f2; }
.opg-table th button { display: block; width: 100%; border: 0; padding: .4rem .45rem .15rem; background: none; color: inherit; font: inherit; font-weight: 700; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.opg-table th button:hover, .opg-table th button:focus-visible { text-decoration: underline; }
.opg-th-label { display: block; padding: .4rem .45rem .15rem; font-weight: 700; }
.opg-select-all { margin: .1rem .45rem .35rem; }
.opg-table th select, .opg-table th input[type="search"] { display: block; width: calc(100% - .7rem); height: 1.7rem; margin: .1rem .35rem .35rem; min-width: 0; border: 1px solid #aebfb0; border-radius: .3rem; padding: .1rem .25rem; background: #fff; font: inherit; font-weight: 400; }
.opg-filter-pair { display: flex; align-items: center; gap: .25rem; margin: .1rem .35rem .35rem; }
.opg-table th .opg-filter-pair input[type="search"] { flex: 1 1 auto; width: auto; margin: 0; }
.opg-only-empty { display: inline-flex; flex: none; align-items: center; gap: .15rem; font-size: .72rem; font-weight: 400; cursor: pointer; }
.opg-resize { position: absolute; top: 0; right: 0; bottom: 0; width: 7px; cursor: col-resize; touch-action: none; }
.opg-resize:hover, .opg-resize:focus-visible { background: #9db39f; outline: 0; }
.opg-table td { padding: .65rem .55rem; border-bottom: 1px solid #e2e8e0; vertical-align: top; background: #fff; overflow: hidden; overflow-wrap: anywhere; }
/* The totals at the foot of the columns (9-10/10): always in sight at the bottom of the scrolling area, like the header
   at the top; on paper they are printed once, after the last row. */
.opg-table tfoot td { position: sticky; bottom: 0; z-index: 2; padding: .35rem .55rem; border-bottom: 0; background: #f4f7f2; box-shadow: 0 -1px 0 #cbd6ca; vertical-align: top; white-space: nowrap; }
.opg-table tfoot td:first-child { z-index: 4; background: #f4f7f2; }
/* The amount stays whole on its line; what it leaves out («8 in attesa», «1 da verificare») goes under it (review Codex 11/10). */
.opg-table tfoot td small, .opg-compact .opg-table tfoot td small { display: block; margin-left: 0; white-space: normal; }
.opg-compact .opg-table tfoot td { white-space: nowrap; text-overflow: clip; vertical-align: top; }
.opg-waiting { color: #5b665a; }
.opg-table tr:hover td { background: #f6f9f4; }
.opg-table tr.opg-selected td { background: #e9f2e4; }
.opg-table td small { display: block; font-size: .75rem; color: #5b665a; }
.opg-table td small.opg-warning { color: #8a421e; }
.opg-cell-button { display: block; width: 100%; min-height: 1.8rem; padding: .15rem; border: 1px solid transparent; border-radius: .25rem; background: transparent; color: inherit; font: inherit; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.opg-cell-button:hover, .opg-cell-button:focus-visible { border-color: #426c55; background: #edf5ec; }
.opg-place { display: flex; align-items: flex-start; gap: .35rem; }
.opg-place .opg-cell-button, .opg-place-text { flex: 1 1 auto; min-width: 0; }
.opg-maps { flex: none; font-size: .75rem; color: #35634e; white-space: nowrap; }
/* A cell being edited opens its form over the neighbours: narrow columns stay narrow and nothing around moves. */
.opg-table td.opg-editing { position: relative; z-index: 5; overflow: visible; }
.opg-editor { position: absolute; top: 0; left: 0; z-index: 6; display: grid; gap: .35rem; width: max(100%, 12rem); padding: .5rem; border: 1px solid #426c55; border-radius: .4rem; background: #fff; box-shadow: 0 6px 18px rgba(41, 47, 34, .2); white-space: normal; }
.opg-address-editor { width: max(100%, 22rem); }
td[data-column="porter"] .opg-editor, td[data-column="porterNote"] .opg-editor, td[data-column="preparer"] .opg-editor { left: auto; right: 0; }
.opg-editor label { display: grid; gap: .2rem; font-weight: 700; }
.opg-editor input, .opg-editor select, .opg-editor textarea { width: 100%; min-width: 7rem; box-sizing: border-box; font: inherit; font-weight: 400; }
/* A consent inside an editor (rows of the same pickup, an address changed by another desk) is a sentence with its box. */
.opg-editor .opg-include { display: block; font-size: .8rem; font-weight: 400; line-height: 1.3; }
.opg-editor .opg-include input { width: auto; min-width: 0; margin-right: .3rem; }
.opg-also { max-width: 34rem; overflow-wrap: anywhere; }
.opg-compare { margin: 0; padding: .35rem .45rem; border-left: 3px solid #8a421e; background: #fbf3ee; font-size: .8rem; font-weight: 400; line-height: 1.3; }
.opg-compare span { display: block; font-weight: 700; overflow-wrap: anywhere; }
.opg-table .opg-incomplete td { box-shadow: inset 0 2px #e7b55c; }
.opg-empty { color: #8a421e; }
.opg-blank { color: #8b9489; }
/* Compact view: one line per order, the whole text on hover and in the editor. */
.opg-compact .opg-table { font-size: 13px; }
.opg-compact .opg-table td { padding: .2rem .4rem; vertical-align: middle; white-space: nowrap; text-overflow: ellipsis; }
.opg-compact .opg-table td small { display: inline; margin-left: .35rem; }
.opg-compact .opg-missing { display: none !important; }
.opg-compact .opg-cell-button { min-height: 1.5rem; padding: .05rem .15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opg-compact .opg-place { align-items: center; }
.opg-compact .opg-place-text { overflow: hidden; text-overflow: ellipsis; }
.opg-summary { margin: 1rem 0; }
.opg-summary p { margin: .4rem 0; }
.opg-summary-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .5rem 0; border-bottom: 1px solid #e2e8e0; }
.opg-summary-row > div { display: flex; flex-wrap: wrap; gap: .4rem; }
.opg-print-head, .opg-print-only { display: none; }
@media (max-width: 600px) {
  .opg-counts { display: grid; gap: .2rem; }
  .opg-controls { margin-left: 0; }
  .opg-scroll { max-height: 68vh; }
  .opg-table { font-size: .82rem; }
}
/* The paper: the same rows in the same order, landscape, nothing to click, every note whole. The class is set by the
   module only while the grid prints, so no other page of the work area prints differently. */
@media print {
  html.opg-printing .labbar, html.opg-printing header.top, html.opg-printing #modalRoot,
  html.opg-printing .opg-head, html.opg-printing .opg-counts, html.opg-printing .opg-bar,
  html.opg-printing .opg-resize, html.opg-printing .opg-maps, html.opg-printing .opg-editor,
  html.opg-printing .opg-table th button, html.opg-printing .opg-table th select, html.opg-printing .opg-table th input, html.opg-printing .opg-filter-pair,
  html.opg-printing .opg-select input, html.opg-printing .opg-select-all, html.opg-printing .opg-empty, html.opg-printing .opg-blank, html.opg-printing .opg-missing { display: none !important; }
  html.opg-printing, html.opg-printing body { background: #fff; }
  html.opg-printing .app-page { max-width: none; margin: 0; padding: 0; }
  html.opg-printing .opg-card { border: 0; border-radius: 0; overflow: visible; }
  html.opg-printing .opg-print-head { display: block; margin: 0 0 6pt; font-size: 10pt; }
  html.opg-printing .opg-print-head strong { display: block; font-size: 13pt; }
  html.opg-printing .opg-scroll { max-height: none !important; overflow: visible !important; border: 0; }
  html.opg-printing .opg-table { width: 100% !important; table-layout: auto; border-collapse: collapse; font-size: 8.5pt; }
  html.opg-printing .opg-table col { width: auto !important; }
  html.opg-printing .opg-table thead { display: table-header-group; break-inside: avoid; }
  html.opg-printing .opg-table tr { break-inside: avoid; page-break-inside: avoid; }
  html.opg-printing .opg-table th, html.opg-printing .opg-table td { position: static !important; overflow: visible; padding: 2pt 3pt; border: .5pt solid #777; background: #fff !important; box-shadow: none !important; white-space: normal !important; text-overflow: clip; overflow-wrap: break-word; }
  html.opg-printing .opg-table th { white-space: nowrap !important; }
  html.opg-printing .opg-th-label { display: block; padding: 0; }
  /* A cell being edited prints what is saved; the editor, hidden above, keeps what is being typed. */
  html.opg-printing .opg-saved { display: inline; }
  html.opg-printing .opg-cell-button { min-height: 0; padding: 0; border: 0; white-space: inherit; overflow: visible; overflow-wrap: break-word; }
  html.opg-printing .opg-table td small { display: inline; margin-left: 3pt; }
  html.opg-printing .opg-table td[data-column="customer"] { min-width: 30mm; }
  html.opg-printing .opg-table td[data-column="place"] { min-width: 42mm; }
  /* The totals once, after the last row: a footer repeated on every page would read as the total of that page. */
  html.opg-printing .opg-table tfoot { display: table-row-group; }
  html.opg-printing .opg-table tfoot td { border-top: 1.2pt solid #333; font-weight: 700; }
}
