*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); }
[hidden] { display: none !important; }
svg.i { width: 1em; height: 1em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px;
  border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; color: var(--text); font-weight: 500; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.outline { border-color: var(--border-strong); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; }
.btn.sm { height: 28px; padding: 0 8px; font-size: 13px; }
.btn.active { background: var(--accent-soft); color: var(--accent); }
.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.sm { width: 24px; height: 24px; }
.split { display: inline-flex; }
.split .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split .btn:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; padding: 0 8px; border-left: 1px solid rgba(255,255,255,.35); }

/* ---------- form controls ---------- */
.input, .select, .textarea {
  width: 100%; height: 34px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
.textarea { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.field-row { display: grid; gap: 6px; margin-bottom: 14px; }
.field-row > label, .lbl { font-weight: 600; font-size: 12px; color: var(--text-2); text-transform: none; }
.hint { color: var(--text-3); font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--text-3); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.error-text { color: var(--danger); font-size: 13px; }

/* ---------- avatar ---------- */
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 10px; font-weight: 700; color: #fff; letter-spacing: .02em;
  border: 2px solid var(--surface);
}
.avatar.lg { width: 32px; height: 32px; font-size: 12px; }
.avatar.sm { width: 20px; height: 20px; font-size: 9px; border-width: 1px; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar + .avatar { margin-left: -7px; }

/* ---------- pills ---------- */
.pill {
  display: inline-flex; align-items: center; max-width: 100%; height: 24px; padding: 0 10px;
  border-radius: 6px; color: #fff; font-size: 12.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pill.soft { height: 22px; font-weight: 500; }
.swatch { width: 18px; height: 18px; border-radius: 5px; border: 0; padding: 0; flex: none; }
