/* Color tokens — served directly (not compiled). Edit here; refresh the browser to apply. */
/* Light mode values from Figma DS: Intecon UI Design, node 21275:9 */

:root {
  --background: #ffffff;
  --foreground: #0a0a0a;
  --card: #ffffff;
  --card-foreground: #0a0a0a;
  --popover: #ffffff;
  --popover-foreground: #0a0a0a;
  --primary: #29235c;
  --primary-foreground: #fafafa;
  --secondary: #fafafa;
  --secondary-foreground: #171717;
  --muted: #f5f5f5;
  --muted-foreground: #737373;
  --accent: #f5f5f5;
  --accent-foreground: #171717;
  --destructive: #dc2626;
  --destructive-foreground: #fafafa;
  --success: #16a34a;
  --success-foreground: #fafafa;
  --warning: #f0c105;
  --warning-foreground: #0a0a0a;
  --brand: #29235c;
  --brand-foreground: #fafafa;
  --border: #f0f0f0;
  --input: #e5e5e5;
  --ring: #a3a3a3;
  --radius: 0.5rem;

  --sidebar: #ffffff;
  --sidebar-foreground: #0a0a0a;
  --sidebar-primary: #171717;
  --sidebar-primary-foreground: #fafafa;
  --sidebar-accent: #f5f5f5;
  --sidebar-accent-foreground: #171717;
  --sidebar-border: #e5e5e5;
  --sidebar-ring: #a3a3a3;

  --chart-1: #29235c;
  --chart-2: #196297;
  --chart-3: #1182b4;
  --chart-4: #08a1d1;
  --chart-5: #00c2f0;

  /* Status icon badge — Figma tailwind yellow/400 (30222:13233) */
  --status-icon-warning: #facc15;

  /* Page content radial background — Figma 29636:6657 */
  --page-content-gradient-center: #ffffff;
  --page-content-gradient-edge: #f5f5f5;
  --page-content-max-width: 120rem;

  /* Floating overlays (dropdowns, popovers) — matches @utility shadow-md */
  --overlay-panel-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.12), 0 2px 4px -2px rgba(0, 0, 0, 0.08);

  /* Scrollbars */
  --scrollbar-size: 0.375rem;
  --scrollbar-track: transparent;
  --scrollbar-thumb: var(--input);
  --scrollbar-thumb-hover: var(--ring);

  /* Border radius — matches Tailwind @theme (application.css) */
  --radius-md: 0.1875rem;

  /* Application shell — preserve desktop layout; allow horizontal scroll below this width */
  --app-min-width: 72rem;
}

/* Dark mode — not defined in Figma node 21275:9; shadcn defaults until DS dark palette is linked */
.dark {
  --background: #0a0a0a;
  --foreground: #fafafa;
  --card: #0a0a0a;
  --card-foreground: #fafafa;
  --popover: #0a0a0a;
  --popover-foreground: #fafafa;
  --primary: #4a3f8c;
  --primary-foreground: #fafafa;
  --secondary: #262626;
  --secondary-foreground: #fafafa;
  --muted: #262626;
  --muted-foreground: #a3a3a3;
  --destructive: #ef4444;
  --destructive-foreground: #fafafa;
  --success: #22c55e;
  --success-foreground: #0a0a0a;
  --warning: #f0c105;
  --warning-foreground: #0a0a0a;
  --brand: #29235c;
  --brand-foreground: #fafafa;
  --accent: #262626;
  --accent-foreground: #fafafa;
  --border: #262626;
  --input: #262626;
  --ring: #737373;

  --sidebar: #171717;
  --sidebar-foreground: #fafafa;
  --sidebar-primary: #fafafa;
  --sidebar-primary-foreground: #171717;
  --sidebar-accent: #262626;
  --sidebar-accent-foreground: #fafafa;
  --sidebar-border: #262626;
  --sidebar-ring: #737373;

  --chart-1: #4a3f8c;
  --chart-2: #196297;
  --chart-3: #1182b4;
  --chart-4: #08a1d1;
  --chart-5: #00c2f0;

  --scrollbar-thumb: var(--border);
  --scrollbar-thumb-hover: var(--sidebar-ring);
}

/* Data table — subtle row and sort-header hovers */
.cn-table-row:hover {
  background-color: color-mix(in srgb, var(--muted) 34%, transparent);
}

.data-table-sort-head:hover {
  background-color: color-mix(in srgb, var(--foreground) 3%, transparent);
}

/* Report card — 8px brand accent at top (#29235c) */
.report-card__accent-top {
  border-top: 8px solid var(--brand);
}

/* Report section headings — trailing 1px brand line */
.report-section-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.report-section-heading__line {
  flex: 1;
  min-width: 0;
  height: 1px;
  background-color: var(--brand);
}

/* Report sections — numbered badge column + content column */
.report-section {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.report-section__badge {
  flex-shrink: 0;
}

.report-section__body {
  flex: 1;
  min-width: 0;
  padding-top: 0.1875rem;
}

/* Report summary — 2×3 grid under header */
.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 3rem;
}

.report-summary-cell {
  padding: 1rem 1.25rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.report-summary-cell:nth-child(3n) {
  border-right: none;
}

.report-summary-cell:nth-child(n + 4) {
  border-bottom: none;
}

.report-summary-cell__value {
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.25rem;
  color: var(--foreground);
}

/* Report preview — full-screen drawer */
.report-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background-color: rgb(0 0 0 / 50%);
}

.report-drawer-content {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background-color: var(--secondary);
  border-radius: 0;
  max-height: 100vh;
}

.report-drawer-scroll {
  padding: 3rem 1.5rem 1.5rem;
  overflow-x: auto;
}

.report-drawer-inner {
  margin-left: auto;
  margin-right: auto;
  width: 900px;
  max-width: none;
  flex-shrink: 0;
}

.report-drawer-footer {
  box-shadow: 0 -4px 12px -4px rgb(0 0 0 / 0.08);
}

/* Status badges — icon square + external label (Figma 30222:13233) */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.status-badge__icon {
  display: inline-flex;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 0.125rem;
}

.status-badge__icon--complete {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.status-badge__icon--needs-review {
  background-color: var(--status-icon-warning);
  color: #ffffff;
}

.status-badge__icon--in-progress {
  background-color: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
}

.status-badge__icon--not-started {
  background-color: var(--muted);
  color: var(--muted-foreground);
}

.status-badge__label {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 400;
  color: var(--foreground);
}

.status-badge__label--emphasized {
  font-weight: 500;
}

.status-badge__icon svg {
  width: 0.625rem;
  height: 0.625rem;
}

.status-badge__icon-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.625rem;
  font-weight: 900;
  line-height: 1;
}

/* Application shell — sidebar + main; min-width keeps layout intact on narrow viewports */
.app-shell {
  display: flex;
  width: 100%;
  min-width: var(--app-min-width);
  height: 100%;
  min-height: 0;
}


/* Main content area — white center, gray edges (Figma 29636:6657) */
.bg-page-content {
  background: radial-gradient(
    ellipse 120% 100% at 50% 0%,
    var(--page-content-gradient-center) 0%,
    var(--page-content-gradient-edge) 100%
  );
  border-left: 1px solid var(--border);
  padding: 1.75rem 2rem 2rem;
}

/* Max-width column — header + body stack with flex gap */
.page-content-inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
  max-width: var(--page-content-max-width, 80rem);
  margin-inline: auto;
  min-height: 0;
}

/* ContentHeaderComponent title row */
.content-header {
  display: flex;
  align-items: center;
}

/* Top panel breadcrumb links */
nav[aria-label="Breadcrumb"] a:hover,
nav[aria-label="Breadcrumb"] a:focus-visible {
  text-decoration: underline;
}

/* Primary page content below the header */
.page-content-body {
  min-width: 0;
}

/* Conversation layout — fixed chat input footer (matches page content edge tone) */
.chat-input-footer {
  background-color: var(--page-content-gradient-edge);
}

/* Co-Pilot streaming / typing indicator — darkest dot travels left to right */
@keyframes stream-typing-dot {
  0%, 80%, 100% {
    opacity: 0.35;
  }

  40% {
    opacity: 1;
  }
}

.stream-typing-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 9999px;
  background-color: var(--muted-foreground);
  animation: stream-typing-dot 1.2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .stream-typing-dot {
    animation: none;
    opacity: 0.55;
  }
}

.fact-card__content {
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* Completeness ring — SVG stroke colors (Tailwind stroke-* utilities may not compile) */
.completeness-ring__track {
  stroke: var(--border);
}

.completeness-ring__progress--complete {
  stroke: var(--primary);
}

.completeness-ring__progress--incomplete {
  stroke: var(--warning);
}

/* Avatar — shadcn/ui */
.cn-avatar {
  position: relative;
  display: flex;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 0.125rem;
}

.cn-avatar.size-6 {
  width: 1.5rem;
  height: 1.5rem;
}

.cn-avatar.size-7 {
  width: 1.75rem;
  height: 1.75rem;
}

.cn-avatar.size-8 {
  width: 2rem;
  height: 2rem;
}

.cn-avatar-image {
  aspect-ratio: 1 / 1;
  height: 100%;
  width: 100%;
  object-fit: cover;
}

.cn-avatar-fallback {
  display: flex;
  height: 100%;
  width: 100%;
  align-items: center;
  justify-content: center;
  border-radius: 0.125rem;
  background-color: var(--muted);
  color: var(--muted-foreground);
}

/* Sidebar menu + user dropdown (Figma 29547:37283) */
.sidebar-menu {
  display: flex;
  width: 100%;
  min-width: 0;
  flex-direction: column;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-menu-item {
  position: relative;
}

/* Active sidebar nav icon — uses sidebar accent tokens (not Tailwind blue) */
.sidebar-nav-link--active {
  background-color: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
}

.sidebar-nav-tooltip {
  position: fixed;
  z-index: 50;
  padding: 0.375rem 0.5rem;
  border-radius: 0.125rem;
  background-color: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.75rem;
  line-height: 1rem;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Default UI tooltip — popover surface above trigger (most icon buttons, truncated text) */
.ui-tooltip {
  position: fixed;
  z-index: 50;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-md);
  background-color: var(--popover);
  color: var(--popover-foreground);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  line-height: 1rem;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--overlay-panel-shadow);
}

.sidebar-menu-button {
  display: flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 0.125rem;
  background: transparent;
  color: var(--sidebar-foreground);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-menu-button:hover,
.sidebar-menu-button[data-state="open"] {
  background-color: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
}

.sidebar-user-menu [data-slot="dropdown-menu-content"] {
  position: absolute;
  left: calc(100% + 0.25rem);
  bottom: 0;
  z-index: 50;
  min-width: 14rem;
  overflow: hidden;
  border-radius: 0.125rem;
  border: 1px solid var(--border);
  background-color: var(--popover);
  color: var(--popover-foreground);
  padding: 0.25rem;
  box-shadow: var(--overlay-panel-shadow);
}

.dropdown-menu-label {
  padding: 0;
  font-weight: 400;
}

.dropdown-menu-separator {
  height: 1px;
  margin: 0.25rem -0.25rem;
  background-color: var(--border);
}

.dropdown-menu-item {
  display: flex;
  width: 100%;
  cursor: default;
  user-select: none;
  align-items: center;
  gap: 0.5rem;
  border: none;
  border-radius: 0.125rem;
  background: transparent;
  padding: 0.375rem 0.5rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--popover-foreground);
  text-align: left;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.dropdown-menu-item:hover,
.dropdown-menu-item:focus {
  outline: none;
  background-color: var(--accent);
  color: var(--accent-foreground);
}

/* DataTable row menu — portaled to body; width measured in JS (align end) */
.data-table-row-menu-content {
  z-index: 50;
  min-width: 8rem;
  width: max-content;
  overflow: hidden;
  border-radius: 0.125rem;
  border: 1px solid var(--border);
  background-color: var(--popover);
  color: var(--popover-foreground);
  padding: 0.25rem;
  box-shadow: var(--overlay-panel-shadow);
}

.data-table-row-menu-content .dropdown-menu-item {
  white-space: nowrap;
}

/* shadcn Button — pointer cursor for button and link variants */
.cn-button {
  cursor: pointer;
}

.cn-button:disabled,
.cn-button[aria-disabled="true"] {
  cursor: not-allowed;
}

/* Form controls — border radius matches cn-button (rounded-md) */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"]),
textarea,
select {
  border-radius: var(--radius-md);
}

/* shadcn Alert Dialog — global delete confirmation */
.alert-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background-color: rgb(0 0 0 / 0.5);
}

.alert-dialog-content {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 101;
  display: flex;
  width: calc(100% - 2rem);
  max-width: 28rem;
  flex-direction: column;
  gap: 1rem;
  transform: translate(-50%, -50%);
  border-radius: 0.375rem;
  border: 1px solid var(--border);
  background-color: var(--background);
  padding: 1.5rem;
  box-shadow: var(--overlay-panel-shadow);
}

.alert-dialog-footer {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .alert-dialog-footer {
    flex-direction: row;
    justify-content: flex-end;
  }
}

.alert-dialog-cancel {
  display: inline-flex;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.125rem;
  border: 1px solid var(--border);
  background-color: var(--background);
  padding: 0 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  transition: background-color 0.15s ease;
}

.alert-dialog-cancel:hover {
  background-color: var(--accent);
}

.alert-dialog-action {
  display: inline-flex;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.125rem;
  padding: 0 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 0.15s ease;
}

.alert-dialog-action--destructive {
  background-color: var(--destructive);
  color: var(--destructive-foreground);
}

.alert-dialog-action--destructive:hover {
  background-color: color-mix(in srgb, var(--destructive) 90%, black);
}

/* DataTable name cell link — pointer cursor + underline title on cell hover */
.table-cell-link {
  cursor: pointer;
}

.table-cell-link:hover .table-cell-link__title,
.table-cell-link:focus-visible .table-cell-link__title {
  text-decoration: underline;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Empty state — gray icon box, sidebar icon (shared/_empty_state.html.erb) */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.empty-state--page {
  justify-content: center;
  padding: 6rem 2rem;
}

.empty-state__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  margin-bottom: 1.25rem;
  background-color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  border-radius: var(--radius-md);
  color: color-mix(in srgb, var(--muted-foreground) 40%, transparent);
}

.empty-state__icon svg,
.empty-state__icon .empty-state__svg {
  width: 1.5rem;
  height: 1.5rem;
  opacity: 0.55;
}

.empty-state__title {
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 600;
  color: var(--foreground);
  margin: 0 0 0.5rem;
}

.empty-state__description {
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--muted-foreground);
  max-width: 20rem;
  margin: 0;
}

.empty-state__description--with-action {
  margin-bottom: 2rem;
}

.empty-state__action > a,
.empty-state__action > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  padding: 0 1.25rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: var(--primary-foreground);
  background-color: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  transition: background-color 0.15s ease;
  cursor: pointer;
  text-decoration: none;
}

.empty-state__action > a:hover,
.empty-state__action > button:hover {
  background-color: color-mix(in srgb, var(--primary) 90%, transparent);
}

/* App scrollbars — narrow, design-system colors */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 9999px;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}

*::-webkit-scrollbar-corner {
  background: var(--scrollbar-track);
}
