/* Khusela Console — application layer on top of the captured design tokens */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-feature-settings: "cv11", "ss01";
}

a {
  color: inherit;
  text-decoration: none;
}

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

svg {
  display: block;
}

/* ---------- Top navigation ---------- */

.k-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--navbar-height);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  border-bottom: 1px solid hsl(var(--border));
  background: color-mix(in oklab, hsl(var(--background)) 88%, transparent);
  backdrop-filter: blur(14px);
}

.k-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: none;
  margin-right: 4px;
}

.k-brand-logo {
  width: auto;
  height: 38px;
  display: block;
  border-radius: 4px;
}

.k-brand-word {
  font-family: var(--font-brand);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
}

.k-brand-word span {
  color: hsl(var(--primary));
}

.k-nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.k-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
  transition: background-color 120ms, color 120ms;
}

.k-nav-link:hover {
  background: var(--card-hover);
  color: hsl(var(--foreground));
}

.k-nav-link.is-active {
  color: hsl(var(--foreground));
  background: hsl(var(--accent));
}

.k-nav-spacer {
  flex: 1;
}

.k-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  min-width: 190px;
  padding: 0 8px 0 10px;
  border: 1px solid hsl(var(--border));
  border-radius: 7px;
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  background: hsl(var(--card));
  cursor: pointer;
  transition: border-color 120ms;
}

.k-search:hover {
  border-color: hsl(var(--foreground) / 0.2);
}

.k-search kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  border: 1px solid hsl(var(--border));
  border-radius: 4px;
  padding: 1px 4px;
  color: hsl(var(--muted-foreground));
}

.k-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  background: hsl(var(--primary) / 0.12);
  color: hsl(var(--primary));
  border: 1px solid hsl(var(--primary) / 0.2);
  flex: none;
}

.k-nav-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: hsl(var(--muted-foreground));
  flex: none;
}

.k-nav-icon:hover {
  background: var(--card-hover);
  color: hsl(var(--foreground));
}

/* ---------- Sidebar ---------- */

.k-sidebar {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  bottom: 0;
  width: var(--dashboard-sidebar-width);
  z-index: 30;
  border-right: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  padding: 10px 10px 22px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.k-side-group + .k-side-group {
  margin-top: 14px;
}

.k-side-label {
  padding: 6px 10px 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}

.k-side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  transition: background-color 110ms, color 110ms;
}

.k-side-link svg {
  width: 16px;
  height: 16px;
  flex: none;
  stroke-width: 1.75;
}

.k-side-link:hover {
  background: var(--card-hover);
  color: hsl(var(--foreground));
}

.k-side-link.is-active {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.k-side-link .k-side-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
}

.k-side-footer {
  margin-top: 20px;
  padding: 12px 10px;
  border-top: 1px solid hsl(var(--border));
}

.k-side-footer p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: hsl(var(--muted-foreground));
}

.k-side-footer strong {
  display: block;
  margin-bottom: 3px;
  color: hsl(var(--foreground));
  font-weight: 600;
}

/* ---------- Main ---------- */

.k-main {
  min-height: calc(100dvh - var(--navbar-height));
  padding-left: var(--dashboard-sidebar-width);
}

.k-content {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 24px 56px;
}

.k-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.k-page-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  margin: 0;
  font-family: var(--font-brand);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.k-page-sub {
  margin: 5px 0 0;
  font-size: 13.5px;
  color: hsl(var(--muted-foreground));
  max-width: 760px;
}

.k-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */

.k-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms, border-color 120ms, color 120ms;
}

.k-btn svg {
  width: 14px;
  height: 14px;
}

.k-btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.k-btn-primary:hover {
  background: hsl(var(--primary) / 0.88);
}

.k-btn-secondary {
  background: hsl(var(--background));
  border-color: hsl(var(--input));
  color: hsl(var(--foreground));
}

.k-btn-secondary:hover {
  background: hsl(var(--muted));
}

.k-btn-ghost {
  background: transparent;
  color: hsl(var(--muted-foreground));
}

.k-btn-ghost:hover {
  background: var(--card-hover);
  color: hsl(var(--foreground));
}

.k-btn-danger {
  background: hsl(var(--destructive));
  color: #fff;
}

.k-btn-danger:hover {
  background: hsl(var(--destructive) / 0.88);
}

.k-btn-sm {
  height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.k-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Cards ---------- */

.k-card {
  border: 1px solid hsl(var(--border));
  border-radius: 10px;
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  overflow: hidden;
}

.k-card-pad {
  padding: 16px;
}

.k-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 0;
}

.k-card-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.k-card-desc {
  margin: 3px 0 0;
  font-size: 12px;
  color: hsl(var(--muted-foreground));
}

.k-card-body {
  padding: 14px 16px 16px;
}

.k-grid {
  display: grid;
  gap: 12px;
}

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

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

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

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

.k-span-2 {
  grid-column: span 2;
}

.k-mt-16 {
  margin-top: 16px;
}

.k-mt-12 {
  margin-top: 12px;
}

.k-mt-24 {
  margin-top: 24px;
}

/* ---------- Metrics ---------- */

.k-metric {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid hsl(var(--border));
  border-radius: 10px;
  background: hsl(var(--card));
  transition: border-color 120ms, background-color 120ms;
}

.k-metric:hover {
  border-color: hsl(var(--foreground) / 0.16);
  background: var(--card-hover);
}

.k-metric-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 11.5px;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}

.k-metric-label svg {
  width: 13px;
  height: 13px;
}

.k-metric-value {
  margin: 0;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.k-metric-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 11.5px;
  color: hsl(var(--muted-foreground));
}

.k-trend {
  font-weight: 600;
}

.k-trend.up {
  color: hsl(var(--success));
}

.k-trend.down {
  color: hsl(var(--destructive));
}

.k-metric-spark {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 26px;
  opacity: 0.85;
}

.k-metric-spark i {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: hsl(var(--primary) / 0.25);
}

.k-metric-spark i:nth-last-child(-n + 2) {
  background: hsl(var(--primary) / 0.55);
}

/* ---------- Banners ---------- */

.k-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border: 1px solid hsl(var(--primary) / 0.18);
  border-radius: 10px;
  background:
    radial-gradient(600px 80px at 0% 0%, hsl(var(--primary) / 0.1), transparent 70%),
    hsl(var(--card));
  margin-bottom: 16px;
}

.k-banner-icon {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: hsl(var(--primary) / 0.12);
  color: hsl(var(--primary));
}

.k-banner-icon svg {
  width: 18px;
  height: 18px;
}

.k-banner h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.k-banner p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: hsl(var(--muted-foreground));
}

.k-banner .k-btn {
  margin-left: auto;
}

.k-banner code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: hsl(var(--muted));
  border: 1px solid hsl(var(--border));
  padding: 1px 5px;
  border-radius: 4px;
}

/* ---------- Badges / verdicts ---------- */

.k-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.25;
  border: 0;
  background: transparent;
  white-space: nowrap;
}

.k-badge svg {
  width: 11px;
  height: 11px;
}

.k-badge-match {
  color: hsl(var(--success));
}

.k-badge-wait {
  color: hsl(32 90% 38%);
}

.k-badge-stop {
  color: hsl(var(--destructive));
}

.k-badge-neutral {
  color: hsl(var(--muted-foreground));
}

.k-badge-purple {
  color: hsl(var(--primary));
}

.k-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  flex: none;
}

/* ---------- Tables ---------- */

.k-table-wrap {
  overflow-x: auto;
}

.k-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.k-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted) / 0.55);
  border-bottom: 1px solid hsl(var(--border));
  white-space: nowrap;
}

.k-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid hsl(var(--border));
  vertical-align: middle;
  white-space: nowrap;
}

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

.k-table tbody tr {
  transition: background-color 100ms;
}

.k-table tbody tr:hover {
  background: var(--card-hover);
}

.k-table .k-main-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
}

.k-table .k-strong {
  font-weight: 600;
  color: hsl(var(--foreground));
}

.k-table .k-sub {
  display: block;
  font-size: 11.5px;
  color: hsl(var(--muted-foreground));
  font-weight: 400;
  margin-top: 1px;
}

.k-table .k-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.k-table .k-mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.k-table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid hsl(var(--border));
  font-size: 12px;
  color: hsl(var(--muted-foreground));
  flex-wrap: wrap;
}

.k-avatar-cell {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 700;
  flex: none;
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
  border: 1px solid hsl(var(--primary) / 0.16);
}

.k-avatar-cell.neutral {
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  border-color: hsl(var(--border));
}

/* ---------- Charts ---------- */

.k-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 168px;
  padding: 8px 2px 0;
}

.k-chart-bars .k-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  height: 100%;
  min-width: 0;
}

.k-chart-bars .k-bar-stack {
  width: 100%;
  max-width: 26px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  gap: 2px;
}

.k-chart-bars .k-bar {
  width: 100%;
  border-radius: 3px 3px 1px 1px;
  background: hsl(var(--primary) / 0.75);
  transition: opacity 120ms;
}

.k-bar-col:hover .k-bar {
  opacity: 0.8;
}

.k-chart-bars .k-bar.stop {
  background: hsl(var(--destructive) / 0.7);
  border-radius: 1px;
}

.k-chart-bars .k-bar-x {
  font-size: 9.5px;
  color: hsl(var(--muted-foreground));
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.k-chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11.5px;
  color: hsl(var(--muted-foreground));
  flex-wrap: wrap;
}

.k-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.k-chart-legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}

.k-donut-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.k-donut {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  flex: none;
  background: conic-gradient(
    hsl(var(--success)) 0 86.7%,
    hsl(38 92% 50%) 86.7% 91.4%,
    hsl(var(--destructive)) 91.4% 100%
  );
  position: relative;
  display: grid;
  place-items: center;
}

.k-donut::after {
  content: "";
  position: absolute;
  inset: 21px;
  border-radius: 50%;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
}

.k-donut-center {
  position: relative;
  z-index: 1;
  text-align: center;
}

.k-donut-center strong {
  display: block;
  font-size: 22px;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.k-donut-center span {
  font-size: 10.5px;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.k-legend-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
  min-width: 120px;
}

.k-legend-list div {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
}

.k-legend-list i {
  width: 7px;
  height: 7px;
  border-radius: 2px;
}

.k-legend-list b {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.k-legend-list span {
  color: hsl(var(--muted-foreground));
}

/* ---------- Progress / meters ---------- */

.k-meter {
  height: 5px;
  border-radius: 99px;
  background: hsl(var(--muted));
  overflow: hidden;
  min-width: 60px;
}

.k-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: hsl(var(--primary));
}

.k-meter.good i {
  background: hsl(var(--success));
}

.k-meter.warn i {
  background: hsl(38 92% 50%);
}

.k-meter.bad i {
  background: hsl(var(--destructive));
}

.k-meter-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.k-meter-row span {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: hsl(var(--muted-foreground));
  min-width: 36px;
  text-align: right;
}

/* ---------- Lists ---------- */

.k-list {
  display: flex;
  flex-direction: column;
}

.k-list-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 16px;
  border-bottom: 1px solid hsl(var(--border));
  font-size: 12.5px;
}

.k-list-row:last-child {
  border-bottom: 0;
}

.k-list-row .k-list-main {
  min-width: 0;
  flex: 1;
}

.k-list-row .k-list-main b {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.k-list-row .k-list-main span {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  color: hsl(var(--muted-foreground));
}

.k-list-row .k-list-val {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
}

/* ---------- Timeline / pipeline ---------- */

.k-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.k-step {
  display: flex;
  gap: 14px;
  position: relative;
  padding-bottom: 22px;
}

.k-step:last-child {
  padding-bottom: 0;
}

.k-step-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: none;
  width: 28px;
}

.k-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 700;
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
  border: 1px solid hsl(var(--primary) / 0.22);
  flex: none;
}

.k-step-line {
  width: 1px;
  flex: 1;
  background: hsl(var(--border));
  margin-top: 4px;
}

.k-step-body {
  padding-top: 2px;
}

.k-step-body h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.k-step-body p {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: hsl(var(--muted-foreground));
  line-height: 1.55;
  max-width: 720px;
}

.k-step-body code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: hsl(var(--muted));
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid hsl(var(--border));
}

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

.k-flow-card {
  border: 1px solid hsl(var(--border));
  border-radius: 9px;
  background: hsl(var(--card));
  padding: 13px 12px;
  position: relative;
}

.k-flow-card:not(:last-child)::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 50%;
  width: 8px;
  height: 1px;
  background: hsl(var(--border));
}

.k-flow-card .k-flow-n {
  font-family: var(--font-mono);
  font-size: 10px;
  color: hsl(var(--primary));
  font-weight: 600;
  letter-spacing: 0.04em;
}

.k-flow-card h4 {
  margin: 7px 0 4px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}

.k-flow-card p {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: hsl(var(--muted-foreground));
}

/* ---------- Forms ---------- */

.k-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.k-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.k-field label {
  font-size: 12px;
  font-weight: 600;
}

.k-field .k-hint {
  font-size: 11.5px;
  color: hsl(var(--muted-foreground));
  line-height: 1.45;
}

.k-input,
.k-select,
.k-textarea {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid hsl(var(--input));
  border-radius: 7px;
  background: hsl(var(--background));
  font-size: 13px;
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
}

.k-textarea {
  height: auto;
  padding: 9px 10px;
  resize: vertical;
  min-height: 84px;
  line-height: 1.5;
}

.k-input:focus,
.k-select:focus,
.k-textarea:focus {
  border-color: hsl(var(--primary) / 0.55);
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.08);
}

.k-input::placeholder,
.k-textarea::placeholder {
  color: hsl(var(--muted-foreground) / 0.8);
}

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

.k-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0;
  border-bottom: 1px solid hsl(var(--border));
}

.k-switch-row:last-child {
  border-bottom: 0;
}

.k-switch-row b {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
}

.k-switch-row span {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: hsl(var(--muted-foreground));
}

.k-switch {
  width: 34px;
  height: 19px;
  border-radius: 99px;
  background: hsl(var(--primary));
  position: relative;
  flex: none;
  cursor: pointer;
  border: 0;
}

.k-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
}

.k-switch.off {
  background: #b9c1ca;
}

.k-switch.off::after {
  right: auto;
  left: 2px;
}

.k-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 148px;
  padding: 20px;
  border: 1.5px dashed hsl(var(--border));
  border-radius: 9px;
  background: hsl(var(--muted) / 0.25);
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms, background-color 120ms;
}

.k-upload:hover {
  border-color: hsl(var(--primary) / 0.4);
  background: hsl(var(--primary) / 0.03);
}

.k-upload svg {
  width: 26px;
  height: 26px;
  color: hsl(var(--primary));
}

.k-upload b {
  font-size: 12.5px;
  font-weight: 600;
}

.k-upload span {
  font-size: 11.5px;
  color: hsl(var(--muted-foreground));
}

/* ---------- Code / docs ---------- */

.k-code {
  position: relative;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  background: #0b0f14;
  color: #d7e0ea;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
  overflow-x: auto;
  tab-size: 2;
}

.k-code .c-key {
  color: #c8ff00;
}

.k-code .c-str {
  color: #8bd5ff;
}

.k-code .c-com {
  color: #6d7d8d;
}

.k-code .c-fn {
  color: #d7a6ff;
}

.k-inline-code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1.5px 5px;
  border-radius: 4px;
  background: hsl(var(--muted));
  border: 1px solid hsl(var(--border));
}

.k-docs {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.k-docs-nav {
  position: sticky;
  top: calc(var(--navbar-height) + 18px);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.k-docs-nav a {
  padding: 6px 9px;
  border-radius: 6px;
  font-size: 12.5px;
  color: hsl(var(--muted-foreground));
}

.k-docs-nav a:hover {
  background: var(--card-hover);
  color: hsl(var(--foreground));
}

.k-docs-nav .k-docs-label {
  margin: 12px 9px 4px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
}

.k-docs-section {
  margin-bottom: 30px;
  scroll-margin-top: 76px;
}

.k-docs-section h2 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.k-docs-section h3 {
  margin: 18px 0 6px;
  font-size: 13.5px;
  font-weight: 600;
}

.k-docs-section p,
.k-docs-section li {
  font-size: 13px;
  line-height: 1.65;
  color: hsl(var(--muted-foreground));
}

.k-docs-section ul {
  margin: 8px 0;
  padding-left: 18px;
}

.k-docs-section li {
  margin: 4px 0;
}

.k-endpoint {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  background: hsl(var(--muted) / 0.35);
  font-family: var(--font-mono);
  font-size: 12.5px;
  margin: 12px 0;
}

.k-endpoint b {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  background: hsl(var(--success) / 0.14);
  color: hsl(var(--success));
}

.k-endpoint code {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.k-schema {
  width: 100%;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  overflow: hidden;
  font-size: 12px;
  margin: 10px 0;
}

.k-schema div {
  display: grid;
  grid-template-columns: 150px 120px 1fr;
  gap: 12px;
  padding: 7px 12px;
  border-bottom: 1px solid hsl(var(--border));
}

.k-schema div:last-child {
  border-bottom: 0;
}

.k-schema div:first-child {
  background: hsl(var(--muted) / 0.55);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
}

.k-schema code {
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.k-schema span {
  color: hsl(var(--muted-foreground));
}

/* ---------- Settings layout ---------- */

.k-settings {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.k-settings-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.k-settings-nav a {
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
}

.k-settings-nav a:hover {
  background: var(--card-hover);
  color: hsl(var(--foreground));
}

.k-settings-nav a.is-active {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.k-section-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.k-section-desc {
  margin: 3px 0 14px;
  font-size: 12.5px;
  color: hsl(var(--muted-foreground));
}

.k-danger {
  border-color: hsl(var(--destructive) / 0.3);
}

.k-danger .k-card-head {
  background: hsl(var(--destructive) / 0.04);
  padding-bottom: 12px;
}

/* ---------- Utility ---------- */

.k-muted {
  color: hsl(var(--muted-foreground));
}

.k-small {
  font-size: 11.5px;
}

.k-mono {
  font-family: var(--font-mono);
}

.k-flex {
  display: flex;
  align-items: center;
  gap: 8px;
}

.k-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.k-wrap {
  flex-wrap: wrap;
}

.k-sep {
  height: 1px;
  background: hsl(var(--border));
  margin: 14px 0;
}

.k-scroll-x {
  overflow-x: auto;
}

.k-empty {
  padding: 34px 16px;
  text-align: center;
  color: hsl(var(--muted-foreground));
}

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

/* ---------- Responsive ---------- */

@media (max-width: 1200px) {
  .k-grid-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .k-flow {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .k-flow-card:not(:last-child)::after {
    display: none;
  }
}

@media (max-width: 1023px) {
  .k-sidebar {
    display: none;
  }
  .k-main {
    padding-left: 0;
  }
  .k-content {
    padding: 18px 16px 44px;
  }
  .k-docs {
    grid-template-columns: 1fr;
  }
  .k-docs-nav {
    display: none;
  }
  .k-settings {
    grid-template-columns: 1fr;
  }
  .k-settings-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 2px;
    padding-bottom: 4px;
  }
  .k-settings-nav a {
    white-space: nowrap;
  }
}

@media (max-width: 860px) {
  .k-docs {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  .k-docs-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 2px 4px;
    padding-bottom: 10px;
    border-bottom: 1px solid hsl(var(--border));
  }
  .k-docs-nav .k-docs-label {
    width: 100%;
  }
  .k-docs-section {
    min-width: 0;
  }
  .k-nav-links {
    display: none;
  }
  .k-search {
    min-width: 0;
    width: 34px;
    padding: 0;
    justify-content: center;
    border-color: transparent;
    background: transparent;
    flex: none;
  }
  .k-search span,
  .k-search kbd {
    display: none;
  }
  .k-grid-4,
  .k-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .k-grid-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .k-span-2 {
    grid-column: span 2;
  }
  .k-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .k-form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .k-code {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
  .k-schema div:first-child {
    display: none;
  }
  .k-schema div:not(:first-child) {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 10px;
    padding: 9px 12px;
  }
  .k-schema div:not(:first-child) > span:last-child {
    grid-column: 1 / -1;
    line-height: 1.45;
  }
  .k-nav {
    gap: 10px;
    padding: 0 12px;
  }
  .k-nav-icon[aria-label="Documentation"] {
    display: none;
  }
  .k-brand-word {
    font-size: 17px;
  }
  .k-brand .k-brand-logo {
    height: 32px;
  }
  .k-grid-2,
  .k-grid-3,
  .k-grid-4,
  .k-grid-5 {
    grid-template-columns: 1fr;
  }
  .k-span-2 {
    grid-column: span 1;
  }
  .k-page-title {
    font-size: 19px;
  }
  .k-donut-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .k-flow {
    grid-template-columns: 1fr;
  }
  .k-banner {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .k-banner .k-btn {
    margin-left: 48px;
  }
}

/* ---------- Command palette ---------- */

.k-palette {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
  background: hsl(var(--foreground) / 0.22);
  backdrop-filter: blur(3px);
}

.k-palette[hidden] {
  display: none;
}

.k-palette-box {
  width: 100%;
  max-width: 520px;
  border: 1px solid hsl(var(--border));
  border-radius: 11px;
  background: hsl(var(--background));
  box-shadow: 0 24px 60px -12px rgb(0 0 0 / 0.28), 0 2px 8px rgb(0 0 0 / 0.06);
  overflow: hidden;
}

.k-palette-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid hsl(var(--border));
}

.k-palette-input svg {
  width: 16px;
  height: 16px;
  color: hsl(var(--muted-foreground));
  flex: none;
}

.k-palette-input input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 13.5px;
}

.k-palette-input kbd,
.k-palette-foot kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  border: 1px solid hsl(var(--border));
  border-radius: 4px;
  padding: 1px 5px;
  color: hsl(var(--muted-foreground));
}

.k-palette-list {
  max-height: 330px;
  overflow-y: auto;
  padding: 6px;
}

.k-palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}

.k-palette-item em {
  font-style: normal;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--muted-foreground));
}

.k-palette-item:hover,
.k-palette-item:focus {
  background: hsl(var(--accent));
  outline: none;
}

.k-palette-empty {
  padding: 26px 10px;
  text-align: center;
  font-size: 12.5px;
  color: hsl(var(--muted-foreground));
}

.k-palette-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-top: 1px solid hsl(var(--border));
  font-size: 11px;
  color: hsl(var(--muted-foreground));
}

.k-palette-foot span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ---------- Mobile navigation ---------- */

.k-menu-btn {
  display: none;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.k-sidebar-scrim {
  display: none;
}

@media (max-width: 1023px) {
  .k-menu-btn {
    display: grid;
  }
  .k-sidebar {
    display: block;
    transform: translateX(-104%);
    transition: transform 180ms ease;
    box-shadow: 20px 0 60px rgb(0 0 0 / 0.12);
    background: hsl(var(--background));
  }
  .k-nav-open .k-sidebar {
    transform: translateX(0);
  }
  .k-nav-open .k-sidebar-scrim {
    display: block;
    position: fixed;
    inset: var(--navbar-height) 0 0;
    z-index: 29;
    background: hsl(var(--foreground) / 0.18);
  }
}

@media (max-width: 480px) {
  .k-banner .k-btn {
    margin-left: 0;
  }
  .k-content {
    padding: 16px 12px 40px;
  }
}

/* ---------- Toolbars & segmented filters ---------- */

.k-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid hsl(var(--border));
}

.k-segmented {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  gap: 2px;
  border: 1px solid hsl(var(--border));
  border-radius: 7px;
  background: hsl(var(--muted) / 0.4);
}

.k-segmented button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: hsl(var(--muted-foreground));
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.k-segmented button:hover {
  color: hsl(var(--foreground));
}

.k-segmented button.is-active {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.07);
}

.k-segmented button span {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  font-variant-numeric: tabular-nums;
}

.k-search-field {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid hsl(var(--input));
  border-radius: 7px;
  background: hsl(var(--background));
  min-width: 220px;
  flex: 1;
  max-width: 320px;
}

.k-search-field svg {
  width: 14px;
  height: 14px;
  color: hsl(var(--muted-foreground));
  flex: none;
}

.k-search-field input {
  border: 0;
  outline: none;
  background: transparent;
  font-size: 12.5px;
  width: 100%;
  min-width: 0;
}

.k-signal {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
}

.k-signal svg {
  width: 12px;
  height: 12px;
  flex: none;
}

.k-signal.bad {
  color: hsl(var(--destructive));
  font-weight: 500;
}

.k-signal.warn {
  color: hsl(32 90% 38%);
  font-weight: 500;
}

.k-signal.good {
  color: hsl(var(--success));
}

.k-row-actions {
  opacity: 0;
  transition: opacity 100ms;
}

tr:hover .k-row-actions {
  opacity: 1;
}

@media (max-width: 620px) {
  .k-toolbar {
    align-items: stretch;
  }
  .k-segmented {
    width: 100%;
    overflow-x: auto;
  }
  .k-search-field {
    max-width: none;
    min-width: 0;
  }
}
