:root {
  --bg: #eef4fb;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbe7f4;
  --primary: #0f766e;
  --primary-strong: #0b5f59;
  --primary-soft: #ccfbf1;
  --blue: #2563eb;
  --amber: #d97706;
  --danger: #dc2626;
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(20, 184, 166, 0.18), transparent 32rem),
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.12), transparent 28rem),
    var(--bg);
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  color: #ecfeff;
  background: linear-gradient(180deg, #0f766e 0%, #123b5d 100%);
  box-shadow: 10px 0 40px rgba(15, 23, 42, 0.16);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 34px;
}

.brand__mark {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: #0f766e;
  font-weight: 800;
  border-radius: 18px;
  background: #ecfeff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--brand {
  width: 28px;
  height: 28px;
  stroke-width: 1.8;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 1.25rem;
}

.brand span {
  margin-top: 3px;
  color: rgba(236, 254, 255, 0.72);
  font-size: 0.85rem;
}

.nav-list {
  display: grid;
  gap: 10px;
}

.nav-link {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 13px 14px;
  color: rgba(236, 254, 255, 0.78);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 16px;
  transition: 0.2s ease;
}

.nav-link .icon {
  opacity: 0.9;
}

.nav-link:hover,
.nav-link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.16);
}

.sidebar-card {
  position: absolute;
  right: 22px;
  bottom: 28px;
  left: 22px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
}

.sidebar-card__label,
.sidebar-card small,
.eyebrow,
.subtitle,
.empty-state,
.detail-empty {
  color: var(--muted);
}

.sidebar-card__label,
.sidebar-card strong,
.sidebar-card small {
  display: block;
}

.sidebar-card__label {
  color: rgba(236, 254, 255, 0.7);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.sidebar-card strong {
  margin: 8px 0 2px;
  color: #ffffff;
}

.sidebar-card small {
  color: rgba(236, 254, 255, 0.68);
}

.main {
  min-width: 0;
  padding: 34px;
}

.topbar {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 4vw, 3.25rem);
  letter-spacing: -0.05em;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.subtitle {
  margin-bottom: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
  text-decoration: none;
  border: 0;
  border-radius: 14px;
}

.btn:hover,
.btn:focus {
  text-decoration: none;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.btn-primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--blue));
  box-shadow: 0 14px 34px rgba(15, 118, 110, 0.25);
}

.btn-secondary {
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.btn-sm {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.82rem;
  border-radius: 12px;
}

.icon-btn {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  cursor: pointer;
  color: var(--primary-strong);
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 13px;
  background: var(--primary-soft);
  transition: 0.18s ease;
}

.icon-btn:hover,
.icon-btn:focus {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

.icon-btn--danger {
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.16);
  background: #fee2e2;
}

.icon-btn--ok {
  color: #047857;
  border-color: rgba(4, 120, 87, 0.16);
  background: #d1fae5;
}

.icon-btn--ghost {
  color: var(--muted);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.74);
}

.alert {
  margin-bottom: 18px;
  padding: 14px 16px;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 18px;
  background: #fffbeb;
}

.alert[data-type="ok"] {
  color: #047857;
  border-color: #86efac;
  background: #ecfdf5;
}

.hidden {
  display: none !important;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat-card,
.panel {
  border: 1px solid rgba(219, 231, 244, 0.85);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.stat-card {
  min-height: 132px;
  padding: 20px;
  border-radius: 22px;
}

.stat-card__icon {
  display: grid;
  width: 40px;
  height: 40px;
  margin-bottom: 18px;
  place-items: center;
  color: var(--primary);
  border-radius: 14px;
  background: var(--primary-soft);
}

.stat-card__icon .icon {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.stat-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 2rem;
  line-height: 1;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.88rem;
}

.skeleton {
  overflow: hidden;
  position: relative;
}

.skeleton::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.1s infinite;
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(340px, 0.8fr);
  gap: 18px;
  margin-bottom: 18px;
}

.dashboard-summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.65fr);
  gap: 18px;
}

.content-grid--secondary {
  grid-template-columns: 1fr 1fr;
}

.panel {
  min-width: 0;
  padding: 22px;
  border-radius: var(--radius);
}

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

.panel-header--wrap {
  flex-wrap: wrap;
}

.panel-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.search-input {
  width: min(260px, 100%);
  min-height: 42px;
  padding: 0 14px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  outline: none;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.12);
}

.select-input,
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: rgba(255, 255, 255, 0.92);
  transition: 0.2s ease;
}

.form-field textarea {
  min-height: 98px;
  padding-top: 12px;
  resize: vertical;
}

.select-input:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.12);
}

.plan-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.plan-toolbar .select-input {
  width: 150px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

th,
td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

td {
  color: #334155;
  font-size: 0.92rem;
}

.client-name {
  display: grid;
  gap: 3px;
}

.client-name strong {
  color: var(--text);
}

.client-name span {
  color: var(--muted);
  font-size: 0.78rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 999px;
}

.badge--ok {
  color: #047857;
  background: #d1fae5;
}

.badge--muted {
  color: #475569;
  background: #e2e8f0;
}

.badge--warn {
  color: #b45309;
  background: #fef3c7;
}

.detail-panel {
  min-height: 420px;
}

.detail-empty,
.empty-state,
.empty-cell {
  padding: 18px;
  text-align: center;
}

.detail-card {
  display: grid;
  gap: 16px;
}

.detail-card__title {
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #f0fdfa, #eff6ff);
}

.detail-card__title h3 {
  margin-bottom: 6px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.detail-row strong {
  color: var(--text);
  text-align: right;
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.module-cloud,
.module-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.module-panel {
  position: relative;
}

.module-summary-list {
  display: grid;
  gap: 10px;
}

.module-summary-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
}

.module-summary-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.12);
}

.module-summary-item strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-summary-item span:last-child {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.module-summary-more {
  padding: 11px 14px;
  color: var(--primary-strong);
  font-size: 0.86rem;
  font-weight: 800;
  text-align: center;
  border: 1px dashed rgba(15, 118, 110, 0.32);
  border-radius: 16px;
  background: rgba(204, 251, 241, 0.48);
}

.summary-stack {
  display: grid;
  gap: 12px;
}

.summary-item {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.8);
}

.summary-item span {
  color: var(--muted);
  font-size: 0.88rem;
}

.summary-item strong {
  color: var(--text);
  font-size: 1.35rem;
}

.module-pill {
  padding: 9px 11px;
  color: #155e75;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid #a5f3fc;
  border-radius: 999px;
  background: #ecfeff;
}

.cards-list {
  display: grid;
  gap: 12px;
}

.plan-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
}

.plan-card__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.plan-price {
  color: var(--primary);
  font-size: 1.35rem;
  font-weight: 800;
}

.plan-modules {
  color: var(--muted);
  font-size: 0.82rem;
}

.stats-grid--compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.module-list--compact {
  max-width: 320px;
}

.price-stack {
  display: grid;
  gap: 2px;
}

.price-stack strong {
  color: var(--primary-strong);
}

.price-stack span {
  color: var(--muted);
  font-size: 0.82rem;
}

.limits-stack {
  display: grid;
  max-width: 280px;
  gap: 3px;
}

.limits-stack strong {
  color: var(--text);
  font-size: 0.84rem;
  text-transform: capitalize;
}

.limits-stack span,
.limits-stack small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

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

.plans-table-panel {
  margin-bottom: 18px;
}

.plan-form {
  display: grid;
  gap: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-field {
  display: grid;
  gap: 7px;
}

.form-field span {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.form-field--full {
  grid-column: 1 / -1;
}

.module-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.72);
}

.module-editor__header,
.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.module-editor__header strong,
.linked-client-item strong {
  color: var(--text);
}

.module-check-list {
  display: grid;
  max-height: 260px;
  gap: 8px;
  overflow: auto;
  padding-right: 4px;
}

.module-check-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.86);
}

.module-check-item input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--primary);
}

.module-check-item span,
.module-check-item small {
  display: block;
}

.module-check-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.75rem;
}

.module-check-item.is-muted {
  opacity: 0.68;
}

.linked-clients {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.linked-client-list {
  display: grid;
  gap: 8px;
}

.linked-client-item {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
}

.linked-client-item span {
  color: var(--muted);
  font-size: 0.82rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(8px);
}

.modal__dialog {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: min(88vh, 920px);
  overflow: auto;
  padding: 24px;
  border: 1px solid rgba(219, 231, 244, 0.88);
  border-radius: 28px;
  background: var(--panel-strong);
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.32);
}

.modal__dialog--narrow {
  width: min(680px, 100%);
}

.modal__header,
.modal__header-actions {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.modal__header {
  margin-bottom: 20px;
}

.modal__header-actions {
  justify-content: flex-end;
}

.apply-plan-client {
  margin-bottom: 18px;
}

.apply-plan-client .detail-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.module-detail-grid {
  margin-bottom: 0;
}

.linked-panel {
  padding: 18px;
  box-shadow: none;
  background: rgba(248, 250, 252, 0.78);
}

.surface-note {
  padding: 13px 14px;
  color: var(--primary-strong);
  font-size: 0.88rem;
  line-height: 1.5;
  border: 1px dashed rgba(15, 118, 110, 0.28);
  border-radius: 16px;
  background: rgba(204, 251, 241, 0.42);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .sidebar-card {
    position: static;
    margin-top: 24px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .content-grid,
  .dashboard-summary-grid,
  .content-grid--secondary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .main,
  .sidebar {
    padding: 22px;
  }

  .topbar,
  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-actions,
  .module-editor__header,
  .modal__header,
  .topbar-actions,
  .plan-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .modal {
    padding: 12px;
    place-items: end center;
  }

  .modal__dialog {
    max-height: 92vh;
    padding: 18px;
    border-radius: 22px 22px 0 0;
  }

  .modal__header-actions {
    justify-content: space-between;
  }

  .plan-toolbar .select-input {
    width: 100%;
  }

  .module-summary-item {
    grid-template-columns: 10px minmax(0, 1fr);
  }

  .module-summary-item span:last-child {
    grid-column: 2;
  }
}

/* Sesión y login */
.sidebar-card--session {
  bottom: 150px;
  display: grid;
  gap: 8px;
}

.sidebar-card--session strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .sidebar-card--session {
    position: static;
  }
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px 16px;
  background: linear-gradient(180deg, #0f766e 0%, #123b5d 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 32px;
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 6px;
}

.login-card form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.login-card .btn {
  width: 100%;
}
