/* SettingsPage — page-specific styles */

/* ── Page title ────────────────────────────────────────── */
.set-h1 {
  font-size: var(--kr-fs-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.set-meta {
  color: var(--kr-text-muted);
  font-size: var(--kr-fs-base);
  margin-top: var(--kr-sp-2);
}

/* ── Section navigation (sticky pills) ─────────────────── */
.set-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--kr-bg-base);
  padding: 10px 0 8px;
  margin-bottom: var(--kr-sp-6);
  display: flex;
  gap: var(--kr-sp-3);
  overflow-x: auto;
  border-bottom: 1px solid var(--kr-border-ghost);
}

.set-nav-btn {
  padding: 5px var(--kr-sp-6);
  border-radius: 20px;
  border: 1px solid var(--kr-border-light);
  background: transparent;
  color: var(--kr-text-muted);
  cursor: pointer;
  font-size: var(--kr-fs-sm);
  font-family: inherit;
  white-space: nowrap;
}

/* ── Card ──────────────────────────────────────────────── */
.set-card {
  background: var(--kr-bg-surface);
  border: 1px solid var(--kr-border);
  border-radius: var(--kr-r-xl);
  margin-bottom: var(--kr-sp-5);
  box-shadow: var(--kr-shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.set-card[data-active="true"] {
  border-color: var(--kr-border-strong);
}

/* ── Accordion sections (Agents / Skills / Profiles / Directives) ──── */

.set-accordion-section {
  border-bottom: 1px solid var(--kr-border);
}

.set-accordion-section:last-child {
  border-bottom: none;
}

.set-accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--kr-sp-4);
  padding: var(--kr-sp-6) var(--kr-sp-8);
  border: none;
  background: transparent;
  color: var(--kr-text-primary);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.set-accordion-header:hover {
  background: var(--kr-bg-subtle);
}

.set-accordion-chevron {
  color: var(--kr-text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.set-accordion-chevron[data-expanded="true"] {
  transform: rotate(90deg);
}

.set-accordion-count {
  font-size: var(--kr-fs-xs);
  color: var(--kr-text-muted);
  background: var(--kr-bg-hover);
  padding: 1px 6px;
  border-radius: var(--kr-r-sm);
  margin-left: auto;
}

.set-accordion-body {
  padding: 0 var(--kr-sp-8) var(--kr-sp-8);
}

/* ── Ollama card (v0.4.0) ─────────────────────────────── */

.set-ollama-card {
  padding: var(--kr-sp-6) var(--kr-sp-8);
}

.set-ollama-header {
  margin-bottom: var(--kr-sp-4);
}

.set-ollama-status {
  font-size: var(--kr-fs-xs);
  font-weight: 600;
}

.set-ollama-body {
  padding-left: var(--kr-sp-9);
}

.set-ollama-wizard {
  background: rgba(var(--kr-info-rgb), 0.04);
  border: 1px solid rgba(var(--kr-info-rgb), 0.1);
  border-radius: var(--kr-r-lg);
  padding: var(--kr-sp-6);
}

.set-ollama-wizard-title {
  font-size: var(--kr-fs-sm);
  font-weight: 700;
  color: var(--kr-text-primary);
  display: flex;
  align-items: center;
  gap: var(--kr-sp-3);
  margin-bottom: var(--kr-sp-4);
}

.set-ollama-wizard-desc {
  font-size: var(--kr-fs-xs);
  color: var(--kr-text-secondary);
  line-height: 1.5;
  margin: 0 0 var(--kr-sp-4);
}

.set-ollama-commands {
  display: flex;
  flex-direction: column;
  gap: var(--kr-sp-3);
  margin-bottom: var(--kr-sp-4);
}

.set-ollama-cmd-group {
  display: flex;
  align-items: center;
  gap: var(--kr-sp-4);
}

.set-ollama-cmd-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--kr-text-muted);
  min-width: 60px;
}

.set-ollama-cmd {
  font-size: var(--kr-fs-xs);
  background: var(--kr-bg-hover);
  border: 1px solid var(--kr-border);
  border-radius: var(--kr-r-sm);
  padding: 3px 8px;
  color: var(--kr-text-secondary);
  user-select: all;
}

.set-ollama-hint {
  font-size: var(--kr-fs-xs);
  color: var(--kr-text-secondary);
  line-height: 1.6;
  margin: 0 0 var(--kr-sp-4);
  white-space: pre-line;
  background: transparent;
  border: none;
  padding: 0;
  font-family: inherit;
}

.set-ollama-link {
  font-size: var(--kr-fs-xs);
  color: var(--kr-accent-text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.set-ollama-link:hover {
  text-decoration: underline;
}

.set-ollama-suggestions {
  display: flex;
  flex-direction: column;
  gap: var(--kr-sp-3);
}

.set-ollama-suggestion {
  display: flex;
  align-items: baseline;
  gap: var(--kr-sp-4);
  flex-wrap: wrap;
}

.set-ollama-suggestion-desc {
  font-size: 9px;
  color: var(--kr-text-muted);
}

.set-ollama-models {
  padding: var(--kr-sp-2) 0;
}

.set-ollama-model-list {
  display: flex;
  flex-direction: column;
  gap: var(--kr-sp-2);
}

.set-ollama-model-row {
  display: flex;
  align-items: center;
  gap: var(--kr-sp-3);
  padding: 2px 0;
}

/* Pickable variant — the read-only check icon is replaced by a radio
 * dot; the whole row becomes a clickable target. We keep
 * `.set-ollama-model-row` for back-compat with any future "info only"
 * usage; the `-pickable` modifier adds the affordance + hover state. */
.set-ollama-model-row-pickable {
  display: flex;
  align-items: center;
  gap: var(--kr-sp-3);
  padding: 4px var(--kr-sp-3);
  border: 1px solid transparent;
  border-radius: var(--kr-r-sm);
  background: transparent;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 60ms ease;
}
.set-ollama-model-row-pickable:hover,
.set-ollama-model-row-pickable:focus-visible {
  background: rgba(var(--kr-text-rgb), 0.04);
  border-color: rgba(var(--kr-text-rgb), 0.08);
  outline: none;
}
.set-ollama-model-row-pickable[data-selected="true"] {
  background: rgba(var(--kr-success-rgb), 0.08);
  border-color: rgba(var(--kr-success-rgb), 0.25);
}
.set-ollama-model-row-pickable:disabled {
  opacity: 0.6;
  cursor: wait;
}

.set-ollama-radio {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid var(--kr-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.set-ollama-radio[data-checked="true"] {
  border-color: var(--kr-success);
  background: rgba(var(--kr-success-rgb), 0.1);
}

.set-ollama-default-tag {
  margin-left: auto;
  font-size: var(--kr-fs-2xs);
  font-weight: 600;
  color: var(--kr-success);
  padding: 1px 6px;
  border-radius: var(--kr-r-sm);
  background: rgba(var(--kr-success-rgb), 0.12);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.set-ollama-model-name {
  font-size: var(--kr-fs-xs);
  color: var(--kr-text-primary);
}

.set-ollama-pull-hint {
  margin-top: var(--kr-sp-4);
  padding-top: var(--kr-sp-3);
  border-top: 1px solid var(--kr-border);
}

/* ── Card section (padding wrapper) ────────────────────── */
.set-section {
  padding: var(--kr-sp-8) var(--kr-sp-9);
}

/* ── Section header: icon + title ──────────────────────── */
.set-section-header {
  display: flex;
  align-items: center;
  gap: var(--kr-sp-4);
  margin-bottom: var(--kr-sp-4);
}

.set-section-header-lg {
  margin-bottom: var(--kr-sp-6);
}

.set-section-title {
  font-weight: 600;
  font-size: var(--kr-fs-lg);
}

/* ── Hint / description text ───────────────────────────── */
.set-hint {
  color: var(--kr-text-faint);
  font-size: var(--kr-fs-base);
  margin-bottom: var(--kr-sp-6);
}

.set-hint-sm {
  color: var(--kr-text-faint);
  font-size: var(--kr-fs-sm);
  margin-bottom: var(--kr-sp-5);
  line-height: 1.4;
}

.set-hint-xs {
  font-size: var(--kr-fs-xs);
  color: var(--kr-text-muted);
  margin-top: var(--kr-sp-2);
}

/* ── Language / choice button (toggle pill) ────────────── */
.set-choice-btn {
  padding: var(--kr-sp-4) var(--kr-sp-8);
  border-radius: var(--kr-r-md);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--kr-fs-base);
  font-weight: 600;
  background: var(--kr-bg-hover);
  color: var(--kr-text-muted);
  border: 1px solid var(--kr-border-light);
  transition: background 0.15s, border-color 0.15s;
}

.set-choice-btn[data-active="true"] {
  background: var(--kr-accent-bg-strong);
  color: var(--kr-accent);
  border-color: rgba(var(--kr-accent-rgb), 0.3);
}

/* ── Radio option (STT model card) ─────────────────────── */
.set-radio-option {
  display: flex;
  align-items: center;
  gap: var(--kr-sp-6);
  padding: var(--kr-sp-5) var(--kr-sp-7);
  border-radius: var(--kr-r-lg);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  background: var(--kr-bg-subtle);
  border: 1px solid var(--kr-border-light);
  transition: border-color 0.15s, background 0.15s;
}

.set-radio-option[data-active="true"] {
  background: rgba(var(--kr-accent-rgb), 0.06);
  border-color: var(--kr-accent-border);
}

/* ── Radio dot ─────────────────────────────────────────── */
.set-radio-dot {
  width: 16px;
  height: 16px;
  border-radius: var(--kr-r-full);
  flex-shrink: 0;
  border: 2px solid var(--kr-text-ghost);
  background: transparent;
  transition: all 0.15s;
}

.set-radio-dot[data-active="true"] {
  border: 5px solid var(--kr-accent);
  background: var(--kr-accent);
}

/* ── Voice button (TTS) ───────────────────────────────── */
.set-voice-btn {
  display: flex;
  align-items: center;
  gap: var(--kr-sp-3);
  padding: var(--kr-sp-3) var(--kr-sp-6);
  border-radius: var(--kr-r-md);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--kr-fs-base);
  background: var(--kr-bg-subtle);
  border: 1px solid var(--kr-border-light);
  color: var(--kr-text-tertiary);
  transition: border-color 0.15s, background 0.15s;
}

.set-voice-btn[data-active="true"] {
  background: rgba(var(--kr-accent-rgb), 0.06);
  border-color: var(--kr-accent-border);
  color: var(--kr-text-primary);
}

/* ── Gender badge (F/M) ───────────────────────────────── */
.set-gender-badge {
  font-size: var(--kr-fs-2xs);
  font-weight: 700;
  padding: 1px 4px;
  border-radius: var(--kr-r-xs);
}

.set-gender-badge[data-gender="F"] {
  background: rgba(var(--kr-pink-rgb), 0.15);
  color: var(--kr-pink);
}

.set-gender-badge[data-gender="M"] {
  background: rgba(var(--kr-info-rgb), 0.15);
  color: var(--kr-info);
}

/* ── Form label ────────────────────────────────────────── */
.set-form-label {
  font-size: var(--kr-fs-sm);
  font-weight: 600;
  color: var(--kr-text-tertiary);
  display: block;
  margin-bottom: var(--kr-sp-2);
}

/* ── Icon button ───────────────────────────────────────── */
.set-icon-btn {
  background: none;
  border: 1px solid var(--kr-border-light);
  border-radius: var(--kr-r-sm);
  padding: var(--kr-sp-2) var(--kr-sp-4);
  color: var(--kr-text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  font-size: var(--kr-fs-sm);
}

.set-icon-btn-bare {
  padding: 0;
}

/* ── Install / action button ───────────────────────────── */
.set-install-btn {
  padding: var(--kr-sp-3) var(--kr-sp-7);
  background: rgba(var(--kr-accent-rgb), 0.1);
  color: var(--kr-accent);
  border: 1px solid var(--kr-accent-border);
  border-radius: var(--kr-r-md);
  font-size: var(--kr-fs-base);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--kr-sp-3);
  font-family: inherit;
}

/* ── Scan / accent action button ───────────────────────── */
.set-action-btn {
  padding: 7px var(--kr-sp-7);
  border-radius: var(--kr-r-md);
  border: 1px solid var(--kr-accent-border);
  background: rgba(var(--kr-accent-rgb), 0.05);
  color: var(--kr-accent);
  cursor: pointer;
  font-size: var(--kr-fs-base);
  font-family: inherit;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--kr-sp-3);
}

/* ── Danger button ─────────────────────────────────────── */
.set-danger-btn {
  background: rgba(var(--kr-error-rgb), 0.08);
  border: 1px solid rgba(var(--kr-error-rgb), 0.2);
  border-radius: var(--kr-r-md);
  padding: var(--kr-sp-3) var(--kr-sp-7);
  color: var(--kr-error);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--kr-sp-3);
  font-size: var(--kr-fs-base);
  font-family: inherit;
}

/* ── Input ─────────────────────────────────────────────── */
.set-input {
  width: 100%;
  padding: var(--kr-sp-4) var(--kr-sp-6);
  background: var(--kr-bg-hover);
  border: 1px solid var(--kr-border-light);
  border-radius: var(--kr-r-md);
  color: var(--kr-text-primary);
  font-size: var(--kr-fs-base);
  font-family: inherit;
  outline: none;
}

.set-input:focus {
  border-color: var(--kr-accent-border-light);
}

.set-input-sm {
  font-size: var(--kr-fs-sm);
  padding: var(--kr-sp-3) var(--kr-sp-4);
}

.set-input-xs {
  font-size: var(--kr-fs-xs);
  padding: 3px 6px;
}

/* ── Textarea ──────────────────────────────────────────── */
.set-textarea {
  width: 100%;
  padding: var(--kr-sp-4) var(--kr-sp-6);
  background: var(--kr-bg-hover);
  border: 1px solid var(--kr-border-light);
  border-radius: var(--kr-r-md);
  color: var(--kr-text-primary);
  font-family: var(--kr-font-mono);
  font-size: var(--kr-fs-base);
  line-height: 1.5;
  outline: none;
  min-height: 120px;
  resize: vertical;
}

/* ── Inline code ───────────────────────────────────────── */
.set-code {
  font-size: var(--kr-fs-sm);
  font-family: var(--kr-font-mono);
  background: var(--kr-bg-hover-strong);
  padding: 2px var(--kr-sp-3);
  border-radius: var(--kr-r-sm);
}

/* ── Status dot ────────────────────────────────────────── */
.set-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--kr-r-full);
  flex-shrink: 0;
  background: var(--kr-bg-selected);
}

.set-dot[data-on="true"] {
  background: var(--kr-success);
  box-shadow: 0 0 6px rgba(var(--kr-success-rgb), 0.4);
}

/* ── Origin badge (npm, etc.) ──────────────────────────── */
.set-origin-badge {
  font-size: var(--kr-fs-xs);
  font-weight: 600;
  padding: 1px var(--kr-sp-3);
  border-radius: var(--kr-r-sm);
  background: rgba(var(--kr-info-rgb), 0.1);
  color: rgba(var(--kr-info-rgb), 0.7);
  border: 1px solid rgba(var(--kr-info-rgb), 0.15);
}

/* ── Update badge ──────────────────────────────────────── */
.set-update-badge {
  font-size: var(--kr-fs-xs);
  font-weight: 600;
  padding: 1px var(--kr-sp-3);
  border-radius: var(--kr-r-sm);
  background: rgba(var(--kr-warning-rgb), 0.1);
  color: var(--kr-warning);
  margin-left: var(--kr-sp-3);
}

/* Clickable variant — turns the badge into an "update available" CTA
 * opening the per-agent update modal. Same color tokens as the static
 * variant; we add an inset border on hover so the affordance reads
 * "button" without shifting layout. */
.set-update-badge-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid transparent;
  cursor: pointer;
}
.set-update-badge-cta:hover,
.set-update-badge-cta:focus-visible {
  border-color: rgba(var(--kr-warning-rgb), 0.4);
  background: rgba(var(--kr-warning-rgb), 0.18);
  outline: none;
}

/* RTK section freshness pill — same shape as the agent update CTA,
 * scoped to the compression card. Mirrors visual weight so users
 * recognize "update available" wherever it appears. */
.set-compression-update-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--kr-fs-2xs);
  font-weight: 600;
  padding: 1px var(--kr-sp-3);
  border-radius: var(--kr-r-sm);
  background: rgba(var(--kr-warning-rgb), 0.12);
  color: var(--kr-warning);
  border: 1px solid transparent;
  cursor: pointer;
}
.set-compression-update-pill:hover,
.set-compression-update-pill:focus-visible {
  border-color: rgba(var(--kr-warning-rgb), 0.4);
  background: rgba(var(--kr-warning-rgb), 0.2);
  outline: none;
}

/* Modal "Copy command" button — used by both the per-agent update
 * modal and the RTK update modal. Subtle, sits flush with the pre
 * block above. */
.set-compression-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--kr-sp-2);
  padding: 4px var(--kr-sp-3);
  font-size: var(--kr-fs-xs);
  background: rgba(var(--kr-text-rgb), 0.04);
  border: 1px solid rgba(var(--kr-text-rgb), 0.1);
  border-radius: var(--kr-r-sm);
  color: var(--kr-text-secondary);
  cursor: pointer;
}
.set-compression-copy-btn:hover,
.set-compression-copy-btn:focus-visible {
  background: rgba(var(--kr-text-rgb), 0.08);
  outline: none;
}

/* ── Account / usage link per agent (added 2026-05-10) ──── */
/* Sits in the same row as the version badge — discrete, opens
 * the provider's billing/usage dashboard in a new tab. The arrow
 * glyph already telegraphs "external link" so we keep the chrome
 * minimal. */
.set-agent-account-link {
  font-size: var(--kr-fs-2xs);
  color: var(--kr-text-tertiary);
  text-decoration: none;
  padding: 1px var(--kr-sp-2);
  border-radius: var(--kr-r-sm);
  transition: color 0.12s, background 0.12s;
}
.set-agent-account-link:hover {
  color: var(--kr-text-primary);
  background: rgba(var(--kr-accent-rgb), 0.08);
}

/* ── Toggle switch ─────────────────────────────────────── */
.set-toggle-track {
  width: 30px;
  height: 16px;
  border-radius: 8px;
  position: relative;
  transition: background 0.2s;
  background: var(--kr-bg-active);
  border: 1px solid var(--kr-border-strong);
}

.set-toggle-track[data-on="true"] {
  background: rgba(var(--kr-accent-rgb), 0.3);
  border-color: rgba(var(--kr-accent-rgb), 0.4);
}

.set-toggle-thumb {
  width: 12px;
  height: 12px;
  border-radius: var(--kr-r-full);
  position: absolute;
  top: 1px;
  transition: left 0.2s;
  background: var(--kr-bg-selected);
}

.set-toggle-thumb[data-on="true"] {
  background: var(--kr-accent);
}

/* ── Enable/disable toggle button ──────────────────────── */
.set-enable-btn {
  font-size: var(--kr-fs-xs);
  padding: 2px var(--kr-sp-4);
  border-radius: var(--kr-r-sm);
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  font-family: inherit;
}

.set-enable-btn[data-on="true"] {
  background: rgba(var(--kr-accent-rgb), 0.1);
  border-color: var(--kr-accent-border);
  color: var(--kr-accent);
}

.set-enable-btn[data-on="false"] {
  background: rgba(var(--kr-warning-amber-rgb), 0.1);
  border-color: rgba(var(--kr-warning-amber-rgb), 0.2);
  color: var(--kr-warning-amber);
}

/* ── Discover keys button ──────────────────────────────── */
.set-discover-btn {
  font-size: var(--kr-fs-xs);
  padding: 2px var(--kr-sp-4);
  border-radius: var(--kr-r-sm);
  background: rgba(var(--kr-accent-rgb), 0.06);
  border: 1px solid rgba(var(--kr-accent-rgb), 0.15);
  color: var(--kr-accent);
  display: flex;
  align-items: center;
  gap: var(--kr-sp-2);
  cursor: pointer;
  font-family: inherit;
}

/* ── Permission box ────────────────────────────────────── */
.set-perm-box {
  margin-left: 22px;
  margin-top: var(--kr-sp-4);
  padding: var(--kr-sp-4) var(--kr-sp-6);
  border-radius: var(--kr-r-md);
  background: var(--kr-bg-subtle);
  border: 1px solid var(--kr-border-ghost);
}

/* ── Key row ───────────────────────────────────────────── */
.set-key-row {
  display: flex;
  align-items: center;
  gap: var(--kr-sp-3);
  padding: 2px 0 2px var(--kr-sp-8);
}

/* ── Token badge (masked/visible) ──────────────────────── */
.set-token-badge {
  font-size: var(--kr-fs-xs);
  padding: 1px var(--kr-sp-3);
  border-radius: var(--kr-r-sm);
}

.set-token-badge[data-disabled="true"] {
  background: var(--kr-bg-hover);
  color: var(--kr-text-ghost);
  text-decoration: line-through;
}

.set-token-badge[data-disabled="false"] {
  background: rgba(var(--kr-success-rgb), 0.1);
  color: rgba(var(--kr-success-rgb), 0.7);
}

/* ── Model tier select ─────────────────────────────────── */
.set-tier-select {
  background: var(--kr-bg-input);
  border: 1px solid var(--kr-border-strong);
  border-radius: var(--kr-r-sm);
  padding: 3px 6px;
  font-size: var(--kr-fs-xs);
  color: var(--kr-text-primary);
  font-family: inherit;
  width: 150px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 20px;
}

.set-tier-select option {
  background: var(--kr-bg-input);
  color: var(--kr-text-primary);
}

/* ── Agent row ─────────────────────────────────────────── */
.set-agent-row {
  padding: var(--kr-sp-5) 0;
  border-top: 1px solid var(--kr-border-ghost);
}

/* ── Agent sub-section (indented) ──────────────────────── */
.set-agent-sub {
  margin-left: 22px;
  margin-top: var(--kr-sp-3);
}

/* ── WSL warning ───────────────────────────────────────── */
.set-wsl-warning {
  padding: var(--kr-sp-4) var(--kr-sp-6);
  margin-bottom: var(--kr-sp-4);
  border-radius: var(--kr-r-md);
  background: rgba(var(--kr-warning-rgb), 0.06);
  border: 1px solid rgba(var(--kr-warning-rgb), 0.15);
  display: flex;
  align-items: flex-start;
  gap: var(--kr-sp-4);
}

/* ── Compression section (RTK) ─────────────────────────── */
.set-compression {
  padding: var(--kr-sp-5) var(--kr-sp-6);
  margin-bottom: var(--kr-sp-5);
  border-radius: var(--kr-r-md);
  border: 1px solid var(--kr-border-soft);
  background: var(--kr-bg-raised);
}

.set-compression-state-attn {
  background: rgba(var(--kr-warning-rgb), 0.06);
  border-color: rgba(var(--kr-warning-rgb), 0.2);
}

.set-compression-state-ok {
  background: rgba(var(--kr-success-rgb), 0.05);
  border-color: rgba(var(--kr-success-rgb), 0.18);
}

.set-compression-head {
  display: flex;
  gap: var(--kr-sp-4);
  align-items: flex-start;
  margin-bottom: var(--kr-sp-3);
}

.set-compression-icon {
  display: inline-flex;
  padding: 6px;
  border-radius: var(--kr-r-sm);
  background: rgba(var(--kr-success-rgb), 0.12);
  color: var(--kr-success);
  flex-shrink: 0;
}

.set-compression-explainer {
  margin: 2px 0 0 0;
  font-size: var(--kr-fs-sm);
  color: var(--kr-text-secondary);
  line-height: 1.45;
}

.set-compression-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  background: transparent;
  border: none;
  color: var(--kr-text-ghost);
  cursor: pointer;
  border-radius: 50%;
  transition: color 0.12s, background 0.12s;
}

.set-compression-info-btn:hover,
.set-compression-info-btn[aria-expanded="true"] {
  color: var(--kr-text-primary);
  background: var(--kr-bg-hover);
}

.set-compression-sobriety {
  margin-top: var(--kr-sp-3);
  padding: var(--kr-sp-3) var(--kr-sp-4);
  border-left: 2px solid var(--kr-border-medium);
  background: var(--kr-bg-base);
  border-radius: 0 var(--kr-r-sm) var(--kr-r-sm) 0;
}

.set-compression-sobriety-title {
  font-size: var(--kr-fs-xs);
  font-weight: 600;
  color: var(--kr-text-primary);
  margin-bottom: 2px;
}

.set-compression-sobriety-body {
  margin: 0;
  font-size: var(--kr-fs-xs);
  color: var(--kr-text-secondary);
  line-height: 1.5;
  font-style: italic;
}

.set-compression-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--kr-fs-sm);
  margin-top: var(--kr-sp-3);
}

.set-compression-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.set-compression-state-ok .set-compression-dot {
  background: var(--kr-success);
  box-shadow: 0 0 0 3px rgba(var(--kr-success-rgb), 0.18);
}

.set-compression-state-attn .set-compression-dot {
  background: var(--kr-warning);
  box-shadow: 0 0 0 3px rgba(var(--kr-warning-rgb), 0.18);
}

.set-compression-status-text {
  font-weight: 500;
  color: var(--kr-text-primary);
}

.set-compression-savings {
  color: var(--kr-text-secondary);
}

.set-compression-details-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--kr-border-soft);
  border-radius: 10px;
  color: var(--kr-text-ghost);
  font-size: var(--kr-fs-2xs);
  cursor: pointer;
}

.set-compression-details-toggle:hover {
  background: var(--kr-bg-hover);
  color: var(--kr-text-primary);
}

.set-compression-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--kr-sp-4);
  margin-top: var(--kr-sp-4);
  padding: var(--kr-sp-4);
  background: var(--kr-bg-base);
  border-radius: var(--kr-r-sm);
  border: 1px solid var(--kr-border-soft);
}

.set-compression-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.set-compression-stat-label {
  font-size: var(--kr-fs-2xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--kr-text-ghost);
}

.set-compression-stat-value {
  font-size: var(--kr-fs-lg);
  font-weight: 600;
  color: var(--kr-text-primary);
  font-variant-numeric: tabular-nums;
}

.set-compression-warning {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--kr-sp-2);
  padding: 6px 10px;
  border-radius: var(--kr-r-sm);
  background: rgba(var(--kr-text-ghost-rgb, 140, 140, 140), 0.08);
  font-size: var(--kr-fs-xs);
  color: var(--kr-text-secondary);
}

.set-compression-actions {
  display: flex;
  align-items: center;
  gap: var(--kr-sp-4);
  margin-top: var(--kr-sp-4);
  flex-wrap: wrap;
}

.set-compression-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--kr-r-sm);
  background: var(--kr-accent);
  color: var(--kr-bg-base);
  border: none;
  font-size: var(--kr-fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.12s;
}

.set-compression-cta:hover:not(:disabled) {
  opacity: 0.9;
}

.set-compression-cta:disabled {
  opacity: 0.6;
  cursor: wait;
}

.set-compression-uninstall {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--kr-r-sm);
  background: transparent;
  color: var(--kr-text-ghost);
  border: 1px solid var(--kr-border-soft);
  font-size: var(--kr-fs-xs);
  cursor: pointer;
  transition: all 0.12s;
}

.set-compression-uninstall:hover:not(:disabled) {
  border-color: rgba(var(--kr-error-rgb), 0.4);
  color: rgba(var(--kr-error-rgb), 0.95);
  background: rgba(var(--kr-error-rgb), 0.05);
}

.set-compression-uninstall:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.set-compression-attrib {
  font-size: var(--kr-fs-xs);
  color: var(--kr-text-ghost);
  margin-left: auto;
}

.set-compression-link {
  color: var(--kr-accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.set-compression-link:hover {
  text-decoration: underline;
}

.set-compression-modal {
  max-width: 520px;
}

.set-compression-modal-body {
  padding: var(--kr-sp-5) var(--kr-sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--kr-sp-4);
}

.set-compression-install-label {
  font-size: var(--kr-fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--kr-text-ghost);
}

.set-compression-install-cmd {
  padding: 10px 12px;
  background: var(--kr-bg-base);
  border: 1px solid var(--kr-border-soft);
  border-radius: var(--kr-r-sm);
  font-family: var(--kr-font-mono);
  font-size: var(--kr-fs-xs);
  overflow-x: auto;
  margin: 0;
  user-select: all;
}

.set-compression-modal-links {
  display: flex;
  gap: var(--kr-sp-5);
  font-size: var(--kr-fs-sm);
}

/* ── Per-agent RTK badge (inside .set-agent-sub) ──────── */
.set-agent-rtk-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: var(--kr-fs-2xs);
  font-weight: 500;
}

.set-agent-rtk-badge[data-state="active"] {
  background: rgba(var(--kr-success-rgb), 0.1);
  color: var(--kr-success);
}

.set-agent-rtk-badge[data-state="missing"] {
  background: rgba(var(--kr-warning-rgb), 0.1);
  color: var(--kr-warning);
}

.set-agent-rtk-badge[data-state="not-installed"] {
  background: rgba(var(--kr-text-ghost-rgb, 140, 140, 140), 0.1);
  color: var(--kr-text-ghost);
}

/* Inline runtime-degradation warning under an agent row in Settings →
 * Agents (e.g. Vibe SDK fallback). Subtle warning tint, matches the
 * popover note used in ChatHeader's summary-strategy section so the
 * UX language is consistent. */
.set-agent-runtime-warning {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: var(--kr-r-sm);
  font-size: var(--kr-fs-xs);
  line-height: 1.35;
  background: rgba(var(--kr-warning-rgb), 0.10);
  color: var(--kr-warning);
  border: 1px solid rgba(var(--kr-warning-rgb), 0.25);
}

.set-agent-rtk-badge[data-state="not-applicable"] {
  background: transparent;
  color: var(--kr-text-ghost);
  font-style: italic;
}

/* ── Usage expand button ───────────────────────────────── */
.set-usage-btn {
  display: flex;
  align-items: center;
  gap: var(--kr-sp-3);
  cursor: pointer;
  padding: var(--kr-sp-2) 0;
  background: none;
  border: none;
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
}

/* ── Best practices box ────────────────────────────────── */
.set-best-practices {
  margin-top: var(--kr-sp-8);
  padding: var(--kr-sp-6) var(--kr-sp-7);
  border-radius: var(--kr-r-lg);
  background: var(--kr-accent-bg);
  border: 1px solid rgba(var(--kr-accent-rgb), 0.08);
}

.set-best-practices a {
  color: var(--kr-text-tertiary);
  text-decoration: none;
}

/* ── Category badge (skills, profiles, directives) ─────── */
.set-cat-badge {
  font-size: var(--kr-fs-2xs);
  padding: 1px var(--kr-sp-3);
  border-radius: var(--kr-r-md);
  font-weight: 600;
}

.set-cat-badge[data-cat="Language"],
.set-cat-badge[data-cat="Technical"] {
  background: rgba(var(--kr-info-rgb), 0.15);
  color: var(--kr-info);
  border: 1px solid rgba(var(--kr-info-rgb), 0.3);
}

.set-cat-badge[data-cat="Business"] {
  background: rgba(var(--kr-success-rgb), 0.15);
  color: var(--kr-success);
  border: 1px solid rgba(var(--kr-success-rgb), 0.3);
}

.set-cat-badge[data-cat="Domain"] {
  background: rgba(var(--kr-accent-rgb), 0.1);
  color: var(--kr-accent);
  border: 1px solid var(--kr-accent-border);
}

.set-cat-badge[data-cat="Meta"] {
  background: rgba(var(--kr-purple-rgb), 0.1);
  color: var(--kr-purple-soft);
  border: 1px solid rgba(var(--kr-purple-rgb), 0.2);
}

.set-cat-badge[data-cat="Output"] {
  background: rgba(var(--kr-warning-amber-rgb), 0.15);
  color: var(--kr-warning-soft);
  border: 1px solid rgba(var(--kr-warning-amber-rgb), 0.3);
}

/* ── Builtin / custom badge ────────────────────────────── */
.set-builtin-badge {
  font-size: var(--kr-fs-2xs);
  padding: 1px var(--kr-sp-3);
  border-radius: var(--kr-r-md);
  background: var(--kr-bg-hover);
  color: var(--kr-text-dim);
  border: 1px solid var(--kr-border-light);
}

.set-custom-badge {
  font-size: var(--kr-fs-2xs);
  padding: 1px var(--kr-sp-3);
  border-radius: var(--kr-r-md);
  background: rgba(var(--kr-purple-rgb), 0.1);
  color: rgba(var(--kr-purple-rgb), 0.7);
  border: 1px solid rgba(var(--kr-purple-rgb), 0.2);
}

.set-custom-badge[data-variant="directive"] {
  background: rgba(var(--kr-warning-amber-rgb), 0.1);
  color: rgba(var(--kr-warning-amber-rgb), 0.7);
  border-color: rgba(var(--kr-warning-amber-rgb), 0.2);
}

/* ── Token cost badge ──────────────────────────────────── */
.set-token-cost-badge {
  font-size: var(--kr-fs-2xs);
  padding: 1px 5px;
  border-radius: var(--kr-r-md);
  background: rgba(var(--kr-warning-amber-rgb), 0.1);
  color: rgba(var(--kr-warning-amber-rgb), 0.7);
  border: 1px solid rgba(var(--kr-warning-amber-rgb), 0.2);
}

/* ── Skill / directive card ────────────────────────────── */
.set-item-card {
  padding: var(--kr-sp-5) var(--kr-sp-7);
  border-radius: var(--kr-r-lg);
  width: 220px;
  background: var(--kr-bg-hover);
  border: 1px solid var(--kr-border-light);
  /* Stop 4-pill header rows (category + builtin/custom + token estimate + ...)
     from pushing the card wider than its fixed 220px on long skill names. */
  overflow: hidden;
}

/* The header row — title on left, pills on right. Let pills wrap under the
   title when the name is long instead of overflowing the card. */
.set-item-card > .flex-between {
  flex-wrap: wrap;
  row-gap: var(--kr-sp-2);
  align-items: flex-start;
}

/* Keep the pill cluster tight and wrap-friendly; never shrink below its
   content so we don't get a truncated "~608 to" badge. */
.set-item-card > .flex-between > .flex-row {
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ── Profile card ──────────────────────────────────────── */
.set-profile-card {
  padding: var(--kr-sp-7) var(--kr-sp-8);
  border-radius: var(--kr-r-xl);
  width: 280px;
  background: var(--kr-bg-hover);
  border: 1px solid var(--kr-border-light);
  position: relative;
}

/* ── Profile avatar container ──────────────────────────── */
.set-profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--kr-r-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

/* ── Create form panel ─────────────────────────────────── */
.set-create-form {
  padding: var(--kr-sp-8);
  border-radius: var(--kr-r-lg);
  background: var(--kr-bg-hover);
  border: 1px solid var(--kr-border-medium);
}

/* ── Grid layouts for forms ────────────────────────────── */
.set-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--kr-sp-5);
  margin-bottom: var(--kr-sp-5);
}

.set-grid-avatar {
  display: grid;
  grid-template-columns: 60px 1fr 80px;
  gap: var(--kr-sp-5);
  margin-bottom: var(--kr-sp-5);
}

/* ── Scan ignore chip ──────────────────────────────────── */
.set-ignore-chip {
  display: flex;
  align-items: center;
  gap: var(--kr-sp-2);
  padding: 3px var(--kr-sp-4);
  background: var(--kr-bg-hover);
  border: 1px solid var(--kr-border-light);
  border-radius: var(--kr-r-sm);
  font-size: var(--kr-fs-sm);
  font-family: var(--kr-font-mono);
}

.set-ignore-chip-x {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
}

/* ── Section divider (inside a card) ───────────────────── */
.set-inner-divider {
  padding-top: var(--kr-sp-6);
  border-top: 1px solid var(--kr-border-ghost);
}

/* ── Identity section ──────────────────────────────────── */
.set-avatar-circle {
  width: 48px;
  height: 48px;
  border-radius: var(--kr-r-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.set-avatar-circle[data-variant="accent"] {
  background: rgba(var(--kr-accent-rgb), 0.1);
  border: 2px solid var(--kr-accent-border);
  font-size: 16px;
  font-weight: 700;
  color: var(--kr-accent);
}

.set-avatar-circle[data-variant="empty"] {
  background: var(--kr-bg-hover);
  border: 2px solid var(--kr-border-medium);
  font-size: var(--kr-fs-base);
  color: var(--kr-text-ghost);
}

.set-gravatar-img {
  width: 48px;
  height: 48px;
  border-radius: var(--kr-r-full);
  border: 2px solid var(--kr-accent-border);
}

/* ── Invite code box ───────────────────────────────────── */
.set-invite-box {
  margin-top: var(--kr-sp-8);
  padding: var(--kr-sp-6) var(--kr-sp-7);
  border-radius: var(--kr-r-lg);
  background: var(--kr-accent-bg);
  border: 1px solid rgba(var(--kr-accent-rgb), 0.08);
}

.set-invite-code {
  flex: 1;
  font-size: var(--kr-fs-sm);
  color: var(--kr-accent);
  background: var(--kr-bg-code);
  padding: var(--kr-sp-3) var(--kr-sp-5);
  border-radius: var(--kr-r-md);
  font-family: var(--kr-font-mono);
  word-break: break-all;
}

/* ── Connection guide ──────────────────────────────────── */
.set-guide-box {
  margin-top: var(--kr-sp-8);
  padding: var(--kr-sp-6) var(--kr-sp-7);
  border-radius: var(--kr-r-lg);
  background: var(--kr-bg-subtle);
  border: 1px solid var(--kr-border-light);
}

.set-guide-inner {
  margin-top: var(--kr-sp-5);
  padding: var(--kr-sp-4) var(--kr-sp-5);
  border-radius: var(--kr-r-md);
  background: var(--kr-bg-subtle);
  border: 1px solid var(--kr-border-ghost);
}

/* ── Tailscale badge ───────────────────────────────────── */
.set-tailscale-badge {
  font-size: var(--kr-fs-2xs);
  padding: 1px var(--kr-sp-3);
  border-radius: var(--kr-r-sm);
  background: rgba(var(--kr-success-rgb), 0.1);
  color: var(--kr-success);
  border: 1px solid rgba(var(--kr-success-rgb), 0.2);
}

/* ── IP item button ────────────────────────────────────── */
.set-ip-btn {
  display: flex;
  align-items: center;
  gap: var(--kr-sp-3);
  padding: var(--kr-sp-2) var(--kr-sp-3);
  font-size: var(--kr-fs-xs);
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--kr-r-sm);
  color: inherit;
  font: inherit;
}

.set-ip-btn[data-active="true"] {
  background: rgba(var(--kr-accent-rgb), 0.03);
  border-color: rgba(var(--kr-accent-rgb), 0.1);
  cursor: default;
}

.set-ip-btn[data-active="false"] {
  cursor: pointer;
}

/* ── IP kind badge ─────────────────────────────────────── */
.set-ip-kind {
  padding: 1px 5px;
  border-radius: var(--kr-r-xs);
  font-size: 8px;
  font-weight: 600;
}

.set-ip-kind[data-kind="tailscale"] {
  background: rgba(var(--kr-success-rgb), 0.1);
  color: var(--kr-success);
  border: 1px solid rgba(var(--kr-success-rgb), 0.2);
}

.set-ip-kind[data-kind="vpn"] {
  background: rgba(var(--kr-info-rgb), 0.1);
  color: var(--kr-info);
  border: 1px solid rgba(var(--kr-info-rgb), 0.2);
}

.set-ip-kind[data-kind="local"],
.set-ip-kind[data-kind="lan"] {
  background: var(--kr-bg-hover);
  color: var(--kr-text-muted);
  border: 1px solid var(--kr-border-light);
}

/* ── Auth status badge ─────────────────────────────────── */
.set-export-warning {
  display: flex;
  align-items: flex-start;
  gap: var(--kr-sp-4);
  padding: var(--kr-sp-4) var(--kr-sp-6);
  border-radius: var(--kr-r-md);
  background: rgba(var(--kr-warning-rgb), 0.06);
  border: 1px solid rgba(var(--kr-warning-rgb), 0.15);
  margin-bottom: var(--kr-sp-4);
  font-size: var(--kr-fs-sm);
  color: rgba(var(--kr-warning-rgb), 0.8);
  line-height: 1.5;
}

.set-export-warning svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: rgba(var(--kr-warning-rgb), 0.7);
}

.set-export-warning a {
  color: var(--kr-accent);
  text-decoration: underline;
  cursor: pointer;
}

.set-auth-badge {
  font-size: var(--kr-fs-xs);
  font-weight: 600;
  padding: 1px var(--kr-sp-3);
  border-radius: var(--kr-r-sm);
  margin-left: var(--kr-sp-2);
}

.set-auth-badge[data-on="true"] {
  background: rgba(var(--kr-success-rgb), 0.1);
  color: var(--kr-success);
  border: 1px solid rgba(var(--kr-success-rgb), 0.2);
}

.set-auth-badge[data-on="false"] {
  background: rgba(var(--kr-error-rgb), 0.1);
  color: var(--kr-error);
  border: 1px solid rgba(var(--kr-error-rgb), 0.2);
}

/* ── Domain input ──────────────────────────────────────── */
.set-domain-input {
  flex: 1;
  font-family: var(--kr-font-mono);
  font-size: var(--kr-fs-base);
  background: var(--kr-bg-hover);
  border: 1px solid var(--kr-border-medium);
  border-radius: var(--kr-r-sm);
  padding: var(--kr-sp-2) var(--kr-sp-4);
  color: var(--kr-text-on-dark);
  outline: none;
}

/* ── Warning callout ───────────────────────────────────── */
.set-warning-callout {
  display: flex;
  align-items: center;
  gap: var(--kr-sp-3);
  margin-top: var(--kr-sp-4);
  padding: var(--kr-sp-3) var(--kr-sp-5);
  border-radius: var(--kr-r-md);
  background: rgba(var(--kr-warning-amber-rgb), 0.06);
  border: 1px solid rgba(var(--kr-warning-amber-rgb), 0.15);
}

/* ── Database stats ────────────────────────────────────── */
.set-db-stat {
  text-align: center;
}

.set-db-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--kr-accent);
}

.set-db-stat-label {
  font-size: var(--kr-fs-xs);
  color: var(--kr-text-faint);
  margin-top: 2px;
}

/* ── Usage section ─────────────────────────────────────── */

/* Toggle group (tokens/cost, filter) */
.set-usage-toggle-group {
  display: inline-flex;
  border: 1px solid var(--kr-border-light);
  border-radius: var(--kr-r-sm);
  overflow: hidden;
}

.set-usage-toggle-btn {
  padding: 3px 8px;
  font-size: var(--kr-fs-xs);
  font-family: inherit;
  background: transparent;
  color: var(--kr-text-muted);
  border: none;
  border-right: 1px solid var(--kr-border-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
  transition: background 0.15s, color 0.15s;
}

.set-usage-toggle-btn:last-child { border-right: none; }
.set-usage-toggle-btn[data-active="true"] {
  background: rgba(var(--kr-accent-rgb), 0.1);
  color: var(--kr-accent);
}

/* Summary cards grid */
.set-usage-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--kr-sp-4);
  margin-bottom: var(--kr-sp-8);
}

.set-usage-card {
  background: var(--kr-bg-elevated);
  border: 1px solid var(--kr-border-light);
  border-top: 2px solid var(--kr-border-medium);
  border-radius: var(--kr-r-md);
  padding: var(--kr-sp-4) var(--kr-sp-5);
  text-align: center;
}

.set-usage-card-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--kr-text-primary);
  line-height: 1.2;
}

.set-usage-card-label {
  font-size: var(--kr-fs-xs);
  color: var(--kr-text-faint);
  margin-top: 4px;
}

.set-usage-card-sub {
  font-size: var(--kr-fs-xs);
  color: var(--kr-text-muted);
  margin-top: 2px;
}

/* Section subtitle */
.set-usage-subtitle {
  font-size: var(--kr-fs-sm);
  font-weight: 600;
  color: var(--kr-text-muted);
  margin-bottom: var(--kr-sp-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: var(--kr-sp-2);
}

.set-usage-collapse-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.set-usage-count {
  font-size: var(--kr-fs-2xs);
  color: var(--kr-text-faint);
  background: var(--kr-bg-hover-strong);
  border-radius: 8px;
  padding: 1px 6px;
  margin-left: 4px;
}

/* Provider bar */
.set-usage-bar-container {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  gap: 2px;
  background: var(--kr-bg-hover);
}

.set-usage-bar-segment {
  border-radius: 4px;
  min-width: 4px;
  transition: width 0.3s;
}

.set-usage-legend {
  display: flex;
  align-items: center;
  gap: var(--kr-sp-2);
}

.set-usage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Project rows with bar */
.set-usage-project-row {
  margin-bottom: var(--kr-sp-3);
}

.set-usage-project-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.set-usage-project-bar-bg {
  height: 6px;
  border-radius: 3px;
  background: var(--kr-bg-hover);
  overflow: hidden;
}

.set-usage-project-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--kr-accent);
  opacity: 0.6;
  transition: width 0.3s;
}

/* Top rows */
.set-usage-row {
  display: flex;
  align-items: center;
  gap: var(--kr-sp-4);
  padding: var(--kr-sp-2) 0;
  border-bottom: 1px solid var(--kr-border-ghost);
}

.set-usage-row:last-child { border-bottom: none; }

.set-usage-row-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.set-usage-row-link {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  background: none;
  border: none;
  font-family: inherit;
  font-size: var(--kr-fs-sm);
  color: var(--kr-accent-text);
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  transition: color 0.15s;
}

.set-usage-row-link:hover {
  color: var(--kr-accent);
  text-decoration: underline;
}

/* Daily chart */
.set-usage-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 100px;
  padding: var(--kr-sp-2) 0;
}

.set-usage-chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  min-width: 0;
}

.set-usage-chart-bar {
  width: 100%;
  max-width: 24px;
  border-radius: 3px 3px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse;
  margin-top: auto;
  transition: height 0.3s;
}

.set-usage-chart-seg {
  width: 100%;
  min-height: 1px;
}

.set-usage-chart-label {
  font-size: 9px;
  color: var(--kr-text-faint);
  margin-top: 4px;
  white-space: nowrap;
}

/* ── Footer ────────────────────────────────────────────── */
.set-footer {
  text-align: center;
  padding: var(--kr-sp-9) 0 var(--kr-sp-5);
  color: var(--kr-text-muted);
  font-size: var(--kr-fs-sm);
}

.set-footer a {
  color: var(--kr-accent-text);
  text-decoration: none;
}

/* ── TTS language section title ────────────────────────── */
.set-tts-lang-title {
  font-size: var(--kr-fs-sm);
  font-weight: 600;
  color: var(--kr-text-muted);
  margin-bottom: var(--kr-sp-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Range slider ──────────────────────────────────────── */
.set-range {
  flex: 1;
  accent-color: var(--kr-accent);
  cursor: pointer;
}

/* ── sr-only (screen-reader only) ──────────────────────── */
.set-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;
}

/* ── Profile persona see-more button ───────────────────── */
.set-see-more-btn {
  font-size: var(--kr-fs-2xs);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 0;
  font-family: inherit;
  opacity: 0.8;
}

/* ── Persona name edit input ───────────────────────────── */
.set-persona-input {
  background: var(--kr-bg-active);
  border-radius: var(--kr-r-sm);
  font-weight: 700;
  font-size: var(--kr-fs-md);
  font-family: inherit;
  padding: 1px var(--kr-sp-3);
  width: 70px;
}

/* ── Avatar input (large emoji) ────────────────────────── */
.set-avatar-input {
  text-align: center;
  font-size: var(--kr-fs-2xl);
  padding: var(--kr-sp-2);
}

/* ── Color input ───────────────────────────────────────── */
.set-color-input {
  width: 100%;
  height: 34px;
  padding: 2px;
  cursor: pointer;
}

/* ── Spin animation (used for loader) ──────────────────── */
@keyframes set-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.set-spin {
  animation: set-spin 1s linear infinite;
}

/* Reusable spin utility — reuses the `spin` keyframe from reset.css.
   Referenced by the refresh button in the Debug log viewer. */
.animate-spin {
  animation: spin 1s linear infinite;
}

/* ── Debug log viewer ────────────────────────────────────────────────
   Monospace scrollable area with a subtle terminal vibe. Alignment of
   the level tag (ERROR / WARN / INFO / DEBUG / TRACE) depends on the
   5-char-padded format emitted server-side in `log_buffer::format_line`. */
.set-debug-viewer {
  margin: 0;
  padding: 12px;
  max-height: 420px;
  min-height: 120px;
  overflow: auto;
  background: var(--kr-bg-code);
  border: 1px solid var(--kr-border);
  border-radius: var(--kr-r-md);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: var(--kr-fs-xs);
  line-height: 1.45;
  color: var(--kr-text-secondary);
  white-space: pre;
  tab-size: 2;
}

.set-debug-viewer:focus-visible {
  outline: 1px solid rgba(var(--kr-accent-rgb), 0.55);
  outline-offset: 1px;
}

/* ── Debug "LIVE" badge — header of the Debug card ──────────────────
   Shown when serverDebugMode=true so users have an unmistakable visual
   signal that verbose capture is active (the user explicitly asked for
   this — the checkbox alone wasn't visually loud enough). */
.set-debug-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: var(--kr-r-sm);
  background: rgba(var(--kr-error-rgb), 0.14);
  border: 1px solid rgba(var(--kr-error-rgb), 0.35);
  color: var(--kr-error-soft);
  font-size: var(--kr-fs-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.set-debug-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--kr-error);
  box-shadow: 0 0 0 0 rgba(var(--kr-error-rgb), 0.7);
  animation: set-debug-live-pulse 1.4s ease-in-out infinite;
}

@keyframes set-debug-live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(var(--kr-error-rgb), 0.55); }
  70%  { box-shadow: 0 0 0 5px rgba(var(--kr-error-rgb), 0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--kr-error-rgb), 0); }
}

/* Same pulsing dot in the Settings sidebar nav, positioned after the
   "Debug" label. Smaller + subtler than the in-card badge. */
.set-nav-btn[data-live="true"] {
  position: relative;
}

.set-nav-live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--kr-error);
  vertical-align: middle;
  animation: set-debug-live-pulse 1.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .set-debug-live-dot,
  .set-nav-live-dot {
    animation: none;
  }
}

/* ── User context editor ─────────────────────────────────
   Inline list of files in ~/.kronn/user-context/, each row
   collapses an editor. Visual logic mirrors the discussion
   "disc-*" rows so an operator who knows the chat list can
   drive this editor without surprises. */
.user-context-editor {
  display: flex;
  flex-direction: column;
  gap: var(--kr-sp-6);
}

.user-context-header h3 {
  margin: 0 0 var(--kr-sp-2);
}

.user-context-create {
  display: flex;
  gap: var(--kr-sp-4);
  align-items: stretch;
}

.user-context-name-input {
  flex: 1;
  padding: var(--kr-sp-3) var(--kr-sp-5);
  background: var(--kr-bg-hover);
  border: 1px solid var(--kr-border-light);
  border-radius: var(--kr-r-md);
  color: var(--kr-text-primary);
  font-size: var(--kr-fs-sm);
  font-family: inherit;
  outline: none;
}

.user-context-name-input:focus {
  border-color: var(--kr-accent-border-light);
}

.user-context-add-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--kr-sp-3);
  padding: var(--kr-sp-3) var(--kr-sp-6);
  background: var(--kr-accent-bg);
  border: 1px solid var(--kr-accent-border);
  border-radius: var(--kr-r-md);
  color: var(--kr-accent);
  font-size: var(--kr-fs-sm);
  cursor: pointer;
}

.user-context-add-btn:hover:not(:disabled) {
  background: var(--kr-accent-bg-hover);
}

.user-context-add-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.user-context-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--kr-sp-2);
}

.user-context-row {
  border: 1px solid var(--kr-border-light);
  border-radius: var(--kr-r-md);
  background: var(--kr-bg-subtle);
}

.user-context-row-head {
  display: flex;
  align-items: center;
  gap: var(--kr-sp-3);
  padding: var(--kr-sp-3) var(--kr-sp-5);
}

.user-context-toggle {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--kr-sp-4);
  background: transparent;
  border: none;
  color: var(--kr-text-primary);
  cursor: pointer;
  text-align: left;
  padding: 0;
  font-family: inherit;
  font-size: var(--kr-fs-sm);
}

.user-context-name {
  font-family: var(--kr-font-mono);
  color: var(--kr-text-primary);
}

.user-context-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--kr-r-sm);
  color: var(--kr-error);
  cursor: pointer;
  opacity: 0.55;
}

.user-context-delete:hover {
  opacity: 1;
  background: rgba(var(--kr-error-rgb), 0.08);
  border-color: rgba(var(--kr-error-rgb), 0.2);
}

.user-context-edit {
  padding: 0 var(--kr-sp-5) var(--kr-sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--kr-sp-3);
}

.user-context-textarea {
  width: 100%;
  padding: var(--kr-sp-3) var(--kr-sp-4);
  background: var(--kr-bg-code-panel);
  border: 1px solid var(--kr-border-light);
  border-radius: var(--kr-r-sm);
  color: var(--kr-text-primary);
  font-family: var(--kr-font-mono);
  font-size: var(--kr-fs-xs);
  line-height: 1.5;
  outline: none;
  resize: vertical;
  min-height: 120px;
}

.user-context-textarea:focus {
  border-color: var(--kr-accent-border-light);
}

.user-context-textarea:disabled {
  opacity: 0.6;
}

.user-context-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--kr-sp-3);
}

.user-context-save {
  display: inline-flex;
  align-items: center;
  gap: var(--kr-sp-3);
  padding: var(--kr-sp-3) var(--kr-sp-6);
  background: var(--kr-accent-bg);
  border: 1px solid var(--kr-accent-border);
  border-radius: var(--kr-r-sm);
  color: var(--kr-accent);
  font-size: var(--kr-fs-sm);
  cursor: pointer;
}

.user-context-save:hover:not(:disabled) {
  background: var(--kr-accent-bg-hover);
}

.user-context-save:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.user-context-loading,
.user-context-empty {
  display: flex;
  align-items: center;
  gap: var(--kr-sp-3);
  padding: var(--kr-sp-5);
  color: var(--kr-text-muted);
  font-size: var(--kr-fs-sm);
}

.user-context-empty {
  background: var(--kr-bg-subtle);
  border: 1px dashed var(--kr-border-light);
  border-radius: var(--kr-r-md);
  justify-content: center;
}

.user-context-error {
  display: flex;
  align-items: center;
  gap: var(--kr-sp-3);
  padding: var(--kr-sp-3) var(--kr-sp-5);
  background: rgba(var(--kr-error-rgb), 0.08);
  border: 1px solid rgba(var(--kr-error-rgb), 0.2);
  border-radius: var(--kr-r-sm);
  color: var(--kr-error-soft);
  font-size: var(--kr-fs-xs);
}

/* canirun.ai hint — surfaced under the Ollama model picker /
 * suggestions to let the user check hardware sizing before
 * pulling a 30 GB model. Discreet, single-line, neutral grey. */
.set-ollama-canirun {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(var(--kr-border-medium-rgb, 100, 100, 100), 0.25);
}

.set-ollama-canirun-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--kr-fs-2xs);
  color: var(--kr-text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.set-ollama-canirun-link:hover {
  color: var(--kr-info);
  text-decoration: underline;
}
