/* ==========================================================================
   shell-frame.css — white-label frame adoption (STAGING review layer)
   Additive & reversible. Loads AFTER app.css; reuses the app's own
   FX-AD-UI-0001 design tokens (--surface/--border/--text/--gold/--radius…).
   Adds only: the new-module empty-state pattern + a projects/dashboard
   surface. Delete this file + its <link>/<script> to fully revert.
   ========================================================================== */

/* new frame screens inherit .screen shell padding; give inner content rhythm.
   Every frame screen gets the light page background — without it the dark
   body (var(--ink)) shows through and .fx-page-title renders dark-on-dark. */
section.screen[id^="frame-"] { background: var(--bg, #f7f8fa); }

.frame-wrap { padding: var(--pad-page); display: grid; gap: 16px; }
.frame-grid { display: grid; gap: 14px; }
.frame-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.frame-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) {
  .frame-grid.cols-2, .frame-grid.cols-3 { grid-template-columns: 1fr; }
}

/* empty-state: the "TBD by client / not built yet" pattern */
.frame-empty {
  border: 1.5px dashed #cfd6df; border-radius: var(--radius);
  padding: 34px 22px; text-align: center; color: var(--text-muted);
  background: var(--surface-2);
}
.frame-empty .frame-ico { font-size: 26px; opacity: .5; line-height: 1; }
.frame-empty h4 { margin: 10px 0 4px; font-size: 15px; color: var(--text); font-weight: 600; }
.frame-empty p { margin: 0 auto; max-width: 48ch; font-size: 13px; line-height: 1.5; }
.frame-empty .fx-btn { margin-top: 14px; }

/* toolbar + count for the projects browser */
.frame-toolbar { display: flex; gap: 8px; align-items: center; padding: 0 var(--pad-page); }
.frame-toolbar input[type="search"] {
  flex: 1; height: var(--h-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 12px; font-size: 13px;
  background: var(--surface); color: var(--text); outline: none;
}
.frame-toolbar input[type="search"]:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.frame-count { padding: 6px var(--pad-page) 0; color: var(--text-muted); font-size: 12px; }
.frame-list-wrap { padding: 8px var(--pad-page) var(--pad-page); }

/* project rows */
.frame-proj-row { cursor: pointer; }
.frame-proj-row:hover td { background: var(--gold-soft); }
.frame-idpill {
  display: inline-block; font-size: 11px; font-weight: 700; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 1px 8px; letter-spacing: .02em;
}

/* a soft "coming soon" chip, reusing badge geometry */
.frame-soon {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px;
  border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; background: #eef0f2; color: #5b6572;
}

/* ==========================================================================
   DEEP RESKIN — lift the legacy screen internals to the FX-AD-UI-0001 design
   system so the whole app reads as one framed product (not new chrome around
   old screens). Additive; legacy selectors are single-class, so equal-
   specificity rules here win by source order. Delete this block to revert
   just the deep reskin (the frame nav/modules above stay).
   ========================================================================== */

/* --- screen canvas → design-system background --- */
#chat, #audit, #progress, #users, #space, #field, #hr, #time,
#journal, #review, #outbox, #upload { background: var(--bg); }

/* --- screen header: dark banner → light content toolbar --- */
.bar {
  background: var(--surface); color: var(--text);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px; box-shadow: var(--shadow-1);
}
.bar .bar-name { color: var(--text); font-weight: 600; font-size: 15px; }
.bar .who { color: var(--text); }
.bar .bar-icon { border-radius: 6px; }
.nav-toggle { color: var(--text-2); }
.role-chip { background: var(--gold-soft); color: var(--gold-hover); }

/* text-buttons ("Back", "Refresh", "Cancel") → readable on light */
.link { color: var(--text-2); font-weight: 600; }
.link:hover { color: var(--gold-hover); }
.f-missing .link, .msg.bot a.doclink { color: var(--gold-hover); }

/* --- form controls: unify border, radius, focus ring --- */
.screen input, .screen select, .screen textarea,
.field-form input, .field-form select, .field-form textarea,
.audit-filters input, .hr-toolbar input, .hr-toolbar select {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
.screen input:focus, .screen select:focus, .screen textarea:focus,
.field-form input:focus, .field-form select:focus, .field-form textarea:focus,
.audit-filters input:focus {
  border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft);
}

/* --- amber action buttons: consistent geometry --- */
#f-submit, #login-btn, #np-btn, #up-submit, .audit-filters button,
.users-add button, .user-form .user-form-actions button[type=submit],
.hr-toolbar button, .time-status button {
  border-radius: var(--radius-sm);
}

/* --- list/row cards: consistent radius, border, shadow --- */
.field-row, .audit-row, .user-card, .outbox-entry, .up-card, .up-file, .act-card {
  border-color: var(--border); box-shadow: var(--shadow-1);
}
.field-row, .audit-row, .user-card, .outbox-entry, .up-card { border-radius: var(--radius); }
.field-list, .audit-list, .users-list, #outbox-list { padding: var(--pad-page); gap: 12px; }

/* --- segmented tabs (field kinds, HR, time) --- */
.kind-tab, .hr-tab {
  border-color: var(--border); border-radius: var(--radius-sm);
  color: var(--text-2); background: var(--surface);
}
.kind-tab.active, .hr-tab.active { background: var(--gold); color: #1b1b1b; border-color: var(--gold); }

/* --- composer + focus bar --- */
.composer, .focus-bar { background: var(--surface); border-color: var(--border); }
.composer textarea { border-color: var(--border); background: var(--surface); }
.composer textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }

/* --- upload dropzone + gated viewer cards --- */
.up-drop { border-color: var(--border); background: var(--surface-2); color: var(--text-muted); }
.up-drop:hover, .up-drop.drag { border-color: var(--gold); background: var(--gold-soft); }
.iso-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.iso-h { color: var(--text); }

/* --- toolbars (search/filter rows) → surface + tokens --- */
.audit-filters, .hr-toolbar { background: var(--surface); border-color: var(--border); }

/* --- Dashboard: On-the-clock strip + live activity feed --- */
.fx-onclock {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); padding: 10px 12px; margin-bottom: 14px;
}
.fx-onclock__head {
  font-size: 12px; font-weight: 700; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .02em; margin-bottom: 8px;
}
.fx-onclock__row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 5px 0; border-top: 1px solid var(--border);
}
.fx-onclock__row:first-of-type { border-top: none; }
.fx-offclock__section { margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--border); }
.fx-onclock__row--off .fx-onclock__who { color: var(--text-2); }
.fx-onclock__who { font-weight: 600; color: var(--text); min-width: 90px; }
.fx-onclock__job { flex: 1; color: var(--text-2); font-size: 13px; }
.fx-onclock__dur {
  font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px;
  color: var(--text); white-space: nowrap;
}
.fx-feed { list-style: none; margin: 0; padding: 0; }
.fx-feed__item {
  display: flex; align-items: baseline; gap: 10px;
  padding: 9px 2px; border-top: 1px solid var(--border);
}
.fx-feed__item:first-child { border-top: none; }
.fx-feed__ico { font-size: 14px; line-height: 1.3; width: 18px; text-align: center; }
.fx-feed__body { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fx-feed__title { color: var(--text); font-size: 14px; }
.fx-feed__meta {
  color: var(--text-muted); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fx-feed__when {
  color: var(--text-muted); font-size: 12px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   MOBILE — prevent iOS Safari zoom-on-focus. Safari auto-zooms the page when a
   focused form control's font-size is < 16px. Many module stylesheets set their
   inputs to 13–14px (purchasing / estimating / scheduling / knowledge /
   expenses / pip / …), which override the app's global mobile rule by
   specificity + source order — so on a phone, tapping almost any field jumps
   the zoom. Force >=16px on phones. !important is required to beat the
   per-module selectors (e.g. `.pur-new-grid input`); scoped to <=720px so
   desktop density is unchanged. Additive & reversible — delete this block to revert.
   ========================================================================== */
@media (max-width: 720px) {
  input, select, textarea { font-size: 16px !important; }
}
/* The 720px rule above misses a phone in LANDSCAPE (a 13/15/16 Pro Max is
   926-932px wide on its side) and every tablet, where the per-module 13-15px
   rules come straight back and iOS zooms on focus again — verified at 926px on
   2026-09-02: 12 of 13 field-form contexts measured under 16px. Match the
   DEVICE instead of the width: hover:none + pointer:coarse is true of phones
   and tablets in any orientation and false of a desktop with a mouse, so
   desktop density is still unchanged. Additive — delete to revert. */
@media (hover: none) and (pointer: coarse) {
  input, select, textarea { font-size: 16px !important; }
}

/* ==========================================================================
   MOBILE — per-module layout fixes. Live-audited + verified at 390px on
   2026-07-13 against the running app (iframe-at-390px method; all 7 screens
   re-probed pageLeaks:false afterwards). Same 720px breakpoint as the 16px
   rule above. Additive & reversible — delete this block to revert.
   (`.fx-tabs` / `.tab-strip` are defensive no-ops: no such class in the tree
   today, kept so future tab strips inherit the scroll behavior.)
   ========================================================================== */
@media (max-width: 720px) {

  /* 1. DASHBOARD grid blowout — a 1fr track expands to unbreakable feed text
        (computed to 628px in a 370px wrap -> page scrolled sideways).
        minmax(0,1fr) lets the track shrink below its content min-width. */
  .frame-wrap { grid-template-columns: minmax(0, 1fr) !important; }

  /* 2. HR directory table leaked the page: its .fx-table-wrap scroller sits in
        a flex parent, and a flex item defaults to min-width:auto (= content
        width) so overflow-x:auto never engaged. min-width:0 lets it clip+scroll. */
  .fx-table-wrap { min-width: 0 !important; max-width: 100% !important; }
  .field-list, .hr-pane { min-width: 0 !important; }

  /* 3. Button rows (Purchasing page-header, HR toolbar) were nowrap and pushed
        the page wide. Let them wrap. */
  .fx-page-header__actions, .hr-toolbar { flex-wrap: wrap !important; }

  /* 4. Tab strips (Expenses "Vendors" tab clipped off-screen) scroll instead. */
  .hr-tabs, .fx-tabs, .tab-strip {
    overflow-x: auto !important; -webkit-overflow-scrolling: touch;
  }

  /* 5. Touch targets — primary action buttons rendered ~30px tall. Bump to 44px.
        Scoped to real action-button classes; deliberately NOT bare <button>,
        which would bloat dense legacy rows (Users renders 106 of them). */
  .fx-btn, .hr-tab,
  .fx-page-header__actions button, .hr-toolbar button,
  .fx-topbar button, .fx-nav__item { min-height: 44px !important; }
}
