/* ==========================================================================
   Broto Shared UI Primitives — Linear-Grade High-Density Contract
   Strictly consumes tokens from src/shared/styles/variables.css
   Zero hardcoded hex colors · Zero !important
   ========================================================================== */

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.broto-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--control-height-md);
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  font-family: inherit;
  font-size: var(--font-size-xs);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  margin: 0;
  transition:
    background-color 0.12s ease,
    border-color 0.12s ease,
    color 0.12s ease,
    opacity 0.12s ease;
}

.broto-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  stroke-width: 1.75;
}

.broto-btn:hover {
  background: var(--muted);
  border-color: var(--input);
}

.broto-btn:active {
  transform: scale(0.98);
}

.broto-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.broto-btn--sm {
  height: var(--control-height-sm);
  padding: 0 8px;
  font-size: var(--font-size-xs);
}

.broto-btn--lg {
  height: var(--control-height-lg);
  padding: 0 14px;
  font-size: var(--font-size-sm);
}

.broto-btn--icon {
  width: var(--control-height-sm);
  height: var(--control-height-sm);
  padding: 0;
  color: var(--muted-foreground);
}

.broto-btn--icon:hover {
  color: var(--foreground);
}

.broto-btn--primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
  font-weight: 600;
}

.broto-btn--primary:hover {
  background: var(--primary);
  border-color: var(--primary);
  opacity: 0.88;
}

.broto-btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted-foreground);
}

.broto-btn--ghost:hover {
  background: var(--muted);
  border-color: transparent;
  color: var(--foreground);
}

.broto-btn--danger {
  background: var(--card);
  border-color: var(--border);
  color: var(--semantic-danger-fg);
}

.broto-btn--danger:hover {
  background: var(--semantic-danger-bg);
  border-color: var(--semantic-danger-border);
  color: var(--semantic-danger-fg);
}

/* ── Form Controls ───────────────────────────────────────────────────────── */
.broto-input,
.broto-select,
.broto-textarea {
  width: 100%;
  height: var(--control-height-md);
  padding: 0 10px;
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--foreground);
  font-family: inherit;
  font-size: var(--font-size-sm);
  line-height: 1.4;
  box-sizing: border-box;
  transition: border-color 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease;
}

.broto-textarea {
  height: auto;
  min-height: 76px;
  padding: 8px 10px;
  resize: vertical;
}

.broto-input--sm,
.broto-select--sm {
  height: var(--control-height-sm);
  font-size: var(--font-size-xs);
  padding: 0 8px;
}

.broto-input:hover,
.broto-select:hover,
.broto-textarea:hover {
  border-color: var(--muted-foreground);
}

.broto-input:focus,
.broto-select:focus,
.broto-textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.1);
}

.broto-input::placeholder,
.broto-textarea::placeholder {
  color: var(--muted-foreground);
  opacity: 0.72;
}

.broto-input:disabled,
.broto-select:disabled,
.broto-textarea:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Badges & Micro-Pills ────────────────────────────────────────────────── */
.broto-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: var(--control-height-micro);
  padding: 0 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--muted);
  color: var(--foreground);
  font-size: var(--font-size-label);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.broto-badge--muted {
  color: var(--muted-foreground);
}

.broto-badge--danger {
  background: var(--semantic-danger-bg);
  color: var(--semantic-danger-fg);
  border-color: var(--semantic-danger-border);
}

.broto-badge--warning {
  background: var(--semantic-warning-bg);
  color: var(--semantic-warning-fg);
  border-color: var(--semantic-warning-border);
}

.broto-badge--success {
  background: var(--semantic-success-bg);
  color: var(--semantic-success-fg);
  border-color: var(--semantic-success-border);
}

.broto-badge--info {
  background: var(--semantic-info-bg);
  color: var(--semantic-info-fg);
  border-color: var(--semantic-info-border);
}

/* ── Operational Toolbar ─────────────────────────────────────────────────── */
.broto-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 6px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

/* ── Keyboard Hint Chip ──────────────────────────────────────────────────── */
.broto-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--soft-bg);
  color: var(--muted-foreground);
  font-family: var(--font-mono);
  font-size: var(--font-size-tiny);
  font-weight: 600;
  line-height: 1;
}

/* ── Compact Empty State ─────────────────────────────────────────────────── */
.broto-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-8) var(--space-4);
  text-align: center;
  color: var(--muted-foreground);
  font-size: var(--font-size-sm);
}

.broto-empty-state__title {
  margin: 0;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--foreground);
}

.broto-empty-state__desc {
  margin: 0;
  max-width: 360px;
  font-size: var(--font-size-xs);
  color: var(--muted-foreground);
  line-height: 1.45;
}
