/*
 * atoms.css: button · icon-button · field (input, textarea, select trigger)
 * · switch · checkbox · radio · tag · dot · label / help / error · heading.
 * Sizes are measured from the React build (rendered pixels).
 */

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.btn svg {
  width: 16px;
  height: 16px;
}
.btn:active:not(:disabled):not([aria-haspopup]) {
  transform: translateY(1px);
}
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.35;
  pointer-events: none;
}
.btn--primary {
  background: var(--primary);
  color: var(--primary-foreground);
}
.btn--primary:hover {
  background: color-mix(in srgb, var(--primary) 80%, transparent);
}
.btn--outline {
  border-color: var(--border);
  background: transparent;
}
.btn--outline:hover,
.btn--outline[aria-expanded="true"] {
  background: var(--muted);
}
.btn--ghost:hover,
.btn--ghost[aria-expanded="true"] {
  background: var(--muted);
}
.btn--soft {
  background: var(--om-soft-btn);
}
.btn--soft:hover,
.btn--soft[aria-pressed="true"] {
  background: var(--om-soft-btn-hover);
}
.btn--danger {
  background: color-mix(in srgb, var(--destructive) 10%, transparent);
  color: var(--destructive);
}
.btn--danger:hover {
  background: color-mix(in srgb, var(--destructive) 18%, transparent);
}
.btn--danger-solid {
  background: var(--destructive);
  color: #fff;
}
/* icon in front: tighter start padding (as shadcn's data-icon="inline-start") */
.btn--icon-start {
  padding-inline-start: 8px;
}
.btn--sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}
.btn--sm.btn--icon-start {
  padding-inline-start: 8px;
}
/* the big dark pill with a round chip on the end (Create agent, Get started) */
.btn--hero {
  height: 48px;
  gap: 14px;
  padding-block: 0;
  padding-inline: 24px 8px;
  font-size: 16px;
  line-height: 24px;
}
.btn__chip {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: var(--om-btn-c);
  color: var(--om-btn-c-ink);
}
.btn--link {
  height: auto;
  padding: 0;
  border-radius: 0;
  text-underline-offset: 4px;
}
.btn--link:hover {
  text-decoration: underline;
}

/* round icon-only button (give it an aria-label) */
.icon-btn {
  width: 36px;
  height: 36px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-pill);
  color: var(--om-ink);
  transition: background 0.15s ease;
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}
.icon-btn:hover,
.icon-btn[aria-expanded="true"] {
  background: var(--om-select);
}
.icon-btn--outline {
  border: 1px solid var(--om-tray-edge);
}
.icon-btn--sm {
  width: 32px;
  height: 32px;
}
.icon-btn--sm svg {
  width: 16px;
  height: 16px;
}
.icon-btn--soft {
  background: var(--om-soft-btn);
}
.icon-btn--soft:hover,
.icon-btn--soft[aria-pressed="true"] {
  background: var(--om-soft-btn-hover);
}
.icon-btn--round {
  width: 40px;
  height: 40px;
  background: var(--om-round);
  border: 1.5px solid var(--om-round-edge);
}

/* ---------- fields ---------- */
.input,
.textarea,
.select-trigger {
  width: 100%;
  min-width: 0;
  background: var(--om-field-2);
  border: 1px solid var(--om-field-2-edge);
  border-radius: var(--r-field);
  color: var(--om-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input {
  height: 40px;
  padding: 4px 12px;
  font-size: 14px;
  line-height: 20px;
}
.textarea {
  display: block;
  min-height: 70px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 24px;
  resize: vertical;
}
.input::placeholder,
.textarea::placeholder {
  color: var(--om-placeholder);
  opacity: 1;
}
.input:focus-visible,
.textarea:focus-visible,
.select-trigger:focus-visible,
.select-trigger[aria-expanded="true"] {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px var(--ring-soft);
}
.input[aria-invalid="true"],
.textarea[aria-invalid="true"],
.select-trigger[aria-invalid="true"] {
  border-color: var(--destructive);
}
.input:disabled,
.textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.input--mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
/* a field with an icon at the start (search) */
.input-wrap {
  position: relative;
}
.input-wrap > svg {
  position: absolute;
  inset-inline-start: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--om-ink-soft);
  pointer-events: none;
}
.input-wrap > .input {
  padding-inline-start: 36px;
}

/* select trigger: a button that opens a listbox (js/ui.js select()) */
.select-trigger {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 14.5px;
  line-height: 21.75px;
  text-align: start;
  white-space: nowrap;
}
.select-trigger__value {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.select-trigger__value[data-placeholder] {
  color: var(--om-placeholder);
}
.select-trigger > svg:last-child {
  width: 16px;
  height: 16px;
  margin-inline-start: auto;
  color: var(--om-ink-soft);
}
.select-trigger--auto {
  width: auto;
}
.select-trigger--tall {
  height: auto;
  min-height: 48px;
  padding-block: 6px;
}

/* ---------- switch ---------- */
.switch {
  position: relative;
  flex: none;
  width: 32px;
  height: 18.4px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: var(--switch-off);
  transition: background 0.15s ease;
}
.switch:hover:not(:disabled) {
  filter: brightness(0.96);
}
.switch::after {
  content: "";
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  width: 16px;
  height: 16px;
  border-radius: var(--r-pill);
  background: var(--switch-thumb);
  box-shadow: var(--switch-thumb-shadow);
  transition: transform 0.15s ease;
}
.switch[aria-checked="true"] {
  background: var(--primary);
}
.switch[aria-checked="true"]::after {
  transform: translateX(14px);
}
:root.dark .switch[aria-checked="true"]::after {
  background: var(--primary-foreground);
}
[dir="rtl"] .switch[aria-checked="true"]::after {
  transform: translateX(-14px);
}
.switch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- checkbox / radio ---------- */
.checkbox {
  flex: none;
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--input);
  border-radius: 4px;
  background: var(--om-field-2);
  color: var(--primary-foreground);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.checkbox svg {
  width: 12px;
  height: 12px;
  visibility: hidden;
}
.checkbox[aria-checked="true"] {
  background: var(--primary);
  border-color: var(--primary);
}
.checkbox[aria-checked="true"] svg {
  visibility: visible;
}
.checkbox:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.radio {
  flex: none;
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--input);
  border-radius: var(--r-pill);
  background: var(--om-field-2);
}
.radio[aria-checked="true"] {
  border-color: var(--primary);
  background: var(--primary);
}
.radio[aria-checked="true"]::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--primary-foreground);
}

/* ---------- tags, dots ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--om-tray-edge);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  white-space: nowrap;
  color: var(--om-ink);
}
.tag svg {
  width: 12px;
  height: 12px;
}
.tag--muted {
  color: var(--om-ink-soft);
}
.tag--sm {
  height: 20px;
}
.dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--om-ink-soft);
}
.dot--success { background: var(--success); }
.dot--warning { background: var(--warning); }
.dot--info { background: var(--info); }
.dot--danger { background: var(--destructive); }

/* ---------- text pieces ---------- */
.label {
  font-size: 14.5px;
  font-weight: 500;
  line-height: 20px;
}
.help {
  font-size: 13px;
  line-height: 20px;
  color: var(--om-ink-soft);
}
.error {
  font-size: 13px;
  line-height: 20px;
  color: var(--destructive);
}
.section-title {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  letter-spacing: -0.02em;
}
.page-title {
  font-family: var(--font-ui);
  font-size: 30px;
  font-weight: 600;
  line-height: 36px;
  letter-spacing: -0.02em;
}

/* quiet tinted blocks */
.soft { background: var(--om-soft-2); }
.box { background: var(--om-box); }
.well {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--om-soft-2);
}
.well--round {
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
}
