/* ========== Enterprise themes (cream default) + accent presets ========== */
:root {
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius: 18px;
  --success: #16a34a;
  --danger: #dc2626;
  /* Cream enterprise — warm surfaces, not stark white */
  --bg: #e5ddd4;
  --bg-elevated: #ebe3d9;
  --surface: #faf6ef;
  --bg-card: #faf6ef;
  --border: rgba(55, 48, 40, 0.14);
  --glass-border: rgba(55, 48, 40, 0.1);
  --text: #1c1917;
  --muted: #57534e;
  --text-on-accent: #ffffff;
  --accent: #8b6914;
  --accent-hover: #a67c00;
  --gold: #8b6914;
  --gold-muted: #6b5420;
  --sidebar-bg: #e0d8ce;
  --sidebar-active: linear-gradient(135deg, rgba(180, 140, 40, 0.96) 0%, rgba(130, 95, 20, 0.94) 100%);
  --shadow-sm: 0 1px 3px rgba(28, 25, 23, 0.08);
  --shadow-md: 0 10px 40px rgba(28, 25, 23, 0.12);
  --body-gradient:
    radial-gradient(ellipse 90% 80% at 0% 20%, rgba(212, 175, 55, 0.14) 0%, transparent 50%),
    radial-gradient(ellipse 80% 70% at 100% 0%, rgba(120, 113, 108, 0.1) 0%, transparent 48%),
    linear-gradient(180deg, #efe8df 0%, #e5ddd4 50%, #ddd5cb 100%);
  --welcome-gradient:
    radial-gradient(ellipse 88% 72% at 0% 32%, rgba(212, 175, 55, 0.18) 0%, transparent 52%),
    radial-gradient(ellipse 78% 68% at 50% 42%, rgba(168, 162, 152, 0.16) 0%, transparent 48%),
    linear-gradient(180deg, #faf6ef 0%, #ebe3d9 100%);
  --topbar-bg: color-mix(in srgb, var(--surface) 90%, transparent);
  --pill-bg: color-mix(in srgb, var(--surface) 65%, transparent);
  --table-header-bg: #d8cfc3;
  --table-row-alt: #f2ebe0;
  --table-hover: #f5edd8;
  --input-focus-ring: rgba(139, 105, 20, 0.38);
  --crm-tab-active-bg: #e8d5a0;
  --crm-tab-active-border: #b8860b;
  --audit-tab-bg: #e8e0d5;
  --audit-tab-active-bg: linear-gradient(135deg, rgba(245, 228, 175, 0.98), rgba(228, 205, 155, 0.95));
  --audit-tab-active-fg: #422006;
  --chart-surface: #fffcf7;
  --chart-plot-bg: #f0e8de;
  --chart-grid: rgba(87, 83, 78, 0.22);
  /* Solid enough for Plotly tick labels on warm plot backgrounds (avoid faint rgba) */
  --chart-axis: #44403c;
  --color-surface: var(--surface);
  --color-surface-alt: var(--table-row-alt);
  --color-border: var(--border);
  --color-text: var(--text);
  --color-muted: var(--muted);
  --color-accent: var(--accent);
  --pane-gap: 0.85rem;
  --pane-radius: 8px;
}

html[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --bg-card: #ffffff;
  --border: rgba(15, 23, 42, 0.1);
  --glass-border: rgba(15, 23, 42, 0.08);
  --text: #0f172a;
  --muted: #64748b;
  --text-on-accent: #ffffff;
  --sidebar-bg: #eef1f8;
  --sidebar-active: linear-gradient(135deg, rgba(212, 175, 55, 0.95) 0%, rgba(180, 140, 40, 0.92) 100%);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 30px rgba(15, 23, 42, 0.08);
  --body-gradient:
    radial-gradient(ellipse 90% 80% at 0% 20%, rgba(251, 191, 36, 0.14) 0%, transparent 50%),
    radial-gradient(ellipse 80% 70% at 100% 0%, rgba(96, 165, 250, 0.12) 0%, transparent 48%),
    linear-gradient(180deg, #f8fafc 0%, #eef2f7 45%, #f4f6fb 100%);
  --welcome-gradient:
    radial-gradient(ellipse 88% 72% at 0% 32%, rgba(251, 191, 36, 0.18) 0%, transparent 52%),
    radial-gradient(ellipse 78% 68% at 50% 42%, rgba(147, 197, 253, 0.2) 0%, transparent 48%),
    linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  --table-header-bg: #e2e8f0;
  --table-row-alt: #f1f5f9;
  --table-hover: #fef9e8;
  --input-focus-ring: rgba(212, 175, 55, 0.28);
  --crm-tab-active-bg: #fde68a;
  --crm-tab-active-border: #d4a017;
  --audit-tab-bg: #f1f5f9;
  --audit-tab-active-bg: linear-gradient(135deg, rgba(253, 230, 138, 0.95), rgba(254, 243, 199, 0.9));
  --audit-tab-active-fg: #422006;
  --chart-surface: #ffffff;
  --chart-plot-bg: #f1f5f9;
  --chart-grid: rgba(100, 116, 139, 0.22);
  --chart-axis: rgba(71, 85, 105, 0.4);
}

html[data-theme="dark"] {
  --bg: #0c0f14;
  --bg-elevated: #141a22;
  --surface: #1a222d;
  --bg-card: #1a222d;
  --border: rgba(255, 255, 255, 0.09);
  --glass-border: rgba(255, 255, 255, 0.06);
  --text: #e8eaed;
  --muted: #9ca3af;
  --text-on-accent: #0c0f14;
  --sidebar-bg: #11161d;
  --sidebar-active: linear-gradient(135deg, rgba(212, 175, 55, 0.92) 0%, rgba(165, 120, 25, 0.9) 100%);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.5);
  --body-gradient:
    radial-gradient(ellipse 75% 55% at 15% 10%, rgba(59, 130, 246, 0.14) 0%, transparent 45%),
    linear-gradient(180deg, #10151c 0%, #0c0f14 55%, #0a0c10 100%);
  --welcome-gradient:
    radial-gradient(ellipse 80% 60% at 30% 20%, rgba(59, 130, 246, 0.12) 0%, transparent 50%),
    linear-gradient(180deg, #141a22 0%, #0c0f14 100%);
  --table-header-bg: #252d3a;
  --table-row-alt: rgba(255, 255, 255, 0.045);
  --table-hover: rgba(251, 191, 36, 0.14);
  --input-focus-ring: rgba(251, 191, 36, 0.35);
  --crm-tab-active-bg: rgba(212, 175, 55, 0.28);
  --crm-tab-active-border: #eab308;
  --audit-tab-bg: #1e2733;
  --audit-tab-active-bg: linear-gradient(135deg, rgba(212, 175, 55, 0.35), rgba(180, 130, 30, 0.28));
  --audit-tab-active-fg: #fef3c7;
  --chart-surface: #1e2733;
  --chart-plot-bg: #151c26;
  --chart-grid: rgba(255, 255, 255, 0.07);
  --chart-axis: rgba(255, 255, 255, 0.16);
}

html[data-theme="cream"][data-accent="gold"] {
  --accent: #8b6914;
  --accent-hover: #a67c00;
  --gold-muted: #6b5420;
  --input-focus-ring: rgba(139, 105, 20, 0.38);
}

html[data-theme="light"][data-accent="gold"] {
  --accent: #b8860b;
  --accent-hover: #c9a227;
  --gold-muted: #9a7209;
  --input-focus-ring: rgba(212, 175, 55, 0.28);
}

html[data-theme="dark"][data-accent="gold"] {
  --accent: #d4a017;
  --accent-hover: #eab308;
  --gold-muted: #ca8a04;
  --text-on-accent: #1a1204;
}

html[data-accent="navy"] {
  --accent: #1d4ed8;
  --accent-hover: #2563eb;
  --gold-muted: #1e3a8a;
  --sidebar-active: linear-gradient(135deg, #2563eb 0%, #1e3a8a 100%);
  --input-focus-ring: rgba(37, 99, 235, 0.35);
}

html[data-theme="dark"][data-accent="navy"] {
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --gold-muted: #93c5fd;
  --text-on-accent: #0c1929;
}

html[data-accent="teal"] {
  --accent: #0d9488;
  --accent-hover: #14b8a6;
  --gold-muted: #115e59;
  --sidebar-active: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
  --input-focus-ring: rgba(13, 148, 136, 0.35);
}

html[data-theme="dark"][data-accent="teal"] {
  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --gold-muted: #5eead4;
  --text-on-accent: #042f2e;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  overflow-x: hidden;
  background-color: var(--bg);
  background-image: var(--body-gradient);
  background-size: 100% 100%;
  background-attachment: fixed;
  animation: bg-shift-audit 48s ease-in-out infinite alternate;
}

/* Disabled: blurred duplicate layer washed out text on light UI */
body::before {
  content: none;
  display: none;
}

@keyframes bg-shift-audit {
  0% {
    background-position: 0% 20%, 40% 30%, 100% 15%, 60% 80%, 0% 0%;
  }
  50% {
    background-position: 15% 35%, 55% 20%, 85% 40%, 45% 70%, 0% 50%;
  }
  100% {
    background-position: 30% 45%, 70% 35%, 70% 25%, 30% 85%, 0% 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  body,
  body::before {
    animation: none;
  }
}

html[data-theme="dark"] body {
  animation: none;
}

/* Floating appearance control — enterprise-style compact panel */
.crm-appearance {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 9998;
  font-family: var(--font);
}

.crm-appearance__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.crm-appearance__toggle:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: var(--bg-elevated);
}

.crm-appearance__toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.crm-appearance__gear {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
}

.crm-appearance__panel {
  display: none;
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.6rem);
  width: min(17.5rem, calc(100vw - 2rem));
  padding: 1rem 1.05rem 1.1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.crm-appearance--open .crm-appearance__panel {
  display: block;
}

.crm-appearance__heading {
  margin: 0 0 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.crm-appearance__heading:not(:first-child) {
  margin-top: 1rem;
}

.crm-appearance__seg {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.crm-appearance__seg--swatches {
  gap: 0.45rem;
}

.crm-appearance__seg-btn {
  flex: 1 1 30%;
  min-width: 0;
  padding: 0.42rem 0.35rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--pill-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.crm-appearance__seg-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: var(--bg-elevated);
}

.crm-appearance__seg-btn--on {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  color: var(--text);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
}

html[data-theme="dark"] .crm-appearance__seg-btn--on {
  background: color-mix(in srgb, var(--accent) 28%, var(--surface));
  color: var(--text);
}

.crm-appearance__swatch {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--swatch, var(--surface));
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32);
  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.crm-appearance__swatch:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
}

.crm-appearance__swatch--on {
  border-color: color-mix(in srgb, var(--accent) 65%, var(--border));
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--accent) 24%, transparent),
    inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.company-stats--org {
  max-height: none;
}

.hr-exec-hub__head h2 {
  margin-bottom: 0.35rem;
}

.hr-exec-hub__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin: 1rem 0 1.25rem;
}

.hr-exec-hub__open {
  flex-shrink: 0;
}

.hr-exec-hub__url {
  font-size: 0.88rem;
  color: var(--muted);
  min-width: 0;
}

.hr-exec-hub__url code {
  font-size: 0.85em;
  word-break: break-all;
}

.hr-exec-hub__embed {
  margin: 0.5rem 0 1.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  background: var(--surface);
}

.hr-exec-hub__embed summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.hr-exec-hub__frame-wrap {
  margin-top: 0.75rem;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.hr-exec-hub__frame {
  display: block;
  width: 100%;
  height: min(72vh, 820px);
  border: 0;
}

.hr-exec-hub__steps {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.hr-exec-hub__steps-title {
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

.hr-exec-hub__steps ol {
  margin: 0;
  padding-left: 1.25rem;
}

.hr-exec-hub__steps li {
  margin-bottom: 0.35rem;
}

/* Human Resources expandable group + sub-links */
.crm-side-details {
  border-radius: 12px;
  border: 1px solid transparent;
}

.crm-side-details.crm-side-details--active {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.crm-side-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  border: 1px solid transparent;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.crm-side-summary::-webkit-details-marker {
  display: none;
}

.crm-side-summary::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  margin-left: 0.15rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  opacity: 0.55;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.crm-side-details[open] > .crm-side-summary::after {
  transform: rotate(135deg);
  margin-top: 0.15rem;
}

.crm-side-summary:hover {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.crm-side-details--active > .crm-side-summary {
  background: var(--sidebar-active);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.crm-side-details--active > .crm-side-summary::after {
  opacity: 0.85;
  border-color: #fff;
}

.crm-side-subnav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.35rem 0 0.5rem 0.45rem;
  margin: 0 0 0 0.35rem;
  border-left: 2px solid color-mix(in srgb, var(--accent) 32%, transparent);
}

.crm-side-subitem {
  display: block;
  padding: 0.42rem 0.55rem;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
  border: 1px solid transparent;
  text-decoration: none;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease;
}

.crm-side-subitem:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.crm-side-subitem.active {
  color: #fff;
  background: color-mix(in srgb, var(--sidebar-active) 88%, #000 12%);
  border-color: color-mix(in srgb, var(--accent) 48%, transparent);
  font-weight: 600;
}

/* HR Executive in-app dashboard — theme-aware (avoid dark overlay on cream: it washes out chart labels) */
.hr-exec-page {
  background: linear-gradient(160deg, rgba(8, 22, 32, 0.35) 0%, var(--surface) 42%, var(--surface) 100%);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: 14px;
  padding: 1rem 1.25rem 1.5rem;
  max-width: 100%;
}

html[data-theme="cream"] .hr-exec-page {
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--accent) 16%, var(--surface)) 0%,
    var(--surface) 48%,
    var(--surface) 100%
  );
}

.hr-exec-plot-mount {
  background: var(--chart-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.35rem;
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.06);
}

.hr-exec-plot-mount--wide {
  grid-column: 1 / -1;
}

.hr-exec-plot-mount--scroll {
  overflow-x: auto;
  overflow-y: hidden;
}

.hr-exec-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
  align-items: start;
}

@media (max-width: 900px) {
  .hr-exec-layout {
    grid-template-columns: 1fr;
  }

  .hr-exec-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .hr-exec-nav__label {
    display: none;
  }
}

.hr-exec-nav {
  position: static;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  padding: 0.55rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  background: color-mix(in srgb, var(--bg-elevated) 94%, transparent);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.hr-exec-nav__label {
  margin: 0 0.25rem 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 70%, var(--muted));
  white-space: nowrap;
}

.hr-exec-nav__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0.45rem 0.75rem;
  margin: 0;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--text);
  border: 1px solid transparent;
  white-space: nowrap;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.hr-exec-nav__item:hover {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  color: var(--text);
}

.hr-exec-nav__item.is-active {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent) 36%, var(--surface)),
    color-mix(in srgb, var(--accent) 18%, var(--surface))
  );
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  color: var(--text);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 16%, transparent);
}

.hr-exec-content {
  min-width: 0;
}

.hr-exec-title {
  margin: 0.25rem 0 0.75rem;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
}

.hr-exec-source {
  margin: 0 0 1rem;
  word-break: break-word;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.5;
}

.hr-exec-source-list {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
  max-height: 11rem;
  overflow: auto;
}

.hr-exec-source-list li {
  margin: 0.2rem 0;
}

.hr-exec-path {
  font-size: 0.82rem;
  color: var(--text);
}

.hr-exec-hint {
  color: color-mix(in srgb, var(--text) 55%, var(--muted));
  margin-top: 0.35rem;
}

.hr-exec-page .sub {
  color: color-mix(in srgb, var(--text) 88%, var(--muted));
  font-size: 0.92rem;
  line-height: 1.5;
}

.hr-exec-page .sub kbd {
  font-size: 0.8em;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.hr-exec-banner {
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.hr-exec-banner--warn {
  background: color-mix(in srgb, #f59e0b 12%, var(--surface));
  border: 1px solid color-mix(in srgb, #f59e0b 35%, var(--border));
}

.hr-exec-banner--error {
  background: color-mix(in srgb, #ef4444 12%, var(--surface));
  border: 1px solid color-mix(in srgb, #ef4444 35%, var(--border));
}

.hr-exec-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.hr-exec-filters--stack {
  flex-direction: column;
  align-items: stretch;
}

.hr-exec-filters__field > span:first-child {
  color: var(--text);
  font-weight: 600;
  font-size: 0.88rem;
}

.hr-exec-filters__field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  min-width: min(100%, 200px);
}

.hr-exec-filters__field input,
.hr-exec-filters__field select {
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.hr-exec-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.hr-exec-metrics--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hr-exec-metrics--5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.hr-exec-metrics--6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.hr-exec-metrics--7 {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

@media (max-width: 720px) {
  .hr-exec-metrics,
  .hr-exec-metrics--3,
  .hr-exec-metrics--5,
  .hr-exec-metrics--6,
  .hr-exec-metrics--7 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.hr-exec-metric {
  padding: 0.65rem 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  text-align: center;
}

.hr-exec-metric__v {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.hr-exec-metric__l {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hr-exec-charts {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.hr-exec-charts--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 900px) {
  .hr-exec-charts--2 {
    grid-template-columns: 1fr;
  }
}

.hr-exec-plot {
  min-height: 320px;
  width: 100%;
}

.hr-exec-plot--tall {
  min-height: 420px;
}

.hr-exec-plot--heatmap {
  min-height: 520px;
}

.hr-exec-glass {
  padding: 1rem 1.15rem;
  border-radius: 12px;
  margin: 1rem 0;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  line-height: 1.55;
}

.hr-exec-glass__h {
  margin: 0.75rem 0 0.35rem;
  font-size: 1rem;
}

.hr-exec-glass__h:first-child {
  margin-top: 0;
}

.hr-exec-details {
  margin-top: 1rem;
}

.hr-exec-table-wrap {
  overflow: auto;
  max-height: 360px;
  margin-top: 0.5rem;
}

.hr-exec-table-wrap--tall {
  max-height: 520px;
}

.hr-exec-table-wrap table {
  font-size: 0.8rem;
}

.hr-demo-click-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.hr-demo-click-panel__count {
  flex: 0 0 auto;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
}

.hr-demo-click-table td,
.hr-demo-click-table th {
  white-space: nowrap;
}

.hr-bi-report {
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-elevated) 94%, transparent);
  padding: 0.85rem;
  margin: 0 0 1rem;
}

.hr-bi-slicers {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr)) minmax(210px, 1.4fr) auto auto;
  gap: 0.55rem;
  align-items: end;
}

.hr-bi-slicers label {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  min-width: 0;
  font-size: 0.76rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--text) 82%, var(--muted));
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hr-bi-slicers select,
.hr-bi-slicers input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0.48rem 0.55rem;
  font: inherit;
  text-transform: none;
  letter-spacing: 0;
}

.hr-bi-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.hr-bi-kpis > div,
.hr-bi-insights > div {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 0.65rem 0.7rem;
}

.hr-bi-kpis span {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
}

.hr-bi-kpis small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hr-bi-insights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.hr-bi-insights strong,
.hr-bi-insights span {
  display: block;
}

.hr-bi-insights strong {
  margin-bottom: 0.25rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .hr-bi-slicers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hr-bi-kpis,
  .hr-bi-insights {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 650px) {
  .hr-bi-slicers,
  .hr-bi-kpis,
  .hr-bi-insights {
    grid-template-columns: 1fr;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.org-table-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.25rem;
  margin-bottom: 0.35rem;
}

.org-table-head__titles {
  min-width: 0;
  flex: 1 1 200px;
}

.org-table-head__titles h2 {
  margin-bottom: 0.35rem;
}

.org-table-head__search {
  flex: 0 1 min(100%, 280px);
}

.org-emp-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.85rem 0.55rem 2.25rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.65rem 50%;
  background-size: 1rem 1rem;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.org-emp-search-input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

.org-emp-search-input:hover {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
}

.org-emp-search-input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: 0 0 0 3px var(--input-focus-ring);
}

.org-emp-search-meta {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
}

.hr-table-scroll--in-glass {
  margin-top: 0.5rem;
  max-height: calc(100vh - 220px);
}

p.hint--org {
  margin: 0.5rem 0 0;
}

.crm-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
}

.crm-sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1.1rem 0.7rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.06);
}

.crm-side-brand {
  display: block;
  margin: 0 0.35rem 1.1rem;
  padding: 0.7rem 0.65rem;
  border-radius: 12px;
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(180deg, #1d4ed8 0%, #1e3a8a 100%);
  border: 1px solid rgba(59, 130, 246, 0.35);
  box-shadow: var(--shadow-md);
}

.crm-side-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.crm-side-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  color: var(--text);
  font-size: 0.94rem;
  font-weight: 500;
  line-height: 1.4;
  border: 1px solid transparent;
  text-decoration: none;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease;
}

.crm-side-item__ico {
  flex-shrink: 0;
  width: 1.45rem;
  text-align: center;
  font-size: 1.02rem;
  line-height: 1.35;
  margin-top: 0.06rem;
  white-space: nowrap;
}

.crm-side-item__txt {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.crm-side-item:hover {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.crm-side-item.active {
  background: var(--sidebar-active);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  color: #fff;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.crm-side-item.active .crm-side-item__ico {
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

.crm-main {
  min-width: 0;
  position: relative;
  min-height: 100vh;
  background: var(--bg);
}

.crm-top-tabs {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 1rem;
  backdrop-filter: blur(12px);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--surface) 70%, transparent) inset;
}

.crm-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.crm-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.72rem;
  border-radius: 999px;
  font-size: 0.83rem;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--pill-bg);
}

.crm-tab:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--text);
}

.crm-tab.active {
  color: var(--text);
  background: var(--crm-tab-active-bg);
  border-color: var(--crm-tab-active-border);
}

.top-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  margin-right: 1rem;
}

.top-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--muted);
  border: 1px solid transparent;
  background: var(--pill-bg);
}

.top-tab:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
}

.top-tab.active {
  color: var(--text-on-accent);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.crm-userbar {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.crm-userbar .secondary {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.88rem;
  max-width: 28ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-main .crm-userbar .btn-ghost {
  border-radius: 999px;
  padding: 0.5rem 1.15rem;
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(8px);
}

.crm-main .crm-userbar .btn-ghost:hover {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text);
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
}

.shell {
  width: min(96vw, 1400px);
  margin: 0 auto;
  padding: clamp(1rem, 2vw, 1.5rem) clamp(0.75rem, 1.8vw, 1.25rem);
}

.crm-main .shell.dashboard {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: clamp(1rem, 2vw, 1.5rem) clamp(1.1rem, 2.2vw, 1.75rem) 2.5rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  padding: 0.75rem 0 2rem;
}

.brand {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand span.brand-crm,
.brand .brand-text span {
  color: var(--accent);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
  position: relative;
  left: 0;
}

.brand-lockup:hover {
  color: inherit;
}

.brand-logo-live {
  position: absolute;
  left: 1.45rem;
  top: 50%;
  width: 4.8rem;
  height: 4.8rem;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 30%, transparent) 0%, transparent 64%);
  filter: blur(8px);
  opacity: 0.55;
  pointer-events: none;
  animation: brand-logo-aura 4s ease-in-out infinite;
}

.brand-logo-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem;
  background: var(--surface);
  border-radius: 14px;
  box-shadow:
    var(--shadow-md),
    inset 0 1px 0 color-mix(in srgb, var(--surface) 85%, #fff);
  flex-shrink: 0;
}

/* company logo — AUDIT: white tile; dashboard keeps it calm */
.crm-main img.brand-logo {
  height: 52px;
  width: auto;
  max-width: 80px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  filter: none;
  animation: none;
}

img.brand-logo {
  height: 72px;
  width: auto;
  max-width: 96px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 12px rgba(15, 23, 42, 0.12));
  animation: logo-float 9s ease-in-out infinite alternate;
}

.brand-logo--live {
  position: relative;
  z-index: 1;
  animation:
    logo-float 7s ease-in-out infinite alternate,
    brand-logo-tilt 4.8s ease-in-out infinite;
}

@keyframes logo-float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(3px) scale(1.02); }
  100% { transform: translateY(0px); }
}

@keyframes brand-logo-tilt {
  0%,
  100% {
    filter: drop-shadow(0 4px 12px rgba(15, 23, 42, 0.12));
    transform: translateY(0) rotate(0deg) scale(1);
  }
  50% {
    filter:
      drop-shadow(0 8px 18px rgba(15, 23, 42, 0.15))
      drop-shadow(0 0 18px color-mix(in srgb, var(--accent) 28%, transparent));
    transform: translateY(-3px) rotate(-2deg) scale(1.04);
  }
}

@keyframes brand-logo-aura {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0.35;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.08);
    opacity: 0.72;
  }
}

.brand-text {
  font-weight: 700;
  font-size: 1.18rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* Dashboard header — gold caps like AUDIT APP */
.brand-text--audit {
  font-size: clamp(0.72rem, 1.35vw, 0.95rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.35;
  text-transform: uppercase;
  color: var(--gold-muted);
  text-shadow: none;
  max-width: min(52ch, 72vw);
}

.brand-text-animated span {
  display: inline-block;
  animation: brand-wave 1.4s ease-in-out infinite;
}

@keyframes brand-wave {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.9;
  }
  50% {
    transform: translateY(-2px);
    opacity: 1;
  }
}

.nav-links {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.nav-links a.secondary {
  color: var(--muted);
}
.nav-links a.secondary:hover {
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius);
  border: none;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: var(--pill-bg);
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
}

.hero {
  display: grid;
  gap: 2.5rem;
  padding: 2rem 0 4rem;
}

@media (min-width: 840px) {
  .hero {
    grid-template-columns: 1fr 1fr;
    align-items: center;
    padding: 3rem 0 5rem;
  }
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 1rem;
}

.hero p.lead {
  color: var(--muted);
  font-size: 1.1rem;
  margin: 0 0 1.75rem;
  max-width: 36ch;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.card-visual {
  background: linear-gradient(145deg, var(--surface), var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.card-visual h3 {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.stat {
  background: var(--table-row-alt);
  border-radius: var(--radius);
  padding: 1rem;
  border: 1px solid var(--border);
}

.stat strong {
  display: block;
  font-size: 1.35rem;
  color: var(--accent);
}

.stat span {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Full-screen shell for landing + login */
.auth-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 1.75rem 1.5rem 2.5rem;
}

/* Welcome (/) page — same light system as app */
body:has(.auth-shell--welcome) {
  background-color: #eef3fa;
  background-image:
    radial-gradient(circle at 18% 18%, color-mix(in srgb, var(--accent) 18%, transparent) 0 9rem, transparent 22rem),
    radial-gradient(circle at 82% 72%, rgba(37, 99, 235, 0.14) 0 10rem, transparent 24rem),
    linear-gradient(135deg, #f8fbff 0%, #eef4fb 42%, #e5edf7 100%);
  background-size: 140% 140%, 130% 130%, 100% 100%;
  animation: landing-bg-drift 22s ease-in-out infinite alternate;
}

body:has(.auth-shell--welcome)::before {
  content: "";
  display: block;
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.36;
  filter: none;
  background-image:
    linear-gradient(115deg, transparent 0 44%, rgba(212, 175, 55, 0.2) 45%, transparent 47% 100%),
    linear-gradient(35deg, transparent 0 54%, rgba(29, 78, 216, 0.12) 55%, transparent 57% 100%);
  background-size: 34rem 34rem, 42rem 42rem;
  animation: landing-line-flow 28s linear infinite;
}

.landing-orbit,
.landing-logo-watermark {
  position: fixed;
  inset: auto;
  z-index: 0;
  pointer-events: none;
}

.landing-orbit {
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 999px;
  filter: blur(0.2px);
  opacity: 0.48;
}

.landing-orbit--one {
  width: min(42vw, 34rem);
  height: min(42vw, 34rem);
  left: -10rem;
  top: 8rem;
  animation: landing-orbit-one 18s ease-in-out infinite alternate;
}

.landing-orbit--two {
  width: min(34vw, 28rem);
  height: min(34vw, 28rem);
  right: 8vw;
  bottom: 6rem;
  border-color: rgba(37, 99, 235, 0.18);
  animation: landing-orbit-two 20s ease-in-out infinite alternate;
}

.landing-logo-watermark {
  width: min(36vw, 28rem);
  height: min(36vw, 28rem);
  right: 10vw;
  top: 15vh;
  opacity: 0.055;
  background-image: var(--landing-logo-url);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  filter: saturate(1.2);
  animation: landing-logo-watermark 16s ease-in-out infinite alternate;
}

.auth-shell--welcome::before {
  content: "";
  position: fixed;
  width: 18rem;
  height: 18rem;
  left: 16vw;
  bottom: 16vh;
  z-index: 0;
  pointer-events: none;
  border-radius: 4rem;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, transparent), transparent 58%),
    linear-gradient(45deg, rgba(37, 99, 235, 0.12), transparent 62%);
  transform: rotate(45deg);
  filter: blur(1px);
  opacity: 0.48;
  animation: landing-diamond-float 14s ease-in-out infinite alternate;
}

.auth-shell--welcome .hero h1 {
  color: var(--text);
  text-shadow: none;
}

.auth-shell--welcome .hero p.lead {
  color: var(--muted);
  text-shadow: none;
}

.auth-shell--welcome .topbar .nav-links a,
.auth-shell--welcome .topbar .brand {
  text-shadow: none;
}

.auth-shell--welcome .card-visual {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(155deg, color-mix(in srgb, var(--surface) 84%, transparent), color-mix(in srgb, var(--bg-elevated) 88%, transparent)),
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 34%);
  border-color: color-mix(in srgb, var(--accent) 18%, var(--border));
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(10px);
  animation: landing-card-rise 0.9s ease-out both;
}

.auth-shell--welcome .card-visual::after {
  content: "";
  position: absolute;
  inset: -40% auto auto -20%;
  width: 45%;
  height: 180%;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.32), transparent);
  transform: rotate(18deg);
  animation: landing-card-sheen 6s ease-in-out infinite;
}

.auth-shell--welcome .stat {
  background: var(--table-row-alt);
  border-color: var(--border);
}

.auth-shell--welcome .stat span {
  color: var(--muted);
}

body:has(.auth-shell--welcome) footer.landing-foot {
  position: relative;
  z-index: 1;
  color: var(--muted);
  text-shadow: none;
}

@keyframes landing-bg-drift {
  0% { background-position: 0% 12%, 100% 88%, 0% 0%; }
  100% { background-position: 24% 34%, 70% 56%, 0% 0%; }
}

@keyframes landing-line-flow {
  0% { background-position: 0 0, 0 0; }
  100% { background-position: 34rem 34rem, -42rem 42rem; }
}

@keyframes landing-orbit-one {
  0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  100% { transform: translate3d(5rem, 2rem, 0) rotate(14deg) scale(1.08); }
}

@keyframes landing-orbit-two {
  0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  100% { transform: translate3d(-3rem, -2rem, 0) rotate(-12deg) scale(0.94); }
}

@keyframes landing-logo-watermark {
  0% { transform: translateY(0) rotate(-4deg) scale(0.96); }
  100% { transform: translateY(1.5rem) rotate(4deg) scale(1.04); }
}

@keyframes landing-diamond-float {
  0% { transform: translateY(0) rotate(45deg) scale(0.9); }
  100% { transform: translateY(-2rem) rotate(58deg) scale(1.05); }
}

@keyframes landing-card-rise {
  0% { opacity: 0; transform: translateY(1rem) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes landing-card-sheen {
  0%, 38% { transform: translateX(0) rotate(18deg); opacity: 0; }
  48% { opacity: 1; }
  70%, 100% { transform: translateX(340%) rotate(18deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  body:has(.auth-shell--welcome),
  body:has(.auth-shell--welcome)::before,
  .landing-orbit,
  .landing-logo-watermark,
  .auth-shell--welcome::before,
  .auth-shell--welcome .card-visual,
  .auth-shell--welcome .card-visual::after {
    animation: none;
  }
}

.auth-shell .topbar {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}

/* --- Lamp login split (sign-in) --- */
.auth-shell--lamp {
  justify-content: flex-start;
  gap: 0.5rem;
}

.auth-shell--lamp.auth-shell--lamp-off {
  /* much darker scene when off */
  filter: brightness(0.25);
}

.login-split {
  flex: 1;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: stretch;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  gap: clamp(1rem, 3vw, 2rem);
}

@media (max-width: 900px) {
  .login-split {
    grid-template-columns: 1fr;
  }
}

.lamp-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(260px, 36vh, 400px);
  border-radius: calc(var(--radius) + 14px);
  overflow: hidden;
  background:
    radial-gradient(ellipse 85% 55% at 50% 62%, rgba(255, 235, 200, 0.42), transparent 58%),
    radial-gradient(circle at 15% 25%, rgba(209, 107, 25, 0.35), transparent 45%),
    radial-gradient(circle at 88% 30%, rgba(45, 71, 161, 0.45), transparent 48%),
    linear-gradient(165deg, #070a12 0%, #0c1020 55%, #06080f 100%);
  box-shadow:
    inset 0 0 0 1px rgba(250, 250, 250, 0.06),
    0 28px 60px rgba(0, 0, 0, 0.45);
}

.lamp-stage--off::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 35%, rgba(0, 0, 0, 0.2), transparent 65%),
    radial-gradient(ellipse 90% 80% at 50% 50%, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.97));
  pointer-events: none;
}

/* When OFF, only show the lamp column, hide the form column completely */
.auth-shell--lamp-off .login-split {
  grid-template-columns: 1fr;
}

.auth-shell--lamp-off .login-split__form {
  display: none;
}

.auth-shell--lamp:not(.auth-shell--lamp-off) .login-split__form {
  display: flex;
}

.login-split__form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0 1rem;
}

.login-split__form--hidden {
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  filter: blur(4px);
  pointer-events: none;
  transition:
    opacity 0.4s ease,
    transform 0.4s ease,
    filter 0.4s ease;
}

.auth-shell--lamp:not(.auth-shell--lamp-off) .login-split__form {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: none;
}

.panel--lamp-login {
  max-width: 440px;
  width: 100%;
  margin: 0;
  border-radius: calc(var(--radius) + 10px);
  background:
    radial-gradient(circle at 0% 0%, rgba(250, 204, 21, 0.08), transparent 52%),
    radial-gradient(circle at 100% 100%, rgba(59, 130, 246, 0.12), transparent 55%),
    rgba(22, 24, 32, 0.92);
  border: 1px solid rgba(250, 250, 250, 0.12);
  box-shadow:
    0 0 0 1px rgba(250, 204, 21, 0.12),
    0 0 48px rgba(250, 204, 21, 0.06),
    0 0 72px rgba(59, 130, 246, 0.08),
    0 32px 64px rgba(0, 0, 0, 0.55);
}

.panel-kicker {
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(203, 213, 245, 0.65);
  margin: 0 0 0.35rem;
  font-weight: 600;
}

.btn-login-glow {
  box-shadow: 0 0 24px rgba(250, 204, 21, 0.35);
}
.btn-login-glow:hover {
  box-shadow: 0 0 32px rgba(253, 224, 71, 0.45);
}

.panel--lamp-login .form-group input {
  background: rgba(10, 14, 28, 0.95);
  border-color: rgba(148, 163, 184, 0.35);
}

.panel--lamp-login .form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.22);
}

.login-form--error .form-group input#password {
  border-color: rgba(248, 113, 113, 0.85);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2), 0 0 28px rgba(248, 113, 113, 0.12);
}

/* Lamp illustration */
.lamp {
  position: relative;
  width: 340px;
  height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  transform: translateY(10px) scale(1.02);
  animation: lamp-float 6s ease-in-out infinite;
}

@keyframes lamp-float {
  0%,
  100% {
    transform: translateY(6px);
  }
  50% {
    transform: translateY(-4px);
  }
}

.lamp-beam {
  position: absolute;
  top: 62%;
  left: 50%;
  width: 500px;
  height: 360px;
  transform: translate(-50%, -22%);
  background:
    radial-gradient(ellipse 70% 60% at 50% 35%, rgba(255, 246, 220, 0.85), transparent 70%);
  filter: blur(22px);
  opacity: 0.8;
  pointer-events: none;
  animation: lamp-pulse 3.2s ease-in-out infinite;
}

/* Beam is fully off before the pull */
.auth-shell--lamp-off .lamp-beam {
  opacity: 0;
}

@keyframes lamp-pulse {
  0%,
  100% {
    opacity: 0.65;
  }
  50% {
    opacity: 0.9;
  }
}

.lamp-shade {
  position: relative;
  z-index: 2;
  width: 260px;
  height: 170px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.9)),
    url("../img/lamp-photo.png") center / cover no-repeat;
  border-radius: 999px;
  box-shadow:
    inset 0 -10px 18px rgba(0, 0, 0, 0.15),
    0 20px 36px rgba(0, 0, 0, 0.55);
}

/* Hide cartoon face so only photo lamp shows */
.lamp-face,
.lamp-eye,
.lamp-mouth {
  display: none;
}

.lamp-neck {
  z-index: 1;
  width: 30px;
  height: 40px;
  margin-top: -10px;
  background: linear-gradient(180deg, #d4d4d8, #9ca3af 60%, #6b7280);
  border-radius: 4px;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.2);
}

.lamp-base {
  width: 140px;
  height: 32px;
  margin-top: -4px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.18), transparent 60%),
    linear-gradient(180deg, #6b7280, #4b5563 55%, #1f2937);
  border-radius: 18px 18px 22px 22px;
  box-shadow:
    0 16px 26px rgba(0, 0, 0, 0.55),
    inset 0 2px 0 rgba(255, 255, 255, 0.08);
}

/* Remove lower boxed objects under the picture */
.lamp-neck,
.lamp-base {
  display: none;
}

/* Pull switch / rope */
.lamp-switch {
  position: absolute;
  right: 22%;
  top: 40%;
  display: inline-flex;
  align-items: center;
  flex-direction: row;
  gap: 0.65rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

.lamp-switch__string {
  width: 64px;
  height: 2px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.4), rgba(75, 85, 99, 0.9));
  border-radius: 999px;
  box-shadow: 0 0 4px rgba(15, 23, 42, 0.9);
  transform-origin: left center;
  transition: transform 0.24s ease-out;
}

.lamp-switch__knob {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 0%, #f9fafb, #d1d5db 55%, #6b7280 100%);
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.lamp-switch__hint {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.78);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
}

.lamp-switch:focus-visible {
  outline: 2px solid rgba(250, 204, 21, 0.8);
  outline-offset: 4px;
}

.lamp-switch--pulled .lamp-switch__string {
  transform: rotate(9deg) translateX(6px);
}

.lamp-switch--pulled .lamp-switch__hint {
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

/* Light guide lines toward login form when ON */
.login-split::before,
.login-split::after {
  content: "";
  position: absolute;
  left: 33%;
  width: min(18vw, 180px);
  height: 1.5px;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  transform-origin: left center;
  transition: opacity 0.35s ease;
  z-index: 1;
}

.login-split::before {
  top: 38%;
  transform: rotate(-9deg);
  background: linear-gradient(90deg, rgba(255, 244, 199, 0.78), rgba(250, 204, 21, 0.34), rgba(255, 255, 255, 0));
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.3);
}

.login-split::after {
  top: 56%;
  transform: rotate(10deg);
  background: linear-gradient(90deg, rgba(240, 247, 255, 0.72), rgba(59, 130, 246, 0.3), rgba(255, 255, 255, 0));
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.26);
}

.auth-shell--lamp:not(.auth-shell--lamp-off) .login-split::before,
.auth-shell--lamp:not(.auth-shell--lamp-off) .login-split::after {
  opacity: 1;
}

/* Lamp moods */
.lamp--id .lamp-eye {
  transform: rotate(-10deg) scaleY(1.15);
}
.lamp--id .lamp-eye--r {
  transform: rotate(10deg) scaleY(1.15);
}
.lamp--id .lamp-mouth {
  transform: translateX(-50%) scaleX(1.05);
}

.lamp--password .lamp-eye {
  height: 3px;
  transform: rotate(-18deg);
  background: #2a2115;
}
.lamp--password .lamp-eye--r {
  transform: rotate(18deg);
}
.lamp--password .lamp-mouth {
  border-radius: 999px;
  width: 10px;
  height: 10px;
  border: 3px solid #3a2c18;
}

.lamp--typing .lamp-beam {
  animation-duration: 2s;
}

.lamp--error .lamp-beam {
  background: radial-gradient(ellipse 52% 48% at 50% 32%, rgba(255, 200, 200, 0.45), transparent 62%);
  opacity: 0.85;
}
.lamp--error .lamp-shade {
  background: linear-gradient(180deg, #f0e4e4 0%, #e0c8c8 48%, #c8a8a8 100%);
}
.lamp--error .lamp-eye {
  height: 4px;
  transform: rotate(25deg);
  background: #4a2020;
}
.lamp--error .lamp-eye--r {
  transform: rotate(-25deg);
}
.lamp--error .lamp-mouth {
  border-radius: 999px 999px 0 0;
  border: 3px solid #4a2020;
  border-bottom: none;
  bottom: 0;
}

@media (prefers-reduced-motion: reduce) {
  .lamp,
  .lamp-beam {
    animation: none;
  }
}

/* Glassmorphism login / landing panel */
.panel {
  max-width: 420px;
  margin: 2rem auto;
  background: var(--surface);
  border-radius: 28px;
  border: 1px solid var(--border);
  padding: 2.25rem 2.35rem 2.4rem;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.panel h1 {
  margin: 0 0 0.4rem;
  font-size: 1.7rem;
  text-align: center;
}

.panel .sub {
  color: var(--muted);
  margin: 0 0 1.8rem;
  font-size: 0.96rem;
  text-align: center;
}

.form-group {
  margin-bottom: 1.15rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--input-focus-ring);
}

.form-actions {
  margin-top: 1.5rem;
}

.form-actions .btn-primary {
  width: 100%;
  border-radius: 999px;
  font-size: 0.98rem;
}

.alert {
  background: rgba(254, 226, 226, 0.85);
  border: 1px solid rgba(220, 38, 38, 0.35);
  color: #991b1b;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 1.25rem;
}

.dashboard {
  padding-bottom: 3rem;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* Executive dashboard surface system */
.kpi-card,
.crm-card,
.company-stats,
.modules,
.branch-stats,
.forms-panel,
.plan-nav,
.hr-pane {
  background: color-mix(in srgb, var(--surface) 94%, #fff);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.kpi-card {
  position: relative;
  min-height: 118px;
  padding: 0.9rem 1rem 0.85rem;
  overflow: hidden;
}

.kpi-card::before,
.meta-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  opacity: 0.78;
}

.kpi-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.4rem;
  font-weight: 700;
}

.kpi-value {
  font-size: clamp(1.55rem, 1.9vw, 2.05rem);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.35rem;
  line-height: 1.4;
}

/* Delta indicator on KPI cards — used by executive landing and any pane that
   passes a `delta` / `delta_dir` to pane.kpi_strip(). */
.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.kpi-delta--up   { color: #16a34a; }
.kpi-delta--down { color: #dc2626; }
.kpi-delta--flat { color: var(--muted); }
.kpi-delta-period {
  font-weight: 500;
  color: var(--muted);
  margin-left: 0.15rem;
}
/* Clickable KPI tile (drill-down link) */
.kpi-card--linked {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.kpi-card--linked:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}

/* ── KPI aliases ─────────────────────────────────────────────────────
   Older panes used .card.kpi (execom), or .kpi with .label/.val (odoo).
   These selectors give them the same visual treatment as .kpi-card so
   every pane looks uniform without touching their templates / JS. */
.crm-main .shell.dashboard .execom-pane .card.kpi,
.crm-main .shell.dashboard .odoo-pane .kpi,
.crm-main .shell.dashboard .fastcash-dash .kpi {
  background: color-mix(in srgb, var(--surface) 94%, #fff);
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  position: relative;
  min-height: 118px;
  padding: 0.9rem 1rem 0.85rem;
  overflow: hidden;
}
.crm-main .shell.dashboard .execom-pane .card.kpi::before,
.crm-main .shell.dashboard .odoo-pane .kpi::before,
.crm-main .shell.dashboard .fastcash-dash .kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  opacity: 0.78;
}
.crm-main .shell.dashboard .execom-pane .card.kpi .kpi-label,
.crm-main .shell.dashboard .odoo-pane .kpi .label,
.crm-main .shell.dashboard .fastcash-dash .kpi .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.4rem;
  font-weight: 700;
}
.crm-main .shell.dashboard .execom-pane .card.kpi .value,
.crm-main .shell.dashboard .odoo-pane .kpi .val,
.crm-main .shell.dashboard .fastcash-dash .kpi .val,
.crm-main .shell.dashboard .execom-pane .card.kpi .kpi-value {
  font-size: clamp(1.55rem, 1.9vw, 2.05rem);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.crm-main .shell.dashboard .execom-pane .card.kpi .delta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.35rem;
  font-weight: 600;
}
.crm-main .shell.dashboard .execom-pane .card.kpi .delta.up { color: #16a34a; }
.crm-main .shell.dashboard .execom-pane .card.kpi .delta.down { color: #dc2626; }

/* ── Audit & Compliance — management banner + exceptions + action plan ── */
.audit-mgmt-banner {
  margin: 0 0 1.25rem 0;
  padding: 1rem 1.1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, #fff);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.audit-mgmt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.85rem;
  margin-bottom: 0.8rem;
}
.audit-mgmt-stat { display: flex; flex-direction: column; gap: 0.18rem; }
.audit-mgmt-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--muted);
}
.audit-mgmt-value {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}
.audit-mgmt-value small { font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-left: 0.25rem; }
.audit-mgmt-value--ok { color: #16a34a; }
.audit-mgmt-value--warn { color: #f59e0b; }
.audit-mgmt-value--crit { color: #dc2626; }
.audit-mgmt-narrative {
  margin: 0;
  padding-left: 1.05rem;
  display: grid;
  gap: 0.3rem;
  font-size: 0.88rem;
  color: var(--text);
}
.audit-mgmt-narrative li { line-height: 1.45; }

/* Severity badges + chips for exceptions / action plan tables */
.audit-ex-sev {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.audit-ex-sev--critical { background: #fee2e2; color: #991b1b; }
.audit-ex-sev--high { background: #fef2f2; color: #dc2626; }
.audit-ex-sev--medium { background: #fffbeb; color: #92400e; }
.audit-ex-sev--low { background: #f1f5f9; color: #475569; }
.audit-ex-row--critical { background: rgba(239, 68, 68, 0.04); }
.audit-ex-row--high { background: rgba(239, 68, 68, 0.02); }

.audit-pri {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.audit-pri--critical { background: #fee2e2; color: #991b1b; }
.audit-pri--high { background: #fef2f2; color: #dc2626; }
.audit-pri--medium { background: #fffbeb; color: #92400e; }
.audit-pri--low { background: #f1f5f9; color: #475569; }
.audit-state-chip {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.audit-action-table table,
.audit-exception-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.audit-action-table th,
.audit-action-table td,
.audit-exception-table th,
.audit-exception-table td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}
.audit-action-table th,
.audit-exception-table th {
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.7rem;
  background: color-mix(in srgb, var(--surface) 95%, #fff);
  position: sticky;
  top: 0;
}

/* Embedded Audit & Compliance (Fire Safety) portal */
.audit-portal__head {
  margin-bottom: 1.25rem;
}

.audit-portal__meta {
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.audit-portal__err {
  margin-bottom: 1rem;
}

.audit-portal__kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

.audit-portal__charts {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.audit-portal__charts--overview {
  margin-top: 0.5rem;
}

.audit-portal__charts-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(0, 1.35fr);
  gap: 1rem;
  align-items: stretch;
}

.audit-portal__charts-row--balanced {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 900px) {
  .audit-portal__charts-row {
    grid-template-columns: 1fr;
  }
}

.audit-chart-cell--grow {
  min-width: 0;
}

.audit-chart-block {
  min-width: 0;
}

.audit-chart-block--wide {
  width: 100%;
}

.audit-chart-block--grow {
  min-width: 0;
}

.audit-chart-cell {
  min-height: 380px;
  height: clamp(380px, 38vh, 520px);
  width: 100%;
  background: var(--chart-surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0.2rem;
  box-sizing: border-box;
}

.audit-chart-cell--wide {
  min-height: 460px;
  height: clamp(460px, 44vh, 620px);
}

.audit-chart-cell .js-plotly-plot,
.audit-chart-cell .plot-container,
.audit-chart-cell .svg-container {
  width: 100% !important;
  height: 100% !important;
}

.audit-chart-caption {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.audit-insight-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.75rem;
}

.audit-insight-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 0.75rem 0.85rem;
  box-shadow: var(--shadow-sm);
}

.audit-insight-card span {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.audit-insight-card strong {
  display: block;
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.audit-insight-card p {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.audit-insight-card--blue {
  border-top: 3px solid #2563eb;
}

.audit-insight-card--ok {
  border-top: 3px solid #16a34a;
}

.audit-insight-card--warn {
  border-top: 3px solid #f59e0b;
}

.audit-insight-card--danger {
  border-top: 3px solid #dc2626;
}

.audit-hub__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.audit-hub__tab {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--audit-tab-bg);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.audit-hub__tab:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  color: var(--text);
  background: var(--surface);
}

.audit-hub__tab--active {
  background: var(--audit-tab-active-bg);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  color: var(--audit-tab-active-fg);
  box-shadow: var(--shadow-sm);
}

.audit-hub__panel {
  display: none;
}

.audit-hub__panel--active {
  display: block;
}

.audit-hub__panel-head {
  margin-bottom: 1rem;
}

.audit-hub__panel-head h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1.15rem;
}

.audit-portal__err--soft {
  border-color: rgba(217, 119, 6, 0.35);
  background: rgba(254, 243, 199, 0.6);
  color: #92400e;
  margin-bottom: 1rem;
}

.audit-preview-wrap {
  margin-top: 0.5rem;
  padding: 0.75rem 0.85rem 0.85rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.audit-preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.65rem;
}

.audit-filter-select {
  min-width: 5.5rem;
  max-width: 12rem;
  width: 100%;
  font-size: 0.72rem;
  line-height: 1.2;
  padding: 0.32rem 1.75rem 0.32rem 0.45rem;
  min-height: 1.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  margin-top: 0.2rem;
  appearance: auto;
}

.audit-filter-text {
  display: block;
  width: 100%;
  min-width: 4.5rem;
  max-width: 12rem;
  box-sizing: border-box;
  font-size: 0.7rem;
  padding: 0.28rem 0.4rem;
  margin-top: 0.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.audit-th-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #64748b);
  line-height: 1.25;
  margin-bottom: 0.2rem;
}

.audit-filter-clear {
  flex-shrink: 0;
}

.audit-preview-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.audit-preview-scroll {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  max-height: 420px;
  overflow-y: auto;
  background: var(--surface);
}

.audit-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  background: var(--surface);
}

.audit-preview-table th,
.audit-preview-table td {
  padding: 0.45rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  background: var(--surface);
}

.audit-preview-table tbody tr:nth-child(even) td {
  background: var(--table-row-alt);
  color: var(--text);
}

.audit-preview-table thead th {
  position: sticky;
  top: 0;
  white-space: normal;
  max-width: 14rem;
  background: var(--table-header-bg);
  z-index: 2;
  color: var(--text);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.audit-preview-table tbody tr:hover td {
  background: var(--table-hover);
  color: var(--text);
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 2rem;
  align-items: flex-start;
}

@media (max-width: 960px) {
  .crm-shell {
    grid-template-columns: 1fr;
  }

  .crm-sidebar {
    position: relative;
    height: auto;
  }

  .crm-top-tabs {
    position: relative;
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
  }
}

.dashboard-side {
  min-width: 0;
}

.company-stats {
  background: var(--surface);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 1.25rem 1.35rem 1.5rem;
  max-height: calc(100vh - 180px);
  overflow: auto;
  box-shadow: var(--shadow-md);
}

.company-stats h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.company-stats .sub {
  margin: 0 0 0.85rem;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.5;
}

.company-stats-table-wrapper {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: auto;
}

.company-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.company-stats-table th,
.company-stats-table td {
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.company-stats-table tbody td {
  background: var(--surface);
}

.company-stats-table th {
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--table-header-bg);
}

.company-stats-table tbody tr:nth-child(even) td {
  background: var(--table-row-alt);
}

.mr-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: end;
  margin: 0.4rem 0 0.9rem;
}

.mr-filters label {
  display: grid;
  gap: 0.2rem;
  font-size: 0.74rem;
  color: var(--muted);
}

.mr-filters select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
  min-width: 120px;
}

.mr-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.8rem;
}

.mr-kpi {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
  font-size: 0.76rem;
  color: var(--text);
  background: var(--surface);
}

.mr-kpi-pass {
  border-color: rgba(34, 197, 94, 0.45);
  color: #166534;
  background: rgba(220, 252, 231, 0.7);
}

.mr-kpi-fail {
  border-color: rgba(248, 113, 113, 0.45);
  color: #991b1b;
  background: rgba(254, 226, 226, 0.7);
}

.mr-kpi-pip {
  border-color: rgba(234, 179, 8, 0.5);
  color: #92400e;
  background: rgba(254, 243, 199, 0.7);
}

.state-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.14rem 0.55rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.status-passing {
  background: rgba(220, 252, 231, 0.9);
  border-color: rgba(34, 197, 94, 0.45);
  color: #166534;
}

.status-failing {
  background: rgba(254, 226, 226, 0.9);
  border-color: rgba(248, 113, 113, 0.45);
  color: #991b1b;
}

.status-no_target {
  background: #f1f5f9;
  border-color: rgba(148, 163, 184, 0.4);
  color: #64748b;
}

.warn-red {
  background: rgba(254, 226, 226, 0.95);
  border-color: rgba(239, 68, 68, 0.45);
  color: #991b1b;
}

.warn-yellow {
  background: rgba(254, 243, 199, 0.95);
  border-color: rgba(234, 179, 8, 0.5);
  color: #92400e;
}

.warn-none {
  background: #f1f5f9;
  border-color: rgba(148, 163, 184, 0.4);
  color: #64748b;
}

.pip-yes {
  background: rgba(254, 226, 226, 0.9);
  border-color: rgba(239, 68, 68, 0.45);
  color: #991b1b;
}

.pip-no {
  background: rgba(220, 252, 231, 0.9);
  border-color: rgba(34, 197, 94, 0.45);
  color: #166534;
}

.report-op-pane {
  display: flex;
  flex-direction: column;
}

.report-op-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
  align-items: start;
}

.report-op-slicers {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: #ffffff;
  padding: 0.75rem;
  position: static;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.65rem;
  align-items: end;
  box-shadow: var(--shadow-sm);
}

.report-op-slicers h3 {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.report-op-slicers details,
.report-op-filter {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 10px;
  background: #f8fafc;
  padding: 0.32rem 0.45rem 0.45rem;
  margin: 0;
  min-width: 0;
}

.report-op-slicers summary,
.report-op-filter label {
  cursor: default;
  font-size: 0.76rem;
  color: #334155;
  margin-bottom: 0.28rem;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.report-op-filter label {
  font-weight: 700;
}

.report-op-slicers summary::-webkit-details-marker {
  display: none;
}

.report-op-slicers details summary::before {
  display: none;
}

.report-op-slicers select {
  background: #fff;
  color: var(--text);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
  min-width: 100%;
  width: 100%;
  font-size: 0.78rem;
  line-height: 1.25;
}

.slicer-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.15rem;
  border-radius: 999px;
  background: rgba(253, 230, 138, 0.65);
  border: 1px solid rgba(202, 138, 4, 0.4);
  color: #713f12;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0 0.35rem;
}

.report-op-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0;
  align-items: center;
}

.auto-apply-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.report-op-main {
  min-width: 0;
}

.report-op-hero {
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 18px;
  padding: 1rem 1rem 0.95rem;
  margin-bottom: 0.85rem;
  background:
    radial-gradient(circle at top right, rgba(96, 165, 250, 0.22), transparent 34%),
    linear-gradient(135deg, #eff6ff 0%, #fff7ed 55%, #f8fafc 100%);
  box-shadow: var(--shadow-sm);
}

.report-op-hero__main h3 {
  margin: 0.1rem 0 0.35rem;
  font-size: 1.08rem;
  color: #0f172a;
}

.report-op-hero__main p {
  margin: 0;
  max-width: 78ch;
  font-size: 0.84rem;
  line-height: 1.55;
  color: #475569;
}

.report-op-kicker {
  display: inline-flex;
  margin-bottom: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.report-op-story-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 0.9rem;
}

.report-op-story-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  padding: 0.8rem 0.85rem;
}

.report-op-story-card .step {
  display: inline-flex;
  margin-bottom: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #b45309;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.report-op-story-card strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.88rem;
  color: #0f172a;
}

.report-op-story-card p {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.5;
  color: #475569;
}

.report-op-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.report-op-tab {
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  color: #475569;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  cursor: pointer;
}

.report-op-tab.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.report-op-view {
  display: none;
}

.report-op-view.is-active {
  display: block;
}

.report-op-view h3 {
  margin: 0.1rem 0 0.55rem;
  font-size: 0.95rem;
}

.report-op-view h4 {
  margin: 0.5rem 0 0.55rem;
  font-size: 0.86rem;
  color: #475569;
}

.report-op-goal-input {
  margin: 0 0 0.6rem;
}

.report-op-goal-input label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.report-op-goal-input input {
  background: #fff;
  color: var(--text);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  width: 220px;
}

.report-op-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.8rem;
}

.goal-progress-track {
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #e2e8f0;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.goal-progress-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #60a5fa);
}

.report-op-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.65rem;
}

.report-op-health-grid .meta-card {
  padding: 0.8rem 0.9rem;
}

.report-op-health-grid .meta-card small {
  display: inline-flex;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.delta-pos {
  color: #15803d;
}

.delta-neg {
  color: #b91c1c;
}

.report-op-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.report-op-chart-grid--overview {
  margin-top: 0.75rem;
}

.report-op-chart {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  min-height: 360px;
  height: clamp(360px, 38vh, 520px);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.report-op-block {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: #f8fafc;
  padding: 0.55rem;
  margin-bottom: 0.7rem;
}

.report-op-block h4 {
  margin: 0.15rem 0 0.5rem;
  font-size: 0.86rem;
}

.advanced-mod-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.advanced-mod-grid h5 {
  margin: 0.15rem 0 0.4rem;
}

.advanced-mod-grid label {
  display: grid;
  gap: 0.2rem;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.advanced-mod-grid input {
  background: #fff;
  color: var(--text);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  padding: 0.3rem 0.45rem;
}

.report-op-table-wrap {
  max-height: calc(100vh - 320px);
  overflow: auto;
}

.report-op-table-tools {
  padding: 0.45rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  background: #f8fafc;
}

.report-op-table-tools input {
  width: min(280px, 100%);
  background: #fff;
  color: var(--text);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  padding: 0.32rem 0.45rem;
}

.report-op-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f1f5f9;
  color: #475569;
}

.report-op-tone {
  position: relative;
  overflow: hidden;
}

.report-op-tone::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.85;
}

.report-op-tone--blue {
  color: #1d4ed8;
  background: linear-gradient(135deg, #eff6ff, #ffffff);
}

.report-op-tone--amber {
  color: #b45309;
  background: linear-gradient(135deg, #fff7ed, #ffffff);
}

.report-op-tone--rose {
  color: #be123c;
  background: linear-gradient(135deg, #fff1f2, #ffffff);
}

.report-op-tone--slate {
  color: #475569;
  background: linear-gradient(135deg, #f8fafc, #ffffff);
}

.report-op-tone--teal {
  color: #0f766e;
  background: linear-gradient(135deg, #ecfeff, #ffffff);
}

@media (max-width: 1100px) {
  .report-op-layout {
    grid-template-columns: 1fr;
  }

  .report-op-slicers {
    position: relative;
    top: auto;
  }

  .report-op-chart-grid {
    grid-template-columns: 1fr;
  }

  .advanced-mod-grid {
    grid-template-columns: 1fr;
  }

  .report-op-story-grid {
    grid-template-columns: 1fr;
  }
}

.hr-pane {
  width: 100%;
  max-width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  padding: 1.1rem 1.1rem 1.25rem;
  max-height: calc(100vh - 180px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hr-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.hr-pane-header h2 {
  margin: 0;
  font-size: 1rem;
}

.hr-pane-sub {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.facet-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow: auto;
}

.facet-block h3 {
  margin: 0 0 0.25rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.facet-header-link {
  color: inherit;
  text-decoration: none;
}

.facet-header-link:hover {
  color: var(--text);
}

.facet-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--border);
  max-height: 120px;
  overflow: auto;
}

.facet-item {
  padding: 0;
  font-size: 0.8rem;
  border-bottom: 1px solid rgba(30, 64, 175, 0.3);
}

.facet-item:last-child {
  border-bottom: none;
}

.facet-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.55rem;
  color: inherit;
  text-decoration: none;
}

.facet-link:hover {
  background: #f1f5f9;
}

.facet-label {
  max-width: 12rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.facet-count {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.facet-item.is-active {
  background: rgba(234, 179, 8, 0.18);
  border-left: 3px solid var(--accent);
}

.hr-table-scroll {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  overflow: auto;
  flex: 1 1 auto;
}

.hr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  min-width: 600px;
}

.hr-table th,
.hr-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  white-space: nowrap;
  color: #334155;
}

.hr-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f5f9;
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.hr-table tr:nth-child(even) td {
  background: #f8fafc;
}

.hr-table tr.is-self td {
  background: rgba(253, 230, 138, 0.35);
}

.dashboard-main {
  min-width: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.badge-editable {
  border-color: rgba(34, 197, 94, 0.55);
  color: #166534;
  background: rgba(220, 252, 231, 0.8);
}

.forms-panel {
  background: var(--bg-card);
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem 1.75rem;
}

.forms-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.forms-count {
  font-size: 0.85rem;
  color: var(--muted);
}

.forms-table-wrapper {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: auto;
}

.forms-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.forms-table th,
.forms-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  color: #334155;
}

.forms-table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: #f8fafc;
}

.forms-table tr:nth-child(even) td {
  background: #f8fafc;
}

.forms-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dot-handle {
  font-size: 1.1rem;
  color: var(--muted);
  cursor: move;
}

.forms-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

.btn-small {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

.link-muted {
  color: var(--accent-hover);
}

.link-muted:hover {
  color: #fbbf24;
}

.toggle {
  display: inline-flex;
  align-items: center;
  width: 40px;
  height: 20px;
  border-radius: 999px;
  padding: 2px;
  background: #1f2937;
  border: 1px solid #4b5563;
}

.toggle.on {
  background: #22c55e;
  border-color: #16a34a;
}

.toggle-knob {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #0f172a;
  transform: translateX(0);
}

.toggle.on .toggle-knob {
  background: #ecfdf5;
  transform: translateX(18px);
}

.muted {
  color: var(--muted);
}

.dash-header {
  margin-bottom: 2rem;
}

.dash-header h1 {
  margin: 0;
  font-size: 1.75rem;
}

.dash-header .sub {
  color: var(--muted);
  margin: 0.35rem 0 0;
}

.grid-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.meta-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.meta-card dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.25rem;
}

.meta-card dd {
  margin: 0;
  font-weight: 600;
}

.modules {
  margin-top: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  padding: 1.25rem 1.5rem;
}

.modules h2 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
}

.chip.enabled {
  border-color: rgba(34, 197, 94, 0.5);
  color: #86efac;
}

.branch-stats {
  margin: 1.5rem 0 2rem;
  background: var(--bg-card);
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid var(--border);
  padding: 1rem 1.2rem;
}

.branch-stats h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.branch-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.branch-stats-table th,
.branch-stats-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.branch-stats-table th {
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--muted);
}

.company-link {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.company-link:hover {
  color: var(--accent-hover);
}

.company-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
}

.company-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(4px);
}

.company-overlay-panel {
  position: relative;
  z-index: 41;
  width: min(90vw, 960px);
  max-height: 80vh;
  background: var(--bg-card);
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--border);
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.12);
  padding: 1.25rem 1.5rem 1.4rem;
  display: flex;
  flex-direction: column;
}

.company-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.company-overlay-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.company-overlay-header .sub {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.company-overlay-body {
  flex: 1 1 auto;
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 0.25rem 0.1rem 0.1rem;
  background: #fff;
}

.company-overlay-close {
  white-space: nowrap;
}

/* Facet tiles grid (Company / Department / Position Grouping) */
.facet-tiles {
  margin-bottom: 1.75rem;
}

.facet-tiles-title {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.facet-tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.6rem;
}

.facet-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  color: var(--text);
  text-decoration: none;
  transition:
    background 0.15s ease,
    transform 0.08s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.facet-tile:hover {
  background: #f8fafc;
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.facet-tile.active {
  background: linear-gradient(135deg, #facc15, #f97316);
  border-color: #facc15;
  box-shadow: 0 14px 30px rgba(251, 191, 36, 0.45);
  color: #111827;
}

.facet-tile-label {
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding-right: 0.4rem;
}

.facet-tile-count {
  min-width: 2.4rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  opacity: 0.85;
}

footer.landing-foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 2rem 1rem 3rem;
}

/* Executive display refinements shared by every dashboard pane */
.crm-main .shell.dashboard {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.crm-main .topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  margin: clamp(-1.5rem, -2vw, -1rem) clamp(-1.75rem, -2.2vw, -1.1rem) 0;
  padding: 0.75rem clamp(1.1rem, 2.2vw, 1.75rem);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 color-mix(in srgb, #fff 35%, transparent) inset;
}

.executive-pane-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: end;
  padding: 1rem 1.1rem;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface) 98%, #fff), color-mix(in srgb, var(--bg-elevated) 86%, #fff)),
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 15%, transparent), transparent 62%);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.executive-pane-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.executive-pane-head h1 {
  margin: 0;
  font-size: clamp(1.3rem, 2vw, 1.9rem);
  line-height: 1.12;
  letter-spacing: 0;
}

.executive-pane-head .sub {
  margin: 0.35rem 0 0;
  color: var(--muted);
  line-height: 1.45;
  max-width: 82ch;
}

.executive-pane-meta {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.executive-pane-meta .chip {
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.executive-pane-meta .chip-source {
  color: color-mix(in srgb, var(--accent) 78%, var(--text));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border));
}

.executive-pane-meta .chip.enabled,
.crm-userbar .chip.enabled {
  color: #166534;
  background: rgba(220, 252, 231, 0.88);
  border-color: rgba(34, 197, 94, 0.45);
}

html[data-theme="dark"] .executive-pane-meta .chip.enabled,
html[data-theme="dark"] .crm-userbar .chip.enabled {
  color: #bbf7d0;
  background: rgba(22, 101, 52, 0.34);
  border-color: rgba(74, 222, 128, 0.35);
}

.company-stats,
.crm-card,
.modules,
.branch-stats,
.forms-panel,
.plan-nav,
.hr-pane,
.report-op-block,
.audit-preview-wrap {
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 95%, #fff);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.company-stats {
  padding: 1rem;
}

.company-stats--full,
.hr-exec-page,
.audit-portal {
  max-height: none;
  overflow: visible;
}

.company-stats h2,
.modules h2,
.branch-stats h2,
.report-op-view h3,
.report-op-block h4,
.audit-hub__panel-head h3 {
  color: var(--text);
  letter-spacing: 0;
}

.grid-meta,
.report-op-health-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.75rem;
}

.meta-card {
  position: relative;
  min-height: 96px;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface) 96%, #fff);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 0.95rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.meta-card dd {
  font-size: clamp(1.05rem, 1.45vw, 1.45rem);
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.company-stats-table-wrapper,
.hr-table-scroll,
.forms-table-wrapper,
.audit-preview-scroll,
.report-op-table-wrap {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.company-stats-table,
.hr-table,
.forms-table,
.audit-preview-table {
  background: var(--surface);
}

.company-stats-table th,
.company-stats-table td,
.hr-table th,
.hr-table td,
.forms-table th,
.forms-table td,
.audit-preview-table th,
.audit-preview-table td {
  color: var(--text);
  border-bottom-color: var(--border);
}

.company-stats-table th,
.hr-table th,
.forms-table th,
.audit-preview-table thead th,
.report-op-table thead th {
  background: var(--table-header-bg);
  color: var(--muted);
  font-weight: 800;
}

.company-stats-table tbody td,
.hr-table tbody td,
.forms-table tbody td,
.audit-preview-table tbody td {
  background: var(--surface);
}

.company-stats-table tbody tr:nth-child(even) td,
.hr-table tr:nth-child(even) td,
.forms-table tr:nth-child(even) td,
.audit-preview-table tbody tr:nth-child(even) td {
  background: var(--table-row-alt);
}

.report-op-layout {
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

.report-op-slicers,
.report-op-slicers details,
.report-op-filter,
.report-op-slicers select,
.report-op-goal-input input,
.advanced-mod-grid input,
.report-op-table-tools,
.report-op-table-tools input,
.report-op-tab,
.report-op-chart,
.report-op-block {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.report-op-slicers {
  border-radius: 8px;
}

.report-op-slicers details,
.report-op-filter,
.report-op-slicers select,
.report-op-goal-input input,
.advanced-mod-grid input,
.report-op-table-tools input {
  border-radius: 6px;
}

.report-op-slicers summary,
.report-op-filter label,
.report-op-view h4,
.report-op-hero__main p {
  color: var(--muted);
}

.report-op-hero {
  border-radius: 8px;
  border-color: var(--border);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface) 96%, #fff), color-mix(in srgb, var(--bg-elevated) 90%, #fff));
}

.report-op-hero__main h3 {
  color: var(--text);
}

.report-op-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
}

.report-op-chart {
  min-height: 360px;
  height: clamp(360px, 38vh, 520px);
}

.report-op-tone--blue,
.report-op-tone--amber,
.report-op-tone--rose,
.report-op-tone--slate,
.report-op-tone--teal {
  background: color-mix(in srgb, var(--surface) 95%, #fff);
}

/* Unified pane report template: one frame, one card rhythm, one table style. */
.pane-body,
.crm-main .shell.dashboard .fastcash-pane,
.crm-main .shell.dashboard .fastcash-dash,
.crm-main .shell.dashboard .odoo-pane,
.crm-main .shell.dashboard .execom-pane {
  padding: 0.15rem 0 1rem;
  display: grid;
  gap: var(--pane-gap);
}

.pane-grid,
.crm-main .shell.dashboard .fastcash-pane .grid,
.crm-main .shell.dashboard .fastcash-dash .twocol,
.crm-main .shell.dashboard .odoo-pane .kpis,
.crm-main .shell.dashboard .fastcash-dash .kpis {
  display: grid;
  gap: var(--pane-gap);
  margin: 0;
}

.pane-grid,
.crm-main .shell.dashboard .fastcash-pane .grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.crm-main .shell.dashboard .fastcash-dash .twocol {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.crm-main .shell.dashboard .odoo-pane .kpis,
.crm-main .shell.dashboard .fastcash-dash .kpis {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.pane-kpi-strip,
.crm-main .shell.dashboard .kpi-row {
  gap: var(--pane-gap);
  margin-bottom: var(--pane-gap);
}

.pane-section-card,
.pane-table-card,
.crm-main .shell.dashboard .fastcash-pane .card,
.crm-main .shell.dashboard .fastcash-dash .card,
.crm-main .shell.dashboard .odoo-pane .card,
.crm-main .shell.dashboard .execom-pane .card,
.crm-main .shell.dashboard .report-op-block,
.crm-main .shell.dashboard .audit-hub__panel {
  background: color-mix(in srgb, var(--surface) 96%, #fff);
  border: 1px solid var(--border);
  border-radius: var(--pane-radius);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  margin: 0;
  padding: 1rem;
}

.pane-section-card > h2:first-child,
.pane-section-card > h3:first-child,
.pane-card-head h3,
.crm-main .shell.dashboard .fastcash-pane .card > h2:first-child,
.crm-main .shell.dashboard .fastcash-dash .card > h3:first-child,
.crm-main .shell.dashboard .odoo-pane .card > h2:first-child,
.crm-main .shell.dashboard .execom-pane .card > h2:first-child {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.pane-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.pane-card-head h3 {
  margin-bottom: 0;
}

.pane-card-head h3 span {
  text-transform: none;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.85rem;
}

.pane-card-actions,
.pane-toolbar,
.crm-main .shell.dashboard .execom-pane .controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

/* Unified iframe wrapper — every embedded sub-app uses this exact frame
   so external panes (BIR reporting fallback, Odoo MIS report) feel like
   native CRM cards instead of foreign windows. */
.pane-embed-wrapper {
  position: relative;
  width: 100%;
  height: 78vh;
  min-height: 640px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--pane-radius);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}
.pane-embed-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.pane-embed-wrapper--tall {
  height: 88vh;
  min-height: 720px;
}
.pane-embed-wrapper__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.4rem 0.85rem;
  background: linear-gradient(0deg, rgba(15, 23, 42, 0.62), rgba(15, 23, 42, 0));
  color: #fff;
  font-size: 0.72rem;
  pointer-events: none;
}

.pane-filter-bar {
  padding: 0.85rem 1rem;
  margin-bottom: var(--pane-gap);
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
}

.pane-filter-field {
  display: grid;
  gap: 0.22rem;
}

.pane-filter-field label,
.crm-main .shell.dashboard .fastcash-pane label,
.crm-main .shell.dashboard .execom-pane .muted {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.pane-filter-field select,
.pane-filter-field input,
.pane-card-actions input,
.pane-card-actions select,
.pane-toolbar input,
.pane-toolbar select,
.crm-main .shell.dashboard .fastcash-pane input[type="file"],
.crm-main .shell.dashboard .fastcash-pane input[type="text"],
.crm-main .shell.dashboard .execom-pane .controls select,
.crm-main .shell.dashboard .execom-pane .controls button,
.crm-main .shell.dashboard .execom-pane .controls a.btn {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
}

.crm-main .shell.dashboard .fastcash-pane button,
.crm-main .shell.dashboard .execom-pane .controls button,
.crm-main .shell.dashboard .execom-pane .controls a.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--text-on-accent);
  font-weight: 800;
}

.crm-main .shell.dashboard .execom-pane .controls a.btn:not(.primary) {
  background: var(--surface);
  color: var(--text);
}

.pane-filter-field select {
  min-width: 120px;
}

.pane-card-actions input[type="search"] {
  width: min(240px, 70vw);
}

.pane-filter-summary {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--muted);
}

.pane-table-scroll,
.crm-main .shell.dashboard .odoo-pane .table-scroll {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--pane-radius);
  background: var(--surface);
}

.pane-data-table,
.pane-table-card table,
.crm-main .shell.dashboard .fastcash-dash table,
.crm-main .shell.dashboard .odoo-pane table,
.crm-main .shell.dashboard .execom-pane table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 0.85rem;
}

.pane-data-table th,
.pane-data-table td,
.pane-table-card th,
.pane-table-card td,
.crm-main .shell.dashboard .fastcash-dash th,
.crm-main .shell.dashboard .fastcash-dash td,
.crm-main .shell.dashboard .odoo-pane th,
.crm-main .shell.dashboard .odoo-pane td,
.crm-main .shell.dashboard .execom-pane th,
.crm-main .shell.dashboard .execom-pane td {
  border-bottom: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.6rem;
  vertical-align: top;
}

.crm-main .shell.dashboard .fastcash-dash td.num,
.crm-main .shell.dashboard .fastcash-dash th.num,
.crm-main .shell.dashboard .odoo-pane th,
.crm-main .shell.dashboard .odoo-pane td,
.crm-main .shell.dashboard .execom-pane th,
.crm-main .shell.dashboard .execom-pane td {
  text-align: right;
}

.crm-main .shell.dashboard .fastcash-dash th:first-child,
.crm-main .shell.dashboard .fastcash-dash td:first-child,
.crm-main .shell.dashboard .odoo-pane th:first-child,
.crm-main .shell.dashboard .odoo-pane td:first-child,
.crm-main .shell.dashboard .execom-pane th:first-child,
.crm-main .shell.dashboard .execom-pane td:first-child {
  text-align: left;
}

.crm-main .shell.dashboard .fastcash-dash tr.total td,
.crm-main .shell.dashboard .odoo-pane .matrix .total td,
.crm-main .shell.dashboard .execom-pane tr.total td {
  font-weight: 800;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.crm-main .shell.dashboard .odoo-pane .matrix .section td,
.crm-main .shell.dashboard .execom-pane tr.section td {
  font-weight: 800;
  background: var(--table-row-alt);
}

.crm-main .shell.dashboard .execom-pane tr.grand td {
  font-weight: 900;
  color: var(--accent);
  border-top: 2px solid var(--accent);
}

.pane-data-table th,
.pane-table-card thead th,
.crm-main .shell.dashboard .fastcash-dash th,
.crm-main .shell.dashboard .odoo-pane th,
.crm-main .shell.dashboard .execom-pane thead th {
  background: var(--table-header-bg);
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.crm-main .shell.dashboard .odoo-pane .kpi,
.crm-main .shell.dashboard .fastcash-dash .kpi,
.crm-main .shell.dashboard .execom-pane .card.kpi {
  position: relative;
  min-height: 112px;
  padding: 0.9rem 1rem;
  background: color-mix(in srgb, var(--surface) 96%, #fff);
  border: 1px solid var(--border);
  border-radius: var(--pane-radius);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.crm-main .shell.dashboard .odoo-pane .kpi::before,
.crm-main .shell.dashboard .fastcash-dash .kpi::before,
.crm-main .shell.dashboard .execom-pane .card.kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  opacity: 0.78;
}

.crm-main .shell.dashboard .odoo-pane .label,
.crm-main .shell.dashboard .fastcash-dash .kpi .label,
.crm-main .shell.dashboard .execom-pane .card.kpi h2 {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.4rem;
}

.crm-main .shell.dashboard .odoo-pane .val,
.crm-main .shell.dashboard .fastcash-dash .kpi .val,
.crm-main .shell.dashboard .execom-pane .kpi .value {
  font-size: clamp(1.35rem, 1.7vw, 1.85rem);
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.crm-main .shell.dashboard .fastcash-pane .msg,
.crm-main .shell.dashboard .odoo-pane .alert {
  border-radius: var(--pane-radius);
  padding: 0.85rem 1rem;
  margin: 0;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (max-width: 900px) {
  .executive-pane-head {
    grid-template-columns: 1fr;
  }

  .executive-pane-meta {
    justify-content: flex-start;
  }

  .crm-main .topbar {
    position: relative;
  }

  .report-op-slicers {
    top: auto;
  }

  .crm-main .shell.dashboard .fastcash-dash .twocol {
    grid-template-columns: 1fr;
  }

  .pane-filter-summary {
    margin-left: 0;
    width: 100%;
  }
}

.plan-pipeline {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.plan-nav {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  padding: 1rem;
  max-height: calc(100vh - 180px);
  overflow: auto;
}

.plan-nav h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.plan-list {
  list-style: none;
  padding: 0;
  margin: 0.8rem 0 0;
  display: grid;
  gap: 0.45rem;
}

.plan-item a {
  display: block;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
  background: #fff;
}

.plan-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.5rem;
  align-items: start;
}

.plan-item-link {
  min-width: 0;
}

.plan-item-form {
  margin: 0;
}

.plan-check {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  color: #64748b;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}

.plan-check:hover {
  border-color: rgba(184, 134, 11, 0.5);
  color: #b45309;
}

.plan-check.is-complete {
  border-color: rgba(34, 197, 94, 0.55);
  color: #15803d;
}

.plan-item a:hover {
  border-color: rgba(250, 204, 21, 0.45);
  background: #f8fafc;
}

.plan-item.active a {
  border-color: rgba(250, 204, 21, 0.65);
  background: rgba(250, 204, 21, 0.14);
}

.plan-phase {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.plan-title {
  display: block;
  font-size: 0.88rem;
  margin-top: 0.2rem;
  color: var(--text);
}

.plan-excerpt {
  display: block;
  margin-top: 0.28rem;
  font-size: 0.76rem;
  color: var(--muted);
}

.plan-content {
  min-width: 0;
}

.plan-progress {
  margin-top: 0.35rem;
}

.plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.plan-actions form {
  margin: 0;
}

.plan-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
}

.plan-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  border: 1px solid rgba(15, 23, 42, 0.08);
  margin-top: 0.35rem;
  overflow: hidden;
}

.plan-progress-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #facc15);
}

.plan-markdown {
  margin: 0.8rem 0 0;
  max-height: calc(100vh - 260px);
  overflow: auto;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
  padding: 0.85rem;
  color: #334155;
  font-size: 0.8rem;
  line-height: 1.42;
  white-space: pre-wrap;
}

@media (max-width: 960px) {
  .plan-pipeline {
    grid-template-columns: 1fr;
  }
}

/* Audit compliance deterrents: browser-level protection only; OS screenshots cannot be fully blocked. */
.audit-portal {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.audit-portal input,
.audit-portal select,
.audit-portal button {
  -webkit-user-select: auto;
  user-select: auto;
}

@media print {
  .audit-portal {
    display: none !important;
  }

  body::before {
    content: "Audit and Compliance content is protected and cannot be printed from the CRM.";
    display: block;
    margin: 2rem;
    padding: 1rem;
    border: 1px solid #ef4444;
    color: #991b1b;
    font: 700 16px/1.4 "Segoe UI", sans-serif;
  }
}

/* ═════════════════════════════════════════════════════════════════════
   Responsive layer — adapts the CRM to whatever monitor the user is on.
   Breakpoints reflect real device sizes seen in deployment:
     small laptop 13"  ≤ 1280 px
     standard laptop   ≤ 1440 px
     desktop monitor   ≤ 1920 px
     wide / ultrawide  > 1920 px
     tablet portrait   ≤ 900 px
     phone             ≤ 640 px
   Anything that uses fixed pixel widths gets a fluid fallback here.
   ════════════════════════════════════════════════════════════════════ */

/* Base: tighten the topbar / userbar so they wrap instead of overflowing. */
.crm-main .topbar {
  flex-wrap: wrap;
  row-gap: 0.5rem;
}
.crm-main .topbar .crm-userbar {
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Force tables inside our shared cards to always scroll horizontally
   instead of pushing the layout. Applies to every table the macros / panes
   produce. */
.crm-main .shell.dashboard .pane-table-scroll,
.crm-main .shell.dashboard .audit-action-table > div,
.crm-main .shell.dashboard .audit-exception-table > div,
.crm-main .shell.dashboard .forms-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.crm-main .shell.dashboard .audit-action-table table,
.crm-main .shell.dashboard .audit-exception-table table,
.crm-main .shell.dashboard .forms-table,
.crm-main .shell.dashboard .pane-table-scroll table {
  min-width: 720px;
}

/* Embedded iframes scale with viewport so the BIR / Odoo / FastCash panes
   fill the available height on every monitor. */
.pane-embed-wrapper {
  height: clamp(560px, 78vh, 1200px);
}
.pane-embed-wrapper--tall {
  height: clamp(640px, 88vh, 1400px);
}

/* Charts inside the audit portal get a min-height so they're legible
   regardless of viewport. */
.audit-chart-cell {
  min-height: 380px;
  height: clamp(380px, 38vh, 520px);
}

.audit-chart-cell--wide {
  min-height: 460px;
  height: clamp(460px, 44vh, 620px);
}

/* ── Ultra-wide / 4K monitors ──────────────────────────────────────── */
@media (min-width: 1800px) {
  .crm-shell {
    /* Slightly wider sidebar at the top end so the nav text breathes. */
    grid-template-columns: 260px minmax(0, 1fr);
  }
  .crm-main .shell.dashboard {
    /* Cap the readable line length on huge screens — anything > 1500px
       wide for a single column reduces information density and readability.
       Add side margins instead of letting content stretch corner-to-corner. */
    max-width: 1680px;
    margin-left: auto;
    margin-right: auto;
    padding-left: clamp(1.5rem, 3vw, 3rem);
    padding-right: clamp(1.5rem, 3vw, 3rem);
  }
  .kpi-row,
  .pane-kpi-strip {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
  .audit-portal__kpis {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }
}

/* ── Desktop / 24" monitor (1440 – 1920 px) ────────────────────────── */
@media (min-width: 1440px) and (max-width: 1799px) {
  .crm-main .shell.dashboard {
    padding-left: clamp(1.25rem, 2.5vw, 2rem);
    padding-right: clamp(1.25rem, 2.5vw, 2rem);
  }
}

/* ── Standard / small laptop (1024 – 1280 px) ──────────────────────── */
@media (max-width: 1280px) {
  .crm-shell {
    grid-template-columns: 200px minmax(0, 1fr);
  }
  .crm-side-item {
    font-size: 0.9rem;
    padding: 0.55rem 0.65rem;
  }
  .kpi-row,
  .pane-kpi-strip {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  .audit-portal__kpis {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
  .audit-mgmt-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
  .executive-pane-head h1,
  .crm-main .shell.dashboard h1 {
    font-size: clamp(1.2rem, 2.2vw, 1.6rem);
  }
}

/* ── Tablet / narrow laptop (≤ 1024 px) ─────────────────────────────── */
@media (max-width: 1024px) {
  .crm-shell {
    /* Sidebar collapses to icon-only at this breakpoint — labels hide,
       icons stay so users can still navigate. */
    grid-template-columns: 64px minmax(0, 1fr);
  }
  .crm-sidebar {
    padding: 0.8rem 0.4rem;
  }
  .crm-side-brand {
    /* Show just the first character of the brand mark when collapsed. */
    font-size: 0;
    padding: 0.5rem;
    position: relative;
  }
  .crm-side-brand::before {
    content: "CRM";
    font-size: 0.7rem;
    letter-spacing: 0.04em;
  }
  .crm-side-item {
    padding: 0.6rem 0.4rem;
    justify-content: center;
  }
  .crm-side-item__txt {
    /* Hide labels — keep only the icon glyph. */
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .crm-side-item__ico {
    font-size: 1.2rem;
    margin: 0;
  }
  .crm-main .shell.dashboard {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }
  .pane-embed-wrapper {
    height: clamp(480px, 70vh, 900px);
  }
}

/* ── Tablet portrait / large phone (≤ 768 px) ──────────────────────── */
@media (max-width: 768px) {
  .crm-main .topbar .brand-text {
    font-size: 0.78rem;
    max-width: 60vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .crm-main .topbar .brand-text--audit {
    /* Truncate the long PCNCI brand on small screens. */
    font-size: 0.72rem;
  }
  .executive-pane-meta {
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .audit-mgmt-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.55rem;
  }
  .audit-mgmt-value {
    font-size: 1.15rem;
  }
  .kpi-card {
    min-height: 96px;
    padding: 0.7rem 0.85rem;
  }
  .kpi-value {
    font-size: 1.35rem;
  }
}

/* ── Phone (≤ 640 px) ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  .crm-shell {
    /* On very narrow screens the sidebar becomes a horizontal nav strip
       above the content so the user gets the full width for KPIs/tables. */
    grid-template-columns: 1fr;
  }
  .crm-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    box-shadow: none;
    padding: 0.6rem 0.4rem;
    overflow-x: auto;
  }
  .crm-side-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.35rem;
    min-width: max-content;
  }
  .crm-side-brand {
    display: none; /* Title already in topbar — save vertical real-estate. */
  }
  .crm-side-item {
    flex-shrink: 0;
    padding: 0.5rem 0.7rem;
  }
  .crm-side-item__txt {
    /* Bring labels back as horizontal tabs. */
    position: static;
    width: auto;
    height: auto;
    clip-path: none;
    font-size: 0.78rem;
  }
  .kpi-row,
  .pane-kpi-strip,
  .audit-portal__kpis {
    grid-template-columns: 1fr;
  }
  .crm-main .shell.dashboard {
    padding-left: 0.6rem;
    padding-right: 0.6rem;
  }
  /* Hide the chips row on tiny screens — title + as-of are enough. */
  .executive-pane-meta .chip:not(.enabled) {
    display: none;
  }
  /* Stack action / exception table headers — show data as flowed cards. */
  .audit-action-table table,
  .audit-exception-table table {
    min-width: unset;
  }
  .pane-embed-wrapper {
    height: clamp(420px, 75vh, 720px);
  }
}

/* ── Print (keep landscape-friendly for executive PDF export) ──────── */
@media print {
  .crm-sidebar,
  .crm-userbar,
  .pane-filter-bar,
  .audit-portal__head,
  #crm-notif-bell,
  .exec-exceptions__cta {
    display: none !important;
  }
  .crm-shell {
    grid-template-columns: 1fr;
  }
  .crm-main .shell.dashboard {
    padding: 0;
    max-width: none;
  }
  .pane-section-card,
  .pane-table-card,
  .kpi-card,
  .audit-hub__panel {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .pane-embed-wrapper {
    /* Iframes don't print well — keep a placeholder line. */
    display: none;
  }
}

