/* ============================================================================
 * JM Connect — Brand & component system
 *
 * JM Connect wears JM Inc's own website (jm-inc.us): the same two typefaces (Roboto Condensed for headings, buttons and
 * labels; Poppins for text), the same gold (#C2A466) and charcoal (#38383B) on white, black and light grey, square corners,
 * flat solid fields, and NO icons or emoji: words do the work, as they do on the site.
 *
 * Measured from the live site, 2026-10-03: primary button = gold fill, Roboto Condensed 700 16px, 0 radius, 19px padding;
 * h1-h3 Roboto Condensed 400; body Poppins; section bands black / white / #F7F7F7. The site sets white text on its gold
 * buttons (2.4:1); the app uses black on gold (8.8:1) because crews read it in sun. Flip --on-brand to #fff for the site look.
 *
 * RE-THEMING happens ONLY in the :root block. The schedule status colours (--st-*) are deliberately NOT brand colours: they
 * are the crews' colour code for a job's state, not decoration.
 *
 * Loaded on every page. Tap targets >=44px, touch inputs >=16px (no iOS zoom).
 * ========================================================================== */

:root {
  /* JM Inc brand (jm-inc.us) */
  --brand:      #c2a466;   /* the site's gold: primary buttons, active marker, focus */
  --brand-hover:#b0924f;
  --brand-t:    #f6f1e5;   /* a tint of the gold, for selected rows and soft highlights */
  --on-brand:   #000000;   /* text on a gold fill (the site uses white; see the header note) */
  --accent:     #7a5f2f;   /* the gold darkened until it reads as TEXT on white (6:1): links, small labels */
  --charcoal:   #38383b;   /* the site's dark accent */

  /* Ink & steel (neutral: the site has no blue anywhere) */
  --ink:        #38383b;
  --ink-2:      #000000;
  --ink-3:      #55555a;
  --shell:      #000000;   /* the rail and the drawer */
  --shell-2:    #141414;
  --steel:      #6b6b70;
  --steel-2:    #9a9aa0;
  --steel-3:    #c9c9cd;

  /* Surfaces */
  --bg:         #f7f7f7;   /* the site's light band */
  --surface:    #ffffff;
  --surface-2:  #f3f3f3;   /* solid fields and quiet panels */
  --border:     #e2e2e2;
  --border-2:   #c9c9c9;

  /* Text */
  --text:       #111111;
  --muted:      #5f5f64;
  --faint:      #8e8e93;

  /* Schedule status palette — doubles as the TeamGantt color code */
  --st-red:     #dc2626;   /* Emergency / high priority */
  --st-yellow:  #eab308;   /* Locked start date */
  --st-green:   #16a34a;   /* Ready, schedule flexible */
  --st-blue:    #2563eb;   /* Tentative / bid */
  --st-gray:    #9ca3af;   /* Potential / not yet awarded */

  --st-red-t:    #fef2f2;
  --st-yellow-t: #fefce8;
  --st-green-t:  #f0fdf4;
  --st-blue-t:   #eff6ff;
  --st-gray-t:   #f3f4f6;

  /* Feedback */
  --ok:    #11794a;
  --warn:  #d99b0b;
  --danger:#c0392f;

  /* Square, like the site's buttons, fields and cards. (Tokens, so one edit would round everything again.) */
  --radius:    0;
  --radius-lg: 0;
  --radius-sm: 0;
  --radius-pill: 0;

  --shadow:    0 1px 3px rgba(0,0,0,.08);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.22), 0 2px 8px rgba(0,0,0,.12);

  --font-sans: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-cond: 'Roboto Condensed', 'Arial Narrow', 'Helvetica Neue', Arial, sans-serif;

  --topbar-h: 60px;
  --rail-w: 240px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden; /* clip the off-screen slide-out nav drawer so no page scrolls sideways */
}

h1, h2, h3, .cond {
  font-family: var(--font-cond);
  font-weight: 700;
  letter-spacing: .005em;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------- Topbar / chrome ---------------------------- */
/* White, like the website's header, with a hairline under it. Text buttons, no icons. */
header.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 4px;
  height: var(--topbar-h);
  padding: 0 14px;
  background: #fff;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0,0,0,.02);
}
header.topbar a.home {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none;
}
header.topbar a.home img { height: 32px; width: auto; display: block; }
header.topbar .wordmark {
  font-family: var(--font-cond);
  font-weight: 700; font-size: 18px; letter-spacing: .02em;
  text-transform: uppercase; color: var(--text);
}
header.topbar .wordmark .light { color: var(--steel); }
header.topbar .module {
  font-family: var(--font-cond);
  font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  font-size: 13px; color: var(--muted);
  padding-left: 14px; margin-left: 8px;
  border-left: 1px solid var(--border-2);
}
header.topbar .spacer { flex: 1; }
.jm-offline { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: #7a4a00; background: #fff4d6; border: 1px solid #e3b341; padding: 3px 10px; margin-left: 10px; white-space: nowrap; }
.jm-offline[hidden] { display: none; }
/* Neutral loading placeholder — pages show this (not their empty state) until jmHydrated(). */
.jm-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 30px 16px; color: var(--muted); font-weight: 600; }
.jm-loading::before { content: ''; width: 16px; height: 16px; border: 2px solid var(--border-2); border-top-color: var(--brand); border-radius: 50%; animation: jm-spin .7s linear infinite; }
@keyframes jm-spin { to { transform: rotate(360deg); } }

.jm-userchip {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted); margin-right: 6px;
}
.jm-userchip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st-green); }
.jm-userchip .dot.off { background: var(--steel-2); }
.jm-userchip a { color: var(--accent); font-size: 13px; font-weight: 600; }

/* The topbar buttons are words (Alerts, Add, Feedback, Menu), set the way the website sets its menu. */
.jm-navbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; min-width: 44px; padding: 0 12px;
  border: none; background: transparent; color: var(--text); cursor: pointer;
  font-family: var(--font-cond); font-weight: 700; font-size: 16px; letter-spacing: .02em;
  border-bottom: 2px solid transparent; border-radius: 0; text-decoration: none;
}
.jm-navbtn:hover { color: var(--accent); text-decoration: none; border-bottom-color: var(--brand); }
.jm-navbtn.jm-bell { position: relative; text-decoration: none; }
.jm-badge { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; background: var(--st-red); color: #fff; font-family: var(--font-sans); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
/* Feedback-reply pip: GREEN, so the two counters read differently at a glance. Green-700 keeps white digits legible in glare. */
.jm-badge-fb { background: #15803d; }
.jm-nav-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  opacity: 0; pointer-events: none; transition: opacity .16s ease; z-index: 98;
}
.jm-nav-overlay.open { opacity: 1; pointer-events: auto; }
.jm-nav-drawer {
  position: fixed; top: 0; right: 0; height: 100%; max-height: 100dvh; width: 300px; max-width: 86vw;
  background: var(--shell); color: #fff; z-index: 99;
  transform: translateX(100%); transition: transform .18s ease, visibility 0s linear .18s; visibility: hidden;
  display: flex; flex-direction: column; padding: 14px 0;
  box-shadow: -8px 0 30px rgba(0,0,0,.4);
  overflow-y: auto; -webkit-overflow-scrolling: touch; /* long menus stay reachable on short screens */
}
.jm-nav-drawer.open { transform: translateX(0); visibility: visible; transition: transform .18s ease, visibility 0s; }
.jm-nav-drawer .head {
  padding: 6px 20px 14px; border-bottom: 1px solid rgba(255,255,255,.14);
  font-family: var(--font-cond); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--brand);
}
.jm-nav-drawer a.link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; color: #ececec; text-decoration: none;
  font-size: 15px; min-height: 44px; border-left: 3px solid transparent;
}
.jm-nav-drawer a.link:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.jm-nav-drawer a.link.active { background: rgba(255,255,255,.1); color: #fff; font-weight: 600; border-left-color: var(--brand); }
.jm-nav-drawer .jm-nav-group { padding: 16px 20px 4px; font-family: var(--font-cond); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--brand); }
/* Drawer footer: who's signed in + Sign out. On phones this is the ONLY home for sign-out —
 * the topbar identity chip is hidden ≤600px (see the media rule below) so the buttons always fit the viewport. */
.jm-nav-drawer .jm-nav-foot { border-top: 1px solid rgba(255,255,255,.14); margin-top: auto; padding: 12px 20px 4px; font-size: 13px; color: var(--steel-3); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.jm-nav-drawer .jm-nav-foot a { color: #fff; min-height: 44px; display: inline-flex; align-items: center; }
.jm-nav-drawer .jm-nav-foot .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st-green); flex: none; }
.jm-nav-drawer .jm-nav-foot .dot.off { background: var(--steel); }

/* -------------------------------- Layout -------------------------------- */
.page { max-width: 1200px; margin: 0 auto; padding: 22px 18px 64px; }
.page-head { display: flex; align-items: baseline; gap: 14px; margin: 6px 0 20px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.page-head h1 { margin: 0; font-size: 30px; font-weight: 700; line-height: 1.15; }
.page-head .sub { color: var(--muted); font-size: 14px; }

/* -------------------------------- Buttons ------------------------------- */
/* The website's buttons: square, Roboto Condensed bold, no uppercase. Primary is gold; the rest are outlined. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 8px 20px;
  border: 1px solid var(--ink); border-radius: var(--radius-sm);
  background: transparent; color: var(--ink);
  font-family: var(--font-cond); font-size: 16px; font-weight: 700; letter-spacing: .02em; line-height: 1.2; cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover { background: var(--ink); color: #fff; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--on-brand); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #a02e25; border-color: #a02e25; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--brand-t); color: var(--accent); }
.btn-sm { min-height: 34px; padding: 5px 13px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { background: transparent; color: var(--ink); }
.btn-primary:disabled:hover { background: var(--brand); color: var(--on-brand); }
/* Touch devices: small buttons stay compact on desktop (fine pointer) but meet the 44px
   tap-target rule on phones/tablets. Applies app-wide so every .btn-sm is field-friendly. */
@media (pointer: coarse) { .btn-sm { min-height: 44px; padding-top: 8px; padding-bottom: 8px; } }

/* --------------------------------- Cards -------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 18px;
}
.card + .card { margin-top: 14px; }

/* --------------------------------- Tags --------------------------------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600;
  background: var(--st-gray-t); color: var(--ink-3);
}
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 0; font-family: var(--font-cond); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.badge.admin { background: var(--ink); color: #fff; }
.badge.member { background: var(--st-gray-t); color: var(--ink-3); }

/* Status chips (schedule color code) */
.st-chip { display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:600; }
.st-chip .sw { width:11px; height:11px; border-radius:0; }
.sw-red{background:var(--st-red)} .sw-yellow{background:var(--st-yellow)}
.sw-green{background:var(--st-green)} .sw-blue{background:var(--st-blue)} .sw-gray{background:var(--st-gray)}

/* -------------------------------- Inputs -------------------------------- */
/* Solid fields, square, like the website's forms. */
input, select, textarea {
  font: inherit; font-size: 16px; /* >=16px: no iOS zoom */
  padding: 10px 12px; border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px rgba(194,164,102,.35);
}
/* Keyboard focus ring for every interactive control (nav tiles, buttons, links, custom
   role=button rows) — not just form fields. Mouse/touch clicks don't trigger :focus-visible. */
.btn:focus-visible, a:focus-visible, button:focus-visible, .tile:focus-visible,
[role="button"]:focus-visible, [tabindex]:focus-visible, summary:focus-visible {
  outline: none; box-shadow: 0 0 0 3px rgba(194,164,102,.65); border-radius: 0;
}
/* Respect reduced-motion for vestibular comfort — kill transitions/animations/hover lifts. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .tile:hover, .card:hover { transform: none !important; }
}
label.fld { display: block; margin: 10px 0; }
label.fld > span { display: block; font-family: var(--font-cond); font-size: 14px; font-weight: 700; letter-spacing: .02em; color: var(--muted); margin-bottom: 4px; }

/* -------------------------------- Modals -------------------------------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(20,20,20,.5);
  display: none; align-items: center; justify-content: center; z-index: 80; padding: 16px;
}
.modal-bg.open { display: flex; }
.modal {
  position: relative; /* anchor the top-right × */
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.3); width: 100%; max-width: 520px;
  max-height: 90vh; overflow: auto; padding: 20px;
}
.modal h2 { margin: 0 0 12px; font-size: 20px; }
/* Standard top-right close affordance for any card/detail modal (injected by jmAddModalClose as the
   panel's FIRST child). STICKY + float so it stays pinned to the top-right and visible while the
   modal body scrolls; the negative bottom margin keeps it from consuming a line (the title flows up
   beside it). 44×44 on every device (incl. desktop mouse) so it always meets the tap-target rule. */
.modal-x {
  position: sticky; top: 4px; float: right;
  margin: -4px -4px -44px 8px;
  width: 44px; height: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: var(--surface); color: var(--muted);
  font-size: 24px; line-height: 1; border-radius: var(--radius); cursor: pointer; z-index: 3;
}
.modal-x:hover { background: var(--surface-2); color: var(--text); }
.modal-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* -------------------------------- Toasts -------------------------------- */
/* z-index 320: toasts must be visible above EVERY surface — the doc viewer (200), the daily-report
 * lightbox (300), and the shared image lightbox (310) were swallowing upload/save confirmations. */
.jm-toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 320; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }

/* Shared image lightbox (window.jmImageLightbox) — replaces open-in-new-tab for attachment photos
 * so there is always a way back (× / backdrop / Esc). z 310: above the doc viewer + dr-lightbox,
 * below toasts. */
#jm-lb { position: fixed; inset: 0; z-index: 310; background: rgba(10,10,10,.94); display: flex; align-items: center; justify-content: center; }
#jm-lb .jm-lb-img { max-width: 94vw; max-height: 88vh; object-fit: contain; border-radius: var(--radius-sm); }
#jm-lb .jm-lb-x { position: absolute; top: 10px; right: 12px; width: 48px; height: 48px; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.6); text-shadow: 0 1px 4px rgba(0,0,0,.9); color: #fff; font-size: 20px; border-radius: var(--radius-pill); cursor: pointer; }
#jm-lb .jm-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 64px; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.6); text-shadow: 0 1px 4px rgba(0,0,0,.9); color: #fff; font-size: 34px; line-height: 1; cursor: pointer; border-radius: var(--radius); }
#jm-lb .jm-lb-prev { left: 8px; } #jm-lb .jm-lb-next { right: 8px; }
#jm-lb .jm-lb-count { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 13px; font-weight: 600; background: rgba(0,0,0,.4); padding: 4px 12px; border-radius: var(--radius-pill); }
@media (pointer: coarse) { #jm-lb .jm-lb-x { width: 52px; height: 52px; } }

/* ---- shared card kit (labels + checklists) — jm-cardkit.js K.mount ---- */
.ck-members { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 8px; }
.ck-mem { display: inline-flex; align-items: center; gap: 3px; width: 30px; height: 30px; justify-content: center; border-radius: var(--radius-pill); background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; text-transform: uppercase; position: relative; }
.ck-mem .ck-rm-mem { position: absolute; top: -5px; right: -5px; border: 0; background: #dc2626; color: #fff; border-radius: var(--radius-pill); width: 15px; height: 15px; line-height: 13px; font-size: 11px; cursor: pointer; padding: 0; }
.ck-add-mem { border: 1px dashed var(--border-2, #d4d4d4); background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; border-radius: var(--radius-pill); padding: 4px 10px; min-height: 30px; cursor: pointer; }
.ck-add-mem:hover { color: var(--ink); border-color: var(--muted); }
.ck-mem-list { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow: auto; }
.ck-mem-opt { display: flex; align-items: center; gap: 7px; font-size: 14px; padding: 5px 2px; cursor: pointer; }
.ck-face .ck-mem-dot { width: 18px; height: 18px; border-radius: var(--radius-pill); background: var(--ink); color: #fff; font-size: 9px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; text-transform: uppercase; }
@media (pointer: coarse) { .ck-mem, .ck-add-mem { min-height: 40px; } .ck-mem { width: 40px; height: 40px; } .ck-mem-opt { padding: 8px 2px; } }
.ck-labels { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 8px; }
.ck-chip { display: inline-flex; align-items: center; gap: 4px; color: #fff; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: var(--radius-pill); line-height: 1.4; min-height: 22px; }
.ck-chip .ck-rm-lbl { border: 0; background: rgba(255,255,255,.35); color: #fff; border-radius: var(--radius-pill); width: 16px; height: 16px; line-height: 14px; font-size: 12px; cursor: pointer; padding: 0; }
.ck-add-lbl { border: 1px dashed var(--border-2, #d4d4d4); background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; border-radius: var(--radius-pill); padding: 3px 10px; min-height: 26px; cursor: pointer; }
.ck-add-lbl:hover { color: var(--ink); border-color: var(--muted); }
.ck-prog { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.ck-bar { flex: 1; height: 6px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.ck-bar i { display: block; height: 100%; background: var(--st-green, #16a34a); transition: width .15s; }
.ck-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; cursor: pointer; }
.ck-item input { width: 20px; height: 20px; flex: none; }
.ck-item span { flex: 1; overflow-wrap: anywhere; }
.ck-item.done span { text-decoration: line-through; color: var(--muted); }
.ck-item .ck-rm { border: 0; background: transparent; color: var(--faint); font-size: 16px; cursor: pointer; padding: 0 4px; }
.ck-item .ck-rm:hover { color: #b91c1c; }
.ck-add { display: flex; gap: 6px; margin-top: 6px; }
.ck-add input { flex: 1; min-width: 0; font-size: 16px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
.ck-add button { flex: none; min-height: 40px; padding: 0 12px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); font-weight: 700; cursor: pointer; color: var(--ink); }
@media (pointer: coarse) { .ck-item input { width: 24px; height: 24px; } .ck-add button, .ck-add-lbl { min-height: 44px; } .ck-item .ck-rm { padding: 0 10px; } }
.ck-pal { position: absolute; z-index: 340; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 10px; width: 210px; }
.ck-pal .ck-pal-text { width: 100%; font-size: 16px; padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; background: var(--surface); color: var(--ink); }
.ck-pal-colors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ck-pal-c { height: 30px; border: 0; border-radius: var(--radius-sm); cursor: pointer; }
/* card-face chip strip (compact, no remove button) reuses .ck-chip via a .ck-face wrapper */
.ck-face { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.ck-face .ck-dot { width: 30px; height: 8px; border-radius: var(--radius-pill); }
/* card comments — a Trello-style thread (jm-cardkit K.mount, opts.comments). Shared across boards. */
.ck-comments { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.ck-cm-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-bottom: 8px; }
.ck-cm { display: flex; gap: 8px; margin-bottom: 10px; }
.ck-cm-av { flex: none; width: 28px; height: 28px; border-radius: var(--radius-pill); background: var(--ink); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; text-transform: uppercase; }
.ck-cm-body { flex: 1; min-width: 0; }
.ck-cm-meta { font-size: 12px; color: var(--muted); }
.ck-cm-meta b { color: var(--ink); font-weight: 700; }
.ck-cm-text { font-size: 14px; color: var(--ink); overflow-wrap: anywhere; white-space: pre-wrap; margin-top: 1px; }
.ck-cm-empty { font-size: 13px; color: var(--faint); margin-bottom: 8px; }
.ck-cm-add { display: flex; gap: 6px; align-items: flex-end; }
.ck-cm-add textarea { flex: 1; min-width: 0; font-size: 16px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); resize: vertical; font-family: inherit; }
.ck-cm-add button { flex: none; min-height: 40px; padding: 0 14px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); font-weight: 700; cursor: pointer; color: var(--ink); }
.ck-cm-add button:hover { border-color: var(--muted); }
@media (pointer: coarse) { .ck-cm-add button { min-height: 44px; } }
/* Custom fields ("Details") — your own labeled fields on a card (jm-cardkit opts.customFields). */
.ck-fields { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.ck-fld-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-bottom: 8px; }
.ck-fld { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ck-fld-label { flex: 0 0 34%; max-width: 34%; font-size: 13px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ck-fld-val { flex: 1; font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }
.ck-fld-input { flex: 1; min-width: 0; font-size: 16px; padding: 6px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
.ck-fld-rm { flex: none; border: 0; background: transparent; color: var(--faint); font-size: 16px; cursor: pointer; padding: 0 4px; }
.ck-fld-rm:hover { color: #b91c1c; }
.ck-fld-add { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.ck-fld-add input { flex: 1; min-width: 90px; font-size: 16px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
.ck-fld-add button { flex: none; min-height: 40px; padding: 0 12px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); font-weight: 700; cursor: pointer; color: var(--ink); }
.ck-fld-add button:hover { border-color: var(--muted); }
@media (pointer: coarse) { .ck-fld-add button { min-height: 44px; } }
/* Activity feed — read-only, bounded (jm-cardkit opts.activity). */
.ck-activity { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.ck-act-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-bottom: 8px; }
.ck-act { font-size: 13px; color: var(--ink); margin-bottom: 5px; line-height: 1.4; overflow-wrap: anywhere; }
.ck-act .ck-act-when { color: var(--faint); font-size: 12px; }
.ck-act-empty { font-size: 13px; color: var(--faint); }
.jm-toast {
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--radius-pill);
  font-size: 14px; box-shadow: var(--shadow); max-width: 90vw;
  animation: jmToastIn .18s ease; pointer-events: auto;
}
.jm-toast.ok    { background: #14532d; }
.jm-toast.error { background: #7f1d1d; }
.jm-toast.warn  { background: #78350f; }
@keyframes jmToastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ----------------------------- Sync progress ---------------------------- */
#jm-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--brand); z-index: 200; transition: width .2s ease, opacity .3s ease;
}

/* --------------------------------- Utils -------------------------------- */
.row { display: flex; gap: 12px; align-items: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.center { text-align: center; }

/* ----------------------------- attachments ----------------------------- */
.jm-atts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.jm-atts .att { position: relative; width: 64px; height: 64px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.jm-atts .att img { width: 100%; height: 100%; object-fit: cover; }
.jm-atts .att .doc { font-size: 10px; padding: 4px; text-align: center; word-break: break-all; color: var(--muted); }
.jm-atts .att .up { position: absolute; inset: 0; background: rgba(0,0,0,.45); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.jm-atts .att .rm { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff; font-size: 14px; line-height: 1; cursor: pointer; padding: 0; }
.jm-atts .addbtn { width: 64px; height: 64px; min-height: 44px; border-radius: var(--radius); border: 1px dashed var(--border-2); background: var(--surface); display: flex; align-items: center; justify-content: center; font-family: var(--font-cond); font-size: 14px; font-weight: 700; letter-spacing: .02em; color: var(--ink); cursor: pointer; }
.jm-atts .addbtn:hover { background: var(--surface-2); }

/* ------------------------------ doc viewer ------------------------------ */
.jm-viewer { position: fixed; inset: 0; z-index: 200; background: #1a1a1a; display: flex; flex-direction: column; }
.bv-bar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; background: #111; color: #fff; overflow-x: auto; flex: none; }
.bv-bar .bv-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
.bv-sp { flex: 1; }
.bv-btn { min-width: 44px; height: 44px; padding: 0 12px; border: none; background: #262626; color: #fff; border-radius: var(--radius-sm); font-family: var(--font-cond); font-size: 15px; font-weight: 700; letter-spacing: .02em; cursor: pointer; flex: none; white-space: nowrap; }
.bv-textinput { font-size: 16px; padding: 7px 9px; border-radius: var(--radius-sm); border: 2px solid var(--accent); background: #fff; color: #111; width: 210px; max-width: 60vw; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
.bv-btn.on { background: var(--brand); }
.bv-btn.bv-save { background: var(--st-green); font-size: 14px; padding: 0 12px; font-weight: 700; }
.bv-colors { display: inline-flex; gap: 3px; }
.bv-color { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #444; cursor: pointer; padding: 0; }
.bv-color.on { border-color: #fff; }
.bv-pages { flex: 1; overflow: auto; padding: 12px; text-align: center; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
.bv-page { position: relative; display: inline-block; margin: 0 auto 12px; box-shadow: 0 4px 20px rgba(0,0,0,.5); background: #fff; } /* no max-width: allow zoom past fit-width, .bv-pages scrolls */
.bv-page canvas.bv-overlay ~ canvas, .bv-page > canvas:first-child { display: block; width: 100%; height: auto; }
.bv-overlay { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-x pan-y; }
.bv-pages.drawing .bv-overlay { touch-action: none; cursor: crosshair; }
.bv-loading { color: #ccc; padding: 40px; }

/* ---------------------------- job documents ---------------------------- */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.doc-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; box-shadow: var(--shadow-sm); }
.doc-card .doc-del { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: none; background: rgba(0,0,0,.55); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; padding: 0; }
.doc-card .thumb { height: 96px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-family: var(--font-cond); font-size: 15px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--steel); }
.doc-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-card .meta { padding: 8px 10px; }
.doc-card .meta .nm { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-card .meta .sub { font-size: 11px; color: var(--muted); }
.doc-card .badge2 { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: var(--radius-pill); background: var(--st-blue-t); color: #1e40af; margin-top: 3px; }
.doc-card .cached { color: var(--st-green); }

/* Access-denied overlay for permission gating */
.jm-denied {
  position: fixed; inset: var(--topbar-h) 0 0 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center; z-index: 70; padding: 24px;
  overflow: auto;
}
.jm-denied .box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; max-width: 420px; text-align: center; box-shadow: var(--shadow); }

@media (max-width: 600px) {
  .page { padding: 14px 12px 60px; }
  .page-head h1 { font-size: 22px; }
  header.topbar .wordmark { font-size: 16px; }
  header.topbar .module { display: none; }
  /* Phones: the fixed-width topbar pieces (wordmark + name chip + FOUR buttons) exceeded
   * narrow viewports — flexbox can't shrink them, so the FEEDBACK and MENU buttons were pushed
   * clean off-screen (427px layout on a 375px phone; "David has no feedback button"). Hide the
   * identity chip here (it moves to the nav-drawer footer — sign-out stays reachable) and
   * tighten gaps: 20 + 80 logo + 5×6 gaps + 4×44 buttons = 306px, safe down to 320px. */
  header.topbar { gap: 0; padding: 0 6px 0 10px; }
  header.topbar .jm-userchip { display: none; }
  /* Four word buttons (Alerts, Add, Feedback, Menu) + the logo must fit 320px: the name beside the logo drops away on phones
   * (the logo stays) and the buttons tighten. 44px tap height is kept. */
  header.topbar .jm-wm { display: none; }
  .jm-navbtn { padding: 0 8px; font-size: 15px; }
  /* The Offline pill must not re-blow the width budget (offline is exactly when crews are on
   * phones): float it just below the bar instead of occupying flex space in it. */
  .jm-offline { position: absolute; top: calc(var(--topbar-h) + 4px); right: 8px; margin-left: 0; z-index: 49; }
}

/* (There is no icon system. JM Connect's controls are words, as on jm-inc.us.) */

/* Quick-add menu (the topbar "Add" button — fast field capture). Words only. */
.jm-qa-pop{position:fixed;top:calc(var(--topbar-h) + 4px);right:8px;z-index:180;background:var(--surface);border:1px solid var(--border-2);border-radius:0;box-shadow:var(--shadow-lg);padding:4px;display:flex;flex-direction:column;gap:2px;min-width:260px;max-width:calc(100vw - 16px)}
.jm-qa-item{display:flex;align-items:center;gap:11px;padding:11px 14px;background:none;border:0;border-left:3px solid transparent;border-radius:0;cursor:pointer;text-align:left;color:var(--ink);width:100%;min-height:48px}
.jm-qa-item:hover,.jm-qa-item:focus{background:var(--brand-t);border-left-color:var(--brand);outline:none}
.jm-qa-item .tx b{display:block;font-family:var(--font-cond);font-size:16px;font-weight:700;letter-spacing:.02em}
.jm-qa-item .tx small{display:block;font-size:12px;color:var(--muted);margin-top:1px}

/* Pull-to-refresh indicator (touch) */
#jm-ptr{position:fixed;top:0;left:50%;transform:translateX(-50%);z-index:150;display:none;align-items:center;gap:7px;padding:7px 14px;background:var(--surface);border:1px solid var(--border-2);border-radius:0;box-shadow:var(--shadow-sm);font-family:var(--font-cond);font-size:14px;font-weight:700;color:var(--muted);pointer-events:none}
#jm-ptr.show{display:inline-flex}
#jm-ptr.armed{color:var(--ink)}
#jm-ptr.busy{color:var(--accent)}

/* Voice dictation and text tidy-up on a notes box (jm-voice.js). Field crews would rather talk than thumb-type a report.
   The wrap is position:relative so the buttons sit bottom-right inside the box; hidden where the browser has no speech API. */
.jm-notes-wrap{position:relative}
/* leave room at the bottom so a full line of text never renders under the buttons (right corner) */
.jm-notes-wrap textarea{width:100%;padding-bottom:52px}
@media (pointer:coarse){.jm-notes-wrap textarea{padding-bottom:56px}}
.jm-mic,.jm-polish{position:absolute;bottom:8px;min-width:44px;height:36px;padding:0 12px;border-radius:0;border:1px solid var(--ink);background:var(--surface);font-family:var(--font-cond);font-size:14px;font-weight:700;letter-spacing:.02em;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--ink)}
.jm-mic{right:8px}
.jm-polish{right:96px}
.jm-mic:hover,.jm-polish:hover{background:var(--ink);color:#fff}
@media (pointer:coarse){.jm-mic,.jm-polish{height:44px}.jm-polish{right:100px}}
.jm-mic.rec{background:#dc2626;border-color:#dc2626;color:#fff;animation:jm-mic-pulse 1s infinite}
@keyframes jm-mic-pulse{0%,100%{opacity:1}50%{opacity:.55}}
.jm-polish.busy{opacity:.55;cursor:default;animation:jm-mic-pulse 1s infinite}
.jm-polish-undo{font-size:12px;color:var(--muted);margin-top:6px;display:flex;align-items:center;gap:4px}
.jm-polish-undo-btn{border:0;background:transparent;color:var(--accent);font-weight:700;cursor:pointer;padding:3px 6px;font-size:12px;text-decoration:underline}
@media (pointer:coarse){.jm-polish-undo-btn{min-height:36px}}

/* ============================================================================
 * The mark: JM Inc's diamond logo (it is gold and brown, so it sits on white), with the name set in real text beside it.
 * ========================================================================== */
.jm-plate { display: inline-flex; align-items: center; justify-content: center; flex: none; background: #fff; padding: 3px 5px; }
.jm-plate img { height: 36px; width: auto; display: block; }
.jm-wm { line-height: 1; min-width: 0; }
.jm-wm .n { display: block; font-family: var(--font-cond); font-weight: 700; letter-spacing: .08em; font-size: 18px; color: var(--text); white-space: nowrap; }
.jm-wm .s { display: block; font-family: var(--font-cond); font-weight: 700; letter-spacing: .34em; font-size: 10px; color: var(--accent); margin-top: 4px; white-space: nowrap; }
header.topbar a.home { padding: 4px; }
@media (max-width: 360px) { header.topbar .jm-wm { display: none; } }   /* keep every button on a 320px screen */
header.topbar a.home:hover { background: transparent; text-decoration: none; }
/* the same lockup on a light page (sign-in, home, error pages) */
.jm-lockup { display: inline-flex; align-items: center; gap: 14px; color: var(--text); text-align: left; }
.jm-lockup img { height: 84px; width: auto; display: block; }
.jm-lockup .n { display: block; font-family: var(--font-cond); font-weight: 700; letter-spacing: .08em; font-size: 30px; color: var(--text); line-height: 1; }
.jm-lockup .s { display: block; font-family: var(--font-cond); font-weight: 700; letter-spacing: .34em; font-size: 12px; color: var(--accent); margin-top: 8px; line-height: 1; }
.jm-lockup.center { display: flex; justify-content: center; }

/* ============================================================================
 * The left rail -- the main menu on wide screens (>= 1080px). Below that the slide-out drawer is the menu. Same groups,
 * same gating. It can be hidden with a mouse (the choice is kept per device); "Menu" in the top bar brings it back.
 * Black with gold group titles and a gold marker on the current page, like the website's footer. Words only.
 * z-index 55: above the page and its sticky headers, BELOW every modal (60+), so a dialog covers it.
 * ========================================================================== */
.jm-rail {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--rail-w); z-index: 55;
  background: var(--shell);
  color: #fff; display: none; flex-direction: column;
  box-shadow: 4px 0 24px rgba(0,0,0,.18);
}
.jm-rail [hidden] { display: none !important; }   /* a.rail-link sets display:flex, which would otherwise beat the hidden attribute */
.jm-rail .rail-top { padding: 16px 16px 12px; display: flex; align-items: center; gap: 10px; position: relative; border-bottom: 1px solid rgba(255,255,255,.14); }
.jm-rail .rail-home { flex: 1 1 auto; min-width: 0; display: block; padding: 2px; margin: -2px; color: #fff; }
.jm-rail .rail-home:hover { text-decoration: none; }
.jm-rail .rail-home:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; box-shadow: none; }
.jm-rail .rail-lockup { display: flex; align-items: center; gap: 10px; min-width: 0; }
.jm-rail .rail-wordmark { flex: 1 1 auto; min-width: 0; }
.jm-rail .jm-wm .n { color: #fff; }
.jm-rail .jm-wm .s { color: var(--brand); }
.jm-rail .rail-toggle {
  min-height: 30px; flex: none; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,.28); background: transparent; border-radius: 0;
  color: #fff; cursor: pointer; font-family: var(--font-cond); font-size: 13px; font-weight: 700; letter-spacing: .04em;
}
.jm-rail .rail-toggle:hover { background: rgba(255,255,255,.12); }
.jm-rail .rail-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; box-shadow: none; }
.jm-rail .rail-scroll { flex: 1; overflow-y: auto; padding: 2px 0 10px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.28) transparent; }
.jm-rail .rail-scroll::-webkit-scrollbar { width: 6px; }
.jm-rail .rail-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.28); }
.jm-rail .rail-group { padding: 18px 20px 6px; font-family: var(--font-cond); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--brand); }
.jm-rail a.rail-link {
  display: flex; align-items: center; gap: 11px; min-height: 38px;
  padding: 7px 16px 7px 20px; color: #e4e4e4; text-decoration: none;
  font-size: 14px; font-weight: 400; border-left: 3px solid transparent;
}
.jm-rail a.rail-link:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.jm-rail a.rail-link:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; box-shadow: none; border-radius: 0; }
.jm-rail a.rail-link.active { background: rgba(255,255,255,.1); color: #fff; font-weight: 600; border-left-color: var(--brand); }
.jm-rail .rail-bottom { border-top: 1px solid rgba(255,255,255,.14); padding: 6px 0 8px; }
.jm-rail .rail-bottom .jm-nav-foot { padding: 6px 20px 2px; font-size: 13px; color: var(--steel-3); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.jm-rail .rail-bottom .jm-nav-foot a { color: #fff; min-height: 36px; display: inline-flex; align-items: center; }
.jm-rail .rail-bottom .jm-nav-foot .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st-green); flex: none; }
.jm-rail .rail-bottom .jm-nav-foot .dot.off { background: var(--steel); }
.jm-rail .rail-bottom .jm-fv-row { flex: 1 1 100%; margin-top: 8px; }
.jm-nav-drawer .jm-fv-row { flex: 1 1 100%; margin-top: 10px; }

@media (min-width: 1080px) {
  body.jm-has-rail .jm-rail { display: flex; }
  body.jm-has-rail { padding-left: var(--rail-w); }
  body.jm-has-rail header.topbar { padding-left: 18px; }
  body.jm-has-rail header.topbar a.home { display: none; }      /* the rail carries the mark */
  body.jm-has-rail #jm-navbtn { display: none; }                /* and the menu */
}
/* The field-view banner is fixed to the bottom of the screen: keep it off the rail. */
@media (min-width: 1080px) { body.jm-has-rail #jm-fieldview-bar { left: var(--rail-w); } body.jm-has-rail .jm-denied { left: var(--rail-w); } }

@media (pointer: coarse) {
  .jm-rail a.rail-link { min-height: 44px; }
  .jm-rail .rail-bottom .jm-nav-foot a { min-height: 44px; }
  .jm-rail .rail-toggle { display: none; }   /* touch keeps the menu open */
}

/* -- hidden (mouse and keyboard only): the rail goes away and the top bar's Menu button brings it back ------------ */
@media (min-width: 1080px) and (hover: hover) and (pointer: fine) {
  body.jm-has-rail.jm-rail-collapsed .jm-rail { display: none; }
  body.jm-has-rail.jm-rail-collapsed { padding-left: 0; }
  body.jm-has-rail.jm-rail-collapsed header.topbar a.home { display: flex; }
  body.jm-has-rail.jm-rail-collapsed #jm-navbtn { display: inline-flex; }
  body.jm-has-rail.jm-rail-collapsed #jm-fieldview-bar, body.jm-has-rail.jm-rail-collapsed .jm-denied { left: 0; }
}
@media print { .jm-rail { display: none !important; } body.jm-has-rail { padding-left: 0 !important; } }
