/* SpanOPS portal: only what the Sanrad kit (sanrad-ui.css 1.5.0) doesn't define.
   No component of the kit is redefined here; colours come from its tokens. */

/* [hidden] must win over our display: grid/flex helpers (e.g. the quantity row on non-raw-material). */
[hidden] { display: none !important; }

/* The SpanOPS logo follows the theme: light artwork on light, #5B9BD5 artwork on dark.
   Auto (no data-theme) follows the device. The artwork is never recoloured. */
.logo-dark { display: none; }
html[data-theme="dark"] .logo-light { display: none; }
html[data-theme="dark"] .logo-dark { display: inline; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .logo-light { display: none; }
  html:not([data-theme]) .logo-dark { display: inline; }
}
.brand-logo { height: 30px; width: auto; }
.auth-logo-img { height: 64px; width: auto; max-width: 100%; }

.who { max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px) { .who { display: none; } }

/* The scan box: the one big input of the portal (USB scanners type the QR and press Enter). */
.scan-input { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 20px; letter-spacing: .06em; }
.code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .05em; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; }
.scope-site { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }

#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; }

/* Form dialogs: the kit's .modal-glass is sized for short confirmations (380px). SpanOPS forms
   (enrol, permissions) need more width, and scroll inside the dialog instead of off the screen. */
.modal-form { max-width: 560px; max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain; }

/* ---------- Using the screen: phones one column; tablets/laptops two panes; wide screens full width ---------- */
.page-full { width: 100%; max-width: 1920px; margin: 0 auto; padding: 20px clamp(16px, 2.5vw, 40px) 32px; }
.split { display: grid; gap: 20px; align-items: start; }
.split > * { min-width: 0; }
.split > .pane-side > * + *, .split > .pane-main > * + * { margin-top: 16px; }
.cards-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); align-items: start; }
.cards-grid > .card { margin: 0; }
.recent .list-item { cursor: pointer; }
@media (min-width: 1100px) {
  .split { grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); }
  .split > .pane-side { position: sticky; top: 84px; max-height: calc(100dvh - 104px); overflow-y: auto; }
  .split.wide-side { grid-template-columns: minmax(360px, 520px) minmax(0, 1fr); }
}
@media (min-width: 1700px) {
  .split.three { grid-template-columns: minmax(340px, 420px) minmax(0, 1fr) minmax(360px, 520px); }
}
/* the asset card + history side by side inside the main pane on very wide screens */
.asset-view { display: grid; gap: 16px; align-items: start; grid-template-columns: minmax(0, 1fr); }
.asset-view > * { min-width: 0; }  /* a wide history table scrolls inside its card instead of widening the page */
@media (min-width: 1500px) { .asset-view { grid-template-columns: minmax(380px, 560px) minmax(0, 1fr); } }
.asset-view > .card { margin: 0; }
/* dense tables on big screens */
@media (min-width: 1100px) { .page-full .table-wrap td, .page-full .table-wrap th { white-space: nowrap; } .page-full .table-wrap td.wrap { white-space: normal; } }
/* big forms (permissions per site and category) get the room on wide screens */
.modal-form.modal-wide { max-width: min(1040px, calc(100vw - 40px)); }

/* site location picker (OpenStreetMap via the bundled Leaflet) */
.map-pick { height: 300px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; z-index: 0; }
@media (min-width: 1100px) { .modal-form .map-pick { height: 360px; } }
.map-coords { margin-top: 4px; }
/* bulk add review: rows and products the server marked */
tr.row-bad > td { background: color-mix(in srgb, var(--color-danger, #c0392b) 10%, transparent); }
tr.row-bad + tr.row-bad > td { color: var(--color-danger, #c0392b); font-size: .9em; padding-top: 0; }
.card-bad { outline: 2px solid var(--color-danger, #c0392b); outline-offset: -2px; }
.stack > * + * { margin-top: 10px; }

/* report category ticks */
.check-list { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin: 8px 0; }
.check-list legend { padding: 0 4px; font-weight: 600; }
.check-list .check-row { margin: 2px 0; }
