/* Business Suite extension styles — Clients & Employees pages */

#bs-ext-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--background, #fff);
  color: var(--foreground, #111);
  overflow: auto;
  font-family: inherit;
}

.bs-ext-page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.bs-ext-topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--background, #fff);
  border-bottom: 1px solid var(--border, #e5e7eb);
  padding: 18px 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
}
.bs-ext-title-group { display: flex; align-items: center; gap: 14px; }
.bs-ext-title-group h1 { font-size: 20px; font-weight: 600; margin: 0; }
.bs-ext-count {
  font-size: 12px;
  color: var(--muted-foreground, #6b7280);
  background: var(--muted, #f3f4f6);
  padding: 3px 8px;
  border-radius: 999px;
}
.bs-ext-toolbar { display: flex; gap: 10px; align-items: center; }

.bs-ext-body { padding: 24px 28px 40px; flex: 1; }
.bs-ext-card {
  background: var(--card, #fff);
  color: var(--card-foreground, inherit);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  overflow: hidden;
}

.bs-ext-input {
  min-width: 260px;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--border, #e5e7eb);
  background: var(--input, transparent);
  color: inherit;
  border-radius: 8px;
  outline: none;
  transition: border-color .15s;
}
.bs-ext-input:focus { border-color: var(--ring, #94a3b8); box-shadow: 0 0 0 2px color-mix(in oklab, var(--ring, #94a3b8) 25%, transparent); }

.bs-ext-btn {
  appearance: none;
  border: 1px solid transparent;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  color: inherit;
  transition: background .15s, color .15s, border-color .15s;
}
.bs-ext-btn-primary {
  background: var(--gold, var(--primary, #111));
  color: var(--gold-foreground, var(--primary-foreground, #fff));
}
.bs-ext-btn-primary:hover { filter: brightness(0.95); }
.bs-ext-btn-ghost {
  border-color: var(--border, #e5e7eb);
  background: transparent;
}
.bs-ext-btn-ghost:hover { background: var(--muted, #f3f4f6); }
.bs-ext-btn-danger {
  color: #dc2626;
  border-color: var(--border, #e5e7eb);
}
.bs-ext-btn-danger:hover { background: rgba(220, 38, 38, 0.08); }

.bs-ext-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.bs-ext-table th, .bs-ext-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border, #e5e7eb);
  vertical-align: middle;
}
.bs-ext-table th {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground, #6b7280);
  background: color-mix(in oklab, var(--muted, #f3f4f6) 60%, transparent);
}
.bs-ext-table tbody tr:last-child td { border-bottom: 0; }
.bs-ext-table tbody tr:hover { background: color-mix(in oklab, var(--muted, #f3f4f6) 50%, transparent); }
.bs-ext-actions { text-align: right; white-space: nowrap; }
.bs-ext-actions .bs-ext-btn + .bs-ext-btn { margin-left: 6px; }
.bs-ext-empty {
  text-align: center !important;
  color: var(--muted-foreground, #6b7280);
  padding: 40px 16px !important;
}

.bs-ext-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 20px;
}
.bs-ext-modal {
  background: var(--card, #fff);
  color: var(--card-foreground, inherit);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.bs-ext-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.bs-ext-modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.bs-ext-modal-body {
  padding: 20px 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.bs-ext-modal-body .bs-ext-field:nth-child(1),
.bs-ext-modal-body .bs-ext-field:nth-child(2) { grid-column: span 1; }
.bs-ext-field { display: flex; flex-direction: column; gap: 6px; grid-column: span 2; }
.bs-ext-field > span { font-size: 12px; font-weight: 500; color: var(--muted-foreground, #6b7280); }
.bs-ext-field .bs-ext-input { width: 100%; min-width: 0; }
.bs-ext-modal-foot {
  padding: 16px 22px;
  border-top: 1px solid var(--border, #e5e7eb);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 640px) {
  .bs-ext-topbar { padding: 14px 16px; }
  .bs-ext-body { padding: 16px; }
  .bs-ext-toolbar { width: 100%; }
  .bs-ext-input { min-width: 0; flex: 1; }
  .bs-ext-modal-body { grid-template-columns: 1fr; }
  .bs-ext-table th:nth-child(3), .bs-ext-table td:nth-child(3),
  .bs-ext-table th:nth-child(4), .bs-ext-table td:nth-child(4) { display: none; }
}

/* ==== Reliability layer (v1.5): diagnostics, error log, toasts ============ */
.bs-ext-card {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid hsl(214.3 31.8% 91.4%);
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.dark .bs-ext-card { background: hsl(224 71% 4%); border-color: hsl(215 27.9% 16.9%); }
.bs-ext-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.bs-ext-card__title { font-size: 0.95rem; font-weight: 600; margin: 0; }
.bs-ext-card__sub { font-size: 0.8rem; color: hsl(215.4 16.3% 46.9%); margin: 0.15rem 0 0; }
.bs-ext-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.4rem 0.8rem; font-size: 0.8rem; font-weight: 500;
  border-radius: 0.5rem; border: 1px solid hsl(214.3 31.8% 91.4%);
  background: hsl(222.2 47.4% 11.2%); color: #fff; cursor: pointer;
  transition: opacity .15s;
}
.bs-ext-btn:hover { opacity: 0.9; }
.bs-ext-btn--ghost { background: transparent; color: hsl(215.4 16.3% 46.9%); }
.dark .bs-ext-btn { background: hsl(210 40% 98%); color: hsl(222.2 47.4% 11.2%); }

.bs-ext-diag { display: grid; grid-template-columns: 1fr; gap: 0.4rem; margin: 0; }
.bs-ext-diag__row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-bottom: 1px dashed hsl(214.3 31.8% 91.4%); }
.bs-ext-diag__row:last-child { border-bottom: none; }
.bs-ext-diag__row dt { font-size: 0.85rem; color: hsl(215.4 16.3% 46.9%); margin: 0; }
.bs-ext-diag__row dd { margin: 0; font-size: 0.85rem; font-weight: 500; }
.dark .bs-ext-diag__row { border-color: hsl(215 27.9% 16.9%); }

.bs-ext-chip {
  display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: .01em;
}
.bs-ext-chip--ok    { background: #dcfce7; color: #166534; }
.bs-ext-chip--warn  { background: #fef3c7; color: #92400e; }
.bs-ext-chip--bad   { background: #fee2e2; color: #991b1b; }
.bs-ext-chip--muted { background: #f1f5f9; color: #475569; }

.bs-ext-log { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.bs-ext-log__empty { padding: 0.75rem 0; font-size: 0.85rem; color: hsl(215.4 16.3% 46.9%); }
.bs-ext-log__item { padding: 0.55rem 0.75rem; border-radius: 0.5rem; margin-bottom: 0.35rem; background: #f8fafc; }
.dark .bs-ext-log__item { background: hsl(217 33% 12%); }
.bs-ext-log__item--ok    { border-left: 3px solid #16a34a; }
.bs-ext-log__item--warn  { border-left: 3px solid #d97706; }
.bs-ext-log__item--error { border-left: 3px solid #dc2626; }
.bs-ext-log__item--info  { border-left: 3px solid #2563eb; }
.bs-ext-log__when   { font-size: 0.7rem; color: hsl(215.4 16.3% 46.9%); }
.bs-ext-log__title  { font-size: 0.85rem; font-weight: 600; margin-top: 0.1rem; }
.bs-ext-log__detail { font-size: 0.78rem; color: hsl(215.4 16.3% 46.9%); margin-top: 0.1rem; white-space: pre-wrap; }

.bs-ext-toasts {
  position: fixed; z-index: 9999; right: 1rem; bottom: 1rem;
  display: flex; flex-direction: column; gap: 0.5rem; max-width: min(380px, 92vw);
}
.bs-ext-toast {
  padding: 0.75rem 0.9rem; border-radius: 0.6rem;
  background: #fff; color: #0f172a; border: 1px solid hsl(214.3 31.8% 91.4%);
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.15);
  animation: bs-ext-toast-in .18s ease-out;
}
.bs-ext-toast--out { opacity: 0; transform: translateY(6px); transition: all .3s; }
.bs-ext-toast--success { border-left: 4px solid #16a34a; }
.bs-ext-toast--error   { border-left: 4px solid #dc2626; }
.bs-ext-toast--info    { border-left: 4px solid #2563eb; }
.bs-ext-toast__title { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.15rem; }
.bs-ext-toast__body  { font-size: 0.8rem; color: hsl(215.4 16.3% 46.9%); white-space: pre-line; }
.dark .bs-ext-toast  { background: hsl(224 71% 4%); color: hsl(210 40% 98%); border-color: hsl(215 27.9% 16.9%); }
@keyframes bs-ext-toast-in { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: translateY(0);} }
