/* BBMT Design System — Components
 * Reusable component classes. Requires bbmt-tokens.css to be loaded first.
 * Prefix: .bbmt-*  (use directly in HTML to get the canonical look)
 */

/* ── BUTTONS ─────────────────────────────────────────────────────────── */
.bbmt-btn {
  font-family: var(--bbmt-font-sans);
  font-size: var(--bbmt-fs-body-sm);
  font-weight: 700;
  cursor: pointer;
  border: none;
  border-radius: 11px;
  padding: 9px 15px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: filter .12s, transform .1s, background .15s;
  line-height: 1;
}
.bbmt-btn:hover  { filter: brightness(1.08); }
.bbmt-btn:active { transform: scale(.97); }
.bbmt-btn:disabled,
.bbmt-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; filter: none; transform: none; }

.bbmt-btn-brand     { background: var(--bbmt-brand); color: #fff; box-shadow: var(--bbmt-shadow-brand-btn); }
.bbmt-btn-secondary { background: var(--bbmt-surface); color: var(--bbmt-brand); border: 1px solid rgba(74,21,75,.26); }
.bbmt-btn-ghost     { background: transparent; color: var(--bbmt-muted); padding: 8px 12px; }
.bbmt-btn-ghost:hover { background: var(--bbmt-surface-alt); filter: none; }
.bbmt-btn-danger    { background: var(--bbmt-danger); color: #fff; box-shadow: 0 2px 8px rgba(239,68,68,.22); }
.bbmt-btn-success   { background: var(--bbmt-success); color: #fff; }
.bbmt-btn-tiny      { padding: 6px 10px; border-radius: var(--bbmt-radius-xs); font-size: var(--bbmt-fs-meta); }

/* Icon inside buttons */
.bbmt-btn .bbmt-icon,
.bbmt-icon { width: 14px; height: 14px; stroke-width: 2.5; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; fill: none; }

/* ── PILLS ───────────────────────────────────────────────────────────── */
.bbmt-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--bbmt-radius-pill);
  font-size: var(--bbmt-fs-eyebrow);
  font-weight: 700;
  letter-spacing: .02em;
  font-family: var(--bbmt-font-sans);
  line-height: 1.2;
}
.bbmt-pill-dot { width: 6px; height: 6px; border-radius: 50%; }

.bbmt-pill-ok      { background: #dcfce7; color: #166534; }
.bbmt-pill-warn    { background: #fef3c7; color: #92400e; }
.bbmt-pill-danger  { background: #fee2e2; color: #991b1b; }
.bbmt-pill-info    { background: #eef2ff; color: #374151; }
.bbmt-pill-brand   { background: var(--bbmt-brand-soft); color: var(--bbmt-brand); }
.bbmt-pill-neutral { background: rgba(0,0,0,.07); color: var(--bbmt-muted); }

.bbmt-pill-high    { background: rgba(239,68,68,.10); color: var(--bbmt-danger-deep); }
.bbmt-pill-medium  { background: rgba(245,158,11,.12); color: var(--bbmt-tile-orange); }
.bbmt-pill-low     { background: rgba(59,130,246,.10); color: #2563eb; }

.bbmt-pill-ro      { background: #ecfdf5; color: var(--bbmt-tile-payroll); }
.bbmt-pill-de      { background: #eff6ff; color: #1d4ed8; }

/* ── STATUS PILL (dot + label) ───────────────────────────────────────── */
.bbmt-status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--bbmt-radius-pill); font-size: var(--bbmt-fs-eyebrow); font-weight: 700; letter-spacing: .02em; background: rgba(0,0,0,.05); color: var(--bbmt-text); }
.bbmt-status-todo       { background: rgba(59,130,246,.12);  color: var(--bbmt-status-todo); }
.bbmt-status-inprogress { background: rgba(245,158,11,.14);  color: var(--bbmt-status-inprogress); }
.bbmt-status-inreview   { background: rgba(139,92,246,.13);  color: var(--bbmt-status-inreview); }
.bbmt-status-approved   { background: rgba(16,185,129,.13);  color: var(--bbmt-status-approved); }
.bbmt-status-blocked    { background: rgba(239,68,68,.12);   color: var(--bbmt-status-blocked); }
.bbmt-status-done       { background: rgba(148,163,184,.18); color: #475569; }

/* ── INPUTS / FORM FIELDS ────────────────────────────────────────────── */
.bbmt-field label,
.bbmt-label {
  display: block;
  font-size: var(--bbmt-fs-eyebrow);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 6px;
  font-family: var(--bbmt-font-sans);
}
.bbmt-input,
.bbmt-select,
.bbmt-textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid rgba(0,0,0,.10);
  border-radius: 11px;
  font-family: var(--bbmt-font-sans);
  font-size: var(--bbmt-fs-body);
  color: var(--bbmt-text);
  background: var(--bbmt-surface-alt);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.bbmt-input:focus,
.bbmt-select:focus,
.bbmt-textarea:focus,
.bbmt-input.is-focused {
  border-color: var(--bbmt-brand);
  box-shadow: 0 0 0 3px var(--bbmt-brand-soft);
  background: var(--bbmt-surface);
}
.bbmt-input.is-error {
  border-color: var(--bbmt-danger);
  background: rgba(239,68,68,.05);
}
.bbmt-error-msg {
  font-size: var(--bbmt-fs-eyebrow);
  color: var(--bbmt-danger-deep);
  margin-top: 6px;
  font-weight: 600;
}
.bbmt-select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%235a6a7e' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* ── TOPBAR ──────────────────────────────────────────────────────────── */
.bbmt-topbar {
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bbmt-border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 54px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.bbmt-topbar-brand { display: flex; align-items: center; gap: 8px; font-size: var(--bbmt-fs-body); font-weight: 700; text-decoration: none; color: var(--bbmt-text); }
.bbmt-topbar-brand img { height: 26px; }
.bbmt-topbar-div { width: 1px; height: 20px; background: var(--bbmt-border-md); }
.bbmt-topbar-title { font-size: var(--bbmt-fs-body); font-weight: 700; }
.bbmt-topbar-spacer { flex: 1; }
.bbmt-topbar-live { width: 8px; height: 8px; border-radius: 50%; background: var(--bbmt-success); box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
.bbmt-topbar-live-label { font-size: var(--bbmt-fs-eyebrow); font-weight: 600; color: var(--bbmt-faint); letter-spacing: .3px; }

.bbmt-icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--bbmt-radius-xs);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--bbmt-muted);
  background: transparent;
  cursor: pointer;
  border: none;
  position: relative;
  transition: background .12s;
}
.bbmt-icon-btn:hover { background: var(--bbmt-surface-alt); }
.bbmt-icon-btn svg { width: 18px; height: 18px; stroke-width: 2; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.bbmt-icon-btn .bbmt-notif-badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  background: var(--bbmt-danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

.bbmt-user-btn { display: flex; align-items: center; gap: 8px; border: none; background: transparent; padding: 5px 8px; border-radius: 9px; cursor: pointer; }
.bbmt-user-btn:hover { background: var(--bbmt-surface-alt); }
.bbmt-user-name { font-size: var(--bbmt-fs-meta); font-weight: 600; color: var(--bbmt-text); }
.bbmt-caret { stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; fill: none; color: var(--bbmt-muted); }

/* ── AVATAR ──────────────────────────────────────────────────────────── */
.bbmt-avatar {
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  background: linear-gradient(135deg, var(--bbmt-brand-mid), #a855f7);
  font-family: var(--bbmt-font-sans);
}
.bbmt-avatar-xs { width: 18px; height: 18px; font-size: 7px; border: 2px solid var(--bbmt-surface); margin-right: -6px; }
.bbmt-avatar-sm { width: 24px; height: 24px; font-size: 9px; }
.bbmt-avatar-md { width: 30px; height: 30px; font-size: 11px; }
.bbmt-avatar-lg { width: 36px; height: 36px; font-size: 13px; }
.bbmt-avatar-xl { width: 56px; height: 56px; font-size: 18px; }
.bbmt-avatar-brand   { background: linear-gradient(135deg, var(--bbmt-brand-mid), #a855f7); }
.bbmt-avatar-blue    { background: linear-gradient(135deg, #0891b2, #06b6d4); }
.bbmt-avatar-emerald { background: linear-gradient(135deg, #059669, var(--bbmt-success)); }
.bbmt-avatar-orange  { background: linear-gradient(135deg, var(--bbmt-tile-orange), #fb923c); }
.bbmt-avatar-rose    { background: linear-gradient(135deg, #e11d48, #fb7185); }
.bbmt-avatar-slate   { background: linear-gradient(135deg, #475569, #94a3b8); }

/* ── MODAL ───────────────────────────────────────────────────────────── */
.bbmt-modal-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(74,21,75,.18), rgba(15,23,42,.46));
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.bbmt-modal {
  width: min(620px, 100%);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,249,251,.98));
  border: 1px solid rgba(255,255,255,.45);
  border-radius: var(--bbmt-radius-2xl);
  box-shadow: var(--bbmt-shadow-modal);
  padding: 22px 24px;
  max-height: 90vh;
  overflow: auto;
}
.bbmt-modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.bbmt-modal-head h2 { margin: 0; font-size: 20px; font-weight: 800; flex: 1; font-family: var(--bbmt-font-sans); color: var(--bbmt-text); }
.bbmt-modal-close { width: 30px; height: 30px; border-radius: var(--bbmt-radius-xs); display: flex; align-items: center; justify-content: center; color: var(--bbmt-muted); cursor: pointer; border: none; background: transparent; }
.bbmt-modal-close:hover { background: var(--bbmt-surface-alt); }
.bbmt-modal-close svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.bbmt-modal-body { font-size: var(--bbmt-fs-body); color: var(--bbmt-muted); line-height: 1.5; margin-bottom: 18px; }
.bbmt-modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ── MODULE TILE (dashboard) ─────────────────────────────────────────── */
.bbmt-tile {
  position: relative;
  background: var(--bbmt-surface);
  border: 1px solid var(--bbmt-border);
  border-radius: var(--bbmt-radius-2xl);
  padding: 24px 22px 22px;
  text-decoration: none;
  color: var(--bbmt-text);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--bbmt-shadow-card);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.bbmt-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--bbmt-shadow-card-hover);
  border-color: var(--bbmt-tile-c, var(--bbmt-brand));
}
.bbmt-tile:hover::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--bbmt-radius-2xl);
  background: var(--bbmt-tile-c, var(--bbmt-brand));
  opacity: .04;
}
.bbmt-tile-icon {
  position: relative;
  width: 48px; height: 48px;
  border-radius: var(--bbmt-radius-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--bbmt-tile-bg, var(--bbmt-brand-soft));
  flex-shrink: 0;
}
.bbmt-tile-icon svg { color: var(--bbmt-tile-c, var(--bbmt-brand)); stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.bbmt-tile-body { position: relative; flex: 1; }
.bbmt-tile-name { font-size: var(--bbmt-fs-h4); font-weight: 800; margin-bottom: 3px; }
.bbmt-tile-desc { font-size: var(--bbmt-fs-eyebrow); color: var(--bbmt-faint); line-height: 1.4; }
.bbmt-tile-footer { position: relative; display: flex; align-items: center; justify-content: space-between; }
.bbmt-tile-arrow { color: var(--bbmt-faint); stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; fill: none; transition: .15s; }
.bbmt-tile:hover .bbmt-tile-arrow { color: var(--bbmt-tile-c, var(--bbmt-brand)); transform: translateX(3px); }
.bbmt-tile-badge { min-width: 20px; height: 20px; border-radius: 10px; background: var(--bbmt-danger); color: #fff; font-size: var(--bbmt-fs-eyebrow); font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 6px; }

/* ── TASK CARD ───────────────────────────────────────────────────────── */
.bbmt-task-card {
  background: var(--bbmt-surface);
  border-radius: var(--bbmt-radius-sm);
  padding: 12px 14px;
  box-shadow: var(--bbmt-shadow-card);
  border-left: 3px solid var(--bbmt-task-priority, var(--bbmt-priority-low));
  cursor: pointer;
  transition: .15s;
}
.bbmt-task-card:hover { transform: translateY(-1px); box-shadow: var(--bbmt-shadow-card-hover); }
.bbmt-task-card.is-selected { outline: 2px solid var(--bbmt-brand); outline-offset: 1px; }
.bbmt-task-title { font-size: var(--bbmt-fs-body-sm); font-weight: 600; line-height: 1.4; margin-bottom: 7px; color: var(--bbmt-text); }
.bbmt-task-meta { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.bbmt-task-footer { display: flex; align-items: center; justify-content: space-between; }
.bbmt-task-due { font-size: var(--bbmt-fs-eyebrow); color: var(--bbmt-faint); font-weight: 500; }
.bbmt-task-due.is-urgent { color: var(--bbmt-danger-deep); }
.bbmt-task-comments { font-size: var(--bbmt-fs-eyebrow); color: var(--bbmt-faint); display: inline-flex; align-items: center; gap: 3px; }
.bbmt-avatar-stack { display: flex; }

/* ── STAT CHIP ───────────────────────────────────────────────────────── */
.bbmt-stat-chip {
  background: var(--bbmt-surface);
  border: 1px solid var(--bbmt-border);
  border-radius: var(--bbmt-radius-md);
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--bbmt-fs-body-sm);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  color: var(--bbmt-text);
}
.bbmt-stat-chip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.bbmt-stat-chip-val { font-size: var(--bbmt-fs-stat); font-weight: 800; }
.bbmt-stat-chip.is-danger .bbmt-stat-chip-val { color: var(--bbmt-danger-deep); }

/* ── TABLE (BBMT style) ──────────────────────────────────────────────── */
.bbmt-table-wrap {
  background: var(--bbmt-surface);
  border: 1px solid var(--bbmt-border);
  border-radius: var(--bbmt-radius-lg);
  box-shadow: var(--bbmt-shadow-card);
  overflow: hidden;
}
.bbmt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--bbmt-fs-body-sm);
  font-family: var(--bbmt-font-sans);
}
.bbmt-table th {
  background: var(--bbmt-surface-alt);
  padding: 9px 14px;
  text-align: left;
  font-size: var(--bbmt-fs-eyebrow);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--bbmt-muted);
  border-bottom: 1px solid var(--bbmt-border);
}
.bbmt-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--bbmt-border);
  color: var(--bbmt-text);
}
.bbmt-table tr:last-child td { border-bottom: none; }
.bbmt-table tbody tr:hover td { background: var(--bbmt-surface-alt); }
.bbmt-table tr.is-selected td { background: rgba(74,21,75,.04); }

/* ── CARD (generic surface) ──────────────────────────────────────────── */
.bbmt-card {
  background: var(--bbmt-surface);
  border: 1px solid var(--bbmt-border);
  border-radius: var(--bbmt-radius-lg);
  box-shadow: var(--bbmt-shadow-card);
  padding: 16px;
}
.bbmt-card-flat { background: var(--bbmt-surface); border: 1px solid var(--bbmt-border); border-radius: var(--bbmt-radius-lg); padding: 16px; box-shadow: var(--bbmt-shadow-flat); }

/* ── UTILITIES ───────────────────────────────────────────────────────── */
.bbmt-row    { display: flex; align-items: center; gap: 8px; }
.bbmt-stack  { display: flex; flex-direction: column; gap: 8px; }
.bbmt-spacer { flex: 1; }
