:root {
  --bg: #090c12;
  --bg-raised: #0d1119;
  --surface: #111722;
  --surface-2: #151d29;
  --surface-3: #1a2432;
  --border: #253142;
  --border-soft: #1d2735;
  --text: #f3f6fa;
  --text-soft: #b5c0cf;
  --muted: #7f8c9f;
  --cloud: #8b8cff;
  --cloud-soft: rgba(139, 140, 255, 0.13);
  --local: #40d7b0;
  --local-soft: rgba(64, 215, 176, 0.12);
  --neutral: #9ba8b9;
  --neutral-soft: rgba(155, 168, 185, 0.12);
  --warning: #f3b65b;
  --warning-soft: rgba(243, 182, 91, 0.12);
  --danger: #ff6f7d;
  --danger-soft: rgba(255, 111, 125, 0.12);
  --success: #67d391;
  --success-soft: rgba(103, 211, 145, 0.12);
  --info: #65b8ff;
  --info-soft: rgba(101, 184, 255, 0.12);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.26);
  --sidebar-width: 248px;
  --radius-lg: 18px;
  --radius-md: 13px;
  --radius-sm: 9px;
  --focus: 0 0 0 3px rgba(139, 140, 255, 0.35);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 78% -20%, rgba(94, 92, 230, 0.12), transparent 35rem),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  letter-spacing: -0.025em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1.15;
}

h3 {
  margin-bottom: 0;
  font-size: 1.02rem;
  line-height: 1.25;
}

a {
  color: var(--info);
}

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

.is-hidden {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: #111;
  background: #fff;
  border-radius: 8px;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 22px 14px 18px;
  background: rgba(11, 15, 22, 0.96);
  border-right: 1px solid var(--border-soft);
  backdrop-filter: blur(22px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 8px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(145deg, #7471ff, #9f79ff);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(106, 94, 255, 0.28);
}

.brand-name {
  font-size: 0.94rem;
  font-weight: 720;
}

.brand-version {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
}

.nav-list {
  display: grid;
  gap: 4px;
  margin-top: 34px;
}

.nav-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  color: var(--text-soft);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
}

.nav-item.is-active {
  color: #fff;
  background: linear-gradient(90deg, rgba(139, 140, 255, 0.15), rgba(139, 140, 255, 0.06));
  border-color: rgba(139, 140, 255, 0.24);
}

.nav-icon {
  color: currentColor;
  font-size: 1.05rem;
  opacity: 0.88;
}

.nav-count {
  min-width: 24px;
  padding: 2px 7px;
  color: #17100a;
  font-size: 0.7rem;
  font-weight: 800;
  text-align: center;
  background: var(--warning);
  border-radius: 99px;
}

.policy-summary {
  margin-top: auto;
  padding: 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
}

.policy-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 0.78rem;
  line-height: 1.45;
}

.status-dot {
  width: 8px;
  height: 8px;
  margin-top: 4px;
  flex: 0 0 auto;
  background: var(--muted);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(127, 140, 159, 0.1);
}

.status-dot--good {
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
}

.status-dot--danger {
  background: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-soft);
}

.status-dot--unknown {
  background: var(--muted);
}

.sidebar-scrim {
  display: none;
}

.main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 0 32px 56px;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 -32px;
  padding: 13px 32px;
  background: rgba(9, 12, 18, 0.84);
  border-bottom: 1px solid rgba(37, 49, 66, 0.72);
  backdrop-filter: blur(20px);
}

.topbar-leading,
.topbar-actions,
.connection-strip {
  display: flex;
  align-items: center;
}

.topbar-leading {
  gap: 12px;
}

.topbar-actions {
  justify-content: flex-end;
  gap: 9px;
}

.connection-strip {
  gap: 6px;
  margin-right: 4px;
}

.topbar-kicker {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 760;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  font-size: 1.13rem;
  line-height: 1.1;
}

.mobile-menu-button {
  display: none !important;
}

.button,
.icon-button,
.text-button {
  border: 0;
}

.button {
  display: inline-flex;
  min-height: 39px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 13px;
  color: var(--text);
  font-size: 0.81rem;
  font-weight: 680;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: transform 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button--primary {
  color: #fff;
  background: #706ff0;
  border-color: #8684ff;
}

.button--primary:hover:not(:disabled) {
  background: #7d7cf6;
}

.button--secondary {
  color: #d9d8ff;
  background: var(--cloud-soft);
  border-color: rgba(139, 140, 255, 0.34);
}

.button--ghost {
  background: rgba(255, 255, 255, 0.035);
}

.button--danger {
  color: #ffc6cc;
  background: var(--danger-soft);
  border-color: rgba(255, 111, 125, 0.32);
}

.button--small {
  min-height: 33px;
  padding: 6px 10px;
  font-size: 0.75rem;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  flex: 0 0 auto;
  color: var(--text-soft);
  font-size: 1.15rem;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.icon-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.065);
}

.text-button {
  padding: 3px;
  color: #a8a7ff;
  font-size: 0.76rem;
  font-weight: 680;
  background: transparent;
}

.text-button:hover {
  color: #d4d3ff;
}

.banner-stack {
  display: grid;
  gap: 8px;
  max-width: 1480px;
  margin: 18px auto 0;
}

.banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 14px;
  color: var(--text-soft);
  font-size: 0.81rem;
  line-height: 1.45;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.banner strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
}

.banner--danger {
  background: var(--danger-soft);
  border-color: rgba(255, 111, 125, 0.26);
}

.banner--warning {
  background: var(--warning-soft);
  border-color: rgba(243, 182, 91, 0.25);
}

.banner--info {
  background: var(--info-soft);
  border-color: rgba(101, 184, 255, 0.25);
}

.view {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding-top: 30px;
}

.view[hidden] {
  display: none;
}

.section-heading {
  display: flex;
  min-height: 66px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.section-heading--actions {
  align-items: center;
}

.section-copy {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.55;
}

.last-updated,
.table-count {
  color: var(--muted);
  font-size: 0.74rem;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 780;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.kpi-card {
  min-height: 138px;
  padding: 17px;
  background: linear-gradient(145deg, rgba(21, 29, 41, 0.98), rgba(15, 21, 31, 0.98));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12);
}

.kpi-card--alert {
  border-color: rgba(243, 182, 91, 0.28);
}

.kpi-card--cloud {
  border-color: rgba(139, 140, 255, 0.25);
}

.kpi-card--local {
  border-color: rgba(64, 215, 176, 0.22);
}

.kpi-card--success {
  border-color: rgba(103, 211, 145, 0.28);
}

.kpi-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-soft);
  font-size: 0.75rem;
  font-weight: 660;
}

.kpi-value {
  margin-top: 19px;
  font-size: clamp(1.45rem, 2.3vw, 2.05rem);
  font-weight: 740;
  letter-spacing: -0.045em;
  line-height: 1;
}

.kpi-meta {
  min-height: 30px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.metric-state {
  color: var(--text-soft);
  font-size: 0.67rem;
  font-weight: 720;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.dashboard-grid--attention {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.55fr);
}

.panel {
  min-width: 0;
  margin-bottom: 12px;
  padding: 18px;
  background: rgba(17, 23, 34, 0.92);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.1);
}

.panel--policy {
  background:
    linear-gradient(120deg, rgba(139, 140, 255, 0.12), transparent 45%),
    rgba(17, 23, 34, 0.96);
  border-color: rgba(139, 140, 255, 0.28);
}

.panel-header {
  display: flex;
  min-height: 40px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-header h3 {
  margin-top: 5px;
}

.panel-header--section {
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px solid var(--border-soft);
}

.status-chip,
.lane-chip,
.tag,
.basis-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
  border: 1px solid transparent;
  border-radius: 99px;
  white-space: nowrap;
}

.status-chip {
  min-height: 27px;
  padding: 4px 9px;
  color: var(--text-soft);
  font-size: 0.67rem;
  font-weight: 720;
  background: var(--neutral-soft);
  border-color: rgba(155, 168, 185, 0.16);
}

.status-chip::before {
  width: 6px;
  height: 6px;
  content: "";
  background: currentColor;
  border-radius: 50%;
}

.status-chip--good,
.status-chip--completed,
.status-chip--approved,
.status-chip--profitable,
.status-chip--passed {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(103, 211, 145, 0.22);
}

.status-chip--warning,
.status-chip--queued,
.status-chip--awaiting_approval,
.status-chip--awaiting_cloud,
.status-chip--awaiting_cloud_review,
.status-chip--paused,
.status-chip--break_even,
.status-chip--mixed,
.status-chip--inconclusive {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: rgba(243, 182, 91, 0.22);
}

.status-chip--danger,
.status-chip--failed,
.status-chip--rejected,
.status-chip--cancelled,
.status-chip--loss_making {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(255, 111, 125, 0.22);
}

.status-chip--info,
.status-chip--running {
  color: var(--info);
  background: var(--info-soft);
  border-color: rgba(101, 184, 255, 0.22);
}

.status-chip--loading {
  color: var(--muted);
}

.lane-chip {
  min-height: 27px;
  padding: 4px 9px;
  font-size: 0.67rem;
  font-weight: 760;
}

.lane-chip--cloud {
  color: #c4c3ff;
  background: var(--cloud-soft);
  border-color: rgba(139, 140, 255, 0.24);
}

.lane-chip--local {
  color: #89efd3;
  background: var(--local-soft);
  border-color: rgba(64, 215, 176, 0.22);
}

.lane-chip--no_llm,
.lane-chip--unknown {
  color: #c3ccd8;
  background: var(--neutral-soft);
  border-color: rgba(155, 168, 185, 0.2);
}

.tag,
.basis-chip {
  min-height: 23px;
  padding: 3px 8px;
  color: var(--text-soft);
  font-size: 0.63rem;
  font-weight: 650;
  background: rgba(255, 255, 255, 0.035);
  border-color: var(--border);
}

.basis-chip--observed {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(103, 211, 145, 0.18);
}

.basis-chip--estimated {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: rgba(243, 182, 91, 0.18);
}

.list-stack {
  display: grid;
  gap: 7px;
}

.attention-item,
.audit-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 57px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
}

.attention-marker {
  width: 7px;
  height: 30px;
  background: var(--warning);
  border-radius: 99px;
}

.attention-marker--danger {
  background: var(--danger);
}

.attention-title {
  color: var(--text);
  font-size: 0.79rem;
  font-weight: 680;
}

.attention-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.69rem;
  line-height: 1.35;
}

.empty-state,
.error-state {
  display: grid;
  min-height: 150px;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

.empty-state--compact,
.error-state--compact {
  min-height: 96px;
}

.empty-state strong,
.error-state strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.error-state {
  color: #e3a5ad;
  border-color: rgba(255, 111, 125, 0.25);
}

.progress-list {
  display: grid;
  gap: 13px;
}

.progress-row {
  display: grid;
  grid-template-columns: minmax(94px, auto) minmax(80px, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.progress-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 650;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.055);
  border-radius: 99px;
}

.progress-fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--neutral);
  border-radius: inherit;
}

.progress-fill--cloud {
  background: var(--cloud);
}

.progress-fill--local {
  background: var(--local);
}

.progress-fill--no_llm {
  background: var(--neutral);
}

.progress-value {
  min-width: 48px;
  color: var(--text-soft);
  font-size: 0.71rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.metric-pair-grid,
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric-pair,
.detail-card {
  min-width: 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.024);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
}

.metric-pair span,
.detail-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 670;
}

.metric-pair strong,
.detail-value {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.metric-note,
.data-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.69rem;
  line-height: 1.5;
}

.metric-note--danger {
  color: #efadb5;
}

.engine-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.engine-card {
  min-height: 164px;
  padding: 16px;
  background: rgba(17, 23, 34, 0.92);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
}

.engine-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.engine-card h3 {
  margin: 14px 0 7px;
}

.engine-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.5;
}

.engine-symbol {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.table-toolbar--filters {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.table-toolbar--filters .table-count {
  margin-left: auto;
}

.search-field,
.select-field {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.search-field {
  width: min(340px, 100%);
  padding-left: 11px;
}

.search-field input,
.select-field select {
  min-width: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}

.search-field input {
  width: 100%;
  padding: 8px 11px 8px 0;
}

.select-field select {
  min-height: 36px;
  padding: 7px 30px 7px 10px;
}

input::placeholder,
textarea::placeholder {
  color: #687587;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.data-table th,
.data-table td {
  padding: 12px 13px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-soft);
}

.data-table th {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 760;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.018);
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  color: var(--text-soft);
  font-size: 0.75rem;
  line-height: 1.4;
}

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

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

.data-table .cell-title {
  min-width: 180px;
  max-width: 360px;
  color: var(--text);
  font-weight: 660;
}

.cell-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 450;
  overflow-wrap: anywhere;
}

.cell-reasons {
  min-width: 210px;
  max-width: 360px;
  color: var(--muted);
  font-size: 0.68rem;
}

.row-button {
  width: 100%;
  padding: 0;
  color: inherit;
  text-align: left;
  background: none;
  border: 0;
}

.row-button:hover .cell-title {
  color: #c8c7ff;
}

.approval-list {
  display: grid;
  gap: 10px;
}

.approval-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding: 18px;
  background: rgba(17, 23, 34, 0.94);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
}

.approval-card--pending {
  border-color: rgba(243, 182, 91, 0.26);
}

.approval-title-row,
.inline-cluster {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.approval-card h3 {
  margin: 10px 0 6px;
}

.approval-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.77rem;
  line-height: 1.5;
}

.approval-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 0.68rem;
}

.approval-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.segmented-control {
  display: inline-flex;
  max-width: 100%;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
}

.segmented-control button {
  min-height: 36px;
  padding: 7px 14px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 680;
  background: transparent;
  border: 0;
  border-radius: 9px;
}

.segmented-control button[aria-selected="true"] {
  color: var(--text);
  background: var(--surface-3);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.engine-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 12px;
}

.rule-list,
.compact-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rule-list li,
.compact-list li {
  position: relative;
  padding-left: 20px;
  color: var(--text-soft);
  font-size: 0.75rem;
  line-height: 1.5;
}

.rule-list li::before,
.compact-list li::before {
  position: absolute;
  top: 0.56em;
  left: 2px;
  width: 6px;
  height: 6px;
  content: "";
  background: var(--cloud);
  border-radius: 50%;
}

.policy-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 20px;
  align-items: start;
}

.policy-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin: 8px 0 10px;
}

.policy-title-row h3 {
  font-size: 1.2rem;
}

.policy-copy {
  max-width: 730px;
  margin: 0;
  color: var(--text-soft);
  font-size: 0.78rem;
  line-height: 1.6;
}

.policy-guardrails {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.kpi-grid--compact .kpi-card {
  min-height: 122px;
}

.definition-list {
  display: grid;
  grid-template-columns: minmax(120px, 0.35fr) minmax(0, 1fr);
  gap: 10px 16px;
  margin: 0;
}

.definition-list dt {
  color: var(--muted);
  font-size: 0.69rem;
}

.definition-list dd {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.74rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.reason-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reason-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text-soft);
  font-size: 0.72rem;
  line-height: 1.45;
}

.reason-list li::before {
  margin-top: 3px;
  color: var(--cloud);
  content: "→";
}

.code-value,
.json-preview {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.code-value {
  color: #c9c8ff;
  font-size: 0.68rem;
}

.json-preview {
  max-height: 240px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  color: #b8c4d4;
  font-size: 0.68rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: rgba(4, 7, 11, 0.55);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}

.dialog {
  width: min(620px, calc(100vw - 28px));
  max-height: min(880px, calc(100vh - 28px));
  padding: 0;
  overflow: hidden;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.dialog--wide {
  width: min(840px, calc(100vw - 28px));
}

.dialog::backdrop {
  background: rgba(1, 3, 7, 0.72);
  backdrop-filter: blur(5px);
}

.dialog-header,
.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 19px;
  background: rgba(255, 255, 255, 0.015);
}

.dialog-header {
  border-bottom: 1px solid var(--border-soft);
}

.dialog-header h2 {
  margin-top: 5px;
  font-size: 1.18rem;
}

.dialog-body {
  max-height: calc(100vh - 190px);
  padding: 19px;
  overflow-y: auto;
}

.dialog-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--border-soft);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.field {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  margin-bottom: 13px;
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 650;
}

.field--wide {
  grid-column: 1 / -1;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
}

.field input,
.field select {
  min-height: 40px;
  padding: 8px 10px;
}

.field textarea {
  padding: 10px;
  line-height: 1.45;
  resize: vertical;
}

.field small,
.score-fieldset p {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 450;
  line-height: 1.45;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  color: var(--text-soft);
  font-size: 0.73rem;
}

.checkbox-field input {
  width: 16px;
  height: 16px;
  accent-color: var(--cloud);
}

.score-fieldset {
  margin: 3px 0 16px;
  padding: 13px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
}

.score-fieldset legend {
  padding: 0 7px;
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 700;
}

.score-fieldset p {
  margin-bottom: 12px;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.score-grid .field {
  margin-bottom: 0;
}

.route-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 4px;
  padding: 14px;
  background: var(--cloud-soft);
  border: 1px solid rgba(139, 140, 255, 0.24);
  border-radius: 12px;
}

.route-preview strong {
  display: block;
  margin-top: 6px;
  font-size: 0.81rem;
}

.route-preview--local {
  background: var(--local-soft);
  border-color: rgba(64, 215, 176, 0.24);
}

.route-preview--error {
  background: var(--danger-soft);
  border-color: rgba(255, 111, 125, 0.24);
}

.task-description {
  margin: 0 0 16px;
  color: var(--text-soft);
  font-size: 0.79rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.detail-section {
  margin-top: 18px;
}

.detail-section h3 {
  margin-bottom: 10px;
  color: var(--text-soft);
  font-size: 0.79rem;
}

.score-bars {
  display: grid;
  gap: 9px;
}

.score-row {
  display: grid;
  grid-template-columns: 95px minmax(80px, 1fr) 40px;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  font-size: 0.68rem;
}

.score-track {
  height: 5px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 99px;
}

.score-track span {
  display: block;
  height: 100%;
  background: var(--cloud);
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(360px, calc(100vw - 36px));
  gap: 8px;
}

.toast {
  padding: 12px 14px;
  color: var(--text-soft);
  font-size: 0.76rem;
  line-height: 1.45;
  background: #182230;
  border: 1px solid var(--border);
  border-radius: 11px;
  box-shadow: var(--shadow);
  animation: toast-in 160ms ease-out both;
}

.toast strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
}

.toast--error {
  border-color: rgba(255, 111, 125, 0.34);
}

.skeleton {
  position: relative;
  overflow: hidden;
  color: transparent !important;
  background: rgba(255, 255, 255, 0.045);
  border-radius: 6px;
}

.skeleton::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.055), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.5s infinite;
}

.button--warning {
  color: #ffd9a2;
  background: var(--warning-soft);
  border-color: rgba(243, 182, 91, 0.32);
}

.control-indicator {
  min-width: 11px;
  font-size: 0.72rem;
  font-weight: 900;
}

.error-action {
  margin-top: 12px;
}

.meter,
.score-meter {
  width: 100%;
  height: 7px;
  overflow: hidden;
  appearance: none;
  color: var(--neutral);
  background: rgba(255, 255, 255, 0.055);
  border: 0;
  border-radius: 99px;
}

.meter::-webkit-progress-bar,
.score-meter::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.055);
  border-radius: 99px;
}

.meter::-webkit-progress-value,
.score-meter::-webkit-progress-value {
  background: currentColor;
  border-radius: 99px;
}

.meter::-moz-progress-bar,
.score-meter::-moz-progress-bar {
  background: currentColor;
  border-radius: 99px;
}

.meter--cloud,
.score-meter {
  color: var(--cloud);
}

.meter--local {
  color: var(--local);
}

.meter--no_llm {
  color: var(--neutral);
}

.compact-stat-list {
  display: grid;
  gap: 8px;
}

.compact-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  color: var(--text-soft);
  font-size: 0.74rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}

.compact-stat strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.finance-grid,
.usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 9px;
}

.finance-card,
.usage-card {
  min-width: 0;
  padding: 13px;
  background: rgba(255, 255, 255, 0.024);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
}

.finance-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.finance-card-head > strong {
  font-size: 0.75rem;
}

.finance-result {
  margin: 15px 0 10px;
  color: var(--success);
  font-size: 1.22rem;
  font-weight: 760;
  letter-spacing: -0.035em;
}

.finance-result.is-negative {
  color: var(--danger);
}

.finance-breakdown {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.67rem;
  line-height: 1.35;
}

.usage-card {
  display: grid;
  align-content: start;
  gap: 8px;
}

.usage-card .lane-chip {
  justify-self: start;
}

.usage-card strong {
  margin-top: 4px;
  color: var(--text);
  font-size: 0.8rem;
}

.usage-card > span:not(.lane-chip) {
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.4;
}

.engine-card--button {
  width: 100%;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.engine-card--button:hover {
  background: var(--surface-2);
  border-color: var(--border);
  transform: translateY(-2px);
}

.inline-create {
  margin-bottom: 14px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
}

.inline-create > summary,
.policy-details > summary {
  padding: 12px 0;
  color: var(--text-soft);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(280px, 1.4fr) minmax(150px, 0.6fr) auto;
  align-items: end;
  gap: 10px;
  padding: 2px 0 14px;
}

.inline-form .field {
  grid-column: auto;
  margin: 0;
}

.inline-form-action {
  padding-bottom: 1px;
}

.stack-form {
  display: grid;
  align-content: start;
}

.stack-form > .button {
  justify-self: start;
}

.record-list,
.attempt-list,
.decision-list {
  display: grid;
  gap: 8px;
}

.record-list--columns {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.record-card,
.attempt-card {
  min-width: 0;
  padding: 13px;
  background: rgba(255, 255, 255, 0.024);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
}

.record-card > strong,
.record-card > a {
  display: block;
  margin-top: 10px;
  color: var(--text);
  font-size: 0.79rem;
  font-weight: 680;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.record-card > p {
  margin: 7px 0 0;
  color: var(--text-soft);
  font-size: 0.72rem;
  line-height: 1.52;
  overflow-wrap: anywhere;
}

.record-meta {
  margin-top: 9px;
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.preserve-lines {
  white-space: pre-wrap;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.mini-fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 9px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 11px;
}

.mini-fieldset legend {
  padding: 0 6px;
  color: var(--text-soft);
  font-size: 0.7rem;
  font-weight: 680;
}

.mini-fieldset .checkbox-field {
  min-height: 32px;
}

.policy-details {
  margin-top: 17px;
  border-top: 1px solid var(--border-soft);
}

.policy-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 4px 0 2px;
}

.policy-columns h4 {
  margin-bottom: 8px;
  color: var(--text-soft);
  font-size: 0.72rem;
}

.validator-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}

.validator-section h4 {
  margin: 0 0 9px;
  color: var(--text-soft);
  font-size: 0.72rem;
}

.validator-section h4:not(:first-child) {
  margin-top: 16px;
}

.contract-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 7px;
}

.contract-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px;
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
}

.contract-card strong {
  color: var(--text-soft);
  font-size: 0.69rem;
}

.contract-card span {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.61rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.circuit-panel {
  border-color: rgba(255, 111, 125, 0.25);
}

.circuit-list {
  display: grid;
  gap: 8px;
  margin-top: 15px;
}

.circuit-reset-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.55fr) minmax(260px, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 11px;
  background: rgba(255, 111, 125, 0.04);
  border: 1px solid rgba(255, 111, 125, 0.14);
  border-radius: 10px;
}

.circuit-reset-form > div > strong {
  color: var(--text);
  font-size: 0.75rem;
}

.circuit-reset-form .field {
  margin: 0;
}

.decision-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  color: inherit;
  text-align: left;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
}

.decision-row:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.decision-row strong,
.decision-row span {
  display: block;
}

.decision-row strong {
  color: var(--text);
  font-size: 0.76rem;
}

.decision-row div:nth-child(2) > span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.4;
}

.preview-reasons {
  margin-top: 6px;
  color: var(--text-soft);
  font-size: 0.69rem;
  line-height: 1.45;
}

.preview-flags {
  margin-top: 8px;
}

.route-preview--neutral {
  background: var(--neutral-soft);
  border-color: rgba(155, 168, 185, 0.24);
}

.reason-code {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.61rem;
}

.output-box {
  max-height: 360px;
  margin: 0;
  padding: 13px;
  overflow: auto;
  color: #c9d4e2;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.68rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: rgba(4, 7, 11, 0.58);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}

.output-box--error {
  color: #ffc2c9;
  background: rgba(70, 15, 24, 0.2);
  border-color: rgba(255, 111, 125, 0.23);
}

.attempt-card .inline-cluster {
  margin-bottom: 9px;
}

.attempt-title {
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 660;
  overflow-wrap: anywhere;
}

.attempt-error {
  margin: 8px 0 0;
  color: #efadb5;
  font-size: 0.68rem;
  line-height: 1.45;
}

.quality-history {
  display: grid;
  gap: 7px;
  margin-bottom: 11px;
}

.quality-event {
  padding: 10px 11px;
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}

.quality-event p {
  margin: 8px 0 4px;
  color: var(--text-soft);
  font-size: 0.7rem;
  line-height: 1.45;
}

.quality-event > span {
  color: var(--muted);
  font-size: 0.62rem;
}

.quality-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 10px;
  padding: 12px;
  background: rgba(139, 140, 255, 0.055);
  border: 1px solid rgba(139, 140, 255, 0.16);
  border-radius: 11px;
}

.quality-form > .button {
  grid-column: 1 / -1;
  justify-self: start;
}

.attempt-card details {
  margin-top: 9px;
  color: var(--muted);
  font-size: 0.67rem;
}

.approval-dialog-task {
  margin: 14px 0 7px;
}

@media (max-width: 1040px) {
  .inline-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .policy-columns {
    grid-template-columns: 1fr;
  }

  .circuit-reset-form {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .circuit-reset-form .button {
    justify-self: start;
  }
}

@media (max-width: 720px) {
  .inline-form,
  .mini-fieldset,
  .record-list--columns,
  .quality-form {
    grid-template-columns: 1fr;
  }

  .decision-row {
    grid-template-columns: 1fr;
  }
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .connection-strip .status-chip span {
    display: none;
  }
}

@media (max-width: 960px) {
  .sidebar {
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 25;
    inset: 0;
    display: block;
    visibility: hidden;
    width: 100%;
    height: 100%;
    padding: 0;
    background: rgba(0, 0, 0, 0.56);
    border: 0;
    opacity: 0;
    transition: opacity 180ms ease, visibility 180ms ease;
  }

  .app-shell.sidebar-open .sidebar-scrim {
    visibility: visible;
    opacity: 1;
  }

  .main {
    margin-left: 0;
    padding-right: 22px;
    padding-left: 22px;
  }

  .topbar {
    margin-right: -22px;
    margin-left: -22px;
    padding-right: 22px;
    padding-left: 22px;
  }

  .mobile-menu-button {
    display: inline-grid !important;
  }

  .dashboard-grid--attention,
  .policy-layout,
  .engine-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .main {
    padding-right: 14px;
    padding-bottom: 34px;
    padding-left: 14px;
  }

  .topbar {
    min-height: 72px;
    margin-right: -14px;
    margin-left: -14px;
    padding: 10px 14px;
  }

  .topbar-kicker,
  .connection-strip,
  .button-label-wide {
    display: none;
  }

  .page-title {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-actions {
    gap: 6px;
  }

  .topbar-actions .button {
    padding-right: 10px;
    padding-left: 10px;
  }

  .view {
    padding-top: 22px;
  }

  .section-heading {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
  }

  .section-heading--actions {
    align-items: stretch;
  }

  .kpi-grid,
  .dashboard-grid,
  .engine-grid,
  .metric-pair-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .kpi-card {
    min-height: 122px;
  }

  .panel,
  .kpi-card,
  .engine-card {
    padding: 15px;
    border-radius: 15px;
  }

  .attention-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .attention-item .button {
    grid-column: 2;
    justify-self: start;
  }

  .table-toolbar,
  .table-toolbar--filters {
    align-items: stretch;
    flex-direction: column;
  }

  .search-field,
  .select-field,
  .select-field select {
    width: 100%;
  }

  .table-toolbar--filters .table-count {
    margin-left: 0;
  }

  .approval-card {
    grid-template-columns: 1fr;
  }

  .approval-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .form-grid,
  .score-grid {
    grid-template-columns: 1fr;
  }

  .route-preview {
    align-items: stretch;
    flex-direction: column;
  }

  .dialog-body {
    max-height: calc(100vh - 180px);
  }

  .dialog-footer {
    flex-wrap: wrap;
  }
}

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