:root {
  --bg-main: #0B0F19;
  --bg-card: #111827;
  --bg-card-sub: #1F2937;
  --bg-input: #151D2C;
  --border-color: #2D3748;
  --border-focus: #3B82F6;

  --text-main: #F3F4F6;
  --text-muted: #9CA3AF;
  --text-dim: #6B7280;

  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-light: rgba(37, 99, 235, 0.15);

  --emerald: #10B981;
  --emerald-hover: #059669;
  --emerald-light: rgba(16, 185, 129, 0.15);

  --amber: #F59E0B;
  --amber-light: rgba(245, 158, 11, 0.15);

  --purple: #8B5CF6;
  --purple-light: rgba(139, 92, 246, 0.15);

  --rose: #EF4444;
  --rose-light: rgba(239, 68, 68, 0.15);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.app-layout {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* TOPBAR */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #1E40AF, #3B82F6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.brand-icon svg {
  width: 26px;
  height: 26px;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.brand-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.connection-badges {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.conn-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.conn-pill:hover {
  border-color: var(--border-focus);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: background 0.3s ease;
}

.status-dot.online {
  background: var(--emerald);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
  animation: pulse-dot 2s infinite;
}

.status-dot.offline {
  background: var(--rose);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
}

.status-dot.loading {
  background: var(--amber);
  animation: pulse-dot 1s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.conn-text {
  display: flex;
  flex-direction: column;
}

.conn-label {
  font-weight: 600;
  color: #fff;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.conn-detail {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color 0.2s;
}

.btn-icon:hover {
  color: #fff;
}

.btn-icon svg {
  width: 14px;
  height: 14px;
}

/* CARDS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title svg {
  width: 20px;
  height: 20px;
  color: var(--primary);
}

.section-title h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
}

/* FILTERS FORM */
.filter-card {
  padding: 0;
}

.filter-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1.2fr auto;
  gap: 18px;
  padding: 24px;
  align-items: flex-end;
}

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

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

input:focus,
select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.select-wrapper {
  position: relative;
}

.filter-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-sm svg {
  width: 14px;
  height: 14px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-emerald {
  background: var(--emerald);
  color: #fff;
}

.btn-emerald:hover {
  background: var(--emerald-hover);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
  background: var(--bg-card-sub);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: #374151;
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--bg-card-sub);
  color: #fff;
}

/* CUENTAS PANEL */
.cuentas-panel {
  border-top: 1px solid var(--border-color);
  background: rgba(17, 24, 39, 0.6);
  padding: 20px 24px;
  transition: all 0.3s ease;
}

.cuentas-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.cuentas-panel-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

.cuentas-panel-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cuentas-panel-actions {
  display: flex;
  gap: 8px;
}

.cuentas-chips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.cuenta-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.cuenta-chip.active {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(30, 58, 138, 0.18);
}

.cuenta-chip.inactive {
  opacity: 0.55;
  background: var(--bg-card);
}

.cuenta-chip-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.cuenta-chip-code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: #60A5FA;
}

.cuenta-chip-name {
  font-size: 0.84rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cuenta-chip-category {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.cuenta-chip-ctrls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* TOGGLE SWITCH */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #374151;
  transition: .3s;
  border-radius: 22px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(16px);
}

/* KPI GRID */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon svg {
  width: 24px;
  height: 24px;
}

.icon-blue { background: var(--primary-light); color: #60A5FA; }
.icon-amber { background: var(--amber-light); color: var(--amber); }
.icon-purple { background: var(--purple-light); color: #A78BFA; }
.icon-emerald { background: var(--emerald-light); color: var(--emerald); }

.kpi-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.kpi-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.kpi-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* TABLE TOOLBAR */
.table-card {
  display: flex;
  flex-direction: column;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  gap: 16px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  width: 360px;
  max-width: 100%;
}

.search-box svg {
  width: 16px;
  height: 16px;
  color: var(--text-dim);
}

.search-box input {
  background: transparent;
  border: none;
  padding: 4px 0;
  outline: none;
  box-shadow: none;
  font-size: 0.85rem;
  color: #fff;
  width: 100%;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* DATA TABLE */
.table-container {
  overflow-x: auto;
  max-height: 560px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  text-align: left;
}

.data-table th {
  background: #131B2E;
  color: var(--text-muted);
  padding: 12px 14px;
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(45, 55, 72, 0.6);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 0.15s ease;
}

.data-table tbody tr:hover {
  background: rgba(30, 41, 59, 0.5);
}

.text-right {
  text-align: right;
}

.tag-service {
  display: inline-block;
  padding: 3px 8px;
  background: rgba(59, 130, 246, 0.12);
  color: #93C5FD;
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.78rem;
}

.font-mono {
  font-family: var(--font-mono);
}

.amount-debe {
  color: #FBBF24;
  font-family: var(--font-mono);
  font-weight: 600;
}

.amount-haber {
  color: #C084FC;
  font-family: var(--font-mono);
  font-weight: 600;
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 60px 20px !important;
}

.empty-state-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
}

.empty-state-content svg {
  width: 44px;
  height: 44px;
  stroke: var(--text-dim);
}

.empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.empty-sub {
  font-size: 0.82rem;
  max-width: 420px;
}

/* TABLE FOOTER */
.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg-card);
}

/* MODALS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 0.2s ease-out;
}

.modal-lg {
  max-width: 780px;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1.1rem;
  color: #fff;
  font-weight: 600;
}

.modal-sub {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: #60A5FA;
  margin-top: 4px;
  word-break: break-all;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(0,0,0,0.15);
}

/* JSON PREVIEW */
.json-viewer-container {
  background: #0D1117;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  max-height: 440px;
  overflow: auto;
}

.json-viewer-container pre {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #E6EDF3;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
}

/* TOASTS */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  color: #fff;
  min-width: 280px;
  max-width: 440px;
  animation: toastIn 0.3s ease;
}

.toast.success { border-color: var(--emerald); }
.toast.error { border-color: var(--rose); }
.toast.info { border-color: var(--primary); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* AUTOMATION & TIC EMAILS */
.automation-card {
  border-left: 4px solid var(--primary);
}

.automation-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  gap: 16px;
  flex-wrap: wrap;
  background: rgba(30, 41, 59, 0.4);
}

.auto-control-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auto-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.badge-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.badge-pill.online {
  background: rgba(16, 185, 129, 0.2);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-pill.offline {
  background: rgba(239, 68, 68, 0.2);
  color: #F87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.select-inline {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 6px 10px;
  font-size: 0.82rem;
  outline: none;
}

.auto-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.automation-details {
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.email-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

.email-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.email-box-header h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
}

.email-box-header small {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.email-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 42px;
  align-items: center;
}

.email-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93C5FD;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

.email-chip-remove {
  background: transparent;
  border: none;
  color: #93C5FD;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
}

.email-chip-remove:hover {
  color: #F87171;
}

.add-email-row {
  display: flex;
  gap: 8px;
}

.add-email-row input {
  flex: 1;
  font-size: 0.82rem;
  padding: 6px 10px;
}

.email-emitters-info {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
}

.emitter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  background: var(--bg-card);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.emitter-tag {
  font-weight: 600;
  color: #A5B4FC;
}

.emitter-pill code {
  color: #CBD5E1;
  font-family: var(--font-mono);
}


/* SINCRONIZACIONES (extractor Softland -> MySQL) */
.sync-info {
  padding: 14px 24px;
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.sync-info code {
  font-family: 'JetBrains Mono', monospace;
  color: #93C5FD;
}
#sync-log-panel {
  border-top: 1px solid var(--border-color);
  max-height: 360px;
}
.badge-pill.warning {
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.colegio-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* LOGIN */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card { padding: 32px 28px; }
.login-brand { margin-bottom: 24px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font: inherit;
}
.login-form input:focus { outline: none; border-color: var(--border-focus); }
.login-btn { width: 100%; justify-content: center; }
.login-error { min-height: 1.2em; margin: 0; font-size: 0.85rem; color: #F87171; }

/* MENÚ DE USUARIO */
.user-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--border-color);
}
.user-info { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: 0.85rem; font-weight: 600; color: var(--text-main); }
.user-role { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.user-role.superadmin { color: #FBBF24; }

/* Viewer: sin controles de edición */
body.rol-viewer .solo-admin { display: none !important; }

/* Administración de usuarios */
.usuarios-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}
.usuarios-form input, .usuarios-form select,
.modal-body input[type="password"] {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font: inherit;
}
.usuarios-table select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  font: inherit;
  font-size: 0.8rem;
}
.usuarios-table td { vertical-align: middle; }
.usuarios-table .acciones { display: flex; gap: 6px; flex-wrap: wrap; }

/* API KEYS */
.apikey-nombre { grid-column: span 2; }
.apikey-entrega {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-md);
  background: var(--amber-light);
}
.apikey-aviso { margin: 0 0 10px; font-size: 0.85rem; color: #FBBF24; }
.apikey-entrega pre { max-height: 280px; overflow: auto; }
.apikey-acciones { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
@media (max-width: 600px) { .apikey-nombre { grid-column: auto; } }

/* PÁGINA API KEYS */
.ak-alerta {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: var(--amber-light);
  color: #FCD34D;
  font-size: 0.85rem;
  line-height: 1.5;
}
.ak-alerta code, .ak-body code { font-family: var(--font-mono); color: #93C5FD; }
.ak-body { padding: 18px 24px 22px; display: flex; flex-direction: column; gap: 14px; }
.ak-crear { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.ak-crear .form-group { flex: 1 1 280px; }
.ak-clave {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 10px;
  background: var(--bg-input); border: 1px dashed var(--amber); border-radius: var(--radius-md);
}
.ak-clave code { flex: 1 1 auto; font-family: var(--font-mono); font-size: 0.9rem; color: #FDE68A; word-break: break-all; }
.ak-base { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ak-base code { font-size: 0.9rem; word-break: break-all; }
.ak-endpoints { border: 1px solid var(--border-color); border-radius: var(--radius-md); }
.ak-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-color); }
.ak-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); padding: 8px 14px; font: inherit; font-size: 0.85rem; cursor: pointer;
}
.ak-tab:hover { color: var(--text-main); }
.ak-tab.active { color: var(--text-main); border-bottom-color: var(--primary); }
.ak-inactiva td { opacity: 0.6; }
.ak-muted { color: var(--text-dim); }
.kpi-value-sm { font-size: 1.1rem; }
.data-table td.acciones { white-space: nowrap; }
@media (max-width: 600px) {
  .ak-body { padding: 14px 16px; }
  .ak-crear .btn { width: 100%; justify-content: center; }
}
