/* ═══════════════════════════════════════════════════════════════════════════
   WATERLINE — the technician's screens, on a phone
   ═══════════════════════════════════════════════════════════════════════════

   rf-base.css and rf-shell.css are deliberately desktop-only — everything in
   them sits behind `@media (min-width: 1024px)` because that is where the
   rail and Inventory already got their review. Below that line is untouched:
   whatever app.css did in 2024 is still what renders there today.

   That untouched ground is exactly where a technician lives. They are not at
   a desk; they are standing at a pool with a phone, sometimes a tablet
   propped in a van, 8 to 15 times a day. So unlike rf-shell, this file's
   centre of gravity is the PHONE, not the desktop, and almost everything
   below sits inside one query:

       @media (max-width: 1023.98px) { ... }

   .98 rather than 1023 so there is no 1px gap or overlap with rf-base's own
   `min-width: 1024px` — the two files meet exactly at the seam and never
   fight over the same pixel. Nothing here touches anything at 1024px and up;
   an admin at a desk sees zero change from this file.

   ── WHY THIS IS SAFE GROUND TO WORK ON ────────────────────────────────────

   Every selector below is either:
     (a) scoped by an id that belongs to one screen (#job-panel-body,
         #rep-panel-body, #cov-panel-body, #today-clock, #prof-hours), or
     (b) a floor (min-height) that adds a property app.css never set, so it
         cannot override anything app.css actually drew.
   Nothing here is a redesign of a shared component — it is a technician-
   scoped correction sitting on top of one.

   ── WHO THIS IS FOR, STATED AS CAPABILITIES NOT A ROLE CHECK ──────────────

   js/can.js now names exactly what a technician can do:
   file-report, measure-cover, move-stock, see-own-hours, read-handbook.
   CSS cannot call Can.do() — there is nothing here that reads it — but that
   list is the BRIEF this file was written against. Every section below maps
   to one capability:

     file-report    → #today-clock, #job-panel-body (Today / the job sheet),
                       #rep-panel-body (the report form itself)
     measure-cover   → #cov-panel-body
     move-stock      → Inventory. Checked and left alone — see note below.
     see-own-hours   → #prof-hours
     read-handbook   → The Bible. Not touched — see note below.

   Nothing here was written for Schedule, Weekly Usage, Stock Audit, Billing,
   Seasonal Data or Admin. A technician doesn't have those capabilities, so
   this file has no opinion about them, and nothing below reaches them.

   ── TWO SCREENS CHECKED AND DELIBERATELY LEFT ALONE ───────────────────────

   Inventory (move-stock): the mobile take/restock buttons are already
   42×42px with clear stock-colour coding (css/app.css ~L319). That is
   already a technician's screen done right — adding to it would be
   decoration, not design.

   The Bible (read-handbook): a technician reads it, rarely edits it. Nothing
   on that screen was under 42px and nothing about it was confusing. Spending
   this file's effort there would have meant spending it somewhere with a
   real problem instead.

   The bottom nav itself (Stock / Activity / Calculator-FAB / Today / More) is
   also untouched: every item is already ≥44px tall, and reordering its icons
   would reorder them for the office role too since there is no body-level
   role class to hang a technician-only override from. See the report for
   where I think the REAL fix for "Today doesn't feel like home" actually
   lives — it is a one-line JS default, not a CSS position.

   ── TOKENS ─────────────────────────────────────────────────────────────────

   Every colour below is a --w-* token from rf-base.css. No hex, anywhere.
   Dimensions use the --w-* spacing/type scale wherever a step on it fits;
   the one number that deliberately is NOT a token is 42-44px touch targets,
   because the brief's own floor (42px) doesn't land on the --w-1..7 ramp and
   a made-up token for one magic number would be worse than naming it.

   ── :has() ─────────────────────────────────────────────────────────────────

   Used below to find the Pictures section of the report form without any
   new markup. Not a risk taken for the first time here — rf-shell.css
   already ships `#nav-today:not(:has(~ #nav-schedule:not(.hidden)))`, signed
   off and live. Same feature, same confidence.
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1023.98px) {

  /* ── TODAY: the clock ──────────────────────────────────────────────────
     Clocking in is the first thing that happens and clocking out is the
     last, which makes #btn-clock the highest-stakes tap in the technician's
     whole day — get it wrong and the week's hours are wrong. It inherits
     .btn-primary/.btn-danger, which pad out to roughly 36px tall on this
     app's base font size: under the 42px floor, on the one button where
     that matters most. Centring is set explicitly rather than trusted to
     the browser's own button-text baseline, which is not reliably vertical
     once min-height forces a box taller than the text needs. */
  #today-clock .clk-top button {
    display: flex; align-items: center; justify-content: center;
    min-height: 44px;
    padding: 0 var(--w-5);
  }

  /* ── TODAY: the job sheet ──────────────────────────────────────────────
     Call / Navigate / History and Start report / View report are the two
     rows a technician's thumb actually lands on for every one of 8-15
     stops a day. Both inherit base button padding that comes out under
     42px even after app.css's own mobile tweak to .stop-btn (11px padding
     + ~13px text ≈ 37px). Floor added, nothing else about their look
     changed — the colours and layout rf-shell didn't touch, this doesn't
     either. */
  #job-panel-body .js-acts .stop-btn {
    min-height: 44px;
  }
  #job-panel-body .js-foot .btn-primary,
  #job-panel-body .js-foot .btn-secondary {
    display: flex; align-items: center; justify-content: center;
    min-height: 44px;
  }

  /* ── THE REPORT FORM ────────────────────────────────────────────────────
     This is the one screen that has to feel right whether the job needs a
     single checkbox (Pick Up & Delivery) or all 48 fields of the old
     fallback form (anything with no template yet). The chrome around the
     variable middle — Visit, Private comment, Message to client, Pictures,
     the footer — is the same length either way, so that is what gets fixed
     here rather than the middle itself.

     #rep-panel-body is turned into a flex column for exactly one reason:
     `order` only works on a flex/grid container, and every child here is
     already a 100% width block, so flex with the default `align-items:
     stretch` renders every one of them at the identical width and position
     it already had. Nothing moves except the three sections given an
     explicit order below. */
  #rep-panel-body {
    display: flex;
    flex-direction: column;
  }

  /* Title stays first... */
  #rep-panel-body > .comm-title { order: -3; }
  /* ...Visit (client / date / job type) stays second, because you cannot
     usefully look at a photo prompt before you know whose pool this is... */
  #rep-panel-body > .comm-sec:has(.comm-form-grid) { order: -2; }
  /* ...and Pictures jumps from dead last — after Private comment and
     Message to client, at the bottom of however many job-specific sections
     this visit type has — to third. Second thing seen on EVERY report,
     1-field or 48-field, before a single chemistry number is typed.

     This is the fix for "a tech must attach a photo must not discover that
     by being blocked." Georgi's rule only throws its error on submit
     (js/app.js ~L2583), which means today a technician can fill out an
     entire 48-field equipment report and be stopped with an error only
     after they reach for Complete. Moving the control up doesn't change
     when the rule fires — it changes whether anyone is ever surprised by
     it. */
  #rep-panel-body > .comm-sec:has(.comm-gallery) {
    order: -1;
    /* Same accent idiom rf-shell already uses for "pay attention to this
       row" on Inventory's low-stock mark (.chem-row.stock-low) — an inset
       edge, not a wash of colour over the whole card, so it reads as a flag
       rather than an error state. Chained with --w-shadow rather than
       replacing app.css's own drop shadow outright, so the card doesn't go
       flat. */
    box-shadow: inset 2px 0 0 var(--w-warn), var(--w-shadow);
    border-color: color-mix(in srgb, var(--w-warn) 35%, var(--w-line));
    background: color-mix(in srgb, var(--w-warn) 5%, var(--w-panel));
  }
  /* The pill reuses the exact pattern .rep-private-tag already established
     for "Office only" — margin-left:auto inside a flex title row — just in
     --w-warn instead of --w-bad, because this is a requirement to clear
     before submitting, not a privacy notice. Generated text, so no markup
     changes anywhere else had to happen for it to exist. */
  #rep-panel-body > .comm-sec:has(.comm-gallery) .comm-sec-title::after {
    content: 'Required';
    margin-left: auto;
    padding: var(--w-1) var(--w-2);
    border-radius: var(--w-r);
    background: color-mix(in srgb, var(--w-warn) 18%, transparent);
    color: var(--w-warn);
    font-size: var(--w-t-label);
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
  }
  /* The upload control itself, not just the card around it — a dashed
     neutral rectangle reading "Add pictures" is easy to mistake for
     optional. Warn-accent border and icon say otherwise before anyone
     reads a word. */
  #rep-panel-body > .comm-sec:has(.comm-gallery) .comm-upload {
    min-height: 48px;
    border: 1.5px dashed var(--w-warn);
    background: color-mix(in srgb, var(--w-warn) 10%, var(--w-sunk));
  }
  #rep-panel-body > .comm-sec:has(.comm-gallery) .comm-upload .ico {
    stroke: var(--w-warn);
    width: 22px; height: 22px;
  }
  #rep-panel-body > .comm-sec:has(.comm-gallery) #rep-upload-label {
    color: var(--w-warn);
    font-weight: 800;
  }

  /* Chemistry inputs, text inputs (equipment make/model/serial), the Visit
     grid's own fields, and the checklist rows: all under the 42px floor at
     their current padding (the number fields come out near 38px; .rep-task
     rows near 39px). Only a floor is added — none of app.css's own colours,
     borders or type sizing for these are touched, so a 1-field and a
     48-field report both just get every control a little taller to hold. */
  #rep-panel-body input:not([type="checkbox"]),
  #rep-panel-body select,
  #rep-panel-body textarea {
    min-height: 44px;
  }
  #rep-panel-body .rep-task {
    min-height: 44px;
  }

  /* Cancel / Save draft / Complete. app.css stacks these column-reverse at
     640px and under, which — because Complete is last in the markup for a
     submittable report — puts Complete at the TOP of the stack and Cancel
     at the BOTTOM, closest to a thumb that has just finished scrolling a
     long form. The one button that can lose a filled-in report sits where
     it is easiest to hit by mistake, and the one button that actually
     finishes the job sits where it takes the most deliberate reach. Column,
     not column-reverse, with Cancel pushed to the top and Complete to the
     bottom, so the safest thing to tap by accident is also the least
     consequential. Scoped to 640px, matching the exact width app.css's own
     column-reverse applies at — this is a one-handed-phone fix, not a
     tablet-in-a-van one, and a tablet has the room for buttons in a row. */
  @media (max-width: 640px) {
    #rep-panel-body .comm-form-footer {
      flex-direction: column;
    }
    #rep-panel-body #btn-rep-cancel { order: -1; }
    #rep-panel-body #btn-rep-draft  { order: 0; }
    #rep-panel-body #btn-rep-submit { order: 1; }
  }

  /* ── COVER MEASURES ─────────────────────────────────────────────────────
     Same input floor as the report form, for the same reason — the
     measurement fields and the pool-photo uploader (.comm-upload is shared
     with the report form, so it already picked up the sizing fix above;
     this only adds what cov-panel doesn't share). No "Required" treatment
     here: cover photos aren't gated on submit the way a service report's
     are, so giving them the same red flag would be announcing a rule that
     doesn't exist. */
  #cov-panel-body input:not([type="checkbox"]),
  #cov-panel-body select,
  #cov-panel-body textarea {
    min-height: 44px;
  }

  /* ── A TECHNICIAN'S OWN HOURS ───────────────────────────────────────────
     The period chips (.hv-tab: "This week" / "2 wks" / ...) come out around
     33px tall at this font size — tapped every time someone checks their
     week. And the hours table is five columns (Week, Shifts, Regular,
     Overtime, Total) with no narrow-screen handling at all, unlike its
     sibling .weekly-table on the admin side — on a 360px phone "Oct 1 – Oct
     7" and "32h 15m" are exactly the kind of strings that wrap onto a
     second line and make every row a different height. Scoped to
     #prof-hours rather than .hv-tab/.hv-tbl generally, because the same
     classes render the admin team-hours view too and that screen is not
     this file's to redesign. */
  #prof-hours .hv-tab {
    display: flex; align-items: center; justify-content: center;
    min-height: 44px;
  }
  #prof-hours {
    overflow-x: auto;
  }
  #prof-hours .hv-tbl th,
  #prof-hours .hv-tbl td {
    white-space: nowrap;
  }
}
