:root {
  --app-bg: #f7f8fa;
  --app-surface: #ffffff;
  --app-border: #d8dee6;
  --app-text: #1f2937;
  --app-muted: #6b7280;
  --app-primary: #0d6efd;
  --app-primary-soft: #eef4ff;
}

body {
  background: var(--app-bg);
  color: var(--app-text);
}

a { color: inherit; }

.topbar {
  background: #ffffff;
}

.brand-link {
  color: #111827;
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 700;
}

.brand-link:hover {
  color: #111827;
}

.brand-subtitle {
  color: var(--app-muted);
  font-size: 0.88rem;
  margin-top: 0.2rem;
}

.user-chip {
  background: #ffffff;
  border: 1px solid var(--app-border);
  border-radius: 0.8rem;
  padding: 0.45rem 0.7rem;
}

.global-nav-wrap {
  background: #ffffff;
}

.global-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--app-border);
  background: #ffffff;
  color: #374151;
  text-decoration: none;
  font-weight: 500;
}

.global-nav-link:hover,
.global-nav-link.active {
  background: var(--app-primary-soft);
  border-color: #b6ccff;
  color: #0b4fc1;
}

.app-main {
  max-width: 1440px;
}

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

.page-title {
  margin-bottom: 0.2rem;
}

.page-subtitle {
  color: var(--app-muted);
  margin-bottom: 0;
}

.card {
  border-radius: 0.9rem;
  border: 1px solid var(--app-border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  background: var(--app-surface);
}

.card-header {
  background: #ffffff;
  color: var(--app-text);
  border-bottom: 1px solid #e9edf3;
  font-weight: 700;
}

.metric-box,
.summary-card {
  background: #ffffff;
  border: 1px solid var(--app-border);
  border-radius: 0.9rem;
  padding: 1rem;
  height: 100%;
}

.metric-label,
.summary-label {
  color: var(--app-muted);
  font-size: 0.85rem;
}

.metric-value,
.summary-value,
.dashboard-metric {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--app-text);
}

.metric-subtext,
.summary-subtext,
.section-note,
.small-note,
.form-help {
  color: var(--app-muted);
  font-size: 0.84rem;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 1rem;
}

.sidebar-card {
  position: sticky;
  top: 1rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.sidebar-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  text-decoration: none;
  color: var(--app-text);
  border: 1px solid var(--app-border);
  border-radius: 0.8rem;
  background: #ffffff;
}

.sidebar-link:hover,
.sidebar-link.active {
  border-color: #b6ccff;
  background: var(--app-primary-soft);
  color: #0b4fc1;
}

.count-pill {
  min-width: 2rem;
  text-align: center;
  background: #eef2f7;
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  color: #475569;
}

.filter-card .form-label {
  font-size: 0.84rem;
  color: var(--app-muted);
  margin-bottom: 0.35rem;
}

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.bar-list.compact {
  gap: 0.65rem;
}

.bar-track {
  width: 100%;
  height: 0.8rem;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: #3b82f6;
}

.bar-fill.secondary { background: #14b8a6; }
.bar-fill.warning { background: #f59e0b; }
.bar-fill.danger { background: #ef4444; }

.badge-soft {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.62rem;
  border-radius: 999px;
  background: #f3f6fb;
  color: #334155;
  border: 1px solid #d7dee8;
  font-size: 0.75rem;
}

.badge-soft.secondary { background: #edfdfa; color: #0f766e; border-color: #b7f0e8; }
.badge-soft.warning { background: #fff8e8; color: #a16207; border-color: #fde68a; }
.badge-soft.gray { background: #f8fafc; color: #475569; border-color: #cbd5e1; }

.table thead th {
  font-size: 0.82rem;
  color: var(--app-muted);
  font-weight: 700;
  white-space: nowrap;
}

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

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.section-kicker {
  font-size: 0.78rem;
  font-weight: 700;
  color: #2563eb;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.info-strip {
  border: 1px solid #dbe6f5;
  background: #ffffff;
  color: #374151;
  border-radius: 0.9rem;
  padding: 0.85rem 1rem;
}

.form-section { margin-bottom: 1.2rem; }
.form-section-title { font-size: 1rem; font-weight: 700; margin-bottom: 0.85rem; }
.form-grid-2, .form-grid-3, .form-grid-4 { display: grid; gap: 1rem; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.hero-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.question-card { border-color: #dbeafe; }
.question-chip { white-space: normal; text-align: left; font-weight: 500; }
.question-example-panel { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 0.9rem; padding: 0.9rem; }
.example-box { height: 100%; border-radius: 0.8rem; border: 1px solid #dbe4f0; padding: 0.75rem 0.8rem; background: #fff; }
.example-box.low { background: #f8fafc; }
.example-box.mid { background: #eff6ff; }
.example-box.high { background: #eefbf5; }
.example-label { font-size: 0.8rem; font-weight: 700; color: #475569; margin-bottom: 0.35rem; }

@media (max-width: 1200px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .sidebar-card { position: static; }
}

@media (max-width: 992px) {
  .kpi-grid,
  .form-grid-4,
  .form-grid-3,
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}


.home-hero .card-body {
  padding: 1.5rem;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 992px) {
  .home-grid {
    grid-template-columns: 1fr;
  }
}


.compact-header { margin-bottom: 0.75rem; }
.dashboard-layout-clean { align-items: start; }
.content-stack { min-width: 0; }
.filter-toolbar-card .card-body { padding: 0.9rem 1rem; }
.filter-inline-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: end;
}
.filter-inline-actions {
  display: flex;
  gap: 0.5rem;
  align-items: end;
  flex-wrap: wrap;
}
.section-banner {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  background: #ffffff;
  border: 1px solid var(--app-border);
  border-radius: 0.9rem;
  padding: 0.9rem 1rem;
}
.section-note.short { max-width: 520px; }
.kpi-grid-compact .summary-card.compact { padding: 0.85rem 1rem; }
.compact-table td, .compact-table th { padding-top: 0.55rem; padding-bottom: 0.55rem; }
.simple-step-list { padding-left: 1.15rem; color: var(--app-text); }
.simple-step-list li { margin-bottom: 0.45rem; }
.simple-step-list li:last-child { margin-bottom: 0; }

@media (max-width: 1200px) {
  .filter-inline-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 992px) {
  .filter-inline-form { grid-template-columns: 1fr; }
  .section-banner { flex-direction: column; align-items: flex-start; }
}

.sticky-top-card {
  position: sticky;
  top: 1rem;
}

.password-row td {
  background: #fafbfc;
}

.badge-soft.green { background: #eefbf5; color: #166534; border-color: #bbf7d0; }
.badge-soft.red { background: #fff1f2; color: #b91c1c; border-color: #fecdd3; }
.badge-soft.blue { background: #eef4ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge-soft.purple { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }

.participant-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap:10px; }

.business-entry-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(340px, 30vw, 460px);
  gap: 0.85rem;
  align-items: start;
}

.business-entry-form-pane,
.business-entry-reference-pane {
  min-width: 0;
}

.business-entry-form-pane > form {
  max-height: calc(100vh - 180px);
  overflow: auto;
  padding-right: 0.1rem;
}

.business-entry-reference-pane {
  position: sticky;
  top: 0.5rem;
}

.business-reference-card {
  max-height: calc(100vh - 180px);
  overflow: hidden;
}

.business-reference-card .card-body {
  padding: 0;
}

.business-reference-body {
  height: calc(100vh - 238px);
  padding: 0;
}

.business-reference-empty {
  padding: 1rem;
  color: var(--app-muted);
}

.business-reference-table-wrap {
  overflow: auto;
  height: 100%;
  max-height: calc(100vh - 260px);
}

.business-reference-table {
  table-layout: fixed;
  font-size: 10.5px;
  line-height: 1.2;
}

.business-reference-table th,
.business-reference-table td {
  border: 1px solid #e5e7eb;
  padding: 0.16rem 0.32rem;
  white-space: nowrap;
  min-width: 78px;
  vertical-align: top;
}

.business-reference-table td {
  background: #ffffff;
}

.business-reference-table .ref-row-header {
  min-width: 44px;
  width: 44px;
  text-align: right;
  background: #f8fafc;
  color: #64748b;
  font-weight: 600;
}

.business-reference-table .sticky-row {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
}

.business-reference-table .sticky-col {
  position: sticky;
  left: 0;
  z-index: 1;
}

.business-reference-table .sticky-col.sticky-row {
  z-index: 3;
}

@media (max-height: 820px) {
  .business-entry-form-pane > form,
  .business-reference-card {
    max-height: calc(100vh - 150px);
  }

  .business-reference-body,
  .business-reference-table-wrap {
    max-height: calc(100vh - 220px);
    height: calc(100vh - 220px);
  }

  .business-reference-table {
    font-size: 10px;
  }
}

@media (max-width: 1180px) {
  .business-entry-layout {
    grid-template-columns: 1fr;
  }

  .business-entry-reference-pane {
    position: static;
  }

  .business-entry-form-pane > form,
  .business-reference-card,
  .business-reference-body,
  .business-reference-table-wrap {
    max-height: none;
    height: auto;
  }
}
