/* Project Hub — app stylesheet.
   Linked from index.html BEFORE frontend/css/tailwind.css (built by the Tailwind CLI since
   2026-09-13; previously the Play CDN injected its <style> in the same later position),
   so Tailwind wins specificity ties. */

body { background-color: #0c0e13; color: #f3f4f6; overscroll-behavior-y: none; }
.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.table-scroll::-webkit-scrollbar { height: 6px; }
.table-scroll::-webkit-scrollbar-track { background: #15181f; }
.table-scroll::-webkit-scrollbar-thumb { background: #2b313c; border-radius: 4px; }
select { text-align: center; text-align-last: center; }
/* FIELD MODE WAS REMOVED HERE on 2026-09-13, along with its Aa toggle.
   It was a set of !important overrides that lifted text-gray-400/500/600 to readable colours
   and pushed text-xs to 14px. In other words, its real job was making the DEFAULTS usable --
   and it only did that when it happened to be on, which was never at a desk (it defaulted off
   above 1024px, so the people doing the money screens on a monitor got the worst of it).

   Those values did not disappear: they are now the `ink` colour tokens and the 12px floor of
   the type scale in tailwind.config.js, applied to everyone all the time. The tokens are
   literally the hex values this block used to substitute, so nothing got dimmer or smaller.

   Its button-padding rule is replaced by the tap-target floor below, which covers every
   control rather than only the ones that happened to use p-2.

   (The comment here also used to claim Field Mode was excluded from the WhatsApp Site Plan
   capture. It was not -- nothing removed the class from the html2canvas clone -- so the image
   a customer received quietly depended on whether the sender had the toggle on. That is fixed
   by there being no toggle.) */

/* Explicit opt-in, kept for the handful of places that want a comfortable target regardless
   of input device. */
.tap { min-width: 44px; min-height: 44px; }

/* TAP TARGET FLOOR. Apple and Google both put the minimum around 44px. Measured before this
   rule: 107 controls on the Customer List and 33 on a phone were under it, some as small as
   16x16 -- and Field Mode did not help, because its padding rule only grew buttons that
   happened to use the p-2 class (25 of 126 opted in via .tap).
   Scoped to coarse pointers so a mouse-and-keyboard desk layout is not stretched. */
@media (pointer: coarse) {
  button,
  select,
  [role="button"],
  input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]) {
    min-height: 44px;
  }
  /* Width too, or a control ends up 44px tall and 16px wide -- which is what the first
     attempt at this rule produced. It scoped min-width to `:has(> svg:only-child)`, and so
     missed every button whose content is an emoji or a single letter (the 🔗 share buttons
     and the "i" info badges). min-width on a button that is already wider costs nothing, so
     there is no reason to be clever about which ones get it.
     Links are matched only when icon-only, so inline links in prose are left alone. */
  button,
  select,
  [role="button"],
  a:has(> svg:only-child),
  /* Text/number inputs too. The first version of this rule gave inputs a min-HEIGHT but not a
     min-width, so the short numeric fields in Measurements stayed 32px wide and 44px tall --
     a target you can reach vertically and miss horizontally. Checkboxes and radios keep their
     native size; they are styled separately and 44px would distort them. */
  input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]) {
    min-width: 44px;
  }
  /* A long press on a button or a tab bar is a slow tap, not a request to select its label:
     on an iPhone it used to highlight the text and pop up Copy / Look Up. Text and fields
     everywhere else stay selectable. */
  button,
  [role="button"],
  nav {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }
}
/* View-only: locked fields read as plain text rather than empty-looking boxes, so the
   screen still reads clearly while making it obvious nothing here can be typed into. */
input:disabled, select:disabled, textarea:disabled {
  opacity: 0.75; cursor: default; -webkit-text-fill-color: currentColor;
}

/* ============================================================
   APP SHELL — the one place page width and desktop chrome live.
   ------------------------------------------------------------
   These are plain media queries rather than Tailwind variants on
   purpose. tailwind.css is linked after this file in index.html,
   so a `lg:max-w-*` utility and a rule here would tie on specificity
   and Tailwind would win. Owning the shell in one CSS block keeps
   the three layouts explicit and out of that race.

   Three layouts, one app:
     phone portrait  — a 28rem column, exactly as before
     landscape       — full width, as before (site plan / measurements
                       need the room, and a phone on its side is still a phone)
     >= 1024px       — a real desktop page: fixed left nav, and content
                       capped so a line of text is readable instead of
                       stretching across a 1440px monitor
   ============================================================ */
.app-measure,
.app-measure-wide { width: 100%; margin-left: auto; margin-right: auto; max-width: 28rem; }
@media (orientation: landscape) {
  .app-measure,
  .app-measure-wide { max-width: none; }
}

/* The app is exactly the VISIBLE screen. It used to be `min-h-screen h-[100dvh]`, and the
   minimum won: on an iPhone in Safari, 100vh is the height with the address bar hidden, so
   while the bar showed, the bottom of the app -- the Measurements pager, then the phone tab
   bar -- sat below the screen, out of reach. dvh is the height actually on screen; 100vh
   stays only as the fallback for a browser too old to know dvh. */
.app-root { height: 100vh; height: 100dvh; }

/* iPhone Home Screen app (main.js fullScreenAppHeight sets the class and --app-h): there iOS
   counts 100dvh without the status bar, so the app stopped that far short of the bottom of the
   screen, with a band of page colour under the tab bar. Sized from the screen instead -- the app,
   and every full-screen layer (popups, sheets, the plan editor) the same way. overflow: hidden so
   the window itself can never be dragged, whichever of the two heights iOS lays the page out in. */
html.home-screen-app .app-root { height: var(--app-h); }
html.home-screen-app, html.home-screen-app body { overflow: hidden; }
html.home-screen-app .fixed.inset-0 { bottom: auto; height: var(--app-h); }

/* Sideways on an iPhone the Dynamic Island and the rounded corners sit at the left and right
   edges, and with viewport-fit=cover the app ran underneath them. These insets are 0 upright,
   in a desktop browser and on most tablets, so only a phone on its side changes. (.app-shell's
   desktop padding-left comes later in this file and still wins at 1024px and up.) */
.app-root { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }

/* A project's header folded away on a phone (main.js handleScroll). The strip under the clock
   keeps the app bar's colour, and this -- the project's tab row -- joins it as one slim bar:
   same colour, edge to edge (the negative margins cancel <main>'s p-2, or landscape:p-4),
   one line under it. Plain CSS rather than Tailwind variants so the phone-only scope is one
   media query instead of a fight between landscape: and lg: overrides. */
@media (max-width: 1023px) {
  .chrome-bar {
    background-color: #15181f;                 /* gray-900, the app bar */
    margin: -0.5rem -0.5rem 0; padding-top: 0.5rem; padding-left: 0.5rem; padding-right: 0.5rem;
    border-bottom: 1px solid #1e222b;          /* gray-800, the app bar's own line */
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  }
  /* The block is `sticky top-0`, and sticky keeps it inside <main>'s padding: the negative
     margin then left an 8px dark seam under the strip. Nothing scrolls <main> itself, so
     sticky does no work here and relative lets the margin reach the strip. */
  .chrome-bar.sticky { position: relative; }
}
@media (max-width: 1023px) and (orientation: landscape) {
  .chrome-bar { margin: -1rem -1rem 0; padding-top: 0.5rem; padding-left: 1rem; padding-right: 1rem; }
}

/* Opened from the iPhone Home Screen the app is drawn under the status bar (index.html:
   black-translucent, viewport-fit=cover). The header and the full-screen plan editor make room
   themselves; a centered popup tall enough to reach the top would still slide under the clock,
   so in that mode they never start above it. Standalone only: a browser tab is untouched. */
@media (display-mode: standalone) {
  .fixed.inset-0.items-center { padding-top: max(1rem, env(safe-area-inset-top)); padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
  /* And no taller than the room between the clock and the home bar: the lot editor's 90vh was
     820px of the iPhone Air's 810px of room, so it ran into the home bar at the bottom. */
  .fixed.inset-0.items-center > * { max-height: 100%; }
}

/* Hidden until there is a desktop to put it on. */
.app-sidebar { display: none; }

@media (min-width: 1024px) {
  /* Fixed, not a grid column: the root is a Tailwind flex column and
     overriding its display here would be the same specificity fight. */
  .app-sidebar {
    display: flex; position: fixed; left: 0; top: 0; bottom: 0; width: 232px;
    flex-direction: column; z-index: 30;
  }
  .app-shell { padding-left: 232px; }
  /* Reading width. A form or a project list is unreadable stretched across a monitor. */
  .app-measure { max-width: 1180px; padding-left: 1rem; padding-right: 1rem; }
  /* Working width. Tables, site plans and the money screens want the monitor, which is
     what `landscape:max-w-none` was really there for. Capped rather than free so an
     ultrawide does not turn a row into a mile of whitespace. */
  .app-measure-wide { max-width: 1800px; padding-left: 1rem; padding-right: 1rem; }
  /* Chrome that the sidebar now carries, or that only makes sense on a phone. */
  .mob-only { display: none !important; }
}
/* The mirror: desktop-only affordances stay out of the field app. */
@media (max-width: 1023px) { .desk-only { display: none !important; } }

/* ============================================================
   READABILITY & KEYBOARD (UI pass — items 6 and 9)
   ============================================================ */

/* Money must line up down a column. Proportional digits give $3,250 and $1,500 different
   widths, so figures wobble and cannot be compared by eye. Scoped to tables and stat tiles
   rather than body, so digits inside ordinary prose keep their natural spacing. */
table,
.stat-num { font-variant-numeric: tabular-nums; }

/* Keyboard focus. :focus-visible fires for keyboard navigation only, so mouse and touch
   users never see this ring — but on a desktop layout a keyboard user otherwise has no way
   to tell where they are. The app had no focus style at all before this. */
:focus-visible {
  /* indigo-400, matching the accent. 4.38:1 against the worst app surface -- below the 4.5:1
     floor for TEXT, but a focus ring is a non-text UI component, where WCAG 1.4.11 asks for
     3:1. Noted here so a future audit that flags it knows this was deliberate. */
  outline: 2px solid #818cf8;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============================================================
   MOTION (2026-11-08) -- the Dashboard and the tab bar.
   ------------------------------------------------------------
   Only transform and opacity move: those two a phone's GPU animates on its own, without the
   page being laid out or painted again each frame. (The progress bars reveal by clip-path,
   which repaints only the bar itself.) Each plays ONCE, when its element first appears --
   React keeps an element across re-renders, so a data refresh or a keystroke replays
   nothing. No loops.

   fill-mode `backwards`, never `both`: a transform left on an element after it lands makes
   it the containing block of any position:fixed popup inside it, which would then open in
   the wrong place. With backwards, the element carries nothing once it has arrived.

   Reduce Motion on the phone (or the computer) turns all of it off.
   ============================================================ */
@keyframes ph-rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes ph-drop { from { opacity: 0; transform: translateY(-6px); } }
@keyframes ph-bar  { from { clip-path: inset(0 100% 0 0 round 9999px); } }
@keyframes ph-fade { from { opacity: 0; } }

/* The Dashboard's sections arrive one after another, 35ms apart; the eighth and later together. */
.ph-stagger > * { animation: ph-rise .32s cubic-bezier(.2, .8, .2, 1) backwards; }
.ph-stagger > :nth-child(2) { animation-delay: 35ms; }
.ph-stagger > :nth-child(3) { animation-delay: 70ms; }
.ph-stagger > :nth-child(4) { animation-delay: 105ms; }
.ph-stagger > :nth-child(5) { animation-delay: 140ms; }
.ph-stagger > :nth-child(6) { animation-delay: 175ms; }
.ph-stagger > :nth-child(7) { animation-delay: 210ms; }
.ph-stagger > :nth-child(n+8) { animation-delay: 245ms; }

/* A list opened under its header: the rows drop in, the first six a beat apart. */
.ph-open > * { animation: ph-drop .22s ease-out backwards; }
.ph-open > :nth-child(2) { animation-delay: 25ms; }
.ph-open > :nth-child(3) { animation-delay: 50ms; }
.ph-open > :nth-child(4) { animation-delay: 75ms; }
.ph-open > :nth-child(5) { animation-delay: 100ms; }
.ph-open > :nth-child(n+6) { animation-delay: 125ms; }

/* A screen too heavy to move (the Site Plan, Measurements' grid, the Customer List's table):
   it fades in, opacity only. */
.ph-fade { animation: ph-fade .2s ease-out backwards; }

/* A progress bar fills from the left. */
.ph-bar { animation: ph-bar .7s cubic-bezier(.2, .8, .2, 1) .12s backwards; }

/* The tab bar: the active tab's pill grows in behind its icon (indigo-600), and a tapped icon gives. */
.ph-pill { position: absolute; inset: 0; border-radius: 9999px; background: #4f46e5;
  transform: scale(.5); opacity: 0; transition: transform .28s cubic-bezier(.3, 1.4, .5, 1), opacity .18s ease-out; }
.ph-pill.on { transform: scale(1); opacity: 1; }
/* The project's tab strip: the same pill, as the strip's own raised segment (gray-700). */
.ph-pill.seg { border-radius: .375rem; background: #2b313c; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transform: scale(.9); }
.ph-pill.seg.on { transform: scale(1); }
.ph-icon { display: inline-flex; transition: transform .12s ease-out; }
.ph-tab:active .ph-icon { transform: scale(.86); }

@media (prefers-reduced-motion: reduce) {
  .ph-stagger > *, .ph-open > *, .ph-bar, .ph-fade { animation: none !important; }
  .ph-pill, .ph-icon { transition: none !important; }
  .ph-tab:active .ph-icon { transform: none; }
}

/* The project's overview card (main.js, THE PROJECT AT A GLANCE) stays out of a phone held
   sideways: there the header and the tab row already take most of the height. */
@media (max-width: 1023px) and (orientation: landscape) { .ph-overview { display: none; } }
