/* ============================================================
   NBI ERP — app layout styles
   Screen-level layout on top of nbi-erp.css. Tokens only —
   no hard-coded colours outside the design system variables.
   ============================================================ */

* { box-sizing: border-box; }
button { font-family: inherit; }

/* ---------- Demo-data banner (Correction 2 — demo quarantine) ---------- */
.demo-banner { position: sticky; top: 0; z-index: 100; text-align: center;
  background: var(--nbi-red-text); color: #fff; font-size: var(--fs-body-s);
  font-weight: 700; letter-spacing: 0.08em; padding: 7px 16px; }

/* ---------- Login ---------- */
/* Item 20 — min-height carries the OUTER ring (800px) plus a pill (about 34px)
   plus breathing room. Without it, a short window clips the frame and the pills
   riding the top and bottom of the orbit are sliced in half as they pass. Every
   pill passes through twelve and six o'clock once per revolution, so there is no
   arrangement that avoids this — the box has to be big enough. A window shorter
   than this scrolls, which is the right trade against a sliced pill.

   Swept a full revolution at 15-degree steps and measured the extreme pill
   edges: 880px leaves ONE pixel at the bottom, which is not clearance, it is
   luck. 920px leaves ~40px, enough to survive a longer label or a font that
   renders a little taller. */
.login-screen { min-height: max(100vh, 920px);
  background: linear-gradient(135deg, #d8f1fd 0%, #e8effc 45%, #d5e2f9 100%);
  position: relative; overflow: hidden; display: grid; place-items: center; padding: 48px 24px; }
.login-ring { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  border-radius: 50%; border: 1.5px dashed rgba(29,71,174,0.18); pointer-events: none; }
.login-ring.r1 { width: 560px; height: 560px; --orbit-r: 280px; }
.login-ring.r2 { width: 800px; height: 800px; --orbit-r: 400px; border-color: rgba(29,71,174,0.1); }
.login-glow { position: absolute; border-radius: 50%; pointer-events: none; }
.login-glow.g1 { width: 520px; height: 520px; background: radial-gradient(circle, rgba(41,171,226,0.24), transparent 70%); top: -180px; right: -120px; }
.login-glow.g2 { width: 420px; height: 420px; background: radial-gradient(circle, rgba(29,71,174,0.14), transparent 70%); bottom: -160px; left: -100px; }
/* TWO ELEMENTS, AND WHICH ONE IS THE CAPSULE MATTERS.

   .login-pill is a bare positioning point that rides the ring. The capsule —
   background, border, radius, shadow — lives on .login-pill-label, because that
   is the element the counter-rotation is applied to. Putting the capsule on the
   outer element instead leaves the text upright inside a lozenge standing on
   its end, with the label spilling out of both flat sides. That is exactly what
   it looked like before this was split.

   Every visual property below is the pill's original; only which element
   carries it changed. */
.login-pill { position: absolute; top: 50%; left: 50%; pointer-events: none;
  transform: translate(-50%, -50%) rotate(var(--a)) translateY(calc(-1 * var(--orbit-r))) rotate(calc(-1 * var(--a))); }
.login-pill-label { display: inline-block; background: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.95); border-radius: var(--r-full); padding: 8px 16px;
  font-size: var(--fs-body-s); font-weight: 700; box-shadow: 0 6px 20px rgba(18,47,120,0.1);
  white-space: nowrap; }
.login-card { position: relative; width: 400px; background: rgba(255,255,255,0.88);
  border: 1px solid rgba(255,255,255,0.98); border-radius: var(--r-2xl); padding: 40px 42px 32px;
  box-shadow: var(--sh-pop); display: flex; flex-direction: column; align-items: center;
  backdrop-filter: var(--nbi-glass-blur); }
.login-tag { font-size: var(--fs-body); color: var(--nbi-ink-500); margin-top: 16px; }
.btn-google { margin-top: 18px; width: 100%; display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 14px 18px; border-radius: var(--r-lg); border: none; background: var(--nbi-grad);
  font-size: var(--fs-card-title); font-weight: 700; color: #fff; cursor: pointer; box-shadow: var(--sh-btn-lg); }
.btn-google:hover { box-shadow: 0 8px 26px rgba(29,71,174,0.42); filter: brightness(1.05); }
.btn-google:active { filter: brightness(0.95); }
.btn-google .g-badge { background: #fff; border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; }
.login-note { margin-top: 14px; display: flex; align-items: center; gap: 8px; font-size: var(--fs-meta); color: var(--nbi-ink-400); }
.login-footer { margin-top: 20px; padding-top: 16px; border-top: 1px solid rgba(16,24,40,0.08); width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px; }
.login-footer span { font-size: var(--fs-meta); letter-spacing: 0.1em; color: var(--nbi-ink-600); font-weight: 700; }

/* ---------- Command Center ---------- */
.home-screen { min-height: 100vh; position: relative; overflow: hidden;
  background: radial-gradient(1000px 520px at 88% -8%, rgba(41,171,226,0.18), transparent 60%),
              linear-gradient(135deg, #eaf6fd 0%, #eef2fb 45%, #e6edfa 100%); }
.home-ring { position: absolute; top: -230px; right: -170px; width: 560px; height: 560px;
  border-radius: 50%; border: 1.5px dashed rgba(29,71,174,0.16); pointer-events: none; z-index: 0; }
.home-bar { display: flex; align-items: center; justify-content: space-between; padding: 0 28px; height: 56px; }
.brand-word { font-weight: 800; font-size: 15.5px; color: var(--nbi-primary); letter-spacing: -0.01em; line-height: 1; white-space: nowrap; flex-shrink: 0; }
.home-bar-right { display: flex; align-items: center; gap: 14px; }
.live-note { font-size: var(--fs-meta); color: var(--nbi-ink-500); display: flex; align-items: center; gap: 6px; }
.home-main { position: relative; z-index: 1; max-width: 1020px; margin: 0 auto; padding: 40px 40px 64px; }
.home-sets { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: 12px; vertical-align: middle; }
.home-date { margin-bottom: 10px; font-size: 14px; color: var(--nbi-ink-500); }
.home-hello { font-size: var(--fs-hero); font-weight: 800; color: var(--nbi-ink-900); letter-spacing: -0.02em; margin-bottom: 24px; }
/* Greeting sheen (22-Aug; removed in the My Work Home polish 06-Nov, BACK on the owner's ruling of 07-Nov-2026). Two background layers on ONE element: a narrow
   travelling highlight on top, the solid brand blue underneath, both clipped
   to the glyphs. The solid layer is why the text is never invisible between
   sweeps, and it stays pinned at "0 0" in both keyframes — only the highlight
   moves. The highlight is 60% wide (never 100%, or the position percentages
   have no travel and it looks frozen) and no-repeat on both layers (repeat-x
   puts a second highlight mid-word). */
@keyframes nbiSheen {
  0%   { background-position: -150% 0, 0 0; }
  100% { background-position:  250% 0, 0 0; }
}
.nbi-greet {
  background-image:
    linear-gradient(100deg, rgba(29,71,174,0) 8%, #6fb9e6 40%,
                    #dcefff 50%, #6fb9e6 60%, rgba(29,71,174,0) 92%),
    linear-gradient(var(--nbi-primary), var(--nbi-primary));
  background-size: 60% 100%, 100% 100%;
  background-repeat: no-repeat, no-repeat;
  background-position: -150% 0, 0 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: nbiSheen 3.6s linear infinite;
}
/* Reduced motion: no sweep, plain solid blue. background-size and -position
   MUST be reset alongside the single-layer background-image. Dropping to one
   layer truncates those two lists to their first value — the 60%-wide, -150%
   offset meant for the travelling highlight — which parks the solid blue off
   the glyphs and, with text-fill transparent, renders the greeting INVISIBLE.
   Verified in the browser, not inferred. */
@media (prefers-reduced-motion: reduce) {
  .nbi-greet { animation: none;
    background-image: linear-gradient(var(--nbi-primary), var(--nbi-primary));
    background-size: 100% 100%;
    background-position: 0 0; }
}
/* .home-search and .topnav-search are REMOVED (D166, owner brief 01-Sep-2026):
   two controls promised "search everything" and searched nothing — no search
   callable exists. They return only WITH a working search behind them. */
.app-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; margin-top: 12px; }
@media (max-width: 980px) { .app-grid { grid-template-columns: repeat(2, 1fr); } }
/* Item 04 — card hover is a 2px lift and a cyan border, 160ms. The growing
   box-shadow it replaces (--sh-hover) is gone from every card: a shadow that
   swells on hover is softer to read than a border that changes colour, and it
   forces the compositor to repaint a large blurred area on a grid of eight
   tiles. The transition names its two properties instead of `all`, so hovering
   can never animate the background or the resting shadow by accident. */
.app-tile { text-align: left; background: var(--nbi-glass-bg); border: var(--nbi-glass-border);
  border-radius: var(--r-xl); backdrop-filter: var(--nbi-glass-blur); padding: 20px; cursor: pointer;
  box-shadow: var(--sh-card); transition: transform 160ms ease, border-color 160ms ease; }
.app-tile:hover { border-color: var(--nbi-cyan); transform: translateY(-2px); }
.app-tile:active { transform: translateY(0); }
.app-tile-top { display: flex; justify-content: space-between; align-items: flex-start; }
.icon-tile { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; }
.app-badge { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: var(--r-full); }
.app-tile-name { font-size: var(--fs-tile); font-weight: 700; color: var(--nbi-ink-900); margin-top: 14px; }
.app-tile-stat { font-size: var(--fs-body-s); color: var(--nbi-ink-500); margin-top: 3px; }
/* Provenance under a derived tile figure — same contract as .bp-tile-src:
   a live reading names its reader so it can never be mistaken for a typed
   constant (owner brief 01-Sep-2026, item 3). */
.app-tile-src { font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--nbi-ink-400); margin-top: 4px; }
.app-tile-mods { font-size: 11px; font-weight: 600; color: var(--nbi-ink-400); margin-top: 10px; }
.today-strip { background: var(--nbi-glass-bg); border: var(--nbi-glass-border); border-radius: var(--r-xl);
  backdrop-filter: var(--nbi-glass-blur); padding: 16px 20px; display: flex; align-items: center; gap: 24px;
  box-shadow: var(--sh-card); }
.today-strip .t-label { font-size: var(--fs-body); font-weight: 700; color: var(--nbi-ink-900); white-space: nowrap; }
.today-strip .t-items { display: flex; gap: 20px; font-size: var(--fs-body); color: var(--nbi-ink-600); flex-wrap: wrap; }
.today-strip b { color: var(--nbi-primary); }

/* ---------- Module shell ---------- */
.module-screen { min-height: 100vh; display: flex; flex-direction: column;
  background: var(--nbi-bg-glow), var(--nbi-bg); }
.topnav { gap: 12px; background: var(--nbi-chrome-bg); backdrop-filter: var(--nbi-glass-blur); }
.topnav-sep { width: 1px; height: 20px; background: rgba(29,71,174,0.12); flex-shrink: 0; }
.topnav-menu-btn { display: flex; align-items: center; gap: 7px; font-size: var(--fs-body); font-weight: 600;
  color: var(--nbi-ink-600); background: none; border: 1px solid var(--nbi-line-200); border-radius: var(--r-sm);
  padding: 7px 11px; cursor: pointer; white-space: nowrap; }
.topnav-menu-btn:hover { background: var(--nbi-hover-nav); }
.menu-panel .topnav-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 9px; text-align: left; }
.menu-panel .mp-ico { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; }
.topnav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.breadcrumb-bar .cta { margin-left: auto; }
.crumb.current { cursor: default; }
.module-body { flex: 1; min-width: 0; }

/* ---------- Group landing ---------- */
.grp-landing { padding: 24px 24px 48px; max-width: 1060px; margin: 0 auto; }
.grp-head { display: flex; align-items: center; gap: 13px; }
.grp-title { font-size: 21px; font-weight: 800; color: var(--nbi-ink-900); letter-spacing: -0.01em; }
.grp-desc { font-size: var(--fs-body-s); color: var(--nbi-ink-500); margin-top: 2px; }
.grp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 20px; }
@media (max-width: 900px) { .grp-grid { grid-template-columns: repeat(2, 1fr); } }
.mod-card { text-align: left; display: flex; flex-direction: column; background: var(--nbi-glass-bg);
  border: var(--nbi-glass-border); border-radius: var(--r-xl); backdrop-filter: var(--nbi-glass-blur);
  padding: 16px 18px; box-shadow: var(--sh-card); transition: transform 160ms ease, border-color 160ms ease; cursor: default; }
.mod-card.linked { cursor: pointer; }
.mod-card.linked:hover { border-color: var(--nbi-cyan); transform: translateY(-2px); }   /* item 04 */
.mod-card.linked:active { transform: translateY(0); }
.mod-card.locked { opacity: 0.55; }
.mod-card-title { display: flex; align-items: center; gap: 7px; color: var(--nbi-ink-500); }
.mod-card-title b { font-size: 14px; font-weight: 700; color: var(--nbi-ink-900); }
.mod-card-stat { font-size: var(--fs-body-s); color: var(--nbi-ink-500); margin-top: 6px; }
.mod-card-open { font-size: var(--fs-meta); font-weight: 700; color: var(--nbi-primary); margin-top: 14px; min-height: 15px; }

/* ---------- Module content layouts ---------- */
/* ONE page geometry (owner ruling, 26-Aug interface pass): every screen is a
   centred content column with symmetric margins — the geometry the buyer
   screens already used (.detail-page 1080, .wizard-page 880) — never a
   full-bleed stretch. --page-max governs pages; --form-max governs
   single-record forms, where 880px keeps a two-column pair readable. */
:root { --page-max: 1080px; --form-max: 880px; }
.mod-page { padding: 20px 24px; max-width: var(--page-max); margin: 0 auto; width: 100%;
  box-sizing: border-box; display: flex; flex-direction: column; gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
.grid-3-2 { display: grid; grid-template-columns: 3fr 2fr; gap: 14px; align-items: start; }
.grid-1-1 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1000px) { .grid-2-1, .grid-3-2, .grid-3 { grid-template-columns: 1fr; } }
.col-16 { display: flex; flex-direction: column; gap: 16px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .note { margin-left: auto; font-size: var(--fs-body-s); color: var(--nbi-ink-500); }
.card-pad { padding: 18px 20px; }
.card-title { font-size: var(--fs-card-title); font-weight: 700; color: var(--nbi-ink-900); margin-bottom: 12px; }
.kv-list { display: flex; flex-direction: column; gap: 10px; font-size: var(--fs-body); color: var(--nbi-ink-700); }
.kv-list > div { display: flex; justify-content: space-between; }
.footer-stats { display: flex; gap: 24px; font-size: var(--fs-body); color: var(--nbi-ink-500); padding: 0 4px; flex-wrap: wrap; }
.footer-stats b { color: var(--nbi-ink-900); }
.movement-row { display: flex; gap: 14px; padding: 9px 0; border-top: 1px solid var(--nbi-fill-100); font-size: var(--fs-body); color: var(--nbi-ink-700); }
.movement-row .m-time { color: var(--nbi-ink-400); min-width: 52px; }
.alert-panel { border-radius: var(--r-xl); backdrop-filter: var(--nbi-glass-blur); padding: 16px 18px; }
.alert-panel.red { background: rgba(253,236,234,0.9); border: 1px solid var(--nbi-red-border); }
.alert-panel.blue { background: rgba(232,239,252,0.9); border: 1px solid var(--nbi-blue-border); }
.alert-panel.amber { background: rgba(255,246,230,0.9); border: 1px solid var(--nbi-amber-border); }
.alert-title { font-size: var(--fs-table); font-weight: 700; }
.alert-panel.red .alert-title { color: var(--nbi-red-text); }
.alert-panel.blue .alert-title { color: var(--nbi-primary-deep); }
.alert-panel.amber .alert-title { color: var(--nbi-amber-text); }
.alert-body { font-size: var(--fs-body-s); margin-top: 4px; line-height: 1.5; }
.alert-panel.red .alert-body { color: var(--nbi-red-deep); }
.alert-panel.blue .alert-body { color: var(--nbi-primary-dark); }
.alert-panel.amber .alert-body { color: var(--nbi-amber-deep); }
.alert-actions { display: flex; gap: 8px; margin-top: 10px; }
.btn-sm { font-size: var(--fs-body-s); font-weight: 600; padding: 7px 12px; border-radius: var(--r-sm); border: none; cursor: pointer; }
.ship-card-route { display: flex; justify-content: space-between; align-items: center; }
.ship-card-route b { font-size: 14px; color: var(--nbi-ink-900); }
.ship-eta { display: flex; justify-content: space-between; font-size: var(--fs-meta); color: var(--nbi-ink-400); margin-top: 6px; }

/* ---------- Buyer list ---------- */
.filter-pill { padding: 7px 13px; background: var(--nbi-glass-bg); border: var(--nbi-glass-border);
  border-radius: var(--r-md); font-size: var(--fs-body-s); font-weight: 600; color: var(--nbi-ink-600); cursor: pointer; }
.filter-pill.warn { display: flex; align-items: center; gap: 6px; background: rgba(255,246,230,0.9);
  border: 1px solid var(--nbi-amber-border); color: var(--nbi-amber-text); }
.search-pill { display: flex; align-items: center; gap: 9px; background: var(--nbi-glass-bg);
  border: var(--nbi-glass-border); border-radius: var(--r-md); backdrop-filter: var(--nbi-glass-blur);
  padding: 8px 13px; font-size: var(--fs-body-s); color: var(--nbi-ink-400); min-width: 230px; cursor: text; }
.list-note { font-size: var(--fs-body-s); color: var(--nbi-ink-400); padding: 0 4px; }
.flag-ico { width: 22px; height: 22px; border-radius: var(--r-xs); display: grid; place-items: center; }
.util-cell { display: flex; align-items: center; gap: 8px; }
.util-cell .bar { width: 52px; height: 5px; flex-shrink: 0; }
.country-note { font-size: var(--fs-chip); font-weight: 700; letter-spacing: 0.04em; color: var(--nbi-red-text); margin-top: 2px; }
.ecgc-sub { font-size: 11px; color: var(--nbi-ink-400); margin-top: 3px; }
.empty-state { padding: 64px 24px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.empty-state .e-ico { width: 48px; height: 48px; border-radius: 14px; background: var(--nbi-pink-tint);
  color: var(--nbi-pink-text); display: grid; place-items: center; }
.empty-state .e-title { font-size: var(--fs-tile); font-weight: 700; color: var(--nbi-ink-900); margin-top: 8px; }
.empty-state .e-body { font-size: var(--fs-body); color: var(--nbi-ink-500); max-width: 380px; line-height: 1.5; }
.skel-head { display: flex; gap: 18px; padding: 14px 18px; background: rgba(232,239,252,0.5); }
.skel-head .skel { animation: none; background: #dbe3f0; height: 10px; }
.skel-row { display: flex; align-items: center; gap: 18px; padding: 15px 18px; border-top: 1px solid var(--nbi-fill-100); }

/* ---------- Buyer detail ---------- */
.detail-page { padding: 20px 24px 48px; max-width: var(--page-max); margin: 0 auto; width: 100%; box-sizing: border-box; display: flex; flex-direction: column; gap: 14px; }
.back-link { align-self: flex-start; display: flex; align-items: center; gap: 6px; font-size: var(--fs-body-s);
  font-weight: 600; color: var(--nbi-ink-500); background: none; border: none; cursor: pointer; padding: 2px 4px; }
.back-link:hover { color: var(--nbi-ink-900); }
.detail-head { padding: 18px 20px; display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.detail-head .d-main { flex: 1; min-width: 320px; }
.d-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.d-name { font-size: var(--fs-page-title); font-weight: 800; color: var(--nbi-ink-900); letter-spacing: -0.01em; }
.d-meta-row { display: flex; align-items: center; gap: 6px; margin-top: 9px; }
.d-meta-row .loc { font-size: var(--fs-body-s); color: var(--nbi-ink-500); margin-left: 4px; }
.d-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-outline-sm { font-size: var(--fs-body-s); font-weight: 600; padding: 8px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--nbi-line-200); background: #fff; color: var(--nbi-ink-700); cursor: pointer; }
.btn-outline-sm:hover { border-color: var(--nbi-primary); color: var(--nbi-primary); }
.btn-tint-sm { font-size: var(--fs-body-s); font-weight: 600; padding: 8px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--nbi-blue-border); background: var(--nbi-blue-tint); color: var(--nbi-primary-dark); cursor: pointer; }
.btn-tint-sm:hover { background: #dbe7fe; }
.acc-section { overflow: hidden; }
.acc-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 14px 18px;
  background: none; border: none; cursor: pointer; text-align: left; }
.acc-head:hover { background: rgba(232,239,252,0.4); }
.acc-head .chev { transition: transform 0.15s ease; flex-shrink: 0; }
.acc-head.open .chev { transform: rotate(180deg); }
.acc-title { font-size: var(--fs-table); font-weight: 700; color: var(--nbi-ink-900); }
.acc-side { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.acc-body { padding: 0 18px 18px; border-top: 1px solid var(--nbi-fill-100); }
.field-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 20px; padding-top: 16px; }
@media (max-width: 800px) { .field-grid { grid-template-columns: 1fr; } }
.fv .field-label { color: var(--nbi-ink-400); }
.fv .v { font-size: var(--fs-table); color: var(--nbi-ink-700); margin-top: 4px; }
.fv .v.strong { font-weight: 600; color: var(--nbi-ink-900); }
.fv .v.mono { font-family: var(--nbi-mono); font-size: var(--fs-body-s); }
.limit-panel { border-radius: var(--r-lg); padding: 14px 16px; }
.limit-panel.nbi { background: rgba(232,239,252,0.7); border: 1px solid var(--nbi-blue-border); max-width: 420px; }
.limit-panel.ecgc { background: rgba(238,244,238,0.85); border: 1px solid var(--nbi-green-border); }
.limit-panel.plain { background: #fff; border: 1px solid var(--nbi-line-100); }
.limit-panel.red { background: rgba(253,236,234,0.85); border: 1px solid var(--nbi-red-border); }
.limit-label { font-size: var(--fs-caption); font-weight: 700; letter-spacing: 0.05em; }
.limit-amount { font-family: var(--nbi-mono); font-size: 22px; font-weight: 700; margin-top: 6px; }
.limit-note { font-size: var(--fs-meta); color: var(--nbi-ink-600); margin-top: 4px; line-height: 1.5; }
.inline-warn { display: flex; align-items: flex-start; gap: 8px; font-size: var(--fs-body-s); color: var(--nbi-amber-deep); }
.contact-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; flex-wrap: wrap; }
.contact-row + .contact-row { border-top: 1px solid var(--nbi-fill-100); }
.contact-row b { font-size: var(--fs-table); color: var(--nbi-ink-900); }
.contact-row .role { font-size: var(--fs-body-s); color: var(--nbi-ink-500); }
.sub-table { width: 100%; border-collapse: collapse; font-size: var(--fs-body-s); }
.sub-table thead tr { text-align: left; color: var(--nbi-ink-500); font-size: 11.5px; }
.sub-table th { padding: 8px 8px; font-weight: 600; }
.sub-table th:first-child, .sub-table td:first-child { padding-left: 0; }
.sub-table th:last-child, .sub-table td:last-child { padding-right: 0; }
.sub-table td { padding: 11px 8px; }
.sub-table tbody tr { border-top: 1px solid var(--nbi-fill-100); }
.mini-chip { font-size: var(--fs-chip); font-weight: 700; padding: 2px 8px; border-radius: var(--r-full); white-space: nowrap; }
.tl-row { display: flex; gap: 14px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.tl-line { flex: 1; width: 2px; background: var(--nbi-line-100); }
.tl-body { flex: 1; padding-bottom: 16px; }
.tl-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-text { font-size: var(--fs-body-s); color: var(--nbi-ink-700); margin-top: 8px; }
.tl-meta { font-size: 11.5px; color: var(--nbi-ink-500); margin-top: 4px; }
.tl-quote { margin-top: 8px; background: #fff; border: 1px solid var(--nbi-red-border); border-radius: var(--r-md);
  padding: 10px 12px; font-size: var(--fs-body-s); color: var(--nbi-red-deep); line-height: 1.5; }

/* ---------- Add buyer wizard ---------- */
/* .form-page is the same geometry for any single-record form (vendor add/edit). */
.wizard-page, .form-page { padding: 20px 24px 48px; max-width: var(--form-max); margin: 0 auto; width: 100%; box-sizing: border-box; display: flex; flex-direction: column; gap: 14px; }
.wizard-card { padding: 22px 24px; }
.steps-row { display: flex; align-items: center; }
.step-seg { display: flex; align-items: center; }
.step-seg.grow { flex: 1 1 auto; }
.step-dot { width: 30px; height: 30px; border-radius: 50%; font-weight: 700; font-size: var(--fs-body-s);
  display: grid; place-items: center; cursor: pointer; flex-shrink: 0; border: 1px solid var(--nbi-line-200);
  background: #fff; color: var(--nbi-ink-500); }
.step-dot.on { background: var(--nbi-grad); color: #fff; border: none; }
.step-label { font-size: var(--fs-meta); font-weight: 600; color: var(--nbi-ink-500); margin-left: 9px; white-space: nowrap; }
.step-label.current { color: var(--nbi-ink-900); }
.step-line { flex: 1; height: 2px; background: var(--nbi-line-100); margin: 0 14px; min-width: 20px; }
.wizard-body { margin-top: 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid .full { grid-column: 1 / -1; }
.wizard-footer { display: flex; align-items: center; gap: 10px; margin-top: 22px; padding-top: 16px;
  border-top: 1px solid var(--nbi-fill-100); }
.wizard-footer .spacer { margin-left: auto; }
.review-box { border: 1px solid var(--nbi-line-100); border-radius: var(--r-lg); padding: 14px 16px; }
.review-box .r-label { font-size: var(--fs-caption); font-weight: 700; letter-spacing: 0.05em; color: var(--nbi-ink-500); }
.review-box .r-body { font-size: var(--fs-body); color: var(--nbi-ink-700); margin-top: 8px; line-height: 1.7; }
.success-panel { margin-top: 26px; display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 8px; padding-bottom: 8px; }
.success-panel .s-ico { width: 46px; height: 46px; border-radius: 50%; background: var(--nbi-green-tint);
  color: var(--nbi-green-text); display: grid; place-items: center; }
.success-panel .s-title { font-size: 19px; font-weight: 800; color: var(--nbi-ink-900); margin-top: 6px; }

/* ---------- Group view ---------- */
.grp-limit-row { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.payer-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--nbi-fill-100);
  flex-wrap: wrap; font-size: var(--fs-body-s); color: var(--nbi-ink-700); }
.flag-line { display: flex; align-items: center; gap: 8px; font-size: var(--fs-body-s); }

/* ===== B8a access control screens — tokens only, no new colours or type scale ===== */
.acc-two-pane { display:grid; grid-template-columns:280px 1fr; gap:14px; align-items:start; }
@media (max-width:900px){ .acc-two-pane{ grid-template-columns:1fr; } }

.acc-set-row { padding:9px 10px; border-radius:8px; cursor:pointer; border:1px solid transparent; }
.acc-set-row:hover { background:var(--nbi-hover-row); }
.acc-set-row.is-sel { background:var(--nbi-blue-tint); border-color:var(--nbi-line-300); }

.acc-grid th, .acc-grid td { vertical-align:top; }
.acc-group-row td { background:var(--nbi-fill-100); }
/* D-477 (B8a build 3, 24-Oct-2026) — the column header and the group heading rows stay up while the grid
   scrolls ("I forget which is the series"). Sticky on the CELLS, not the tr. The offsets are MEASURED after
   every paint and on resize (app.js fitPermissionGrid): --acc-head-top is the top bar's height, --acc-group-top
   the top bar plus the header's. A sticky cell is held inside the whole table, so the next group row slides up
   over the current one. Opaque tokens: the thead row's own background is translucent. The review sheet (z 60)
   and the top bar (z 6) stay above. */
.acc-grid thead th { position:sticky; top:var(--acc-head-top, 0px); z-index:2; background:var(--nbi-blue-tint); }
.acc-group-row td { position:sticky; top:var(--acc-group-top, 0px); z-index:1; }
/* A module row's indent under its group — inline on the cell until D-477, here so the narrow rule can ease it. */
.acc-grid tbody tr:not(.acc-group-row) > td:first-child { padding-left:24px; }
.acc-planned td { opacity:.62; }

.acc-tick { width:24px; height:24px; border-radius:6px; border:1.5px solid var(--nbi-line-300);
  background:#fff; cursor:pointer; font-size:13px; line-height:1; color:var(--nbi-primary);
  font-weight:700; padding:0; }
.acc-tick:hover { border-color:var(--nbi-primary); }
.acc-all { background:var(--nbi-primary); border-color:var(--nbi-primary); color:#fff; }
.acc-partial { background:var(--nbi-blue-tint); border-color:var(--nbi-primary); }
/* The unticked state — referenced since the grid shipped, defined nowhere
   until the class check caught it on its first real run (26-Aug). The base
   .acc-tick already renders the off state; this records the name as decided
   rather than leaving it to fall through. */
.acc-none { background:#fff; color:var(--nbi-line-300); }

.acc-savebar { position:sticky; bottom:0; margin-top:12px; display:flex; align-items:center; gap:10px;
  padding:11px 14px; border-radius:10px; background:var(--nbi-chrome-bg);
  border:1px solid var(--nbi-chrome-border); font-size:13px; }

.acc-chip { display:inline-flex; align-items:center; gap:5px; }
.acc-chip-x { border:0; background:transparent; cursor:pointer; font-size:13px; line-height:1;
  color:inherit; opacity:.6; padding:0 1px; }
.acc-chip-x:hover { opacity:1; }

.acc-src { font-size:10.5px; color:var(--nbi-ink-500); margin-top:3px; line-height:1.45; }
.acc-ea td { vertical-align:top; }

.acc-modal-wrap { position:fixed; inset:0; background:rgba(16,24,40,.42); display:flex;
  align-items:center; justify-content:center; padding:20px; z-index:60; }
.acc-modal { background:#fff; border-radius:12px; padding:20px; width:100%; max-width:560px;
  max-height:86vh; overflow:auto; border:1px solid var(--nbi-line-200); }
/* D-491 (B8a build 4, 24-Oct-2026): a card's backdrop-filter makes it the containing block of a fixed
   descendant, and its overflow clips it, so a sheet drawn inside a card was cut to the card's height (the
   C5 move sheet in its Documentation card). A card holding an open sheet drops both while the sheet is open;
   the record sheet (.sheet) keeps its own blur and holds a sheet drawn inside it whole. */
.card:has(.acc-modal-wrap) { backdrop-filter: none; -webkit-backdrop-filter: none; overflow: visible; }

/* HOME empty state — the zero-sets floor. Every seat between offboarding and
   reassignment, and every new seat before its first set, lands here. */
.home-empty { max-width:560px; margin:6px auto 0; padding:20px 22px;
  background:var(--nbi-glass-bg); border:1px solid var(--nbi-line-200); border-radius:12px; }
.home-empty-title { font-family:var(--nbi-font); font-size:16px; font-weight:700;
  color:var(--nbi-ink-900); }
.home-empty-body { font-size:13px; line-height:1.65; color:var(--nbi-ink-600); margin-top:8px; }

/* ---------- Build status panel (interaction idea 21) ----------
   Direction 6e, the language the shell is already locked to: frosted glass
   card, dashed-orbit ground behind it, navy and cyan, no new surface type. The
   panel is a .card like every other container on the screen.

   The chip palette is the whole point of the section, so it is spelled out
   rather than reusing .chip: LIVE is a filled navy statement, IN BUILD is the
   pale ground with a cyan edge, PLANNED is a grey outline that recedes. All
   four states come from existing tokens — no colour is introduced here. */
.build-panel { background: var(--nbi-glass-bg); border: var(--nbi-glass-border);
  border-radius: var(--r-xl); backdrop-filter: var(--nbi-glass-blur); box-shadow: var(--sh-card);
  padding: 22px 24px; margin-top: 20px; position: relative; z-index: 1; }
.bp-head { margin-bottom: 18px; }
.bp-title { font-size: var(--fs-page-title); font-weight: 800; color: var(--nbi-ink-900); letter-spacing: -0.01em; }
.bp-sub { font-size: var(--fs-body-s); color: var(--nbi-ink-500); margin-top: 3px; }

.bp-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 980px) { .bp-tiles { grid-template-columns: repeat(2, 1fr); } }
.bp-tile { background: rgba(255,255,255,0.6); border: 1px solid var(--nbi-line-100);
  border-radius: var(--r-lg); padding: 14px 16px; }
.bp-tile-v { font-size: var(--fs-stat); font-weight: 800; color: var(--nbi-primary);
  letter-spacing: -0.02em; line-height: 1.1; }
.bp-tile-k { font-size: var(--fs-body-s); color: var(--nbi-ink-700); margin-top: 6px; font-weight: 600; }
/* Provenance under every figure. A stated constant and a live reading must
   never look alike on a dashboard whose whole claim is that it is honest. */
.bp-tile-src { font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--nbi-ink-400); margin-top: 8px; }

/* .bp-rails / .bp-rail* are REMOVED with the phase rails (D119, 01-Sep-2026):
   a typed rail contradicted the live chips on the same screen. See the note
   in build-panel.js for what it takes to bring them back derived. */

.bp-groups { margin-top: 22px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 24px; }
@media (max-width: 900px) { .bp-groups { grid-template-columns: 1fr; } }
.bp-group-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.bp-group-name { font-size: var(--fs-body); font-weight: 700; color: var(--nbi-ink-900); }
.bp-group-count { font-size: var(--fs-meta); color: var(--nbi-ink-400); }
.bp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bchip { font-size: var(--fs-chip); font-weight: 700; letter-spacing: 0.02em;
  padding: 4px 9px; border-radius: var(--r-full); border: 1px solid transparent; }
.bchip.bc-live    { background: var(--nbi-primary); color: #fff; }
.bchip.bc-build   { background: var(--nbi-blue-tint); border-color: var(--nbi-cyan); color: var(--nbi-primary-dark); }
.bchip.bc-planned { background: transparent; border-color: var(--nbi-line-300); color: var(--nbi-ink-400); }
.bchip.bc-retired { background: transparent; border-color: var(--nbi-line-200);
  color: var(--nbi-ink-400); text-decoration: line-through; }

.bp-legend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--nbi-line-100); }
.bp-legend-note { font-size: var(--fs-meta); color: var(--nbi-ink-400); }
.bp-note { font-size: var(--fs-body-s); color: var(--nbi-ink-500); margin-top: 20px;
  background: rgba(255,255,255,0.6); border: 1px solid var(--nbi-line-100);
  border-radius: var(--r-lg); padding: 14px 16px; line-height: 1.55; }
.bp-note-warn { border-color: var(--nbi-amber-border); background: rgba(255,246,230,0.7);
  color: var(--nbi-amber-deep); }

/* ============ Shared component layer (interface pass, 26-Aug-2026) ============
   The classes the component layer (js/ui.js) and the screens reference beyond
   the 06-Aug system file. Every class here EARNS its place: it is referenced by
   a live screen and duplicates nothing in nbi-erp.css. Classes that duplicated
   a system class were retired instead (.tbl -> .table, .kv-grid -> .form-grid /
   .field-grid, empty-title/empty-sub -> .e-title/.e-body, the vendor tab set ->
   the accordion section). The class check (functions/test) fails the build if a
   screen references a class no stylesheet defines. */

/* Filter/type chips (vendor list filters, vendor-type multi-select). Selected
   state is a filled primary pill - visibly distinct, Finding E item 2. */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { font: inherit; font-size: var(--fs-body-s); font-weight: 600; padding: 6px 14px;
  border-radius: 16px; border: 1px solid var(--nbi-line-300); background: #fff;
  color: var(--nbi-ink-600); cursor: pointer; }
.chip-btn:hover { border-color: var(--nbi-ink-400); color: var(--nbi-ink-900); }
.chip-btn-on, .chip-btn-on:hover { background: var(--nbi-primary); border-color: var(--nbi-primary); color: #fff; }

/* Small text roles */
.hint-xs { font-size: 12px; color: var(--nbi-ink-400); margin-top: 3px; line-height: 1.5; }
.muted { color: var(--nbi-ink-400); }
.link-strong { font-weight: 650; color: var(--nbi-primary); text-decoration: none; }
.link-strong:hover { color: var(--nbi-primary-deep); text-decoration: underline; }

/* Layout helpers */
.row-between { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sec-title { font-size: 13.5px; font-weight: 700; color: var(--nbi-ink-900); }

/* Loading skeleton line - height built in, so a skeleton can never be an
   invisible zero-height element (Finding E). */
.skel-line { height: 12px; }
.skel-line + .skel-line { margin-top: 10px; }

/* Blacklisted register rows: visible, dimmed, tinted - never hidden (D36). */
.row-blacklisted td { color: var(--nbi-ink-400); background: rgba(253,236,234,0.35); }

/* Administration section tabs (the .seg segmented control's items). */
.seg-item { font: inherit; font-size: var(--fs-body-s); font-weight: 600; border: none;
  background: none; color: var(--nbi-ink-500); cursor: pointer; }
.seg-item:hover { color: var(--nbi-ink-900); }
.seg-item.is-on { background: var(--nbi-primary); color: #fff; border-radius: var(--r-sm); }

/* Build panel group container */
.bp-group { margin-top: 14px; }

/* ============ D160 / D-134 — phones: nothing breaks at 375px (01-Sep-2026) ============
   The quotation module is built for WhatsApp workflows; staff work from
   phones. Scope is deliberately narrow: NOTHING BREAKS at 375px — no screen
   is redesigned. Shared rules only, no per-screen media queries (Interface
   Conformance SPEC §10); no markup changed, so the class check is untouched.

   THE CLASS 11 LEDGER — what these rules make unreachable, and its cover:
     - The Command Center button is REMOVED at every width (My Work Home
       polish, 06-Nov-2026). Go-home is reachable at every width through the
       My work tab or, where the tabs fold into the menu (1120px and below),
       the menu panel's My work entry. D-27's lesson checked, not assumed.
     - .topnav-search was hidden here ≤640px until 01-Sep, when D166 removed
       the control at every width — it searched nothing. (Owner item 8: the
       ⌘K badge question is moot with the boxes gone.)
     - .step-label hidden ≤640px except the current one. The numbered
       .step-dot for every step remains visible and clickable.
   Nothing else is removed; everything else is clamped, stacked or scrolled. */

/* Fixed-width cards clamp instead of overflowing. The profile screen sets an
   inline width:440px (live.js) and the login card is 400px. max-width:100%
   does NOT work here: the login screen centres with an auto-sized grid
   track, the track grows to the card's 440px first, and 100% then resolves
   against the grown track — measured still 440 wide, clipped unreadably by
   the screen's overflow:hidden. The viewport unit has no such circularity;
   48px is the login screen's own side padding. */
.login-card { max-width: calc(100vw - 48px); }

/* Grid items default to min-width:auto, so a card whose content min-width
   exceeds the column makes the column grow past its own container — found
   live at 375px: the admin sets card forced the single 1fr column to 412px
   and the page scrolled sideways. min-width:0 lets the column hold its size
   and the content wrap inside it; on desktop it also lets the permission
   grid scroll inside the 1fr pane instead of widening it. */
.acc-two-pane > * { min-width: 0; }

@media (max-width: 640px) {
  .topnav { padding: 0 12px; gap: 8px; }
  .topnav-sep { display: none; }
  /* Owner item 7 (01-Sep-2026) — the breadcrumb at phone widths. The D-134
     scroll hid the register's primary CTA past the right edge (measured in a
     rig against these stylesheets: "+ Add vendor" right edge 431px in a
     375px viewport, no scroll affordance). Class 11 enumeration — Home
     crumb, group crumb, module name, CTA: the CTA is the one control that
     must never leave the screen. So the bar WRAPS AS AN ALIGNED UNIT instead
     of scrolling: each crumb stays whole (nowrap), every row keeps the 44px
     touch floor, and the CTA drops to its own right-aligned row when the
     crumbs fill the first. The module-name crumb ellipsizes past 55vw —
     what the ellipsis hides is display text only; no control is lost. */
  .breadcrumb-bar { padding: 0 12px; height: auto; min-height: 44px; flex-wrap: wrap; }
  .breadcrumb-bar .crumb { white-space: nowrap; }
  .breadcrumb-bar .crumb.current { overflow: hidden; text-overflow: ellipsis; max-width: 55vw; }
  /* The group menu panel opens left-anchored from mid-bar and its 250px hung
     past the right edge (measured 409px of page at 375). Anchoring it to the
     button's right edge keeps it inside; the account menu already does this. */
  .topnav-menu .menu-panel { left: auto; right: 0; max-width: calc(100vw - 24px); }
  /* My Work Home (06-Nov-2026): the area names are longer than the legacy group names ("Purchase and suppliers"); the
     current area's name on the menu button is display text and ellipsizes, so the avatar never leaves a 375 px screen
     (measured on the rig: the bar ran to 391 px on a module screen; the home, which names no area, fit). */
  .topnav-menu { min-width: 0; flex: 0 1 auto; }
  .topnav-menu-btn { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
  .home-main { padding: 24px 16px 48px; }
  .home-sets { display: flex; margin-left: 0; margin-top: var(--sp-2); }
  .home-ring { top: -140px; right: -100px; width: 240px; height: 240px; }
  .topnav-menu-btn svg { margin-right: var(--sp-2); vertical-align: middle; }
  .home-bar { padding: 0 16px; }
  .grp-landing { padding: 20px 16px 40px; }
  .mod-page { padding: 16px 12px; }
  .detail-page { padding: 16px 12px 40px; }
  .wizard-page, .form-page { padding: 16px 12px 40px; }
  /* 320px of guaranteed width cannot fit inside a 375px viewport's card.
     D-464 (Bundle 2, 22-Oct-2026): with min-width 0 alone, short actions (Issue and Render specimen) sat BESIDE the
     title block and squeezed it to 6px at 360 — the number broke and the buyer line ran one word per line. On a
     phone the title block takes its own row; the actions wrap below it. Every detail page shares this rule. */
  .detail-head .d-main { min-width: 0; flex-basis: 100%; }
  .step-label { display: none; }
  .step-label.current { display: block; white-space: normal; }
}

/* Data tables scroll inside their own card instead of stretching the page.
   The ui.js table() wrapper already scrolls; display:block catches the
   tables written before it existed (admin grid, import preview, audit
   tables) without touching their markup. A table narrower than its card
   no longer stretches to fill it at these widths — accepted, because at
   phone widths a data table is almost always wider than its card. */
@media (max-width: 720px) {
  .table, .sub-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* D-477: the permission grid alone is NOT a sideways scroll box — a scroll box would capture its sticky
     header and group rows. Its five columns fit the card instead (309px at 375: the page's 12px and the
     card's 20px a side); every other table keeps the rule above. */
  .table.acc-grid { display: table; overflow-x: visible; }
  .acc-grid th, .acc-grid td { padding-left: 2px; padding-right: 2px; }
  .acc-grid th:first-child, .acc-grid td:first-child { padding-left: 8px; overflow-wrap: anywhere; }
  .acc-grid th:last-child, .acc-grid td:last-child { padding-right: 8px; }
  /* the widest rows (C2): a management-only badge beside four 44px ticks — the badge may break at its hyphen
     and the module indent eases, so the module column fits what the ticks leave */
  .acc-grid tbody tr:not(.acc-group-row) > td:first-child { padding-left: 12px; }
  .acc-grid .chip { white-space: normal; }
}

/* Thumb targets: 44px minimum on touch pointers, and on phone-width windows
   so the floor is verifiable in a resized browser. Status chips (.chip) are
   read-only and deliberately excluded. */
@media (pointer: coarse), (max-width: 640px) {
  .btn, .btn-sm, .btn-ghost, .btn-tint, .btn-danger, .btn-outline-sm, .btn-tint-sm,
  .chip-btn, .topnav-item, .topnav-menu-btn, .filter-pill, .seg > *, .seg-item,
  .crumb { min-height: 44px; }
  /* The 44px floor turned the current-crumb SPAN into a 44px box whose text
     TOP-ALIGNS — a button centres its label natively, a block-level span does
     not. Measured 13px of baseline drift between "Home" and the current crumb
     at 375px: the visible half of owner item 7 ("loses its baseline").
     Buttons centre via inline-flex; the current crumb stays block-level so
     text-overflow ellipsis keeps working, and centres by line-height. */
  button.crumb { display: inline-flex; align-items: center; }
  .crumb.current { line-height: 44px; }
  .btn-text, .back-link { min-height: 44px; display: inline-flex; align-items: center; }
  /* .sheet .sheet-close, not bare: interactions.css declares the 28px base
     AFTER this file in the cascade, so the bare selector loses. Measured
     28x28 live before this was raised to two classes. */
  .avatar, .sheet .sheet-close, .step-dot { width: 44px; height: 44px; }
  .acc-tick { width: 44px; height: 44px; }
}

/* ============ Owner brief 01-Sep-2026, item 9 — the mobile browser bar ============
   The last tile row sat under the browser's bottom bar at 375px: 100vh
   includes the strip behind the collapsing URL bar, and nothing reserved the
   safe-area inset. dvh tracks the VISIBLE viewport where supported (the vh
   line before it is the fallback for engines without dvh); the env() pad
   reserves the device inset where one exists and resolves to 0 everywhere
   else. Shared shells only — no per-screen rule. Placed after the 640px
   block deliberately: same specificity, later in the cascade, so the
   safe-area floor holds at phone widths too. */
.home-screen, .module-screen, .login-screen { min-height: 100vh; min-height: 100dvh; }
.home-main, .module-body, .grp-landing {
  padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px)); }

/* My Work mobile and visual polish (19-Nov-2026): the quick-note button clears the last content on every shared shell where a
   phone or tablet shows it; the quick-note sheet's title shares the fields' left edge and its Save row stays reachable. */
@media (max-width: 1024px) {
  .home-main, .module-body, .grp-landing {
    padding-bottom: calc(var(--fab-clear) + env(safe-area-inset-bottom, 0px)); }
}
.acc-modal .sheet-head { padding-left: 0; padding-right: 0; }
.acc-modal { max-height: 86vh; max-height: 86dvh; }
.qn-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; flex-wrap: wrap;
  position: sticky; bottom: calc(-1 * var(--sp-5)); background: var(--nbi-white); padding: var(--sp-2) 0; }
@media (max-width: 480px) { .bp-tiles { grid-template-columns: 1fr; } }
.bp-tile-src { overflow-wrap: break-word; word-break: normal; }
/* the menu panel hangs inside the screen whatever the width of the button that opens it (a seat with one short label measured
   2px past the left edge at 375) */
@media (max-width: 720px) {
  .topnav-menu .menu-panel { position: fixed; top: 48px; left: var(--sp-3); right: auto; width: min(250px, calc(100vw - 24px)); }
}

/* ============ MOBILE POLISH SWEEP (20-Nov-2026) ============
   Shared rules only; tokens only, no colour literal. Nothing above 720px changes except that the toolbar's right-hand cell and the
   count label are classes now (the same box, the same look) instead of inline styles. */
.toolbar-count { font-size: 13px; color: var(--nbi-ink-500); }
.toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.toolbar-right-end, .toolbar-end { margin-left: auto; }
.empty-state .e-actions { display: flex; gap: 10px; margin-top: 14px; }

/* (a) iOS Safari zooms the page on focus of any text control under 16px; the fix is the size, never user-scalable. The
   selector carries the type exclusions so it outranks every class that sets a smaller size on a control. */
@media (pointer: coarse), (max-width: 640px) {
  :is(input, select, textarea, .input):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="button"]):not([type="submit"]) { font-size: 16px; min-height: 44px; box-sizing: border-box; }
}

/* (a) the visible viewport (js/app.js sets --vv-h and --vv-top from window.visualViewport): a sheet and a modal follow the
   visible height, so the keyboard never covers the action row; where visualViewport is absent the variables are unset and
   every rule below falls back to what it was. */
@media (pointer: coarse), (max-width: 640px) {
  .acc-modal-wrap { top: var(--vv-top, 0px); bottom: auto; height: var(--vv-h, 100%); padding: var(--sp-3); box-sizing: border-box; }
  .acc-modal { max-height: calc(var(--vv-h, 100dvh) - var(--sp-6)); overflow-y: auto; overscroll-behavior: contain; }
  .acc-modal .d-actions, .acc-modal .qn-actions { position: sticky; bottom: calc(-1 * var(--sp-5)); z-index: 1; background: var(--nbi-white);
    padding: var(--sp-2) 0 calc(var(--sp-2) + env(safe-area-inset-bottom, 0px)); }
  .sheet { top: var(--vv-top, 0px); bottom: auto; height: var(--vv-h, 100%); }
}

@media (max-width: 720px) {
  /* (c2) the toolbar stacks: the count on its own line, the search full width, the create button full width at the 44px floor */
  .toolbar { flex-direction: column; align-items: stretch; gap: var(--sp-2); }
  .toolbar-right, .toolbar-right-end, .toolbar-end { margin-left: 0; }
  .toolbar-right { width: 100%; flex-direction: column; align-items: stretch; justify-content: flex-start; }
  .toolbar-right > * { width: 100%; box-sizing: border-box; }
  .toolbar-right > span, .toolbar-right > div { flex-wrap: wrap; }
  .toolbar-right .btn { flex: 1 1 100%; justify-content: center; }
  .toolbar-right .input-search, .toolbar-right .input { max-width: none; width: 100%; }
  .toolbar-right .btn-primary { width: 100%; justify-content: center; text-align: center; }
  .toolbar-right .btn { min-height: 44px; }
  /* (c4) the chips are one row that scrolls sideways; the last chip shows part-way so the row reads as scrollable */
  .chip-row { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; scroll-snap-type: x proximity;
    padding-bottom: 2px; }
  .chip-row::-webkit-scrollbar { display: none; }
  .chip-row .chip-btn { flex: 0 0 auto; white-space: nowrap; scroll-snap-align: start; }
  /* (c5) an empty list is no taller than its words */
  .empty-state { padding: var(--sp-5) var(--sp-4); }
  .empty-state .e-actions { flex-wrap: wrap; justify-content: center; }
}
