/* ==========================================================================
   QualityPulse UI theme — top-level visual layer over Bootstrap 5.
   Loaded AFTER bootstrap and base.html's inline styles, BEFORE page CSS, so
   it restyles every page without touching page logic. It deliberately does
   NOT change layout mechanics owned by base.html: --sticky-h, --sidebar-w,
   safe-area insets, the mobile bottom bar height, keyboard handling.
   ========================================================================== */

:root {
  --primary: #2d62c9;                 /* keep the name every template uses */
  --qp-primary: #2d62c9;
  --qp-primary-600: #2552ab;
  --qp-primary-300: #7ea2ea;
  --qp-primary-soft: #e8effc;
  /* Light is a touch softer than paper-white (12 November 2026), easier on the
     eyes over a whole day: the surfaces about 3% under white, the page grey a
     step deeper so cards keep their edge, inputs and dialogs a hair brighter
     than the cards they sit on. Text contrast stays above 15:1. */
  --qp-bg: #eceff3;
  --qp-bg-2: #eef1f5;
  --qp-surface: #f8f9fb;
  --qp-border: #e0e5ec;
  --qp-border-strong: #cdd4de;
  --qp-text: #0f172a;
  --qp-text-2: #334155;
  --qp-muted: #5b6b82;
  --qp-muted-2: #94a3b8;
  --qp-success: #15803d; --qp-success-soft: #dcfce7;
  --qp-warning: #b45309; --qp-warning-soft: #fef3c7;
  --qp-danger:  #b91c1c; --qp-danger-soft:  #fee2e2;
  --qp-info:    #0369a1; --qp-info-soft:    #e0f2fe;
  /* What each colour is for. Pages and components ask for one of these by its
     job; dark mode only re-points them, which is why a page
     needs no dark rules of its own.
       Backgrounds  --qp-bg page, --qp-bg-2 secondary (table heads, nested blocks),
                    --qp-fill a fainter tint of the same
       Surfaces     --qp-surface cards, --qp-elevated menus, modals and sheets
       Text         --qp-text primary, --qp-text-2 secondary, --qp-muted tertiary,
                    --qp-muted-2 quietest (hints, disabled)
       Lines        --qp-border, --qp-border-strong, --qp-separator between rows
       Actions      --qp-action a filled control, under --qp-on-action text;
                    --qp-primary a link or an outline, on the page itself
       Status       --qp-success, --qp-warning, --qp-danger, --qp-info, each with
                    a -soft tint to sit on */
  --qp-fill: #f2f4f7;
  --qp-elevated: #fbfbfc;
  --qp-separator: #e7ebf0;
  --qp-hover: rgba(15, 23, 42, .045);
  --qp-action: #2d62c9; --qp-action-hover: #2552ab; --qp-on-action: #ffffff;
  --qp-input-bg: #fbfcfd; --qp-input-border: #cdd4de; --qp-placeholder: #64748b;
  --qp-focus-ring: rgba(45, 98, 201, .22);
  --qp-bar-bg: #f8f9fb;
  --qp-radius: 12px;
  --qp-radius-sm: 8px;
  --qp-shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .06);
  --qp-shadow-md: 0 4px 12px rgba(15, 23, 42, .08), 0 2px 4px rgba(15, 23, 42, .05);
  --qp-shadow-lg: 0 18px 40px rgba(15, 23, 42, .16);
  --qp-font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-font-family: var(--qp-font);
  --bs-body-color: var(--qp-text-2);
  --bs-link-color: var(--qp-primary);
  --bs-link-hover-color: var(--qp-primary-600);
  --bs-border-color: var(--qp-border);

  /* Spacing, type and control sizes (26 Nov 2026): one scale for the report's
     sections and the template editor (qp-sections.css), so neighbours keep
     the same distances. The rest of the app keeps its own values for now.
       Space    4 6 8 12 16 20 24 32 px at Normal text
       Type     12 hints and counts, 13 labels and captions, 14 body, 16 titles
       Controls 32 small, 36 on a phone, 40 for a finger
     Space and type are rem, so they grow with Large and Larger text as the
     values they replaced did; controls stay px, as theirs were. */
  --qp-space-1: .25rem; --qp-space-1h: .375rem; --qp-space-2: .5rem; --qp-space-3: .75rem;
  --qp-space-4: 1rem; --qp-space-5: 1.25rem; --qp-space-6: 1.5rem; --qp-space-8: 2rem;
  --qp-fs-xs: .75rem; --qp-fs-sm: .8125rem; --qp-fs-md: .875rem; --qp-fs-lg: 1rem;
  --qp-ctl-sm: 32px; --qp-ctl-md: 36px; --qp-ctl-touch: 40px;
}

html, body { background: var(--qp-bg); }
body { font-family: var(--qp-font); color: var(--qp-text-2); font-size: .9rem; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--qp-text); font-weight: 650; letter-spacing: -.01em; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.btn:hover, .nav-link:hover, .card:hover, .list-group-item:hover, .dropdown-item:hover, .page-link:hover { text-decoration: none; }
:focus-visible { outline: 2px solid var(--qp-primary-300); outline-offset: 2px; }

/* Thin scrollbars inside the scrolling main pane */
#main { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
#main::-webkit-scrollbar { width: 8px; height: 8px; }
#main::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; border: 2px solid var(--qp-bg); }

/* --------------------------------------------------------------------------
   Sidebar: deliberately NOT restyled — it keeps the live app's look from
   base.html. Only the appearance/text-size buttons below are new.
   -------------------------------------------------------------------------- */
/* The two groups share a row while they fit and stack when they do not:
   at Larger text they ran 58px out of the menu. */
.qp-prefs { display: flex; flex-wrap: wrap; gap: .35rem; margin: .5rem 0 .1rem; }
.qp-prefs .btn-group { flex: 1 1 5.6rem; min-width: 0; }
.qp-prefs .btn-group .btn { min-width: 0; }
/* The look (Classic / Alpenglow, 27 November 2026) has a row to itself. */
.qp-prefs [data-pref="qp-look"] { flex-basis: 100%; }
/* Each of the two takes the room its own word needs (28 November 2026): as
   equal halves, "Alpenglow" with its sun ran out over the edge of its button
   at Large and Larger text. */
.qp-prefs [data-pref="qp-look"] .btn { white-space: nowrap; flex: 1 1 auto; }
/* At Large and Larger text the word alone: with its little sun it was still
   7 px too wide in Alpenglow's narrower menu on a computer. */
html[data-qp-text] .qp-prefs [data-pref="qp-look"] .btn > i { display: none; }
.qp-prefs .btn { flex: 1; padding: .15rem .3rem; font-size: .68rem; color: #64748b; border-color: #cbd5e1; background: transparent; }
.qp-prefs .btn.active { background: #e8effc; color: #1e3a8a; border-color: #93b4ea; }
.qp-prefs .btn:hover { color: #0f172a; background: #f1f5f9; }
[data-bs-theme="dark"] .qp-prefs .btn { color: #aeaba1; border-color: #4a4943; }
[data-bs-theme="dark"] .qp-prefs .btn.active { background: #4a4943; color: #f1f5f9; border-color: #5c5b54; }
[data-bs-theme="dark"] .qp-prefs .btn:hover { color: #f1f5f9; background: #4a4943; }

/* --------------------------------------------------------------------------
   Sticky top bar (heights are owned by base.html — only looks change here)
   -------------------------------------------------------------------------- */
.sticky-top-bar {
  background: color-mix(in srgb, var(--qp-bar-bg) 86%, transparent) !important; -webkit-backdrop-filter: saturate(160%) blur(10px); backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--qp-border) !important; box-shadow: 0 1px 0 rgba(15,23,42,.02) !important;
}
.sticky-top-bar::before { background: color-mix(in srgb, var(--qp-bar-bg) 95%, transparent); }
.sticky-top-bar h1, .sticky-top-bar .h1 { font-size: 1.05rem !important; font-weight: 650 !important; color: var(--qp-text) !important; letter-spacing: -.01em; }
.sticky-top-bar h1 i { color: var(--qp-primary) !important; }
/* A long page title squeezed the buttons on a phone until "Save" wrapped
   under its icon, and the row stretched every button to that 52px. Labels
   stay on one line, so the button group keeps its width and the title
   (which already truncates) gives up the space instead. */
.sticky-top-bar .btn { white-space: nowrap; }

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card { border: 1px solid var(--qp-border); border-radius: var(--qp-radius); box-shadow: var(--qp-shadow-sm); background: var(--qp-surface); }
.card-header {
  background: transparent; border-bottom: 1px solid var(--qp-border); font-weight: 600; color: var(--qp-text);
  padding: .8rem 1rem; font-size: .93rem; border-top-left-radius: var(--qp-radius) !important; border-top-right-radius: var(--qp-radius) !important;
}
.card-header i:first-child { color: var(--qp-primary); }
.card-footer { background: transparent; border-top: 1px solid var(--qp-border); }
.card > .list-group:last-child { border-bottom-left-radius: var(--qp-radius); border-bottom-right-radius: var(--qp-radius); }
.section-card { border-left: 3px solid var(--qp-primary) !important; }
a.card:hover { box-shadow: var(--qp-shadow-md); border-color: var(--qp-border-strong); transform: translateY(-1px); transition: all .15s; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn { border-radius: var(--qp-radius-sm); font-weight: 500; letter-spacing: .005em; transition: background .15s, border-color .15s, box-shadow .15s, color .15s; }
.btn-sm, .btn-group-sm > .btn { padding: .32rem .7rem; font-size: .8rem; }
.btn-primary { background: var(--qp-primary); border-color: var(--qp-primary); box-shadow: 0 1px 2px rgba(45,98,201,.25); }
.btn-primary:hover, .btn-primary:focus { background: var(--qp-primary-600); border-color: var(--qp-primary-600); }
.btn-primary:active, .btn-primary.active { background: #1f468f !important; border-color: #1f468f !important; }
.btn-outline-primary { color: var(--qp-primary); border-color: #b9cdf3; background: var(--qp-surface); }
.btn-outline-primary:hover { background: var(--qp-primary); border-color: var(--qp-primary); color: #fff; }
.btn-outline-secondary { color: var(--qp-text-2); border-color: var(--qp-border-strong); background: var(--qp-surface); }
.btn-outline-secondary:hover { background: #f1f5f9; border-color: #b8c2d1; color: var(--qp-text); }
.btn-outline-danger { border-color: #f3c0c0; background: var(--qp-surface); }
.btn-outline-danger:hover { background: #dc2626; border-color: #dc2626; }
.btn-outline-success { border-color: #b7e4c7; background: var(--qp-surface); }
.btn-light { background: #f1f5f9; border-color: #f1f5f9; color: var(--qp-text-2); }
.btn-light:hover { background: #e2e8f0; border-color: #e2e8f0; }
.btn:focus-visible, .btn:focus { box-shadow: 0 0 0 3px rgba(45,98,201,.2); }
.btn .bi { vertical-align: -.1em; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-control, .form-select { border-radius: var(--qp-radius-sm); border-color: var(--qp-border-strong); color: var(--qp-text); background-color: var(--qp-input-bg); transition: border-color .15s, box-shadow .15s; }
.form-control:hover, .form-select:hover { border-color: #b8c2d1; }
.form-control:focus, .form-select:focus { border-color: var(--qp-primary); box-shadow: 0 0 0 3px rgba(45,98,201,.16); }
.form-control::placeholder { color: #a0aabb; }
.form-control[readonly], .form-control:disabled, .form-select:disabled, .bg-light.form-control { background-color: var(--qp-fill); color: var(--qp-text-2); }
.form-label { font-size: .8rem; font-weight: 600; color: var(--qp-text-2); margin-bottom: .3rem; }
.form-text { color: var(--qp-muted); font-size: .76rem; }
.form-check-input { border-color: var(--qp-border-strong); }
.form-check-input:checked { background-color: var(--qp-primary); border-color: var(--qp-primary); }
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(45,98,201,.16); border-color: var(--qp-primary); }
.form-switch .form-check-input { width: 2.2em; }
.input-group-text { background: #f6f8fb; border-color: var(--qp-border-strong); color: var(--qp-muted); font-size: .82rem; border-radius: var(--qp-radius-sm); }
.ts-wrapper .ts-control { border-radius: var(--qp-radius-sm) !important; border-color: var(--qp-border-strong) !important; }
.ts-wrapper.focus .ts-control { border-color: var(--qp-primary) !important; box-shadow: 0 0 0 3px rgba(45,98,201,.16) !important; }
.ts-dropdown { border-radius: var(--qp-radius-sm); border-color: var(--qp-border); box-shadow: var(--qp-shadow-md); }
.ts-dropdown .active { background: var(--qp-primary-soft); color: var(--qp-text); }

/* --------------------------------------------------------------------------
   Tables & DataTables
   -------------------------------------------------------------------------- */
.table { --bs-table-color: var(--qp-text-2); --bs-table-border-color: #edf0f5; --bs-table-hover-bg: #f6f8fb; margin-bottom: 0; }
.table > :not(caption) > * > * { border-bottom-color: #edf0f5; }
.table th { font-size: .7rem; letter-spacing: .07em; color: var(--qp-muted); background: transparent; font-weight: 650; border-bottom: 1px solid var(--qp-border) !important; }
.table thead.table-light th, .table .table-light th { background: #f6f8fb !important; }
.table td { color: var(--qp-text-2); }
.table td a:not(.btn) { color: var(--qp-primary); font-weight: 500; }
.table-hover tbody tr:hover { background: #f6f8fb; }
@media (min-width: 768px) {
  .table > :not(caption) > * > * { padding: .6rem .75rem; }
  .table-sm > :not(caption) > * > * { padding: .35rem .5rem; }
}
.table-responsive { border-radius: var(--qp-radius-sm); }
.card > .card-body > .table:first-child thead th:first-child, .card-body.p-0 .table thead th:first-child { padding-left: 1rem; }
/* DataTables 2 chrome */
div.dt-container .dt-search input, div.dt-container .dt-length select {
  border: 1px solid var(--qp-border-strong) !important; border-radius: var(--qp-radius-sm) !important; padding: .35rem .6rem !important; font-size: .82rem !important; background: var(--qp-input-bg);
}
div.dt-container .dt-search input { min-width: 200px; padding-left: 2rem !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.656a5 5 0 1 1 0-10 5 5 0 0 1 0 10'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: .6rem center; }
div.dt-container .dt-search input:focus { outline: none; border-color: var(--qp-primary) !important; box-shadow: 0 0 0 3px rgba(45,98,201,.16); }
div.dt-container .dt-search label, div.dt-container .dt-length label { font-size: .82rem; color: var(--qp-muted); }
div.dt-container .dt-info { font-size: .8rem; color: var(--qp-muted); padding-top: .9rem; }
div.dt-container .dt-paging .pagination { gap: .25rem; }
div.dt-container .dt-paging .page-link { border-radius: var(--qp-radius-sm) !important; border: 1px solid transparent; color: var(--qp-text-2); font-size: .8rem; min-width: 32px; text-align: center; padding: .3rem .5rem; }
div.dt-container .dt-paging .page-link:hover { background: #eef2f7; }
div.dt-container .dt-paging .page-item.active .page-link { background: var(--qp-primary); border-color: var(--qp-primary); color: #fff; }
div.dt-container .dt-paging .page-item.disabled .page-link { color: #b8c2d1; background: transparent; }
div.dt-container .dt-layout-row:first-child { padding-bottom: .5rem; }
table.dataTable thead > tr > th.dt-orderable-asc:hover, table.dataTable thead > tr > th.dt-orderable-desc:hover { outline: none; background: #f6f8fb; }
table.dataTable > tbody > tr > td.dtr-control::before, table.dataTable > tbody > tr > th.dtr-control::before { color: var(--qp-muted-2); }
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control::before { border-radius: 4px; }
/* Responsive child rows */
table.dataTable > tbody > tr.child ul.dtr-details > li { border-bottom-color: #edf0f5; padding: .35rem 0; font-size: .82rem; }
table.dataTable > tbody > tr.child span.dtr-title { color: var(--qp-muted); font-weight: 600; min-width: 110px; }

/* --------------------------------------------------------------------------
   Badges, alerts, lists, modals, dropdowns, tabs
   -------------------------------------------------------------------------- */
.badge { border-radius: 999px; font-weight: 600; padding: .32em .65em; font-size: .7rem; letter-spacing: .01em; }
.badge-draft     { background: #e9edf3; color: #475569; }
.badge-submitted { background: var(--qp-info-soft); color: var(--qp-info); }
.badge-approved  { background: var(--qp-success-soft); color: var(--qp-success); }
.badge-rejected  { background: var(--qp-danger-soft); color: var(--qp-danger); }
.badge.bg-success { background: var(--qp-success-soft) !important; color: var(--qp-success) !important; }
.badge.bg-danger  { background: var(--qp-danger-soft) !important; color: var(--qp-danger) !important; }
.badge.bg-warning { background: var(--qp-warning-soft) !important; color: var(--qp-warning) !important; }
.badge.bg-info    { background: var(--qp-info-soft) !important; color: var(--qp-info) !important; }
.badge.bg-secondary { background: #e9edf3 !important; color: #475569 !important; }
.badge.bg-primary { background: var(--qp-primary-soft) !important; color: var(--qp-primary-600) !important; }
.badge.bg-dark { background: #1e293b !important; }
/* Solid badges that must stay solid (counts on the sidebar / tabs) */
#sidebar .badge.bg-danger { background: #ef4444 !important; color: #fff !important; }
#sidebar .badge.bg-warning { background: #f59e0b !important; color: #1e293b !important; }

.alert { border: 1px solid transparent; border-left-width: 3px; border-radius: var(--qp-radius-sm); padding: .65rem .9rem; font-size: .86rem; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; border-left-color: #22c55e; color: #166534; }
.alert-danger  { background: #fef2f2; border-color: #fecaca; border-left-color: #ef4444; color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: #fde68a; border-left-color: #f59e0b; color: #92400e; }
.alert-info    { background: #f0f9ff; border-color: #bae6fd; border-left-color: #0ea5e9; color: #075985; }
.alert .alert-link { font-weight: 600; }

.list-group-item { border-color: #edf0f5; color: var(--qp-text-2); }
.list-group-item-action:hover { background: #f6f8fb; }

.modal-content { border: none; border-radius: 14px; box-shadow: var(--qp-shadow-lg); }
.modal-header { border-bottom: 1px solid var(--qp-border); padding: .9rem 1.1rem; }
.modal-title { font-weight: 650; color: var(--qp-text); font-size: 1rem; }
.modal-footer { border-top: 1px solid var(--qp-border); padding: .7rem 1rem; }
.modal-backdrop.show { opacity: .4; }

.dropdown-menu { border: 1px solid var(--qp-border); border-radius: 10px; box-shadow: var(--qp-shadow-md); padding: .35rem; font-size: .86rem; }
.dropdown-item { border-radius: 6px; padding: .4rem .65rem; }
.dropdown-item:hover, .dropdown-item:focus { background: #f1f5f9; color: var(--qp-text); }
.dropdown-item.active, .dropdown-item:active { background: var(--qp-primary-soft); color: var(--qp-primary-600); }

.nav-tabs { border-bottom: 1px solid var(--qp-border); gap: .25rem; }
.nav-tabs .nav-link { border: none; border-bottom: 2px solid transparent; color: var(--qp-muted); font-weight: 500; padding: .55rem .9rem; border-radius: 0; }
.nav-tabs .nav-link:hover { color: var(--qp-text); border-bottom-color: var(--qp-border-strong); }
.nav-tabs .nav-link.active { color: var(--qp-primary); border-bottom-color: var(--qp-primary); background: transparent; }
.nav-pills .nav-link { border-radius: var(--qp-radius-sm); color: var(--qp-text-2); }
.nav-pills .nav-link.active { background: var(--qp-primary); }

.progress { background: #e9edf3; border-radius: 999px; }
.progress-bar { border-radius: 999px; }
hr { border-color: var(--qp-border); opacity: 1; }
.text-muted { color: var(--qp-muted) !important; }
.tooltip-inner { border-radius: 6px; font-size: .76rem; }
footer { color: var(--qp-muted-2) !important; }

/* Page header used by pages that still render one */
.page-header h1 { font-weight: 650; letter-spacing: -.01em; }

/* Empty state helper (opt-in) */
.qp-empty { text-align: center; padding: 2.5rem 1rem; color: var(--qp-muted); }
/* Only the illustration icon is large: a button inside the empty state keeps
   its own icon size, or it grows into a tall block around a 2rem glyph. */
.qp-empty > i { font-size: 2rem; display: block; margin-bottom: .5rem; color: #b8c2d1; }
.qp-empty .btn { display: table; margin: .75rem auto 0; }

/* --------------------------------------------------------------------------
   Dashboard stat cards
   -------------------------------------------------------------------------- */
.qp-stat, .card.qp-stat { display: flex; flex-direction: row; align-items: center; gap: .9rem; padding: .95rem 1.1rem; height: 100%; color: inherit; }
.qp-stat .qp-stat-icon {
  width: 42px; height: 42px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-size: 1.15rem; background: var(--qp-primary-soft); color: var(--qp-primary);
}
.qp-stat.is-warning .qp-stat-icon { background: var(--qp-warning-soft); color: var(--qp-warning); }
.qp-stat.is-danger  .qp-stat-icon { background: var(--qp-danger-soft);  color: var(--qp-danger); }
.qp-stat.is-info    .qp-stat-icon { background: var(--qp-info-soft);    color: var(--qp-info); }
.qp-stat.is-neutral .qp-stat-icon { background: #eef2f7; color: var(--qp-text-2); }
.qp-stat .qp-stat-label { font-size: .8rem; color: var(--qp-muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qp-stat .qp-stat-value { font-size: 1.55rem; font-weight: 700; color: var(--qp-text); line-height: 1.1; letter-spacing: -.02em; }
.qp-stat .qp-stat-sub { font-size: .74rem; color: var(--qp-muted); }
.qp-stat .bi-chevron-right { margin-left: auto; color: #b8c2d1; }
/* Two cards a row on a phone leave ~100px for the label: let it wrap rather
   than cut "Pending approval" to "PENDING AP…". */
@media (max-width: 575.98px) {
  .qp-stat, .card.qp-stat { gap: .65rem; padding: .8rem .85rem; }
  .qp-stat .qp-stat-icon { width: 36px; height: 36px; font-size: 1rem; }
  .qp-stat .qp-stat-label { white-space: normal; letter-spacing: .04em; line-height: 1.25; }
}
/* Attention list on the dashboard */
.qp-attn .list-group-item { display: flex; align-items: flex-start; gap: .7rem; padding: .65rem 1rem; }
.qp-attn .qp-attn-icon { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: .9rem; margin-top: .05rem; }
.qp-attn .is-danger .qp-attn-icon { background: var(--qp-danger-soft); color: var(--qp-danger); }
.qp-attn .is-warning .qp-attn-icon { background: var(--qp-warning-soft); color: var(--qp-warning); }
.qp-attn .is-success .qp-attn-icon { background: var(--qp-success-soft); color: var(--qp-success); }
.qp-attn .list-group-item .small { font-size: .84rem; }
.qp-attn .list-group-item a { font-weight: 600; white-space: nowrap; }

/* --------------------------------------------------------------------------
   Quick search (Ctrl/Cmd+K)
   -------------------------------------------------------------------------- */
#qpSearchModal .modal-dialog { max-width: 620px; margin-top: 8vh; }
#qpSearchModal .modal-content { overflow: hidden; }
#qpSearchModal .qp-search-input { border: none; border-radius: 0; padding: .95rem 1rem .95rem 2.6rem; font-size: 1rem; box-shadow: none; background: var(--qp-input-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.656a5 5 0 1 1 0-10 5 5 0 0 1 0 10'/%3E%3C/svg%3E") no-repeat 1rem center; border-bottom: 1px solid var(--qp-border); }
#qpSearchModal .qp-search-results { max-height: 60vh; overflow-y: auto; }
#qpSearchModal .qp-sr-group { font-size: .66rem; text-transform: uppercase; letter-spacing: .09em; color: var(--qp-muted); padding: .6rem 1rem .25rem; font-weight: 700; }
#qpSearchModal .qp-sr-item { display: flex; align-items: center; gap: .7rem; padding: .5rem 1rem; color: var(--qp-text-2); cursor: pointer; }
#qpSearchModal .qp-sr-item i { width: 1.2rem; text-align: center; color: var(--qp-muted-2); }
#qpSearchModal .qp-sr-item .qp-sr-title { font-weight: 500; color: var(--qp-text); }
#qpSearchModal .qp-sr-item .qp-sr-sub { font-size: .76rem; color: var(--qp-muted); }
#qpSearchModal .qp-sr-item.active, #qpSearchModal .qp-sr-item:hover { background: var(--qp-primary-soft); }
#qpSearchModal .qp-sr-item.active .qp-sr-title { color: var(--qp-primary-600); }
#qpSearchModal .qp-sr-empty { padding: 1.5rem 1rem; text-align: center; color: var(--qp-muted); font-size: .86rem; }
#qpSearchModal .qp-search-foot { border-top: 1px solid var(--qp-border); padding: .45rem 1rem; font-size: .72rem; color: var(--qp-muted-2); display: flex; gap: 1rem; }
#qpSearchModal kbd { font-size: .66rem; background: #f1f5f9; border: 1px solid var(--qp-border); border-radius: 4px; padding: .05rem .35rem; color: var(--qp-text-2); }

/* --------------------------------------------------------------------------
   Mobile bottom bar (built by base.html JS) — looks only
   -------------------------------------------------------------------------- */
.qp-bb { border-top: 1px solid var(--qp-border); background: rgba(255,255,255,.94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.qp-bb-btn { color: var(--qp-muted); font-weight: 500; }
.qp-bb-btn.active, .qp-bb-btn[aria-current="page"] { color: var(--qp-primary); }

/* --------------------------------------------------------------------------
   Phone tweaks
   -------------------------------------------------------------------------- */
@media (max-width: 575px) {
  .qp-stat { padding: .75rem .8rem; gap: .65rem; }
  .qp-stat .qp-stat-icon { width: 36px; height: 36px; font-size: 1rem; border-radius: 9px; }
  .qp-stat .qp-stat-value { font-size: 1.3rem; }
  .card { border-radius: 10px; }
  #qpSearchModal .modal-dialog { margin: .5rem; }
}

/* Phone: stat cards get tighter and drop the chevron */
@media (max-width: 575px) {
  .qp-stat .bi-chevron-right { display: none; }
  .qp-stat .qp-stat-label { font-size: .64rem; letter-spacing: .05em; }
}

/* DataTables' own empty row and server-rendered empty states share one look */
table.dataTable td.dt-empty, td.dt-empty { padding: 2.5rem 1rem !important; text-align: center; color: var(--qp-muted); font-size: .9rem; }
table.dataTable td.dt-empty::before { content: '\F3F2'; font-family: 'bootstrap-icons'; display: block; font-size: 2rem; color: #b8c2d1; margin-bottom: .4rem; line-height: 1; }
.qp-empty { font-size: .9rem; }
.qp-empty .small { color: var(--qp-muted-2); }

/* --------------------------------------------------------------------------
   Dark mode (Bootstrap 5.3 data-bs-theme="dark" + our tokens) and large text.
   Chosen in the sidebar; applied by an early inline script in base.html.
   -------------------------------------------------------------------------- */
/* :root[...] as well as the bare attribute: static/theme.css sets the shared
   tokens (--ink, --page, --bs-body-bg…) on :root and is linked after this
   file, so at equal specificity its light values won in dark mode. */
:root[data-bs-theme="dark"], [data-bs-theme="dark"] {
  /* Warm charcoal, after Claude's dark mode: neutral greys with a hint of
     warmth instead of navy, soft off-white text, and edges drawn by subtle
     warm borders rather than by colour. The app's blue stays the accent. */
  --ink: #f0eee8; --ink-2: #dcd9d0; --muted: #aeaba1; --faint: #918e85;
  --line: #4a4943; --line-strong: #5c5b54; --page: #262624;
  --primary-hover: #9bbaf5; --primary-soft: #343b49; --primary-line: #4d6a9e;
  --qp-bg: #262624; --qp-bg-2: #3a3a37; --qp-surface: #30302e; --qp-border: #4a4943; --qp-border-strong: #5c5b54;
  --qp-text: #f0eee8; --qp-text-2: #dcd9d0; --qp-muted: #aeaba1; --qp-muted-2: #918e85;
  --qp-primary: #7ea6f2; --primary: #7ea6f2; --qp-primary-600: #9bbaf5; --qp-primary-300: #5b86dc; --qp-primary-soft: #343b49;
  --qp-success-soft: #0f2e1d; --qp-success: #4ade80; --qp-warning-soft: #3a2a0a; --qp-warning: #fbbf24;
  --qp-danger-soft: #3b1414; --qp-danger: #f87171; --qp-info-soft: #2c3a4b; --qp-info: #7eb2f7;
  --qp-fill: #353533; --qp-elevated: #3a3a37; --qp-separator: #454440; --qp-hover: rgba(255, 250, 240, .07);
  --qp-action: #3567d0; --qp-action-hover: #4475da; --qp-on-action: #ffffff;
  --qp-input-bg: #262624; --qp-input-border: #5c5b54; --qp-placeholder: #a5a297;
  --qp-focus-ring: rgba(126, 166, 242, .38);
  --qp-bar-bg: #262624;
  --qp-shadow-sm: 0 1px 2px rgba(0,0,0,.4); --qp-shadow-md: 0 4px 14px rgba(0,0,0,.5); --qp-shadow-lg: 0 18px 40px rgba(0,0,0,.6);
  --bs-body-bg: var(--qp-bg); --bs-body-color: var(--qp-text-2); --bs-border-color: var(--qp-border);
  --bs-secondary-bg: var(--qp-bg-2); --bs-tertiary-bg: var(--qp-bg-2); --bs-emphasis-color: var(--qp-text);
  --bs-link-color: var(--qp-primary); --bs-link-hover-color: var(--qp-primary-600);
  color-scheme: dark;
}
[data-bs-theme="dark"] html, [data-bs-theme="dark"] body, html[data-bs-theme="dark"], html[data-bs-theme="dark"] body { background: var(--qp-bg); }
[data-bs-theme="dark"] .sticky-top-bar { background: var(--qp-bar-bg) !important; border-bottom: 1px solid var(--qp-border); }
[data-bs-theme="dark"] .sticky-top-bar::before { background: var(--qp-bar-bg); }
/* The sidebar sits a shade under the page with a visible edge, instead of
   melting into it. */
/* Set on :root, not just the sidebar: the phone top bar uses --side-bg too
   and stayed navy. */
:root[data-bs-theme="dark"] { --side-bg: #1f1e1d; --side-line: rgba(255, 250, 240, .08); --side-hover: rgba(255, 250, 240, .06); --side-active: rgba(255, 250, 240, .11); }
[data-bs-theme="dark"] #sidebar { background: #1f1e1d; border-right: 1px solid #33322f; }
[data-bs-theme="dark"] #topbar { border-bottom: 1px solid #33322f; }
[data-bs-theme="dark"] .card, [data-bs-theme="dark"] .list-group-item { background-color: var(--qp-surface); color: var(--qp-text-2); }
/* One step above the cards, so a menu or a sheet reads as lifted off the page. */
[data-bs-theme="dark"] .modal-content, [data-bs-theme="dark"] .dropdown-menu, [data-bs-theme="dark"] .offcanvas, [data-bs-theme="dark"] .ts-dropdown {
  --bs-modal-bg: var(--qp-elevated); --bs-dropdown-bg: var(--qp-elevated); --bs-offcanvas-bg: var(--qp-elevated);
  background-color: var(--qp-elevated); color: var(--qp-text-2); border-color: var(--qp-border-strong); box-shadow: var(--qp-shadow-lg); }
[data-bs-theme="dark"] .modal-content .card, [data-bs-theme="dark"] .modal-content .list-group-item, [data-bs-theme="dark"] .offcanvas .list-group-item { background-color: transparent; }
[data-bs-theme="dark"] .card-header, [data-bs-theme="dark"] .modal-header, [data-bs-theme="dark"] .modal-footer { border-color: var(--qp-border); }
/* static/theme.css (shared, light-only, linked last) paints these white or
   near-white; in dark mode they read as bright bars on a dark page. */
[data-bs-theme="dark"] .card-header { background: transparent; color: var(--qp-text); }
[data-bs-theme="dark"] .card-footer { background: var(--qp-fill); border-top-color: var(--qp-border); }
[data-bs-theme="dark"] .list-group { --bs-list-group-border-color: var(--qp-border); }
[data-bs-theme="dark"] .pagination { --bs-pagination-hover-bg: var(--qp-hover); }
[data-bs-theme="dark"] .status-tabs a { color: var(--qp-muted); }
[data-bs-theme="dark"] .status-tabs .tab-count,
[data-bs-theme="dark"] .page-header h1 .page-count { background: var(--qp-bg-2); color: var(--qp-text-2); }
[data-bs-theme="dark"] .status-chip.is-expired  { color: #fca5a5; background: #3b1414; border-color: #7f1d1d; }
[data-bs-theme="dark"] .status-chip.is-expiring { color: #fde68a; background: #3a2a0a; border-color: #78350f; }
[data-bs-theme="dark"] .row-expired  { background: #2a1214 !important; }
[data-bs-theme="dark"] .row-expiring { background: #2a210c !important; }
[data-bs-theme="dark"] .badge-Valid    { background: #0f2e1d; color: #86efac; }
[data-bs-theme="dark"] .badge-Expiring { background: #3a2a0a; color: #fdba74; }
[data-bs-theme="dark"] .badge-Expired  { background: #3b1414; color: #fca5a5; }
/* The light-mode blue lifted for dark is right for links but too pale under
   white button text (about 2.7:1); solid buttons keep a deeper blue. */
[data-bs-theme="dark"] .btn-primary { background: var(--qp-action); border-color: var(--qp-action); color: var(--qp-on-action); }
[data-bs-theme="dark"] .status-chip.active { background: var(--qp-action) !important; border-color: var(--qp-action) !important; }
[data-bs-theme="dark"] .btn-primary:hover,[data-bs-theme="dark"] .btn-primary:focus { background: var(--qp-action-hover); border-color: var(--qp-action-hover); color: var(--qp-on-action); }
[data-bs-theme="dark"] .form-check-input { background-color: var(--qp-input-bg); border-color: var(--qp-input-border); }
[data-bs-theme="dark"] .form-check-input:checked { background-color: var(--qp-action); border-color: var(--qp-action); }
[data-bs-theme="dark"] .nav-pills .nav-link.active { background: var(--qp-action); color: var(--qp-on-action); }
[data-bs-theme="dark"] div.dt-container .dt-paging .page-item.active .page-link,
[data-bs-theme="dark"] .pagination .page-item.active .page-link { background: var(--qp-action); border-color: var(--qp-action); color: var(--qp-on-action); }
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select, [data-bs-theme="dark"] .input-group-text, [data-bs-theme="dark"] .ts-wrapper .ts-control,
[data-bs-theme="dark"] div.dt-container .dt-search input, [data-bs-theme="dark"] div.dt-container .dt-length select {
  background-color: var(--qp-input-bg) !important; border-color: var(--qp-input-border) !important; color: var(--qp-text) !important; }
[data-bs-theme="dark"] .form-control::placeholder, [data-bs-theme="dark"] .ts-control input::placeholder, [data-bs-theme="dark"] textarea::placeholder { color: var(--qp-placeholder); opacity: 1; }
[data-bs-theme="dark"] .form-control:focus, [data-bs-theme="dark"] .form-select:focus, [data-bs-theme="dark"] .ts-wrapper.focus .ts-control {
  border-color: var(--qp-primary) !important; box-shadow: 0 0 0 3px var(--qp-focus-ring) !important; }
[data-bs-theme="dark"] .form-check-input:focus { border-color: var(--qp-primary); box-shadow: 0 0 0 3px var(--qp-focus-ring); }
[data-bs-theme="dark"] .form-control.is-invalid, [data-bs-theme="dark"] .form-select.is-invalid, [data-bs-theme="dark"] .was-validated .form-control:invalid { border-color: var(--qp-danger) !important; }
[data-bs-theme="dark"] .form-control.is-valid, [data-bs-theme="dark"] .form-select.is-valid { border-color: var(--qp-success) !important; }
[data-bs-theme="dark"] .invalid-feedback { color: var(--qp-danger); }
[data-bs-theme="dark"] .valid-feedback { color: var(--qp-success); }
[data-bs-theme="dark"] .form-control[readonly], [data-bs-theme="dark"] .form-control:disabled, [data-bs-theme="dark"] .form-select:disabled,
[data-bs-theme="dark"] .bg-light, [data-bs-theme="dark"] .bg-light.form-control { background-color: var(--qp-bg-2) !important; color: var(--qp-text-2) !important; }
[data-bs-theme="dark"] .table { --bs-table-bg: transparent; --bs-table-color: var(--qp-text-2); --bs-table-border-color: var(--qp-separator); --bs-table-hover-bg: var(--qp-hover); --bs-table-striped-bg: var(--qp-fill); }
[data-bs-theme="dark"] .table > :not(caption) > * > * { border-bottom-color: var(--qp-separator); }
[data-bs-theme="dark"] .table thead.table-light th, [data-bs-theme="dark"] .table .table-light th, [data-bs-theme="dark"] .table-light { background: var(--qp-bg-2) !important; color: var(--qp-muted) !important; }
/* Bootstrap gives .table-light its own pale border colour, and in a bordered
   table that drew a bright white frame round every table head. */
[data-bs-theme="dark"] .table-light, [data-bs-theme="dark"] .table-bordered { --bs-table-border-color: var(--qp-border); border-color: var(--qp-border); }
[data-bs-theme="dark"] .table-bordered > :not(caption) > * > *, [data-bs-theme="dark"] .table-light > * > * { border-color: var(--qp-border) !important; }
[data-bs-theme="dark"] .table-hover tbody tr:hover { background: var(--qp-hover); }
[data-bs-theme="dark"] .btn-outline-secondary, [data-bs-theme="dark"] .btn-outline-primary, [data-bs-theme="dark"] .btn-outline-danger, [data-bs-theme="dark"] .btn-outline-success,
[data-bs-theme="dark"] .btn-outline-info, [data-bs-theme="dark"] .btn-outline-warning { background: transparent; }
[data-bs-theme="dark"] .btn-outline-secondary { color: var(--qp-text-2); border-color: var(--qp-border-strong); }
[data-bs-theme="dark"] .btn-outline-secondary:hover { background: var(--qp-hover); color: var(--qp-text); }
[data-bs-theme="dark"] .btn-light { background: var(--qp-bg-2); border-color: var(--qp-bg-2); color: var(--qp-text-2); }
[data-bs-theme="dark"] .badge-draft, [data-bs-theme="dark"] .badge.bg-secondary { background: var(--qp-bg-2) !important; color: var(--qp-text-2) !important; }
[data-bs-theme="dark"] .badge.bg-light, [data-bs-theme="dark"] .bg-light.text-dark { background: var(--qp-bg-2) !important; color: var(--qp-text) !important; }
[data-bs-theme="dark"] .text-dark { color: var(--qp-text) !important; }
[data-bs-theme="dark"] .alert-success { background: #0f2e1d; border-color: #1f5a37; color: #bbf7d0; }
[data-bs-theme="dark"] .alert-danger  { background: #3b1414; border-color: #7f1d1d; color: #fecaca; }
[data-bs-theme="dark"] .alert-warning { background: #3a2a0a; border-color: #78350f; color: #fde68a; }
[data-bs-theme="dark"] .alert-info    { background: var(--qp-info-soft); border-color: #41586f; color: #cfe3fa; }
[data-bs-theme="dark"] .dropdown-item:hover, [data-bs-theme="dark"] .dropdown-item:focus, [data-bs-theme="dark"] .list-group-item-action:hover { background: var(--qp-hover); color: var(--qp-text); }
[data-bs-theme="dark"] div.dt-container .dt-paging .page-link { color: var(--qp-text-2); }
[data-bs-theme="dark"] div.dt-container .dt-paging .page-link:hover { background: var(--qp-hover); }
[data-bs-theme="dark"] .section-nav-bar { background: var(--qp-bar-bg) !important; border-bottom-color: var(--qp-border); }
[data-bs-theme="dark"] .section-nav-pill { background: var(--qp-surface); }
[data-bs-theme="dark"] .qp-bb { background: var(--qp-bar-bg); border-top-color: var(--qp-border); }
[data-bs-theme="dark"] .qp-stat.is-neutral .qp-stat-icon { background: var(--qp-bg-2); color: var(--qp-text-2); }
[data-bs-theme="dark"] .qp-empty > i, [data-bs-theme="dark"] table.dataTable td.dt-empty::before { color: var(--qp-muted-2); }
[data-bs-theme="dark"] table.dataTable td.dt-empty { box-shadow: none !important; }
[data-bs-theme="dark"] #qpSearchModal .qp-search-input { background-color: var(--qp-input-bg); color: var(--qp-text); }
[data-bs-theme="dark"] #qpSearchModal kbd { background: var(--qp-bg-2); border-color: var(--qp-border); color: var(--qp-text-2); }
[data-bs-theme="dark"] #main { scrollbar-color: var(--qp-border-strong) transparent; }
[data-bs-theme="dark"] #main::-webkit-scrollbar-thumb { background: var(--qp-border-strong); border-color: var(--qp-bg); }
[data-bs-theme="dark"] .test-block { background: var(--qp-bg-2) !important; border-color: var(--qp-border) !important; }
[data-bs-theme="dark"] .test-block[data-edit-url]:hover { background: var(--qp-fill) !important; }
[data-bs-theme="dark"] .section-header:hover { background: var(--qp-hover) !important; }
[data-bs-theme="dark"] .xc-item:hover, [data-bs-theme="dark"] .qp-attn .list-group-item { background-color: var(--qp-surface); }
[data-bs-theme="dark"] .xc-item:hover { background-color: var(--qp-hover); }
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
[data-bs-theme="dark"] img.pic-thumb, [data-bs-theme="dark"] .pic-thumb { border-color: var(--qp-border); }
/* static/theme.css (the look shared with the sibling apps, linked after this
   file) paints the page, card heads and outline buttons in its own light
   colours; light mode's softer whites win over it here, as dark mode's do. */
:root[data-bs-theme="light"] { --page: var(--qp-bg); --bs-body-bg: var(--qp-bg); }
[data-bs-theme="light"] .card-header { background: var(--qp-surface); }
[data-bs-theme="light"] :is(.btn-outline-primary, .btn-outline-secondary, .btn-outline-danger, .btn-outline-success,
  .btn-outline-warning, .btn-outline-info, .btn-outline-dark):not(:hover):not(.active):not(:active):not(.btn-check:checked + *) {
  background-color: var(--qp-surface); }
/* Light mode's softer white reaches the white written into templates too, and
   .bg-white; canvases (signatures, notes) and images keep their paper white. */
[data-bs-theme="light"] :not(canvas):not(img)[style*="background:#fff"], [data-bs-theme="light"] :not(canvas):not(img)[style*="background: #fff"],
[data-bs-theme="light"] :not(canvas):not(img)[style*="background-color:#fff"], [data-bs-theme="light"] :not(canvas):not(img)[style*="background-color: #fff"],
[data-bs-theme="light"] .bg-white { background-color: var(--qp-surface) !important; }
/* Inline white backgrounds left in templates become surface-coloured.
   Not canvases (signatures and notes are drawn in dark ink on white) nor
   images (stamp and certificate icons sit on a white chip on purpose). */
[data-bs-theme="dark"] :not(canvas):not(img)[style*="background:#fff"], [data-bs-theme="dark"] :not(canvas):not(img)[style*="background: #fff"],
[data-bs-theme="dark"] :not(canvas):not(img)[style*="background-color:#fff"], [data-bs-theme="dark"] :not(canvas):not(img)[style*="background-color: #fff"],
[data-bs-theme="dark"] .bg-white { background-color: var(--qp-surface) !important; }
/* …and the near-white tints used for sub-panels, table heads and average rows */
[data-bs-theme="dark"] [style*="background:#f8fafc"], [data-bs-theme="dark"] [style*="background: #f8fafc"],
[data-bs-theme="dark"] [style*="background:#f1f5f9"], [data-bs-theme="dark"] [style*="background: #f1f5f9"],
[data-bs-theme="dark"] [style*="background:#fafbfc"], [data-bs-theme="dark"] [style*="background: #fafbfc"] { background-color: var(--qp-bg-2) !important; }
[data-bs-theme="dark"] .filter-note .fn-crit { background: var(--qp-bg-2); border-color: var(--qp-border); }
[data-bs-theme="dark"] #nav-palette .pal-box { background: var(--qp-elevated); }
[data-bs-theme="dark"] #nav-palette .pal-input kbd { background: var(--qp-bg-2); border-color: var(--qp-border); color: var(--qp-text-2); }
/* Documents stay as they were made. Nothing here inverts, dims or tints a PDF,
   a photo, a signature or an upload (tests/test_theme.py holds to that). A PDF or
   a page shown in a frame keeps its own light canvas, and an upload with a
   transparent background keeps the white paper it was drawn for: without it,
   black ink on a transparent scan disappears into a dark page. */
object, embed, iframe { color-scheme: light; }
[data-bs-theme="dark"] img[src*="/uploads/"], [data-bs-theme="dark"] img[src^="blob:"], [data-bs-theme="dark"] img[src^="data:image"] { background-color: #fff; }
/* Signatures, stamps, logos and gauge photos are white-background images: keep them readable */
[data-bs-theme="dark"] img[src*="signatures/"], [data-bs-theme="dark"] img[src*="stamps/"], [data-bs-theme="dark"] img[src*="/logo/"] {
  background: #fff; border-radius: 6px; padding: 2px; }
/* ...except the logo copy made for dark backgrounds (logo_for_dark in app.py):
   it is transparent, and the white tile showed as a white box in the menu. */
[data-bs-theme="dark"] img.qp-logo-ondark { background: none; padding: 0; border-radius: 0; }

/* Large text: everything rem-based scales; fixed-height bars are clamped by base.html */
html[data-qp-text="large"] { font-size: 112.5%; }
html[data-qp-text="larger"] { font-size: 125%; }

/* Bold text (13 Nov 2026), chosen per device in the menu, as the iPhone's own
   Bold Text: every letter a little thicker, in proportion to its size, so
   headings stay heavier than body text and grey stays grey. Drawn as a thin
   outline in each letter's own colour rather than by changing the weight:
   letters keep their width, so no line wraps and no button row moves.
   The email signature's preview and editor show the email as sent; print is
   untouched. */
@media screen {
  html[data-qp-bold] body, html[data-qp-bold] body * { -webkit-text-stroke-width: .022em; }
  html[data-qp-bold] :is(.qp-sig-preview, .qp-sig-editor), html[data-qp-bold] :is(.qp-sig-preview, .qp-sig-editor) * { -webkit-text-stroke-width: 0; }
}

/* Dictation microphone next to textareas */
.qp-mic { border: 1px solid var(--qp-border-strong); background: var(--qp-surface); color: var(--qp-muted); border-radius: 999px; width: 24px; height: 24px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; padding: 0; vertical-align: middle; cursor: pointer; }
.qp-mic.qp-mic-inline { margin-left: .4rem; }
.qp-mic.qp-mic-after { margin-top: .3rem; }
.qp-mic:hover { color: var(--qp-primary); border-color: var(--qp-primary); }
.qp-mic.is-on { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; animation: qp-mic-pulse 1.2s ease-in-out infinite; }
@keyframes qp-mic-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.35); } 50% { box-shadow: 0 0 0 6px rgba(220,38,38,0); } }
/* The button that hides the menu (layout in qp-layout.css): on the menu's dark
   ground while the menu shows, on the page's bar once it is hidden. */
#qp-side-toggle { background: transparent; color: rgba(255, 255, 255, .62); }
#qp-side-toggle:hover { background: rgba(255, 255, 255, .08); color: #fff; }
html[data-qp-side="hidden"] #qp-side-toggle { color: var(--qp-muted); }
html[data-qp-side="hidden"] #qp-side-toggle:hover { background: var(--qp-hover); color: var(--qp-text); }

/* Label over a value in a report's details (layout in qp-layout.css). */
.qp-meta-label { color: var(--qp-muted); }

/* The section chips over a report (layout in qp-layout.css). In the page they
   sit on its own background; a white strip across the whole screen, halfway down
   between two cards, looked broken. Once stuck under the bar above, they take
   its colour and line, so what scrolls under them is hidden (.is-stuck, set by
   report_detail.html). */
.qp-jump { background: transparent; border-bottom: 1px solid transparent; transition: background-color .15s ease, border-color .15s ease; }
.qp-jump.is-stuck { background: var(--qp-bar-bg); border-bottom-color: var(--qp-border); }
.qp-jump-list .btn { --bs-btn-bg: var(--qp-surface); }
.qp-jump-list .btn[aria-current="true"] { background: var(--qp-action); border-color: var(--qp-action); color: var(--qp-on-action); }

/* A control that cannot be used yet looks like itself, dimmed: Bootstrap's own
   disabled colours are a brighter blue than any button here, hard to read in dark. */
.btn-primary { --bs-btn-disabled-bg: var(--qp-action); --bs-btn-disabled-border-color: var(--qp-action); --bs-btn-disabled-color: var(--qp-on-action); }
.btn-outline-primary { --bs-btn-disabled-color: var(--qp-primary); --bs-btn-disabled-border-color: var(--qp-primary); }

/* static/theme.css loads later and sets these for light mode: white on its bright
   green is 3.3:1, and so is its green text on white. */
:root[data-bs-theme="light"] .btn-success {
  --bs-btn-bg: #15803d; --bs-btn-border-color: #15803d; --bs-btn-hover-bg: #166534; --bs-btn-hover-border-color: #166534;
  --bs-btn-active-bg: #166534; --bs-btn-active-border-color: #166534; --bs-btn-disabled-bg: #15803d; --bs-btn-disabled-border-color: #15803d; }
:root[data-bs-theme="light"] .text-success { color: var(--qp-success) !important; }
:root[data-bs-theme="light"] { --bs-code-color: #b5286f; }
/* The menu is dark in both themes. */
html #sidebar .nav-kbd { color: rgba(255, 255, 255, .62); border-color: rgba(255, 255, 255, .18); }

/* "Needs your attention" (qp-notify.js): above the page, under its bars. */
#qp-alerts {
  position: fixed; z-index: 1045; right: 1rem; width: min(26rem, calc(100vw - 2rem));
  top: calc(env(safe-area-inset-top, 0px) + var(--topbar-h, 0px) + var(--sticky-h) + .5rem);
  display: flex; flex-direction: column; gap: .5rem;
}
#qp-alerts:empty { display: none; }
/* With a PDF or a dialog open she would hear it and see nothing, so it comes above.
   Down in the corner, where it stays off the dialog's own buttons. */
body.modal-open #qp-alerts {
  z-index: 1060; top: auto; right: auto; left: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}
.qp-alert {
  display: flex; align-items: flex-start; gap: .625rem; padding: .75rem;
  background: var(--qp-elevated); color: var(--qp-text-2);
  border: 1px solid var(--qp-border-strong); border-left: 4px solid var(--qp-warning);
  border-radius: var(--qp-radius-sm); box-shadow: var(--qp-shadow-lg);
}
.qp-alert-icon { color: var(--qp-warning); font-size: 1.15rem; line-height: 1.3; flex: none; }
.qp-alert-body { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.qp-alert-title { color: var(--qp-text); font-weight: 650; }
.qp-alert-text { margin: .125rem 0 .5rem; max-height: 6.5em; overflow: hidden; }
.qp-alert-close { flex: none; }

/* Status chips on list pages */
.status-chip { border-radius: 999px !important; }
.status-chip.active { background: var(--qp-action) !important; color: var(--qp-on-action) !important; border-color: var(--qp-action) !important; }
.status-chip.active .badge { background: rgba(15, 23, 42, .3) !important; color: var(--qp-on-action) !important; }
/* The status dot: the first thing in a chip, and not its count. "All" has no
   dot, so its count was the first element in it and was drawn as a 10 px dot
   with the number hanging out of it (28 November 2026). */
.status-chip .badge:first-child:not(.bg-secondary) { width: 10px; height: 10px; padding: 0; border-radius: 50%; display: inline-block; vertical-align: -1px; }
/* The dot is all that carries the status here, so it takes the strong colour,
   not the pale tint a badge has behind its words. */
.status-chip .badge-draft:first-child { background: var(--qp-muted-2) !important; }
.status-chip .badge-submitted:first-child { background: var(--qp-info) !important; }
.status-chip .badge-approved:first-child { background: var(--qp-success) !important; }
.status-chip .badge-rejected:first-child { background: var(--qp-danger) !important; }

/* Bootstrap 5 has no min-w-0 utility; flex children need it to truncate instead of overflowing */
.min-w-0 { min-width: 0 !important; }
.qp-stat > div { min-width: 0; flex: 1 1 auto; }
.xc-item > .min-w-0 { flex: 1 1 auto; }
.xc-item > .xc-when { flex: 0 0 auto; }

/* Dark mode: headings and inline dark-slate text colours left in templates (e.g. the dashboard greeting) */
[data-bs-theme="dark"] h1, [data-bs-theme="dark"] h2, [data-bs-theme="dark"] h3, [data-bs-theme="dark"] h4, [data-bs-theme="dark"] h5, [data-bs-theme="dark"] h6,
[data-bs-theme="dark"] .h1, [data-bs-theme="dark"] .h2, [data-bs-theme="dark"] .h3, [data-bs-theme="dark"] .h4, [data-bs-theme="dark"] .h5, [data-bs-theme="dark"] .h6 { color: var(--qp-text); }
[data-bs-theme="dark"] [style*="color:#1e293b"], [data-bs-theme="dark"] [style*="color: #1e293b"], [data-bs-theme="dark"] [style*="color:#0f172a"], [data-bs-theme="dark"] [style*="color: #0f172a"],
[data-bs-theme="dark"] [style*="color:#111827"], [data-bs-theme="dark"] [style*="color: #111827"] { color: var(--qp-text) !important; }
[data-bs-theme="dark"] [style*="color:#64748b"], [data-bs-theme="dark"] [style*="color: #64748b"], [data-bs-theme="dark"] [style*="color:#5c5b54"], [data-bs-theme="dark"] [style*="color: #5c5b54"] { color: var(--qp-muted) !important; }
[data-bs-theme="dark"] #main h1, [data-bs-theme="dark"] #main h2, [data-bs-theme="dark"] #main h3 { color: var(--qp-text) !important; }

/* ---------------------------------------------------------------------------
   Page-to-page feel on tablets (2026-10-27, "layer 1" of the iPad work)
   --------------------------------------------------------------------------- */

/* Cross-document view transitions: the content slides in instead of the page
   flashing white between two full loads. Safari 18.2+ / iPadOS 18.2+, Chrome
   126+; older browsers ignore the whole thing. The sidebar and the top bar
   are named so they stay put while only the page body moves. */

/* ─── Dark: the Claude Code app's colours ─────────────────────────────────────
   Since 12 November 2026 the only dark: the Dark button and Auto on a device in
   dark mode both set data-dark-style="code" (base.html, qp-base-appearance.js);
   the warm charcoal dark it was laid over is no longer chosen. Neutral near-black
   greys with no warmth (page #151515, panels #202020, sidebar #111, white at
   7 % / 15 % for hover and selected, text #f9f9f9 / #c2c2c2 / #959595). The
   app's blue stays the accent. Only the tokens change, plus the few dark rules
   above that carry a colour of their own (the warm charcoal bars and chips). */
html[data-bs-theme="dark"][data-dark-style="code"] {
  --ink: #f9f9f9; --ink-2: #c2c2c2; --muted: #959595; --faint: #8c8c8c;
  --line: #333333; --line-strong: #444444; --page: #151515;
  --primary-soft: #26303f; --primary-line: #4d6a9e;
  --qp-bg: #151515; --qp-bg-2: #292929; --qp-surface: #202020; --qp-border: #333333; --qp-border-strong: #444444;
  --qp-text: #f9f9f9; --qp-text-2: #c2c2c2; --qp-muted: #959595; --qp-muted-2: #8c8c8c;
  --qp-primary-soft: #232c3a;
  --qp-fill: #252525; --qp-elevated: #292929; --qp-separator: #2e2e2e; --qp-hover: rgba(255, 255, 255, .075);
  --qp-input-bg: #151515; --qp-input-border: #444444; --qp-placeholder: #959595;
  --qp-bar-bg: #151515;
  --qp-shadow-sm: 0 1px 2px rgba(0,0,0,.5); --qp-shadow-md: 0 4px 14px rgba(0,0,0,.6); --qp-shadow-lg: 0 18px 40px rgba(0,0,0,.7);
  --side-bg: #111111; --side-line: #262626; --side-hover: rgba(255, 255, 255, .075); --side-active: rgba(255, 255, 255, .15);
}
html[data-bs-theme="dark"][data-dark-style="code"] #sidebar { background: #111111; border-right-color: #262626; }
html[data-bs-theme="dark"][data-dark-style="code"] #topbar { border-bottom-color: #262626; }
html[data-bs-theme="dark"][data-dark-style="code"] .qp-prefs .btn { color: #959595; border-color: #333333; }
html[data-bs-theme="dark"][data-dark-style="code"] .qp-prefs .btn.active { background: #333333; color: #f9f9f9; border-color: #444444; }
html[data-bs-theme="dark"][data-dark-style="code"] .qp-prefs .btn:hover { color: #f9f9f9; background: #333333; }
html[data-bs-theme="dark"][data-dark-style="code"] #sidebar .nav-avatar { background: #292929; }

/* From one page to the next: one quick dissolve, nothing else.
   The browser's own crossfade blends the two pages (plus-lighter), so what is
   the same on both — the top bar, the bottom bar, the menu, the background —
   stays exactly where and as it is, and the content changes in place. It used
   to fade the old page out in 120ms and the new one in over 200ms, sliding it
   16px: half-way both were see-through, the background flashed between them,
   and the bars blinked and shifted on every tap. */
/* Only where a mouse drives the page. On touch (the iPhone and iPad apps,
   phones, tablets) WebKit's crossfade made a page change worse, as filmed on an
   iOS 27 simulator (2026-11-11): two white frames between the pages, then the
   old and new page ghosting over each other while the list was still being
   laid out, then the dark top bar washed out for about 0.2s. A touch screen
   now swaps straight to the new page. A view-transition-name on the menu also
   stopped the list inside it from scrolling by touch on iOS Safari. */
@media (hover: hover) and (pointer: fine) {
  @view-transition { navigation: auto; }
  #sidebar { view-transition-name: qp-sidebar; }
  .sticky-top-bar { view-transition-name: qp-topbar; }
}
/* A list that DataTables turns into its phone layout is not shown raw first:
   it was painted as a plain table, then rearranged into cards 100-150ms later.
   Until its script has run (it adds .dataTable) it keeps its space unseen, for
   1.2s at most in case the script never runs. Only these tables are set up on
   load; others on the same pages are never touched. */
@media (max-width: 991.98px) {
  :is(#reports-table, #jobs-table, #clients-table, #gauge-table, #gauges-table,
      #kit-table, #cert-table, #pcert-table, #painters-table, #exp-table,
      #notes-table, #va-table, #templates-table, #email-templates-table,
      #standards-table, #defects-table, #recent-table,
      #pending-table, #docs-table):not(.dataTable) {
    visibility: hidden;
    animation: qp-table-wait 0s linear 1.2s forwards !important;
  }
}
@keyframes qp-table-wait { to { visibility: visible; } }
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-group(*) { animation-duration: 180ms; animation-timing-function: ease-out; }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* Touch targets on tablets. Apple asks for 44pt; most buttons here were 29-31px.
   Phones keep the dense layout (the per-test mobile rules in base.html own it);
   this applies to coarse pointers at tablet width and up. The sidebar is left
   exactly as it is on purpose. */
@media (pointer: coarse) and (min-width: 768px) {
  body { font-size: .95rem; }
  .btn { min-height: 42px; padding-top: .5rem; padding-bottom: .5rem; }
  .btn-sm { min-height: 40px; font-size: .9rem; padding-left: .8rem; padding-right: .8rem; }
  .btn-group-sm > .btn, .btn-sm.py-0 { min-height: 40px; }
  .form-control, .form-select { min-height: 42px; font-size: 16px; }
  .form-control-sm, .form-select-sm { min-height: 40px; font-size: 16px; }
  .input-group-sm > .form-control, .input-group-sm > .form-select, .input-group-sm > .btn, .input-group-sm > .input-group-text { min-height: 40px; font-size: .95rem; }
  .form-check-input { width: 1.4em; height: 1.4em; margin-top: .1em; }
  .form-check-label { padding-left: .15rem; line-height: 1.6em; }
  .table > :not(caption) > * > * { padding-top: .7rem; padding-bottom: .7rem; }
  table.dataTable > tbody > tr > td, table.dataTable > thead > tr > th { padding-top: .7rem; padding-bottom: .7rem; }
  .dropdown-item, .page-link, .list-group-item-action { min-height: 44px; display: flex; align-items: center; }
  .nav-tabs .nav-link, .nav-pills .nav-link { min-height: 44px; display: inline-flex; align-items: center; }
  .status-chip { min-height: 40px; }
  .badge:is(a, button) { min-height: 36px; display: inline-flex; align-items: center; }
  small, .small, .text-muted.small { font-size: .86rem; }
  .form-label.small { font-size: .9rem; }
  /* Icon-only buttons in tables and the small square ones were 34x40 / 21x40 */
  .table .btn-sm, .btn-sm.py-0, .btn-sm.px-1 { min-width: 40px; }
  .page-link, .dt-paging .dt-paging-button { min-width: 44px !important; min-height: 44px; justify-content: center; }
  /* Picture reorder arrows (12x13) and the dictation microphones (24x24) */
  .move-btn { min-width: 36px; min-height: 36px; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; }
  .qp-mic, .qp-mic.qp-mic-inline { width: 36px; height: 36px; }
  .reading-delete-btn { width: 24px !important; height: 24px !important; font-size: 14px !important; line-height: 24px !important; top: -10px !important; right: -10px !important; }
}

/* The native apps' pre-cache progress bars (3px across the top) read as a
   slow page load. Hidden here; qp-base-sync-pill.js shows the progress as a
   pill above the bottom bar instead, only for crawls longer than two seconds. */
#proxy-cache-bar, #qp-cache-bar { display: none !important; }
#qp-sync-pill {
  position: fixed; right: 14px; bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); z-index: 1045;
  display: flex; align-items: center; gap: .45rem; padding: .45rem .8rem; border-radius: 999px;
  background: var(--qp-surface, #fff); color: var(--qp-text-2, #334155); border: 1px solid var(--qp-border, #e2e8f0);
  box-shadow: 0 6px 20px rgba(15, 23, 42, .12); font-size: .82rem; line-height: 1;
  opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .25s, transform .25s;
}
#qp-sync-pill i { color: var(--qp-primary, #2d62c9); font-size: 1rem; }
#qp-sync-pill.show { opacity: 1; transform: none; }
#qp-sync-pill.done i { color: var(--qp-success, #16a34a); }
body.has-qp-bb #qp-sync-pill { bottom: calc(env(safe-area-inset-bottom, 0px) + 72px); }

/* Page-level search bar (reports list). One obvious box at the top of a list
   page, sized for a thumb; it drives the DataTable's global search. */
.qp-searchbar { position: relative; }
.qp-searchbar .form-control {
  height: 48px; padding: .6rem 2.8rem .6rem 2.9rem; font-size: 16px; border-radius: 14px;
  background: var(--qp-surface, #fff); border: 1px solid var(--qp-border, #e2e8f0);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.qp-searchbar .form-control:focus { border-color: var(--qp-primary, #2d62c9); box-shadow: 0 0 0 .2rem rgba(45, 98, 201, .15); }
.qp-searchbar .form-control::-webkit-search-cancel-button { -webkit-appearance: none; }
.qp-searchbar-icon { position: absolute; left: 1.05rem; top: 50%; transform: translateY(-50%); color: var(--qp-muted, #64748b); font-size: 1.05rem; pointer-events: none; }
.qp-searchbar-clear { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: transparent; color: var(--qp-muted, #94a3b8); font-size: 1.15rem; border-radius: 50%; }
.qp-searchbar-clear:active { background: var(--qp-bg, #f1f5f9); }
@media (min-width: 992px) { .qp-searchbar { max-width: 720px; } }

/* --------------------------------------------------------------------------
   Touch gestures (static/js/qp-gestures.js): the chevron that follows a swipe
   in from the left edge, and the arrow that comes down on a pull-to-refresh.
   Both turn blue once letting go would act.
   -------------------------------------------------------------------------- */
.qp-swipe-back, .qp-pull-refresh {
  position: fixed; z-index: 1090; width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; pointer-events: none;
  background: var(--qp-surface); color: var(--qp-muted); border: 1px solid var(--qp-border);
  box-shadow: var(--qp-shadow-md); font-size: 1.2rem; opacity: 0;
  transition: transform .2s ease, opacity .2s ease, background-color .15s, color .15s;
}
.qp-swipe-back { left: 0; transform: translateX(-44px); }
/* Under the page bar (1020), so it slides out from beneath it. */
.qp-pull-refresh { left: 50%; transform: translate(-50%, -44px); z-index: 1015; }
.qp-swipe-back.is-ready, .qp-pull-refresh.is-ready, .qp-pull-refresh.is-loading {
  background: var(--qp-primary); border-color: var(--qp-primary); color: #fff;
}
/* While the finger is down the indicator tracks it exactly; the transition
   is only for springing back or settling into place. */
.qp-pull-refresh.is-pulling:not(.is-loading) { transition: background-color .15s, color .15s; }
.qp-swipe-back.is-tracking { transition: background-color .15s, color .15s; }
.qp-pull-refresh.is-loading { opacity: 1; }
.qp-pull-refresh.is-loading i { animation: qp-spin .8s linear infinite; }
@keyframes qp-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .qp-pull-refresh.is-loading i { animation: none; } }

/* --------------------------------------------------------------------------
   Unsaved edits (qp-bottom-bar.js): an amber dot on Save — in the bottom bar
   and on the page's own Save at the top — until the edits are saved.
   -------------------------------------------------------------------------- */
.qp-bb-btn.qp-dirty .qp-bb-ico::after,
.sticky-top-bar .btn.qp-dirty::after {
  content: ''; position: absolute; width: 9px; height: 9px; border-radius: 50%;
  background: #f59e0b; box-shadow: 0 0 0 2px var(--qp-surface);
}
.qp-bb-btn.qp-dirty .qp-bb-ico::after { top: 0; right: 10px; }
.sticky-top-bar .btn.qp-dirty { position: relative; }
.sticky-top-bar .btn.qp-dirty::after { top: -3px; right: -3px; }
@media (prefers-reduced-motion: no-preference) {
  .qp-bb-btn.qp-saved .qp-bb-ico { animation: qp-saved-pop .35s ease; }
  @keyframes qp-saved-pop { 50% { transform: scale(1.15); } }
}
[data-bs-theme="dark"] .qp-bb-btn { color: var(--qp-muted); }
[data-bs-theme="dark"] .qp-bb-btn:active .qp-bb-ico { background: var(--qp-hover); }
[data-bs-theme="dark"] .qp-bb-btn[aria-current="page"],
[data-bs-theme="dark"] .qp-bb-btn[data-qp-bb="save"] { color: var(--qp-primary); }
[data-bs-theme="dark"] .qp-bb-btn.qp-saved { color: var(--qp-success); }

/* More sheet: the edit bar's overflow, as a sheet from the bottom. */
.qp-more.offcanvas-bottom { height: auto; max-height: 75vh; border-radius: 16px 16px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--qp-surface); }
.qp-more-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--qp-border-strong); margin: .5rem auto 0; }
.qp-more .qp-more-row { display: flex; align-items: center; gap: .9rem; min-height: 52px; font-size: .95rem;
  border: 0; border-radius: 10px; padding: .5rem .75rem; color: var(--qp-text); background: transparent; }
.qp-more .qp-more-row i { font-size: 1.25rem; color: var(--qp-muted); width: 1.5rem; text-align: center; }
@media (min-width: 576px) { .qp-more.offcanvas-bottom { max-width: 480px; margin: 0 auto; } }

/* --------------------------------------------------------------------------
   Menu drawer on phones and iPads: quick actions under the search box, and
   rows tall enough to hit with a thumb (44px, Apple's minimum).
   -------------------------------------------------------------------------- */
/* minmax(0, 1fr): four equal columns whatever the label. With plain 1fr a
   column grew to fit its label, and at Larger text "Gauges" stuck 10px out of
   the drawer (and peeked in at the screen edge with the drawer closed). */
#sidebar .nav-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem; padding: .25rem .75rem .6rem; }
/* Large / Larger text: two by two, so every label keeps its words whole. */
:root[data-qp-text] #sidebar .nav-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
:root[data-qp-text] #sidebar .nav-quick-btn { flex-direction: row; min-height: 48px; gap: .45rem; }
#sidebar .nav-quick-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem;
  min-height: 60px; padding: .45rem .2rem; border-radius: 10px; text-decoration: none;
  background: rgba(255,255,255,.06); color: #cbd5e1; font-size: .7rem; font-weight: 600; text-align: center; line-height: 1.15;
  -webkit-tap-highlight-color: transparent; min-width: 0;
}
#sidebar .nav-quick-btn i { font-size: 1.15rem; color: #94a3b8; }
#sidebar .nav-quick-btn:active { background: rgba(255,255,255,.12); }
#sidebar .nav-quick-btn.is-primary { background: #3567d0; color: #fff; }
#sidebar .nav-quick-btn.is-primary i { color: #fff; }
@media (max-width: 991.98px) {
  #sidebar .section-label { min-height: 44px; }
  #sidebar .nav-link.sub { min-height: 44px; display: flex; align-items: center; }
  /* Followed with the finger while swiping it shut (qp-gestures.js). */
  #sidebar.is-dragging { transition: none; }
}
/* The bottom bar's own box has no background (qp-menu.css): it floats, and only
   its pill and the round Menu are drawn. A dark-mode rule here from the old
   full-width bar outranked that and painted a band across the screen behind
   them, hiding the page on either side. */

/* × to clear a date / time field on iPhone and iPad (qp-base-mobile.js) */
.qp-date-wrap { position: relative; display: inline-block; vertical-align: middle; max-width: 100%; }
.qp-date-wrap:has(> .form-control) { display: block; }
.qp-date-wrap > input { padding-right: 2.4rem; }
.qp-date-wrap > .qp-date-x {
  position: absolute; top: 0; right: 0; bottom: 0; width: 2.4rem;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--bs-secondary-color, #6c757d);
  font-size: .85rem; padding: 0;
}
.qp-date-wrap.is-sm > .qp-date-x { width: 2rem; font-size: .75rem; }
.qp-date-wrap.is-sm > input { padding-right: 2rem; }
.qp-date-x:active { color: var(--bs-danger, #dc3545); }

/* Pass / fail / warning tints in dark mode. Test pages colour readings with
   light-only fills (.reading-pass / .reading-fail, .bg-success-subtle, and
   inline #dcfce7 / #fee2e2 / #fef3c7 set from scripts). Under dark mode the
   field text is light, so a reading on #dcfce7 could hardly be read. These
   keep the meaning with dark-friendly fills. Inline styles set from JS are
   stored as rgb(), so both spellings are matched. */
[data-bs-theme="dark"] .reading-pass,
[data-bs-theme="dark"] .bg-success-subtle,
[data-bs-theme="dark"] [style*="#dcfce7"], [data-bs-theme="dark"] [style*="rgb(220, 252, 231)"],
[data-bs-theme="dark"] [style*="#d1e7dd"], [data-bs-theme="dark"] [style*="rgb(209, 231, 221)"],
[data-bs-theme="dark"] [style*="#ecfdf5"], [data-bs-theme="dark"] [style*="rgb(236, 253, 245)"] {
  background-color: rgba(34, 197, 94, .2) !important; color: var(--qp-text) !important;
}
[data-bs-theme="dark"] .reading-fail,
[data-bs-theme="dark"] .bg-danger-subtle,
[data-bs-theme="dark"] [style*="#fee2e2"], [data-bs-theme="dark"] [style*="rgb(254, 226, 226)"],
[data-bs-theme="dark"] [style*="#fef2f2"], [data-bs-theme="dark"] [style*="rgb(254, 242, 242)"] {
  background-color: rgba(239, 68, 68, .22) !important; color: var(--qp-text) !important;
}
[data-bs-theme="dark"] .bg-warning-subtle,
[data-bs-theme="dark"] [style*="#fef3c7"], [data-bs-theme="dark"] [style*="rgb(254, 243, 199)"],
[data-bs-theme="dark"] [style*="#fffbeb"], [data-bs-theme="dark"] [style*="rgb(255, 251, 235)"] {
  background-color: rgba(245, 158, 11, .22) !important; color: var(--qp-text) !important;
}

/* User menu (sidebar foot): exactly as wide as the user button it opens from,
   so it stays inside the sidebar, and every row starts at the same place
   (Edit Profile, the Appearance row and Logout used to start at three
   different places, with the menu sticking out over the page). */
#sidebar .nav-foot .dropdown-menu {
  min-width: 0; width: calc(100% - 1rem); padding: .3rem 0;
  font-size: .84rem;
}
/* Placed by CSS, not Popper (data-bs-display="static"): opened from the
   slide-in drawer, Popper measured the drawer mid-slide and left the menu
   beside it, over the page and partly off-screen. */
#sidebar .nav-foot .dropup { position: relative; }
#sidebar .nav-foot .dropdown-menu[data-bs-popper] {
  left: .5rem; right: auto; top: auto; bottom: calc(100% + 4px); margin: 0;
}
#sidebar .nav-foot .dropdown-item,
#sidebar .nav-foot .qp-prefs-row { padding: .45rem .6rem; }
#sidebar .nav-foot .dropdown-item i { display: inline-block; width: 1.4rem; margin-right: .35rem !important; text-align: center; }
#sidebar .nav-foot .qp-prefs-row { padding-top: .2rem; padding-bottom: .3rem; }
#sidebar .nav-foot .qp-prefs-label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--bs-secondary-color, #64748b); }
#sidebar .nav-foot .dropdown-divider { margin: .3rem 0; }


/* A gallery's two add tiles, Add (this device) and Phone (by its QR code),
   each an icon and its word (27 Nov 2026: the camera one had none). Where
   they sit, under the photos: qp-layout.css; a report section's: qp-sections.css. */
.camera-upload-btn.qp-pic-add {
  display: inline-flex; flex-direction: row; align-items: center; justify-content: center; gap: .4rem;
  width: auto; min-width: 7rem; height: 2.75rem; padding: 0 .9rem; margin: 0; align-self: flex-start;
  border: 1.5px dashed var(--qp-border-strong); border-radius: 10px;
  color: var(--qp-muted); font-size: 1.1rem; line-height: 1; cursor: pointer; flex-shrink: 0;
}
.camera-upload-btn.qp-pic-add > span { font-size: .8rem; font-weight: 600; }

/* The camera / phone upload tiles. The phone one is a <button>, so it took
   the browser's grey button fill and its "Phone" label all but vanished. */
button.camera-upload-btn { background: transparent; color: inherit; }
[data-bs-theme="dark"] .camera-upload-btn, [data-bs-theme="dark"] .cleanliness-upload-btn { color: #aeaba1; border-color: #5c5b54; }

/* Light-only fills the dark theme missed, found by a contrast scan of every
   page. Inline styles first (dark text tokens sit on these, so the text went
   invisible), then the page stylesheets' hover and state fills. */
[data-bs-theme="dark"] [style*="#fefce8"] { background-color: rgba(245, 158, 11, .14) !important; }
[data-bs-theme="dark"] [style*="#eff6ff"], [data-bs-theme="dark"] [style*="#eef2ff"],
[data-bs-theme="dark"] [style*="#e7f1ff"] { background-color: rgba(59, 130, 246, .16) !important; }
[data-bs-theme="dark"] [style*="#fecaca"] { background-color: rgba(239, 68, 68, .28) !important; }
[data-bs-theme="dark"] [style*="background:#e2e8f0"], [data-bs-theme="dark"] [style*="background: #e2e8f0"],
[data-bs-theme="dark"] [style*="background:#e9ecef"], [data-bs-theme="dark"] [style*="background: #e9ecef"],
[data-bs-theme="dark"] [style*="background-color:#e9ecef"], [data-bs-theme="dark"] [style*="background-color: #e9ecef"] { background-color: var(--qp-bg-2) !important; }

[data-bs-theme="dark"] .camera-upload-btn:hover, [data-bs-theme="dark"] .cleanliness-upload-btn:hover,
[data-bs-theme="dark"] .imp-dropzone.dragover, [data-bs-theme="dark"] .cert-dropzone.dragover,
[data-bs-theme="dark"] .drawing-drop:hover, [data-bs-theme="dark"] .batch-item:hover,
[data-bs-theme="dark"] .failure-desc-display:hover, [data-bs-theme="dark"] .reading-value-display:hover,
[data-bs-theme="dark"] .test-block[data-edit-url]:hover, [data-bs-theme="dark"] .cert-icon-add:hover,
[data-bs-theme="dark"] .r3d-photo, [data-bs-theme="dark"] .api-doc pre,
[data-bs-theme="dark"] #signatures-table > thead > tr > th { background: var(--qp-bg-2) !important; }
[data-bs-theme="dark"] .hdg-defect-card.is-no, [data-bs-theme="dark"] .pvi-defect-card.is-no,
[data-bs-theme="dark"] .imp-dropzone.chosen { background: rgba(34, 197, 94, .14) !important; }
[data-bs-theme="dark"] .pfp-calc.chk-fail, [data-bs-theme="dark"] .pfp-table .form-control.chk-fail { background: rgba(239, 68, 68, .28) !important; color: var(--qp-text) !important; }
[data-bs-theme="dark"] .pfp-table tr.new-row { background: var(--qp-warning-soft) !important; }
[data-bs-theme="dark"] .pfp-table tr.new-row > td { background: transparent !important; }
[data-bs-theme="dark"] .r3d-metric-2d, [data-bs-theme="dark"] .metric-2d { background: rgba(99, 102, 241, .2) !important; color: var(--qp-text) !important; }
[data-bs-theme="dark"] .r3d-metric-3d, [data-bs-theme="dark"] .metric-3d { background: rgba(6, 182, 212, .18) !important; color: var(--qp-text) !important; }
[data-bs-theme="dark"] .xc-item.k-cert .xc-icon { background: rgba(139, 92, 246, .22) !important; }
[data-bs-theme="dark"] .xc-item.k-gauge .xc-icon { background: rgba(14, 165, 233, .22) !important; }
[data-bs-theme="dark"] #nav-palette .pal-row.on { background: rgba(59, 130, 246, .22) !important; }
[data-bs-theme="dark"] [style*="#bbf7d0"] { background-color: rgba(34, 197, 94, .24) !important; color: var(--qp-text) !important; }
[data-bs-theme="dark"] [style*="#fecaca"] { color: var(--qp-text) !important; }

/* Selected pills, tabs and toggle buttons: in dark mode they filled with the
   light dark-mode blue (#6f9bf0) under white text, 2.8:1. The deeper blue the
   dark buttons use reads at 5:1+. */
[data-bs-theme="dark"] .nav-pills .nav-link.active,
[data-bs-theme="dark"] .btn-outline-primary.active, [data-bs-theme="dark"] .btn-outline-secondary.active:not([data-val]),
[data-bs-theme="dark"] .btn-check:checked + .btn-outline-primary, [data-bs-theme="dark"] .btn-check:checked + .btn-outline-secondary {
  background-color: #3567d0 !important; border-color: #3567d0 !important; color: #fff !important;
}

/* Sidebar section headings (REPORTS, MANAGEMENT...): #64748b on the dark
   sidebar was 3.7:1, too dim to scan. The sidebar is dark in both themes. */
/* html prefix: static/theme.css is linked after this file and its equal
   #sidebar .section-label rule won, so the first version never applied. */
html #sidebar .section-label { color: #8d99ad; }
html[data-bs-theme="dark"] #sidebar .section-label { color: #a8a59c; }

/* Plain links kept the light theme's #2563eb, 3:1 on dark cards; the dark
   primary reads at 6:1. Links with their own colour class are left alone. */
[data-bs-theme="dark"] a:not(.btn):not(.nav-link):not(.dropdown-item):not(.badge):not(.nav-quick-btn):not(.list-group-item):not([class*="text-"]):not(.page-link) { color: var(--qp-primary); }
[data-bs-theme="dark"] a:not(.btn):not(.nav-link):not(.dropdown-item):not(.badge):not(.nav-quick-btn):not(.list-group-item):not([class*="text-"]):not(.page-link):hover { color: var(--qp-primary-600); }
/* White on the bright green was 3.3:1. */
[data-bs-theme="dark"] .btn-success { background-color: #18794e; border-color: #18794e; color: #fff; }
[data-bs-theme="dark"] .btn-success:hover, [data-bs-theme="dark"] .btn-success:focus { background-color: #1d8f5c; border-color: #1d8f5c; color: #fff; }

/* Status-coloured text and outline buttons kept the light theme's deep
   reds/ambers/greens (2.6:1 on the dark page): the lighter dark-mode ones. */
[data-bs-theme="dark"] .text-danger { color: #f87171 !important; }
[data-bs-theme="dark"] .text-warning { color: #fbbf24 !important; }
[data-bs-theme="dark"] .text-success { color: #4ade80 !important; }
[data-bs-theme="dark"] .text-info { color: #7eb2f7 !important; }
[data-bs-theme="dark"] .btn-outline-warning { color: #fbbf24; border-color: rgba(251, 191, 36, .55); }
[data-bs-theme="dark"] .btn-outline-danger { color: #f87171; border-color: rgba(248, 113, 113, .55); }
[data-bs-theme="dark"] .btn-outline-success { color: #4ade80; border-color: rgba(74, 222, 128, .5); }
[data-bs-theme="dark"] .btn-outline-info { color: #7eb2f7; border-color: rgba(126, 178, 247, .55); }
[data-bs-theme="dark"] .btn-outline-warning:hover { background: #b45309; border-color: #b45309; color: #fff; }
[data-bs-theme="dark"] .btn-outline-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
[data-bs-theme="dark"] .btn-outline-success:hover { background: #18794e; border-color: #18794e; color: #fff; }

/* Report page (report_detail.html): how far a report being written has got,
   and the line its empty sections fold into. */
.qp-progress-line { display: flex; align-items: center; gap: .9rem; margin: 0 0 1rem; }
.qp-progress-text { font-size: .86rem; color: var(--qp-text-2); white-space: nowrap; }
.qp-progress-text b { color: var(--qp-text); }
.qp-progress-bar { flex: 1 1 auto; height: 6px; border-radius: 999px; background: var(--qp-border); overflow: hidden; }
.qp-progress-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--qp-primary); }
.qp-empty-sections {
  display: flex; align-items: center; gap: .75rem; margin: 0 0 1rem; padding: .75rem 1rem;
  border: 1px dashed var(--qp-border-strong); border-radius: var(--qp-radius); color: var(--qp-text-2);
}
.qp-empty-sections > i { font-size: 1.2rem; color: var(--qp-muted); }
.qp-empty-sections > div { flex: 1 1 auto; min-width: 0; }
.qp-empty-sections .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qp-empty-sections .btn { flex: none; }

/* Lists on a phone (qp-lists.js): the list and Show more, no page-size box
   or pager. */
@media (max-width: 767.98px) {
  .qp-phone-list .dt-length, .qp-phone-list .dt-paging,
  .qp-phone-list .dataTables_length, .qp-phone-list .dataTables_paginate { display: none !important; }
  .qp-show-more { margin-top: .75rem; min-height: 44px; }
}

/* Reports list: the filters wait behind a button on a phone. */
.qp-filters-toggle { display: none; }
@media (max-width: 767.98px) {
  .qp-filters-toggle { display: inline-flex; align-items: center; }
  .qp-filters-card:not(.is-open) { display: none; }
}

/* Sub-reports folded under their main report (static/js/qp-sub-fold.js): the
   control on the main report's row, and the rows it shows under it. The
   control is the "+2 sub" mark made into something to press. It sits under
   the report's number, not beside it: the number's cell never wraps, and
   beside it the control made that column 67 px wider, enough for an iPad on
   its side to lose the row's View, PDF and Edit to the details. */
.qp-sub-toggle {
  display: flex; align-items: center; gap: .25rem; width: max-content; margin: .3rem 0 0; padding: .12rem .5rem .12rem .35rem;
  border: 1px solid var(--qp-border-strong); border-radius: 999px; background: var(--qp-fill); color: var(--qp-text);
  font-size: .72rem; font-weight: 600; line-height: 1.35; white-space: nowrap; cursor: pointer;
}
.qp-sub-toggle:hover { border-color: var(--qp-primary); }
.qp-sub-toggle .bi { font-size: .68rem; transition: transform .15s ease; }
.qp-sub-toggle[aria-expanded="true"] .bi { transform: rotate(90deg); }
@media (pointer: coarse) { .qp-sub-toggle { min-height: 2rem; padding: .32rem .7rem .32rem .5rem; font-size: .76rem; } }
/* Under its main report: set in, on a quieter ground; the arrow before its
   number says what it is, so its "sub-report" mark is not said twice. */
table.dataTable > tbody > tr.qp-sub-under > td { background: var(--qp-fill); box-shadow: none; }
table.dataTable > tbody > tr.qp-sub-under > td:first-child { padding-left: 1.75rem; }
tr.qp-sub-under .qp-sub-mark { display: none; }

/* Reports list on a phone: each report a card, number and status on top, the
   title under them, then the job and the last change. The expand arrow stays
   for the rest (client, inspector, View and Edit). */
@media (max-width: 575.98px) {
  #reports-table { border-collapse: separate; border-spacing: 0; }
  /* DataTables gives the table a width of its own, so the cards stopped about
     a third short of the screen's edge; they take the row's, as on Jobs. */
  #reports-table, #reports-table > tbody { display: block; width: 100% !important; }
  #reports-table thead { display: none; }
  #reports-table > tbody > tr.qp-report-row {
    display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .2rem .75rem;
    margin-bottom: .55rem; padding: .7rem .85rem; border: 1px solid var(--qp-border);
    border-radius: 12px; background: var(--qp-surface);
  }
  #reports-table > tbody > tr.qp-report-row > td:not(.dtr-hidden) { display: block; border: 0; padding: 0; background: none; box-shadow: none; }
  #reports-table > tbody > tr.qp-report-row > td:first-child { grid-column: 1; grid-row: 1; font-weight: 700; }
  #reports-table > tbody > tr.qp-report-row > td.col-title { grid-column: 1 / -1; grid-row: 2; color: var(--qp-text); }
  #reports-table > tbody > tr.qp-report-row > td:nth-child(6) { grid-column: 2; grid-row: 1; }
  #reports-table > tbody > tr.qp-report-row::after {
    content: attr(data-job) "  ·  " attr(data-updated); grid-column: 1; grid-row: 3;
    font-size: .78rem; color: var(--qp-muted);
  }
  /* The job is in the line above; View, PDF and Edit sit at the bottom right. */
  #reports-table > tbody > tr.qp-report-row > td:nth-child(3) { display: none !important; }
  #reports-table > tbody > tr.qp-report-row > td.col-actions { grid-column: 2; grid-row: 3; justify-self: end; }
  #reports-table > tbody > tr.child { display: block; margin: -.4rem 0 .55rem; }
  #reports-table > tbody > tr.child > td { display: block; border: 0; }
  /* A sub-report's card sits in from its main report's, and close under it. */
  #reports-table > tbody > tr.qp-report-row.qp-sub-under { margin-left: 1.1rem !important; margin-top: -.25rem; }
  #reports-table > tbody > tr.qp-report-row.qp-sub-under > td:first-child { padding-left: 0; }
  #reports-table > tbody > tr.child.qp-sub-under { margin-left: 1.1rem; }
}

/* Jobs list on a phone: each job a card, number and status on top, the name
   under them across the whole width, then client and location with the
   report count and the buttons. As a table its name column was squeezed to a
   word a line, and the buttons ran past the card's edge. */
@media (max-width: 575.98px) {
  #jobs-table { border-collapse: separate; border-spacing: 0; }
  /* DataTables gives the table a width of its own; the cards take the row's. */
  #jobs-table, #jobs-table > tbody { display: block; width: 100% !important; }
  #jobs-table thead { display: none; }
  #jobs-table > tbody > tr.qp-job-row {
    display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: .25rem .6rem;
    margin-bottom: .55rem; padding: .7rem .85rem; border: 1px solid var(--qp-border);
    border-radius: 12px; background: var(--qp-surface);
  }
  #jobs-table > tbody > tr.qp-job-row > td { display: block; border: 0; padding: 0; background: none; box-shadow: none; }
  #jobs-table > tbody > tr.qp-job-row > td:first-child { grid-column: 1; grid-row: 1; }
  #jobs-table > tbody > tr.qp-job-row > td.col-status { grid-column: 2 / -1; grid-row: 1; justify-self: end; }
  #jobs-table > tbody > tr.qp-job-row > td.col-name { grid-column: 1 / -1; grid-row: 2; color: var(--qp-text); overflow-wrap: anywhere; }
  #jobs-table > tbody > tr.qp-job-row > td.col-client,
  #jobs-table > tbody > tr.qp-job-row > td.col-location { display: none; }
  #jobs-table > tbody > tr.qp-job-row::after {
    content: attr(data-sub); grid-column: 1; grid-row: 3; min-width: 0;
    font-size: .78rem; color: var(--qp-muted); overflow-wrap: anywhere;
  }
  #jobs-table > tbody > tr.qp-job-row > td.col-reports { grid-column: 2; grid-row: 3; }
  #jobs-table > tbody > tr.qp-job-row > td.col-actions { grid-column: 3; grid-row: 3; justify-self: end; }
}

/* Wider than a phone, the jobs list stays a table; its name keeps room to be
   read, and location and client fold away behind the arrow first. */
@media (min-width: 576px) {
  #jobs-table td.col-name { min-width: 12rem; }
}

/* The ⓘ beside a trade term in a form label (qp-glossary.js). */
.qp-term {
  border: 0; background: none; padding: 0 .25rem; margin-left: .1rem; line-height: 1;
  color: var(--qp-muted); font-size: .85em; vertical-align: baseline; cursor: help;
}
.qp-term:hover, .qp-term:focus-visible { color: var(--qp-primary); }

/* Certificates check (certificates_check.html). */
.qp-cc-req { display: block; line-height: 1.5; }
.qp-cc-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .35rem; vertical-align: .05em; background: var(--qp-muted); }
.qp-cc-dot.is-success { background: var(--qp-success); }
.qp-cc-dot.is-warning { background: var(--qp-warning); }
.qp-cc-dot.is-danger { background: var(--qp-danger); }
.qp-cc-src { margin-left: .35rem; padding: 0 .4rem; border-radius: 999px; font-size: .7rem; background: var(--qp-fill); border: 1px solid var(--qp-border); color: var(--qp-text-2); white-space: nowrap; }
.qp-cc-person .min-w-0 { min-width: 0; }
.qp-cc-person .flex-none { flex: none; }

/* Email addresses as pills (qp-email-pills.js): each one rounded, with its ×. */
.qp-email-pills .ts-control { flex-wrap: wrap; gap: .25rem; padding: .3rem .4rem !important; min-height: 2.4rem; }
.qp-email-pills .ts-control > .item {
  display: inline-flex; align-items: center; margin: 0 !important; padding: .1rem .15rem .1rem .6rem !important;
  border-radius: 999px !important; border: 1px solid var(--qp-border) !important;
  background: var(--qp-primary-soft) !important; color: var(--qp-text) !important; font-size: .85rem; line-height: 1.5;
}
.qp-email-pills .ts-control > .item .remove {
  border: 0 !important; margin-left: .2rem; padding: 0 .4rem !important; border-radius: 999px; color: var(--qp-muted) !important;
}
.qp-email-pills .ts-control > .item .remove:hover { background: var(--qp-hover) !important; color: var(--qp-danger) !important; }
.qp-email-pills.is-invalid .ts-control { border-color: var(--qp-danger) !important; }

/* Sent to the client (report page) and the Sent mark in the reports list. */
.qp-sent-icon { font-size: 1.15rem; color: var(--qp-success); }
.qp-sent .min-w-0 { min-width: 0; }
.qp-sent details summary { cursor: pointer; }
/* What the card says keeps a readable width; on a phone the buttons go under it. */
.qp-sent-what { flex: 1 1 14rem; min-width: 0; }
.qp-sent-mark { color: var(--qp-success); font-size: .78rem; white-space: nowrap; }
@media (max-width: 575.98px) { .qp-sent-mark .qp-sent-text { display: none; } }

/* A list's status column: the badge in the middle, under its heading. A short
   badge at the left of a wide column looked lost, and badges of different
   lengths left a ragged edge. "Sent" goes under the badge, centred with it, on a
   phone just its icon beside it. The heading's sort arrow is balanced by the
   same room on the left, so the word sits over the badges. */
.table th.col-status, .table td.col-status { text-align: center; }
table.dataTable thead th.col-status .dt-column-title { padding-left: 16px; }
table.dataTable thead th.col-status.dt-orderable-none .dt-column-title { padding-left: 0; }
.table td.col-status .qp-sent-mark { display: block; margin-top: .2rem; }
@media (max-width: 575.98px) { .table td.col-status .qp-sent-mark { display: inline; margin: 0 0 0 .25rem; } }

/* The email signature box on the profile (paste from Outlook). It shows the
   signature as it will look in the email: on white, whatever the theme. */
.qp-sig-editor { min-height: 7rem; height: auto; overflow: auto; background: #fff; color: #222; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 11pt; }
.qp-sig-editor:empty::before { content: attr(data-placeholder); white-space: pre-line; color: #9aa3ae; }
.qp-sig-editor img { cursor: pointer; max-width: 100%; }
.qp-sig-editor img.is-picked { outline: 3px solid var(--qp-primary); outline-offset: 2px; }
.qp-sig-editor img[data-missing] { background: #eef1f5; outline: 1px dashed #9aa3ae; }
.qp-sig-preview { background: #fff; color: #222; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 11pt; border: 1px solid var(--qp-border); border-radius: var(--qp-radius-sm); padding: .6rem .75rem; overflow: auto; }
/* An email as the client will read it (Preview, qp-email-preview.js): on
   white in either look, as the signature above, since it is what they get. */
.qp-email-preview { background: #fff; color: #222; border: 1px solid var(--qp-border); border-radius: var(--qp-radius-sm); height: 24rem; overflow: hidden; }
.qp-email-preview.is-tall { height: 30rem; }
.qp-email-preview > p { padding: .75rem .9rem; }
.qp-email-preview > iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }

/* The phone's top bar (27 November 2026): Menu and Search were 22 and 18 px
   targets, hard to hit with a glove. The same icons in the same place, with
   44 px to press: the padding is taken back by the margin, so nothing moves. */
#topbar #sidebar-toggle { padding: 11px; margin: -11px; }
#topbar #topbar-search { padding: 13px; margin: -13px; }

/* ---- Fingers and tidy edges (28 November 2026) ------------------------------
   From measuring all 61 menu pages at phone and iPad width (nothing ran off
   the screen on any). What a finger could not hit well gets 40 px to press,
   without anything moving where the size is taken back by a margin or added
   as an unseen area round the button. */
@media (pointer: coarse) {
  /* The logo that takes you Home: 22 px tall on every page. */
  #topbar .topbar-brand { padding-block: 11px; margin-block: -11px; }
  /* Back and the other icon-only buttons in a page's bar: 31 px wide. More to
     press on each side, as an unseen area (.btn-sm already has one above and
     below, qp-motion.css). Not a wider button: at 40 px each, a report's
     number and its Draft pill no longer fitted on one line on an iPhone
     (28 November 2026, put right the same day). */
  .sticky-top-bar .btn-sm:not(.position-static)::before { left: -4px; right: -4px; }
  /* The small helpers beside a field or a row: the microphone (24 px), the
     glossary's "?" (20 x 13), a folded row's arrow (19 x 13). The same size
     to look at, 10 px more to press on every side. */
  :is(.qp-mic, .qp-term, .resp-btn) { position: relative; }
  :is(.qp-mic, .qp-term, .resp-btn)::after { content: ""; position: absolute; inset: -10px; }
  /* A list's search box and its "entries per page": 13 px letters. */
  div.dt-container .dt-search input, div.dt-container .dt-length select { font-size: 16px; min-height: 40px; }
}
@media (pointer: coarse) and (max-width: 767.98px) {
  /* A report's row on a phone, the blasting library's rows and a DFT spot's
     row: View, PDF, Edit and Delete were 28 to 37 px wide. */
  .qp-report-row .btn, .kb-head .btn, tr.spot-row .btn {
    min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center;
  }
}
/* A report's number in a table stays on one line on every screen: on a job's
   page at iPad width all 25 broke at their hyphens ("QP-2026-" over "0249"). */
td.dtr-control > a.fw-semibold, td > a.text-inherit.fw-semibold { white-space: nowrap; }

/* ---- A test's own page on a phone (28 November 2026) --------------------------
   Its fields were 31 px tall with 14 px letters: tight for a gloved finger and
   small to read on site. 40 px and 16 px on a phone; an iPad and a computer
   are as they were. The small calendar and clock inside a date or time field
   are not drawn there: a tap anywhere on the field opens the picker, and
   without them "27/11/2026" shows whole (it was cut to "27/11/202").
   Shown to the user as a before and after first. */
@media (pointer: coarse) and (max-width: 767.98px) {
  body[data-qp-test-page] #main :is(input.form-control-sm, select.form-select-sm, textarea.form-control-sm) { font-size: 16px; min-height: 40px; }
  body[data-qp-test-page] #main input[type="date"]::-webkit-calendar-picker-indicator,
  body[data-qp-test-page] #main input[type="time"]::-webkit-calendar-picker-indicator { display: none; }
}

/* The Stamp switch's words under the photos are the quiet grey (its place and
   size: qp-layout.css, .qp-caption-under; 28 November 2026). */
.qp-caption-under .qp-stamp-wrap .form-check-label { color: var(--qp-muted); }

/* Nothing in the person's small switches can stand outside its pill (28
   November 2026). "Alpenglow" was reported outside its pill a second time,
   on a device where it could not be measured so here: at 375, 820, 1024 and
   1280 px, both looks, three text sizes, Regular and Bold, with touch, the
   word had 15 px or more to spare on each side. So the pill itself now cuts
   whatever is in it to its own shape, and a word that would not fit is
   shortened with "…" inside its button, whatever the device's own text
   settings do to its size. */
/* The cause, found the same day: these buttons were meant to be compact
   (.qp-prefs .btn above: .3rem at the sides), but the general small-button
   rule further down the file won and gave them .7rem. "Classic" and
   "Alpenglow" then filled their row to within 2 px on this Mac, and ran over
   on any device whose letters are a touch wider, or at Larger text (9 px
   over). The Look row has its intended side padding. */
.qp-prefs [data-pref="qp-look"] > .btn { padding-left: .35rem; padding-right: .35rem; }
.qp-prefs .btn-group { overflow: hidden; border-radius: var(--bs-border-radius-sm, .4rem); }
.qp-prefs .btn-group > .btn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
