/**
 * Portal — Branz brand alignment
 * Palette: Branz Navy, Charcoal Slate, Insight Emerald, Clean White
 * Typography: Inter (UI), IBM Plex Serif (optional headings)
 */

:root {
  --branz-navy: #0A2F50;
  --branz-charcoal: #363A42;
  --branz-emerald: #00BFA5;
  --branz-emerald-hover: #009688;
  --branz-white: #FFFFFF;
  /* Generic "surface" background used for cards/menus/modals in both themes */
  --branz-surface: #FFFFFF;
  --branz-bg: #f5f7fa;
  --branz-border: #e2e6eb;
  --branz-muted: #6b7280;
}

html[data-theme="dark"] {
  --branz-bg: #0b1220;
  --branz-white: #FFFFFF;
  --branz-surface: #0f1a2b;
  --branz-border: #24324a;
  --branz-charcoal: #e5e7eb;
  --branz-muted: #9ca3af;
  --branz-navy: #0b3a62;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  margin: 0;
  background: var(--branz-bg);
  color: var(--branz-charcoal);
  line-height: 1.5;
  font-size: 1rem;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.modal-open {
  overflow: hidden;
}

/* Header — Branz Navy bar, white text */
.header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--branz-navy);
  border-bottom: none;
}

.logo {
  display: block;
  text-decoration: none;
  line-height: 0;
}

.logo-img {
  display: block;
  height: 28px;
  width: auto;
  object-fit: contain;
}

.logo:hover .logo-img {
  opacity: 0.9;
}

.header-actions {
  margin-left: auto;
  position: relative;
  display: flex;
  align-items: center;
}

.btn-menu {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-menu::after {
  display: none;
}

.hamburger {
  width: 18px;
  height: 12px;
  position: relative;
  display: inline-block;
  background: transparent;
}

.hamburger::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  /* Draw 3 lines (top, middle, bottom) */
  box-shadow: 0 5px 0 currentColor, 0 10px 0 currentColor;
}

.menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 180px;
  background: var(--branz-surface);
  border: 1px solid var(--branz-border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(10, 47, 80, 0.18);
  padding: 0.35rem;
  z-index: 50;
}

html[data-theme="dark"] .menu {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.menu-item {
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.7rem;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--branz-charcoal);
}

.menu-item:hover,
.menu-item:focus {
  outline: none;
  background: rgba(0, 191, 165, 0.12);
  color: var(--branz-navy);
}

.menu-sep {
  height: 1px;
  background: var(--branz-border);
  margin: 0.35rem 0.35rem;
}

.user-email {
  flex: 1;
  font-size: 0.875rem;
}

/* Buttons */
.btn {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: background 0.2s, color 0.2s;
}

.btn-primary {
  background: var(--branz-emerald);
  color: var(--branz-white);
}

.btn-primary:hover {
  background: var(--branz-emerald-hover);
  color: var(--branz-white);
}

.btn-ghost {
  color: rgba(255, 255, 255, 0.9);
  background: transparent;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--branz-white);
}

/* Destructive actions (delete org/user) */
.btn-danger {
  background: #b91c1c;
  color: var(--branz-white);
}

.btn-danger:hover {
  background: #991b1b;
  color: var(--branz-white);
}

.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* In cards, ghost is dark */
.card .btn-ghost {
  color: var(--branz-charcoal);
}

.card .btn-ghost:hover {
  background: var(--branz-border);
  color: var(--branz-navy);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
}

#main {
  margin: 0 5%;
  padding: 1.5rem;
  padding-bottom: 2rem;
  flex: 1;
}

body.admin-mode #main {
  max-width: none;
  padding: 0;
}

body.admin-mode .footer-inner {
  max-width: none;
}

.portal-headline {
  margin: 0 0 1.5rem;
  font-size: 1.75rem;
  font-family: 'IBM Plex Serif', Georgia, serif;
  font-weight: 600;
  color: var(--branz-navy);
}

html[data-theme="dark"] .portal-headline {
  color: var(--branz-white);
}

.hidden {
  display: none !important;
}

#loading {
  padding: 2rem;
  text-align: center;
  color: var(--branz-muted);
  font-weight: 500;
}

.view {
  display: block;
}

/* Layout: left rail + main content (1:2 — sidebar one-third, workspace two-thirds) */
.portal-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 1.5rem;
  align-items: start;
}

/* Customer workspace: cap task rail width; main column fills remaining space */
@media (min-width: 901px) {
  #view-customer .portal-content {
    grid-template-columns: minmax(0, 450px) minmax(0, 1fr);
  }
}

/* Full-width org + progress strip above tasks and workspace */
#view-customer .portal-content.portal-content--customer #customer-org-progress {
  grid-column: 1 / -1;
}

.customer-org-progress-card .message:empty {
  display: none;
}

.customer-org-progress-card .status-stage {
  margin: 0.75rem 0 0;
}

.customer-launch-pad {
  margin-bottom: 1.5rem;
}

.customer-launch-pad-title {
  font-family: 'IBM Plex Serif', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--branz-navy);
  margin: 0 0 0.75rem;
}

.customer-launch-pad-lead {
  margin-bottom: 1rem;
  line-height: 1.55;
}

.customer-launch-pad-stage {
  font-weight: 500;
  color: var(--branz-charcoal);
  margin: 0 0 1.25rem;
}

.customer-launch-pad-stage:empty {
  display: none;
}

.customer-launch-pad-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

html[data-theme="dark"] .customer-launch-pad-title {
  color: var(--branz-white);
}

html[data-theme="dark"] .customer-launch-pad-stage {
  color: var(--branz-muted);
}

#view-customer-left,
#view-admin-left,
#view-customer-main,
#view-admin-main {
  min-width: 0;
}

/*
 * Customer left rail (two-column layout only): stretch to the main column row
 * height so position:sticky on the Tasks card is not clipped. In a single-column
 * grid the aside is its own short row, so sticky cannot span the workspace.
 */
@media (min-width: 901px) {
  #view-customer-left {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  /*
   * Sticky must not share overflow:auto with this element — that makes this box
   * the scroll container and breaks sticking to the viewport. Scroll the list only.
   */
  #view-customer-left>.card.customer-tasks-sidebar {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    z-index: 2;
    align-self: stretch;
    overflow: visible;
  }

  #view-customer-left>.card.customer-tasks-sidebar .tasks-header {
    flex-shrink: 0;
  }

  #view-customer-left>.card.customer-tasks-sidebar .customer-tasks-sidebar-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Task actions below the main customer cards (Mark as complete, etc.) */
.customer-main-task-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  margin-top: -0.25rem;
  margin-bottom: 0;
  padding: 0 0.15rem 0.25rem;
}

@media (max-width: 900px) {
  .portal-content {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* Cards — white, subtle shadow, Branz headings */
.card {
  background: var(--branz-surface);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(10, 47, 80, 0.08);
  border: 1px solid var(--branz-border);
}

/* Stacked task cards (customer workspace) */
.task-stack {
  display: flex;
  flex-direction: column;
}

.task-stack .card {
  margin-bottom: 1.5rem;
}

.task-stack-item {
  display: flex;
  flex-direction: column;
}

.task-stack-item-top {
  flex-shrink: 0;
}

.task-stack-item-body {
  flex: 1 1 auto;
  margin-top: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--branz-border);
}

/* Mark complete / undo sits at bottom-right of the whole task card, below subtask content */
.task-stack-item > .task-actions {
  flex-shrink: 0;
  margin-top: 1.25rem;
  margin-bottom: 0;
}

html[data-theme="dark"] .card {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.card h1 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-family: 'IBM Plex Serif', Georgia, serif;
  font-weight: 600;
  color: var(--branz-navy);
}

html[data-theme="dark"] .card h1 {
  color: var(--branz-white);
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-family: 'IBM Plex Serif', Georgia, serif;
  font-weight: 600;
  color: var(--branz-navy);
}

html[data-theme="dark"] .card h2 {
  color: var(--branz-white);
}

.org-name {
  font-weight: 600;
  color: var(--branz-navy);
  margin-bottom: 0.25rem;
}

html[data-theme="dark"] .org-name {
  color: var(--branz-white);
}

.org-status {
  font-size: 0.875rem;
  color: var(--branz-muted);
  margin-bottom: 0.75rem;
}

.message {
  font-size: 0.875rem;
  color: var(--branz-muted);
  margin: 0.5rem 0;
}

.message.error {
  color: #b91c1c;
}

.form-link {
  margin: 1rem 0;
}

.task-detail-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.35rem;
}

.task-detail-header .task-detail-title-heading {
  margin: 0;
  flex: 1 1 12rem;
  font-size: 1.15rem;
}

.task-detail-completion {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  font-size: 0.875rem;
  color: var(--branz-muted);
}

.task-detail-completion--done {
  color: var(--branz-navy);
}

html[data-theme="dark"] .task-detail-completion--done {
  color: var(--branz-white);
}

.task-completion-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 2px solid var(--branz-border);
  flex-shrink: 0;
}

.task-completion-icon--pending {
  border-style: dashed;
  opacity: 0.85;
}

.task-completion-icon--done {
  border-color: #15803d;
  background: #15803d;
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
  font-weight: 700;
}

html[data-theme="dark"] .task-completion-icon--done {
  border-color: #22c55e;
  background: #22c55e;
  color: #0f1419;
}

.task-completion-text {
  max-width: 14rem;
  line-height: 1.35;
}

@media (min-width: 640px) {
  .task-completion-text {
    max-width: none;
  }
}

/* Embedded questionnaire — visually part of the portal card */
.typeform-embed-wrap {
  width: 100%;
  margin: 0 -0.25rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--branz-border);
  background: var(--branz-white);
  min-height: min(72vh, 820px);
}

html[data-theme="dark"] .typeform-embed-wrap {
  background: #0f1419;
  border-color: var(--branz-border);
}

.typeform-embed-wrap iframe {
  display: block;
  width: 100%;
  min-height: min(72vh, 820px);
  border: 0;
}

.form-link .form-error {
  margin-top: 0.75rem;
  margin-bottom: 0;
}

/* Due diligence questionnaire — section assignments (parallel to Typeform) */
.ddq-blocking-banner {
  margin-top: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.1);
  font-size: 0.9rem;
}

html[data-theme="dark"] .ddq-blocking-banner {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(245, 158, 11, 0.12);
}

.task-ddq-panel {
  margin: 0 0 1rem;
  padding: 0;
}

.ddq-stack-ddq-host {
  margin-bottom: 1rem;
}

.ddq-alloc-panel {
  margin-bottom: 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--branz-border);
  background: var(--branz-white);
}

html[data-theme="dark"] .ddq-alloc-panel {
  background: #0f1419;
}

.ddq-alloc-heading {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.ddq-alloc-lead {
  margin: 0 0 0.75rem !important;
  font-size: 0.875rem;
}

.ddq-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.65rem;
}

.ddq-filter-label {
  font-size: 0.8rem;
  color: var(--branz-muted);
  margin-right: 0.15rem;
}

.ddq-filter-btn--active {
  border-color: var(--branz-navy);
  color: var(--branz-navy);
}

html[data-theme="dark"] .ddq-filter-btn--active {
  border-color: var(--branz-white);
  color: var(--branz-white);
}

.ddq-alloc-stats {
  font-size: 0.8rem;
  color: var(--branz-muted);
  margin-left: auto;
}

.ddq-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ddq-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.ddq-table th,
.ddq-table td {
  text-align: left;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--branz-border);
  vertical-align: middle;
}

.ddq-th-actions,
.ddq-actions {
  white-space: nowrap;
}

.ddq-actions .btn {
  margin-right: 0.25rem;
}

.ddq-assign-select {
  max-width: 12rem;
  font-size: 0.8125rem;
}

/* Organisation status: due diligence stages */
.status-stage {
  margin: 1rem 0;
}

.status-stage-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.status-stage-item {
  font-size: 0.875rem;
  color: var(--branz-muted);
  position: relative;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--branz-border);
  white-space: nowrap;
  flex: 0 0 auto;
}

.status-stage-item--completed {
  font-weight: 600;
  color: var(--branz-white);
  background: #16a34a;
  border-color: #16a34a;
}

.status-stage-item--active {
  font-weight: 600;
  color: var(--branz-white);
  background: #d97706;
  border-color: #d97706;
}

/* Tasks card */
.tasks-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tasks-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.tasks-filter-label {
  font-size: 0.875rem;
  color: var(--branz-charcoal);
  margin: 0;
}

.input--inline {
  display: inline-block;
  width: auto;
  min-width: 140px;
  max-width: 240px;
  margin-bottom: 0;
}

.tasks-list {
  margin: 0;
}

.tasks-list-ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tasks-list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--branz-border);
  font-size: 0.875rem;
}

.tasks-list-item[role="button"] {
  cursor: pointer;
  border-radius: 6px;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.tasks-list-item[role="button"]:focus {
  outline: 2px solid rgba(0, 191, 165, 0.6);
  outline-offset: 2px;
}

.tasks-list-item--selected {
  background: rgba(0, 191, 165, 0.08);
  box-shadow: inset 4px 0 0 var(--branz-emerald);
}

.tasks-list-item--checklist {
  gap: 0.75rem;
  align-items: flex-start;
}

.task-state-icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid var(--branz-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin-top: 2px;
  background: #f3f4f6;
}

.task-state-icon--complete {
  border-color: var(--branz-emerald);
  background: rgba(0, 191, 165, 0.18);
}

.task-state-icon--complete::before {
  content: '✓';
  color: #047857;
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  transform: translateY(-0.5px);
}

.task-content {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-weight: 600;
  color: var(--branz-charcoal);
}

.task-subtitle {
  font-size: 0.8125rem;
  color: var(--branz-muted);
  margin-top: 0.15rem;
}

/* Collapsible task groups */
.task-group {
  list-style: none;
}

.task-group-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--branz-navy);
  border-bottom: 1px solid var(--branz-border);
  cursor: pointer;
  user-select: none;
}

html[data-theme="dark"] .task-group-header {
  color: var(--branz-white);
}

.task-group-header:hover {
  background: rgba(0, 191, 165, 0.04);
}

.task-group-header:focus {
  outline: 2px solid rgba(0, 191, 165, 0.6);
  outline-offset: -2px;
  border-radius: 6px;
}

.task-group-chevron {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  margin-left: auto;
}

.task-group-chevron::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  opacity: 0.5;
}

.task-group--expanded>.task-group-header .task-group-chevron {
  transform: rotate(90deg);
}

.task-group-children {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.task-group--expanded>.task-group-children {
  max-height: 500px;
}

.task-group--complete .task-group-title {
  opacity: 0.7;
}

.task-group:last-child .task-group-header {
  border-bottom: none;
}

.task-group:last-child.task-group--expanded .task-group-header {
  border-bottom: 1px solid var(--branz-border);
}

/* Parent task badge — hidden by default, shown when required subtasks are incomplete */
.task-group-badge {
  margin-left: 0.4rem;
  transition: opacity 0.3s ease;
}

/* Subtask indentation — offset to sit visually inside the parent group */
.tasks-list-item--subtask[role="button"] {
  padding-left: 3.25rem;
}

/* Required / Optional badges */
.task-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  vertical-align: middle;
  line-height: 1.4;
}

.task-badge--required {
  color: #991b1b;
  background: rgba(185, 28, 28, 0.1);
  border: 1px solid rgba(185, 28, 28, 0.2);
}

html[data-theme="dark"] .task-badge--required {
  color: #fca5a5;
  background: rgba(185, 28, 28, 0.2);
  border-color: rgba(185, 28, 28, 0.35);
}

.task-badge--optional {
  color: var(--branz-muted);
  background: rgba(107, 114, 128, 0.08);
  border: 1px solid var(--branz-border);
}

/* Task action buttons (main workspace: align to bottom-right of the action row) */
.task-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin: 1rem 0 0.5rem;
}

.task-actions--split {
  justify-content: space-between;
}

.task-actions .btn {
  min-width: 140px;
}

.tasks-list-item:last-child {
  border-bottom: none;
}

.tasks-list-item-title {
  flex: 1;
  min-width: 0;
}

.tasks-list-item-assignee {
  color: var(--branz-muted);
}

.tasks-list-item-status {
  font-size: 0.8125rem;
  color: var(--branz-muted);
}

/* Reports card */
.reports-list {
  margin: 0;
}

.reports-list-ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.reports-list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--branz-border);
  font-size: 0.875rem;
}

.reports-list-item:last-child {
  border-bottom: none;
}

.reports-list-item-name {
  font-weight: 500;
}

.reports-list-item-date {
  color: var(--branz-muted);
  font-size: 0.8125rem;
}

.reports-list-item-actions {
  margin-left: auto;
}

.reports-placeholder {
  color: var(--branz-muted);
  font-size: 0.875rem;
  margin: 0.5rem 0;
}

.org-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.org-toolbar .org-search-input {
  flex: 1;
  max-width: 280px;
  margin-bottom: 0;
}

#btn-create-org {
  margin-left: auto;
}

.org-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.org-card .org-row {
  border-bottom: none;
  padding-top: 0;
}

.org-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--branz-border);
}

.org-row:last-child {
  border-bottom: none;
}

.org-row .org-row-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.15rem;
}

.org-row .org-name {
  flex: 1;
  margin: 0;
}

.org-status-row {
  font-size: 0.8125rem;
  color: var(--branz-muted);
}

.org-status-label {
  font-weight: 600;
}

.org-row .btn-org-action {
  background: transparent;
  color: var(--branz-charcoal);
  border: 1px solid transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.org-row .btn-org-action:hover {
  background: var(--branz-border);
  border-color: var(--branz-muted);
}

.org-row .btn-org-action.btn-delete-org:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  color: var(--branz-white);
}

.empty {
  color: var(--branz-muted);
  font-size: 0.875rem;
  margin: 0.5rem 0;
}

/* Org users list: no bullets, Name | Email | Verification */
.org-users {
  margin: 0.5rem 0 1rem;
  padding-left: 0;
  list-style: none;
}

.user-list-heading {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 0.75rem 1rem;
  align-items: center;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--branz-charcoal);
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--branz-border);
}

.user-list-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 0.75rem 1rem;
  align-items: center;
  padding: 0.35rem 0;
  font-size: 0.875rem;
  border-bottom: none;
}

.user-list-row .user-name,
.user-list-row .user-email,
.user-list-row .user-verification {
  margin: 0;
}

.user-list-row .user-verification {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-delete-user,
.btn-delete-org {
  white-space: nowrap;
}

/* Status dot: verified (green), invited / pending password (amber), unknown (muted) */
.user-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
  flex-shrink: 0;
}

.user-status-dot--verified {
  background: var(--branz-emerald);
}

.user-status-dot--pending {
  background: #d97706;
}

.user-status-dot--unknown {
  background: var(--branz-muted);
}

/* Inputs — Branz border and focus */
.input {
  display: block;
  width: 100%;
  max-width: 320px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  border: 1px solid var(--branz-border);
  border-radius: 6px;
  color: var(--branz-charcoal);
  background: var(--branz-surface);
}

.input::placeholder {
  color: var(--branz-muted);
}

.input:focus {
  outline: none;
  border-color: var(--branz-emerald);
  box-shadow: 0 0 0 2px rgba(0, 191, 165, 0.2);
}

#create-org-panel .btn,
#invite-panel .btn {
  margin-right: 0.5rem;
  margin-top: 0.25rem;
}

a {
  color: var(--branz-navy);
}

a:hover {
  color: var(--branz-emerald);
  text-decoration: underline;
}

/* Modal (Appearance) */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: var(--branz-surface);
  border: 1px solid var(--branz-border);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.modal-panel--recovery-codes {
  max-width: 560px;
}

.recovery-codes-modal-warning {
  color: #92400e;
  font-weight: 500;
}

html[data-theme="dark"] .recovery-codes-modal-warning {
  color: #fcd34d;
}

.mfa-recovery-code-list--modal {
  max-height: 220px;
  overflow: auto;
  margin: 0.75rem 0;
}

.recovery-codes-modal-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.recovery-codes-icon-btn .recovery-codes-icon {
  margin-right: 0.35rem;
  opacity: 0.85;
}

.recovery-codes-modal-footer {
  margin-top: 0.25rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--branz-border);
}

.modal-title {
  margin: 0;
  font-size: 1.1rem;
  font-family: 'IBM Plex Serif', Georgia, serif;
  font-weight: 600;
  color: var(--branz-navy);
}

.modal-close {
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
}

.modal-body {
  padding: 1rem 1.25rem 1.25rem;
}

.modal-subtitle {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: var(--branz-muted);
}

.radio-group {
  border: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}

.radio-option {
  display: grid;
  grid-template-columns: 18px 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.75rem;
  row-gap: 0.1rem;
  align-items: start;
  padding: 0.75rem;
  border: 1px solid var(--branz-border);
  border-radius: 10px;
  cursor: pointer;
  background: rgba(0, 191, 165, 0.04);
}

.radio-option input {
  margin-top: 2px;
}

.radio-option-title {
  font-weight: 600;
  color: var(--branz-charcoal);
}

.radio-option-hint {
  grid-column: 2;
  font-size: 0.8125rem;
  color: var(--branz-muted);
}

.radio-option:hover,
.radio-option:focus-within {
  border-color: rgba(0, 191, 165, 0.55);
  background: rgba(0, 191, 165, 0.08);
}

/* Footer */
#portal-footer {
  border-top: 1px solid var(--branz-border);
  margin-top: auto;
  padding: 1.5rem 1rem;
}

.footer-inner {
  margin: 0 5%;
  display: flex;
  gap: 1.25rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.footer-title {
  font-weight: 600;
  color: var(--branz-navy);
  margin-bottom: 0.15rem;
}

html[data-theme="dark"] .footer-title {
  color: var(--branz-white);
}

.footer-subtitle {
  color: var(--branz-muted);
  font-size: 0.875rem;
}

.footer-links {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.footer-links a {
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.footer-copyright {
  color: var(--branz-muted);
  font-size: 0.875rem;
}

/* Management portal — primary nav + overview */
.admin-mgmt-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  padding: 0.65rem 1.5rem;
  background: var(--branz-surface);
  border-bottom: 1px solid var(--branz-border);
}

.admin-mgmt-nav__link {
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--branz-charcoal);
  border: 1px solid transparent;
}

.admin-mgmt-nav__link:hover {
  background: rgba(0, 191, 165, 0.1);
  color: var(--branz-navy);
}

.admin-mgmt-nav__link--active {
  background: rgba(0, 191, 165, 0.16);
  border-color: var(--branz-border);
  color: var(--branz-navy);
}

html[data-theme="dark"] .admin-mgmt-nav__link--active {
  color: var(--branz-white);
}

.portal-content--admin-overview {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 2rem 2rem;
}

.portal-headline--admin {
  font-size: 1.35rem;
  margin-bottom: 0.35rem;
}

.admin-overview-lead {
  margin-bottom: 1.25rem;
}

.admin-overview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.admin-stat-pill {
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid var(--branz-border);
  background: var(--branz-bg);
}

.admin-stat-pill strong {
  display: block;
  font-size: 1.5rem;
  font-family: 'IBM Plex Serif', Georgia, serif;
  color: var(--branz-navy);
}

html[data-theme="dark"] .admin-stat-pill strong {
  color: var(--branz-emerald);
}

.admin-stat-pill span {
  font-size: 0.8rem;
  color: var(--branz-muted);
}

.admin-org-hero-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--branz-muted);
  margin: 0 0 0.25rem;
}

.admin-publish-hint {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.admin-org-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 1rem 0 1.25rem;
  padding: 0;
  list-style: none;
}

.admin-org-subnav__link {
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--branz-charcoal);
  border: 1px solid var(--branz-border);
  background: var(--branz-surface);
}

.admin-org-subnav__link:hover {
  background: rgba(0, 191, 165, 0.08);
}

.admin-org-subnav__link--active {
  border-color: var(--branz-emerald);
  background: rgba(0, 191, 165, 0.12);
  color: var(--branz-navy);
}

html[data-theme="dark"] .admin-org-subnav__link--active {
  color: var(--branz-white);
}

.admin-panel-title {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.admin-panel-sub {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.admin-delivery-lead {
  margin-bottom: 1rem;
}

.admin-delivery-actions {
  margin-top: 0.75rem;
}

.admin-tech-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--branz-border);
}

.admin-tech-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.admin-tech-section h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.admin-tech-meta {
  font-size: 0.85rem;
  color: var(--branz-muted);
  margin-bottom: 0.5rem;
}

.admin-tech-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.admin-tech-pre {
  font-size: 0.75rem;
  max-height: 220px;
  overflow: auto;
  padding: 0.75rem;
  border-radius: 8px;
  background: var(--branz-bg);
  border: 1px solid var(--branz-border);
  margin: 0;
}

.admin-seeds-fields label {
  display: block;
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.admin-seeds-fields textarea {
  width: 100%;
  min-height: 4rem;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
}

.admin-test-mode-banner {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.45);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

html[data-theme="dark"] .admin-test-mode-banner {
  background: rgba(234, 179, 8, 0.12);
}

.admin-audit-list {
  font-size: 0.85rem;
}

.admin-audit-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--branz-border);
}

.admin-audit-row:last-child {
  border-bottom: none;
}

.admin-audit-detail {
  font-size: 0.75rem;
  color: var(--branz-muted);
  word-break: break-word;
}

/* Admin sidebar + detail layout (same 1:2 as customer) */
.portal-content--admin {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 0;
  align-items: stretch;
  min-height: calc(100vh - 120px);
}

.portal-content--admin #view-admin-left {
  border-right: 1px solid var(--branz-border);
  padding: 1rem;
  overflow-y: auto;
  max-height: calc(100vh - 120px);
  position: sticky;
  top: 0;
}

.portal-content--admin #view-admin-main {
  padding: 1.5rem 2rem;
  min-width: 0;
}

.sidebar-header-card {
  padding: 1rem;
  margin-bottom: 1rem;
}

.sidebar-header-card h2 {
  margin-bottom: 0.75rem;
}

.org-toolbar--sidebar {
  margin-bottom: 0;
  gap: 0.5rem;
}

.org-toolbar--sidebar .org-search-input {
  max-width: none;
  flex: 1;
}

/* Compact org cards in sidebar */
.org-list--sidebar {
  gap: 0;
  margin-top: 0;
}

.org-list--sidebar .org-card {
  border-radius: 0;
  margin-bottom: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  box-shadow: none;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.15s;
}

.org-list--sidebar .org-card:first-child {
  border-top: 1px solid var(--branz-border);
}

.org-list--sidebar .org-card:hover {
  background: rgba(0, 191, 165, 0.06);
}

.org-list--sidebar .org-card.org-card--selected {
  background: rgba(0, 191, 165, 0.10);
  box-shadow: inset 4px 0 0 var(--branz-emerald);
}

.org-list--sidebar .org-row {
  padding: 0;
  gap: 0.5rem;
}

.org-list--sidebar .btn-org-action {
  display: none;
}

/* Admin detail panel */
.admin-detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 300px;
  color: var(--branz-muted);
}

.admin-detail-empty h2 {
  color: var(--branz-muted);
}

.admin-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.admin-detail-header h1 {
  margin-bottom: 0.25rem;
}

.admin-detail-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

#admin-detail-users .user-list-heading,
#admin-detail-users .user-list-row {
  grid-template-columns: 1fr 1.5fr auto auto auto;
}

@media (max-width: 900px) {
  .portal-content--admin {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .portal-content--admin #view-admin-left {
    border-right: none;
    border-bottom: 1px solid var(--branz-border);
    max-height: none;
    position: static;
  }
}

.admin-journey-hint {
  margin-bottom: 1rem;
}

.admin-journey-content .admin-journey-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.admin-journey-content .admin-journey-status-row label {
  font-size: 0.875rem;
  font-weight: 500;
}

.admin-journey-content .admin-journey-group {
  margin-top: 1rem;
  border-top: 1px solid var(--branz-border);
  padding-top: 0.75rem;
}

.admin-journey-content .admin-journey-group-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.admin-journey-content .admin-journey-group-title h3 {
  margin: 0;
  font-size: 1rem;
}

.admin-journey-content .admin-journey-group-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.admin-journey-content .admin-journey-task-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--branz-border-subtle, rgba(0, 0, 0, 0.06));
}

.admin-journey-content .admin-journey-task-row:last-child {
  border-bottom: none;
}

.admin-journey-content .admin-journey-task-label {
  flex: 1 1 12rem;
  min-width: 0;
}

.admin-journey-content .admin-journey-task-meta {
  font-size: 0.8rem;
  color: var(--branz-muted);
}

.admin-journey-content .admin-journey-task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.admin-journey-content .admin-journey-pill {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--branz-surface-2, rgba(0, 0, 0, 0.05));
}

.admin-journey-content .admin-journey-pill--done {
  background: rgba(34, 139, 34, 0.15);
  color: #1b5e20;
}

/* Set-password page (invite acceptance) */
.set-password-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 3rem 1rem;
  min-height: 60vh;
}

.set-password-card {
  max-width: 420px;
  width: 100%;
}

.set-password-card h1 {
  margin-bottom: 0.25rem;
}

.set-password-card .input-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin: 1rem 0 0.35rem;
  color: var(--branz-text);
}

.set-password-card .hint {
  font-size: 0.8rem;
  color: var(--branz-text-muted);
  margin: 0.5rem 0 1.25rem;
}

.set-password-card .error {
  color: #b91c1c;
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

.btn-block {
  display: block;
  width: 100%;
}

/* Account view */
.account-header {
  margin-bottom: 1.5rem;
}

.btn-back {
  display: inline-block;
  font-size: 0.875rem;
  color: var(--branz-muted);
  text-decoration: none;
  margin-bottom: 0.75rem;
  transition: color 0.15s;
}

.btn-back:hover {
  color: var(--branz-emerald);
  text-decoration: none;
}

.account-content {
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.account-card {
  margin-bottom: 0;
}

.account-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.account-card-header h2 {
  margin-bottom: 0;
}

.account-muted {
  font-size: 0.875rem;
  color: var(--branz-muted);
  margin-top: 0;
}

.account-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.account-overview-item {
  background: var(--branz-surface-2, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--branz-border);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
}

.account-overview-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--branz-muted);
  margin-bottom: 0.2rem;
}

.account-overview-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--branz-charcoal);
  word-break: break-word;
}

.account-overview-note {
  display: inline-block;
  margin-top: 0.3rem;
  margin-left: 0.4rem;
  font-size: 0.75rem;
  color: #92400e;
}

.account-inline-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

#account-contact-form,
#account-password-form {
  margin-top: 0.9rem;
}

/* MFA badge (status pill in card header) */
.mfa-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
}

.mfa-badge--on {
  color: #065f46;
  background: rgba(0, 191, 165, 0.14);
  border: 1px solid rgba(0, 191, 165, 0.3);
}

html[data-theme="dark"] .mfa-badge--on {
  color: #6ee7b7;
  background: rgba(0, 191, 165, 0.15);
  border-color: rgba(0, 191, 165, 0.3);
}

.mfa-badge--off {
  color: #991b1b;
  background: rgba(185, 28, 28, 0.08);
  border: 1px solid rgba(185, 28, 28, 0.2);
}

html[data-theme="dark"] .mfa-badge--off {
  color: #fca5a5;
  background: rgba(185, 28, 28, 0.15);
  border-color: rgba(185, 28, 28, 0.3);
}

.mfa-badge--setup {
  color: #92400e;
  background: rgba(217, 119, 6, 0.1);
  border: 1px solid rgba(217, 119, 6, 0.25);
}

html[data-theme="dark"] .mfa-badge--setup {
  color: #fcd34d;
  background: rgba(217, 119, 6, 0.15);
  border-color: rgba(217, 119, 6, 0.3);
}

.mfa-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mfa-dot--on {
  background: var(--branz-emerald);
}

.mfa-dot--off {
  background: #b91c1c;
}

.mfa-description {
  font-size: 0.875rem;
  color: var(--branz-muted);
  margin: 0 0 1rem;
  line-height: 1.6;
}

.mfa-instructions {
  margin-bottom: 1.25rem;
}

.mfa-instructions h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--branz-charcoal);
  margin: 0 0 0.5rem;
}

.mfa-instructions ol {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.875rem;
  color: var(--branz-charcoal);
  line-height: 1.7;
}

.mfa-reauth-notice {
  font-size: 0.875rem;
  color: #92400e;
  background: rgba(217, 119, 6, 0.08);
  border: 1px solid rgba(217, 119, 6, 0.2);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
}

html[data-theme="dark"] .mfa-reauth-notice {
  color: #fcd34d;
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.25);
}

.mfa-actions {
  margin-top: 1rem;
}

.mfa-mandatory-notice {
  font-size: 0.875rem;
  font-weight: 500;
  color: #991b1b;
  background: rgba(185, 28, 28, 0.07);
  border: 1px solid rgba(185, 28, 28, 0.2);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  line-height: 1.55;
}

.mfa-mandatory-notice--success {
  color: #065f46;
  background: rgba(0, 191, 165, 0.08);
  border-color: rgba(0, 191, 165, 0.25);
}

html[data-theme="dark"] .mfa-mandatory-notice {
  color: #fca5a5;
  background: rgba(185, 28, 28, 0.14);
  border-color: rgba(185, 28, 28, 0.3);
}

html[data-theme="dark"] .mfa-mandatory-notice--success {
  color: #6ee7b7;
  background: rgba(0, 191, 165, 0.12);
  border-color: rgba(0, 191, 165, 0.3);
}

.mfa-admin-notice {
  font-size: 0.8125rem;
  color: var(--branz-muted);
  font-style: italic;
  margin: 0 0 0.5rem;
}

.mfa-backup-recommendation {
  font-size: 0.85rem;
  color: #92400e;
  background: rgba(217, 119, 6, 0.08);
  border: 1px solid rgba(217, 119, 6, 0.2);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  line-height: 1.5;
  margin: 0 0 0.9rem;
}

html[data-theme="dark"] .mfa-backup-recommendation {
  color: #fcd34d;
  background: rgba(217, 119, 6, 0.14);
  border-color: rgba(217, 119, 6, 0.28);
}

.mfa-backup-tools {
  border: 1px dashed var(--branz-border);
  border-radius: 8px;
  padding: 0.85rem;
  margin-bottom: 1rem;
}

.mfa-backup-tools h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.mfa-backup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.75rem 0;
}

.mfa-sms-coming-soon-row {
  align-items: flex-start;
}

.mfa-coming-soon-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #92400e;
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid rgba(217, 119, 6, 0.25);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  white-space: nowrap;
}

html[data-theme="dark"] .mfa-coming-soon-badge {
  color: #fcd34d;
  background: rgba(217, 119, 6, 0.18);
  border-color: rgba(217, 119, 6, 0.35);
}

.mfa-recovery-codes {
  margin-top: 0.75rem;
  border: 1px solid var(--branz-border);
  border-radius: 8px;
  padding: 0.75rem;
}

.mfa-recovery-codes h4 {
  margin: 0 0 0.35rem;
}

.mfa-recovery-code-list {
  margin: 0.4rem 0 0;
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  background: var(--branz-surface-2, rgba(0, 0, 0, 0.04));
  border: 1px solid var(--branz-border);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.875rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

/* MFA setup wizard */
.mfa-setup h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--branz-charcoal);
  margin: 0 0 0.75rem;
}

.mfa-qr-container {
  display: flex;
  justify-content: center;
  padding: 1.25rem;
  margin-bottom: 0.75rem;
  background: #fff;
  border: 1px solid var(--branz-border);
  border-radius: 10px;
  max-width: 240px;
}

.mfa-qr-container svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 200px;
}

.mfa-manual-toggle {
  font-size: 0.8125rem;
  margin-bottom: 1rem;
}

.mfa-manual-entry {
  margin-bottom: 1rem;
}

.mfa-secret-display {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.mfa-secret-code {
  display: block;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--branz-navy);
  background: rgba(0, 191, 165, 0.06);
  border: 1px solid var(--branz-border);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  word-break: break-all;
  user-select: all;
}

html[data-theme="dark"] .mfa-secret-code {
  color: var(--branz-white);
  background: rgba(0, 191, 165, 0.08);
}

.mfa-setup-hint {
  font-size: 0.8125rem;
  color: var(--branz-muted);
  margin: 0 0 1.25rem;
  line-height: 1.6;
}

.mfa-verify-form {
  max-width: 320px;
}

.mfa-verify-form .input-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--branz-charcoal);
}

.mfa-verify-form .input {
  font-size: 1.1rem;
  letter-spacing: 0.15em;
  text-align: center;
}

.mfa-verify-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

/* Subtask rows: single-line title with ellipsis */
.tasks-list-item--subtask {
  flex-wrap: nowrap;
}

.tasks-list-item--subtask .task-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Main workspace task detail action */
.task-detail-action {
  margin: 1rem 0 0.25rem;
}

/* Auditing subtasks: third-party integrations list */
.task-detail-services {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--branz-border, rgba(0, 0, 0, 0.08));
}

.task-services-heading {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--branz-muted);
  margin: 0 0 0.75rem;
}

.task-services-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.task-service-item {
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: var(--branz-surface-2, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--branz-border, rgba(0, 0, 0, 0.08));
}

.task-service-item-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
}

.task-service-item-header .task-service-resource-flag,
.task-service-item-header .task-service-live {
  margin-left: auto;
}

.task-service-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--branz-navy);
}

.task-service-live {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--branz-accent-soft, rgba(46, 125, 50, 0.12));
  color: var(--branz-accent, #2e7d32);
}

.risk-severity-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.4rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.risk-severity-pill--high {
  background: rgba(198, 40, 40, 0.14);
  color: #b71c1c;
  border-color: rgba(198, 40, 40, 0.35);
}

.risk-severity-pill--medium {
  background: rgba(245, 124, 0, 0.14);
  color: #e65100;
  border-color: rgba(245, 124, 0, 0.35);
}

.risk-severity-pill--critical {
  background: rgba(69, 10, 10, 0.2);
  color: #7f1d1d;
  border-color: rgba(127, 29, 29, 0.45);
}

.risk-severity-pill--info {
  background: rgba(67, 56, 202, 0.12);
  color: #4338ca;
  border-color: rgba(67, 56, 202, 0.35);
}

.risk-severity-pill--low {
  background: rgba(46, 125, 50, 0.14);
  color: #1b5e20;
  border-color: rgba(46, 125, 50, 0.35);
}

.task-service-desc {
  display: block;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--branz-muted);
}

html[data-theme="dark"] .task-service-item {
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .task-service-name {
  color: var(--branz-white);
}

html[data-theme="dark"] .risk-severity-pill--high {
  background: rgba(255, 82, 82, 0.2);
  color: #ff8a80;
  border-color: rgba(255, 82, 82, 0.45);
}

html[data-theme="dark"] .risk-severity-pill--medium {
  background: rgba(255, 167, 38, 0.2);
  color: #ffcc80;
  border-color: rgba(255, 167, 38, 0.45);
}

html[data-theme="dark"] .risk-severity-pill--low {
  background: rgba(102, 187, 106, 0.2);
  color: #a5d6a7;
  border-color: rgba(102, 187, 106, 0.45);
}

/* Workspace-only task (no subtasks): sidebar row */
.task-group--workspace-only .task-group-header--workspace-task {
  cursor: pointer;
}

.task-group--workspace-only .task-group-header--workspace-task.tasks-list-item--selected {
  background: rgba(0, 191, 165, 0.08);
  box-shadow: inset 4px 0 0 var(--branz-emerald);
  border-radius: 6px;
}

/* Under review — single message */
.task-detail-custom {
  margin-top: 1rem;
}

/* Org details — support emails in one row */
.org-details-support-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin-top: 0.35rem;
  align-items: start;
}

.org-details-support-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

@media (max-width: 720px) {
  .org-details-support-row {
    grid-template-columns: 1fr;
  }
}

.org-details-form-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
}

.org-details-form-footer-primary {
  flex: 1 1 auto;
  min-width: 0;
}

.org-details-form-footer-actions {
  flex: 0 0 auto;
  margin-left: auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.org-details-form-footer-actions--auto {
  max-width: 22rem;
}

.org-details-form-footer-actions--auto .org-details-auto-hint {
  margin: 0;
  font-size: 0.8125rem;
  text-align: right;
}

@media (max-width: 720px) {
  .org-details-form-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .org-details-form-footer-actions {
    margin-left: 0;
    justify-content: flex-end;
  }

  .org-details-form-footer-actions--auto .org-details-auto-hint {
    text-align: left;
  }
}

/* Org details save: muted until there are unsaved changes */
.btn-org-details-save.btn-org-details-save--clean {
  background: #e8eaed;
  color: #6b7280;
  cursor: not-allowed;
  opacity: 1;
}

.btn-org-details-save.btn-org-details-save--clean:hover {
  background: #e8eaed;
  color: #6b7280;
}

html[data-theme="dark"] .btn-org-details-save.btn-org-details-save--clean {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.45);
}

html[data-theme="dark"] .btn-org-details-save.btn-org-details-save--clean:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.45);
}

.btn-org-details-save.btn-org-details-save--dirty {
  background: var(--branz-emerald);
  color: var(--branz-white);
}

.btn-org-details-save.btn-org-details-save--dirty:hover {
  background: var(--branz-emerald-hover);
  color: var(--branz-white);
}

.btn-org-details-save.btn-org-details-save--clean:disabled {
  opacity: 1;
}

.under-review-card {
  padding: 1.25rem 1.35rem;
  border-radius: 10px;
  background: var(--branz-surface-2, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--branz-border, rgba(0, 0, 0, 0.08));
}

.under-review-message {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--branz-charcoal);
}

html[data-theme="dark"] .under-review-card {
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .under-review-message {
  color: var(--branz-white);
}

/* Generating reports — three report sections */
.reports-findings-note {
  font-size: 0.875rem;
  color: var(--branz-muted);
  margin-bottom: 1rem;
  line-height: 1.45;
}

.reports-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 0.5rem;
}

.report-section {
  padding: 1rem 1.1rem;
  border-radius: 10px;
  border: 1px solid var(--branz-border, rgba(0, 0, 0, 0.08));
  background: var(--branz-surface-2, rgba(0, 0, 0, 0.02));
}

.report-section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.report-section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--branz-navy);
}

html[data-theme="dark"] .report-section-title {
  color: var(--branz-white);
}

.report-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.report-download-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--branz-navy);
}

html[data-theme="dark"] .report-download-icon {
  color: var(--branz-white);
}

.report-download-label {
  font-size: 0.8125rem;
  font-weight: 600;
}

.report-pdf-preview {
  border-radius: 8px;
  min-height: 140px;
  background: linear-gradient(145deg, #f8fafc 0%, #eef2f7 100%);
  border: 1px dashed var(--branz-border, rgba(0, 0, 0, 0.12));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

html[data-theme="dark"] .report-pdf-preview {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.report-pdf-preview-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  max-width: 200px;
}

.report-pdf-preview-doc-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--branz-navy, #0f172a);
  text-align: center;
  line-height: 1.25;
  max-width: 100%;
}

html[data-theme="dark"] .report-pdf-preview-doc-title {
  color: var(--branz-white, #f8fafc);
}

.report-pdf-preview-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(185, 28, 28, 0.12);
  color: #b91c1c;
}

.report-pdf-preview-lines {
  width: 100%;
  height: 52px;
  border-radius: 4px;
  background: repeating-linear-gradient(0deg,
      rgba(0, 0, 0, 0.06),
      rgba(0, 0, 0, 0.06) 1px,
      transparent 1px,
      transparent 10px);
  opacity: 0.85;
}

html[data-theme="dark"] .report-pdf-preview-lines {
  background: repeating-linear-gradient(0deg,
      rgba(255, 255, 255, 0.08),
      rgba(255, 255, 255, 0.08) 1px,
      transparent 1px,
      transparent 10px);
}

.report-downloaded-note {
  margin: 0.65rem 0 0;
  font-size: 0.8125rem;
  color: var(--branz-emerald, #0d9488);
  font-weight: 600;
}

/* Complete indicator (non-collapsible final task) */
.task-group--indicator {
  list-style: none;
}

.task-group-header--indicator {
  cursor: default;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--branz-navy);
  border-bottom: none;
}

html[data-theme="dark"] .task-group-header--indicator {
  color: var(--branz-white);
}

.task-indicator-label {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--branz-muted);
  margin-left: 0.5rem;
}

/* Invite team card (customer workspace) */
.invite-team-textarea {
  max-width: 100%;
  min-height: 60px;
  resize: vertical;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
}

.invite-team-limit {
  font-size: 0.8125rem;
  color: var(--branz-muted);
  margin: 0.5rem 0;
}

.invite-team-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* Admin user list: MFA status dot */
.user-mfa {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
}

.user-mfa-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.user-mfa-dot--enabled {
  background: var(--branz-emerald);
}

.user-mfa-dot--disabled {
  background: #b91c1c;
}

/* Breach check card (customer workspace) */
.breach-check-intro {
  font-size: 0.9375rem;
  margin-bottom: 1rem;
  color: var(--branz-charcoal);
}

.attack-surface-source-coverage {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.attack-source-pill {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: var(--branz-bg);
  border: 1px solid var(--branz-border);
  color: var(--branz-muted);
}

.breach-check-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.breach-stat {
  flex: 1;
  text-align: center;
  padding: 0.75rem 0.5rem;
  border-radius: 8px;
  background: var(--branz-bg);
  border: 1px solid var(--branz-border);
}

.breach-stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--branz-charcoal);
}

.breach-stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--branz-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.15rem;
}

.breach-stat--exposed .breach-stat-value {
  color: #b91c1c;
}

.breach-stat--clean .breach-stat-value {
  color: var(--branz-emerald);
}

.breach-check-date {
  font-size: 0.8125rem;
  color: var(--branz-muted);
  margin-bottom: 1rem;
}

.breach-results {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.breach-result {
  border: 1px solid var(--branz-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  background: var(--branz-surface);
}

.breach-result--exposed {
  border-left: 3px solid #b91c1c;
}

.breach-result--clean {
  border-left: 3px solid var(--branz-emerald);
}

.breach-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.breach-result-email {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--branz-charcoal);
  word-break: break-all;
}

.breach-result-status {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.breach-result--exposed .breach-result-status {
  color: #b91c1c;
}

.breach-result--clean .breach-result-status {
  color: var(--branz-emerald);
}

.breach-result-details {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.breach-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  padding: 0.25rem 0;
  border-top: 1px solid var(--branz-border);
}

.breach-item-name {
  font-weight: 500;
  color: var(--branz-charcoal);
}

.breach-item-date {
  color: var(--branz-muted);
}

.breach-item-data {
  color: var(--branz-muted);
  font-size: 0.75rem;
}

.breach-check-note {
  font-size: 0.8125rem;
  color: var(--branz-muted);
  font-style: italic;
}

.breach-check-running {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0;
  color: var(--branz-muted);
  font-size: 0.875rem;
}

.breach-check-spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--branz-border);
  border-top-color: var(--branz-emerald);
  border-radius: 50%;
  animation: breach-spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes breach-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Admin API docs/tester */
.api-docs-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.api-docs-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.api-endpoint-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.api-endpoint-item {
  border: 1px solid var(--branz-border);
  border-radius: 8px;
  padding: 0.75rem;
  background: var(--branz-surface);
}

.api-endpoint-top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.api-method-pill {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: rgba(10, 47, 80, 0.12);
  color: var(--branz-navy);
}

.api-path {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.82rem;
}

.api-status-pill {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--branz-border);
}

.api-status-pill--ok {
  color: #065f46;
  background: rgba(0, 191, 165, 0.12);
  border-color: rgba(0, 191, 165, 0.35);
}

.api-status-pill--warn {
  color: #92400e;
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.35);
}

.api-status-pill--error {
  color: #991b1b;
  background: rgba(185, 28, 28, 0.1);
  border-color: rgba(185, 28, 28, 0.32);
}

.api-endpoint-meta {
  margin-top: 0.45rem;
  font-size: 0.8125rem;
  color: var(--branz-muted);
}

.api-endpoint-actions {
  margin-top: 0.65rem;
  display: flex;
  justify-content: flex-end;
}

.api-tester-grid .input-label {
  display: block;
  margin: 0 0 0.25rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.api-tester-body {
  max-width: none;
  min-height: 140px;
  resize: vertical;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.8125rem;
}

.api-tester-actions {
  margin-top: 0.75rem;
}

.api-test-output {
  margin-top: 0.75rem;
  background: var(--branz-bg);
  border: 1px solid var(--branz-border);
  border-radius: 8px;
  padding: 0.75rem;
  min-height: 180px;
  max-height: 420px;
  overflow: auto;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 1024px) {
  .api-docs-layout {
    grid-template-columns: 1fr;
  }
}