:root {
  --c2-savebar-bg: rgba(255, 255, 255, 0.92);
  --c2-savebar-border: rgba(0, 0, 0, 0.08);
  --c2-savebar-shadow: 0 -10px 30px rgba(0, 0, 0, 0.14);
  --c2-dirty-ring: rgba(13, 110, 253, 0.25); /* Bootstrap primary */
}

/* Square avatar previews */
.c2-avatar-lg,
.c2-avatar-xl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(248, 249, 250, 1);
  overflow: hidden;
}

.c2-avatar-lg {
  width: 72px;
  height: 72px;
}

.c2-avatar-xl {
  width: 120px;
  height: 120px;
}

img.c2-avatar-lg,
img.c2-avatar-xl {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.c2-avatar-placeholder {
  color: rgba(108, 117, 125, 1);
}

/* Clickable table rows (used in search results for keyboard/row navigation) */
.c2-row-clickable {
  cursor: pointer;
}

/* Circular avatar preview for user detail */
.c2-avatar-circle-sm {
  width: 88px;
  height: 88px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(248, 249, 250, 1);
  overflow: hidden;
  object-fit: cover;
}

/* Flags list layout */
.flag-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.flag-item .flag-label {
  word-break: break-word;
  white-space: normal;
}

/* Flags autosave highlights */
.flag-item {
  position: relative;
  padding: 0.15rem 0.9rem 0.15rem 0.35rem;
  border-radius: 8px;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.flag-item::after {
  content: '';
  position: absolute;
  top: 4px;
  bottom: 4px;
  right: 6px;
  width: 4px;
  border-radius: 999px;
  background: transparent;
  transition: background 160ms ease;
}

.flag-item.c2-flag-changed {
  background: rgba(13, 110, 253, 0.08);
  box-shadow: inset 0 0 0 1px rgba(13, 110, 253, 0.25);
}

.flag-item.c2-flag-changed::after {
  background: rgba(13, 110, 253, 0.9);
}

.c2-flag-help {
  cursor: help;
  display: inline-flex;
  align-items: center;
}

.c2-flag-help:focus-visible {
  outline: 2px solid rgba(13, 110, 253, 0.55);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Dirty field highlight for config forms */
.c2-field-dirty {
  border-color: rgba(13, 110, 253, 0.55) !important;
  box-shadow: 0 0 0 0.2rem var(--c2-dirty-ring) !important;
}

/* Sticky save bar for config/settings forms */
.c2-savebar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 1040;
  transform: translateY(110%);
  opacity: 0;
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
}

.c2-savebar.is-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.c2-savebar__inner {
  background: var(--c2-savebar-bg);
  border-top: 1px solid var(--c2-savebar-border);
  box-shadow: var(--c2-savebar-shadow);
  backdrop-filter: blur(12px);
}

body.c2-savebar-visible {
  padding-bottom: var(--c2-savebar-stack-height, 96px);
}

.c2-savebar__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #0d6efd;
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.12);
  flex: 0 0 auto;
}

.c2-savebar__status {
  min-height: 20px;
}

.c2-inline-status {
  min-height: 20px;
}

.c2-muted-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.2em;
}

/* KPI dashboard tooltip (definition + SQL) */
.c2-kpi-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  color: rgba(108, 117, 125, 1); /* Bootstrap secondary */
  cursor: help;
}

.c2-kpi-help:hover {
  color: rgba(73, 80, 87, 1);
}

.c2-kpi-help:focus-visible {
  outline: 2px solid rgba(13, 110, 253, 0.55);
  outline-offset: 2px;
  border-radius: 4px;
}

.c2-kpi-tooltip {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1080;
  width: min(720px, 92vw);
  max-height: 70vh;
  overflow: auto;
  padding: 0.75rem;
  margin-top: 0.5rem;
  background: rgba(17, 17, 17, 0.98);
  color: rgba(248, 249, 250, 1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.c2-kpi-help:hover .c2-kpi-tooltip,
.c2-kpi-help:focus .c2-kpi-tooltip,
.c2-kpi-help:focus-within .c2-kpi-tooltip {
  display: block;
}

.c2-kpi-tooltip__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

.c2-kpi-tooltip__body {
  font-size: 0.9rem;
  line-height: 1.3;
}

.c2-kpi-tooltip__sql {
  margin: 0.4rem 0 0;
  padding: 0.6rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  white-space: pre;
  overflow: auto;
  font-size: 0.8rem;
}

.c2-kpi-tooltip__sql code {
  color: inherit;
}

.c2-kpi-table {
  max-height: 360px;
  overflow: auto;
}

.c2-kpi-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bs-body-bg, #fff);
}

.c2-kpi-chart svg {
  display: block;
  width: 100%;
  height: 140px;
}

.c2-kpi-chart__grid {
  stroke: rgba(0, 0, 0, 0.08);
  stroke-width: 1;
}

.c2-kpi-chart__line {
  stroke: rgba(17, 17, 17, 0.95);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  vector-effect: non-scaling-stroke;
}

.c2-kpi-chart__dot {
  fill: rgba(17, 17, 17, 0.95);
}

.c2-kpi-chart__label {
  fill: rgba(0, 0, 0, 0.55);
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
