/* Panel components — cards, tablas modernas, modales (inspirado FacturaPY).
   Cargado por shells después de tema.css. */

/* === Page header consistente (titulo + acciones) === */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--espacio-md);
  margin-bottom: var(--espacio-lg);
  flex-wrap: wrap;
}
.page-header h1 { margin: 0; font-size: 24px; }
.page-header .sub { font-size: 13px; color: var(--ink-2); margin-top: 2px; }

/* === Toggle de tema en topbars verdes (MainLayout .topbar + planilla .app-header) ===
   Botón ghost translúcido que combina con la barra verde, igual que el avatar. */
.topbar .theme-toggle,
.app-header .theme-toggle {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  width: 34px; height: 34px; padding: 0;
  border-radius: 999px;
  font-size: 15px; line-height: 1;
  box-shadow: none;
}
.topbar .theme-toggle:hover,
.app-header .theme-toggle:hover { background: rgba(255,255,255,0.2); }

/* === Registry: tabla envuelta en card (FacturaPY pattern) ===
   SP5: overflow-x:auto (antes overflow:hidden) → tablas anchas scrollean dentro de la
   card en pantallas angostas en vez de cortarse. El header (.rhead) queda fijo. */
.registry {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
.registry .rhead {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  gap: 12px; flex-wrap: wrap;
}
.registry .rhead h3 {
  font-family: var(--fuente-base);
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
  margin: 0;
}
.registry .rhead .meta { font-size: 12px; color: var(--ink-3); margin-left: 4px; font-weight: normal; }
.registry .rhead .ract { display: flex; gap: 8px; flex-wrap: wrap; }

table.t { width: 100%; border-collapse: collapse; }
table.t th {
  text-align: left;
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 600;
  padding: 10px 20px;
  background: var(--surface-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line);
}
table.t td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line-2);
  font-size: 13.5px;
  vertical-align: middle;
}
table.t tbody tr:last-child td { border-bottom: 0; }
table.t tbody tr { transition: background .12s; }
table.t tbody tr:hover { background: var(--surface-2); }
table.t .nro { font-family: var(--fuente-tabular); font-size: 12.5px; color: var(--ink-2); }
table.t .name { font-weight: 600; font-size: 14px; color: var(--ink); }
table.t .name .sub { display: block; font-weight: 400; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; font-family: var(--fuente-tabular); }
table.t .amt {
  font-family: var(--fuente-tabular); font-weight: 600;
  text-align: right; font-variant-numeric: tabular-nums;
}

/* Pills / badges */
.pill {
  display: inline-flex; padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line);
}
.pill-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill-good { background: var(--good-bg); color: var(--good); border-color: transparent; }
.pill-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.pill-bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }

/* Row actions: appear on hover */
.rowact {
  display: flex; gap: 4px; justify-content: flex-end;
  opacity: 0.6; transition: opacity .15s;
}
table.t tr:hover .rowact { opacity: 1; }
@media (hover: none) { .rowact { opacity: 1; } }

/* === Empty state inside registry === */
.registry-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--ink-3);
}
.registry-empty .icon { font-size: 32px; margin-bottom: 12px; opacity: 0.6; }
.registry-empty h3 { font-size: 16px; color: var(--ink-2); margin-bottom: 6px; }
.registry-empty p { font-size: 13px; color: var(--ink-3); }

/* === Grid de cards (dashboard admin) === */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--espacio-md);
}
.card-link {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  text-decoration: none;
  color: var(--ink);
  transition: var(--transition);
  cursor: pointer;
}
.card-link:hover {
  border-color: var(--accent-2);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  text-decoration: none;
}
.card-link .icon {
  width: 40px; height: 40px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 20px;
  margin-bottom: 10px;
}
.card-link h3 { font-size: 15px; margin-bottom: 4px; }
.card-link p { font-size: 12.5px; color: var(--ink-3); margin: 0; }

/* === Form rows: label + input arriba/abajo === */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: var(--espacio-md);
}
.form-row .help { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--espacio-md); }
@media (max-width: 600px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}

/* === Modal moderno === */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}
.modal-caja {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  animation: slideIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translate(-50%, -45%); opacity: 0; } to { transform: translate(-50%, -50%); opacity: 1; } }

.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 16px 16px 0 0;
  display: flex; justify-content: space-between; align-items: center;
}
.modal-head h2 {
  font-family: var(--fuente-base);
  font-size: 17px; font-weight: 600; margin: 0; color: var(--ink);
}
.modal-cerrar { color: var(--ink-3); font-size: 20px; padding: 4px 8px; border-radius: 6px; }
.modal-cerrar:hover { background: var(--surface-2); color: var(--ink); }
.modal-body { padding: 20px; max-height: 70vh; overflow-y: auto; color: var(--ink); }
.modal-footer {
  padding: 14px 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--surface-2);
  border-radius: 0 0 16px 16px;
}
