/* /css/views.css
   Estados vacíos centrados para vistas dummy + modal de "Salir"
--------------------------------------------------------------- */

/* Contenedor de cada vista dummy */
.app-view {
  position: fixed;
  top: var(--topbar-h);
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  padding: 24px;
  padding-left: 24px;
  background: #f8fafc;
  overflow: auto;
  scrollbar-gutter: stable both-edges;
  z-index: calc(var(--z-topbar) - 100); /* bajo topbar para desplegables */
}

/* Empty-state centrado */
.empty-state {
  min-height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text);
}

.empty-state .icon {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #eef6ff;
  color: var(--brand);
  margin: 0 auto 12px;
}

.empty-state .icon svg {
  width: 28px;
  height: 28px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state h2 {
  margin: 8px 0 4px;
  font-weight: 800;
  letter-spacing: -0.2px;
  font-size: 18px;
}

.empty-state p {
  color: #6b7280;
  margin: 0;
  font-size: 14px;
}

.hidden { display: none !important; }

/* Panel admin/usuario */
.panel {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
  color: #0f172a;
}
.panel + .panel {
  margin-top: 12px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.panel-head .muted {
  color: #475569;
  margin: 6px 0 0;
  font-size: 14px;
}
.panel-head .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #64748b;
  margin: 0 0 4px;
  font-size: 12px;
}
.panel-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}
.panel-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(620px, 1.6fr);
  gap: 18px;
  align-items: start;
  margin-top: 8px;
}
.cards-stack {
  display: grid;
  gap: 16px;
}
.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 14px 34px rgba(15,23,42,0.06);
}
.card-invite {
  max-width: none;
}
.card h3 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}
.invite-grid {
  display: grid;
  gap: 10px 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  max-width: 720px;
}
.invite-grid .full-span {
  grid-column: 1 / -1;
}
.invite-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.form-grid label {
  display: block;
  color: #475569;
  font-size: 13px;
  margin-bottom: 8px;
}
.form-grid input,
.form-grid select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  margin-top: 4px;
}
.table-wrap {
  position: relative;
  overflow: auto;
  max-height: 520px;
  width: 100%;
  min-height: 260px;
  padding-bottom: 4px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15,23,42,0.05);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}
thead {
  background: #f1f5f9;
}
th, td {
  padding: 12px 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: middle;
}
thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #334155;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 800;
}
.table-wrap thead th:first-child {
  border-top-left-radius: 11px;
}
.table-wrap thead th:last-child {
  border-top-right-radius: 11px;
}
.table-wrap tbody tr:last-child td {
  border-bottom: none;
}
.table-wrap tbody tr:nth-child(even) {
  background: #f8fafc;
}
.table-wrap tbody tr:hover {
  background: #eef2f7;
}
.table-wrap input,
.table-wrap select {
  width: 100%;
  box-sizing: border-box;
  height: 34px;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid #cbd5e1;
}
.table-wrap select.user-role {
  max-width: 140px;
}
.table-wrap select.user-cities {
  height: 76px;
  min-width: 230px;
}
.table-wrap input[type="checkbox"] {
  width: 18px;
  height: 18px;
}
.table-wrap input.user-expires {
  max-width: 160px;
}
.table-wrap td.row-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  white-space: nowrap;
  min-width: 200px;
  width: auto;
  padding-right: 16px;
  text-align: right;
}
.table-wrap td.row-actions .btn {
  min-width: 96px;
  height: 34px;
  font-weight: 700;
}
.table-wrap td.row-actions .btn-danger {
  padding: 0 12px;
}
.table-wrap th:nth-child(1), .table-wrap td:nth-child(1) { width: 26%; }
.table-wrap th:nth-child(2), .table-wrap td:nth-child(2) { width: 12%; }
.table-wrap th:nth-child(3), .table-wrap td:nth-child(3) { width: 26%; }
.table-wrap th:nth-child(4), .table-wrap td:nth-child(4) { width: 8%; }
.table-wrap th:nth-child(5), .table-wrap td:nth-child(5) { width: 12%; }
.table-wrap th:nth-child(6), .table-wrap td:nth-child(6) { width: 16%; text-align: right; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e0f2fe;
  color: #0f172a;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #bae6fd;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.12);
  font-size: 12px;
  font-weight: 700;
}

/* Account embed */
.account-embed {
  width: 100%;
  height: calc(100vh - var(--topbar-h));
  max-width: 1280px;
  margin: 0 auto;
  background: #f8fafc;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(15,23,42,0.06);
  border: 1px solid #e2e8f0;
}
.account-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #f8fafc;
}

#statsView {
  position: fixed;
  top: var(--topbar-h);
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  z-index: 1100; /* por debajo del sidebar (1200) */
  height: calc(100vh - var(--topbar-h));
  background: #f8fafc;
  padding: 24px;
  padding-left: 24px;
  overflow: auto;
}

.stats-shell {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.stats-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.stats-header .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #64748b;
  margin: 0 0 4px;
  font-size: 12px;
}

.stats-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}

.stats-header .sub {
  margin: 4px 0 0;
  color: #475569;
  font-size: 14px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.stat-card .label {
  display: block;
  color: #64748b;
  font-size: 13px;
  margin-bottom: 4px;
}

.stat-card strong {
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
}

.stat-card .muted {
  display: block;
  color: #94a3b8;
  margin-top: 4px;
}

.stats-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.card-block {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 200px;
  display: grid;
  gap: 8px;
}

.card.span-2,
.card-block.span-2 {
  grid-column: 2 / 3;
}

@media (max-width: 1100px) {
  .panel-grid {
    grid-template-columns: 1fr;
  }
  .card-invite {
    max-width: none;
  }
  .card.span-2,
  .card-block.span-2 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 920px) {
  .card-block.span-2 {
    grid-column: span 1;
  }
}

.card-block__head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.card-block__head .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #64748b;
  margin: 0 0 2px;
  font-size: 11px;
}

.list-rows .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #eef2f7;
  color: #0f172a;
  font-weight: 600;
}

.list-rows .row:last-child {
  border-bottom: none;
}

.list-rows .muted,
.card-block .muted {
  color: #94a3b8;
}

.coverage-box {
  padding: 6px 0;
}

.coverage-stat strong {
  font-size: 28px;
  color: #0f172a;
}

.coverage-stat .muted {
  margin: 2px 0 0;
}

.progress {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.progress__bar {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #16a34a);
  transition: width 0.2s ease;
}

.loader {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 4px 0;
}
.loader .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2563eb;
  animation: pulse 0.9s infinite ease-in-out;
}
.loader .dot:nth-child(2) { animation-delay: 0.15s; }
.loader .dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.6; }
  40% { transform: scale(1); opacity: 1; }
}

.pill-link {
  margin-left: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #2563eb;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
}

/* ---------------- Modal Salir ---------------- */

.gm-modal[hidden] { display: none; }

.gm-modal {
  position: fixed;
  inset: 0;
  z-index: 1000002;
  display: grid;
  place-items: center;
}

.gm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: saturate(1.2) blur(3px);
}

.gm-modal__dialog {
  position: relative;
  width: min(480px, 92vw);
  margin: 0 auto;
  padding: 18px 16px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.gm-modal__dialog h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.gm-modal__dialog p {
  margin: 0 0 14px;
  color: #475569;
  line-height: 1.35;
  font-size: 14px;
}

.gm-modal__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Botones genéricos */
.btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}
.btn-xs {
  height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

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

.btn-secondary {
  background: #fff;
  color: #111827;
}
.btn-danger {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}
