    *,*::before,*::after { box-sizing:border-box; }
    html,body { margin:0; height:100%; }
    body { background:#F7F8FA; }
    .ico { display:inline-flex; align-items:center; justify-content:center; }
    .ico svg { display:block; }
    input.cmd, select.cmd { font-family:'Archivo',sans-serif; }
    input.cmd::placeholder { color:#A7B2BE; }
    input.cmd:focus, select.cmd:focus { border-color:#2F6FE0 !important; box-shadow:0 0 0 3px rgba(47,111,224,.12); }
    input[type=date].cmd::-webkit-calendar-picker-indicator { opacity:.45; cursor:pointer; }
    .navitem:hover { background:rgba(255,255,255,.06) !important; }
    @keyframes scrFade { from { opacity:0; } to { opacity:1; } }
    .screenfade { animation: scrFade .26s ease both; }
    .morph-clone { position:fixed; margin:0; z-index:99999; pointer-events:none; white-space:nowrap; transform-origin:0 0; font-family:'Archivo',sans-serif; }
    @keyframes mrevDown { from { opacity:0; transform:translateY(-16px); } to { opacity:1; transform:translateY(0); } }
    @keyframes mrevUp { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
    @keyframes navFade { from { opacity:0; transform:translateX(-6px); } to { opacity:1; transform:translateX(0); } }
    /* Tracker long-press (hold to add/remove a requirement) */
    .trk-cell { -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; transition:transform .12s ease, box-shadow .12s ease; }
    .trk-arming { animation: trkArm .35s ease forwards; }
    @keyframes trkArm { from { transform:scale(1); box-shadow:0 0 0 0 rgba(47,111,224,0); } 55% { box-shadow:0 0 0 3px rgba(47,111,224,.35); } to { transform:scale(1.22); box-shadow:0 0 0 4px rgba(47,111,224,.6); } }
    @keyframes trkToastIn { from { opacity:0; transform:translate(-50%,10px); } to { opacity:1; transform:translate(-50%,0); } }
    .trk-toast { animation: trkToastIn .2s ease both; }
    @media (prefers-reduced-motion: reduce) { .screenfade { animation: none; } .trk-arming { animation: none; box-shadow:0 0 0 3px rgba(47,111,224,.5); } .trk-toast { animation: none; } }
    .info-panel { max-height:0; } .info-panel.info-open { max-height:340px; }
    .col-grip { position:absolute; top:0; right:0; width:12px; height:100%; cursor:col-resize; z-index:8; touch-action:none; display:flex; align-items:center; justify-content:center; }
    .col-grip::after { content:''; width:2px; height:56%; border-radius:2px; background:#C4CCD4; transition:background .12s, height .12s; }
    .col-grip:hover::after, .col-grip:active::after { background:#2F6FE0; height:84%; }
    .prow:hover { background:#F8FAFD !important; }
    .prow:hover .openbtn { background:#2F6FE0; color:#fff; border-color:#2F6FE0; }
    .iconbtn:hover { background:#EEF2F6; }
    .delbtn:hover { background:#FDECEC !important; color:#DC2626 !important; }
    .copybtn:hover { filter:brightness(.96); }
    .actbtn:hover { background:#EEF2F6 !important; }
    .seg:hover { color:#1f2d3a; }
    .emailpre { font-family:'Archivo',-apple-system,'Segoe UI',sans-serif; font-size:13.5px; line-height:1.72; color:#28323C; white-space:pre-wrap; margin:0; }
    ::-webkit-scrollbar { width:9px; height:9px; }
    ::-webkit-scrollbar-thumb { background:#CBD3DC; border-radius:99px; border:2px solid #F7F8FA; }
    ::-webkit-scrollbar-thumb:hover { background:#A9B4C0; }

    /* =====================================================================
       RESPONSIVE LAYER — additive only. Overrides the app's inline styles
       via !important + attribute / data-screen-label selectors. No markup,
       JS, data, or logic is changed; desktop/laptop render is untouched.
       Breakpoints: 768px (tablet), 480px (phone).
       ===================================================================== */

    /* NOTE: the runtime re-serializes inline styles (": ", 0 -> 0px,
       hex -> rgb(), minmax(0,1fr) -> minmax(0px, 1fr)); selectors below
       match that serialized form. */

    /* ---------- TABLET & SMALLER (<= 768px) ---------- */
    @media (max-width:768px){
      body{ overflow-x:hidden; }

      /* Sidebar collapse is handled in JS (state.sidebarCompact / Sidebar()),
         which swaps to an icons-only rail with hover tooltips below 900px — so
         no CSS overrides for <aside> here (they used to fight the inline styles
         and crush the labels). */

      /* Reduce big horizontal page padding everywhere */
      main [style*="px 24px"]{ padding-left:14px !important; padding-right:14px !important; }
      [data-screen-label="Home"] [style*="px 24px"]{ padding-left:14px !important; padding-right:14px !important; }
      [data-screen-label="Home"] [style*="px 28px"]{ padding-left:16px !important; padding-right:16px !important; }

      /* Page header bars: stack the title above the action buttons; wrap actions */
      main [style*="padding: 15px 24px"]{ flex-direction:column !important; align-items:stretch !important; row-gap:10px; }
      main [style*="padding: 15px 24px"] > div:last-child{ flex-wrap:wrap !important; justify-content:flex-start !important; row-gap:8px; }
      /* Search / action bars: wrap controls instead of overflowing (tab bars excluded) */
      main [style*="padding: 13px 24px"]:not([style*="24px 0px"]){ flex-wrap:wrap !important; row-gap:10px; }
      /* Metric strips: wrap */
      main [style*="padding: 14px 24px"]{ flex-wrap:wrap !important; row-gap:10px; }
      main [style*="padding: 0px 28px"]{ padding-left:14px !important; padding-right:14px !important; }
      main [style*="padding-right: 28px"]{ padding-right:14px !important; }

      /* Collapse two-column page grids into a single column */
      [style*="minmax(0px, 1fr) 340px"],
      [style*="minmax(0px, 1fr) 280px"],
      [style*="300px minmax(0px, 1fr)"]{ grid-template-columns:1fr !important; }
      [data-screen-label="Project Info"] [style*="grid-template-columns: 1fr 1fr"]{ grid-template-columns:1fr !important; }
      [data-screen-label="Email Drafts"] [style*="grid-template-columns: 1fr 1fr"]{ grid-template-columns:1fr !important; }

      /* Project Info: let the right-hand column flow below the form */
      [data-screen-label="Project Info"] [style*="position: sticky"][style*="top: 0px"]{ position:static !important; }

      /* Subcontractor cards: stack company/phase/scope + contact fields */
      [style*="grid-template-columns: 1fr 160px 1fr"]{ grid-template-columns:1fr !important; }
      [style*="grid-template-columns: 1fr 1fr 150px"]{ grid-template-columns:1fr !important; }
      [data-screen-label="Subcontractors"] [style*="padding: 13px 18px"]{ flex-wrap:wrap !important; row-gap:6px; }
      /* hide the collapsed-row contact summary so the name/phase/scope/% stay clean */
      [data-screen-label="Subcontractors"] [style*="max-width: 280px"]{ display:none !important; }

      /* Email tab bar: horizontal scroll, keep buttons tappable, hide hint */
      [data-screen-label="Email Drafts"] [style*="padding: 13px 24px"]{ overflow-x:auto !important; min-width:0 !important; flex-wrap:nowrap !important; -webkit-overflow-scrolling:touch; }
      [data-screen-label="Email Drafts"] [style*="padding: 13px 24px"] > div:first-child{ flex-shrink:0 !important; }
      [data-screen-label="Email Drafts"] [style*="padding: 13px 24px"] > div[style*="margin-left: auto"]{ display:none !important; }

      /* Deliverables tab bar: horizontal scroll, keep buttons tappable */
      [data-screen-label="Deliverables"] [style*="padding: 13px 24px 0px"]{ overflow-x:auto !important; min-width:0 !important; -webkit-overflow-scrolling:touch; }
      [data-screen-label="Deliverables"] [style*="padding: 13px 24px 0px"] > button{ flex-shrink:0 !important; white-space:nowrap; }

      /* Email cards: wrap action buttons rather than overflow */
      [data-screen-label="Email Drafts"] [style*="padding: 11px 18px"]{ flex-wrap:wrap !important; row-gap:8px; }

      /* Home header + toolbar: wrap so buttons never run off screen */
      [data-screen-label="Home"] [style*="padding: 16px 28px"]{ flex-wrap:wrap !important; row-gap:10px; }
      [data-screen-label="Home"] [style*="justify-content: space-between"]{ flex-wrap:wrap !important; row-gap:10px; }

      /* Home project list: stack each row, hide the column-label header */
      [data-screen-label="Home"] [style*="grid-template-columns: minmax(0px, 1fr) 92px"]:not(.prow){ display:none !important; }
      [data-screen-label="Home"] .prow{ grid-template-columns:1fr !important; row-gap:8px; }
      [data-screen-label="Home"] .prow > div{ padding-right:0 !important; }
      [data-screen-label="Home"] .prow > div[style*="text-align: center"]{ text-align:left !important; }
      [data-screen-label="Home"] .prow > div[style*="flex-end"]{ justify-content:flex-start !important; }
    }

    /* ---------- PHONE (<= 480px) ---------- */
    @media (max-width:480px){
      main [style*="px 24px"]{ padding-left:11px !important; padding-right:11px !important; }
      [data-screen-label="Home"] [style*="px 24px"],
      [data-screen-label="Home"] [style*="px 28px"]{ padding-left:12px !important; padding-right:12px !important; }
      main [style*="padding: 15px 24px"]{ row-gap:8px; }

      /* Metric strips: 2-up grid so the numbers never run off screen */
      [data-screen-label="Project Info"] [style*="padding: 14px 24px"],
      [data-screen-label="Tracker"] [style*="padding: 14px 24px"],
      [data-screen-label="Deliverables"] [style*="padding: 14px 24px"]{
        display:grid !important; grid-template-columns:1fr 1fr !important; gap:10px 6px !important; }
      main [style*="padding: 0px 28px"][style*="border-left"]{ border-left:none !important; }

      /* Keep the click-to-copy phone numbers large and easy to tap */
      [data-screen-label="Email Drafts"] [title="Click to copy number"]{ padding:8px 14px !important; }
    }

/* Spinner for the login / loading states (cloud auth) */
@keyframes spin { from { transform:rotate(0deg); } to { transform:rotate(360deg); } }

/* Custom rounded checkbox (login "keep me signed in", etc.) — native boxes can't
   be corner-rounded, so we style an appearance:none box + draw the check. */
.tcm-check {
  appearance: none; -webkit-appearance: none; margin: 0;
  width: 18px; height: 18px; flex-shrink: 0;
  border: 1.5px solid #C4CDD6; border-radius: 6px; background: #fff;
  position: relative; cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.tcm-check:hover { border-color: #9AA7B4; }
.tcm-check:checked { background: #2F6FE0; border-color: #2F6FE0; }
.tcm-check:checked::after {
  content: ''; position: absolute; left: 5px; top: 2px;
  width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.tcm-check:focus-visible { outline: 2px solid #9DC0FF; outline-offset: 1px; }

/* Vault review-card "Details" disclosure: hide the native triangle so the
   info icon in the summary is the only marker. */
details.brain-details > summary { list-style: none; }
details.brain-details > summary::-webkit-details-marker { display: none; }
details.brain-details > summary::marker { content: ''; }
