/* Component kit styles (WI000251). Uses tokens from tokens.css.
   Focus rings use color-mix so they tint to the brand in both modes. */

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 7px 14px;
  font-weight: 500;
  line-height: 1;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.04s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn--sm { padding: 4px 10px; font-size: 13px; }
.btn--primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn--primary:hover { background: var(--brand-hover); }
.btn--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger:hover { filter: brightness(0.95); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--surface-2); }
.btn__icon { display: inline-flex; }

/* ---- Fields / inputs ---- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field__label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.field__hint { font-size: 12px; color: var(--text-faint); }
.input {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font: inherit;
}
.input::placeholder { color: var(--text-faint); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 28%, transparent); }
.input--area { resize: vertical; min-height: 72px; line-height: 1.5; }

/* ---- Badges / pills / dots ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted);
}
.badge--success { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--warning { background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--warning); }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 999px;
}
.pill__icon { display: inline-flex; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 5px; font-size: 11px; font-weight: 500;
  border-radius: 999px; background: var(--surface-2); color: var(--text-muted);
}
.count-badge--brand { background: var(--brand); color: var(--on-brand); }
.count-badge--danger { background: var(--danger); color: #fff; }

/* ---- Avatars ---- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-weight: 500; overflow: hidden; flex: none;
  object-fit: cover;
}
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface); margin-left: -6px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack__more { margin-left: 4px; font-size: 11px; color: var(--text-muted); }

/* ---- Tab strip ---- */
.tabstrip { display: flex; gap: 16px; border-bottom: 1px solid var(--border); }
.tabstrip__tab {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; padding: 9px 0; color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabstrip__tab:hover { color: var(--text); }
.tabstrip__tab.is-active { color: var(--text); border-bottom-color: var(--brand); font-weight: 500; }

/* ---- Menu / dropdown ---- */
.menu { position: relative; display: inline-block; }
.menu__trigger {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); padding: 6px 10px; color: var(--text);
}
.menu__trigger:hover { background: var(--surface-2); }
.menu__list {
  position: absolute; top: calc(100% + 4px); z-index: 50; min-width: 180px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); padding: 4px; box-shadow: 0 8px 28px rgba(0,0,0,0.22);
}
.menu__list--start { left: 0; }
.menu__list--end { right: 0; }
.menu__item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: none; border: none; padding: 7px 9px; border-radius: var(--radius-sm); color: var(--text);
}
.menu__item:hover { background: var(--surface-2); }
.menu__item.is-destructive { color: var(--danger); }
.menu__label { flex: 1; }
.menu__check { color: var(--brand); }
.menu__sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ---- Modal / alert ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; background: var(--overlay);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 520px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35); display: flex; flex-direction: column;
  max-height: 86vh;
}
.modal--sm { max-width: 400px; }
.modal--lg { max-width: 760px; }
.modal__header { padding: 16px 18px; font-size: 16px; font-weight: 500; border-bottom: 1px solid var(--border); }
.modal__body { padding: 16px 18px; overflow: auto; }
.modal__message { margin: 0; color: var(--text-muted); line-height: 1.55; }
.modal__footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ---- Toasts / undo ---- */
.toaster {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  background: #222829; color: #f3f4f4; border-radius: var(--radius-md);
  padding: 10px 12px 10px 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.4); font-size: 13px;
}
.toast__action { background: none; border: none; color: #7fd4bb; font-weight: 500; }
.toast__close { background: none; border: none; color: #9aa0a1; font-size: 12px; }

/* ---- Markdown ---- */
.md { line-height: 1.6; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { font-weight: 600; line-height: 1.3; }
.md code { background: var(--surface-2); }
.md pre { background: var(--surface-2); padding: 10px 12px; border-radius: var(--radius-md); overflow: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 0; padding-left: 12px; border-left: 3px solid var(--border-strong); color: var(--text-muted); }
.md a { color: var(--accent); }

/* ---- Markdown editor ---- */
.mde { border: 1px solid var(--border-strong); border-radius: var(--radius-md); overflow: hidden; }
.mde__toolbar { display: flex; align-items: center; gap: 2px; padding: 5px 6px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.mde__btn { width: 30px; height: 28px; background: none; border: none; border-radius: var(--radius-sm); color: var(--text); }
.mde__btn:hover { background: var(--surface); }
.mde__spacer { flex: 1; }
.mde__toggle { background: none; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 4px 10px; color: var(--text-muted); font-size: 12px; }
.mde__toggle.is-active { color: var(--text); }
.mde__area { border: none; border-radius: 0; }
.mde__area:focus { box-shadow: none; }
.mde__preview { padding: 10px 12px; min-height: 72px; }

/* ---- Component gallery (dev) ---- */
.gallery { max-width: 880px; margin: 0 auto; padding: 24px 20px 80px; }
.gallery__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.gallery h1 { font-size: 20px; font-weight: 600; margin: 0; }
.gallery section { padding: 18px 0; border-top: 1px solid var(--border); }
.gallery h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin: 0 0 12px; }
.gallery .row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.gallery .stack { display: flex; flex-direction: column; gap: 12px; max-width: 460px; }
