/* Slice 2A additions — ONLY the new Developer-page grids, the three-fact
   cells, the queue tiles, honest empty/error states, and the responsive rules.
   The preserved shared design lives in tokens.css + styles.css; nothing here
   re-themes it or introduces a new visual motif. */

/* --- refresh / filter chrome (top bar + page headers) --- */
.refresh-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--fg-1);
  padding: 6px 10px; border: 1px solid var(--glass-border); border-radius: var(--r-md);
}
.refresh-chip.is-error { color: var(--warn); border-color: var(--warn-border); }
.dev-filter { display: inline-flex; align-items: center; gap: 8px; color: var(--fg-2); }
.page-header > :first-child { min-width: 0; flex: 1 1 320px; }
.page-header-right {
  display: flex; align-items: center; gap: 8px;
  min-width: 0; max-width: 100%; flex: 0 1 auto;
}
/* Native selects use their longest option as an intrinsic width. A formal BCA
   project title can be hundreds of characters, so bound the shared project
   filter instead of allowing it to collapse the page title to one glyph. */
.dev-project-filter {
  width: clamp(180px, 32vw, 380px);
  min-width: 0; max-width: 100%;
}
.dev-project-filter .select { width: 100%; min-width: 0; }

.dev-banner {
  padding: 12px 16px; border: 1px solid var(--warn-border);
  background: var(--warn-bg); color: var(--warn);
  border-radius: var(--r-md); font-size: 12px;
}

/* --- three independent facts (registration / event / poll) + cursor --- */
.dev-fact { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dev-fact-sub { font-size: 10px; line-height: 1.4; }
.dev-strong { color: var(--fg-0); font-weight: 500; }

/* --- terminals table (Device Health + Dashboard) --- */
.dev-terminals .thead,
.dev-terminals .tr { grid-template-columns: 1.3fr 1fr 1.1fr 1.2fr 1.1fr 1.4fr; min-width: 880px; }
.dev-terminals { overflow-x: auto; }
.dev-terminals .tr { align-items: start; }
.dev-terminals .td-name { font-size: 13px; }

/* --- ingestion events table --- */
.dev-events .thead,
.dev-events .tr { grid-template-columns: 1fr 1fr 0.7fr 1.5fr 1fr 1fr; }

/* --- attendance table --- */
.dev-attendance .thead,
.dev-attendance .tr { grid-template-columns: 1.2fr 1.1fr 1.1fr 0.7fr 1fr 1fr; }
/* R2.1e: the Customer attendance table prepends Worker and now includes BAS
   sources, so it needs eight explicit tracks. Never leave Warning in an
   implicit auto track; that was the cause of the earlier collapsed layout. */
.dev-attendance-cust .thead,
.dev-attendance-cust .tr { grid-template-columns: 1.3fr 0.9fr 1fr 1fr 0.6fr 1.3fr 0.8fr 1fr; }
.dev-attendance-cust.is-month .thead,
.dev-attendance-cust.is-month .tr {
  grid-template-columns: 1fr 1.3fr 0.9fr 1fr 1fr 0.6fr 1.3fr 0.8fr 1fr;
}

/* column separation + clip so no dense cell overruns its neighbour */
.dev-terminals .thead, .dev-terminals .tr,
.dev-events .thead, .dev-events .tr,
.dev-attendance .thead, .dev-attendance .tr { column-gap: 16px; }
.dev-terminals .tr > div, .dev-events .tr > div, .dev-attendance .tr > div,
.dev-terminals .thead > div, .dev-events .thead > div, .dev-attendance .thead > div { min-width: 0; }
.dev-events .tr > div, .dev-attendance .tr > div,
.dev-terminals .td-meta {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* stable empty state so a refresh with no rows does not collapse the card */
.dev-empty { padding: 22px 18px; color: var(--fg-2); font-size: 12px; }

/* --- queue tiles --- */
.dev-queue { padding: 18px 20px; }
.dev-queue-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 6px; }
.dev-queue-cell {
  padding: 14px 10px; border: 1px solid var(--glass-border);
  border-radius: var(--r-md); text-align: center; background: rgba(120,140,170,0.03);
}
.dev-queue-num { font-size: 26px; font-weight: 600; letter-spacing: -0.01em; font-feature-settings: "tnum"; line-height: 1; }
.dev-queue-label { font-size: 10px; color: var(--fg-2); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 6px; }

.dev-dash-row { grid-template-columns: 1.6fr 1fr; }

/* generic browse table (mappings/commands/audit/personnel) */
.dev-generic .thead, .dev-generic .tr { align-items: center; }
.dev-generic .tr > div, .dev-generic .thead > div { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ghost-btn.is-on { background: rgba(56,189,248,0.10); border-color: var(--accent); color: var(--fg-0); }

/* customer create/edit form */
.cust-form { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 6px 0; }
.cust-form label { display: flex; flex-direction: column; gap: 4px; font-size: 10px;
  color: var(--fg-2); letter-spacing: 0.06em; text-transform: uppercase; }
.cust-form .select { width: 100%; text-transform: none; letter-spacing: 0; font-size: 13px; }
.cust-form .checkbox-row { flex-direction: row; align-items: flex-start; gap: 8px;
  line-height: 1.45; color: var(--text); }
.cust-form .checkbox-row input { width: 15px; height: 15px; margin: 1px 0 0;
  flex: 0 0 15px; accent-color: var(--cyan); }
.val-drawer input[type="file"] { color: var(--fg-1); font-size: 12px; }
.dev-banner.is-error { border-color: var(--err-border); background: var(--err-bg); color: var(--err); }

/* Project creation makes the BCA / BuildEx contract visible at the source. */
.project-form { display: flex; flex-direction: column; gap: 16px; }
.project-form-head { margin-bottom: 0; }
.project-form-head .pill { flex-shrink: 0; white-space: nowrap; }
.project-form-sub {
  margin-top: 5px;
  max-width: 520px;
  color: var(--fg-2);
  font-size: 11.5px;
  line-height: 1.45;
  letter-spacing: 0;
}
.project-form-section {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--glass-border);
}
.project-form-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}
.project-form-section-head h3 {
  margin: 0;
  color: var(--fg-0);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0;
}
.project-form-section-head p {
  margin: 3px 0 0;
  color: var(--fg-2);
  font-size: 10.5px;
  line-height: 1.45;
  letter-spacing: 0;
}
.required-badge {
  padding: 3px 7px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 999px;
  color: var(--accent);
  font-size: 9px;
  line-height: 1.2;
  white-space: nowrap;
}
.project-form-fields { padding: 0; gap: 12px; }
.cust-form label.project-field-label {
  gap: 6px;
  color: var(--fg-1);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0;
  text-transform: none;
}
.project-field-label > span[aria-hidden="true"],
.project-type-field legend > span { color: var(--warn); }
.project-form-fields textarea.select { resize: vertical; min-height: 74px; line-height: 1.5; }
.field-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--fg-2);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.4;
}
.field-meta span:last-child { flex-shrink: 0; font-family: var(--mono); }
.company-proof {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(110px, .7fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: 7px;
  background: rgba(52, 211, 153, 0.04);
}
.company-proof.is-invalid { border-color: var(--err-border); background: var(--err-bg); }
.company-proof > div { min-width: 0; }
.company-proof > div span {
  display: block;
  margin-bottom: 3px;
  color: var(--fg-2);
  font-size: 9.5px;
}
.company-proof > div strong {
  display: block;
  color: var(--fg-0);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.project-type-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.project-type-field legend {
  margin-bottom: 6px;
  color: var(--fg-1);
  font-size: 11.5px;
  font-weight: 500;
}
.project-type-segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--glass-border);
  border-radius: 7px;
  background: rgba(120, 140, 170, 0.035);
}
.project-type-segmented button {
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 5px;
  color: var(--fg-2);
  font-size: 11.5px;
  line-height: 1.25;
  transition: background .15s, box-shadow .15s, color .15s, transform .08s;
}
.project-type-segmented button.is-active {
  background: rgba(56, 189, 248, 0.11);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.25);
  color: var(--fg-0);
}
.project-type-segmented button:active { transform: translateY(1px) scale(.99); }
.project-type-segmented button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.project-optional { padding-bottom: 14px; border-bottom: 1px solid var(--glass-border); }
.project-optional summary {
  cursor: pointer;
  color: var(--fg-1);
  font-size: 11.5px;
  font-weight: 500;
}
.project-optional[open] summary { margin-bottom: 12px; }
.project-form-actions { flex-direction: row; flex-wrap: wrap; }

@media (max-width: 620px) {
  .project-form-head, .project-form-section-head { flex-direction: column; }
  .company-proof { grid-template-columns: 1fr; }
  .project-type-segmented { grid-template-columns: 1fr; }
}

/* prevent any horizontal page overflow globally */
html, body, #root { max-width: 100%; }
.main { overflow-x: hidden; }

/* ============================================================
   RESPONSIVE — desktop design preserved; below 860px the fixed
   grid becomes a stacked flex column, the sidebar becomes a slim
   horizontal nav, and each dense table scrolls INSIDE its own card
   (never the page).
   ============================================================ */
/* Mobile customer context band: hidden by default (desktop sidebar .env-card
   serves the role); the @media rule below flips it to flex at <=860px. This base
   rule MUST precede the media query — media queries add no specificity, so a
   later `display:none` would otherwise win at <=860px. */
.mobile-env { display: none; }

@media (max-width: 860px) {
  #root { height: auto; }
  .app {
    display: flex; flex-direction: column;
    height: auto; min-height: 100vh;
  }
  .sidebar {
    flex-direction: row; align-items: center; gap: 14px;
    overflow-x: auto; padding: 10px 14px;
    border-right: 0; border-bottom: 1px solid var(--glass-border);
  }
  .sidebar .brand { padding: 0; flex-shrink: 0; }
  .sidebar .env-card, .sidebar .side-foot { display: none; }
  .sidebar .nav { flex-direction: row; gap: 6px; flex: 1; }
  .nav-group { flex-direction: row; gap: 6px; }
  .nav-group-title { display: none; }
  .nav-item { white-space: nowrap; }
  .nav-item.is-active .nav-rail { display: none; }

  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px; }
  .topbar-actions { margin-left: 0; flex-wrap: wrap; }
  .main { padding: 16px 14px 40px; }
  .page { gap: 16px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-header > :first-child, .page-header-right,
  .dev-project-filter { width: 100%; }
  .page-header > :first-child { flex-basis: auto; }
  .dash-row, .dev-dash-row { grid-template-columns: 1fr; }
  .dev-queue-grid { grid-template-columns: repeat(2, 1fr); }

  .statusbar { flex-wrap: wrap; height: auto; padding: 8px 12px; row-gap: 4px; }
  .statusbar .grow { flex-basis: 100%; }

  /* dense tables: scroll horizontally within their own card, not the page */
  .dev-terminals, .dev-events, .dev-attendance, .dev-generic { overflow-x: auto; }
  .dev-terminals .thead, .dev-terminals .tr { min-width: 880px; }
  .dev-events .thead, .dev-events .tr { min-width: 640px; }
  .dev-attendance .thead, .dev-attendance .tr { min-width: 560px; }
  .dev-attendance-cust .thead, .dev-attendance-cust .tr { min-width: 780px; }  /* 8 cols */
  .dev-attendance-cust.is-month .thead,
  .dev-attendance-cust.is-month .tr { min-width: 900px; }  /* date + 8 cols */
  .dev-generic .thead, .dev-generic .tr { min-width: 620px; }
  /* R2 Correction 4: every DataTable opts into .dev-wide (min-width:0 for
     desktop fill, line 133). At <=860 that cancels the scroll-in-card pattern
     above and squishes columns to illegibility. Higher specificity (0,3,0 vs
     0,2,0) re-enables in-card horizontal scroll on mobile so no column/badge is
     invisibly clipped, while desktop keeps the fluid fill. */
  .table.dev-wide .thead, .table.dev-wide .tr { min-width: 640px; }
  .val-shell { grid-template-columns: 1fr; }        /* personnel list + drawer stack */
  .val-drawer { position: static; }
  .kpi-grid { grid-template-columns: 1fr 1fr !important; }
  .md-detail-grid, .md-scope-groups { grid-template-columns: 1fr; }

  /* Mobile customer context band: the sidebar .env-card is display:none here, so
     surface the project switcher / account / BAS-sync status / Sign out in the
     column flow. Wraps instead of overflowing; no control is ever clipped. */
  .mobile-env {
    position: relative; z-index: 2;   /* sit above the .ambient background so the
                                          selector / Sign out are interactable */
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px;
    margin: 10px 14px 0; padding: 8px 12px;
    border: 1px solid var(--glass-border); border-radius: var(--r-sm);
  }
  .mobile-env .env-label { font-size: 10px; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--fg-2); }
  .mobile-env .env-val { min-width: 0; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; max-width: 42vw; }
  .mobile-env .env-project-select { max-width: 44vw; min-width: 96px; }
  .mobile-env .grow { flex: 1 1 auto; }
}

/* ---- Master Data (Companies + Projects) — same glass/pill/spacing idiom ---- */
.dev-wide .thead, .dev-wide .tr { min-width: 0; }
.ghost-btn.xs { padding: 3px 7px; font-size: 10px; }
.primary-btn.sm { padding: 6px 12px; font-size: 12px; }

.md-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px;
  padding: 4px 0 12px; font-size: 12px; }
.md-detail-grid > div span.dim { display: block; font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; margin-bottom: 2px; }
.md-detail-grid > div > div { color: var(--fg-0); }

.md-section { border-top: 1px solid var(--glass-border); padding-top: 14px; margin-top: 14px; }
.md-section-head { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-2); margin-bottom: 10px; }

.md-roles { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.md-role-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.md-role-row .pill { text-transform: none; }
.roster-cleanup-panel { font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; scroll-margin-top: 75px; }
.roster-cleanup-panel .drawer-section { padding: 8px 0; }
.roster-cleanup-panel .drawer-actions { flex-wrap: wrap; }
.roster-maintenance { border-block: 1px solid var(--glass-border);
  font-size: 12px; line-height: 1.5; letter-spacing: 0; }
.roster-maintenance summary { cursor: pointer; }
.roster-maintenance details:not([open]) > :not(summary) { display: none; }
.roster-maintenance summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.roster-summary { display: flex; align-items: center; gap: 12px; min-height: 48px;
  padding: 10px 0; list-style: none; }
.roster-summary::-webkit-details-marker { display: none; }
.roster-summary-title { display: flex; align-items: center; gap: 8px; min-width: 0;
  overflow-wrap: anywhere; font-weight: 600; }
.roster-summary-title > svg { flex-shrink: 0; }
.roster-summary-status { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; min-width: 0; }
.roster-summary-status .pill { white-space: normal; text-transform: none; letter-spacing: 0; }
.roster-chevron { display: flex; flex: 0 0 14px; }
details[open] > .roster-summary > .roster-chevron { transform: rotate(90deg); }
.roster-review-body { padding-bottom: 12px; }
.roster-review-body > p { margin: 4px 0 12px; }
.roster-device-reads, .roster-completed { padding: 10px 0; }
.roster-device-reads > summary, .roster-completed > summary { color: var(--fg-1); }
.roster-device-read { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px;
  padding: 5px 0; overflow-wrap: anywhere; }
.roster-device-read .pill { text-transform: none; letter-spacing: 0; }
.roster-active-results, .roster-result + .roster-result { border-top: 1px solid var(--glass-border); }
.roster-result > .ghost-btn { margin-bottom: 10px; }
.roster-result-devices { padding-bottom: 8px; }
@media (max-width: 600px) {
  .roster-summary { display: grid; grid-template-columns: minmax(0, 1fr) 14px; gap: 4px 8px; }
  .roster-summary-title { grid-column: 1; }
  .roster-summary-status { grid-column: 1; margin-left: 0; }
  .roster-chevron { grid-column: 2; grid-row: 1 / 3; }
}
.md-map-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px;
  font-size: 12px; padding: 5px 0; border-bottom: 1px solid var(--glass-border); }
.md-map-row:last-child { border-bottom: 0; }
.md-map-row .pill { text-transform: none; }
.md-role-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.md-role-add .select { flex: 1; min-width: 120px; }

.md-scope { border: 1px solid var(--glass-border); border-radius: var(--r-sm);
  padding: 8px 10px; margin-bottom: 8px; }
.md-scope-head { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.md-scope-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 10px 0; }
.md-scope-group-title { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-2); margin-bottom: 4px; }
.md-scope-check { display: flex; align-items: center; gap: 6px; font-size: 11px;
  color: var(--fg-1); padding: 2px 0; cursor: pointer; }
.md-scope-check input { accent-color: var(--accent); }

/* ---- Customer account login (Stage 1) ---- */
/* override the shared .app grid so the login card centers on the full viewport */
.login-app { display: block; min-height: 100vh; }
.login-shell { min-height: 100vh; }
.login-shell { display: flex; align-items: center; justify-content: center;
  padding: 32px 18px; position: relative; z-index: 1; }
.login-card { width: 100%; max-width: 380px; padding: 28px 26px;
  border-radius: var(--r-md); position: relative; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.login-language { position: absolute; top: 18px; right: 18px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form label { display: flex; flex-direction: column; gap: 5px;
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-2); }
.login-form .select { text-transform: none; letter-spacing: 0; font-size: 14px;
  padding: 9px 11px; }
.login-form .primary-btn { justify-content: center; margin-top: 4px; }
.login-err { color: var(--err); font-size: 12px; padding: 2px 0; }
.login-hint { font-size: 11px; line-height: 1.5; margin-top: 2px; }
.env-project-select { width: 100%; max-width: 130px; font-size: 11px;
  padding: 3px 6px; }
.env-logout { width: 100%; justify-content: center; }

/* ---- Developer Customer Accounts (Recovery Pass A) ---- */
.acct-grants-label { font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--fg-2); margin-top: 4px; }
.acct-grants-label .req-hint { text-transform: none; letter-spacing: 0;
  color: var(--warn, #d08700); font-weight: 500; }
.acct-grants { display: flex; flex-direction: column; gap: 5px; max-height: 220px;
  overflow-y: auto; border: 1px solid var(--glass-border); border-radius: var(--r-sm);
  padding: 8px 10px; }
/* Force horizontal rows: the checkbox sits ON the row is inside `.cust-form`,
   whose `.cust-form label { flex-direction: column }` rule (higher specificity
   than `.acct-grant-check`) would otherwise stack the checkbox above its label.
   The two-class selector `.cust-form .acct-grant-check` outranks it. */
.acct-grant-check { display: flex; align-items: center; gap: 8px; font-size: 12px;
  color: var(--fg-1); cursor: pointer; }
.cust-form .acct-grant-check { flex-direction: row; align-items: center; }
.acct-grant-check input[type="checkbox"] { accent-color: var(--accent);
  width: 15px; height: 15px; flex: 0 0 auto; margin: 0; }
.acct-grant-check > span { min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }

/* Accounts table: State/Password pills live in fixed-width columns (set in
   dev-accounts.jsx) so they never clip; a column-gap keeps the State badge off
   the Granted-projects text; nowrap makes long grant lists truncate on ONE line
   (the existing `.dev-generic .tr>div` overflow+ellipsis then applies) instead
   of wrapping into a tall, colliding cell. The two fixed pill columns + the
   text minima can exceed the (narrow, drawer-adjacent) val-shell table width;
   rather than let `.table{overflow:hidden}` HARD-CLIP the last column, the table
   scrolls horizontally IN-CARD (min-width + overflow-x:auto, at every width) so
   every column stays reachable — the same pattern the other dense dev tables
   use at mobile. Overrides `.dev-wide .thead/.tr{min-width:0}`. */
.dev-accounts { overflow-x: auto; }
.dev-accounts .thead, .dev-accounts .tr { column-gap: 12px; min-width: 680px; }
.dev-accounts .thead > div, .dev-accounts .tr > div { white-space: nowrap; }
.dev-accounts .tr .pill { white-space: nowrap; max-width: 100%; }

.pw-overlay { position: fixed; inset: 0; background: rgba(6,10,20,0.62);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.pw-dialog { width: 100%; max-width: 440px; padding: 22px 24px; }
.pw-user { font-size: 12px; color: var(--fg-2); margin: 4px 0 12px; }
.pw-value { font-size: 20px; letter-spacing: 0.02em; color: var(--fg-0);
  background: rgba(8,14,28,0.55); border: 1px solid var(--glass-border-strong);
  border-radius: var(--r-sm); padding: 12px 14px; word-break: break-all;
  user-select: all; }
.pw-warn { font-size: 11px; line-height: 1.5; color: var(--warn); margin: 12px 0 6px; }

/* ---- Developer Gateway & BAS (Recovery Pass A Part 3) ---- */
.gw-card { padding: 18px 20px; margin-bottom: 16px; }
.gw-enrol-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.gw-enrol-row .select { flex: 1; min-width: 130px; }
.gw-actions { margin-top: 12px; padding: 14px 16px; }
.proj-deact-confirm { display: inline-flex; gap: 6px; align-items: center; }

/* Optional hardened gateway path. The gateway block is one operational
   surface, while each node is an unframed band rather than a nested card. */
.gateway-profile-heading, .gateway-profile-summary {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px;
}
.gateway-profile-heading { margin-bottom: 10px; }
.gateway-profile-heading .md-section-head { margin-bottom: 4px; }
.gateway-profile {
  padding: 16px 0 18px; border-top: 1px solid var(--glass-border);
}
.gateway-profile:last-child { padding-bottom: 2px; }
.gateway-profile-summary h3 {
  margin: 0 0 4px; color: var(--fg-0); font-size: 13px;
  font-weight: 550; letter-spacing: 0;
}
.gateway-profile-status { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.connection-paths {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px; margin: 14px 0;
}
.connection-path {
  min-width: 0; padding: 2px 0 2px 11px;
  border-left: 2px solid var(--glass-border-strong);
}
.connection-path.is-current { border-left-color: rgba(56, 189, 248, .52); }
.connection-path.is-ready { border-left-color: rgba(52, 211, 153, .62); }
.connection-path > div { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.connection-path strong { color: var(--fg-0); font-size: 11.5px; font-weight: 550; }
.connection-path > span { display: block; margin-top: 7px; color: var(--fg-1); font-size: 10.5px; }
.connection-path p { margin: 5px 0 0; color: var(--fg-2); font-size: 10.5px; line-height: 1.45; }
.gateway-profile-form {
  display: grid; grid-template-columns: minmax(180px, 1.8fr) minmax(110px, .7fr) minmax(110px, .7fr);
  gap: 10px; align-items: end;
}
.gateway-profile-form label {
  display: flex; min-width: 0; flex-direction: column; gap: 5px;
  color: var(--fg-2); font-size: 10px; letter-spacing: .05em;
  text-transform: uppercase;
}
.gateway-profile-form .select { width: 100%; min-width: 0; }
.gateway-check-fact {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-top: 9px; color: var(--fg-2); font-size: 10.5px;
}
.gateway-profile-actions { flex-wrap: wrap; margin-top: 10px; }

.connection-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.connection-copy { margin-bottom: 10px; font-size: 10.5px; line-height: 1.5; }
.connection-mode-options button {
  display: flex; min-width: 0; flex-direction: column; align-items: flex-start;
  gap: 3px; text-align: left;
}
.connection-mode-options button strong { color: inherit; font-size: 11.5px; font-weight: 550; }
.connection-mode-options button span { color: var(--fg-2); font-size: 10px; }
.connection-picker { display: flex; flex-direction: column; gap: 7px; margin-top: 9px; }
.connection-endpoints { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--fg-2); font-size: 10.5px; }

@media (max-width: 720px) {
  .gateway-profile-heading, .gateway-profile-summary { flex-direction: column; }
  .gateway-profile-status { justify-content: flex-start; }
  .connection-paths, .gateway-profile-form { grid-template-columns: 1fr; }
}

/* --- Recovery Pass B: BAS Sync page --- */
/* R2.1e: wrap the status-pill group as UNITS at narrow widths. Without
   flex-wrap the group stayed one row and the pills' text wrapped to 2-3 lines
   ("SYNC AWAITING APPROVAL" / "NOT IN SYNC") — a status pill is a single-line
   lozenge, so keep the pill text nowrap and let the group flow to a new row. */
.sync-head-right { display: inline-flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sync-head-right .pill { white-space: nowrap; }
.sync-summary { padding: 14px 16px; margin-bottom: 12px; display: flex;
  flex-direction: column; gap: 12px; }
.sync-scope { font-size: 12px; color: var(--fg-2); }
.sync-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sync-chip { display: flex; flex-direction: column; align-items: center;
  min-width: 74px; padding: 8px 10px; border: 1px solid var(--glass-border);
  border-radius: var(--r-sm); background: rgba(255,255,255,0.02); }
.sync-chip.is-work { border-color: var(--warn, #d08700); }
.sync-chip-n { font-size: 18px; font-weight: 600; }
.sync-chip-l { font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--fg-2); margin-top: 2px; }
.sync-confirm-q { font-size: 12px; color: var(--fg-2); margin-right: 6px; }

/* ---- Pass C: employee photo section ---- */
.photo-row { display: flex; gap: 12px; align-items: flex-start; }
.photo-preview { width: 96px; height: 112px; object-fit: cover;
  border-radius: var(--r-sm); border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.03); flex: none; }
.photo-empty { display: flex; align-items: center; justify-content: center;
  font-size: 11px; }
.photo-meta { font-size: 11px; line-height: 1.5; padding-top: 4px; }

/* R3.1 Phase 3 — one-time credential display. Deliberately loud: this is the
   only moment the plaintext exists, and the operator must not scroll past it. */
.cred-once { border: 1px solid var(--warn, #b7791f); border-radius: 6px;
  padding: 10px; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.cred-token { display: block; word-break: break-all; user-select: all;
  font-size: 12px; padding: 6px 8px; border-radius: 4px;
  background: rgba(127, 127, 127, 0.14); }
