/* Lumo UI: shadcn/ui's design language (New York style, zinc base), written as
   plain CSS on VS Code's theme so it runs in a webview with no build and no
   network. One accent, the hero's colour (--hero, --hero-foreground), used
   sparingly: the primary button, focus rings, progress, the current account.

   Tokens follow shadcn's names. Components are .ui-* classes. Icons are Lucide
   paths (24 viewBox, stroke 2) inlined as SVG. */

:root {
  --radius: 8px;
  --hero: var(--vscode-button-background);
  --hero-foreground: var(--vscode-button-foreground);

  --background: var(--vscode-sideBar-background, var(--vscode-editor-background));
  --foreground: var(--vscode-foreground);
  --card: color-mix(in srgb, var(--vscode-foreground) 2.5%, var(--background));
  --card-foreground: var(--foreground);
  --popover: var(--vscode-editorWidget-background, var(--card));
  --popover-foreground: var(--vscode-editorWidget-foreground, var(--foreground));
  --muted: color-mix(in srgb, var(--vscode-foreground) 6%, var(--background));
  --muted-foreground: var(--vscode-descriptionForeground);
  --accent: color-mix(in srgb, var(--vscode-foreground) 7%, transparent);
  --accent-foreground: var(--foreground);
  --border: color-mix(in srgb, var(--vscode-foreground) 11%, transparent);
  --input: color-mix(in srgb, var(--vscode-foreground) 15%, transparent);
  --ring: color-mix(in srgb, var(--hero) 70%, transparent);
  --primary: var(--hero);
  --primary-foreground: var(--hero-foreground);
  --secondary: var(--muted);
  --secondary-foreground: var(--foreground);
  --destructive: var(--vscode-errorForeground, #ef4444);
  --success: #22c55e;
  --warning: #eab308;
  --font-sans: var(--vscode-font-family, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif);
  --font-mono: var(--vscode-editor-font-family, ui-monospace, 'SF Mono', Menlo, monospace);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.12);
  --shadow-md: 0 4px 12px -2px rgb(0 0 0 / 0.28), 0 2px 4px -2px rgb(0 0 0 / 0.2);
}
body.vscode-light {
  --success: #16a34a;
  --warning: #ca8a04;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.06);
  --shadow-md: 0 4px 12px -2px rgb(0 0 0 / 0.12), 0 2px 4px -2px rgb(0 0 0 / 0.08);
}
body.vscode-high-contrast,
body.vscode-high-contrast-light {
  --border: var(--vscode-contrastBorder);
  --input: var(--vscode-contrastBorder);
  --ring: var(--vscode-focusBorder);
}

/* --- base */
.ui,
.ui * {
  box-sizing: border-box;
}
.ui {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
}
.ui :focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.ui-icon {
  width: 16px;
  height: 16px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ui-icon--sm {
  width: 14px;
  height: 14px;
}
.ui-muted {
  color: var(--muted-foreground);
}
.ui-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.ui-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* --- type */
.ui-h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.ui-h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.ui-label,
.ui-section-label {
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}
.ui-section-label {
  color: var(--muted-foreground);
}
.ui-small {
  font-size: 12px;
}

/* --- card */
.ui-card {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: var(--card);
  color: var(--card-foreground);
  box-shadow: var(--shadow-sm);
}
.ui-card-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 14px 0;
}
.ui-card-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}
.ui-card-description {
  font-size: 12px;
  color: var(--muted-foreground);
}
.ui-card-content {
  padding: 14px;
}
.ui-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px 14px;
}

/* --- button */
.ui-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid transparent;
  font: 500 12.5px/1 var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s, opacity 0.12s;
  background: var(--primary);
  color: var(--primary-foreground);
}
.ui-btn:hover {
  background: color-mix(in srgb, var(--primary) 88%, var(--foreground));
}
.ui-btn:disabled,
.ui-btn[aria-disabled='true'] {
  opacity: 0.5;
  pointer-events: none;
}
.ui-btn--secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}
.ui-btn--secondary:hover {
  background: color-mix(in srgb, var(--foreground) 10%, var(--background));
}
.ui-btn--outline {
  background: transparent;
  color: var(--foreground);
  border-color: var(--input);
  box-shadow: var(--shadow-sm);
}
.ui-btn--outline:hover,
.ui-btn--ghost:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}
.ui-btn--ghost {
  background: transparent;
  color: var(--foreground);
}
.ui-btn--destructive {
  background: var(--destructive);
  color: #fff;
}
.ui-btn--link {
  background: transparent;
  color: var(--foreground);
  height: auto;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border);
}
.ui-btn--link:hover {
  background: transparent;
  text-decoration-color: currentColor;
}
.ui-btn--sm {
  height: 26px;
  padding: 0 9px;
  font-size: 12px;
}
.ui-btn--lg {
  height: 36px;
  padding: 0 16px;
  font-size: 13px;
}
.ui-btn--icon {
  width: 28px;
  height: 28px;
  padding: 0;
}
.ui-btn--block {
  width: 100%;
}

/* --- badge */
.ui-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: calc(var(--radius) - 3px);
  border: 1px solid transparent;
  font: 500 11px/1 var(--font-sans);
  white-space: nowrap;
  background: var(--primary);
  color: var(--primary-foreground);
}
.ui-badge--secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}
.ui-badge--outline {
  background: transparent;
  color: var(--foreground);
  border-color: var(--border);
}
.ui-badge--success {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
}
.ui-badge--warning {
  background: color-mix(in srgb, var(--warning) 16%, transparent);
  color: var(--warning);
}
.ui-badge--destructive {
  background: color-mix(in srgb, var(--destructive) 14%, transparent);
  color: var(--destructive);
}
.ui-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  flex: none;
}

/* --- switch: <button class="ui-switch" role="switch" aria-checked="true"><span class="ui-switch__thumb"></span></button> */
.ui-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: none;
  width: 32px;
  height: 18px;
  padding: 2px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--input);
  cursor: pointer;
  transition: background-color 0.15s;
}
.ui-switch[aria-checked='true'] {
  background: var(--primary);
}
.ui-switch__thumb {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--background);
  box-shadow: var(--shadow-sm);
  transform: translateX(0);
  transition: transform 0.15s;
}
body.vscode-dark .ui-switch[aria-checked='false'] .ui-switch__thumb {
  background: color-mix(in srgb, var(--foreground) 75%, var(--background));
}
.ui-switch[aria-checked='true'] .ui-switch__thumb {
  transform: translateX(14px);
  background: var(--primary-foreground);
}
.ui-switch[aria-busy='true'] {
  opacity: 0.6;
  cursor: progress;
}

/* --- progress: <div class="ui-progress" style="--value: 42"><div class="ui-progress__bar"></div></div> */
.ui-progress {
  position: relative;
  height: 6px;
  width: 100%;
  overflow: hidden;
  border-radius: 999px;
  background: var(--secondary);
}
.ui-progress__bar {
  height: 100%;
  width: calc(var(--value, 0) * 1%);
  border-radius: inherit;
  background: var(--bar, var(--primary));
  transition: width 0.4s ease;
}
.ui-progress--thin {
  height: 4px;
}

/* --- avatar */
.ui-avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 32px;
  height: 32px;
  overflow: hidden;
  border-radius: calc(var(--radius) - 2px);
  background: var(--muted);
  color: var(--muted-foreground);
  font-weight: 600;
}
.ui-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 8%;
}
.ui-avatar--sm {
  width: 24px;
  height: 24px;
}
.ui-avatar--lg {
  width: 40px;
  height: 40px;
}
.ui-avatar--round {
  border-radius: 999px;
}

/* --- separator */
.ui-separator {
  height: 1px;
  width: 100%;
  background: var(--border);
  border: 0;
  margin: 0;
}

/* --- tabs: <div class="ui-tabs__list" role="tablist"><button class="ui-tabs__trigger" role="tab" aria-selected="true">…</button></div> */
.ui-tabs__list {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 30px;
  padding: 3px;
  border-radius: var(--radius);
  background: var(--muted);
  color: var(--muted-foreground);
}
.ui-tabs__list--full {
  display: flex;
  width: 100%;
}
.ui-tabs__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 1;
  height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: calc(var(--radius) - 3px);
  background: transparent;
  color: inherit;
  font: 500 12px/1 var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
}
.ui-tabs__trigger:hover {
  color: var(--foreground);
}
.ui-tabs__trigger[aria-selected='true'] {
  background: var(--background);
  color: var(--foreground);
  box-shadow: var(--shadow-sm);
}

/* --- inputs */
.ui-input,
.ui-textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--foreground);
  font: 13px/1.4 var(--font-sans);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.ui-input {
  height: 32px;
  padding: 0 10px;
}
.ui-textarea {
  min-height: 64px;
  padding: 8px 10px;
  resize: vertical;
}
.ui-input::placeholder,
.ui-textarea::placeholder {
  color: var(--muted-foreground);
}
.ui-input:focus,
.ui-textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 25%, transparent);
}
.ui-input[aria-invalid='true'] {
  border-color: var(--destructive);
}
.ui-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ui-help {
  font-size: 12px;
  color: var(--muted-foreground);
}

/* --- radio card: <label class="ui-radio-card"><input type="radio">…</label> */
.ui-radio-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.12s, background-color 0.12s;
}
.ui-radio-card:hover {
  background: var(--accent);
}
.ui-radio-card:has(input:checked) {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.ui-radio-card input {
  appearance: none;
  flex: none;
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  border: 1px solid var(--input);
  border-radius: 999px;
  display: grid;
  place-content: center;
}
.ui-radio-card input::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--primary);
  transform: scale(0);
  transition: transform 0.12s;
}
.ui-radio-card input:checked {
  border-color: var(--primary);
}
.ui-radio-card input:checked::before {
  transform: scale(1);
}

/* --- alert */
.ui-alert {
  position: relative;
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 2px 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.ui-alert > .ui-icon {
  margin-top: 1px;
  color: var(--alert, var(--foreground));
}
.ui-alert__title {
  grid-column: 2;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
}
.ui-alert__description {
  grid-column: 2;
  font-size: 12px;
  color: var(--muted-foreground);
}
.ui-alert--destructive {
  --alert: var(--destructive);
  border-color: color-mix(in srgb, var(--destructive) 40%, transparent);
}
.ui-alert--destructive .ui-alert__title {
  color: var(--destructive);
}

/* --- list rows */
.ui-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 7px 8px;
  border-radius: calc(var(--radius) - 2px);
}
.ui-row--interactive {
  cursor: pointer;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
}
.ui-row--interactive:hover {
  background: var(--accent);
}
.ui-row[aria-current='true'] {
  background: var(--accent);
}

/* --- popover */
.ui-popover {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--popover);
  color: var(--popover-foreground);
  box-shadow: var(--shadow-md);
}

/* --- skeleton */
.ui-skeleton {
  border-radius: calc(var(--radius) - 2px);
  background: linear-gradient(90deg, var(--muted) 0%, color-mix(in srgb, var(--foreground) 10%, var(--background)) 50%, var(--muted) 100%);
  background-size: 200% 100%;
  animation: ui-shimmer 1.4s ease-in-out infinite;
}
@keyframes ui-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

/* --- kbd */
.ui-kbd {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--muted);
  font: 500 10.5px/1 var(--font-mono);
  color: var(--muted-foreground);
}

@media (prefers-reduced-motion: reduce) {
  .ui *,
  .ui *::before,
  .ui *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
