/* Netsurx Admin Web — Fase 36 */
:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #2563eb;
  --danger: #ef4444;
  --ok: #22c55e;
  --warn: #f59e0b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem;
  display: flex;
  flex-direction: column;
}
.sidebar h1 { font-size: 1.1rem; margin: 0 0 0.25rem; }
.sidebar .muted { color: var(--muted); font-size: 0.85rem; margin-bottom: 1rem; }
.sidebar nav { flex: 1; display: flex; flex-direction: column; gap: 0.25rem; }
.sidebar nav button {
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
}
.sidebar nav button.active, .sidebar nav button:hover { background: #334155; }
.sidebar-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); font-size: 0.8rem; }

main { flex: 1; padding: 1.25rem; overflow: auto; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.login-wrap {
  max-width: 400px;
  margin: 4rem auto;
}
.login-wrap .remember {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
  font-size: 0.9rem;
}
.login-wrap .remember input { width: auto; margin: 0; }
h2 { margin-top: 0; }
input, select, textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  margin: 0.35rem 0 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0f172a;
  color: var(--text);
}
.btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #334155;
  color: var(--text);
  cursor: pointer;
}
.btn.primary { background: var(--primary); border-color: var(--primary); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.sm { padding: 0.25rem 0.5rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.error { color: var(--danger); font-size: 0.9rem; }
.success { color: var(--ok); font-size: 0.9rem; }

.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}
.kpi {
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
}
.kpi .label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; }
.kpi .value { font-size: 1.4rem; font-weight: 600; margin-top: 0.25rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.5rem; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--muted); font-weight: 500; }
tr:hover td { background: rgba(255,255,255,0.03); }

.toolbar { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: center; }
.hidden { display: none !important; }
.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
  background: #334155;
}
.badge.activo { background: #166534; }
.badge.moroso { background: #92400e; }
.badge.suspendido { background: #991b1b; }

.table-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 220px;
  max-width: 420px;
}
.table-search-input {
  margin: 0;
  flex: 1;
}
.table-search-hint { font-size: 0.8rem; white-space: nowrap; }
.table-filter-row th {
  padding-top: 0.25rem;
  padding-bottom: 0.65rem;
  vertical-align: top;
}
.col-filter-input,
.col-filter-select {
  width: 100%;
  margin: 0;
  padding: 0.35rem 0.45rem;
  font-size: 0.8rem;
}
.table-count { margin-top: 0.5rem; }

.isp-summary-grid {
  margin-bottom: 1rem;
}
.isp-summary-grid .kpi {
  min-width: 120px;
}
.isp-summary-grid .kpi.activo {
  border-left: 3px solid #166534;
}
.isp-summary-grid .kpi.suspendido {
  border-left: 3px solid #991b1b;
}
.isp-summary-grid .kpi.demo {
  border-left: 3px solid #92400e;
}

.isp-bulk-toolbar {
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  gap: 0.35rem;
}
.isp-bulk-toolbar .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.isp-sel-count {
  min-width: 8rem;
  font-size: 0.85rem;
  margin-right: 0.25rem;
}
.isp-table .col-check,
.isp-table .col-menu {
  width: 2.5rem;
  text-align: center;
  vertical-align: middle;
}
.row-menu-cell {
  position: relative;
  text-align: center;
}
.isp-row-menu {
  padding: 0.1rem 0.45rem;
  min-width: 2rem;
  line-height: 1.2;
}
.isp-row-menu-pop {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 30;
  margin-top: 0.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  min-width: 11rem;
  overflow: hidden;
}
.isp-row-menu-pop button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
}
.isp-row-menu-pop button:hover {
  background: rgba(255, 255, 255, 0.06);
}
.isp-row-menu-pop button.danger {
  color: #f87171;
}

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal { background: var(--surface); border-radius: 10px; padding: 1.25rem; width: min(480px, 92vw); max-height: 90vh; overflow: auto; }
.modal-wide { width: min(720px, 96vw); }
.modal-body label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.75rem; }
.modal-foot { margin-top: 1rem; justify-content: flex-end; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.actions-cell { white-space: nowrap; min-width: 200px; }
.actions-cell .btn { margin-right: 0.25rem; margin-bottom: 0.25rem; display: inline-flex !important; visibility: visible !important; opacity: 1 !important; }
.actions-col, td.actions-cell {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: -8px 0 12px rgba(15, 23, 42, 0.35);
}
thead .actions-col { z-index: 3; }
.table-scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.table-scroll table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; }
.btn-delete { flex-shrink: 0; }
.sidebar nav a.nav-link {
  color: var(--text);
  text-decoration: none;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  display: block;
}
.sidebar nav a.nav-link:hover { background: #334155; }

@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.plan-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: box-shadow 0.15s ease, opacity 0.15s ease;
}
.plan-card.plan-dragging {
  opacity: 0.55;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.plan-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}
.plan-card-head h4 { margin: 0; font-size: 1.05rem; }
.plan-drag-hint { cursor: grab; user-select: none; font-size: 1rem; line-height: 1; }
.plan-card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.75rem;
  margin: 0;
  font-size: 0.85rem;
}
.plan-card-meta dt {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
}
.plan-card-meta dd { margin: 0; }
.plan-desc { margin: 0; font-size: 0.85rem; }
.plan-feats {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.plan-feats-empty { margin: 0; font-size: 0.85rem; }
.plan-card-actions { margin-top: auto; padding-top: 0.25rem; }
.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
@media (max-width: 640px) {
  .form-row-3 { grid-template-columns: 1fr; }
}

.input-with-btn {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.input-with-btn input { flex: 1; }

.radio-group {
  border: 1px solid var(--border, #ddd);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
}
.radio-group legend { font-weight: 600; padding: 0 0.25rem; }
.radio-group label { display: inline-flex; align-items: center; gap: 0.35rem; margin-right: 1rem; }
