/* Shared Kit internal tools */
body {
  font-family: system-ui, -apple-system, sans-serif;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
  color: #0f172a;
  line-height: 1.5;
}
a { color: #2563eb; }
.back { margin-bottom: 1rem; font-size: 0.95rem; }
.back a { text-decoration: none; }
.back a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 0.35rem; }
.lead { color: #475569; margin: 0 0 1.25rem; max-width: 52rem; }
.tools { display: grid; gap: 12px; margin-top: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
a.card {
  display: block; padding: 16px 18px; border: 1px solid #cbd5e1; border-radius: 10px;
  text-decoration: none; color: inherit; background: #f8fafc;
}
a.card:hover { border-color: #2563eb; background: #eff6ff; }
a.card strong { display: block; font-size: 1.05rem; margin-bottom: 4px; }
a.card span { color: #64748b; font-size: 0.95rem; }

.panel {
  border: 1px solid #e2e8f0; border-radius: 10px; background: #fff;
  padding: 1rem 1.1rem; margin-bottom: 1rem;
}
.panel h2 { font-size: 1rem; margin: 0 0 0.75rem; color: #334155; }
.filters { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: #64748b; font-weight: 600; }
.filters input, .filters select, .filters button {
  font: inherit; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px;
  background: #fff; min-height: 38px;
}
.filters button {
  cursor: pointer; background: #2563eb; color: #fff; border-color: #2563eb; font-weight: 600;
}
.filters button.secondary { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }
.filters button:hover { filter: brightness(0.95); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.stat {
  border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 12px; background: #f8fafc;
}
.stat .n { font-size: 1.5rem; font-weight: 700; color: #0f172a; line-height: 1.2; }
.stat .l { font-size: 0.78rem; color: #64748b; margin-top: 2px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0.75rem 0; }
.toolbar .meta { color: #64748b; font-size: 0.88rem; flex: 1; }
.toolbar button {
  font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid #cbd5e1;
  background: #fff; cursor: pointer; font-weight: 600;
}
.toolbar button.primary { background: #0f766e; color: #fff; border-color: #0f766e; }

.table-wrap { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
th {
  background: #f8fafc; color: #475569; font-weight: 600; white-space: nowrap;
  cursor: pointer; user-select: none; position: sticky; top: 0;
}
th:hover { background: #f1f5f9; }
th.sorted-asc::after { content: " ▲"; font-size: 0.7em; }
th.sorted-desc::after { content: " ▼"; font-size: 0.7em; }
tr:hover td { background: #fafafa; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600;
}
.badge.sent { background: #dcfce7; color: #166534; }
.badge.failed { background: #fee2e2; color: #991b1b; }
.badge.pending { background: #fef9c3; color: #854d0e; }
.badge.none { background: #f1f5f9; color: #64748b; }
.err { color: #b91c1c; font-weight: 600; }
.ok-msg { color: #15803d; }
.empty { padding: 2rem; text-align: center; color: #64748b; }
#status { min-height: 1.25rem; margin-top: 0.5rem; font-size: 0.9rem; }

.pager {
  display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center;
  margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid #e2e8f0;
}
.pager label { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: #64748b; }
.pager select { font: inherit; padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 8px; }
.pager button {
  font: inherit; padding: 7px 12px; border-radius: 8px; border: 1px solid #cbd5e1;
  background: #fff; cursor: pointer; font-weight: 600;
}
.pager button:disabled { opacity: 0.45; cursor: not-allowed; }
.pager .page-info { color: #475569; font-size: 0.88rem; }

.people-list { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.people-list li { padding: 8px 0; border-bottom: 1px solid #f1f5f9; }
.people-list .muted, .muted { color: #64748b; font-size: 0.9rem; }
.health { padding: 8px 12px; border-radius: 8px; margin-bottom: 8px; font-size: 0.9rem; }
.health-error { background: #fee2e2; color: #991b1b; }
.health-warning { background: #fef9c3; color: #854d0e; }
.health-info { background: #eff6ff; color: #1e40af; }
.action-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.action-bar button {
  font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid #cbd5e1;
  background: #fff; cursor: pointer; font-weight: 600;
}
.action-bar button.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.action-bar button.secondary { background: #f1f5f9; }
.action-bar button.danger { background: #fef2f2; color: #991b1b; border-color: #fca5a5; }
.kit-pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.78rem; font-weight: 700;
  background: #f1f5f9; color: #475569;
}
.kit-pill--ok { background: #ecfdf5; color: #047857; }
.kit-pill--warn { background: #fef9c3; color: #854d0e; }
table button.danger {
  font: inherit; padding: 4px 10px; border-radius: 6px; border: 1px solid #fca5a5;
  background: #fef2f2; color: #991b1b; cursor: pointer; font-weight: 600;
}
.audit-list { font-size: 0.85rem; max-height: 280px; overflow-y: auto; }
code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 0.88em; }

.kit-toast {
  position: fixed; bottom: 20px; right: 20px; max-width: 420px; padding: 12px 16px;
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 9999; font-size: 0.92rem;
}
.kit-toast.ok { background: #ecfdf5; color: #065f46; border: 1px solid #6ee7b7; }
.kit-toast.err { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
.kit-modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.kit-modal {
  background: #fff; border-radius: 12px; max-width: 520px; width: 100%; padding: 20px;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.kit-modal h3 { margin: 0 0 12px; font-size: 1.15rem; }
.kit-modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.kit-field { display: block; margin-bottom: 12px; font-size: 0.9rem; }
.kit-field input, .kit-field textarea, .kit-field select {
  display: block; width: 100%; margin-top: 4px; font: inherit; padding: 8px; border-radius: 8px; border: 1px solid #cbd5e1;
}
.email-preview-frame {
  border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px; max-height: 360px; overflow: auto; background: #fafafa;
}
.dashboard-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin: 16px 0;
}
.dashboard-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 14px; text-decoration: none; color: inherit;
}
.dashboard-card strong { display: block; font-size: 1.6rem; color: #0f766e; }
.dashboard-card span { font-size: 0.85rem; color: #64748b; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid #f1f5f9; font-size: 0.9rem; }
.lead-row-failed { background: #fef2f2; }
.err-cell { color: #b91c1c; max-width: 240px; word-break: break-word; }
.ops-banner { background: #fff7ed; border: 1px solid #fdba74; border-radius: 8px; padding: 12px 14px; margin: 12px 0; }
.ops-banner.error { background: #fef2f2; border-color: #fca5a5; }
.kit-alert {
  padding: 12px 14px; border-radius: 8px; margin: 0 0 16px;
  background: #eff6ff; border: 1px solid #93c5fd; color: #1e3a8a;
}
.kit-alert.err { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.kit-readonly-cell { user-select: none; cursor: default; color: #334155; }
.kit-leads-table .la { white-space: nowrap; }
.kit-leads-table .la button { margin: 2px 4px 2px 0; }
