:root {
  --bg-base: #111217;
  --bg-top: #0d0f14;
  --bg-panel: #181b23;
  --bg-panel-2: #1f2330;
  --bg-hover: #252b38;
  --border: rgba(204, 211, 224, 0.12);
  --border-strong: rgba(204, 211, 224, 0.18);
  --text-primary: #e8edf7;
  --text-secondary: #a6afc0;
  --text-muted: #697386;
  --text-link: #77a8ff;
  --accent-blue: #5794f2;
  --accent-green: #73bf69;
  --accent-amber: #f2cc0c;
  --accent-red: #f2495c;
  --accent-purple: #b877d9;
  --topbar-h: 48px;
  --sidebar-w: 48px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  background: var(--bg-base);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-base) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-sans) !important;
  font-size: 13px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

body.kc-dashboard-ready {
  padding: 0;
}

a {
  color: var(--text-link);
}

button,
input,
select,
textarea {
  font-family: var(--font-sans) !important;
}

button,
.button-link,
a.button-link {
  min-height: 32px;
  border: 1px solid var(--border-strong) !important;
  border-radius: 3px !important;
  background: #202432 !important;
  color: var(--text-primary) !important;
  font-size: 12px;
  font-weight: 600;
  padding: 0 11px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

button:hover,
.button-link:hover,
a.button-link:hover {
  background: var(--bg-hover) !important;
  border-color: rgba(87, 148, 242, 0.42) !important;
  text-decoration: none;
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

input,
select,
textarea {
  border: 1px solid var(--border-strong) !important;
  border-radius: 3px !important;
  background: #0f1219 !important;
  color: var(--text-primary) !important;
  box-shadow: none !important;
}

input:focus,
select:focus,
textarea:focus {
  outline: 1px solid var(--accent-blue);
  outline-offset: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--border) !important;
  padding: 9px 10px !important;
  text-align: left;
}

th {
  color: var(--text-secondary) !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  color: var(--text-primary) !important;
  letter-spacing: 0 !important;
}

h1 {
  font-size: 22px !important;
  font-weight: 500 !important;
}

h2 {
  font-size: 15px !important;
  font-weight: 500 !important;
}

h3 {
  font-size: 13px !important;
  font-weight: 500 !important;
}

p,
.small,
.meta,
small,
span {
  color: inherit;
}

pre,
code {
  font-family: var(--font-mono) !important;
}

pre {
  border: 1px solid var(--border) !important;
  border-radius: 3px !important;
  background: #0c0f15 !important;
  color: var(--text-secondary) !important;
}

.kc-topbar {
  position: fixed;
  z-index: 1000;
  top: 0;
  right: 0;
  left: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #1f2430;
  background: var(--bg-top);
  padding: 0 14px 0 10px;
}

.kc-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 100%;
}

.kc-logo {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(87, 148, 242, 0.34);
  border-radius: 5px;
  background: linear-gradient(135deg, rgba(87,148,242,0.28), rgba(115,191,105,0.12));
  color: #dce9ff;
  font-size: 11px;
  font-weight: 700;
}

.kc-wordmark {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
}

.kc-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 12px;
}

.kc-breadcrumb:before {
  content: "";
  width: 1px;
  height: 20px;
  margin: 0 2px;
  background: var(--border-strong);
}

.kc-breadcrumb strong {
  color: var(--text-secondary);
  font-weight: 500;
}

.kc-top-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.kc-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #141822;
  color: var(--text-secondary);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 500;
}

.kc-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 12px rgba(115,191,105,0.65);
}

.kc-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #1b202b;
  color: var(--text-primary);
  font-weight: 600;
}

.kc-sidebar {
  position: fixed;
  z-index: 900;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  border-right: 1px solid #1f2430;
  background: var(--bg-top);
  padding: 8px 5px;
}

.kc-nav-item {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-decoration: none;
}

.kc-nav-item:hover {
  background: #1a1f2b;
  color: var(--text-primary);
  text-decoration: none;
}

.kc-nav-item.active {
  background: #20283a;
  color: var(--accent-blue);
}

.kc-nav-item.active:before {
  content: "";
  position: absolute;
  left: -5px;
  width: 3px;
  height: 22px;
  border-radius: 0 2px 2px 0;
  background: var(--accent-blue);
}

.kc-nav-item svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

.kc-main {
  min-height: calc(100vh - var(--topbar-h));
  margin-top: var(--topbar-h);
  margin-left: var(--sidebar-w);
  padding: 18px;
}

.kc-content {
  max-width: 1600px;
}

.kc-page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.kc-page-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.kc-page-title {
  margin: 4px 0 0;
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 500;
}

.kc-page-description {
  max-width: 680px;
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.kc-time-range {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #141822;
  color: var(--text-secondary);
  padding: 6px 9px;
  font-size: 12px;
}

.kc-observability-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.kc-stat-panel,
.card,
.metric,
.panel,
.subcard,
.message,
.task,
.org-card,
.doc-section,
.lane,
.row {
  border: 1px solid var(--border) !important;
  border-radius: 3px !important;
  background: var(--bg-panel) !important;
  box-shadow: none !important;
}

.kc-stat-panel,
.metric,
.card,
.panel,
.subcard,
.message,
.task,
.org-card,
.doc-section,
.lane,
.row {
  padding: 14px !important;
}

.kc-stat-label,
.metric span,
.small,
.meta,
p {
  color: var(--text-secondary) !important;
}

.kc-stat-value,
.metric strong {
  display: block;
  margin-top: 6px;
  color: var(--text-primary) !important;
  font-size: 32px !important;
  font-weight: 300 !important;
  letter-spacing: -0.8px;
  line-height: 1;
}

.kc-stat-sub {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.kc-chart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 8px;
  align-items: start;
  width: 100%;
  margin-bottom: 10px;
}

.kc-chart-panel {
  height: 220px;
  max-height: 220px;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-panel);
  padding: 8px 14px;
  overflow: hidden;
}

.kc-chart-grid .chart-panel,
.kc-chart-grid .throughput-panel,
.kc-chart-grid [class*="throughput"] {
  height: auto !important;
  max-height: 220px;
}

.kc-chart-grid .throughput-panel {
  height: 220px !important;
  min-width: 0;
}

.kc-chart-grid .throughput-panel canvas,
.kc-chart-panel canvas,
#throughputChart,
#systemThroughputChart,
#kc-line-chart {
  max-width: 100% !important;
  max-height: 150px !important;
  height: 150px !important;
}

.kc-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
}

.throughput-panel .chart-legend,
.throughput-panel .panel-header {
  padding: 6px 12px;
}

.kc-panel-title span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

.kc-gauge {
  height: 118px;
  display: grid;
  place-items: center;
}

.kc-gauge-value {
  color: var(--text-primary);
  font-size: 48px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: -1px;
}

.automation-health-panel,
.kc-chart-grid [class*="automation"] {
  align-self: start;
  padding: 8px 24px;
  min-width: 0;
}

.automation-health-panel .automation-health-value,
.automation-health-panel .health-percent,
.automation-health-panel [class*="health"] .big-number {
  font-size: 48px !important;
  font-weight: 300 !important;
  line-height: 1;
}

.automation-health-label {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: lowercase;
}

.refresh-counter {
  margin-left: 8px;
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}

.kc-panel-grid,
.grid,
.summary,
.metrics,
.ops-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.pill,
.badge,
.kc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-strong) !important;
  border-radius: 3px !important;
  background: #141822 !important;
  color: var(--text-secondary) !important;
  padding: 3px 7px !important;
  font-size: 11px !important;
  font-weight: 500 !important;
}

.pill.approved,
.pill.routed,
.pill.processed,
.pill.passed,
.badge.approved,
.badge.active,
.good strong {
  color: var(--accent-green) !important;
  border-color: rgba(115,191,105,0.45) !important;
}

.pill.pending,
.pill.awaiting_approval,
.pill.new,
.warn strong {
  color: var(--accent-amber) !important;
  border-color: rgba(242,204,12,0.45) !important;
}

.pill.rejected,
.pill.bad,
.bad strong {
  color: var(--accent-red) !important;
  border-color: rgba(242,73,92,0.45) !important;
}

.kc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
  padding-top: 12px;
  color: var(--text-muted);
  font-size: 11px;
}

.kc-code {
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

body.kc-dashboard-ready > header.kc-original-header {
  display: none !important;
}

body.kc-dashboard-ready > main {
  display: block;
  padding: 0 !important;
}

body.kc-dashboard-ready .kc-original-main {
  display: grid;
  gap: 10px;
}

body.kc-dashboard-ready .kc-original-main > section,
body.kc-dashboard-ready .kc-original-main > article {
  min-width: 0;
}

body.kc-dashboard-ready nav:not(.kc-sidebar nav) {
  display: none !important;
}

body.kc-dashboard-ready ul:not(.kc-keep-list) {
  display: grid;
  gap: 8px;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

body.kc-dashboard-ready ul:not(.kc-keep-list) > li {
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #141822;
  padding: 9px 10px;
}

@media (max-width: 1180px) {
  .kc-observability-row,
  .kc-panel-grid,
  .grid,
  .summary,
  .metrics,
  .ops-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kc-chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .kc-wordmark,
  .kc-breadcrumb {
    display: none;
  }

  .kc-main {
    padding: 12px;
  }

  .kc-page-head {
    align-items: start;
    flex-direction: column;
  }

  .kc-observability-row,
  .kc-panel-grid,
  .grid,
  .summary,
  .metrics,
  .ops-grid {
    grid-template-columns: 1fr;
  }
}
