/* Structural base, report rendering and print rules. Reusable visual values
 * come from tokens.css; the canonical component layer is visitor-insights.css. */

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus-visible,
.btn:active:focus-visible,
.btn-link.nav-link:focus-visible,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem var(--color-bg-surface), 0 0 0 0.25rem var(--color-focus-ring);
}

.btn:focus:not(:focus-visible),
.btn:active:focus:not(:focus-visible),
.btn-link.nav-link:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

#theme-toggle:focus:not(:focus-visible),
#theme-toggle:active:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

#theme-toggle:focus-visible {
  outline: 2px solid rgba(var(--color-accent-rgb), 0.45);
  outline-offset: 2px;
  box-shadow: none;
}

.navbar-toggler:focus:not(:focus-visible),
.navbar-toggler:active:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

.navbar-toggler:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
  box-shadow: none;
}

html {
  position: relative;
  min-height: 100%;
  scrollbar-gutter: stable;
}

body {
  margin-bottom: 60px;
  background:
    linear-gradient(180deg, rgba(var(--color-accent-rgb), 0.05), transparent 220px),
    var(--color-bg-page);
}

.app-page {
  padding-bottom: 2rem;
}

.app-navbar .navbar-collapse {
  gap: var(--space-md);
}

.app-navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
}

.theme-toggle-button,
.app-user-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  color: var(--color-text-secondary);
  background: transparent;
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.4rem;
}

.theme-toggle-button {
  width: 2rem;
  padding: 0;
}

.theme-toggle-button:hover,
.theme-toggle-button:focus-visible,
.app-user-menu-toggle:hover,
.app-user-menu-toggle:focus-visible,
.app-user-menu-toggle[aria-expanded="true"] {
  color: var(--color-text-primary);
  background: var(--color-bg-surface-subtle);
  border-color: var(--color-border-subtle);
}

.theme-toggle-icon {
  display: none;
  width: 1.05rem;
  height: 1.05rem;
  color: currentColor;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle-button[data-theme="light"] .theme-toggle-sun,
.theme-toggle-button[data-theme="dark"] .theme-toggle-moon {
  display: block;
}

.app-user-menu-toggle {
  gap: 0.42rem;
  padding: 0.18rem 0.48rem 0.18rem 0.25rem;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 650;
}

.app-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  color: var(--color-accent-text);
  background: rgba(var(--color-accent-rgb), 0.13);
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.app-user-chevron {
  width: 0.42rem;
  height: 0.42rem;
  margin-left: 0.08rem;
  border-right: 1.7px solid currentColor;
  border-bottom: 1.7px solid currentColor;
  transform: translateY(-0.12rem) rotate(45deg);
  transition: transform 0.15s ease;
}

.app-user-menu-toggle[aria-expanded="true"] .app-user-chevron {
  transform: translateY(0.1rem) rotate(225deg);
}

.app-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: 1.25rem;
}

.app-page-title {
  margin: 0;
  font-size: clamp(1.7rem, 1.45rem + 1vw, 2.3rem);
  line-height: 1.1;
  font-weight: var(--font-weight-bold);
}

.app-page-lead {
  max-width: 48rem;
  margin: 0.45rem 0 0;
  color: var(--color-text-secondary);
}

.app-page-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.app-surface {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
  box-shadow: var(--shadow-subtle);
}

.app-surface > .card-body {
  padding: var(--space-md);
}

.password-field {
  position: relative;
}

.password-field .form-control {
  padding-right: 2.75rem;
}

.password-visibility-toggle {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  color: var(--color-text-secondary);
  background: transparent;
  border: 0;
  border-radius: 0.35rem;
  transform: translateY(-50%);
}

.password-visibility-toggle:hover,
.password-visibility-toggle:focus-visible {
  color: var(--color-text-primary);
  background: var(--color-bg-surface-subtle);
}

.password-toggle-eye {
  position: relative;
  display: block;
  width: 1.05rem;
  height: 1.05rem;
  border: 1.7px solid currentColor;
  border-radius: 75% 15%;
  transform: rotate(45deg);
}

.password-toggle-eye::before {
  position: absolute;
  content: "";
  top: 50%;
  left: 50%;
  width: 0.32rem;
  height: 0.32rem;
  background: currentColor;
  border-radius: var(--radius-pill);
  transform: translate(-50%, -50%);
}

.password-visibility-toggle.is-visible .password-toggle-eye::after {
  position: absolute;
  content: "";
  top: 50%;
  left: 50%;
  width: 1.25rem;
  border-top: 1.7px solid currentColor;
  transform: translate(-50%, -50%) rotate(90deg);
}

input.form-control:-webkit-autofill,
input.form-control:-webkit-autofill:hover,
input.form-control:-webkit-autofill:focus,
input.form-control:-webkit-autofill:active {
  -webkit-text-fill-color: var(--color-text-primary) !important;
  caret-color: var(--color-text-primary);
  -webkit-box-shadow: 0 0 0 1000px var(--color-bg-page) inset !important;
  box-shadow: 0 0 0 1000px var(--color-bg-page) inset !important;
  transition: background-color 9999s ease-in-out 0s;
}

input.form-control:autofill {
  color: var(--color-text-primary);
  box-shadow: 0 0 0 1000px var(--color-bg-page) inset !important;
}

.app-toast-container {
  position: fixed;
  display: flex;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 1090;
  width: min(25rem, calc(100vw - 2rem));
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: none;
}

.app-toast {
  position: relative;
  overflow: hidden;
  width: 100%;
  color: var(--color-text-primary);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-subtle);
  border-left: 4px solid var(--color-success);
  border-radius: 8px;
  box-shadow: var(--shadow-elevated);
  backdrop-filter: blur(12px);
  pointer-events: auto;
}

.app-toast-progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--color-success);
  transform-origin: left;
  pointer-events: none;
}

.app-toast-error .app-toast-progress {
  background: var(--color-danger);
}

.app-toast-info .app-toast-progress {
  background: var(--color-accent);
}

.app-toast-error {
  border-left-color: var(--color-danger);
}

.app-toast-error.show {
  animation: app-toast-error-shake 0.5s ease-in-out;
}

@keyframes app-toast-error-shake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-5px); }
  36% { transform: translateX(4px); }
  54% { transform: translateX(-3px); }
  72% { transform: translateX(2px); }
  88% { transform: translateX(-1px); }
}

@media (prefers-reduced-motion: reduce) {
  .app-toast-error.show {
    animation: none;
  }
}

.app-toast-info {
  border-left-color: var(--color-accent);
}

.app-toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  margin-left: 0.9rem;
  color: var(--color-success);
  background: rgba(var(--color-success-rgb), 0.12);
  border-radius: var(--radius-pill);
}

.app-toast-error .app-toast-icon {
  color: var(--color-danger);
  background: rgba(var(--color-danger-rgb), 0.12);
}

.app-toast-info .app-toast-icon {
  color: var(--color-accent-text);
  background: rgba(var(--color-accent-rgb), 0.12);
}

.app-toast-icon svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.app-toast .toast-body {
  display: flex;
  min-width: 0;
  padding: 0.85rem;
  flex: 1 1 auto;
  flex-direction: column;
  line-height: 1.35;
}

.app-toast .toast-body strong {
  margin-bottom: 0.12rem;
  font-size: 0.82rem;
}

.app-toast .toast-body span {
  color: var(--color-text-secondary);
  font-size: 0.88rem;
}

.app-toast-details {
  overflow-y: auto;
  max-height: 11rem;
  margin: 0.55rem 0 0;
  padding-left: 1.1rem;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
}

.app-toast-details li + li {
  margin-top: 0.3rem;
}

.app-toast-close {
  flex: 0 0 auto;
  margin: 0 0.85rem 0 auto;
}

.app-section {
  margin-bottom: var(--space-section);
}

.app-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: 0.75rem;
}

.app-section-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: var(--font-weight-bold);
}

.app-section-meta {
  margin: 0.2rem 0 0;
  color: var(--color-text-secondary);
  font-size: 0.94rem;
}

.app-toolbar {
  display: flex;
  align-items: end;
  gap: var(--space-sm);
  flex-wrap: wrap;
  padding: var(--space-md);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
}

.app-toolbar .form-label {
  margin-bottom: 0.25rem;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

.validation-summary-valid,
.field-validation-valid {
  display: none;
}

.app-toolbar-actions {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-left: auto;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-sm);
}

.kpi-card {
  padding: var(--space-md);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
}

.kpi-label {
  margin-bottom: 0.35rem;
  color: var(--color-text-secondary);
  font-size: 0.88rem;
}

.kpi-value {
  font-size: 1.65rem;
  line-height: 1.1;
  font-weight: var(--font-weight-bold);
}

.kpi-note {
  margin-top: 0.25rem;
  color: var(--color-text-secondary);
  font-size: 0.86rem;
}

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

.workflow-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: var(--space-md);
  color: inherit;
  text-decoration: none;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
  box-shadow: var(--shadow-subtle);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.workflow-card:hover,
.workflow-card:focus-visible {
  color: inherit;
  border-color: var(--color-border-subtle);
  transform: translateY(-1px);
}

.workflow-title {
  margin: 0 0 0.35rem;
  font-weight: var(--font-weight-bold);
}

.workflow-text {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 0.93rem;
}

.table-shell {
  overflow: auto;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
}

.table-shell .table {
  margin-bottom: 0;
}

.table-shell thead th {
  color: var(--color-text-secondary);
  background: var(--color-bg-surface-subtle);
  border-bottom-color: var(--color-border-subtle);
  font-size: 0.9rem;
  font-weight: var(--font-weight-bold);
}

.table-shell tbody tr:last-child td {
  border-bottom: 0;
}

.app-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

.app-tab {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.35rem 0.75rem;
  color: var(--color-text-primary);
  text-decoration: none;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-pill);
  background: var(--color-bg-surface);
}

.app-tab:hover,
.app-tab:focus-visible {
  color: var(--color-text-primary);
  border-color: var(--color-border-subtle);
}

.app-tab.active {
  color: var(--color-on-accent);
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.form-panel {
  padding: var(--space-md);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-panel);
}

.factor-row-actions-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  color: var(--color-text-secondary);
  background: var(--color-bg-surface-subtle);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.4rem;
  cursor: pointer;
}

.factor-row-actions-toggle:hover,
.factor-row-actions-toggle:focus-visible {
  color: var(--color-text-primary);
  border-color: var(--color-border-subtle);
}

.factor-row-actions-icon {
  display: grid;
  gap: 0.16rem;
}

.factor-row-actions-icon span {
  display: block;
  width: 0.22rem;
  height: 0.22rem;
  background: currentColor;
  border-radius: var(--radius-pill);
}

.factor-row-actions-popover {
  position: fixed;
  inset: 0 auto auto 0;
  margin: 0;
  padding: 0;
  color: var(--color-text-primary);
  background: transparent;
  border: 0;
  overflow: visible;
  z-index: 1080;
}

.factor-row-actions-popover:popover-open {
  display: block;
}

.factor-row-actions-menu {
  display: grid;
  gap: 0.15rem;
  min-width: 9rem;
  margin-top: 0.35rem;
  padding: 0.3rem;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.45rem;
  box-shadow: var(--shadow-subtle);
}

.factor-row-action-item {
  display: block;
  width: 100%;
  padding: 0.4rem 0.5rem;
  color: var(--color-text-primary);
  background: transparent;
  border: 0;
  border-radius: 0.3rem;
  text-align: left;
  text-decoration: none;
  font: inherit;
  white-space: nowrap;
}

.factor-row-action-item:hover,
.factor-row-action-item:focus-visible {
  color: var(--color-text-primary);
  background: var(--color-bg-surface-subtle);
}

.factor-row-action-danger {
  color: var(--color-danger);
}

/* Global link treatment: less default-blue, clearer hover/focus behavior */
a:not(.btn):not(.nav-link):not(.navbar-brand):not(.workflow-card):not(.app-tab):not(.dropdown-item) {
  color: var(--color-text-primary);
  text-decoration-color: rgba(var(--color-accent-rgb), 0.45);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:not(.btn):not(.nav-link):not(.navbar-brand):not(.workflow-card):not(.app-tab):not(.dropdown-item):hover,
a:not(.btn):not(.nav-link):not(.navbar-brand):not(.workflow-card):not(.app-tab):not(.dropdown-item):focus-visible {
  color: var(--color-accent-text);
  text-decoration-color: rgba(var(--color-accent-rgb), 0.75);
}

.btn-primary {
  --bs-btn-color: var(--color-on-accent);
  --bs-btn-bg: var(--color-accent);
  --bs-btn-border-color: var(--color-accent);
  --bs-btn-hover-color: var(--color-on-accent);
  --bs-btn-hover-bg: var(--color-accent-hover);
  --bs-btn-hover-border-color: var(--color-accent-hover);
  --bs-btn-focus-shadow-rgb: var(--color-accent-rgb);
  --bs-btn-active-color: var(--color-on-accent);
  --bs-btn-active-bg: var(--color-accent-strong);
  --bs-btn-active-border-color: var(--color-accent-strong);
  --bs-btn-disabled-color: var(--color-on-accent);
  --bs-btn-disabled-bg: var(--color-accent);
  --bs-btn-disabled-border-color: var(--color-accent);
}

.btn-outline-primary {
  --bs-btn-color: var(--color-accent);
  --bs-btn-border-color: var(--color-border-subtle);
  --bs-btn-hover-color: var(--color-on-accent);
  --bs-btn-hover-bg: var(--color-accent);
  --bs-btn-hover-border-color: var(--color-accent);
  --bs-btn-focus-shadow-rgb: var(--color-accent-rgb);
  --bs-btn-active-color: var(--color-on-accent);
  --bs-btn-active-bg: var(--color-accent-strong);
  --bs-btn-active-border-color: var(--color-accent-strong);
  --bs-btn-disabled-color: var(--color-accent);
  --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: var(--color-border-subtle);
}

.factor-timeline {
  display: grid;
  gap: var(--space-xs);
}

.factor-timeline-event {
  position: relative;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
  box-shadow: var(--shadow-subtle);
  overflow: hidden;
}

.factor-timeline-event[open] {
  border-color: var(--color-border-subtle);
}

.factor-timeline-row {
  display: grid;
  grid-template-columns: 2rem 8.5rem minmax(16rem, 1fr) minmax(11rem, 0.65fr) 1.25rem;
  gap: 0.9rem;
  align-items: center;
  padding: 0.85rem 1rem;
  cursor: pointer;
  list-style: none;
}

.factor-timeline-row::-webkit-details-marker {
  display: none;
}

.factor-timeline-event[open] > .factor-timeline-row {
  border-bottom: 1px solid var(--color-border-subtle);
}

.factor-timeline-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  color: var(--color-text-secondary);
  background: var(--color-bg-surface-subtle);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-body);
  font-weight: 800;
  line-height: 1;
}

.factor-timeline-created .factor-timeline-marker {
  color: var(--color-success);
  background: var(--color-success-surface);
  border-color: color-mix(in oklab, var(--color-success) 32%, var(--color-border-subtle));
}

.factor-timeline-updated .factor-timeline-marker {
  color: var(--color-accent-text);
  background: rgba(var(--color-accent-rgb), 0.13);
  border-color: rgba(var(--color-accent-rgb), 0.32);
}

.factor-timeline-deleted .factor-timeline-marker {
  color: var(--color-danger);
  background: var(--color-danger-surface);
  border-color: color-mix(in oklab, var(--color-danger-fill) 45%, var(--color-border-subtle));
}

.factor-timeline-date-time {
  display: grid;
  gap: 0.12rem;
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.factor-timeline-clock {
  color: var(--color-text-primary);
  font-size: 0.98rem;
  font-weight: var(--font-weight-regular);
}

.factor-timeline-identity {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex-wrap: wrap;
}

.factor-title {
  color: var(--color-text-primary);
  font-weight: var(--font-weight-regular);
  white-space: nowrap;
}

.factor-timeline-when {
  display: grid;
  gap: 0.18rem;
  color: var(--color-text-secondary);
  font-size: 0.93rem;
  justify-self: end;
  white-space: nowrap;
}

.factor-timeline-when > span,
.factor-timeline-range {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.factor-timeline-range {
  color: var(--color-text-primary);
  font-size: 0.98rem;
  font-weight: var(--font-weight-regular);
}

.factor-timeline-when-icon {
  position: relative;
  display: inline-block;
  width: 1rem;
  height: 1rem;
  color: var(--color-text-secondary);
  flex: 0 0 auto;
}

.factor-timeline-when-calendar {
  border: 1.7px solid currentColor;
  border-radius: 0.2rem;
}

.factor-timeline-when-calendar::before {
  position: absolute;
  content: "";
  left: -1.7px;
  right: -1.7px;
  top: 0.25rem;
  border-top: 1.7px solid currentColor;
}

.factor-timeline-when-calendar::after {
  position: absolute;
  content: "";
  left: 0.22rem;
  right: 0.22rem;
  top: -0.22rem;
  height: 0.32rem;
  border-left: 1.7px solid currentColor;
  border-right: 1.7px solid currentColor;
}

.factor-timeline-when-clock {
  border: 1.7px solid currentColor;
  border-radius: var(--radius-pill);
}

.factor-timeline-when-clock::before,
.factor-timeline-when-clock::after {
  position: absolute;
  content: "";
  left: 50%;
  top: 50%;
  width: 1.7px;
  background: currentColor;
  transform-origin: 50% 0;
}

.factor-timeline-when-clock::before {
  height: 0.34rem;
  transform: translate(-50%, -0.04rem);
}

.factor-timeline-when-clock::after {
  height: 0.27rem;
  transform: translate(-50%, -0.04rem) rotate(90deg);
}

.factor-timeline-chevron {
  width: 0.7rem;
  height: 0.7rem;
  border-right: 2px solid var(--color-text-secondary);
  border-bottom: 2px solid var(--color-text-secondary);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  justify-self: end;
}

.factor-timeline-event[open] .factor-timeline-chevron {
  transform: rotate(225deg);
}

.factor-timeline-expanded {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(14rem, 0.9fr);
  gap: var(--space-md);
  padding: 1rem 1rem 1rem 3.9rem;
}

.factor-detail-heading {
  margin-bottom: 0.7rem;
  color: var(--color-text-secondary);
  font-size: 0.88rem;
  font-weight: 800;
}

.factor-values-panel {
  padding-right: 1rem;
  border-right: 1px solid var(--color-border-subtle);
}

.factor-values-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-sm);
}

.factor-values-grid div {
  display: grid;
  gap: var(--space-2xs);
}

.factor-values-grid span {
  color: var(--color-text-secondary);
  font-size: 0.86rem;
}

.factor-values-grid strong {
  font-size: 1.15rem;
}

.factor-comment-panel {
  min-width: 0;
}

.factor-comment-panel p {
  margin: 0;
  color: var(--color-text-primary);
  font-weight: var(--font-weight-regular);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.factor-comment-empty {
  color: var(--color-text-secondary) !important;
  font-weight: 500 !important;
}

.factor-timeline .badge,
.factor-timeline .app-badge {
  white-space: nowrap;
}

.report-week-wrap,
.table-shell.report-week-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

.report-week-table {
  min-width: 64rem;
  table-layout: fixed;
}

.report-week-table .report-week-col-week {
  width: 7%;
}

.report-week-table .report-week-col-summary {
  width: 11%;
}

.report-week-table .report-week-col-age {
  width: 5.5%;
}

.report-week-table .report-week-col-chart {
  width: 38%;
}

.report-week-table th,
.report-week-table td {
  padding-right: 0.45rem;
  padding-left: 0.45rem;
}

.report-week-table thead th {
  line-height: 1.1;
  white-space: normal;
  vertical-align: bottom;
}

.report-week-table th:first-child,
.report-week-table td:first-child {
  white-space: nowrap;
}

.text-week-adults {
  --audience-color: var(--color-data-adults);
}

.text-week-young-adults {
  --audience-color: var(--color-data-young-adults);
}

.text-week-teens {
  --audience-color: var(--color-data-teens);
}

.text-week-children {
  --audience-color: var(--color-data-children);
}

:is(.text-week-adults, .text-week-young-adults, .text-week-teens, .text-week-children) {
  color: var(--color-text-primary);
}

:is(.text-week-adults, .text-week-young-adults, .text-week-teens, .text-week-children)::before {
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: var(--audience-color);
  vertical-align: 0.1em;
  content: "";
}

.factors-active-table,
.factors-old-table {
  min-width: 1080px;
}

.factors-active-table th,
.factors-active-table td,
.factors-old-table th,
.factors-old-table td {
  white-space: nowrap;
}

.week-stack-track {
  width: 100%;
  height: 16px;
  overflow: visible;
}

.week-stack-svg {
  width: 100%;
  max-width: 100%;
  height: 100%;
  border-radius: var(--radius-pill);
  overflow: hidden;
  display: block;
}

.chart-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate(-9999px, -9999px);
  padding: 0.35rem 0.5rem;
  border-radius: 0.4rem;
  border: 1px solid var(--color-border-subtle);
  background: var(--color-bg-page);
  color: var(--color-text-primary);
  font-size: 0.82rem;
  box-shadow: var(--shadow-elevated);
  pointer-events: none;
  white-space: nowrap;
  z-index: 5;
}

.chart-tooltip-global {
  z-index: 2000;
}

.chart-tooltip.is-visible {
  transform: none;
}

.legend-swatch {
  width: 0.75rem;
  height: 0.75rem;
  margin-right: 0.35rem;
  vertical-align: -0.1em;
}

.legend-swatch circle {
  fill: currentColor;
}

.legend-visits {
  color: var(--color-data-visits);
}

.legend-factor-adults {
  color: var(--color-data-adults);
}

.legend-factor-young-adults {
  color: var(--color-data-young-adults);
}

.legend-factor-teens {
  color: var(--color-data-teens);
}

.legend-factor-children {
  color: var(--color-data-children);
}

.week-segment-adults {
  fill: var(--color-data-adults);
}

.week-segment-young-adults {
  fill: var(--color-data-young-adults);
}

.week-segment-teens {
  fill: var(--color-data-teens);
}

.week-segment-children {
  fill: var(--color-data-children);
}

.passage-gap-modal-content {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

.passage-gap-modal-content.is-loading .modal-body,
.passage-gap-modal-content.is-loading .modal-footer {
  pointer-events: none;
  opacity: 0.55;
}

.passage-gap-modal-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: 0.75rem;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  font-weight: 650;
}

.passage-gap-modal-list {
  border-radius: 0.8rem;
}

.passage-gap-modal-day {
  grid-template-columns: minmax(0, 0.9fr) minmax(13rem, 1.1fr);
}

.passage-gap-modal-empty {
  margin-top: 0.8rem;
}

.passage-gap-pagination,
.passage-gap-modal-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.passage-gap-pagination-position {
  min-width: 3.25rem;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  font-weight: var(--font-weight-bold);
  text-align: center;
}

@media (max-width: 991.98px) {
  .app-page-header,
  .app-section-header {
    flex-direction: column;
  }

  .app-page-actions,
  .app-toolbar-actions {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }

  .kpi-grid,
  .workflow-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .factor-timeline-row {
    grid-template-columns: 2rem 7.5rem minmax(0, 1fr) 1.25rem;
  }

  .factor-timeline-marker {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .factor-timeline-date-time {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .factor-timeline-identity {
    grid-column: 3;
    grid-row: 1;
  }

  .factor-timeline-when {
    grid-column: 3;
    grid-row: 2;
    justify-self: start;
  }

  .factor-timeline-chevron {
    grid-column: 4;
    grid-row: 1 / span 2;
  }

  .factor-timeline-expanded {
    grid-template-columns: 1fr;
  }

  .factor-values-panel {
    padding-right: 0;
    padding-bottom: 1rem;
    border-right: 0;
    border-bottom: 1px solid var(--color-border-subtle);
  }

  .navbar-collapse .app-navbar-actions {
    width: 100%;
    justify-content: flex-start;
    margin-top: 0.55rem;
    margin-left: 0;
    padding-top: 0.55rem;
    border-top: 1px solid var(--color-border-subtle);
  }
}

@media (max-width: 767.98px) {

  .app-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .kpi-grid,
  .workflow-grid {
    grid-template-columns: 1fr;
  }

  .kpi-value {
    font-size: 1.45rem;
  }

  .factor-timeline-row {
    grid-template-columns: 2rem minmax(0, 1fr) 1.25rem;
    gap: 0.65rem;
    padding: 0.85rem;
  }

  .factor-timeline-marker {
    grid-column: 1;
    grid-row: 1;
  }

  .factor-timeline-date-time {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    gap: var(--space-sm);
    align-items: baseline;
  }

  .factor-timeline-identity {
    grid-column: 2 / 4;
    grid-row: 2;
  }

  .factor-timeline-when {
    grid-column: 2 / 4;
    grid-row: 3;
  }

  .factor-timeline-chevron {
    grid-column: 3;
    grid-row: 1;
  }

  .factor-timeline-expanded {
    padding: 0.85rem 0.85rem 0.85rem 3.5rem;
  }

  .factor-values-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-week-table {
    min-width: 64rem;
  }

  .passage-gap-modal-day {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .passage-gap-pagination {
    justify-content: space-between;
  }

  .passage-gap-modal-actions {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }
}
