/* ==========================================================================
   BORDERLINE · OBSIDIAN RED
   Shell: authentication, sidebar, topbar, overview, scanner, overlays.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Safety notice (fixture only)
   -------------------------------------------------------------------------- */
body > div[role="note"] {
  position: sticky !important;
  top: 0 !important;
  z-index: 9500 !important;
  background: var(--surface-2) !important;
  color: var(--muted) !important;
  border-bottom: 1px solid var(--border) !important;
  font-family: var(--font-ui) !important;
  font-size: 9px !important;
  font-weight: 500 !important;
  letter-spacing: .13em !important;
  text-transform: uppercase;
  padding: 6px 12px !important;
}

/* --------------------------------------------------------------------------
   Authentication — full-bleed industrial split
   -------------------------------------------------------------------------- */
.auth-stage { min-height: calc(100dvh - var(--demo-banner-h, 0px)); display: grid; }
body:has(#scannerSection:not(.hidden)) .auth-stage { display: none; }

#setup {
  position: fixed;
  top: 14px; left: 50%;
  transform: translateX(-50%);
  z-index: 9500;
  width: min(720px, calc(100vw - 24px));
  padding: 10px 14px;
  border: 1px solid var(--danger-line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--danger);
  font-size: 12px;
  line-height: 1.5;
}

.login-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(420px, .88fr);
  width: 100%;
  min-height: calc(100dvh - var(--demo-banner-h, 0px));
  border: 0;
  border-radius: 0;
  background: var(--bg);
  box-shadow: none;
  overflow: hidden;
  animation: bl-login-in 520ms var(--ease-out) both;
}
@keyframes bl-login-in { from { opacity: 0; } to { opacity: 1; } }

.login-identity {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(28px, 4.2vw, 52px);
  background: #0c0c0c url("assets/gym-dark.webp") center/cover no-repeat;
  color: #e8e6e3;
}
.login-identity::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(12, 12, 12, .62) 0%, rgba(12, 12, 12, .18) 40%, rgba(12, 12, 12, .95) 100%),
    linear-gradient(92deg, rgba(12, 12, 12, .72) 0%, rgba(12, 12, 12, .12) 72%);
}
.login-identity::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(520px 280px at 86% 10%, rgba(197, 44, 50, .2), transparent 70%),
    radial-gradient(420px 260px at 8% 100%, rgba(197, 44, 50, .08), transparent 70%);
  mix-blend-mode: screen;
}
.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.045em;
  color: #f4f1ed;
}
.login-brand .square { width: 9px; height: 9px; background: var(--primary); }
.login-brand em { font-style: normal; color: var(--primary); }
.login-statement {
  margin: auto 0 22px;
  font-family: var(--font-display);
  font-size: clamp(44px, 5.4vw, 82px);
  font-weight: 600;
  line-height: .94;
  letter-spacing: -.07em;
  color: #efede9;
  text-wrap: balance;
}
.login-identity .login-caption {
  margin: 0;
  color: rgba(232, 230, 227, .55);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
}
.login-signal {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid rgba(232, 230, 227, .16);
  color: rgba(232, 230, 227, .58);
  font-size: 10px;
}
.login-signal .signal { display: inline-flex; align-items: center; gap: 7px; }
.login-signal .signal::before { content: ""; width: 4px; height: 4px; background: #7cc79a; }
.login-signal .rule { width: 1px; height: 11px; background: rgba(232, 230, 227, .18); }

.login-content {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(32px, 4.6vw, 64px);
  background: var(--surface);
  border-left: 1px solid var(--border);
}
.login-topline { position: absolute; top: 18px; right: 18px; margin: 0; z-index: 2; }
.login-topline .section-kicker { display: none !important; }
.login-content h2 { margin: 0 0 8px; font-size: clamp(30px, 3.2vw, 40px); letter-spacing: -.045em; }
.login-content .lead { margin: 0 0 24px; max-width: 36ch; font-size: 13px; }
#loginStatus {
  margin: 0 0 14px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-inset);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}
#loginStatus:empty { display: none; }
#loginStatus.good { color: var(--success); border-color: var(--success-line); }
#loginStatus.bad { color: var(--danger); border-color: var(--danger-line); }
#loginForm { display: grid; gap: 14px; }
#loginForm input { min-height: 44px; }
#loginForm .actions { margin-top: 6px; }
#loginBtn { width: 100%; min-height: 44px; justify-content: space-between; padding: 0 14px; font-size: 13px; }
.login-gym-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
  text-decoration: none;
}
.login-gym-link:hover { color: var(--text); text-decoration: underline; }
.login-signature { margin: 26px 0 0; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted-2); font-size: 10px; }

/* --------------------------------------------------------------------------
   App shell
   -------------------------------------------------------------------------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: calc(100dvh - var(--demo-banner-h, 0px));
  transition: grid-template-columns 300ms var(--ease-out);
}
.app-shell.is-collapsed { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

.sidebar {
  position: sticky;
  top: var(--demo-banner-h, 0px);
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: calc(100dvh - var(--demo-banner-h, 0px));
  padding: 14px 10px 10px;
  border-right: 1px solid var(--border);
  background: var(--sidebar);
  overflow: hidden;
}
.sidebar-head { display: flex; align-items: center; gap: 4px; padding: 2px 4px 12px; }
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
  padding: 4px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  text-align: left;
  box-shadow: none;
}
.brand:hover:not(:disabled) { background: transparent; border-color: transparent; }
.brand-mark { width: 9px; height: 9px; flex: none; background: var(--primary); }
.brand-copy { display: grid; min-width: 0; gap: 1px; }
.brand-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.04em;
  color: var(--text);
  white-space: nowrap;
}
.brand-title span { color: var(--primary); }
.brand-subtitle {
  color: var(--muted-2);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: .18em;
  line-height: 1.5;
  text-transform: uppercase;
}
.sidebar-collapse { flex: none; }

.sidebar-context {
  margin: 0 4px 8px;
  padding: 12px 6px 14px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.context-label {
  display: block;
  color: var(--muted-2);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.context-name { display: block; margin-top: 4px; color: var(--text-2); font-size: 11px; font-weight: 450; line-height: 1.35; }
.context-scope {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 9.5px;
}
.context-scope::before { content: ""; width: 4px; height: 4px; background: var(--success); }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 2px 10px;
}
.nav-group-title {
  margin: 16px 8px 5px;
  color: var(--muted-2);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.nav-group-title:first-child { margin-top: 4px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 450;
  letter-spacing: .005em;
  text-align: left;
  box-shadow: none;
  transition: background-color var(--dur-1) linear, color var(--dur-1) linear;
}
.nav-item:hover:not(:disabled) { background: var(--surface-2); color: var(--text); transform: none; }
.nav-item[aria-current="page"] {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 500;
}
.nav-item[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--primary);
  transform-origin: center;
  animation: bl-nav-in 220ms var(--ease-out) both;
}
@keyframes bl-nav-in { from { transform: scaleY(.15); opacity: 0; } to { transform: scaleY(1); opacity: 1; } }
.nav-item[aria-current="page"] .nav-icon { color: var(--text); }
.nav-icon { display: grid; place-items: center; flex: none; width: 16px; height: 16px; color: var(--muted-2); }
.nav-icon svg { width: 15px; height: 15px; stroke-width: 1.5; }
.nav-label { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item--accent { color: var(--muted); }
.nav-item--accent .nav-icon { color: var(--primary); }

.workspace-links {
  display: grid;
  gap: 1px;
  margin: 12px 4px 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.workspace-links a {
  display: flex;
  align-items: center;
  min-height: 28px;
  padding: 0 5px;
  color: var(--muted-2);
  font-size: 9.5px;
  letter-spacing: .02em;
  text-decoration: none;
  transition: color var(--dur-1) linear;
}
.workspace-links a:hover { color: var(--text); }
.workspace-links a::after {
  content: "";
  width: 5px; height: 5px;
  margin-left: auto;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg);
  opacity: .45;
}

.sidebar-foot { display: grid; gap: 4px; padding-top: 8px; border-top: 1px solid var(--border); }
.sidebar-util { display: flex; gap: 2px; }
.sidebar-util .util-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-height: 28px;
  padding: 0 6px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 450;
  text-align: left;
  box-shadow: none;
}
.sidebar-util .util-btn:hover { background: var(--surface-2); color: var(--text); }
.util-btn svg { width: 14px; height: 14px; flex: none; }

.auth-meta.profile {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.profile-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px; height: 24px;
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
}
.profile-meta { min-width: 0; flex: 1; display: grid; gap: 1px; }
.profile-meta .signed-label { color: var(--muted-2); font-size: 7.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.profile-meta strong { color: var(--text-2); font-size: 10px; font-weight: 450; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-mark {
  width: 5px; height: 5px;
  flex: none;
  border-radius: 50%;
  background: var(--success);
}
.auth-pill { display: none; }
.signout { display: flex; }
#logoutBtn {
  flex: 1;
  min-height: 28px;
  padding: 0 6px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 450;
  justify-content: flex-start;
  box-shadow: none;
}
#logoutBtn:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* Collapsed rail */
.app-shell.is-collapsed .brand-copy,
.app-shell.is-collapsed .sidebar-context,
.app-shell.is-collapsed .nav-label,
.app-shell.is-collapsed .nav-group-title,
.app-shell.is-collapsed .workspace-links a span,
.app-shell.is-collapsed .profile-meta,
.app-shell.is-collapsed .util-btn span,
.app-shell.is-collapsed .logout-label { display: none; }
.app-shell.is-collapsed .sidebar { padding-left: 8px; padding-right: 8px; }
.app-shell.is-collapsed .sidebar-head { flex-direction: column; gap: 6px; }
.app-shell.is-collapsed .brand { flex: none; justify-content: center; }
.app-shell.is-collapsed .sidebar-collapse { transform: rotate(180deg); }
.app-shell.is-collapsed .nav-item { justify-content: center; padding: 0; }
.app-shell.is-collapsed .nav-item[aria-current="page"]::before { left: -2px; }
.app-shell.is-collapsed .sidebar-util { flex-direction: column; }
.app-shell.is-collapsed .util-btn { justify-content: center; padding: 0; }
.app-shell.is-collapsed .auth-meta.profile { justify-content: center; padding: 6px 0; }
.app-shell.is-collapsed .session-mark { display: none; }
.app-shell.is-collapsed .workspace-links { display: none; }
.app-shell.is-collapsed #logoutBtn { justify-content: center; }

/* --------------------------------------------------------------------------
   Main column / topbar
   -------------------------------------------------------------------------- */
.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  position: sticky;
  top: var(--demo-banner-h, 0px);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--topbar-h);
  padding: 0 clamp(16px, 2.4vw, 34px);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.crumbs .crumb-brand { color: var(--muted); }
.crumbs .crumb-sep { color: var(--primary); }
.crumbs #crumbCurrent { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.cmd-trigger {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 176px;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 400;
  text-align: left;
  box-shadow: none;
}
.cmd-trigger:hover { border-color: var(--border-strong); background: var(--surface-2); color: var(--muted); }
.cmd-trigger .cmd-label { flex: 1; }
.cmd-trigger svg { width: 13px; height: 13px; }
#mobileMenuBtn { display: none; }
#topbarScanBtn { font-size: 10.5px; color: var(--muted); min-height: 28px; padding: 0 7px; }
#topbarScanBtn svg { width: 13px; height: 13px; }

.app-viewport {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(22px, 2.8vw, 40px) clamp(16px, 2.4vw, 34px) 24px;
  flex: 1;
}
.workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.workspace:has(#sportsDashboard:not(.hidden)) { grid-template-columns: minmax(0, 1fr) 272px; }
.workspace:not(:has(#sportsDashboard:not(.hidden))) .side-panel { display: none; }
.side-panel {
  position: sticky;
  top: calc(var(--topbar-h) + var(--demo-banner-h, 0px) + 20px);
  padding: 0 0 18px 20px;
  border-left: 1px solid var(--border);
  background: transparent;
  border-radius: 0;
}
.side-panel h2 { margin: 0 0 8px; font-size: 16px; }
.side-panel > p { margin: 0 0 18px; font-size: 11px; color: var(--muted); line-height: 1.6; }
.info-row { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 9px; padding: 12px 0; border-top: 1px solid var(--border); }
.info-number { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--border-strong); border-radius: 2px; color: var(--muted); font-family: var(--font-mono); font-size: 8px; }
.info-row strong { display: block; margin-bottom: 2px; color: var(--text-2); font-size: 11px; font-weight: 500; }
.info-row span { display: block; color: var(--muted); font-size: 10.5px; line-height: 1.5; }
.side-panel .rail-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--muted-2); font-size: 9.5px; line-height: 1.6; }

#workPanel { min-width: 0; padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
#workPanel:has(#crmSection:not(.hidden)) .view-head,
#workPanel:has(#manageMode:not(.hidden)) .view-head { display: none; }
.command-heading, .section-kicker, .eyebrow { display: none !important; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.view-head h1 { margin: 0 0 6px; }
.view-head .lead { max-width: 60ch; }
.view-head-actions { flex: none; }
.overview-action { display: flex; align-items: center; gap: 8px; }
#overviewOpenScanner { min-height: 38px; font-size: 12px; }
#overviewOpenScanner svg { width: 14px; height: 14px; }
#dashboardScopeNote { margin: 14px 0; padding: 10px 12px; border: 1px solid var(--warning-line); background: var(--warning-soft); color: var(--warning); font-size: 11.5px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--border); }
.toolbar:not(:has(button:not(.hidden))) { display: none; }
.toolbar button { min-height: 32px; }
#status:not(.bad) { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#status.bad { display: block; margin: 16px 0 0; padding: 9px 11px; border: 1px solid var(--danger-line); border-radius: var(--r-sm); background: var(--danger-soft); color: var(--danger); font-size: 11.5px; }

/* --------------------------------------------------------------------------
   Dashboard — open instrument composition
   -------------------------------------------------------------------------- */
#sportsDashboard { position: relative; isolation: isolate; margin: 0; padding: 0; background: transparent; border: 0; border-radius: 0; }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.dash-head h2 { margin: 0; font-size: 19px; letter-spacing: -.03em; }
.dash-head-meta { display: flex; align-items: center; gap: 14px; color: var(--muted-2); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.dash-head-meta .status-dot { font-size: 9.5px; }
.dash-head-meta b { color: var(--text-2); font-weight: 500; }

.metric-band {
  display: grid;
  grid-template-columns: 1.5fr repeat(2, minmax(0, 1fr)) 1.2fr;
  border-bottom: 1px solid var(--border);
}
.metric-primary, .metric-cell { min-width: 0; padding: 26px 20px 22px; border-left: 1px solid var(--border); }
.metric-primary { padding-left: 0; border-left: 0; position: relative; }
.metric-primary::before { content: ""; display: block; width: 26px; height: 2px; margin-bottom: 16px; background: var(--primary); }
.metric-label { margin: 0 0 14px; color: var(--muted); font-size: 9.5px; font-weight: 550; letter-spacing: .1em; text-transform: uppercase; }
.metric-value { position: relative; min-height: .9em; }
.metric-value h2, .metric-cell h2 { margin: 0; font-family: var(--font-display); font-weight: 600; line-height: .9; letter-spacing: -.06em; font-variant-numeric: tabular-nums; color: var(--text); }
.metric-primary h2 { font-size: clamp(56px, 5.8vw, 88px); }
.metric-cell h2 { font-size: clamp(34px, 3.1vw, 48px); }
.metric-count { position: absolute; inset: 0 auto auto 0; display: none; font-family: var(--font-display); font-size: clamp(56px, 5.8vw, 88px); font-weight: 600; line-height: .9; letter-spacing: -.06em; font-variant-numeric: tabular-nums; color: var(--text); }
.metric-cell .metric-count { font-size: clamp(34px, 3.1vw, 48px); }
.metric-value.is-counting h2 { opacity: 0; }
.metric-value.is-counting .metric-count { display: block; }
.metric-note { margin: 10px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.metric-cell .metric-note { max-width: 22ch; }
.share-line { display: flex; gap: 0; height: 2px; margin: 13px 0 0; background: var(--border); }
.share-line i { display: block; height: 100%; background: var(--primary); transition: width 420ms var(--ease-out); }
.share-line i + i { background: var(--muted-2); }
.metric-cell .metric-note b { color: var(--text-2); font-weight: 550; }

.dash-instruments {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(240px, .75fr);
  margin-top: 26px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-inset);
  overflow: hidden;
}
.chart-section { min-width: 0; padding: 22px 24px 18px; }
.mix-section { min-width: 0; padding: 22px; border-left: 1px solid var(--border); }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.section-head h3 { margin: 0 0 3px; font-size: 13px; letter-spacing: -.01em; }
.section-head p { margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.5; }
.section-head > span { color: var(--muted-2); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.chart-body { position: relative; min-height: 190px; }
.chart-body .empty-state { min-height: 180px; align-content: center; }

.dash-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(240px, .75fr);
  margin-top: 26px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.activity-section { min-width: 0; padding: 20px 24px 16px 0; }
.actions-section { min-width: 0; padding: 20px 0 16px 24px; border-left: 1px solid var(--border); }
#dashHistory { max-height: 250px; overflow: auto; color: var(--muted); font-size: 12px; line-height: 1.5; }
#dashHistory p { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 45px; margin: 0; padding: 8px 0; border-bottom: 1px solid var(--border-soft); }
#dashHistory p:last-child { border-bottom: 0; }
.visit-identity { display: grid; gap: 1px; min-width: 0; }
.visit-identity strong { color: var(--text-2); font-size: 11.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.visit-identity > span { color: var(--muted-2); font-size: 9.5px; }
#dashHistory time { flex: none; color: var(--muted); font-size: 9.5px; font-variant-numeric: tabular-nums; text-align: right; }

.qa-list { display: grid; }
.qa-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 38px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  border-radius: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 450;
  text-align: left;
  box-shadow: none;
  transition: color var(--dur-1) linear, padding-left var(--dur-2) var(--ease-out);
}
.qa-row:last-child { border-bottom: 0; }
.qa-row:hover:not(:disabled) { background: transparent; border-color: var(--border-soft); color: var(--text); padding-left: 4px; }
.qa-row svg { width: 12px; height: 12px; color: var(--muted-2); transition: color var(--dur-1) linear, transform var(--dur-2) var(--ease-out); }
.qa-row:hover svg { color: var(--primary); transform: translateX(2px); }
.qa-row span { display: grid; gap: 1px; }
.qa-row em { font-style: normal; color: var(--muted-2); font-size: 9px; font-weight: 400; letter-spacing: .02em; }

.dash-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 14px;
}
.dash-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; color: var(--muted-2); font-size: 9.5px; letter-spacing: .02em; }
.dash-meta b { color: var(--muted); font-weight: 500; }
.dash-feedback { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dash-feedback p { margin: 0; color: var(--muted-2); font-size: 9.5px; }
.dash-feedback button { min-height: 28px; padding: 0 9px; font-size: 10px; }

/* Login/overview footer */
.footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 26px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--muted-2); font-size: 9.5px; }
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--text); }
.footer .footer-meta { display: flex; align-items: center; gap: 12px; }

/* --------------------------------------------------------------------------
   Scanner
   -------------------------------------------------------------------------- */
#scanMode { margin-top: 2px; }
#scannerCamera {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-inset);
  overflow: hidden;
}
.scanner-copy { display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: clamp(24px, 3vw, 38px); border-right: 1px solid var(--border); min-width: 0; }
.scanner-copy h2 { margin: 0; font-size: clamp(23px, 2.4vw, 31px); letter-spacing: -.04em; }
.scanner-copy p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.65; max-width: 42ch; }
.scanner-steps { display: grid; gap: 7px; margin-top: 3px; }
.scanner-step { display: flex; align-items: flex-start; gap: 9px; color: var(--muted); font-size: 10.5px; line-height: 1.5; }
.scanner-step i { display: grid; place-items: center; flex: none; width: 17px; height: 17px; margin-top: 1px; border: 1px solid var(--border-strong); border-radius: 2px; font-family: var(--font-mono); font-size: 8px; font-style: normal; color: var(--muted-2); }
#startBtn { align-self: flex-start; min-height: 42px; padding: 0 18px; font-size: 12.5px; margin-top: 4px; }
.scan-symbol { display: inline-grid; place-items: center; width: 16px; height: 16px; }
.scan-symbol svg { width: 15px; height: 15px; }
.viewfinder-wrap { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 18px; background: var(--viewfinder); }
.viewfinder {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 340px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid #2c2c2c;
  border-radius: 2px;
  background:
    linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px) 0 0/100% 44px,
    #080808;
}
.viewfinder::before, .viewfinder::after {
  content: "";
  position: absolute;
  z-index: 2;
  left: 16px; right: 16px;
  height: 22px;
  pointer-events: none;
  background:
    linear-gradient(var(--primary), var(--primary)) left top / 20px 1px no-repeat,
    linear-gradient(var(--primary), var(--primary)) left top / 1px 20px no-repeat,
    linear-gradient(var(--primary), var(--primary)) right top / 20px 1px no-repeat,
    linear-gradient(var(--primary), var(--primary)) right top / 1px 20px no-repeat;
  opacity: .9;
}
.viewfinder::before { top: 16px; }
.viewfinder::after {
  top: auto; bottom: 16px;
  background:
    linear-gradient(var(--primary), var(--primary)) left bottom / 20px 1px no-repeat,
    linear-gradient(var(--primary), var(--primary)) left bottom / 1px 20px no-repeat,
    linear-gradient(var(--primary), var(--primary)) right bottom / 20px 1px no-repeat,
    linear-gradient(var(--primary), var(--primary)) right bottom / 1px 20px no-repeat;
}
.camera-placeholder { display: grid; justify-items: center; gap: 7px; text-align: center; color: #8c8c8c; padding: 18px; }
.camera-placeholder strong { color: #e8e6e3; font-size: 12px; font-weight: 500; }
.camera-placeholder p { margin: 0; max-width: 30ch; font-size: 10.5px; line-height: 1.55; color: #8c8c8c; }
.camera-placeholder .scan-frame { display: grid; place-items: center; width: 66px; height: 66px; margin-bottom: 8px; border: 1px solid #3a3a3a; border-radius: 2px; color: var(--primary); background: #121212; }
.scan-plus { position: relative; display: block; width: 22px; height: 22px; }
.scan-plus::before, .scan-plus::after { content: ""; position: absolute; left: 50%; top: 50%; background: currentColor; transform: translate(-50%, -50%); }
.scan-plus::before { width: 22px; height: 1px; }
.scan-plus::after { width: 1px; height: 22px; }
.viewfinder #reader { width: 100%; }
.viewfinder #reader video, .viewfinder #reader__scan_region video { display: block !important; width: 100% !important; max-width: 100% !important; height: auto !important; max-height: 60dvh !important; object-fit: contain !important; border-radius: 2px !important; }
.viewfinder #reader__scan_region { width: 100% !important; max-width: 100% !important; min-width: 0 !important; display: flex !important; align-items: center; justify-content: center; }
.viewfinder #reader__dashboard { width: 100% !important; max-width: 100% !important; }
#scannerCamera .actions { display: flex; gap: 8px; }
#scannerCamera .actions button { min-height: 32px; font-size: 10.5px; background: #1c1c1c; border-color: #343434; color: #b9b6b1; }
#scannerCamera .tool-note { grid-column: 1 / -1; margin: 0; padding: 13px 24px; border-top: 1px solid var(--border); background: var(--surface); font-size: 10px; color: var(--muted); }
.scan-beam { position: absolute; left: 12%; right: 12%; top: 50%; height: 1px; background: linear-gradient(90deg, transparent, var(--accent-line), transparent); opacity: 0; pointer-events: none; }
.viewfinder.is-scanning .scan-beam { opacity: .9; animation: bl-scan-beam 2.8s var(--ease-in-out) infinite alternate; }
@keyframes bl-scan-beam { from { transform: translateY(-70px); } to { transform: translateY(70px); } }

/* --------------------------------------------------------------------------
   Access result
   -------------------------------------------------------------------------- */
.access-result { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 16px; padding: 28px 18px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-inset); text-align: center; }
.access-result-icon { display: grid; place-items: center; width: 58px; height: 58px; border: 1px solid var(--success-line); border-radius: 2px; background: var(--success-soft); color: var(--success); font-size: 28px; font-weight: 600; line-height: 1; }
.access-result h2 { margin: 0; font-size: clamp(22px, 4vw, 30px); letter-spacing: -.04em; }
.access-result p { margin: 0; max-width: 44ch; color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }
.access-result .access-result-note { color: var(--muted-2); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; }
.access-result button { min-height: 40px; margin-top: 8px; }
.access-result.denied { border-color: var(--danger-line); }
.access-result.denied .access-result-icon { border-color: var(--danger-line); background: var(--danger-soft); color: var(--danger); }
.access-result.error { border-color: var(--warning-line); }
.access-result.error .access-result-icon { border-color: var(--warning-line); background: var(--warning-soft); color: var(--warning); }
.access-result:not(.hidden) {
  position: fixed;
  inset: 0;
  z-index: 9400;
  margin: 0;
  padding: clamp(22px, 5vw, 60px);
  border: 0;
  border-radius: 0;
  min-height: 100dvh;
  justify-content: center;
  background: var(--bg-deep);
  animation: bl-access-in 260ms var(--ease-out) both;
}
@keyframes bl-access-in { from { opacity: 0; transform: scale(.992); } to { opacity: 1; transform: none; } }
.access-result.denied:not(.hidden) { background: #0e0a0a; }
.access-result.error:not(.hidden) { background: #0f0d09; }
.access-result:not(.hidden) .access-result-icon { width: 76px; height: 76px; font-size: 38px; }
.access-result:not(.hidden) h2 { font-size: clamp(28px, 5vw, 44px); }
.access-result:not(.hidden) p { font-size: clamp(13px, 2vw, 17px); }
.access-result:not(.hidden) button { width: min(100%, 340px); min-height: 46px; margin-top: 20px; }

#crmQRZoom { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0, 0, 0, .86); }
#crmQRZoom.hidden { display: none; }

/* --------------------------------------------------------------------------
   Preferences popover
   -------------------------------------------------------------------------- */
.prefs-popover {
  position: fixed;
  left: calc(var(--sidebar-w) + 8px);
  bottom: 58px;
  z-index: 7000;
  width: 258px;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  box-shadow: var(--shadow-md);
  transform-origin: bottom left;
  animation: bl-pop 170ms var(--ease-out) both;
}
.app-shell.is-collapsed ~ .prefs-popover { left: calc(var(--sidebar-w-collapsed) + 8px); }
.prefs-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.prefs-head h3 { margin: 0 0 2px; font-size: 13px; }
.prefs-head p { margin: 0; color: var(--muted); font-size: 9.5px; }
.prefs-group { margin-top: 11px; }
.prefs-label { display: block; margin-bottom: 5px; color: var(--muted-2); font-size: 8px; font-weight: 600; letter-spacing: .15em; text-transform: uppercase; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 3px; background: var(--surface-inset); }
.segmented button { min-height: 25px; padding: 0 6px; border: 1px solid transparent; border-radius: 2px; background: transparent; color: var(--muted); font-size: 9.5px; font-weight: 450; box-shadow: none; }
.segmented button:hover:not(:disabled) { background: transparent; border-color: transparent; color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }

/* --------------------------------------------------------------------------
   Command palette
   -------------------------------------------------------------------------- */
.cmdk { position: fixed; inset: 0; z-index: 9200; display: grid; place-items: start center; padding-top: min(16vh, 128px); }
.cmdk-scrim { position: absolute; inset: 0; background: var(--overlay); animation: bl-fade 150ms linear both; }
.cmdk-panel { position: relative; width: min(560px, calc(100vw - 24px)); overflow: hidden; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface-2); box-shadow: var(--shadow-lg); transform-origin: top center; }
.cmdk-search { display: flex; align-items: center; gap: 9px; padding: 12px 13px; border-bottom: 1px solid var(--border); }
.cmdk-search svg { width: 15px; height: 15px; flex: none; color: var(--muted); }
.cmdk-search input { flex: 1; min-height: 22px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-size: 13px; }
.cmdk-search input:focus { border: 0; box-shadow: none; background: transparent; }
.cmdk-list { max-height: min(52vh, 380px); overflow-y: auto; padding: 5px; }
.cmdk-group { padding: 8px 8px 3px; color: var(--muted-2); font-size: 8px; font-weight: 600; letter-spacing: .15em; text-transform: uppercase; }
.cmdk-item { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 33px; padding: 5px 8px; border: 0; border-left: 2px solid transparent; border-radius: 0; background: transparent; color: var(--text-2); font-size: 11.5px; text-align: left; box-shadow: none; }
.cmdk-item:hover, .cmdk-item.is-active { background: var(--surface-3); color: var(--text); }
.cmdk-item.is-active { border-left-color: var(--primary); }
.cmdk-item svg { width: 14px; height: 14px; flex: none; color: var(--muted); }
.cmdk-item .cmdk-hint { margin-left: auto; color: var(--muted-2); font-size: 9.5px; }
.cmdk-empty { padding: 22px 12px; color: var(--muted); font-size: 11.5px; text-align: center; }
.cmdk-foot { display: flex; gap: 16px; padding: 8px 13px; border-top: 1px solid var(--border); color: var(--muted-2); font-size: 8.5px; letter-spacing: .04em; }

/* Shared */
.back-btn { flex: none; width: 32px; height: 32px; min-height: 32px; padding: 0; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1440px) {
  .workspace:has(#sportsDashboard:not(.hidden)) { grid-template-columns: minmax(0, 1fr) 252px; }
}
@media (max-width: 1320px) {
  .workspace:has(#sportsDashboard:not(.hidden)) { grid-template-columns: minmax(0, 1fr); }
  .side-panel { display: none; }
}
@media (max-width: 1180px) {
  .metric-band { grid-template-columns: 1.3fr 1fr 1fr; }
  .metric-cell--accent { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--border); display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 20px; }
  .metric-cell--accent .metric-label { margin-bottom: 6px; }
  .metric-cell--accent h2 { font-size: 36px; }
  .metric-cell--accent .share-line { margin: 8px 0 0; }
  .metric-cell--accent .metric-note { margin: 8px 0 0; }
  .dash-instruments { grid-template-columns: minmax(0, 1.5fr) minmax(220px, .8fr); }
}
@media (min-width: 901px) and (max-width: 1100px) {
  .app-shell { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }
  .app-shell .sidebar { padding: 14px 8px 10px; }
  .app-shell .brand-copy, .app-shell .sidebar-context, .app-shell .nav-label,
  .app-shell .nav-group-title, .app-shell .workspace-links,
  .app-shell .profile-meta, .app-shell .session-mark, .app-shell .util-btn span,
  .app-shell .logout-label { display: none; }
  .app-shell .sidebar-head { flex-direction: column; gap: 6px; }
  .app-shell .brand { flex: none; justify-content: center; }
  .app-shell .sidebar-collapse { display: none; }
  .app-shell .nav-item { justify-content: center; padding: 0; }
  .app-shell .nav-item[aria-current="page"]::before { left: -2px; }
  .app-shell .sidebar-util { flex-direction: column; }
  .app-shell .util-btn { justify-content: center; padding: 0; }
  .app-shell .auth-meta.profile { justify-content: center; padding: 6px 0; }
  .app-shell #logoutBtn { justify-content: center; }
  .prefs-popover { left: calc(var(--sidebar-w-collapsed) + 8px); }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .app-shell .sidebar {
    position: fixed;
    left: 0; top: var(--demo-banner-h, 0px);
    width: min(86vw, 292px);
    height: calc(100dvh - var(--demo-banner-h, 0px));
    padding: 14px 10px 10px;
    transform: translateX(-102%);
    transition: transform 300ms var(--ease-drawer);
    box-shadow: var(--shadow-lg);
  }
  .app-shell.nav-open .sidebar { transform: none; }
  .app-shell .brand-copy, .app-shell .sidebar-context, .app-shell .nav-label,
  .app-shell .nav-group-title, .app-shell .profile-meta,
  .app-shell .util-btn span, .app-shell .logout-label { display: revert; }
  .app-shell .workspace-links { display: grid; }
  .app-shell .sidebar-head { flex-direction: row; gap: 4px; }
  .app-shell .brand { flex: 1; justify-content: flex-start; }
  .app-shell .sidebar-collapse { display: none; }
  .app-shell .nav-item { justify-content: flex-start; padding: 0 8px; }
  .app-shell .sidebar-util { flex-direction: row; }
  .app-shell .util-btn { justify-content: flex-start; padding: 0 6px; }
  .app-shell .auth-meta.profile { justify-content: flex-start; padding: 8px 6px; }
  .app-shell #logoutBtn { justify-content: flex-start; }
  #mobileMenuBtn { display: inline-flex; }
  .crumbs .crumb-brand, .crumbs .crumb-sep { display: none; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 35; background: var(--overlay); opacity: 0; visibility: hidden; transition: opacity 220ms ease, visibility 220ms; }
  .app-shell.nav-open .sidebar-scrim { opacity: 1; visibility: visible; }
  body.nav-locked { overflow: hidden; }
  #loginSection.login-shell { grid-template-columns: 1fr; min-height: calc(100dvh - var(--demo-banner-h, 0px)); }
  .login-identity { min-height: 200px; padding: 24px; }
  .login-statement { font-size: clamp(34px, 7vw, 52px); margin: 24px 0 14px; }
  .login-identity .login-signal { display: none; }
  .login-content { border-left: 0; border-top: 1px solid var(--border); padding: 28px 24px 34px; }
  .login-content h2 { font-size: 28px; }
  .dash-instruments, .dash-bottom { grid-template-columns: minmax(0, 1fr); }
  .mix-section { border-left: 0; border-top: 1px solid var(--border); }
  .actions-section { border-left: 0; border-top: 1px solid var(--border); padding-left: 0; }
  .activity-section { padding-right: 0; }
}
@media (max-width: 760px) {
  .app-viewport { padding: 18px 14px 20px; }
  .app-topbar { padding: 0 14px; }
  .cmd-trigger { min-width: 0; width: 30px; padding: 0; justify-content: center; }
  .cmd-trigger .cmd-label, .cmd-trigger kbd { display: none; }
  #topbarScanBtn { display: none; }
  .view-head { flex-direction: column; align-items: stretch; gap: 16px; margin-bottom: 22px; }
  .view-head-actions { width: 100%; }
  .overview-action, #overviewOpenScanner { width: 100%; }
  .dash-head { align-items: flex-start; flex-direction: column; gap: 8px; }
  .dash-head-meta { flex-wrap: wrap; gap: 10px; }
  .metric-band { grid-template-columns: 1fr 1fr; }
  .metric-primary { grid-column: 1 / -1; padding: 22px 0 18px; }
  .metric-cell { padding: 18px 14px; }
  .metric-cell:nth-child(2) { border-left: 0; }
  .metric-cell--accent { grid-column: 1 / -1; padding: 18px 0; }
  .metric-primary h2 { font-size: 64px; }
  .metric-cell h2 { font-size: 36px; }
  .dash-instruments { margin-top: 18px; }
  .chart-section, .mix-section { padding: 18px; }
  .dash-bottom { margin-top: 18px; }
  .dash-foot { align-items: flex-start; flex-direction: column; }
  .dash-feedback { width: 100%; justify-content: space-between; }
  #scannerCamera { grid-template-columns: 1fr; }
  .scanner-copy { order: 1; border-right: 0; border-bottom: 1px solid var(--border); padding: 22px; }
  .viewfinder-wrap { order: 2; padding: 14px; }
  .viewfinder { min-height: 260px; }
  #scannerCamera .tool-note { order: 3; }
  .login-identity { min-height: 168px; }
  .login-statement { font-size: 34px; }
  .login-content { padding: 26px 18px 30px; }
  .login-content h2 { font-size: 26px; }
  .footer { flex-direction: column; align-items: flex-start; gap: 5px; }
}
@media (max-width: 460px) {
  .metric-band { grid-template-columns: 1fr; }
  .metric-primary, .metric-cell { border-left: 0; padding-left: 0; padding-right: 0; }
  .metric-cell { border-top: 1px solid var(--border); }
  .metric-primary { border-top: 0; }
  .metric-cell--accent { grid-column: auto; }
  .login-identity { display: flex; min-height: 150px; padding: 18px; background-position: center 42%; }
  .login-content { padding-top: 28px; }
  .login-signal { display: none; }
  .dash-head-meta { font-size: 8.5px; }
  .toast-host { right: 10px; bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .app-shell, .sidebar, .login-shell { transition: none; animation: none; }
  .viewfinder.is-scanning .scan-beam { animation: none; opacity: 0; }
}
[data-motion="reduce"] .nav-item[aria-current="page"]::before { animation: none; }


/* Scrim participates only when the drawer layout is active. */
.sidebar-scrim { display: none; }
@media (max-width: 900px) {
  .sidebar-scrim { display: block; }
}


#cmdkInput {
  flex: 1;
  min-height: 22px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 13px;
}
#cmdkInput:focus { border: 0; background: transparent; box-shadow: none; }


/* ==========================================================================
   OBSIDIAN EMBER — shell warmth and motion
   ========================================================================== */

.sidebar {
  background:
    linear-gradient(180deg, rgba(233, 161, 90, .035), transparent 34%),
    var(--sidebar);
}
.app-topbar {
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border);
}
#topbarScanBtn .btn-arrow { display: none; }

/* Brand mark and navigation get a small physical personality */
.brand-mark {
  transition: transform 320ms var(--ease-spring), background-color 180ms linear;
}
.brand:hover .brand-mark { transform: rotate(12deg) scale(1.16); }
.nav-item[aria-current="page"]::before {
  animation: bl-nav-in 260ms var(--ease-spring) both;
}
.nav-icon svg {
  transition: transform 240ms var(--ease-spring), color 140ms linear;
}
.nav-item:hover .nav-icon svg { transform: translateY(-1px) rotate(-5deg) scale(1.07); }
.nav-item[aria-current="page"] .nav-icon svg { animation: bl-nav-icon 380ms var(--ease-spring); }
@keyframes bl-nav-icon {
  0% { transform: scale(.8) rotate(-8deg); }
  60% { transform: scale(1.12) rotate(2deg); }
  100% { transform: scale(1) rotate(0); }
}
.nav-item .nav-label { transition: color 140ms linear, transform 220ms var(--ease-spring); }
.nav-item:hover .nav-label { transform: translateX(1px); }
.workspace-links a { transition: color 140ms linear, transform 200ms var(--ease-spring); }
.workspace-links a:hover { transform: translateX(2px); }

/* A warmer, more red key metric */
.metric-cell--accent h2 { color: var(--primary); }
.metric-primary::before {
  animation: bl-rule-grow 560ms 120ms var(--ease-spring) both;
}
@keyframes bl-rule-grow { from { width: 0; opacity: 0; } to { width: 26px; opacity: 1; } }
.metric-value.is-counting .metric-count {
  animation: bl-count-pop 300ms var(--ease-spring) both;
}
@keyframes bl-count-pop {
  from { opacity: .45; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

/* The instrument panel is one warm material, not a card */
.dash-instruments {
  background:
    linear-gradient(180deg, rgba(233, 161, 90, .035), transparent 26%),
    var(--surface-inset);
  transition: border-color 220ms var(--ease-out);
}
.dash-instruments:hover { border-color: var(--border-strong); }
.dash-instruments .section-head h3 { transition: color 160ms linear; }
.dash-instruments:hover .section-head h3 { color: var(--text); }
.qa-row > svg { transition: transform 200ms var(--ease-spring), color 120ms linear; }
.qa-row:hover > svg { transform: translateX(4px); color: var(--primary); }

/* Scanner: an object with a physical state */
.viewfinder::before, .viewfinder::after { transition: opacity 260ms ease, transform 320ms var(--ease-spring); }
.viewfinder.is-scanning::before, .viewfinder.is-scanning::after { opacity: 1; transform: scale(1.015); }
.camera-placeholder .scan-plus { animation: bl-idle-pulse 3.2s var(--ease-in-out) infinite; }
@keyframes bl-idle-pulse {
  0%, 100% { transform: scale(1); opacity: .8; }
  50% { transform: scale(1.12); opacity: 1; }
}
#scannerCamera .actions button { transition: transform 180ms var(--ease-spring), background-color 120ms linear, border-color 120ms linear; }
#scannerCamera .actions button:hover:not(:disabled) { transform: translateY(-1px); }

/* Access result — celebrate granted, keep denied heavy */
.access-result:not(.hidden) { animation: bl-access-in 300ms var(--ease-spring) both; }
.access-result:not(.hidden) .access-result-icon {
  box-shadow: 0 0 0 1px currentColor inset, 0 0 0 10px var(--success-soft);
}
.access-result.denied:not(.hidden) .access-result-icon { box-shadow: 0 0 0 1px currentColor inset, 0 0 0 10px var(--danger-soft); }
.access-result.error:not(.hidden) .access-result-icon { box-shadow: 0 0 0 1px currentColor inset, 0 0 0 10px var(--warning-soft); }

/* Login gets one warm editorial detail */
.login-statement { position: relative; }
.login-statement::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 6px;
  width: 2px;
  height: 44%;
  background: var(--primary);
}
.login-content { background: var(--surface); }
.login-topline { transition: opacity 200ms ease; }

/* Small warm accent for the page footer */
.footer a { transition: color 120ms linear, transform 200ms var(--ease-spring); }
.footer a:hover { transform: translateX(2px); }

@media (max-width: 460px) {
  .login-statement::before { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .brand-mark, .nav-icon svg, .nav-label, .workspace-links a, .qa-row > svg,
  .viewfinder::before, .viewfinder::after, .camera-placeholder .scan-plus,
  .access-result:not(.hidden), .login-topline { transform: none !important; animation: none !important; transition: none !important; }
}
[data-motion="reduce"] .brand-mark,
[data-motion="reduce"] .nav-icon svg,
[data-motion="reduce"] .nav-label,
[data-motion="reduce"] .workspace-links a,
[data-motion="reduce"] .qa-row > svg,
[data-motion="reduce"] .viewfinder::before,
[data-motion="reduce"] .viewfinder::after,
[data-motion="reduce"] .camera-placeholder .scan-plus,
[data-motion="reduce"] .access-result:not(.hidden) { transform: none !important; animation: none !important; transition: none !important; }


/* Granted access is the one rare celebration */
.access-result-icon { position: relative; }
.access-result:not(.denied):not(.error):not(.hidden) {
  background:
    radial-gradient(circle at 50% 42%, var(--success-soft), transparent 34%),
    var(--bg-deep);
}
.access-result:not(.denied):not(.error):not(.hidden) .access-result-icon::before,
.access-result:not(.denied):not(.error):not(.hidden) .access-result-icon::after {
  content: "";
  position: absolute;
  inset: -12px;
  border: 1px solid var(--success);
  border-radius: 50%;
  pointer-events: none;
  animation: bl-access-ring 1.5s var(--ease-out) both;
}
.access-result:not(.denied):not(.error):not(.hidden) .access-result-icon::after {
  animation-delay: 180ms;
}
@keyframes bl-access-ring {
  0% { transform: scale(.72); opacity: .55; }
  100% { transform: scale(2.5); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .access-result-icon::before, .access-result-icon::after { animation: none !important; opacity: 0 !important; }
}
[data-motion="reduce"] .access-result-icon::before,
[data-motion="reduce"] .access-result-icon::after { animation: none !important; opacity: 0 !important; }


/* The camera is black in both themes, so its controls must invert with it */
#scannerCamera .actions button {
  background: rgba(255, 248, 242, .045);
  border-color: rgba(255, 248, 242, .24);
  color: #e7ddd2;
}
#scannerCamera .actions button:hover:not(:disabled) {
  background: rgba(255, 248, 242, .1);
  border-color: rgba(255, 248, 242, .38);
  color: #fff8f2;
}
#scannerCamera .actions button:disabled {
  background: rgba(255, 248, 242, .02);
  border-color: rgba(255, 248, 242, .18);
  color: #b7aa9c;
  opacity: 1;
}
