/* Portal-specific styles. Everything structural (topbar, tables, badges,
 * count-pills, modal, theme tokens) comes from the shared admin style.css.
 * This file only adds the login screen + minor portal affordances. */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
  background: var(--bg-page);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-surface);
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  padding: var(--sp-7) var(--sp-6);
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
}
.login-logo { height: 40px; width: auto; margin: 0 auto var(--sp-2); }
.login-logo-light { display: none; }
.login-logo-dark { display: block; }
[data-theme="ice"] .login-logo-light,
[data-theme="paper"] .login-logo-light { display: block; }
[data-theme="ice"] .login-logo-dark,
[data-theme="paper"] .login-logo-dark { display: none; }

.login-tagline {
  color: var(--text-secondary);
  font-size: 13px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin: 0 0 var(--sp-6);
}
.login-form { display: flex; flex-direction: column; gap: var(--sp-4); text-align: left; }
.login-label {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  font-size: 13px;
  color: var(--text-secondary);
}
.login-error {
  color: var(--alert);
  font-size: 13px;
  padding: var(--sp-2) var(--sp-3);
  background: rgba(226, 75, 74, 0.10);
  border-radius: var(--r-sm);
}

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  border: 0;
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 120ms ease;
}
.btn-primary:hover { opacity: 0.92; }
.btn-primary:disabled { opacity: 0.5; cursor: default; }

/* App shell fills the viewport so the shared #layout grid (320px + 1fr)
 * and the scrollable #sidebar / #mainView from the admin style.css work.
 * The admin puts these rules on <body>, but the portal nests everything in
 * #appShell (a sibling of the login screen), so replicate them here. */
#appShell { height: 100vh; display: flex; flex-direction: column; }
#appShell #layout { flex: 1; min-height: 0; }

/* ============================================================
   REG-087 - Responsive shell + collapsible / pinnable left nav.
   All portal-only (shared admin style.css is untouched). The state
   lives on #appShell[data-nav]:
     expanded  (default) - 320px sidebar, always open (pinned)
     collapsed           - 56px icon rail; HOVER expands to a 320px
                           overlay without shoving the content
   On narrow screens the sidebar becomes an off-canvas drawer toggled
   by the topbar hamburger (data-nav is ignored under the breakpoint).
   ============================================================ */

/* Toggle buttons (injected by portal.js into the topbar + sidebar). */
.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: 0 0 auto;
  border-radius: var(--r-md);
  border: 0.5px solid var(--border-2);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  cursor: pointer; font-size: 16px; line-height: 1;
  transition: background .12s ease, color .12s ease;
}
.nav-toggle:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
#navHamburger { display: none; margin-right: 4px; }  /* mobile only */
.side-nav-toggle-row {
  display: flex; align-items: center; justify-content: flex-end;
  margin: -4px -4px 2px 0;
}
.side-collapsed-only { display: none; }

/* ---- Desktop: pinned (expanded) is the shared default (320px 1fr) ---- */

/* ---- Desktop: collapsed rail ----
   REG-099 v2: the earlier version kept the rail as a 56px GRID column and only
   went position:fixed ON HOVER. Flipping a grid child in/out of flow on hover
   still made Chrome drop the #mainView scroll-container paint (blank screen).
   NEW approach: when collapsed the sidebar is `position: fixed` AT ALL TIMES
   (both the 56px rail AND the hover flyout), and #layout becomes a SINGLE
   column with a static 56px left padding for #mainView. The grid track NEVER
   resizes and #mainView's box NEVER changes on hover - so there is nothing for
   the compositor to drop. Hover just widens the already-fixed sidebar. */
@media (min-width: 901px) {
  #appShell[data-nav="collapsed"] #layout {
    grid-template-columns: 1fr;
    padding-left: 56px;               /* reserve the rail's width statically */
  }
  #appShell[data-nav="collapsed"] #sidebar {
    position: fixed;
    top: var(--topbar-h, 58px); bottom: 0; left: 0; width: 56px;
    padding: var(--sp-3) 8px;
    overflow: hidden;
    z-index: 60;
    transition: width .14s ease;
    background: var(--bg-surface);
    border-right: 0.5px solid var(--border-2);
  }
  /* Hide the real content of the rail until hover; keep just the toggle rail. */
  #appShell[data-nav="collapsed"] #sidebar > .side-section:not(.side-nav-host) { display: none; }
  #appShell[data-nav="collapsed"] #sidebar .side-nav-toggle-row { justify-content: center; margin-right: 0; }
  #appShell[data-nav="collapsed"] #sidebar .side-collapsed-only {
    display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 8px;
  }
  /* Hover / keyboard focus just WIDENS the already-fixed rail to 320px and
     reveals its content. #mainView is untouched (its 56px padding stays), so
     the flyout floats over the content and nothing reflows or blanks.
     ALL expand rules are gated on :not([data-just-collapsed]) so that right
     after a click-collapse (pointer still over the rail, button possibly still
     focused) NOTHING re-expands - the rail visibly collapses immediately and
     hover-to-peek only resumes once the pointer has left and re-entered. */
  #appShell[data-nav="collapsed"]:not([data-just-collapsed]) #sidebar:hover,
  #appShell[data-nav="collapsed"]:not([data-just-collapsed]) #sidebar:focus-within {
    width: 320px;
    padding: var(--sp-4);
    box-shadow: 4px 0 24px rgba(0,0,0,0.28);
    overflow: hidden auto;
  }
  #appShell[data-nav="collapsed"]:not([data-just-collapsed]) #sidebar:hover > .side-section,
  #appShell[data-nav="collapsed"]:not([data-just-collapsed]) #sidebar:focus-within > .side-section { display: flex; }
  #appShell[data-nav="collapsed"]:not([data-just-collapsed]) #sidebar:hover .side-nav-toggle-row,
  #appShell[data-nav="collapsed"]:not([data-just-collapsed]) #sidebar:focus-within .side-nav-toggle-row { justify-content: flex-end; }
  #appShell[data-nav="collapsed"]:not([data-just-collapsed]) #sidebar:hover .side-collapsed-only,
  #appShell[data-nav="collapsed"]:not([data-just-collapsed]) #sidebar:focus-within .side-collapsed-only { display: none; }
}

/* ---- Mobile / narrow: off-canvas drawer ---- */
@media (max-width: 900px) {
  #navHamburger { display: inline-flex; }
  #appShell #layout { grid-template-columns: 1fr; }  /* content full-width */
  #appShell #sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: min(320px, 86vw);
    z-index: 120;
    transform: translateX(-100%);
    transition: transform .18s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.32);
    padding-top: calc(var(--sp-4) + 8px);
  }
  #appShell[data-nav="open"] #sidebar { transform: translateX(0); }
  /* dimmed backdrop behind the open drawer */
  #navBackdrop {
    display: none; position: fixed; inset: 0; z-index: 110;
    background: rgba(3,8,18,0.55);
  }
  #appShell[data-nav="open"] #navBackdrop { display: block; }
  /* the in-sidebar collapse toggle is desktop-only; hide on mobile drawer */
  #appShell #sidebar .side-nav-toggle-row { display: none; }
}
@media (min-width: 901px) {
  #navBackdrop { display: none !important; }
}

/* Clickable count pills on the asset detail (reuse admin visuals) */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}
.detail-cell {
  background: var(--bg-surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
}
.detail-cell .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}
.detail-cell .value { color: var(--text-primary); font-size: 15px; word-break: break-word; }

.thumb-strip { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-5); }
.thumb {
  width: 160px; height: 120px; object-fit: cover;
  border-radius: var(--r-md); border: 1px solid var(--border-2);
  cursor: pointer; background: var(--bg-surface-2);
  transition: transform 120ms ease, border-color 120ms ease;
}
.thumb:hover { transform: scale(1.02); border-color: var(--border-1); }

/* REG-046: per-photo captured location + heading line under the thumbnail.
 * The asset-detail .photo-strip wraps each photo in a .thumb DIV (img + ref +
 * geo line), so widen that container and stack its children. */
.photo-strip { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-3); }
.photo-strip .thumb {
  width: 160px; height: auto; display: flex; flex-direction: column;
  border: none; background: transparent; cursor: default; transform: none;
}
.photo-strip .thumb:hover { transform: none; }
.photo-strip .thumb > img {
  width: 160px; height: 120px; object-fit: cover;
  border-radius: var(--r-md); border: 1px solid var(--border-2);
  cursor: pointer; background: var(--bg-surface-2);
  transition: transform 120ms ease, border-color 120ms ease;
}
.photo-strip .thumb > img:hover { transform: scale(1.02); border-color: var(--border-1); }
.photo-strip .thumb .imgref {
  /* The shared ADMIN stylesheet (/portal/shared/style.css) styles `.thumb
   * .imgref` as a dark ABSOLUTE pill pinned to bottom:4px of the image. In
   * the portal that pill now collides with our category banner strip along
   * the image bottom (the "black shapes" Tim spotted). Fully un-pin it here
   * and render 'img N' as a plain caption BELOW the image instead. Every
   * property the admin rule sets is explicitly reset (REG-089 review fix). */
  position: static; left: auto; right: auto; top: auto; bottom: auto;
  display: block;
  font-size: 10px; margin-top: 3px;
  padding: 0; border: none; border-radius: 0;
  background: none;
  color: var(--text-secondary, #6b7280);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.photo-geo {
  display: flex; flex-direction: column; gap: 1px; margin-top: 2px;
  font-size: 10.5px; line-height: 1.35;
}
.photo-geo-loc {
  color: var(--text-secondary); text-decoration: none;
  font-family: var(--mono, monospace);
}
.photo-geo-loc:hover { color: var(--accent, #6a28d8); text-decoration: underline; }
.photo-geo-head { color: var(--text-tertiary); font-weight: 600; }

/* ---------------------------------------------------------------- forms
   Self-service create modals (Add customer, etc.). Reuses the shared
   .modal overlay (fixed, centered, .hidden => display:none). */
.form-modal { align-items: flex-start; }
.form-modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  width: min(440px, calc(100vw - 48px));
  margin: 10vh auto 0;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
}
.form-modal-card h2 { margin: 0 0 var(--sp-5); font-size: 20px; }
.form-label {
  display: flex; flex-direction: column; gap: var(--sp-2);
  font-size: 13px; color: var(--text-secondary);
  margin-bottom: var(--sp-4);
}
.form-label .req { color: var(--alert); }
.form-input {
  background: var(--bg-page);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  font-size: 15px; color: inherit;
  outline: none;
}
.form-input:focus { border-color: var(--brand, #4b9fff); }
.form-actions {
  display: flex; justify-content: flex-end; gap: var(--sp-3);
  margin-top: var(--sp-5);
}
.btn-mute {
  background: transparent;
  border: 1px solid var(--border-1);
  color: var(--text-secondary);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: 14px; cursor: pointer;
}
.btn-mute:hover { background: var(--bg-page); }
.view-header .actions { display: flex; align-items: center; gap: var(--sp-3); }

/* v0.3.0 - full-CRUD portal: row actions, archive toggle, archived rows */
td.row-actions { white-space: nowrap; text-align: right; }
.row-btn {
  border: 1px solid var(--border, #d5dae2); background: var(--bg-card, #fff);
  color: var(--text, #223); border-radius: 6px; padding: 3px 8px; margin-left: 4px;
  cursor: pointer; font-size: 13px; line-height: 1;
}
.row-btn:hover { background: var(--bg-page, #f2f5f9); }
.row-btn.danger { color: var(--alert, #d64545); }
tr.row-arch { opacity: 0.55; }
tr.row-arch:hover { opacity: 0.8; }
.arch-toggle {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  color: var(--text-dim, #667); cursor: pointer; user-select: none;
}
.arch-toggle input { cursor: pointer; }

/* v0.4.0 - grouped form sections (business identity form) */
.form-section {
  font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-dim, #667); margin: var(--sp-4, 14px) 0 2px; padding-top: var(--sp-3, 8px);
  border-top: 1px solid var(--border, #e2e6ec);
}
.form-section:first-child { border-top: none; padding-top: 0; margin-top: 0; }

/* v0.6.0 - asset chip strips + property overview composition gaps.
   Structural chip/group/tab classes come from the shared admin style.css;
   these only fill portal-specific spacing. */
.chip-strips { margin-top: var(--sp-4, 14px); display: flex; flex-direction: column; gap: 6px; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-wrap .typ-chip { display: inline-flex; align-items: center; gap: 6px; }
.portal-note {
  margin-top: var(--sp-3, 10px);
  padding: var(--sp-2, 8px) var(--sp-3, 12px);
  font-size: 12.5px;
  color: var(--text-secondary, #667);
  background: rgba(75, 159, 255, 0.08);
  border: 1px solid var(--border-2, #e2e6ec);
  border-radius: var(--r-sm, 6px);
}

/* --- Asset detail parity (mirrors admin record) --- */
.portal-placeholder {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 12px; color: var(--text-secondary, #667);
  font-size: 12.5px; line-height: 1.45;
}
.portal-placeholder-icon {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(120, 132, 150, 0.12); color: var(--text-secondary, #889);
  font-weight: 700;
}
.portal-placeholder-msg { flex: 1 1 auto; }

.rel-list { display: flex; flex-direction: column; gap: 6px; padding: 4px 2px; }
.rel-row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 8px; border-radius: var(--r-sm, 6px);
  background: rgba(120, 132, 150, 0.06);
}
.rel-row-in { background: rgba(75, 159, 255, 0.07); }
.rel-verb {
  flex: 0 0 auto; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.03em; color: var(--text-secondary, #778);
  font-weight: 600; min-width: 92px;
}
.rel-target { flex: 1 1 auto; font-size: 13px; color: var(--text-primary, #222); }

/* --- REG-064: relationships as an indented dependency tree (v0.31.0) ---
 * Parents (what feeds / contains this) sit above the centred 'this asset'
 * node; children (what this feeds / contains) indent below. A SINGLE
 * continuous spine at left runs from the first parent, through the centre
 * node, down to the last child, with an elbow into each node's chip. */
/* The up/self/down chain lives in .rel-core; ONE spine is drawn as its
 * ::before across the WHOLE block so there are no segment boundaries. The
 * centre card's dot sits exactly on the rail and its own elbow ties it in. */
.rel-tree {
  display: flex; flex-direction: column; padding: 4px 2px 0;
  --rail: 13px; position: relative;
}
.rel-core { position: relative; }
.rel-core::before {
  content: ""; position: absolute; left: var(--rail);
  top: var(--spine-top, 15px); bottom: var(--spine-bottom, 15px);
  width: 1.5px; background: var(--border-1); z-index: 1;
}
.rel-tsection { display: flex; flex-direction: column; position: relative; z-index: 2; }

.rel-tnode {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px 5px 46px; position: relative; z-index: 1;
  font-size: 13px; color: var(--text-primary, #222); min-height: 30px;
}
/* elbow: horizontal tick from the spine to this node. Longer tick + deeper
 * node padding = a clearer indent step off the spine (REG-064, 2026-07-27). */
.rel-tnode::before {
  content: ""; position: absolute; left: var(--rail); top: 50%;
  width: 26px; border-top: 1.5px solid var(--border-1);
}
.rel-tverb {
  flex: 0 0 auto; font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.03em; color: var(--text-tertiary, #889);
  font-weight: 700; min-width: 74px;
}
.rel-ttarget { flex: 1 1 auto; }
/* REG-114: a served asset recognised from the circuit schedule but not yet
   matched to an asset record (provisional / derived edge). */
.rel-provisional {
  display: inline-block; margin-left: 6px; font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.3px; padding: 1px 6px; border-radius: 999px;
  color: #b9540b; background: rgba(234,88,12,0.14); border: 0.5px solid rgba(234,88,12,0.34);
  vertical-align: middle;
}

/* centre 'this asset' node - a NODE ON the spine, not a band that interrupts
 * it. The spine (drawn by .rel-core::before) runs straight past; the dot sits
 * exactly on the rail so the line visibly passes through it. Emphasis comes
 * from the gradient pill around the label + dot, which is inset to the RIGHT of
 * the rail so it never covers the spine. */
.rel-tself {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 6px 8px; margin: 2px 0; position: relative; z-index: 1;
  min-height: 34px;
}
.rel-tself-dot {
  flex: none; width: 13px; height: 13px; border-radius: 50%;
  margin-left: 7px;                 /* centre the dot on the rail (13px) */
  background: linear-gradient(135deg, #00C6FF, #7B2FFF);
  box-shadow: 0 0 0 3px var(--bg-elevated, #fff), 0 0 0 4.5px rgba(123,47,255,0.35);
  position: relative; z-index: 2;
}
/* the emphasis pill wraps the label, starting after the dot */
.rel-tself-label {
  padding: 4px 12px; border-radius: 100px;
  font-weight: 700; font-size: 13px; color: var(--text-primary);
  background: linear-gradient(90deg, rgba(0,198,255,0.14), rgba(123,47,255,0.12));
  border: 0.5px solid rgba(123,47,255,0.30);
}
.rel-tself-tag {
  margin-left: auto; font-size: 9.5px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: #6a28d8;
  background: rgba(123,47,255,0.12); padding: 2px 8px; border-radius: 100px;
}
.rel-tside-label {
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  font-weight: 700; color: var(--text-tertiary); margin: 14px 0 4px 2px;
  padding-top: 12px; border-top: 0.5px solid var(--border-1);
}
.rel-tside { display: flex; flex-direction: column; gap: 2px; }
.rel-tside .rel-tnode { padding-left: 8px; }
.rel-tside .rel-tnode::before { display: none; }

/* REG-082: verb sub-grouping inside a direction section. A hub asset with
 * many mixed edge kinds (feeds + serves + contains...) now renders one small
 * labelled, counted sub-heading per kind so the different relationship types
 * are visually separated instead of mingled in one flat indentation. */
.rel-tgroup { position: relative; }
.rel-tgroup + .rel-tgroup { margin-top: 4px; }
/* Collapsible verb groups: <summary> heading, native expand/collapse. */
.rel-tgroup { position: relative; }
summary.rel-tgroup-head { list-style: none; cursor: pointer; }
summary.rel-tgroup-head::-webkit-details-marker { display: none; }
.rel-tgroup-head {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 8px 3px 40px; position: relative; z-index: 2;
}
.rel-tgroup > .rel-tgroup-head .acc-caret {
  font-size: 9px; color: var(--text-tertiary, #889);
  transition: transform 0.15s ease; margin-right: 1px;
}
.rel-tgroup[open] > .rel-tgroup-head .acc-caret { transform: rotate(90deg); }
/* Fire-mode Assets/Zones sub-buckets are collapsible too. */
.rel-fcat-subwrap { display: block; }
summary.rel-fcat-sub { list-style: none; cursor: pointer; }
summary.rel-fcat-sub::-webkit-details-marker { display: none; }
.rel-fcat-sub .acc-caret {
  font-size: 8.5px; color: var(--text-tertiary, #889);
  transition: transform 0.15s ease; margin-right: 2px;
}
.rel-fcat-subwrap[open] > .rel-fcat-sub .acc-caret { transform: rotate(90deg); }
/* tie the sub-heading into the spine with a short elbow, matching nodes */
.rel-tgroup-head::before {
  content: ""; position: absolute; left: var(--rail); top: 50%;
  width: 26px; border-top: 1.5px dashed var(--border-1);
}
.rel-tgroup-verb {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em;
  font-weight: 800; color: var(--text-secondary, #556);
}
.rel-tgroup-count {
  font-size: 10px; font-weight: 700; line-height: 1;
  color: var(--text-tertiary, #889);
  background: var(--bg-subtle, rgba(123,47,255,0.08));
  border: 0.5px solid var(--border-1);
  border-radius: 100px; padding: 2px 7px; min-width: 16px; text-align: center;
}
.rel-tgroup-body { display: flex; flex-direction: column; }
/* inside a verb sub-group the kind is in the heading, so drop the per-node
 * verb chip and indent the nodes one step further under the heading. */
.rel-tsection-grouped .rel-tgroup-body .rel-tverb { display: none; }
.rel-tsection-grouped .rel-tgroup-body .rel-tnode { padding-left: 58px; }
.rel-tsection-grouped .rel-tgroup-body .rel-tnode::before { width: 38px; }

/* Fire-mode CATEGORY buckets (Detection / Smoke-fan control) with an
 * Assets-vs-Zones split beneath each (Tim 2026-08-14). Indented under the
 * fire-mode verb heading. */
.rel-fcat + .rel-fcat { margin-top: 3px; }
.rel-fcat-head {
  display: flex; align-items: center; gap: 6px; padding: 3px 8px 2px 58px;
}
.rel-fcat-label {
  font-size: 10px; font-weight: 800; letter-spacing: 0.03em;
  color: var(--text-secondary, #556);
}
.rel-fcat-sub {
  display: flex; align-items: center; gap: 5px; padding: 2px 8px 1px 72px;
}
.rel-fcat-sublabel {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-tertiary, #889);
}
.rel-fcat-count {
  font-size: 9.5px; font-weight: 700; line-height: 1; color: var(--text-tertiary, #889);
  background: var(--bg-subtle, rgba(123,47,255,0.08));
  border: 0.5px solid var(--border-1); border-radius: 100px;
  padding: 1px 6px; min-width: 14px; text-align: center;
}
/* Type sub-group inside an Assets/Zones bucket (group by Type then Floor). */
.rel-ftype { display: block; }
.rel-ftype-head {
  display: flex; align-items: center; gap: 5px; padding: 2px 8px 1px 86px;
}
.rel-ftype-label {
  font-size: 9px; font-weight: 700; letter-spacing: 0.03em;
  color: var(--text-tertiary, #99a);
}
.rel-ftype-count {
  font-size: 9px; font-weight: 700; line-height: 1; color: var(--text-tertiary, #99a);
  background: var(--bg-subtle, rgba(123,47,255,0.06));
  border: 0.5px solid var(--border-1); border-radius: 100px;
  padding: 0 5px; min-width: 12px; text-align: center;
}
/* nodes inside a fire type indent one step further than the type heading */
.rel-tsection-grouped .rel-fcat-body .rel-tnode { padding-left: 100px; }
.rel-tsection-grouped .rel-fcat-body .rel-tnode::before { width: 20px; }
/* A standardised, not-yet-matched fire device tag (neutral, no link). */
.chip-bim-static {
  display: inline-block; font-family: var(--mono, monospace);
  font-size: 11px; padding: 1px 6px; border-radius: 4px;
  background: var(--bg-subtle, rgba(120,130,150,0.10));
  color: var(--text-secondary, #556);
  border: 1px solid var(--border-1, rgba(120,130,150,0.22));
}

.chip-bim {
  display: inline-block; font-family: var(--mono, monospace);
  font-size: 11px; padding: 1px 6px; border-radius: 4px;
  background: rgba(123, 47, 255, 0.10); color: #6a28d8;
  border: 1px solid rgba(123, 47, 255, 0.18);
}

.circuit-table-lite td.col-num { font-family: var(--mono, monospace); font-weight: 600; white-space: nowrap; }
.circuit-table-lite .chip-bim { margin: 1px 2px; }
/* REG-084: protection cell (amps / poles / device / make read off the board) */
.circuit-table-lite td.cir-prot { line-height: 1.25; }
.cir-rating { font-family: var(--mono, monospace); font-weight: 700; font-size: 12.5px; color: var(--text-primary); display: block; }
.cir-dev { font-size: 11px; color: var(--text-tertiary, #889); display: block; }

/* Fire panel (FIP / EWIS / smoke-control) schedule tables (2026-08-14, refined
 * 2026-08-14 Tim review: type-grouped rows, no column overlap).
 * Theme-aware tokens only (REG-101/108 lesson: no hardcoded light greys). */
/* Fixed layout DRIVEN BY AN EXPLICIT <colgroup> emitted per section (the JS
 * builds it). Without the colgroup the inherited table-layout:fixed collapsed
 * onto the first colspan'd heading row -> every column overlapped (the mess Tim
 * screenshotted). word-break lets long values wrap inside their fixed column
 * instead of bleeding into the next. */
.fp-table { table-layout: fixed; width: 100%; }
.fp-table td, .fp-table th { word-break: break-word; overflow-wrap: anywhere; vertical-align: top; }
.fp-table th { text-align: left; }
.fp-table td.fp-label, .fp-table th.fp-c-label { color: var(--text-primary); font-weight: 600; }
.fp-table .fp-c-ref  { white-space: normal; }
.fp-table .fp-c-zone { text-align: center; }
.fp-table .fp-c-loc  { color: var(--text-secondary); }
.fp-table .fp-c-mode { color: var(--text-secondary); }

/* Detection section: Zone (floor) as the top collapsible layer, asset type as
 * the second (Tim r4/r5). The zone accordion REUSES the .rel-tgroup look from
 * the Relationships tree so it's visually consistent (Tim r5). */
.fp-byzone { display: flex; flex-direction: column; gap: 6px; }
.fp-zone-body { display: flex; flex-direction: column; gap: 8px; }
.fp-ztype-head {
  display: flex; align-items: center; gap: 6px; padding: 4px 2px 2px;
}
.fp-ztype-label {
  font-size: 10px; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--text-secondary, #556);
}
.rel-zone-label { color: var(--text-secondary, #556); }
/* Floor grouping inside the fire-mode monitors/commands tree buckets. */
.rel-ffloor > .rel-tgroup-head .rel-tgroup-verb { text-transform: none; }

/* Type sub-heading row within a section (mirrors rel-tree verb groups). */
.fp-table tr.fp-grp-head td {
  padding-top: 8px; padding-bottom: 3px; border-bottom: 1px solid var(--border-subtle, rgba(120,132,150,0.22));
  background: transparent;
}
.fp-table tbody tr.fp-grp-head:first-child td { padding-top: 2px; }
.fp-grp-label {
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-tertiary, #889);
}
.fp-grp-count {
  display: inline-block; margin-left: 7px; padding: 0 6px; border-radius: 9px;
  font-size: 10px; font-weight: 700; color: var(--text-secondary);
  background: var(--chip-soft-bg, rgba(120,132,150,0.14));
}
/* Zebra striping must ignore the heading rows, so stripe explicitly below. */
.fp-table.fp-grouped tbody tr:not(.fp-grp-head):nth-of-type(odd) { background: transparent; }
.fp-ref {
  font-family: var(--mono, monospace); font-weight: 700; font-size: 12px;
  padding: 1px 6px; border-radius: 4px; white-space: nowrap;
  color: #6a28d8; background: rgba(123, 47, 255, 0.10);
  border: 1px solid rgba(123, 47, 255, 0.18);
}
.fp-ref-gap {
  color: var(--text-tertiary, #889); background: var(--chip-soft-bg, rgba(120,132,150,0.12));
  border: 1px solid transparent; font-weight: 600; font-family: inherit; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.03em;
}

/* REG-084: visual circuit/control diagram - board as root, circuits as
 * branches. Mirrors the relationships dependency-tree spine/elbow styling. */
.cir-diagram { padding: 6px 2px 2px; }
.cir-core { position: relative; }
.cir-root { display: flex; align-items: center; gap: 10px; padding: 4px 8px 6px 8px; }
.cir-root-dot {
  flex: none; width: 13px; height: 13px; border-radius: 3px; margin-left: 9px;
  background: linear-gradient(135deg, #00C6FF, #7B2FFF);
  box-shadow: 0 0 0 3px var(--bg-elevated, #fff), 0 0 0 4.5px rgba(123,47,255,0.35);
  position: relative; z-index: 2;
}
.cir-root-label {
  padding: 4px 12px; border-radius: 100px; font-weight: 700; font-size: 13px;
  color: var(--text-primary); font-family: var(--mono, monospace);
  background: linear-gradient(90deg, rgba(0,198,255,0.14), rgba(123,47,255,0.12));
  border: 0.5px solid rgba(123,47,255,0.30);
}
.cir-root-tag {
  margin-left: auto; font-size: 9.5px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: #6a28d8;
  background: rgba(123,47,255,0.12); padding: 2px 8px; border-radius: 100px;
}
/* Nested tree: each level indents with its own left guide-rail border, so the
   hierarchy (group -> circuit -> child device) reads cleanly. */
.cir-branches { display: flex; flex-direction: column; }
.cir-branch { position: relative; }
.cir-node {
  display: flex; align-items: baseline; gap: 8px;
  padding: 2px 8px 2px 14px; position: relative;
}
.cir-node::before {
  content: ""; position: absolute; left: 0; top: 11px;
  width: 9px; border-top: 1.5px solid var(--border-1);
}
.cir-way {
  flex: 0 0 auto; min-width: 58px; font-family: var(--mono, monospace);
  font-weight: 700; font-size: 12px; color: var(--text-primary);
  background: var(--bg-subtle, rgba(123,47,255,0.06));
  border: 0.5px solid var(--border-1); border-radius: 5px;
  padding: 1px 8px; text-align: center; align-self: center;
}
/* child device rows (contactor / relay / overload / thermal cutout) indented
   one level under their circuit */
.cir-children { margin: 0 0 2px 30px; border-left: 1.5px solid var(--border-1); }
.cir-child {
  display: flex; align-items: baseline; gap: 8px; padding: 1px 8px 1px 14px;
  position: relative; font-size: 11.5px;
}
.cir-child::before {
  content: ""; position: absolute; left: 0; top: 9px;
  width: 9px; border-top: 1px solid var(--border-1);
}
.cir-child-role {
  flex: 0 0 auto; font-weight: 600; color: var(--text-secondary, #556);
  text-transform: uppercase; letter-spacing: 0.02em; font-size: 10px;
}
.cir-child-detail { color: var(--text-primary); font-family: var(--mono, monospace); font-size: 11px; }
.cir-chip-kw { color: #6a28d8; background: rgba(123,47,255,0.12); border-color: rgba(123,47,255,0.28); }
.cir-badge-ess { color: #0a6b57; background: rgba(0,190,140,0.14); border: 0.5px solid rgba(0,190,140,0.32); }
.cir-badge-mute { color: var(--text-tertiary, #889); background: var(--bg-subtle, rgba(0,0,0,0.04)); border: 0.5px solid var(--border-1); }
/* Row-wrap so way/serves/target/chips sit on ONE line and only wrap when
   they must - kills the tall stacked spacing between each Way (Tim review). */
.cir-body {
  display: flex; flex-flow: row wrap; align-items: baseline; column-gap: 8px;
  row-gap: 2px; flex: 1 1 auto;
}
.cir-serves { font-size: 13px; color: var(--text-primary, #222); }
.cir-target { font-size: 12px; }
.cir-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.cir-chip {
  font-family: var(--mono, monospace); font-size: 10.5px; font-weight: 700;
  padding: 1px 7px; border-radius: 4px; color: #0a6b8a;
  background: rgba(0,198,255,0.12); border: 0.5px solid rgba(0,198,255,0.28);
}
.cir-chip-mute { color: var(--text-tertiary, #889); background: var(--bg-subtle, rgba(0,0,0,0.04)); border-color: var(--border-1); font-weight: 600; }
.cir-badge { font-size: 9.5px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; padding: 1px 7px; border-radius: 100px; }
.cir-badge-em { color: #b5001e; background: rgba(255,90,90,0.14); border: 0.5px solid rgba(255,90,90,0.3); }
/* REG-103: served asset could not be resolved to a specific id (non-deterministic). */
.cir-badge-nd { color: #9a3412; background: rgba(234,88,12,0.15); border: 0.5px solid rgba(234,88,12,0.35); }
.cir-badge-inf { color: #8a6d00; background: rgba(255,196,0,0.16); border: 0.5px solid rgba(255,196,0,0.35); }
.cir-refs { display: block; margin-top: 1px; }
.cir-relay { font-family: var(--mono, monospace); font-weight: 700; font-size: 11px; color: #6a28d8; }
.cir-note { font-size: 11px; margin: 8px 0 0 8px; }
/* REG-084 (Tim review 3): the diagram is a nested functional-group tree.
   Each group is a collapsible <details>; its branches indent under a rail. */
.cir-dgroup { position: relative; }
.cir-dgroup > .cir-dgroup-head {
  display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  padding: 5px 10px; font-weight: 700; font-size: 12.5px; color: var(--text-primary);
  background: var(--bg-subtle, rgba(123,47,255,0.05)); border-radius: 6px; margin-top: 3px;
}
.cir-dgroup > .cir-dgroup-head::-webkit-details-marker { display: none; }
.cir-dgroup .acc-caret { transition: transform 0.15s ease; color: var(--text-tertiary); }
.cir-dgroup[open] .acc-caret { transform: rotate(90deg); }
.cir-dgroup-title { flex: 1 1 auto; }
.cir-dgroup > .cir-branches { margin-left: 16px; border-left: 1.5px solid var(--border-1); padding-top: 2px; }
/* REG-108: count chips must be readable on ALL themes. `--bg-elevated` is
   UNDEFINED (no theme sets it) so it fell back to #fff, which on dark themes
   (Abyss/Cobalt/Violet) put light-grey `--text-tertiary` text on a white pill =
   invisible. Use theme-aware tokens: readable `--text-secondary` on the
   theme's own soft-chip background `--chip-soft-bg`. */
.cir-group-count {
  font-size: 11px; font-weight: 700;
  color: var(--text-secondary, rgba(120,130,150,0.95));
  background: var(--chip-soft-bg, rgba(127,127,127,0.14));
  border: 0.5px solid var(--border-1);
  border-radius: 100px; padding: 1px 9px; min-width: 18px; text-align: center;
}
/* Detailed compact schedule table (Tim review 3) */
.circuit-table-wrap { overflow-x: auto; }
.circuit-table-lite { width: 100%; font-size: 12px; table-layout: fixed; }
/* Column sizing: keep Serves narrow so Load/Amps/Poles/Device/Make-model/Relay
   /Flags stop being squashed (Tim review 4). cols: Way Serves Load Amps Poles
   Device Make/model Relay Flags */
.circuit-table-lite col.c-way    { width: 8%; }
.circuit-table-lite col.c-serves { width: 22%; }
.circuit-table-lite col.c-load   { width: 7%; }
.circuit-table-lite col.c-amps   { width: 7%; }
.circuit-table-lite col.c-poles  { width: 6%; }
.circuit-table-lite col.c-device { width: 13%; }
.circuit-table-lite col.c-make   { width: 17%; }
.circuit-table-lite col.c-relay  { width: 8%; }
.circuit-table-lite col.c-flags  { width: 12%; }
.circuit-table-lite td { word-break: break-word; overflow-wrap: anywhere; }
.circuit-table-lite th {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--text-tertiary, #889); font-weight: 700; padding: 4px 8px; white-space: nowrap;
}
.circuit-table-lite td { padding: 2px 8px; line-height: 1.35; vertical-align: top; }
.circuit-table-lite tbody tr:nth-child(even) { background: var(--bg-subtle, rgba(0,0,0,0.015)); }
.circuit-table-lite .col-num { font-family: var(--mono, monospace); font-weight: 700; white-space: nowrap; }
.circuit-table-lite .col-c { text-align: center; white-space: nowrap; }
.circuit-table-lite .cir-flags { white-space: nowrap; }
.circuit-table-lite .cir-refs { margin-top: 1px; }

/* REG-084: sub-component role accordion groups (high-volume boards). */
.sub-groups { display: flex; flex-direction: column; gap: 6px; }
.sub-group { border: 0.5px solid var(--border-1); border-radius: 8px; overflow: hidden; }
.sub-group > .sub-group-head {
  display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  padding: 8px 12px; background: var(--bg-subtle, rgba(123,47,255,0.04));
  font-weight: 600; font-size: 13px; color: var(--text-primary);
}
.sub-group > .sub-group-head::-webkit-details-marker { display: none; }
.sub-group .acc-caret { transition: transform 0.15s ease; color: var(--text-tertiary); }
.sub-group[open] .acc-caret { transform: rotate(90deg); }
.sub-group-title { flex: 1 1 auto; }
/* REG-108: same undefined-`--bg-elevated` invisibility bug as .cir-group-count. */
.sub-group-count {
  font-size: 11px; font-weight: 700;
  color: var(--text-secondary, rgba(120,130,150,0.95));
  background: var(--chip-soft-bg, rgba(127,127,127,0.14));
  border: 0.5px solid var(--border-1);
  border-radius: 100px; padding: 2px 9px; min-width: 18px; text-align: center;
}
.sub-group-body { padding: 8px 12px 10px; }
/* REG-084: top-level split of sub-components into Promotable vs Components,
   each holding a set of category accordions. */
.sub-section { margin-bottom: 12px; }
.sub-section:last-child { margin-bottom: 0; }
.sub-section-head {
  display: flex; align-items: center; gap: 8px; margin: 0 0 6px;
  padding-bottom: 5px; border-bottom: 1px solid var(--border-1);
}
.sub-section-title { font-weight: 700; font-size: 13px; color: var(--text-primary); }
.sub-section-hint { flex: 1 1 auto; font-size: 11px; color: var(--text-tertiary, #889); }
.sub-section-head .sub-group-count { flex: 0 0 auto; }

/* NOTE: .sec-sub, .sec-headline, .record-banner and its .banner-bim* children
 * are intentionally NOT redefined here. They are styled verbatim by the shared
 * admin style.css (loaded first) so the portal asset view matches the admin UI
 * exactly - the collapsible section banners, the gradient section headlines
 * (e.g. the $ / yrs-left value on the right-pane cards) and the gradient BIM
 * pill in the record banner. Earlier flat-grey overrides here were what made
 * the portal look worse than admin; removed 2026-07-16. */

/* --- Clickable BIM chips + lifecycle economics (v0.8.0) --- */
a.chip-bim-link { cursor: pointer; text-decoration: none; }
a.chip-bim-link:hover { background: rgba(123, 47, 255, 0.20); border-color: rgba(123, 47, 255, 0.42); }
.chip-bim-dangling { opacity: 0.62; border-style: dashed; }
.rel-label { font-size: 12px; color: var(--text-secondary, #667); }

.cond-badge {
  display: inline-block; font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.03em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px; white-space: nowrap;
}
.cond-excellent { background: rgba(34, 160, 90, 0.15); color: #1c7a45; }
.cond-good      { background: rgba(90, 175, 90, 0.15); color: #3d8a3d; }
.cond-fair      { background: rgba(214, 158, 46, 0.16); color: #9a6c12; }
.cond-poor      { background: rgba(224, 122, 46, 0.16); color: #a8560f; }
.cond-eol       { background: rgba(220, 55, 55, 0.15); color: #b02121; }

.lcam-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lcam-note { font-size: 12.5px; color: var(--text-secondary, #667); }
/* REG-108 (2nd pass): these source chips were hardcoded light (#EEF2F7 bg /
   #55627A text) = near-white pill with washed-out text on dark themes. Use
   theme-aware tokens so they stay legible on every theme. */
.lcam-src-chip { font-size: 10px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase;
  padding: 1px 7px; border-radius: 10px;
  background: var(--chip-soft-bg, rgba(120,140,170,0.16)); color: var(--text-secondary, #c7d0e0);
  border: 1px solid var(--border-1, rgba(140,160,190,0.3));
  vertical-align: middle; }
.lcam-src-chip.lcam-src-ai { background: rgba(46,125,50,0.18); color: #6bd47a; border-color: rgba(46,125,50,0.4); }
/* Replacement-cost supplier source links (customer portal). Engine URLs are
   stripped server-side; only genuine supplier pages render here. */
.cost-source-count { color: var(--text-secondary, #667); font-weight: 500; }
.cost-source-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cost-source-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.cost-source-idx { flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%; background: #EEF2F7;
  color: #55627A; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.cost-source-item a { display: inline-flex; align-items: center; gap: 6px; color: #0057FF; text-decoration: none; }
.cost-source-item a:hover { text-decoration: underline; }
.cost-source-host { font-weight: 500; }
.cost-source-badge { font-size: 9.5px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase;
  padding: 1px 6px; border-radius: 8px; background: #EAF0FF; color: #0057FF; border: 1px solid #CFE0FF; }
.cost-source-arrow { font-size: 11px; opacity: .7; }
.cost-source-primary .cost-source-idx { background: #E3ECFF; color: #0057FF; }

/* --- property summary parity (v0.8.0) --- */
.portal-est-banner {
  margin-top: 12px; padding: 10px 14px; border-radius: var(--r-sm, 6px);
  background: rgba(255, 206, 71, 0.12); border: 1px solid rgba(255, 206, 71, 0.35);
  font-size: 12.5px; color: var(--text-primary, #333); line-height: 1.4;
}
.cond-dist { display: flex; flex-wrap: wrap; gap: 8px; }
.cond-dist-item { display: inline-flex; align-items: center; gap: 5px; }
.cond-dist-n { font-size: 12px; font-weight: 600; color: var(--text-secondary, #667); font-variant-numeric: tabular-nums; }
.prop-type-count {
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text-primary, #222);
}
.prop-eco-clickable { cursor: pointer; }
.prop-eco-clickable:hover { filter: brightness(1.06); }

/* === Take-on / Import + enrichment gap classes (admin style.css supplies the
   rest: import-*, cfg-*, card, badge-*). Portal-only tweaks below. === */
.btn-ghost.danger { color: var(--alert, #d64545); }
.import-table th.num, .import-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.import-table tr.row-arch { opacity: 0.55; }
.import-table td.row-actions { white-space: nowrap; text-align: right; }

/* === Derived asset-filter pill (F3: drill-through from a summary tile/bar) === */
.derived-filter-bar { margin: 12px 0 4px; }
.derived-filter-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 8px 5px 12px; border-radius: 999px;
  background: rgba(0, 198, 255, 0.12); border: 1px solid rgba(0, 198, 255, 0.4);
  font-size: 12.5px; font-weight: 600; color: var(--text-primary, #222);
}
.derived-filter-x {
  border: none; background: rgba(0, 0, 0, 0.08); color: inherit;
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
  font-size: 13px; line-height: 1; display: inline-flex; align-items: center;
  justify-content: center; padding: 0;
}
.derived-filter-x:hover { background: rgba(0, 0, 0, 0.16); }

/* === Customer spatial accordion (F4: property > building > floor > location) === */
.acc-list { display: flex; flex-direction: column; gap: 6px; }
.acc-item { border-radius: var(--r-sm, 6px); }
.acc-prop {
  border: 0.5px solid var(--border-2, #e2e5ea);
  background: var(--bg-surface, #fff); overflow: hidden;
}
.acc-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; cursor: pointer; user-select: none;
}
.acc-head:hover { background: var(--bg-surface-2, rgba(0, 0, 0, 0.03)); }
.acc-head-leaf { cursor: pointer; }
.acc-caret {
  display: inline-block; font-size: 10px; color: var(--text-secondary, #667);
  transition: transform 0.12s ease; flex: none; width: 12px;
}
.acc-caret.acc-open { transform: rotate(90deg); }
.acc-bullet { color: var(--text-secondary, #99a); flex: none; width: 12px; text-align: center; }
.acc-title { font-weight: 600; font-size: 13px; color: var(--text-primary, #222); }
.acc-sub { font-size: 11.5px; color: var(--text-secondary, #778); flex: 1; }
.acc-count {
  font-size: 11.5px; font-weight: 600; color: var(--text-secondary, #667);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.acc-view {
  border: 0.5px solid var(--border-2, #dce0e6); background: transparent;
  color: var(--accent, #0891b2); font-size: 11.5px; font-weight: 600;
  padding: 3px 8px; border-radius: 5px; cursor: pointer; white-space: nowrap;
}
.acc-view:hover { background: rgba(8, 145, 178, 0.1); }
.acc-view-leaf { border: none; background: none; opacity: 0.75; padding: 0; }
.acc-head-leaf:hover .acc-view-leaf { opacity: 1; }
.acc-body { padding: 0 0 0 22px; }
.acc-bldg .acc-head, .acc-floor .acc-head { padding: 7px 10px; }
.acc-bldg { border-left: 2px solid rgba(0, 198, 255, 0.25); margin: 2px 0; }
.acc-floor { border-left: 2px solid rgba(148, 163, 184, 0.3); margin: 1px 0; }
.acc-loc .acc-head-leaf { padding: 5px 10px; }
.acc-loc { margin: 1px 0; }

/* --- Financial / provenance / sustainability metrics (all summaries) --- */
.fin-metric-kpis .kpi-carbon {
  border-color: rgba(22, 163, 74, 0.35);
  background: linear-gradient(180deg, rgba(22, 163, 74, 0.06), transparent);
}
.fin-metric-kpis .kpi-carbon .kpi-value { color: #15803d; }
.fin-prov-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 10px; font-size: 12px;
}
.fin-prov-title {
  font-weight: 700; color: var(--muted, #64748b);
  font-size: 11.5px; margin-right: 2px;
}
.fin-prov-item {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  border: 0.5px solid rgba(148, 163, 184, 0.25);
  color: #334155;
}
.fin-prov-item b { font-weight: 700; }
.fin-prov-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #94a3b8; display: inline-block;
}
.fin-prov-invoice .fin-prov-dot { background: #16a34a; }
.fin-prov-quote .fin-prov-dot { background: #0891b2; }
.fin-prov-benchmark .fin-prov-dot { background: #ca8a04; }
.fin-prov-enrichment_estimate .fin-prov-dot { background: #7c3aed; }
.fin-prov-customer_declared .fin-prov-dot { background: #64748b; }

/* Licensing group heading + mandatory-licence accent (portal-only additions;
 * everything else - .sub-card/.label-card/.sub-bim etc. - comes from the
 * shared admin style.css). */
.lic-group-label {
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  font-weight: 700; color: var(--text-tertiary, #889);
  display: flex; align-items: center; gap: 8px; margin: 0 0 8px;
}
.lic-group-label .sec-count {
  background: rgba(148,163,184,0.18); color: var(--text-secondary);
  padding: 1px 7px; border-radius: 100px; font-size: 10.5px;
  font-weight: 600; letter-spacing: 0;
}
.sub-card-mandatory { border-left-color: #f87171; }

/* ---- Rich AI-extraction sections on the asset detail ---- */
/* .attr-table itself is styled by the shared admin style.css (ruled rows,
 * 40% tertiary-colour label column, bottom borders) so portal attr tables
 * match admin exactly. We only ADD wrap-safety (see .asset-detail block
 * below) - no visual override here. Removed the flat no-border override
 * 2026-07-16 (it was dropping admin's row separators). */
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip { display: inline-block; padding: 2px 9px; border-radius: 999px;
  background: var(--bg-elevated, rgba(255,255,255,0.06));
  border: 1px solid var(--border-1); font-size: 12px; color: var(--text-primary); }
.conf-chip { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px;
  background: rgba(59,130,246,0.15); color: #60a5fa; font-size: 10px; font-weight: 600;
  vertical-align: middle; }

/* ==========================================================
 * Asset-detail two-column grid (mirrors admin UI). WITHOUT this,
 * the columns free-flow and long right-pane content (observations,
 * standards, sub-components) blows the column out and squashes the
 * middle pane. min-width:0 on the tracks is what actually lets grid/
 * flex children shrink instead of overflowing. (2026-07-15)
 * ========================================================== */
/* Match admin's asset-detail grid EXACTLY (1.2fr / 1fr, --sp-5 gap,
 * 1200px stack breakpoint) but keep the minmax(0,...) + min-width:0
 * shrink-safety that admin lacks so long right-pane content can't blow
 * the columns out. */
.asset-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: var(--sp-5, 20px);
  align-items: start;
}
.asset-detail-left,
.asset-detail-right {
  display: flex; flex-direction: column; gap: var(--sp-4, 16px);
  min-width: 0;                 /* critical: allow shrink, prevent blow-out */
}
.asset-detail-left > *,
.asset-detail-right > * { min-width: 0; max-width: 100%; }
@media (max-width: 1200px) {
  .asset-detail { grid-template-columns: 1fr; }
}
/* Long values (standards notes, descriptions, evidence) must wrap. */
.asset-detail .value,
.asset-detail .attr-table td,
.asset-detail p { overflow-wrap: anywhere; word-break: break-word; }
.attr-table td { overflow-wrap: anywhere; }

/* Observations: severity chip + wrapping text, admin-style two-col grid. */
.obs-list { list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px; }
.obs-item, .obs-list li {
  display: grid; grid-template-columns: 62px minmax(0, 1fr);
  gap: 10px; align-items: start;
  margin: 0; padding: 8px 0;
  border-bottom: 0.5px dashed var(--border-1);
  font-size: 13px; line-height: 1.55; color: var(--text-primary);
  overflow-wrap: anywhere;
}
.obs-list li:last-child, .obs-item:last-child { border-bottom: 0; }
/* legacy single-column obs colouring still works, but text now wraps */
.obs-item.obs-warning { color: #fbbf24; }
.obs-item.obs-critical, .obs-item.obs-danger { color: #f87171; }

/* Sub-components / parts / labels: responsive card grid that WRAPS
 * within the right column instead of a single squashed chip row. */
.sub-list, .label-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.sub-list .tag-chip, .label-grid .tag-chip { white-space: normal; }
/* tag rows already wrap; make sure long tokens don't force overflow */
.tag-chip { max-width: 100%; overflow-wrap: anywhere; white-space: normal; }

/* Observation severity chip + text (admin-style). */
.obs-sev {
  font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase;
  font-weight: 700; text-align: center; white-space: nowrap;
  padding: 3px 6px; border-radius: 999px; align-self: start;
  background: rgba(148,163,184,0.15); color: var(--text-secondary);
}
.obs-sev-info     { background: rgba(59,130,246,0.15); color: #60a5fa; }
.obs-sev-minor    { background: rgba(245,158,11,0.15); color: #fbbf24; }
.obs-sev-major    { background: rgba(249,115,22,0.20); color: #fb923c; }
.obs-sev-warn, .obs-sev-warning  { background: rgba(245,158,11,0.18); color: #fbbf24; }
.obs-sev-alert, .obs-sev-critical, .obs-sev-danger { background: rgba(239,68,68,0.18); color: #f87171; }
.obs-text { font-size: 12.5px; line-height: 1.55; color: var(--text-primary); overflow-wrap: anywhere; }

/* --- REG-065: defects (actionable findings, distinct from observations) --- */
.obs-list-defect li.defect-item {
  display: block; padding: 9px 0;
  border-left: 2px solid rgba(249,115,22,0.55); padding-left: 11px;
}
.defect-head { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.defect-cat {
  font-size: 9.5px; letter-spacing: 0.05em; text-transform: uppercase;
  font-weight: 700; padding: 2px 7px; border-radius: 4px;
  background: rgba(249,115,22,0.14); color: #fb923c;
}
.defect-action {
  margin-top: 5px; font-size: 11.5px; line-height: 1.5;
  color: var(--text-secondary);
}
.defect-action-label {
  font-weight: 700; color: var(--text-tertiary);
  text-transform: uppercase; font-size: 9.5px; letter-spacing: 0.05em;
}

/* Sub-component / part cards. */
.sub-card {
  padding: 10px 12px; border-radius: 8px;
  background: var(--bg-elevated, rgba(255,255,255,0.04));
  border: 0.5px solid var(--border-1);
  border-left: 2px solid #60a5fa;
  min-width: 0; overflow-wrap: anywhere;
}
.sub-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.sub-head { flex-wrap: wrap; }
.sub-role {
  font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase;
  font-weight: 700; color: #60a5fa;
  background: rgba(59,130,246,0.12); padding: 2px 7px; border-radius: 4px;
  white-space: nowrap;            /* never break MANDATORY / category mid-word */
}
.sub-title { font-size: 13.5px; font-weight: 700; line-height: 1.3; color: var(--text-primary); }
.sub-notes {
  font-size: 11px; color: var(--text-secondary); line-height: 1.5;
  margin-top: 6px; padding-top: 6px; border-top: 0.5px dashed var(--border-1);
}

/* --- REG-066/067: compact accordion rows (v0.30.0 redesign) ---
 * Replaces the big two-column card grid with a dense single-column list.
 * A collapsed row is ONE tight line (caret + title + right-aligned chips);
 * expanding reveals the detail inline. Far less real estate, easy to scan. */
.acc-list {
  display: flex; flex-direction: column;
  border: 0.5px solid var(--border-1); border-radius: 8px;
  overflow: hidden; background: var(--bg-elevated, rgba(255,255,255,0.02));
}
.acc-row { border-top: 0.5px solid var(--border-1); }
.acc-list > .acc-row:first-child { border-top: 0; }
.acc-summary, .acc-row-static {
  list-style: none; display: flex; align-items: center; gap: 8px;
  padding: 7px 11px; min-height: 34px;
}
.acc-summary { cursor: pointer; }
.acc-summary::-webkit-details-marker { display: none; }
.acc-summary:hover { background: rgba(148,163,184,0.06); }
.acc-caret {
  flex: none; width: 10px; font-size: 12px; line-height: 1;
  color: var(--text-tertiary); transition: transform 0.15s ease;
}
.acc-row[open] > .acc-summary > .acc-caret { transform: rotate(90deg); }
.acc-caret-empty { visibility: hidden; }
.acc-title {
  flex: 1 1 auto; min-width: 0;
  font-size: 12.5px; font-weight: 600; line-height: 1.35;
  color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acc-row[open] > .acc-summary > .acc-title { white-space: normal; }  /* full title once open */
.acc-chips { flex: none; display: inline-flex; align-items: center; gap: 5px; }
.acc-chip {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.03em;
  padding: 1px 7px; border-radius: 4px; white-space: nowrap; text-transform: uppercase;
}
.acc-chip-mute { background: rgba(148,163,184,0.16); color: var(--text-secondary); }
.acc-chip-role { background: rgba(59,130,246,0.12); color: #60a5fa; }
.acc-chip-alert { background: rgba(248,113,113,0.16); color: #f87171; }
.acc-mand { box-shadow: inset 2px 0 0 #f87171; }
.acc-detail {
  padding: 2px 12px 10px 29px; margin-top: -2px;
}
.acc-detail > .sub-notes:first-child, .acc-detail > .sub-meta:first-child { margin-top: 0; }
/* REG-067 series nesting: a family (AS/NZS 3666 Parts 1-4) collapses into one
 * series row; the nested .acc-list sits inside its detail, slightly recessed. */
.acc-detail > .acc-nested { margin-top: 4px; }
.acc-nested { background: rgba(148,163,184,0.05); border-radius: 6px; }
.acc-nested .acc-title { font-weight: 500; }
.acc-nested .acc-summary, .acc-nested .acc-row-static { padding-left: 14px; min-height: 30px; }
@media (max-width: 560px) {
  /* stack chips under the title on narrow screens instead of squeezing */
  .acc-summary, .acc-row-static { flex-wrap: wrap; }
  .acc-title { flex-basis: 100%; white-space: normal; }
  .acc-chips { padding-left: 18px; }
}

/* REG-067: standards / service sub-group heading (by discipline / interval) */
.std-subgroup {
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  font-weight: 700; color: var(--text-tertiary);
  margin: 12px 0 5px 2px;
}

/* --- Enrichment: gate panel + rule modal helpers (v0.21.0) --- */
.cfg-gate-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
@media (max-width: 780px) { .cfg-gate-grid { grid-template-columns: 1fr; } }
.gate-sel { min-width: 220px; }
.enrich-cat-allrow {
  display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px;
}
.row-actions { white-space: nowrap; text-align: right; }
select[multiple].form-input { padding: 4px; }

/* --- Enrichment: unified page set-switcher + inline add-rule (v0.22.0) --- */
.enrich-setbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.enrich-setbar .import-field { margin: 0; min-width: 240px; }
.enrich-setbar-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.enrich-selall {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted, #64748b); cursor: pointer; margin: 4px 0;
}
.enrich-selall input { margin: 0; }
.enrich-nocall {
  display: flex; width: 100%; color: var(--text, #0f172a);
  background: #fef2f2; border: 1px solid #fecaca; border-radius: 6px;
  padding: 8px 10px; margin: 4px 0 8px;
}
.enrich-nocall strong { color: #b91c1c; }
#enrichAddValueRow { display: flex; flex-direction: column; gap: 4px; }
#enrichAddValueRow select[multiple] { padding: 4px; }

/* --- Enrichment: cascading dependency filters (v0.23.0, REG-006) --- */
.enrich-cascade {
  display: flex; gap: 12px; flex-wrap: wrap; margin: 4px 0 8px;
  padding: 8px; border: 1px dashed var(--border, #cbd5e1); border-radius: 8px;
  background: var(--surface-2, #f8fafc);
}
.enrich-cascade-field {
  display: flex; flex-direction: column; gap: 3px; min-width: 160px; flex: 1 1 160px;
  font-size: 12px; margin: 0;
}
.enrich-cascade-field select[multiple] { padding: 4px; }
#enrichModalTargetWrap, #enrichAddTargetWrap {
  display: flex; flex-direction: column; gap: 4px; margin-top: 4px;
}
/* --- Enrichment gate cell: state pill + select (v0.23.0, REG-007) --- */
.gate-cell { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* --- Parts & consumables: spec chips (v0.22.0) --- */
.spec-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 2px; }
.spec-chip {
  font-size: 11px; line-height: 1.4; padding: 2px 7px; border-radius: 5px;
  background: var(--surface-2, #f1f5f9); color: var(--text-secondary, #475569);
  border: 1px solid var(--border, #e2e8f0);
}
.spec-chip .spec-k { font-weight: 600; opacity: .7; margin-right: 3px; }

/* ---- v0.24.0 URL routing + full-screen enrichment edit ---- */
a.crumb { text-decoration: none; color: inherit; cursor: pointer; }
a.crumb:hover { text-decoration: underline; }
.enrich-edit-card { max-width: 720px; padding: 22px 24px; }
.enrich-edit-catrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.enrich-edit-catgrid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 22px; margin-top: 4px;
}
.enrich-edit-catgrid .enrich-cat-sel { max-width: 120px; }
@media (max-width: 640px) { .enrich-edit-catgrid { grid-template-columns: 1fr; } }

/* --- v0.26.0: "Assets with images only" toggle + BIM/tag ref column --- */
.imgs-only-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: var(--r-md, 8px);
  border: 1px solid var(--border-1, #d5dae2);
  background: var(--bg-surface, #fff);
  color: var(--text-primary, #1a2230);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  white-space: nowrap; line-height: 1;
}
.imgs-only-toggle:hover { border-color: var(--accent, #0891b2); }
.imgs-only-toggle.active {
  border-color: var(--accent, #0891b2);
  background: color-mix(in srgb, var(--accent, #0891b2) 12%, transparent);
  color: var(--accent, #0891b2);
}
.imgs-only-toggle .imgs-only-box {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 4px;
  border: 1.5px solid var(--border-1, #b9c0cc);
  font-size: 11px; font-weight: 800;
}
.imgs-only-toggle.active .imgs-only-box {
  border-color: var(--accent, #0891b2);
  background: var(--accent, #0891b2); color: #fff;
}
/* REG-114: lifecycle-status multi-select filter */
.status-filter-wrap { position: relative; display: inline-block; }
.status-filter-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--r-md, 8px);
  border: 1px solid var(--border-1, #d5dae2);
  background: var(--bg-surface, #fff); color: var(--text-primary, #1a2230);
  font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; line-height: 1;
}
.status-filter-btn:hover { border-color: var(--accent, #0891b2); }
.status-filter-btn.active {
  border-color: var(--accent, #0891b2);
  background: color-mix(in srgb, var(--accent, #0891b2) 12%, transparent);
  color: var(--accent, #0891b2);
}
.status-filter-caret { font-size: 10px; opacity: 0.7; }
.status-filter-pop {
  position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; min-width: 220px;
  background: var(--bg-surface, #fff); border: 1px solid var(--border-1, #d5dae2);
  border-radius: var(--r-md, 8px); box-shadow: 0 8px 28px rgba(0,0,0,0.28);
  padding: 6px;
}
.status-filter-opt {
  display: flex; align-items: center; gap: 9px; padding: 7px 8px;
  border-radius: 6px; cursor: pointer; font-size: 12.5px; font-weight: 600;
  color: var(--text-primary, #1a2230);
}
.status-filter-opt:hover { background: var(--chip-soft-bg, rgba(120,140,170,0.14)); }
.status-filter-box {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 4px; flex: 0 0 auto;
  border: 1.5px solid var(--border-1, #b9c0cc);
  font-size: 11px; font-weight: 800; color: var(--accent, #0891b2);
}
.status-filter-actions {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 6px 4px 2px;
  border-top: 1px solid var(--border-1, #e4e8ee); margin-top: 4px;
}
.status-filter-actions .btn-primary { padding: 4px 16px; font-size: 12px; }
.status-filter-actions .btn-mute { font-size: 12px; }
.asset-table td.ref-cell {
  font-weight: 600; color: var(--text-primary, #1a2230);
  white-space: nowrap;
}

/* ===== REG-061/031: spatial Documents & images panel ===== */
.docs-panel { margin-top: 4px; }
.docs-filter { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 4px; }
.docs-chip {
  border: 1px solid var(--border-1); background: transparent;
  color: var(--text-secondary); padding: 4px 12px; border-radius: 999px;
  font-size: 12px; cursor: pointer;
}
.docs-chip.is-on { background: var(--link, #2f6df6); color: #fff; border-color: var(--link, #2f6df6); }
.docs-uploading, .docs-uploaded { font-size: 13px; margin: 8px 0; color: var(--text-secondary); }
.docs-uploaded { color: #3fbf7f; }
.docs-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 12px; }
@media (min-width: 780px) { .docs-grid { grid-template-columns: 1fr 1fr; } }
.docs-card {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--border-1); border-radius: 10px;
  padding: 10px; background: var(--bg-surface);
}
.docs-thumb {
  width: 64px; height: 64px; flex: 0 0 64px; border-radius: 8px; overflow: hidden;
  background: var(--bg-surface-2); display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.docs-thumb img { width: 100%; height: 100%; object-fit: cover; }
.docs-thumb-icon { font-size: 28px; }
.docs-body { flex: 1 1 auto; min-width: 0; }
.docs-title { font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; }
.docs-sub { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; font-size: 11.5px; color: var(--text-secondary); }
.docs-kind-chip { background: var(--chip-soft-bg, rgba(8,17,31,0.05)); padding: 1px 7px; border-radius: 999px; }
.docs-cat { background: var(--chip-soft-bg, rgba(8,17,31,0.05)); padding: 1px 7px; border-radius: 999px; color: var(--text-secondary); }
.docs-caption { font-size: 12px; color: var(--text-secondary); margin-top: 5px; overflow-wrap: anywhere; }
.docs-geo { display: inline-block; font-size: 11px; color: #6fa8ff; margin-top: 5px; text-decoration: none; }
.docs-geo:hover { text-decoration: underline; }
/* REG-093: you-are-here point on a plan/evac diagram - stand it out a touch. */
.docs-geo-here { color: #4ade80; font-weight: 600; }
.docs-pins-note { font-size: 11px; color: #9fb3c8; margin-top: 4px; }
.row-btn-pins { border-color: #3b6ea5; color: #bcd6ff; }

/* ---- REG-093: diagram asset-pin overlay ---- */
#pinOverlay { position: fixed; inset: 0; z-index: 2000; }
.pin-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.66); }
.pin-modal {
  position: absolute; inset: 3vh 3vw; background: var(--bg-surface, #12161c);
  border: 0.5px solid var(--border-2, #2a3340); border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5); display: flex; flex-direction: column;
  overflow: hidden;
}
.pin-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 0.5px solid var(--border-2, #2a3340);
}
.pin-title { font-weight: 600; font-size: 14px; }
.pin-tools { display: flex; gap: 8px; }
.pin-note { padding: 8px 16px; font-size: 12px; color: #f0c674; background: rgba(240,198,116,0.08); }
.pin-stage {
  position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex;
  align-items: center; justify-content: center; padding: 12px;
  background: #0a0d11;
}
/* The canvas is the positioning box for pins and shrink-wraps the fitted image.
 * We cap the IMAGE directly with viewport-relative sizes (not ancestor %, which
 * fails to resolve inside nested flex boxes and let the image blow out / clip).
 * The modal is inset 3vh 3vw; toolbar ~46px; palette up to 32vh; stage pad 24px.
 * So the image gets the remaining space and object-fit:contain keeps the WHOLE
 * plan visible. Canvas = image size, so pins (% of canvas) stay glued. */
.pin-canvas {
  position: relative; display: inline-block; line-height: 0;
  max-width: 100%; max-height: 100%;
}
.pin-stage img {
  display: block; object-fit: contain;
  max-width: calc(94vw - 24px);
  max-height: calc(94vh - 46px - 24px);
  width: auto; height: auto;
  user-select: none; -webkit-user-drag: none;
}
/* When the asset palette is open (edit mode) it can take up to 32vh, so cap the
 * image tighter to leave room and still fit the whole plan. */
.pin-modal.is-editing .pin-stage img {
  max-height: calc(94vh - 46px - 24px - 34vh);
}
.diagram-pin {
  position: absolute; transform: translate(-50%, -100%);
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  font-size: 11.5px; line-height: 1; cursor: pointer; z-index: 5;
}
.diagram-pin .pin-dot { font-size: 18px; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6)); }
.diagram-pin .pin-label {
  background: rgba(17,22,28,0.92); color: #e8eef6; padding: 2px 6px;
  border-radius: 6px; border: 0.5px solid #3b6ea5; max-width: 180px;
  overflow: hidden; text-overflow: ellipsis;
}
.diagram-pin.is-link:hover .pin-label { background: #1c2836; border-color: #6fa8ff; }
.diagram-pin.is-edit { cursor: grab; }
.diagram-pin.is-edit:active { cursor: grabbing; }
.diagram-pin .pin-x {
  background: #b3261e; color: #fff; border-radius: 50%; width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px;
  margin-left: 2px;
}
.pin-palette {
  border-top: 0.5px solid var(--border-2, #2a3340); max-height: 32vh; overflow: auto;
  padding: 8px 12px;
}
.pin-palette-head { font-size: 12px; color: #9fb3c8; margin-bottom: 6px; }
.pin-palette-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pin-asset {
  font-size: 11.5px; padding: 4px 8px; border-radius: 6px; cursor: pointer;
  background: #172029; color: #cfe0f2; border: 0.5px solid #2a3340;
}
.pin-asset:hover { border-color: #6fa8ff; }
.pin-asset.is-sel { background: #1d3a5f; border-color: #6fa8ff; color: #fff; }
.pin-asset.is-pinned { opacity: 0.72; }
.docs-actions { display: flex; flex-direction: column; gap: 4px; flex: 0 0 auto; }
.docs-actions .row-btn { padding: 3px 8px; font-size: 11.5px; }
.row-btn-danger { color: #ff6b6b; border-color: #5a2a2a; }

/* ===== REG-032/033/034: structured attributes ("Details") editor ===== */
.attr-panel { border: 1px solid var(--border-1); border-radius: 10px; padding: 12px 14px; background: var(--bg-surface); }
.attr-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.attr-bar-title { font-weight: 600; font-size: 13.5px; }
.attr-section { margin-top: 12px; }
.attr-sec-head { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-tertiary); margin-bottom: 6px; border-bottom: 1px solid var(--border-2); padding-bottom: 3px; }
.attr-rows { display: grid; grid-template-columns: 1fr; gap: 6px; }
.attr-row { display: grid; grid-template-columns: 180px 1fr; gap: 12px; align-items: start; font-size: 13px; }
.attr-row-edit { align-items: center; }
.attr-label { color: var(--text-secondary); }
.attr-value { overflow-wrap: anywhere; }
.attr-value input[type=text], .attr-value input[type=number], .attr-value input[type=date],
.attr-value textarea, .attr-value select {
  width: 100%; box-sizing: border-box; background: var(--bg-surface-2); color: inherit;
  border: 1px solid var(--border-1); border-radius: 6px; padding: 5px 8px; font-size: 13px;
}
.attr-unit { color: var(--text-secondary); font-size: 11.5px; margin-left: 6px; }
.attr-help { font-size: 11px; color: var(--text-secondary); margin-top: 3px; }
.attr-check { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; margin-right: 12px; }
.attr-multi { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.attr-contact { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
@media (max-width: 640px) { .attr-row { grid-template-columns: 1fr; gap: 3px; } .attr-contact { grid-template-columns: 1fr; } }

/* ===== REG-023/025/026: PDF report export picker ===== */
.export-card { max-width: 480px; }
.export-opt {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--bg-surface, #fff); border: 1px solid var(--border-1, #E2E8F0);
  border-radius: 10px; padding: 11px 13px; margin-bottom: 9px; transition: all .12s;
}
.export-opt:hover { border-color: #0057FF; background: rgba(0,87,255,.04); transform: translateY(-1px); }
.export-opt-label { font-weight: 700; font-size: 13px; color: var(--text-primary, #0B1220); }
.export-opt-blurb { font-size: 11px; color: var(--text-secondary, #64748B); margin-top: 2px; }

/* ===================================================================
 * REG-089 / REG-092 (2026-07-31): photo category banner + "view more",
 * and asset-record banner tags (provider/installer/warranty/FM +
 * barcode IDs). Ported to match the admin asset screen.
 * =================================================================== */

/* --- REG-089: per-photo category banner overlaid on the thumbnail ---
 * The banner is a NEAT STRIP along the BOTTOM of the 120px preview (Tim: not
 * a full-image tint). The .thumb is a flex column [img, banner, imgref, geo];
 * we anchor the banner to the bottom edge of the IMAGE by pinning it inside
 * the .thumb's image region. Explicit block + fixed height so an inline <span>
 * can never stretch to cover the whole photo. */
.photo-strip .thumb { position: relative; }
.photo-strip .thumb.thumb-tagged > img { border-color: rgba(0, 198, 255, 0.55); }
.photo-strip .thumb .thumb-role {
  position: absolute; left: 0; right: 0;
  /* bottom of the 120px image (image sits at the top of the flex column) */
  top: calc(120px - 18px); height: 18px;
  display: flex; align-items: center; justify-content: center;
  box-sizing: border-box;
  background: rgba(0, 198, 255, 0.92); color: #001;
  font-size: 9px; padding: 0 4px; line-height: 1;
  font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
  border-bottom-left-radius: var(--r-md); border-bottom-right-radius: var(--r-md);
  pointer-events: none; overflow: hidden; white-space: nowrap;
}
.photo-strip .thumb .thumb-role-nameplate     { background: rgba(0, 198, 255, 0.92); color: #001; }
/* REG-089: sub_component banner retired (was noise); diagram + document added. */
.photo-strip .thumb .thumb-role-diagram       { background: rgba(123, 47, 255, 0.88); color: #fff; }
.photo-strip .thumb .thumb-role-document      { background: rgba(230, 160, 40, 0.92); color: #201500; }
.photo-strip .thumb .thumb-role-sub_component { background: rgba(123, 47, 255, 0.85); color: #fff; }

/* --- REG-110: user-tagged Display image (sorts first + PDF page 1) --- */
.photo-strip .thumb.thumb-is-display > img {
  border-color: rgba(255, 196, 0, 0.9); box-shadow: 0 0 0 2px rgba(255, 196, 0, 0.45);
}
.photo-strip .thumb .thumb-display {
  position: absolute; top: 4px; left: 4px; z-index: 2;
  background: rgba(255, 196, 0, 0.95); color: #201500;
  font-size: 9px; font-weight: 800; letter-spacing: 0.4px; text-transform: uppercase;
  padding: 2px 6px; border-radius: 999px; pointer-events: none;
}
.photo-strip .thumb .thumb-display-btn {
  position: absolute; top: 3px; right: 3px; z-index: 3;
  width: 26px; height: 26px; padding: 0; line-height: 24px; text-align: center;
  border-radius: 999px; cursor: pointer; font-size: 15px;
  background: rgba(10, 14, 22, 0.72); color: #ffd24d;
  border: 1px solid rgba(255, 210, 77, 0.5);
  /* Always visible (was hover-only + opacity:0 -> invisible on touch / easy to
     miss). Full opacity so the toggle is discoverable. */
  opacity: 1; transition: transform 0.12s ease, background 0.12s ease;
}
.photo-strip .thumb .thumb-display-btn:hover { transform: scale(1.12); background: rgba(10, 14, 22, 0.9); }
.photo-strip .thumb .thumb-display-btn.on { color: #f5b301; background: rgba(245, 179, 1, 0.22); border-color: #f5b301; }

/* --- REG-089: view-more / show-fewer control under the grid --- */
.photo-more { width: 100%; margin-top: var(--sp-2); }
.photo-more .btn-mute { font-size: 12px; }

/* --- REG-092: asset-record banner tags (company names + barcode IDs) --- */
.banner-tags { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-2) 0; }
.banner-tag {
  display: inline-flex; align-items: baseline; gap: 4px;
  padding: 2px 8px; border-radius: 6px; font-size: 11.5px;
  border: 0.5px solid var(--border-1); background: var(--bg-surface-2);
}
.banner-tag-label {
  font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase;
  font-weight: 600; color: var(--text-tertiary);
}
.banner-tag-value { font-family: var(--mono, monospace); font-weight: 600; color: var(--text-primary); }
.banner-tag-issuer { color: var(--text-secondary); font-size: 11px; }
.banner-tag-fm       { border-color: rgba(168, 85, 247, 0.40); }
.banner-tag-fm .banner-tag-label       { color: #b18bff; }
.banner-tag-service  { border-color: rgba(29, 158, 117, 0.40); }
.banner-tag-service .banner-tag-label  { color: #4dd9a7; }
.banner-tag-installer { border-color: rgba(0, 158, 210, 0.40); }
.banner-tag-installer .banner-tag-label { color: #4bc6ee; }
.banner-tag-warranty { border-color: rgba(230, 160, 40, 0.40); }
.banner-tag-warranty .banner-tag-label { color: #e0a83a; }
.banner-tag-provider { border-color: rgba(120, 130, 150, 0.40); }
.banner-tag-provider .banner-tag-label { color: #9aa5b8; }
[data-theme="ice"] .banner-tag-fm .banner-tag-label,
[data-theme="paper"] .banner-tag-fm .banner-tag-label { color: #7B2FFF; }
[data-theme="ice"] .banner-tag-service .banner-tag-label,
[data-theme="paper"] .banner-tag-service .banner-tag-label { color: #0F6E56; }
