/* PassCell — Advanced dashboard: battery profiles, compliance meters, lifecycle */

.battery-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}
.battery-drawer.hidden {
  visibility: hidden;
  pointer-events: none;
}
.battery-drawer.hidden .battery-drawer-panel {
  transform: translateX(100%);
}
.battery-drawer:not(.hidden) {
  visibility: visible;
}
.battery-drawer.open {
  pointer-events: auto;
}
.battery-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 18, 32, 0.45);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.battery-drawer.open .battery-drawer-backdrop {
  opacity: 1;
}
.battery-drawer-panel {
  position: relative;
  width: min(100%, 32rem);
  max-width: 100%;
  height: 100%;
  background: var(--pc-surface);
  border-left: 1px solid var(--pc-line);
  box-shadow: var(--pc-shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s ease;
  overflow: hidden;
}
@media (min-width: 768px) {
  .battery-drawer-panel { width: min(44rem, 92vw); }
}
.battery-drawer.open .battery-drawer-panel {
  transform: translateX(0);
}
.battery-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--pc-line);
  background: var(--pc-surface-muted);
  flex-shrink: 0;
}
@media (max-width: 479px) {
  .battery-drawer-header { padding: 1rem; }
}
.battery-drawer-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--pc-ink);
  margin: 0 0 0.25rem;
}
.battery-drawer-sub {
  font-size: 0.75rem;
  color: var(--pc-muted);
  margin: 0;
}
.battery-drawer-close {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 1px solid var(--pc-line);
  border-radius: 10px;
  background: var(--pc-surface);
  color: var(--pc-muted);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}
.battery-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem 2rem;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 479px) {
  .battery-drawer-body { padding: 1rem 1rem 1.75rem; }
}

.profile-hero {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
@media (min-width: 480px) {
  .profile-hero {
    grid-template-columns: auto 1fr;
    align-items: start;
  }
}
.profile-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  border-radius: var(--pc-radius);
  border: 1px solid var(--pc-line);
  background: #fff;
  box-shadow: var(--pc-shadow-sm);
}
.profile-qr-wrap #profile-qrcode {
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-qr-wrap #profile-qrcode img,
.profile-qr-wrap #profile-qrcode canvas {
  display: block;
  margin: 0 auto;
}
.profile-qr-caption {
  margin-top: 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pc-muted);
  text-align: center;
}
.stakeholder-qr-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.875rem;
  margin-bottom: 1.5rem;
}
@media (min-width: 400px) {
  .stakeholder-qr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 640px) {
  .stakeholder-qr-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.stakeholder-qr-card {
  border: 1px solid var(--pc-line);
  border-radius: var(--pc-radius);
  background: var(--pc-surface-muted);
  padding: 0.75rem;
  text-align: center;
}
.stakeholder-qr-host {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 104px;
  margin-bottom: 0.5rem;
}
.stakeholder-qr-host img,
.stakeholder-qr-host canvas {
  display: block;
  margin: 0 auto;
}
.stakeholder-qr-title {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--pc-ink);
}
.stakeholder-qr-audience {
  margin: 0.25rem 0 0;
  font-size: 0.625rem;
  line-height: 1.4;
  color: var(--pc-muted);
}
.stakeholder-qr-fields {
  margin: 0.375rem 0 0;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--pc-accent);
}
.stakeholder-qr-download {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--pc-accent);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 0.5rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.stakeholder-access-panel {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--pc-line);
  border-radius: var(--pc-radius-lg);
  background: var(--pc-surface-muted);
}
.stakeholder-access-panel h3 {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--pc-ink);
}
.stakeholder-tier-list {
  display: grid;
  gap: 0.625rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.stakeholder-tier-list li {
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--pc-ink-secondary);
}
.stakeholder-tier-list strong {
  color: var(--pc-ink);
}
.profile-hero-meta { min-width: 0; }
.profile-serial {
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--pc-accent);
  word-break: break-all;
  margin: 0 0 0.5rem;
}
.profile-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.profile-badge {
  display: inline-flex;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.profile-manufacturer {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--pc-ink);
  margin: 0 0 0.25rem;
}
.profile-meta-line {
  font-size: 0.8125rem;
  color: var(--pc-muted);
  margin: 0;
  line-height: 1.5;
}

.compliance-grid {
  display: grid;
  gap: 0.875rem;
  margin-bottom: 1.5rem;
}
@media (min-width: 480px) {
  .compliance-grid { grid-template-columns: repeat(2, 1fr); }
}
.compliance-meter {
  padding: 1rem;
  border-radius: var(--pc-radius);
  border: 1px solid var(--pc-line);
  background: var(--pc-surface-muted);
}
.compliance-meter-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.compliance-meter-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pc-muted);
  margin: 0;
}
.compliance-meter-value {
  font-size: 0.875rem;
  font-weight: 800;
  color: var(--pc-ink);
}
.compliance-meter-bar {
  height: 0.5rem;
  border-radius: 999px;
  background: var(--pc-line);
  overflow: hidden;
}
.compliance-meter-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}
.compliance-meter-fill.excellent { background: linear-gradient(90deg, #059669, #10b981); }
.compliance-meter-fill.good { background: linear-gradient(90deg, #1d4ed8, #3b82f6); }
.compliance-meter-fill.warn { background: linear-gradient(90deg, #d97706, #f59e0b); }
.compliance-meter-fill.danger { background: linear-gradient(90deg, #dc2626, #ef4444); }
.compliance-meter-hint {
  font-size: 0.6875rem;
  color: var(--pc-muted);
  margin: 0.375rem 0 0;
  line-height: 1.4;
}

.lifecycle-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pc-accent);
  margin: 0 0 1rem;
}
.lifecycle-track {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 1.5rem;
  padding-left: 0.25rem;
}
.lifecycle-step {
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  gap: 0.75rem;
  position: relative;
  padding-bottom: 1.25rem;
}
.lifecycle-step:last-child { padding-bottom: 0; }
.lifecycle-step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 0.6875rem;
  top: 1.5rem;
  bottom: 0;
  width: 2px;
  background: var(--pc-line);
}
.lifecycle-step.is-complete:not(:last-child)::before {
  background: linear-gradient(180deg, var(--pc-teal), var(--pc-line));
}
.lifecycle-dot {
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  border: 2px solid var(--pc-line);
  background: var(--pc-surface);
  margin-top: 0.125rem;
  z-index: 1;
}
.lifecycle-step.is-complete .lifecycle-dot {
  border-color: var(--pc-teal);
  background: var(--pc-teal-soft);
  box-shadow: inset 0 0 0 3px var(--pc-teal);
}
.lifecycle-step.is-current .lifecycle-dot {
  border-color: var(--pc-accent);
  background: var(--pc-accent);
  box-shadow: 0 0 0 4px var(--pc-accent-soft);
}
.lifecycle-step.is-future .lifecycle-dot {
  opacity: 0.45;
}
.lifecycle-step-body { min-width: 0; }
.lifecycle-step-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--pc-ink);
  margin: 0 0 0.125rem;
}
.lifecycle-step.is-future .lifecycle-step-title { color: var(--pc-muted); }
.lifecycle-step-date {
  font-size: 0.6875rem;
  color: var(--pc-muted);
  margin: 0;
}
.lifecycle-step-note {
  font-size: 0.75rem;
  color: var(--pc-ink-secondary);
  margin: 0.25rem 0 0;
  line-height: 1.45;
}

.profile-detail-section {
  margin-bottom: 1.25rem;
}
.profile-detail-section h4 {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pc-accent);
  margin: 0 0 0.75rem;
}
.profile-detail-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}
@media (min-width: 480px) {
  .profile-detail-grid { grid-template-columns: repeat(2, 1fr); }
}
.profile-detail-item {
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--pc-line-soft);
  background: var(--pc-surface);
}
.profile-detail-item dt {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pc-muted);
  margin: 0 0 0.25rem;
}
.profile-detail-item dd {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--pc-ink);
  margin: 0;
  word-break: break-word;
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding-top: 1rem;
  border-top: 1px solid var(--pc-line);
  margin-top: 0.5rem;
}
@media (min-width: 480px) {
  .profile-actions { flex-direction: row; flex-wrap: wrap; }
}

.ledger-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
@media (min-width: 768px) {
  .ledger-toolbar {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }
}
.ledger-search-wrap {
  flex: 1;
  min-width: min(100%, 16rem);
  position: relative;
}
.ledger-search-wrap svg {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--pc-muted);
  pointer-events: none;
}
.ledger-search {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border-radius: 12px;
  border: 1px solid var(--pc-line);
  background: var(--pc-surface);
  font-size: 1rem;
  font-family: inherit;
}
.ledger-search:focus {
  outline: none;
  border-color: var(--pc-accent);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}
.ledger-filter {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--pc-line);
  background: var(--pc-surface);
  font-size: 0.875rem;
  font-family: inherit;
  min-width: 9rem;
}
.ledger-search-meta {
  font-size: 0.75rem;
  color: var(--pc-muted);
  margin: -0.25rem 0 0.75rem;
}
.ledger-row-clickable {
  cursor: pointer;
  transition: background 0.15s ease;
}
.ledger-row-clickable:hover {
  background: var(--pc-accent-soft);
}
.ledger-row-clickable:focus-visible {
  outline: 2px solid var(--pc-accent);
  outline-offset: -2px;
}
.lifecycle-form-grid {
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 640px) {
  .lifecycle-form-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .lifecycle-form-grid { grid-template-columns: repeat(4, 1fr); }
}
.lifecycle-form-preview {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: var(--pc-radius);
  border: 1px dashed var(--pc-line);
  background: var(--pc-surface-muted);
}
.lifecycle-form-preview .lifecycle-track {
  margin-bottom: 0;
}

/* ── Dashboard sidebar layout ── */
.dash-layout {
  display: flex;
  min-height: calc(100vh - 8rem);
  position: relative;
}
.dash-sidebar {
  width: 15.5rem;
  flex-shrink: 0;
  border-right: 1px solid var(--pc-line-soft);
  background: var(--pc-surface);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0;
  position: sticky;
  top: 0;
  align-self: flex-start;
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
}
.dash-sidebar-brand {
  padding: 0 1.25rem 1rem;
  border-bottom: 1px solid var(--pc-line-soft);
  margin-bottom: 0.75rem;
}
.dash-sidebar-brand p {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pc-muted);
}
.dash-sidebar-brand strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--pc-ink);
  margin-top: 0.25rem;
  word-break: break-word;
}
.dash-sidebar-plan {
  font-size: 0.75rem;
  color: var(--pc-accent);
  font-weight: 600;
  margin-top: 0.15rem;
  display: block;
}
.dash-workspace-card {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin-top: 0.7rem;
}
.dash-workspace-avatar {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  border: 1px solid var(--pc-line-soft, #e2e8f0);
  background: #0f172a;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  position: relative;
}
.dash-workspace-avatar.is-preview {
  cursor: default;
}
.dash-workspace-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.dash-workspace-avatar span {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.dash-workspace-copy {
  min-width: 0;
  flex: 1;
}
.dash-workspace-copy strong {
  margin-top: 0;
  font-size: 0.875rem;
  line-height: 1.25;
}
.dash-workspace-email {
  display: block;
  font-size: 0.68rem;
  color: var(--pc-muted);
  word-break: break-word;
  margin-top: 0.12rem;
}
.dash-workspace-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  margin: 0.4rem 0 0;
  font-size: 0.68rem;
  font-weight: 700;
  color: #0f172a;
}
.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.dash-nav {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0 0.75rem;
  flex: 1;
}
.dash-nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--pc-ink-secondary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.dash-nav-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}
.dash-nav-item:hover {
  background: var(--pc-surface-muted);
  color: var(--pc-ink);
}
.dash-nav-item.is-active {
  background: var(--pc-accent-soft);
  color: var(--pc-accent-dark);
}
.dash-nav-item.is-active svg { opacity: 1; }
.dash-nav-group-label {
  margin: 1rem 0 0.375rem;
  padding: 0 0.75rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pc-muted);
}
.stakeholder-rbac-note {
  margin-bottom: 1.25rem;
  padding: 0.875rem 1rem;
  border-radius: var(--pc-radius);
  border: 1px solid var(--pc-line);
  background: var(--pc-surface-muted);
}
.stakeholder-rbac-note .lifecycle-section-title { margin-top: 0; }
.dash-sidebar-foot {
  padding: 1rem 1.25rem 0;
  border-top: 1px solid var(--pc-line-soft);
  margin-top: 0.75rem;
}
.dash-sidebar-usage-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pc-muted);
  margin: 0 0 0.375rem;
}
.dash-sidebar-usage-text {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--pc-ink);
  margin: 0 0 0.5rem;
}
.dash-sidebar-usage-bar {
  height: 4px;
  border-radius: 999px;
  background: var(--pc-line-soft);
  overflow: hidden;
}
.dash-sidebar-usage-fill {
  height: 100%;
  background: var(--pc-accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.dash-main {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 1.5rem 2.5rem;
}
@media (min-width: 1024px) {
  .dash-main { padding: 2rem 2rem 3rem; }
}
.dash-section { display: none; }
.dash-section.is-active { display: block; }
.dash-section-head {
  margin-bottom: 1.5rem;
}
.dash-section-head h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--pc-ink);
  margin: 0 0 0.375rem;
}
.dash-section-head p {
  font-size: 0.8125rem;
  color: var(--pc-muted);
  margin: 0;
  line-height: 1.5;
}
.dash-sidebar-toggle {
  display: none;
  position: fixed;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  right: calc(1.25rem + env(safe-area-inset-right, 0px));
  z-index: 40;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  border: none;
  background: var(--pc-accent);
  color: #fff;
  box-shadow: var(--pc-shadow);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.dash-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 38;
  background: rgba(15, 23, 42, 0.4);
}
.profile-form-grid {
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 640px) {
  .profile-form-grid { grid-template-columns: repeat(2, 1fr); }
}
.profile-form-grid .span-2 { grid-column: 1 / -1; }
.profile-save-status {
  font-size: 0.8125rem;
  font-weight: 600;
  margin: 0.75rem 0 0;
}
.profile-save-status.success { color: var(--pc-teal); }
.profile-save-status.error { color: #dc2626; }
.profile-readonly-note {
  font-size: 0.75rem;
  color: var(--pc-muted);
  margin: 0.25rem 0 0;
}
@media (max-width: 1023px) {
  .dash-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 39;
    max-height: none;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--pc-shadow);
  }
  .dash-sidebar.is-open { transform: translateX(0); }
  .dash-sidebar-backdrop.is-open { display: block; }
  .dash-sidebar-toggle { display: flex; }
  .dash-layout { min-height: auto; }
  .dash-main { padding: 1.25rem 1rem 4.5rem; }
}
body:has(.pc-cookie-banner:not(.is-hiding)) .dash-sidebar-toggle {
  bottom: calc(6.5rem + env(safe-area-inset-bottom, 0px));
}
@media (max-width: 1023px) {
  body:has(.pc-cookie-banner:not(.is-hiding)) .bih-toast {
    bottom: calc(7.5rem + env(safe-area-inset-bottom, 0px));
  }
}
body.demo-session .dash-sidebar-brand strong {
  color: var(--pc-accent-dark);
}
body.demo-session .user-plan-picker {
  display: none !important;
}

/* Battery Pass Content Guidance — form & profile clusters */
.passport-guidance-note {
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--pc-muted);
  margin: 0.75rem 0 0;
  padding: 0.75rem 1rem;
  background: var(--pc-accent-soft);
  border: 1px solid rgba(29, 78, 216, 0.15);
  border-radius: 10px;
}
.passport-guidance-note a {
  color: var(--pc-accent-dark);
  font-weight: 600;
}
.passport-cluster-ref {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pc-muted);
  margin-left: 0.5rem;
  vertical-align: middle;
}
.passport-cluster-section h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem;
}
.passport-access-tag {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  background: #fef3c7;
  color: #92400e;
  vertical-align: middle;
  margin-left: 0.25rem;
}
