:root {
  --v3-color-background: #0d0f14;
  --v3-color-surface-elevated: #141821;
  --v3-color-surface-card: #191e28;
  --v3-color-border: rgba(224, 230, 241, 0.14);
  --v3-color-text-primary: #f7f8fb;
  --v3-color-text-secondary: #c3c9d4;
  --v3-color-text-muted: #8d96a7;
  --v3-color-primary-action: #14b8a6;
  --v3-color-success: #37c978;
  --v3-color-warning: #f3b64d;
  --v3-color-danger: #f45f6f;
  --v3-color-info: #6aa9ff;
  --v3-color-unknown: #9aa3b2;
  --v3-color-disabled: #667085;
  --v3-space-page: clamp(1rem, 2.4vw, 2rem);
  --v3-space-section: 1.25rem;
  --v3-space-card: 1rem;
  --v3-space-table-cell: 0.78rem 0.9rem;
  --v3-space-drawer: 1.15rem;
  --v3-space-compact: 0.5rem;
  --v3-space-comfortable: 0.85rem;
  --v3-type-page-title: 1.75rem;
  --v3-type-workspace-title: 1.45rem;
  --v3-type-section-title: 1rem;
  --v3-type-card-title: 0.95rem;
  --v3-type-metric-value: clamp(1.45rem, 2.5vw, 2rem);
  --v3-type-table-body: 0.88rem;
  --v3-type-metadata: 0.76rem;
  --v3-type-button: 0.84rem;
  --v3-type-badge: 0.72rem;
  --v3-radius-card: 8px;
  --v3-radius-button: 7px;
  --v3-radius-badge: 999px;
  --v3-radius-drawer: 12px 0 0 12px;
  --v3-radius-input: 7px;
  --v3-shadow-card: 0 14px 40px rgba(0, 0, 0, 0.22);
  --v3-shadow-drawer: -24px 0 70px rgba(0, 0, 0, 0.38);
  --v3-shadow-hover: 0 18px 48px rgba(0, 0, 0, 0.3);
  --v3-focus-ring: 0 0 0 3px rgba(20, 184, 166, 0.35);
  --v3-motion-fast: 140ms ease;
  --v3-motion-drawer: 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --v3-motion-hover: 160ms ease;
}

.v3-button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--v3-radius-button);
  cursor: pointer;
  display: inline-flex;
  font-size: var(--v3-type-button);
  font-weight: 750;
  gap: 0.45rem;
  justify-content: center;
  line-height: 1;
  min-height: 2.35rem;
  padding: 0.65rem 0.88rem;
  transition:
    background var(--v3-motion-hover),
    border-color var(--v3-motion-hover),
    box-shadow var(--v3-motion-hover),
    transform var(--v3-motion-hover);
}

.v3-button:focus-visible,
.v3-action-menu summary:focus-visible,
.v3-data-table tr:focus-visible,
.v3-saved-view-tabs button:focus-visible,
.v3-command-row:focus-visible,
.v3-drawer-close:focus-visible {
  box-shadow: var(--v3-focus-ring);
  outline: 0;
}

.v3-button-primary {
  background: var(--v3-color-primary-action);
  color: #021411;
}

.v3-button-secondary {
  background: rgba(255, 255, 255, 0.055);
  border-color: var(--v3-color-border);
  color: var(--v3-color-text-primary);
}

.v3-button-danger {
  background: rgba(244, 95, 111, 0.14);
  border-color: rgba(244, 95, 111, 0.5);
  color: #ffd9de;
}

.v3-button:hover {
  box-shadow: var(--v3-shadow-hover);
  transform: translateY(-1px);
}

.v3-workspace-header,
.v3-card,
.v3-empty-state,
.v3-unavailable-state,
.v3-danger-action,
.v3-command-palette {
  background: color-mix(in srgb, var(--v3-color-surface-card) 92%, transparent);
  border: 1px solid var(--v3-color-border);
  border-radius: var(--v3-radius-card);
  box-shadow: var(--v3-shadow-card);
}

.v3-workspace-header {
  align-items: start;
  display: grid;
  gap: var(--v3-space-card);
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: var(--v3-space-section);
  padding: clamp(1rem, 2vw, 1.35rem);
}

.v3-workspace-copy p,
.v3-section-header p,
.v3-card p,
.v3-empty-state p,
.v3-unavailable-state p,
.v3-danger-action p {
  color: var(--v3-color-text-secondary);
  line-height: 1.55;
  margin: 0;
}

.v3-eyebrow {
  color: var(--v3-color-text-muted);
  font-size: var(--v3-type-metadata);
  font-weight: 850;
  letter-spacing: 0.08em;
  margin: 0 0 0.45rem;
  text-transform: uppercase;
}

.v3-workspace-title-row,
.v3-card-head,
.v3-section-header {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
}

.v3-workspace-title-row h1,
.v3-section-header h2,
.v3-card h3,
.v3-drawer h2,
.v3-drawer h3 {
  color: var(--v3-color-text-primary);
  letter-spacing: 0;
  margin: 0;
}

.v3-workspace-title-row h1 {
  font-size: var(--v3-type-workspace-title);
  line-height: 1.15;
}

.v3-section-header {
  margin: 0 0 0.75rem;
}

.v3-section-header h2 {
  font-size: var(--v3-type-section-title);
}

.v3-workspace-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: end;
}

.v3-workspace-nuru {
  grid-column: 1 / -1;
}

.v3-card,
.v3-empty-state,
.v3-unavailable-state,
.v3-danger-action {
  padding: var(--v3-space-card);
}

.v3-card-head h3,
.v3-card h4,
.v3-evidence-stack h4 {
  font-size: var(--v3-type-card-title);
  margin: 0;
}

.v3-metric-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  margin-top: 0.9rem;
}

.v3-metric-item {
  border-left: 1px solid var(--v3-color-border);
  display: grid;
  gap: 0.25rem;
  padding-left: 0.8rem;
}

.v3-metric-item span,
.v3-metric-item small,
.v3-muted {
  color: var(--v3-color-text-muted);
  font-size: var(--v3-type-metadata);
}

.v3-metric-item strong,
.v3-insight-value {
  color: var(--v3-color-text-primary);
  font-size: var(--v3-type-metric-value);
  letter-spacing: 0;
  line-height: 1.05;
}

.v3-health-summary ul,
.v3-evidence-stack ul,
.v3-nuru-briefing ul,
.v3-nuru-briefing ol,
.v3-nuru-recommendation ul {
  display: grid;
  gap: 0.55rem;
  list-style-position: inside;
  margin: 0.8rem 0 0;
  padding: 0;
}

.v3-health-summary li,
.v3-evidence-stack li {
  align-items: center;
  border-top: 1px solid var(--v3-color-border);
  display: flex;
  gap: 0.8rem;
  justify-content: space-between;
  padding-top: 0.6rem;
}

.v3-health-summary small {
  color: var(--v3-color-text-muted);
  display: block;
  font-size: var(--v3-type-metadata);
  margin-top: 0.2rem;
}

.v3-status-badge,
.v3-confidence-badge {
  border: 1px solid currentColor;
  border-radius: var(--v3-radius-badge);
  display: inline-flex;
  font-size: var(--v3-type-badge);
  font-weight: 850;
  gap: 0.35rem;
  line-height: 1;
  padding: 0.32rem 0.52rem;
  text-transform: none;
  white-space: nowrap;
}

.v3-status-success,
.v3-confidence-success {
  background: rgba(55, 201, 120, 0.12);
  color: var(--v3-color-success);
}

.v3-status-warning,
.v3-confidence-warning {
  background: rgba(243, 182, 77, 0.13);
  color: var(--v3-color-warning);
}

.v3-status-danger,
.v3-confidence-danger {
  background: rgba(244, 95, 111, 0.13);
  color: var(--v3-color-danger);
}

.v3-status-info {
  background: rgba(106, 169, 255, 0.13);
  color: var(--v3-color-info);
}

.v3-status-unknown,
.v3-status-disabled {
  background: rgba(154, 163, 178, 0.12);
  color: var(--v3-color-unknown);
}

.v3-table-shell {
  border: 1px solid var(--v3-color-border);
  border-radius: var(--v3-radius-card);
  overflow: auto;
}

.v3-data-table {
  border-collapse: collapse;
  color: var(--v3-color-text-primary);
  font-size: var(--v3-type-table-body);
  min-width: 52rem;
  width: 100%;
}

.v3-data-table caption {
  color: var(--v3-color-text-muted);
  font-size: var(--v3-type-metadata);
  padding: 0.7rem 0.9rem;
  text-align: left;
}

.v3-data-table th,
.v3-data-table td {
  border-top: 1px solid var(--v3-color-border);
  padding: var(--v3-space-table-cell);
  text-align: left;
  vertical-align: middle;
}

.v3-data-table th {
  color: var(--v3-color-text-muted);
  font-size: var(--v3-type-metadata);
  font-weight: 850;
  text-transform: uppercase;
}

.v3-data-table tbody tr {
  cursor: pointer;
  transition: background var(--v3-motion-hover);
}

.v3-data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.v3-table-actions {
  align-items: center;
  display: flex;
  gap: 0.45rem;
  white-space: nowrap;
}

.v3-table-dense .v3-data-table th,
.v3-table-dense .v3-data-table td {
  padding: 0.52rem 0.65rem;
}

.v3-action-menu {
  position: relative;
}

.v3-action-menu summary {
  border: 1px solid var(--v3-color-border);
  border-radius: var(--v3-radius-button);
  color: var(--v3-color-text-secondary);
  cursor: pointer;
  list-style: none;
  min-height: 2.35rem;
  padding: 0.6rem 0.75rem;
}

.v3-action-menu summary::-webkit-details-marker {
  display: none;
}

.v3-action-menu-list {
  background: var(--v3-color-surface-elevated);
  border: 1px solid var(--v3-color-border);
  border-radius: var(--v3-radius-card);
  box-shadow: var(--v3-shadow-card);
  display: grid;
  gap: 0.2rem;
  min-width: 11rem;
  padding: 0.35rem;
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 20;
}

.v3-action-menu-list button,
.v3-command-row {
  background: transparent;
  border: 0;
  color: var(--v3-color-text-primary);
  cursor: pointer;
  padding: 0.6rem 0.7rem;
  text-align: left;
}

.v3-filter-bar {
  align-items: end;
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  margin-bottom: 0.9rem;
}

.v3-filter-bar label {
  color: var(--v3-color-text-muted);
  display: grid;
  font-size: var(--v3-type-metadata);
  gap: 0.35rem;
}

.v3-filter-bar input,
.v3-command-search input {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--v3-color-border);
  border-radius: var(--v3-radius-input);
  color: var(--v3-color-text-primary);
  padding: 0.7rem 0.8rem;
}

.v3-saved-view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.v3-saved-view-tabs button {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--v3-color-border);
  border-radius: var(--v3-radius-badge);
  color: var(--v3-color-text-secondary);
  padding: 0.5rem 0.7rem;
}

.v3-saved-view-tabs button.active {
  background: rgba(20, 184, 166, 0.13);
  border-color: rgba(20, 184, 166, 0.5);
  color: var(--v3-color-text-primary);
}

.v3-drawer {
  background: var(--v3-color-surface-elevated);
  border-left: 1px solid var(--v3-color-border);
  border-radius: var(--v3-radius-drawer);
  bottom: 0;
  box-shadow: var(--v3-shadow-drawer);
  color: var(--v3-color-text-primary);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-width: min(100vw, 34rem);
  position: fixed;
  right: 0;
  top: 0;
  transform: translateX(0);
  transition: transform var(--v3-motion-drawer);
  width: 100%;
  z-index: 100;
}

.v3-drawer[hidden] {
  display: grid;
  transform: translateX(105%);
}

.v3-drawer-header,
.v3-drawer-footer {
  align-items: center;
  border-bottom: 1px solid var(--v3-color-border);
  display: flex;
  gap: 0.65rem;
  justify-content: space-between;
  padding: var(--v3-space-drawer);
}

.v3-drawer-footer {
  border-bottom: 0;
  border-top: 1px solid var(--v3-color-border);
  justify-content: end;
}

.v3-drawer-body {
  display: grid;
  gap: 1rem;
  overflow: auto;
  padding: var(--v3-space-drawer);
}

.v3-drawer-body pre {
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid var(--v3-color-border);
  border-radius: var(--v3-radius-card);
  color: var(--v3-color-text-secondary);
  overflow: auto;
  padding: 0.8rem;
}

.v3-drawer-close {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--v3-color-border);
  color: var(--v3-color-text-primary);
}

.v3-command-palette {
  margin: 0 auto;
  max-width: 42rem;
  padding: 0.8rem;
}

.v3-command-search {
  display: grid;
  gap: 0.5rem;
}

.v3-command-search span {
  color: var(--v3-color-text-muted);
  font-size: var(--v3-type-metadata);
}

.v3-command-group {
  margin-top: 0.85rem;
}

.v3-command-group h3 {
  color: var(--v3-color-text-muted);
  font-size: var(--v3-type-metadata);
  margin: 0 0 0.35rem;
  text-transform: uppercase;
}

.v3-command-row {
  align-items: center;
  border-radius: var(--v3-radius-button);
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.v3-command-row small {
  color: var(--v3-color-text-muted);
}

.v3-nuru-briefing,
.v3-nuru-recommendation {
  border-color: rgba(20, 184, 166, 0.28);
}

.v3-nuru-briefing h3,
.v3-nuru-recommendation h3 {
  font-size: 1.08rem;
}

.v3-danger-action {
  border-color: rgba(244, 95, 111, 0.45);
}

.v3-focus-mode {
  background: var(--v3-color-background);
  color: var(--v3-color-text-primary);
  min-height: 100vh;
  padding: var(--v3-space-page);
}

.v3-focus-content {
  display: grid;
  gap: var(--v3-space-section);
  margin: 0 auto;
  max-width: 58rem;
}

@media (max-width: 760px) {
  .v3-workspace-header,
  .v3-workspace-title-row,
  .v3-card-head,
  .v3-section-header,
  .v3-health-summary li,
  .v3-evidence-stack li {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .v3-workspace-header,
  .v3-section-header {
    display: grid;
  }

  .v3-workspace-actions,
  .v3-drawer-footer {
    justify-content: stretch;
  }

  .v3-workspace-actions .v3-button,
  .v3-drawer-footer .v3-button {
    width: 100%;
  }

  .v3-drawer {
    border-radius: 12px 12px 0 0;
    max-width: 100vw;
    top: 8vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
