/* AirfieldDaily FieldLog — mobile-first base styles.
   Design system fleshed out in Task #7; this is the initial reset + tokens
   so nothing renders unstyled while auth/security land first. */

/* Light theme, palette drawn from the Alder Airfield Services logo: navy
   (icon mark / body text), slate gray (icon mark / muted text), deep red
   (the bold "ALDER" wordmark — primary brand accent), and teal (the
   "AIRFIELD SERVICES" subtitle — secondary/gradient-partner accent). */
:root {
  --color-bg: #f4f6f9;
  --color-surface: #ffffff;
  --color-text: #182634;
  --color-muted: #5c6b7a;
  --color-accent: #9c2222;
  --color-accent-2: #0f5257;
  --color-danger: #dc2626;
  --color-success: #0d9488;
  --hairline: #dde3ea;
  --field-bg: #f8fafc;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --radius: 0.75rem;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
}

/* Secondary/explanatory text. Deliberately a real defined utility rather than
   a convention — this codebase has repeatedly shipped class names with no
   matching CSS rule (see the `section-card--incomplete` fix), so anything used
   in markup must actually exist somewhere the page loads. style.css is
   included globally via partials/head.ejs, so this is available everywhere. */
.muted {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.visually-hidden-defs {
  position: absolute;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* 2026-08-02 bug fix, user-reported (iOS zooms in on every input tap):
   a baseline floor for every real form control, not just the ones
   wrapped in .form-field (see that class's own more specific override
   further down for the full explanation) — catches any input/select/
   textarea elsewhere in the app that doesn't set its own font-size and
   would otherwise inherit a sub-16px value from whatever ancestor it's
   nested in. Deliberately low-specificity (three bare type selectors) so
   any page/component that genuinely wants a different, intentional size
   can still override it normally — this is a safety-net default, not a
   forced value. */
input,
select,
textarea {
  font-size: 16px;
}

.page {
  min-height: 100dvh;
  padding: var(--space-4);
}

.page--centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-2);
}

/* ==========================================================================
   Auth shell: login / forgot-password / reset-password.
   Adapted from the VolTech Precision login page design (same boot-sequence
   + staggered-reveal pattern), recolored to the Alder Airfield Services
   brand palette (navy/gray from the logo mark, deep red from the "ALDER"
   wordmark, teal from the "AIRFIELD SERVICES" subtitle) with a
   construction-blueprint grid motif instead of VolTech's aviation grid.
   ========================================================================== */

.auth-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(156, 34, 34, 0.09), transparent 60%),
    radial-gradient(900px 500px at 105% 110%, rgba(15, 82, 87, 0.09), transparent 60%),
    var(--color-bg);
}

.auth-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(24, 38, 52, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 38, 52, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 20%, transparent 80%);
  pointer-events: none;
}

/* ---------- Boot / loading sequence ---------- */
#auth-boot {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  background: var(--color-bg);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#auth-boot.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-ring {
  position: relative;
  width: 108px;
  height: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.boot-ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.boot-ring .track {
  stroke: rgba(24, 38, 52, 0.12);
}

.boot-ring .sweep {
  stroke: url(#bootGradient);
  stroke-linecap: round;
  transform-origin: 50% 50%;
  animation: auth-spin 1.4s linear infinite;
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

.boot-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
}

.boot-mark img {
  width: 20px;
  height: 20px;
}

.boot-status {
  text-align: center;
}

.boot-label {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: var(--space-2);
}

#bootMessage {
  font-size: 0.9rem;
  min-height: 1rem;
}

.boot-bar {
  width: 220px;
  height: 3px;
  border-radius: 3px;
  background: var(--hairline);
  overflow: hidden;
  margin-top: var(--space-3);
}

.boot-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-2));
  transition: width 0.25s ease;
}

/* ---------- Auth card + staggered reveal ---------- */
.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 26rem;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.auth-shell.in {
  opacity: 1;
  transform: none;
}

.auth-card {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(24, 38, 52, 0.08);
  border-radius: 1.25rem;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 30px 70px -30px rgba(24, 38, 52, 0.28);
  padding: clamp(1.75rem, 5vw, 2.5rem);
}

.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.auth-shell.in .reveal {
  opacity: 1;
  transform: none;
}

/* 2026-08-02: stagger halved (was 70ms/step, so the Sign in button at
   .reveal-6 didn't finish settling until ~820ms after reveal). Kept as a
   real entrance animation — the fields are hit-testable throughout, so this
   never gated interaction — but on the app's highest-frequency screen the
   shorter cadence reads as responsive rather than ceremonial. */
.reveal-0 { transition-delay: 0s; }
.reveal-1 { transition-delay: 0.035s; }
.reveal-2 { transition-delay: 0.07s; }
.reveal-3 { transition-delay: 0.105s; }
.reveal-4 { transition-delay: 0.14s; }
.reveal-5 { transition-delay: 0.175s; }
.reveal-6 { transition-delay: 0.21s; }
.reveal-7 { transition-delay: 0.245s; }

.brand-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.6rem;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 8px 18px -6px rgba(156, 34, 34, 0.4);
}

.brand-mark img {
  width: 1.35rem;
  height: 1.35rem;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
}

.brand-sub {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.auth-card h1 {
  font-size: 1.6rem;
  margin: 0 0 0.25rem;
}

.subtitle {
  color: var(--color-muted);
  margin: 0 0 var(--space-2);
}

.auth-card .subtitle {
  margin: 0 0 var(--space-4);
}

.alert {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.25);
  color: #7f1d1d;
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 0.6rem 0.75rem;
  border-radius: calc(var(--radius) / 1.5);
  margin-bottom: var(--space-3);
}

.alert[hidden] {
  display: none;
}

.alert-success {
  background: rgba(13, 148, 136, 0.1);
  border-color: rgba(13, 148, 136, 0.28);
  color: #0f4c46;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  text-align: left;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: 0.9rem;
  color: var(--color-muted);
}

.field-input-wrap {
  position: relative;
}

.form-field input {
  width: 100%;
  font: inherit;
  /* 2026-08-02 bug fix, user-reported (iOS zooms in on every input tap):
     `font: inherit` pulls in .form-field's own deliberately-smaller
     0.9rem (14.4px) label/helper-text sizing — iOS Safari auto-zooms the
     whole page in on focus whenever a real form control's computed
     font-size is under 16px. Overriding font-size back up afterward
     (font: inherit already set every other font-shorthand property
     correctly — family, weight, line-height — this only restores the
     one that matters for iOS's threshold) stops the unwanted zoom without
     changing how the input looks on desktop/larger screens, where 16px
     was already close to the base size. */
  font-size: 16px;
  color: var(--color-text);
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) / 1.5);
  padding: 0.65rem 0.75rem;
}

.form-field input::placeholder {
  color: #64748b;
}

.form-field input[type="file"] {
  padding: 0.5rem;
  background: var(--color-surface);
}

.form-field select {
  width: 100%;
  font: inherit;
  /* Same iOS zoom-on-focus fix as .form-field input above. */
  font-size: 16px;
  color: var(--color-text);
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) / 1.5);
  padding: 0.65rem 0.75rem;
}

.form-field select:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin: -0.25rem 0 var(--space-2);
}

.form-field input:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.toggle-vis {
  position: absolute;
  right: 0.1rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: transparent;
  color: var(--color-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  border-radius: calc(var(--radius) / 2);
}

.toggle-vis:hover {
  color: var(--color-text);
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  gap: var(--space-2);
}

.remember {
  display: flex;
  align-items: center;
  min-height: 44px;
  gap: var(--space-2);
  color: var(--color-muted);
  cursor: pointer;
}

.remember input {
  width: 0.95rem;
  height: 0.95rem;
  accent-color: var(--color-accent);
}

.link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--color-accent);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.85rem;
}

/* A <button> that should read as an inline text link (e.g. "Resend code"
   inside a form that can't be a plain <a href>, since submitting it needs
   to be a POST). */
.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.btn-block {
  width: 100%;
}

.signup-line {
  text-align: center;
  margin-top: var(--space-3);
  font-size: 0.85rem;
  color: var(--color-muted);
}

.auth-legal-footer {
  text-align: center;
  margin-top: var(--space-4);
  font-size: 0.75rem;
  color: var(--color-muted);
}

.auth-legal-footer a {
  color: var(--color-muted);
}

.auth-legal-footer span {
  margin: 0 var(--space-1);
}

/* Honeypot: visually hidden and unreachable by keyboard/assistive tech, but
   still present in the DOM so bots that auto-fill every field trip it. See
   authController.ts — a filled honeypot silently no-ops the request instead
   of revealing that it was detected. */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-error {
  color: var(--color-danger);
  font-size: 0.9rem;
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  .boot-ring .sweep {
    animation: none;
  }
  .auth-shell,
  .reveal {
    transition: none;
    opacity: 1;
    transform: none;
  }
}

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: calc(var(--radius) / 2);
  padding: 0.7rem 1rem;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn[disabled] {
  cursor: wait;
  opacity: 0.75;
}

/* Added to a <form> on submit by public/js/form-loading.js. Shows a small
   spinner on its submit button(s) so the user gets immediate feedback that
   their tap registered, even before a response comes back. */
.is-submitting button[type="submit"]::after {
  content: "";
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin-left: 0.5em;
  vertical-align: -0.1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .is-submitting button[type="submit"]::after {
    animation: none;
  }
}

.btn-primary {
  background: var(--color-accent);
  color: #ffffff;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--hairline);
}

.btn-ghost:hover {
  background: var(--color-bg);
}

.btn-danger {
  background: var(--color-danger);
  color: #ffffff;
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Purge-project "type the name to confirm" control (deleted-projects.ejs) —
   a destructive-action confirm pattern with no other user in this app yet. */
.purge-confirm {
  margin-top: var(--space-2);
  padding: var(--space-2);
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: calc(var(--radius) / 2);
  background: rgba(220, 38, 38, 0.05);
}

.purge-confirm summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--color-danger);
}

.purge-confirm__body {
  margin-top: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.purge-confirm__body input[type="text"] {
  width: 100%;
}

.purge-blocked {
  color: var(--color-muted);
  font-size: 0.85rem;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--hairline);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* 2026-08-03 user-reported fix: this div had no layout rule of its own at
   all (block by default), so the ~4px gap between Dashboard/Projects/
   Timesheets/Admin was nothing but collapsed HTML-source whitespace, not a
   deliberate value — a change to indentation in the template could have
   shrunk or grown it by accident. Matches the outer .app-header__nav's own
   gap so the brand-to-links spacing and the links-to-each-other spacing
   read as one consistent rhythm rather than two different amounts. */
.app-header__nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.app-header__nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: var(--space-1) 0;
  color: var(--color-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.app-header__nav a:hover {
  color: var(--color-text);
}

/* 2026-08-02 HCI fix: active-page indicator. Uses a real underline + weight +
   colour shift rather than colour alone (WCAG 1.4.1), and hangs off the same
   aria-current attribute that conveys it programmatically, so the visual and
   assistive-tech signals can never drift apart. */
.app-header__nav a[aria-current="page"] {
  color: var(--color-accent);
  box-shadow: inset 0 -2px 0 var(--color-accent);
}

.app-menu-dropdown__links a[aria-current="page"] {
  color: var(--color-accent);
  font-weight: 700;
}

/* Brand is now an <a> to "/" (it looked identical to the nav links but did
   nothing when clicked — an affordance mismatch against a near-universal
   convention). Keeps its previous visual weight exactly. */
.app-header__brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
  text-decoration: none;
}

.app-header__user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 0.85rem;
  color: var(--color-muted);
}

.app-header__user-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Mobile hamburger menu — shared by both header partials (views/partials/
   app-header.ejs, the staff header, and views/partials/portal-header.ejs,
   the customer-portal header) so the two look and behave identically on a
   narrow screen, not just on desktop. Both share the same base
   .app-header/.app-header__nav/.app-header__user classes and now the same
   markup shape (.app-header__nav-links, .app-header__user-info,
   .app-header__menu) — each partial just supplies its own nav-link list
   and identity fields into it. Below the breakpoint, the full nav-link row
   and the email/role/logout block hide; only the brand, the notification
   bell, and this hamburger stay visible — the hamburger's own dropdown
   duplicates the user's identity + every nav link they're allowed to see +
   logout, so nothing is actually lost, just moved off the cramped top bar. */
.app-header__menu {
  display: none;
  position: relative;
}

.app-header__menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  border-radius: 999px;
  color: var(--color-muted);
  cursor: pointer;
}

.app-header__menu-toggle:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

/* Three-line hamburger that animates into an X on open — pure CSS, driven
   off the button's own aria-expanded attribute (already toggled by
   app-menu.js for accessibility, so no separate JS-managed visual class is
   needed). */
.hamburger-icon {
  position: relative;
  width: 20px;
  height: 14px;
}

.hamburger-icon span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.25s ease, opacity 0.2s ease, top 0.25s ease;
}

.hamburger-icon span:nth-child(1) {
  top: 0;
}

.hamburger-icon span:nth-child(2) {
  top: 6px;
}

.hamburger-icon span:nth-child(3) {
  top: 12px;
}

.app-header__menu-toggle[aria-expanded="true"] .hamburger-icon span:nth-child(1) {
  top: 6px;
  transform: rotate(45deg);
}

.app-header__menu-toggle[aria-expanded="true"] .hamburger-icon span:nth-child(2) {
  opacity: 0;
}

.app-header__menu-toggle[aria-expanded="true"] .hamburger-icon span:nth-child(3) {
  top: 6px;
  transform: rotate(-45deg);
}

.app-menu-dropdown {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  width: min(280px, 80vw);
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  z-index: 50;
  overflow: hidden;
  animation: app-menu-in 0.15s ease;
}

/* Same "author display:flex beats the [hidden] user-agent default" fix
   already documented on .notification-dropdown[hidden]. */
.app-menu-dropdown[hidden] {
  display: none;
}

@keyframes app-menu-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-menu-dropdown__user {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3);
  border-bottom: 1px solid var(--hairline);
}

.app-menu-dropdown__user strong {
  color: var(--color-text);
  font-size: 0.95rem;
}

.app-menu-dropdown__user span {
  color: var(--color-muted);
  font-size: 0.8rem;
}

.app-menu-dropdown__links {
  display: flex;
  flex-direction: column;
  padding: var(--space-1) 0;
}

.app-menu-dropdown__links a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-3);
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.app-menu-dropdown__links a:hover {
  background: var(--color-bg);
}

.app-menu-dropdown__logout {
  padding: var(--space-2) var(--space-3) var(--space-3);
  border-top: 1px solid var(--hairline);
}

.app-menu-dropdown__logout .btn {
  width: 100%;
}

@media (max-width: 640px) {
  .app-header__nav-links,
  .app-header__user-info {
    display: none;
  }

  .app-header__menu {
    display: flex;
  }

  /* 2026-08-02 bug fix, caught during testing at the narrowest real device
     width (320px): .app-header still had its original flex-wrap:wrap from
     the pre-hamburger layout — with nav-links/user-info hidden, the only
     remaining content is the brand (fairly long post-rebrand: "AirfieldDaily
     FieldLog") plus the bell+hamburger group, and at 320px those two don't
     quite fit on one line, so the row wrapped anyway, landing
     .app-header__user back near the LEFT edge — reopening the exact
     notification-dropdown positioning bug just fixed above, whose fix
     assumes .app-header__user sits at the header's right edge, not wrapped
     onto its own left-starting row. Forced to a single row instead;
     min-width:0 is required on the flex item for content to actually be
     allowed to shrink/truncate rather than force an overflow-driven wrap —
     browsers default a flex item's min-width to `auto` (effectively its
     content's natural width), which silently defeats flex-shrink/ellipsis
     otherwise. */
  .app-header {
    flex-wrap: nowrap;
  }

  .app-header__nav {
    min-width: 0;
    flex: 1 1 auto;
  }

  .app-header__user {
    flex-shrink: 0;
  }

  /* The plain-text staff brand truncates with an ellipsis if it doesn't
     fit — a single text run, so text-overflow applies cleanly. */
  .app-header__brand {
    display: block;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  /* The portal brand is NOT a single text run (an icon mark + a two-line
     "AirfieldDaily FieldLog" / "Client Portal" text stack, its own nested
     flex layout) — text-overflow:ellipsis doesn't apply meaningfully to
     that shape, and forcing display:block here would break the icon+text
     side-by-side arrangement. min-width:0 alone is enough to let it shrink
     below its content's natural width instead of forcing a wrap; at true
     320px widths the icon mark and short brand text still comfortably fit
     without truncation, unlike the plain header's longer inline text. */
  .portal-header__brand {
    min-width: 0;
  }
}

/* Notification bell + dropdown (public/js/notifications.js) */
.notification-bell {
  position: relative;
}

.notification-bell__toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  border-radius: 999px;
  color: var(--color-muted);
  cursor: pointer;
}

.notification-bell__toggle:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.notification-bell__badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--color-danger);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.1rem;
  text-align: center;
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  width: min(360px, 90vw);
  max-height: 420px;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  z-index: 50;
  overflow: hidden;
}

/* The class rule's `display: flex` above is author CSS, which beats the
   browser's own [hidden] default (user-agent stylesheet, lowest cascade
   priority) even though that default is "display: none" — same bug class
   documented elsewhere in this app (see the daily-report editor's
   data-when[hidden] fix). Without this, toggling the `hidden` attribute
   from JS silently does nothing. */
.notification-dropdown[hidden] {
  display: none;
}

/* 2026-08-02 bug fix, user-reported ("cut off" on mobile): this rule was
   written for the OLD header layout, where a narrow viewport made the
   entire .app-header__user block wrap onto its own row (via .app-header's
   flex-wrap), landing the bell near the viewport's LEFT edge — left:0
   (relative to .notification-bell, its positioned ancestor) correctly
   reached the screen edge in that world. The hamburger-menu redesign (see
   .app-header__menu above) no longer wraps the header on mobile at all —
   nav links and the email/role/logout block hide instead, so the bell now
   sits mid-row, to the LEFT of the hamburger button, never at either
   edge. left:0 relative to the bell now anchors a near-viewport-width
   panel starting well INTO the screen, running it off the RIGHT edge
   instead — the reported cutoff.
   Fixed by moving the positioning root from .notification-bell up to
   .app-header__user, which (via .app-header's own
   justify-content:space-between) sits flush against the header's true
   right edge regardless of exactly where the bell/hamburger fall within
   it, then anchoring from the right — mirroring the already-correct
   desktop rule instead of re-deriving a separate left-anchored special
   case. .notification-bell only ever needed position:relative to give its
   own dropdown child a positioning root — moving that role to
   .app-header__user at this breakpoint doesn't affect anything else (the
   bell's unread-count badge is independently anchored to
   .notification-bell__toggle, not this element). */
@media (max-width: 640px) {
  .notification-bell {
    position: static;
  }

  .app-header__user {
    position: relative;
  }

  .notification-dropdown {
    left: auto;
    right: 0;
    width: min(320px, calc(100vw - 2rem));
  }
}

.notification-dropdown__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--hairline);
  font-weight: 700;
  color: var(--color-text);
}

.notification-dropdown__header .link-button {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-accent);
}

.notification-dropdown__list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
}

.notification-dropdown-item {
  display: block;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--hairline);
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.85rem;
}

.notification-dropdown-item:last-child {
  border-bottom: none;
}

.notification-dropdown-item:hover {
  background: var(--color-bg);
}

.notification-dropdown-item--unread {
  font-weight: 700;
  background: rgba(156, 34, 34, 0.05);
}

.notification-dropdown-item__time {
  display: block;
  margin-top: var(--space-1);
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--color-muted);
}

.notification-dropdown__empty {
  padding: var(--space-3);
  text-align: center;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.notification-dropdown__push {
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--hairline);
}

.notification-dropdown__push .link-button {
  font-weight: 600;
  font-size: 0.85rem;
}

.notification-dropdown__push-status {
  padding: 0 var(--space-3) var(--space-2);
  color: var(--color-muted);
  font-size: 0.78rem;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: var(--space-4);
  max-width: 36rem;
  margin: var(--space-4) auto 0;
  box-shadow: 0 1px 2px rgba(24, 38, 52, 0.06), 0 1px 3px rgba(24, 38, 52, 0.08);
  animation: card-in 0.35s ease;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: var(--space-3);
}

.admin-tile {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: var(--space-4);
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 2px rgba(24, 38, 52, 0.06), 0 1px 3px rgba(24, 38, 52, 0.08);
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.admin-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(24, 38, 52, 0.12);
}

.admin-tile h2 {
  margin: 0 0 var(--space-1);
  font-size: 1.1rem;
  color: var(--color-accent);
}

.admin-tile p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.skeleton-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Author CSS's `display: flex` above otherwise beats the browser's default
   `[hidden] { display: none }` UA rule, so setting `.hidden = true` in JS
   would silently do nothing and the shimmer would run forever underneath
   the real content once it appears. */
.skeleton-group[hidden] {
  display: none;
}

.skeleton--title {
  height: 1.25rem;
  width: 40%;
}

.skeleton--line {
  height: 1rem;
  width: 90%;
}

.skeleton--line-short {
  width: 75%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.page-header h1 {
  margin: 0;
}

.page-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.page-header__actions form {
  display: inline-flex;
}

.phase-card {
  text-align: left;
  margin-left: 0;
  margin-right: 0;
  max-width: none;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.inline-form input[type="text"],
.inline-form input[type="number"] {
  font: inherit;
  color: var(--color-text);
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) / 1.5);
  padding: 0.5rem 0.65rem;
}

.inline-form__narrow {
  width: 5rem;
}

.daily-report-form textarea {
  width: 100%;
  font: inherit;
  color: var(--color-text);
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) / 1.5);
  padding: 0.65rem 0.75rem;
  resize: vertical;
}

.phase-fieldset {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: var(--space-3);
  margin: 0;
}

.phase-fieldset legend {
  font-weight: 700;
  padding: 0 var(--space-1);
}

.repeatable-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: flex-start;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--hairline);
}

.repeatable-row--inline {
  align-items: center;
}

.repeatable-row input[type="text"],
.repeatable-row input[type="number"] {
  font: inherit;
  color: var(--color-text);
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) / 1.5);
  padding: 0.4rem 0.6rem;
}

.repeatable-row textarea {
  flex: 1 1 16rem;
  font: inherit;
  color: var(--color-text);
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) / 1.5);
  padding: 0.4rem 0.6rem;
  resize: vertical;
}

/* Stacked "card" repeatable rows (Location/Work, Visitors, Labor, Equipment)
   — each row is its own labeled mini-form instead of a cramped inline strip,
   so it's clear what each field is for even once placeholder text is gone. */
#work-entries,
#visitor-entries,
#labor-entries,
#equipment-entries {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.repeatable-row--stacked {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--field-bg);
}

.repeatable-row__fields {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.repeatable-row__field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1 1 14rem;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.repeatable-row__field--narrow {
  flex: 0 1 9rem;
}

.repeatable-row__field input,
.repeatable-row__field textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) / 1.5);
  padding: 0.6rem 0.7rem;
}

.repeatable-row__field textarea {
  resize: vertical;
}

.repeatable-row--stacked .remove-row {
  align-self: flex-end;
}

.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: var(--space-3);
}

.attachment-tile {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  background: var(--field-bg);
}

.attachment-tile__media {
  width: 100%;
  max-height: 14rem;
  object-fit: contain;
  border-radius: calc(var(--radius) / 1.5);
  background: #0000000d;
}

.attachment-tile__status {
  color: var(--color-muted);
  font-style: italic;
}

.attachment-tile__meta {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin: 0;
}

/* Attachment capture (new daily report form) — big camera-first buttons
   rather than a plain file input, since users are taking a photo/video, not
   browsing for an existing file. */
.attachment-capture {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

.btn-camera {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex: 1 1 9rem;
  min-height: 6rem;
  padding: var(--space-3);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text);
  background: var(--field-bg);
  border: 2px dashed var(--hairline);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.btn-camera:hover {
  border-color: var(--color-accent);
  background: var(--color-surface);
}

.btn-camera__icon {
  font-size: 1.75rem;
  line-height: 1;
}

.btn-camera--secondary {
  border-style: solid;
  font-weight: 500;
}

.attachment-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.attachment-preview-chip {
  position: relative;
  width: 6rem;
  height: 6rem;
  border-radius: calc(var(--radius) / 1.5);
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: var(--color-surface);
}

.attachment-preview-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.attachment-preview-chip__video {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: var(--field-bg);
}

.attachment-preview-chip__label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  font-size: 0.6rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  padding: 0.1rem 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 2026-08-02 touch-ergonomics fix: measured ~21px, sitting directly beside
   the highest-frequency capture action in the app (Take Photo). The visible
   badge stays small so it doesn't cover the thumbnail it sits on, so the hit
   area is extended invisibly via ::before — same technique as
   .date-picker__day / .date-picker__nav above. */
.attachment-preview-chip__remove {
  position: absolute;
  top: 0.15rem;
  right: 0.15rem;
  width: 1.3rem;
  height: 1.3rem;
  line-height: 1;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.attachment-preview-chip__remove::before {
  content: "";
  position: absolute;
  inset: -11px;
}

.attachment-preview-chip__remove:hover {
  background: var(--color-danger);
}

/* Approval workflow: status badges, draft/revision banners, review actions */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.status-badge--draft {
  background: #e2e8f0;
  color: var(--color-muted);
}

.status-badge--submitted {
  background: #fef3c7;
  color: #92400e;
}

.status-badge--approved {
  background: #d1fae5;
  color: #065f46;
}

.status-badge--rejected {
  background: #fee2e2;
  color: #991b1b;
}

.draft-banner {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  max-width: 48rem;
  margin: 0 auto var(--space-3);
  font-size: 0.9rem;
  color: var(--color-muted);
}

.revision-banner {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: var(--space-3);
  color: #991b1b;
  max-width: 36rem;
  margin: var(--space-4) auto 0;
}

.revision-banner a {
  color: inherit;
  font-weight: 700;
}

.form-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

.review-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}

.review-actions form {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
}

.review-actions textarea {
  font: inherit;
  color: var(--color-text);
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) / 1.5);
  padding: 0.5rem 0.65rem;
  resize: vertical;
  width: 16rem;
}

/* Animated calendar date picker (public/js/date-picker.js) */
.date-picker {
  position: relative;
  display: flex;
  gap: var(--space-2);
}

.date-picker__input {
  flex: 1 1 auto;
  font: inherit;
  color: var(--color-text);
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) / 1.5);
  padding: 0.6rem 0.75rem;
  cursor: pointer;
}

.date-picker__toggle {
  flex: 0 0 auto;
  font-size: 1.1rem;
  line-height: 1;
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) / 1.5);
  padding: 0.5rem 0.65rem;
  cursor: pointer;
}

.date-picker__panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 20;
  /* Widened from 17.5rem so seven 44px day cells actually fit — see the
     .date-picker__day comment below. Deliberately sized in px, not rem: this
     file's `html { font-size: clamp(14px, ..., 16px) }` responsive root
     shrinks every rem on exactly the narrow viewports where the 44px touch
     floor matters most (22rem resolved to 317px at 390px wide, giving 42px
     cells). 7*44 + 6*2 gaps + ~29px padding ~= 350px. max-width keeps it
     inside a 320px viewport, degrading to slightly-under-44 rather than
     overflowing (this app has a standing zero-horizontal-scroll rule). */
  width: 350px;
  max-width: calc(100vw - 1.5rem);
  background: var(--color-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: 0 4px 10px rgba(24, 38, 52, 0.1), 0 1px 3px rgba(24, 38, 52, 0.08);
  /* Horizontal padding trimmed (vertical unchanged) to hand the saved width
     back to the day grid — with var(--space-3) on both sides the seven columns
     came out at 41.8px, just under the touch floor this widening exists to
     reach. */
  padding: var(--space-3) var(--space-2);
  transform-origin: top left;
  opacity: 0;
  transform: scale(0.95) translateY(-4px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.date-picker__panel.is-open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.date-picker__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
  font-weight: 700;
}

.date-picker__nav {
  position: relative;
  background: none;
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) / 1.5);
  width: 1.75rem;
  height: 1.75rem;
  line-height: 1;
  font-size: 1rem;
  cursor: pointer;
  color: var(--color-text);
}

/* The visible 28px button stays compact (a full 44px box would look
   oversized in a tight calendar-header row), but the actual tap target is
   invisibly extended to ~44px via this ::before, rather than the button
   itself growing — the standard technique for a small control in a dense
   layout that still needs a real mobile touch target. */
.date-picker__nav::before {
  content: "";
  position: absolute;
  inset: -8px;
}

.date-picker__nav:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.date-picker__grid-holder {
  position: relative;
  overflow: hidden;
}

.date-picker__grid {
  display: grid;
  /* minmax(44px, 1fr) rather than plain 1fr so the touch floor is enforced by
     the grid itself — the cells can grow with a wider panel but can never be
     squeezed below 44px by a narrower one (they'd overflow instead, which the
     panel's own max-width prevents from reaching the page). */
  grid-template-columns: repeat(7, minmax(44px, 1fr));
  gap: 2px;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.date-picker__grid.is-leaving-left {
  transform: translateX(-100%);
  opacity: 0;
  position: absolute;
  inset: 0;
}

.date-picker__grid.is-leaving-right {
  transform: translateX(100%);
  opacity: 0;
  position: absolute;
  inset: 0;
}

.date-picker__grid.is-entering-right {
  transform: translateX(100%);
  opacity: 0;
}

.date-picker__grid.is-entering-left {
  transform: translateX(-100%);
  opacity: 0;
}

.date-picker__weekday {
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-muted);
  padding: 0.2rem 0;
}

/* 2026-08-02 touch-ergonomics fix. Measured on a real 390px viewport, day
   cells rendered ~29-32px square — well under the 44px floor (WCAG 2.5.8),
   on a grid whose ADJACENT targets are different calendar dates. Mis-tapping
   here sets the wrong report date, which is a compliance error rather than a
   cosmetic one.

   Deliberately NOT solved with the invisible `::before { inset: -Npx }` trick
   used elsewhere in this file for the prev/next arrows: those are isolated
   controls with empty space around them, whereas these cells are packed in a
   7-column grid, so an inset overlay overlaps its neighbours. Measured that
   directly — a probe 5px to the right of a day cell resolved to the NEXT day's
   button, meaning each target ends up silently offset from the circle the user
   is actually aiming at. That's worse than a small centred target, not better.

   Real fix: make the cells genuinely 44px by widening the panel enough for
   7 columns to fit at that size (7*44 + 6*2px gaps + 2*16px padding ~= 352px),
   capped to the viewport so it can't overflow a narrow phone. */
.date-picker__day {
  aspect-ratio: 1;
  min-height: 44px;
  border: none;
  background: none;
  border-radius: 50%;
  font: inherit;
  font-size: 0.9rem;
  color: var(--color-text);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease, transform 0.1s ease;
}

.date-picker__day:hover {
  background: var(--field-bg);
  transform: scale(1.08);
}

.date-picker__day--muted {
  color: var(--color-muted);
  opacity: 0.55;
}

.date-picker__day--disabled {
  color: var(--color-muted);
  opacity: 0.35;
  cursor: not-allowed;
}

.date-picker__day--disabled:hover {
  background: none;
  transform: none;
}

.date-picker__day--today {
  box-shadow: inset 0 0 0 1px var(--color-accent-2);
  font-weight: 700;
}

.date-picker__day--selected {
  background: var(--color-accent);
  color: #fff;
  font-weight: 700;
}

.date-picker__day--selected:hover {
  background: var(--color-accent);
  transform: none;
}

/* Animated month picker (public/js/month-picker.js) — same visual language
   as the date picker above (fade/scale open, slide transition on
   navigation), kept as its own class set rather than sharing the
   .date-picker__* names since a month grid (12 rectangular buttons, no
   weekday header) isn't a drop-in reuse of the day-grid markup. */
.month-picker {
  position: relative;
  display: flex;
  gap: var(--space-2);
}

.month-picker__input {
  flex: 1 1 auto;
  font: inherit;
  color: var(--color-text);
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) / 1.5);
  padding: 0.6rem 0.75rem;
  cursor: pointer;
}

.month-picker__toggle {
  flex: 0 0 auto;
  font-size: 1.1rem;
  line-height: 1;
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) / 1.5);
  padding: 0.5rem 0.65rem;
  cursor: pointer;
}

.month-picker__panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 20;
  width: 15rem;
  background: var(--color-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: 0 4px 10px rgba(24, 38, 52, 0.1), 0 1px 3px rgba(24, 38, 52, 0.08);
  padding: var(--space-3);
  transform-origin: top left;
  opacity: 0;
  transform: scale(0.95) translateY(-4px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.month-picker__panel.is-open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.month-picker__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
  font-weight: 700;
}

.month-picker__nav {
  position: relative;
  background: none;
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) / 1.5);
  width: 1.75rem;
  height: 1.75rem;
  line-height: 1;
  font-size: 1rem;
  cursor: pointer;
  color: var(--color-text);
}

/* Same invisible touch-target extension as .date-picker__nav above. */
.month-picker__nav::before {
  content: "";
  position: absolute;
  inset: -8px;
}

.month-picker__nav:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.month-picker__grid-holder {
  position: relative;
  overflow: hidden;
}

.month-picker__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.month-picker__grid.is-leaving-left {
  transform: translateX(-100%);
  opacity: 0;
  position: absolute;
  inset: 0;
}

.month-picker__grid.is-leaving-right {
  transform: translateX(100%);
  opacity: 0;
  position: absolute;
  inset: 0;
}

.month-picker__grid.is-entering-right {
  transform: translateX(100%);
  opacity: 0;
}

.month-picker__grid.is-entering-left {
  transform: translateX(-100%);
  opacity: 0;
}

.month-picker__month {
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) / 1.5);
  background: none;
  font: inherit;
  font-size: 0.85rem;
  color: var(--color-text);
  padding: 0.45rem 0;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.month-picker__month:hover {
  border-color: var(--color-accent);
}

.month-picker__month--disabled {
  color: var(--color-muted);
  opacity: 0.4;
  cursor: not-allowed;
}

.month-picker__month--disabled:hover {
  border-color: var(--hairline);
}

.month-picker__month--today {
  box-shadow: inset 0 0 0 1px var(--color-accent-2);
  font-weight: 700;
}

.month-picker__month--selected {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
  font-weight: 700;
}

.month-picker__month--selected:hover {
  border-color: var(--color-accent);
}

.month-picker__footer {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-2);
}

/* .link-button is deliberately zero-padding everywhere else (it's meant to
   read as inline text, e.g. mid-sentence "resend code") — but here it's a
   standalone toolbar action, not inline text, so it gets its own real touch
   target the same way the compact date/month-picker nav arrows do. */
.month-picker__footer .link-button {
  position: relative;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* Custom time picker (public/js/time-picker.js) — user explicitly didn't
   want the native <input type="time"> control. Same visual language as
   .date-picker (fade/scale-open panel) but its own class names, since a
   scrollable Hour/Minute/AM-PM column layout isn't a drop-in reuse of the
   day-grid markup. */
.time-picker {
  position: relative;
  display: flex;
  gap: var(--space-2);
}

.time-picker__input {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  color: var(--color-text);
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) / 1.5);
  padding: 0.6rem 0.75rem;
  cursor: pointer;
}

.time-picker__toggle,
.time-picker__clear {
  flex: 0 0 auto;
  font-size: 1.1rem;
  line-height: 1;
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) / 1.5);
  padding: 0.5rem 0.65rem;
  cursor: pointer;
  color: var(--color-text);
}

.time-picker__clear {
  font-size: 1.3rem;
  color: var(--color-muted);
}

/* 2026-08-03 redesign — see public/js/time-picker.js's header comment for
   the full reasoning. Summary: the previous panel used three scrolling
   columns, so only ~3 of 12 hours were visible at once and AM/PM was a
   two-item scroll list that read as a rendering bug. Everything is now
   visible at once in two 6x2 grids plus a real segmented AM/PM control,
   with a live preview and a one-tap "Now". */
.time-picker__panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 20;
  /* Wide enough for a 6-column grid to keep ~44px cells, but never wider
     than the viewport allows — these fields sit inside multi-column form
     grids on narrow screens. Deliberately px, not rem: the daily-report
     editor shrinks the root font-size on narrow screens
     (daily-report-overrides.css's `html { font-size: clamp(14px…) }`), which
     would shrink a rem-based panel and push the grid cells back under the
     44px touch target on exactly the smallest screens that need them most. */
  width: min(336px, calc(100vw - 2rem));
  background: var(--color-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(24, 38, 52, 0.13), 0 2px 6px rgba(24, 38, 52, 0.08);
  padding: var(--space-3);
  transform-origin: top left;
  opacity: 0;
  transform: scale(0.95) translateY(-4px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

/* Set by time-picker.js when a left-anchored panel would run past the
   right edge of the viewport (a right-hand column in a form grid). */
.time-picker__panel--flip-right {
  left: auto;
  right: 0;
  transform-origin: top right;
}

.time-picker__panel.is-open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* Live preview of the time being composed. The old panel showed nothing
   until after Done, so a mis-tap on the hour column was only discoverable
   by closing the picker and re-reading the field. */
.time-picker__preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--hairline);
}

.time-picker__preview-value {
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: var(--color-text);
}

/* The dominant real use of this control is "what time is it right now"
   (clock in/out, visitor arrival), so it gets a dedicated one-tap action
   rather than being reachable only by composing hour + minute + period. */
.time-picker__now {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0.35rem 0.95rem;
  border: 1px solid var(--color-accent);
  border-radius: 999px;
  background: none;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-accent);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.time-picker__now:hover {
  background: var(--color-accent);
  color: #fff;
}

.time-picker__section + .time-picker__section {
  margin-top: var(--space-3);
}

.time-picker__legend {
  display: block;
  margin-bottom: var(--space-1);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* Every option visible at once — recognition rather than scroll-hunting,
   and a stationary target for each value instead of one that moves as the
   column scrolls. */
.time-picker__grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
}

.time-picker__option {
  min-height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) / 1.5);
  background: var(--field-bg);
  font: inherit;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.time-picker__option:hover {
  border-color: var(--color-accent);
}

.time-picker__option--selected {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
  font-weight: 700;
}

.time-picker__option--selected:hover {
  background: var(--color-accent);
}

/* AM/PM as a real two-option segmented control. Previously this was a
   scrolling column containing exactly two items, which rendered as one
   filled block with a second option clipped below it. */
.time-picker__period-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-top: var(--space-3);
}

.time-picker__period {
  min-height: 44px;
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) / 1.5);
  background: var(--field-bg);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.time-picker__period:hover {
  border-color: var(--color-accent);
}

.time-picker__period.time-picker__option--selected {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.time-picker__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--hairline);
}

.time-picker__cancel,
.time-picker__done {
  min-height: 44px;
  border-radius: calc(var(--radius) / 1.5);
  padding: 0.45rem 1.15rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.time-picker__cancel {
  border: 1px solid var(--hairline);
  background: none;
  color: var(--color-muted);
}

.time-picker__cancel:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.time-picker__done {
  border: 1px solid var(--color-accent);
  background: var(--color-accent);
  color: #fff;
}

.whitespace-pre-line {
  white-space: pre-line;
}

/* Visually hidden but still read by screen readers. Used where a visual
   affordance carries meaning that isn't in the text — e.g. the daily-report
   entry cards show their position as a small numbered badge (aria-hidden,
   since "1" alone is meaningless read aloud) and put the real "Work item 1:"
   prefix here instead. Not `display: none`/`visibility: hidden`, which would
   remove it from the accessibility tree too. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.legal-page {
  max-width: 42rem;
  margin: 0 auto;
  text-align: left;
}

.legal-page h2 {
  margin-top: var(--space-4);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th,
td {
  padding: var(--space-2);
  border-bottom: 1px solid var(--hairline);
  font-size: 0.9rem;
}

/* Responsive stacked-row tables for the still-plain admin pages (Security,
   Deleted Projects, Disabled Users, Privacy Requests) — this app has an
   explicit "zero horizontal scroll anywhere" requirement (established for
   the daily-report editor's resource tables, see daily-report-overrides.css),
   so a raw <table> doesn't get an overflow-x:auto escape hatch here; every
   row collapses into a label/value stack below this breakpoint instead,
   mirroring the same technique .daily-resource-table already uses in
   daily-report-reference.css. Apply class="admin-table" to the <table> and
   a matching data-label="..." to each <td> — skip data-label on a
   purely-action cell (e.g. the trailing empty <th></th> column) so no
   blank label renders there. */
@media (max-width: 640px) {
  .admin-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    padding: 0;
    margin: -1px;
  }

  .admin-table,
  .admin-table tbody,
  .admin-table tr,
  .admin-table td {
    display: block;
    width: 100%;
  }

  .admin-table tr {
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--hairline);
  }

  .admin-table td {
    border-bottom: none;
    padding: var(--space-1) 0;
    display: flex;
    gap: var(--space-2);
    font-size: 0.95rem;
  }

  .admin-table td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 42%;
    font-weight: 600;
    color: var(--color-muted);
  }

  .admin-table td:not([data-label]) {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    margin-top: var(--space-2);
  }
}

.site-footer {
  margin-top: var(--space-4);
  display: flex;
  gap: var(--space-3);
  font-size: 0.85rem;
  color: var(--color-muted);
}

.site-footer a {
  color: inherit;
}

.skeleton {
  background: linear-gradient(90deg, var(--hairline) 25%, #eef1f5 37%, var(--hairline) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: var(--radius);
}

@keyframes skeleton-loading {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }
}

/* Toast notifications — fixed-position, dismissible pop-ups for
   transient/actionable errors (e.g. daily-report upload failures,
   submission-blocking validation) that shouldn't push page content down
   the way an inline .form-notice banner does. Persistent/contextual
   notices (read-only-draft status, "this is a corrected revision") stay
   as inline banners; only real errors use this. */
.toast-stack {
  position: fixed;
  top: var(--space-3);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: min(92vw, 480px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0.9rem 1rem;
  box-shadow: 0 12px 32px rgba(24, 38, 52, 0.18);
  pointer-events: auto;
  animation: toast-in 0.25s ease;
}

.toast--error {
  border-color: rgba(220, 38, 38, 0.28);
  background: #fff0f0;
  color: #8f171c;
}

/* 2026-08-02 HCI fix: until now `toast--error` was the ONLY variant, and
   AlderToast.show() hardcoded it — so genuinely positive, expected messages
   ("Saved offline — this will sync automatically once you're back online")
   rendered in alarm-red with an assertive role="alert" screen-reader
   interruption. That actively undermined confidence in the offline system,
   which is exactly the feature that most depends on the user trusting it.
   Success/info now have their own treatment and use role="status" instead
   (see toast.js) so assistive tech announces them politely, not urgently. */
.toast--success {
  border-color: rgba(13, 148, 136, 0.32);
  background: #effcf9;
  color: #0f4c46;
}

.toast--info {
  border-color: var(--hairline);
  background: var(--color-surface);
  color: var(--color-text);
}

.toast--warning {
  border-color: rgba(180, 120, 10, 0.32);
  background: #fffaf0;
  color: #7c4a03;
}

.toast__body {
  flex: 1 1 auto;
  min-width: 0;
}

.toast__body strong {
  display: block;
  margin-bottom: 0.15rem;
}

.toast__body span {
  display: block;
}

.toast__dismiss {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: -0.5rem -0.5rem -0.5rem 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 0.5rem;
}

.toast__dismiss:hover,
.toast__dismiss:focus-visible {
  background: rgba(0, 0, 0, 0.08);
}

.toast.is-dismissed {
  animation: toast-out 0.18s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    animation: none;
  }
  .toast.is-dismissed {
    animation: none;
    display: none;
  }
}

/* Real upload progress (XHR-driven, see attachment-upload.js) — replaces
   the plain "the button is disabled" feedback with an actual byte-progress
   bar, since attachment uploads (photos/video/PDF, scanned for malware
   before storage) can take several seconds on a mobile connection. */
.upload-progress {
  margin-top: var(--space-2);
}

.upload-progress__track {
  height: 10px;
  border-radius: 999px;
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  overflow: hidden;
}

.upload-progress__fill {
  height: 100%;
  width: 0%;
  background: var(--color-accent);
  border-radius: 999px;
  transition: width 0.15s ease;
}

.upload-progress__label {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}

/* ---------------------------------------------------------------------------
   Ambient connectivity indicator (2026-08-02 HCI fix) — see
   public/js/connectivity-status.js for the full reasoning. Bottom-anchored so
   it never competes with the sticky top header or the top-centred toast stack,
   and pointer-events:none so it can never intercept a tap meant for content
   underneath it (it's purely informational — there's nothing to click).
   --------------------------------------------------------------------------- */
.connectivity-status {
  position: fixed;
  left: 50%;
  bottom: var(--space-3);
  transform: translateX(-50%);
  z-index: 900;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: min(92vw, 30rem);
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(180, 120, 10, 0.35);
  background: #fffaf0;
  color: #7c4a03;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(24, 38, 52, 0.16);
  pointer-events: none;
}

/* The native `hidden` attribute's implicit display:none loses to the display:flex
   above (author styles beat the UA stylesheet regardless of specificity) — this
   app has hit that exact trap before with .notification-dropdown and the
   daily-report editor's [data-when] elements. Force it back explicitly. */
.connectivity-status[hidden] {
  display: none;
}

.connectivity-status__dot {
  flex: 0 0 auto;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #b4780a;
}
