* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  background: #f3f4f6;
  color: #111827;
}

.topbar {
  background: #111827;
  color: #f9fafb;
  padding: 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
}

.topbar__subtitle {
  font-size: 13px;
  opacity: 0.8;
}

/* Tabs */

.tabs {
  display: flex;
  gap: 4px;
  padding: 8px 24px 0;
  background: #111827;
}

.tab-btn {
  border: none;
  padding: 6px 12px;
  border-radius: 999px 999px 0 0;
  font-size: 13px;
  cursor: pointer;
  background: #1f2937;
  color: #e5e7eb;
}

.tab-btn.active {
  background: #f3f4f6;
  color: #111827;
}

/* Layout */

.container {
  max-width: 1200px;
  margin: 0 auto 24px;
  padding: 12px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tab-section.hidden {
  display: none;
}

.panel {
  background: white;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 4px 10px rgba(15,23,42,0.05);
}

.panel h2 {
  margin-top: 0;
  font-size: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.search-input {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 13px;
}

/* Forms */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  font-size: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 12px;
  color: #4b5563;
}

.field input,
.field select {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 14px;
}

.checkbox-inline {
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Botones */

.btn {
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
  background: #e5e7eb;
}

.btn.primary {
  background: #2563eb;
  color: white;
}

.btn.danger {
  background: #dc2626;
  color: white;
}

.btn:hover {
  filter: brightness(0.95);
}

/* Tabla */

.table-wrapper {
  margin-top: 8px;
  max-height: 500px;
  overflow: auto;
}

.tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tabla th,
.tabla td {
  border-bottom: 1px solid #e5e7eb;
  padding: 6px 8px;
  text-align: left;
}

.tabla thead {
  position: sticky;
  top: 0;
  background: #f9fafb;
  z-index: 1;
}

.tabla tbody tr:hover {
  background: #eff6ff;
}

/* Badges */

.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
}

.badge.green {
  background: #dcfce7;
  color: #166534;
}

.badge.red {
  background: #fee2e2;
  color: #b91c1c;
}

.badge.blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge.gray {
  background: #e5e7eb;
  color: #374151;
}

/* Toast */

.toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: #111827;
  color: #f9fafb;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  max-width: 260px;
}

.toast.show {
  opacity: 1;
}

/* Campos extra según rol de persona */
.field-extra {
  display: none;
}

/* Responsive */

@media (max-width: 900px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}
