/* Internal app pages (/login, /app) */
.app-body { min-height: 100vh; display: flex; flex-direction: column; }
.app-main { flex: 1; padding: 40px 0 64px; }
.app-narrow { max-width: 560px; }

.app-who { color: var(--muted); font-size: 0.9rem; }
.nav form.inline { margin: 0; }

/* spec 026 Part C: the dashboard's quick-action row — large, plain <a>
   buttons for gloved hands on the floor, no JavaScript. Two per row on a
   phone; a plain wrapping flex row everywhere wider than that. */
.quick-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0; }
.quick-action {
  flex: 1 1 200px;
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 1.05rem;
}
@media (max-width: 640px) {
  .quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .quick-action { flex: none; }
}

/* Spec 035: the Procedures page (/app/binder/sops) — one full-width row
   per published SOP entry, reusing .quick-action's min-height/tap-target
   sizing but stacked into a single column at every width (not the
   dashboard's 2-per-row grid above). */
.procedures-list { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }
.procedure-row { flex-direction: column; align-items: flex-start; text-align: left; width: 100%; }

.app-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 24px;
}
.app-login { margin-top: 24px; }
.app-tile { display: block; text-decoration: none; color: inherit; transition: transform 0.15s ease; }
.app-tile:hover { transform: translateY(-2px); }
.app-tile p { color: var(--muted); margin: 0; }
.app-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: 24px; }

label { display: block; font-weight: 600; color: var(--green-deep); margin-bottom: 14px; font-size: 0.95rem; }
/* spec 026 Part B: was just text/email/password/select, so every other
   input type (date, month, time, datetime-local, number, search, tel, url)
   and textarea fell back to the bare browser control — visibly different
   from its styled siblings (e.g. the closeouts filter bar's Month field
   next to its selects). Native date/time pickers keep their own icon;
   nothing here hides it. */
input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="month"], input[type="time"], input[type="datetime-local"],
input[type="number"], input[type="search"], input[type="tel"], input[type="url"],
textarea, select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid rgba(43, 63, 43, 0.25);
  border-radius: 8px;
  font: inherit;
  background: var(--paper);
}
textarea { min-height: 96px; resize: vertical; }
input[type="file"] { font: inherit; margin-top: 6px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--leaf); border-color: var(--leaf-dark); }
/* button.btn's `border: 0` (specificity 0,1,1) used to beat `.btn-outline`'s
   `border: 2px solid ...` (0,1,0, from styles.css) whenever both classes
   landed on a <button> rather than an <a> — losing the border and falling
   back to the browser's own grey button chrome (the closeouts Filter
   button). `background: transparent` here has the same clash against
   `.btn-primary`/`.btn-danger`'s own `background`, so every `.btn` variant
   actually used on a <button> in src/views/*.js gets its own same-specificity
   override below, keeping <a class="btn ..."> and <button class="btn ...">
   visually identical. */
button.btn { border: 0; background: transparent; cursor: pointer; font: inherit; }
button.btn-outline { border: 2px solid var(--green-mid); }
button.btn-primary { background: var(--leaf); }
button.btn-danger { background: #b3401e; }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; }
/* Review fix (spec 047 fix pass): the draft page's buttons (move
   up/down, edit, retire, open/remove the draft file, ...) came out around
   36px tall using the plain .btn-sm sizing above — too small for the
   floor/phone touch targets the spec calls for (at least 48px). Scoped to
   .doc-draft-page (src/views/docsPages.js#draftPage) rather than changing
   .btn-sm everywhere, since plenty of other .btn-sm uses are compact
   table/toolbar buttons on desktop-only admin pages that don't need it. */
.doc-draft-page .btn-sm {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
form.inline { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
form.inline select, form.inline input { width: auto; margin: 0; }

.app-form-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; }
.app-form-row label { margin: 0; }
.app-form-row .btn { justify-self: start; }

/* A narrow inline number input inside a table cell (e.g. a measured-cull
   figure) — CSP has no 'unsafe-inline', so this replaces a style="" attribute
   rather than sitting beside one. */
.app-input-narrow { width: 6em; }

.app-table { width: 100%; border-collapse: collapse; }
.app-table th, .app-table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid rgba(43, 63, 43, 0.1); vertical-align: middle; }
.app-table th { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.app-table tr.inactive td { opacity: 0.55; }
.app-table td.actions { display: flex; flex-wrap: wrap; gap: 10px; }

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-weight: 600; }
.flash-error { background: #fbe9e4; color: #8a3418; }
.flash-ok { background: var(--green-pale); color: var(--green-deep); }
/* Spec 035 (pre-existing CSP fix): the documents list's "unpublished
   changes" badge used an inline style="" attribute, blocked by this app's
   style-src 'self' CSP. A class does the same thing without it. */
.badge-inline { display: inline-block; padding: 2px 10px; margin: 0; }
.flash-warn { background: #fdf1dc; color: #8a5a18; }

.btn-danger { background: #b3401e; color: #fff; }
.btn-danger:hover { background: #8a3418; }

.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.role-help { margin: 18px 0 0; padding-left: 18px; }

@media (max-width: 700px) {
  .app-table thead { display: none; }
  .app-table tr { display: block; padding: 12px 0; border-bottom: 1px solid rgba(43, 63, 43, 0.1); }
  .app-table td { display: block; border: 0; padding: 6px 0; }
}

/* Spec 044: the HACCP schedule's year grid and the /app/calendar month
   view. calendar-day/calendar-month reuse .app-table's own <700px rule
   above (header hidden, every td a block) for the phone "stacked day
   list" the spec calls for — no separate phone layout is needed. */
.haccp-grid-card { overflow-x: auto; }
.calendar-month td.calendar-day { vertical-align: top; min-height: 70px; }
.calendar-month td.calendar-today { background: var(--green-pale); }

/* Registers module (spec 006) — small helpers used only by
   src/views/registerPages.js, kept as classes (never inline style=) since
   the CSP has no 'unsafe-inline' for style-src. */
.badge { display: inline-block; padding: 2px 10px; margin: 0; font-size: 0.8rem; border-radius: 999px; font-weight: 600; }
.badge-muted { background: rgba(43, 63, 43, 0.08); color: var(--muted); }
.badge-ok { background: var(--green-pale); color: var(--green-deep); }
.badge-bad { background: #fbe9e4; color: #8a3418; }
/* spec 009: the pending-GMO-test chip stays amber, distinct from a pass
   (green) or a hard fail (red), until a result is entered. */
.badge-warn { background: #fdf1dc; color: #8a5a18; }

/* Receiving stepper (spec 009) — a plain ordered list of steps, no JS: the
   current step is bold, completed steps are muted, matching how every other
   register page in this app avoids client-side scripting (CSP has no
   'unsafe-inline'). */
.stepper { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0 0 20px; }
.stepper li { padding: 6px 14px; border-radius: 999px; background: rgba(43, 63, 43, 0.08); color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.stepper li.step-current { background: var(--green-pale); color: var(--green-deep); }
.stepper li.step-done { color: var(--green-deep); }

.checkbox-label { display: flex; align-items: center; gap: 8px; }
.checkbox-label input[type="checkbox"] { width: auto; margin: 0; }

.tile-count { font-size: 1.8rem; font-weight: 700; margin: 0; }

.capitalize { text-transform: capitalize; }

.board-grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 700px) {
  .board-grid { grid-template-columns: 1fr; }
}

/* Record integrity corrections (spec 007 Part D) */
.correction-details { margin-top: 8px; }
.correction-details summary { cursor: pointer; color: var(--leaf-dark, #2b3f2b); font-weight: 600; font-size: 0.85rem; }
.correction-details form { margin-top: 10px; }
.correction-field-form { padding: 8px 0; border-top: 1px solid rgba(43, 63, 43, 0.1); }
.correction-field-form:first-of-type { border-top: 0; }
.correction-field-name { font-weight: 600; font-size: 0.8rem; color: var(--muted); }

/* Audit binder (spec 007 Parts A/B/G) */
.clause-status-na { opacity: 0.7; }
.audit-section-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.packet-cover { text-align: center; padding: 60px 20px; page-break-after: always; }

/* CAPA comments and management review minutes (spec 014) — free-typed
   text with line breaks the author meant to keep; CSP has no
   'unsafe-inline' so this is a class, never a style="" attribute. */
.pre-wrap { white-space: pre-wrap; }

/* The staff guide (/app/help — src/views/pages.js#helpPage, rendered from
   docs/USER-GUIDE.md by src/docs/helpMarkdown.js). A centered reading
   column rather than the full wide-layout width, since this is prose, not
   a table; readable and tappable at tablet width per this app's own
   tablet-first design. */
.help-page { max-width: 760px; margin-inline: auto; }
.help-page h2 { margin-top: 1.4em; padding-top: 0.6em; border-top: 1px solid rgba(43, 63, 43, 0.12); }
.help-page h2:first-of-type { margin-top: 0.5em; padding-top: 0; border-top: 0; }
.help-page h3 { margin-top: 1.1em; }
.help-page p, .help-page li { line-height: 1.55; }
.help-page ul, .help-page ol { padding-left: 1.3em; margin: 0 0 1em; }
.help-page li { margin-bottom: 0.4em; }
.help-page code { background: rgba(43, 63, 43, 0.08); border-radius: 4px; padding: 0.1em 0.35em; font-size: 0.92em; }
.help-page hr { border: 0; border-top: 1px solid rgba(43, 63, 43, 0.12); margin: 1.6em 0; }
.help-page .back-to-top { margin: 0 0 0.4em; font-size: 0.85rem; }
.help-page .back-to-top a { text-decoration: none; }
@media (max-width: 700px) {
  .help-page { max-width: 100%; }
}

/* Presenter mode (spec 024): a slim bar in place of the standard site
   header/nav (src/views/auditDayPages.js#presenterShell) so a phone screen
   during the facility walk isn't crowded by nav links nobody needs
   mid-walk. */
.presenter-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--leaf-dark, #2b3f2b); color: #fff;
  flex-wrap: wrap; position: sticky; top: 0; z-index: 5;
}
.presenter-bar a { color: #fff; }
.presenter-body .app-main { padding-top: 16px; }
.evidence-details summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
@media (max-width: 700px) {
  .evidence-details { }
}

/* Spec 052: sign-in and sign-off methods (phone unlock, station PIN,
   password) are worked from a phone or a tablet on the floor, often with
   gloves on — every tappable control here is at least the 56 px touch
   target this app uses elsewhere, as a class, never a style="" attribute
   (CSP has no 'unsafe-inline'; see .pre-wrap above). */
.tap-target { min-height: 56px; }
.tap-target-lg { min-height: 72px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.pin-input { min-height: 56px; font-size: 28px; letter-spacing: 0.3em; text-align: center; }
.btn-block { width: 100%; }
/* Spec 028/040: the run close-out card, bagging transfer, and packaging
   materials phone pages (receipt entry, the pick panel, counts) reference
   these two classes for a 56 px touch target — defined here (they were
   referenced by src/views/runCloseoutPages.js before this spec but never
   actually defined; this is the one, shared definition every phone page now
   gets, not a per-page style=""). */
.app-phone-btn { min-height: 56px; }
.app-phone-input { min-height: 56px; font-size: 1.05rem; }

/* Spec 040 fix pass (H2): one row per FIFO-split pick on the pick panel —
   a receipt/typed-lot field paired with its own quantity field. */
.app-pick-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }

/* Spec 031: the operations timeline's day/range and week grids — lines as
   COLUMNS, unlike every other .app-table in this app (a plain record list
   with named fields per row). Below 700px, .app-table's own rule (thead
   hidden, tr/td become blocks) still applies, but a bare stacked block
   would lose which LINE each cell was — this labels every cell with its
   line through `data-label`/`::before`, the same idea as a definition list,
   spelled out per cell since the columns here are dynamic (only the lines
   the viewer's role can see). No JavaScript; the label is pure CSS content,
   so it never appears in copied/printed text (print.css uses its own
   layout via src/timeline/printHtml.js and never loads app.css at all).
   Timeline events touch-target and empty cells collapse (`:empty`) so a
   quiet lane doesn't leave a bare label row for every hour on a phone. */
.timeline-table td[data-label]::before { content: attr(data-label); display: block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.timeline-table .timeline-event { padding: 6px 0; }
.timeline-table .timeline-event a { font-weight: 600; }
@media (min-width: 701px) {
  .timeline-table td[data-label]::before { display: none; }
}
@media (max-width: 700px) {
  .timeline-table td:empty { display: none; }
  .timeline-table th[scope="row"] { font-weight: 700; padding-top: 14px; }
}
.text-center { text-align: center; }

/* Spec 030: the kiosk enrol code, shown once on /app/settings/kiosks
   (src/views/signInPages.js#kiosksListPage) — large and spaced out so it
   reads easily off a laptop screen onto the tablet. Was an inline style=
   attribute, a CSP violation (style-src 'self', no 'unsafe-inline'). */
.kiosk-enrol-code { font-size: 2rem; letter-spacing: 0.2em; }

/* Review fix M4: the office entry form (src/views/signInPages.js#
   officeSignInFormPage) reuses the kiosk's own public/kiosk-pad.js
   signature pad, drawing on this same #signature-pad canvas — these
   rules mirror public/kiosk.css's own (that stylesheet is never loaded
   here, and this one is never loaded by the kiosk, so the shared
   selector names never collide). */
.kiosk-pad-wrap { margin: 16px 0; }
#signature-pad {
  display: block;
  width: 100%;
  max-width: 900px;
  height: auto;
  aspect-ratio: 900 / 300;
  border: 2px dashed #666666;
  border-radius: 8px;
  background: #ffffff;
  touch-action: none;
}
.kiosk-pad-actions { display: flex; justify-content: space-between; margin-top: 10px; max-width: 900px; }
