/* Panel de plataforma Roustix — superadmin SaaS (paleta corporativa oscura) */
:root {
  --platform-bg: #0b0e14;
  --platform-sidebar: #151b2d;
  --platform-sidebar-border: #1e2640;
  --platform-sidebar-active: rgba(24, 95, 165, 0.24);
  --platform-surface: #1e2533;
  --platform-surface-2: #151c28;
  --platform-input-bg: #121820;
  --platform-border: #2a3448;
  --platform-text: #f3f4f6;
  --platform-muted: #8b95a8;
  --platform-accent: #378add;
  --platform-accent-strong: #185fa5;
  --platform-accent-soft: rgba(55, 138, 221, 0.14);
  --platform-primario: #042c53;
  --platform-popular: #7c3aed;
  --platform-success: #22c55e;
}

body.platform-body {
  background: var(--platform-bg);
  color: var(--platform-text);
  font-family: "Inter", system-ui, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

.platform-layout {
  display: flex;
  min-height: 100vh;
  max-width: 100%;
}

.platform-sidebar {
  width: 240px;
  background: var(--platform-sidebar);
  border-right: 1px solid var(--platform-sidebar-border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0;
}

.platform-brand {
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid var(--platform-sidebar-border);
  margin-bottom: 0.75rem;
}

.platform-brand-mark {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.platform-brand-logo-panel {
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  line-height: 0;
  overflow: hidden;
  padding: 0.5rem 0.65rem;
  width: 100%;
}

.platform-brand-logo-panel--login {
  max-width: 280px;
  padding: 0.65rem 0.85rem;
}

.platform-brand-logo {
  display: block;
  height: auto;
  max-height: 52px;
  object-fit: contain;
  width: 100%;
}

.platform-brand-logo-panel--login .platform-brand-logo {
  max-height: 72px;
}

.platform-brand-icon {
  align-items: center;
  background: var(--platform-accent);
  border-radius: 0.5rem;
  color: #fff;
  display: flex;
  font-size: 1.1rem;
  font-weight: 700;
  height: 2.25rem;
  justify-content: center;
  width: 2.25rem;
}

.platform-brand-title {
  color: #fff;
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
}

.platform-brand-sub {
  color: var(--platform-accent);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin: 0.35rem 0 0;
  text-transform: uppercase;
}

.platform-nav .nav-link {
  border-left: 3px solid transparent;
  border-radius: 0;
  color: var(--platform-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.65rem 1.25rem;
}

.platform-nav .nav-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #e5e7eb;
}

.platform-nav .nav-link.active {
  background: var(--platform-sidebar-active);
  border-left-color: var(--platform-accent);
  color: #fff;
  font-weight: 600;
}

.platform-main {
  background: var(--platform-bg);
  flex: 1;
  min-width: 0;
  max-width: 100%;
  padding: 1.75rem 2rem 2.5rem;
  position: relative;
}

.platform-main-inner {
  max-width: 100%;
  min-width: 0;
}

.platform-sidebar-toggle {
  align-items: center;
  background: var(--platform-surface);
  border: 1px solid var(--platform-border);
  border-radius: 0.5rem;
  color: #fff;
  display: none;
  height: 2.5rem;
  justify-content: center;
  margin-bottom: 1rem;
  width: 2.5rem;
}

.platform-sidebar-toggle:hover {
  background: rgba(55, 138, 221, 0.12);
  border-color: var(--platform-accent);
}

.platform-page-header h1 {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.platform-page-header p {
  color: var(--platform-muted);
  font-size: 0.875rem;
  margin: 0;
}

.platform-kpi-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 1.5rem 0;
}

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

@media (max-width: 991px) {
  .platform-sidebar-toggle {
    display: inline-flex;
  }

  .platform-sidebar {
    height: 100vh;
    left: 0;
    overflow-y: auto;
    position: fixed;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    width: min(280px, 88vw);
    z-index: 1040;
  }

  .platform-sidebar.platform-sidebar--open {
    transform: translateX(0);
  }

  body.platform-sidebar-open::before {
    background: rgba(0, 0, 0, 0.45);
    content: "";
    inset: 0;
    position: fixed;
    z-index: 1035;
  }

  .platform-main {
    padding: 1rem 1rem 2rem;
    width: 100%;
  }

  .platform-plan-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .platform-plan-limits {
    grid-template-columns: 1fr;
  }

  .platform-filters .platform-search-wrap {
    flex: 1 1 100%;
    max-width: none;
  }

  .platform-filters .platform-select {
    flex: 1 1 calc(50% - 0.35rem);
    min-width: 0;
  }
}

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

  .platform-filters .platform-select {
    flex: 1 1 100%;
  }

  .platform-kpi-value {
    font-size: 1.65rem;
  }

  .platform-plan-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .platform-plan-price-row {
    grid-template-columns: 1fr;
  }
}

.platform-kpi {
  background: var(--platform-surface);
  border: 1px solid var(--platform-border);
  border-radius: 0.75rem;
  padding: 1.1rem 1.25rem;
}

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

.platform-kpi-row {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  margin-top: 0.35rem;
}

.platform-kpi-value {
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.platform-kpi-trend {
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
}

.platform-kpi-trend--up {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.platform-kpi-sub {
  color: #6b7280;
  font-size: 0.75rem;
  margin-top: 0.35rem;
}

.platform-filters {
  align-items: center;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.platform-filters .platform-search-wrap {
  flex: 1 1 220px;
  max-width: 320px;
  min-width: 200px;
}

.platform-filters .platform-search {
  max-width: none;
  width: 100%;
}

.platform-filters .platform-select {
  flex: 0 1 auto;
  min-width: 11rem;
  width: auto;
}

.platform-filters .platform-btn {
  flex-shrink: 0;
}

.platform-search {
  background: var(--platform-surface);
  border: 1px solid var(--platform-border);
  border-radius: 0.5rem;
  color: #fff;
  flex: 1;
  max-width: 280px;
  min-width: 180px;
  padding: 0.45rem 0.75rem 0.45rem 2.25rem;
}

.platform-search-wrap {
  position: relative;
}

.platform-search-wrap i {
  color: var(--platform-muted);
  left: 0.75rem;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.platform-select {
  background: var(--platform-input-bg);
  border: 1px solid var(--platform-border);
  border-radius: 0.5rem;
  box-sizing: border-box;
  color: #e8edf5;
  font-size: 0.8125rem;
  max-width: 100%;
  padding: 0.45rem 2rem 0.45rem 0.75rem;
  width: auto;
}

.platform-select:focus,
.platform-price-input-wrap:focus-within {
  border-color: var(--platform-accent);
  box-shadow: 0 0 0 2px rgba(55, 138, 221, 0.18);
  outline: none;
}

.platform-card {
  background: var(--platform-surface);
  border: 1px solid var(--platform-border);
  border-radius: 0.75rem;
  overflow: hidden;
}

.platform-table {
  color: #e5e7eb;
  margin: 0;
  width: 100%;
}

.platform-table thead th {
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--platform-border);
  color: var(--platform-muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 0.85rem 1rem;
  text-transform: uppercase;
}

.platform-table tbody td {
  border-bottom: 1px solid var(--platform-border);
  padding: 0.9rem 1rem;
  vertical-align: middle;
}

.platform-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.platform-table tbody tr:last-child td {
  border-bottom: none;
}

.platform-empresa-cell {
  align-items: center;
  display: flex;
  gap: 0.75rem;
}

.platform-avatar {
  align-items: center;
  border-radius: 0.5rem;
  color: #fff;
  display: flex;
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 700;
  height: 2.25rem;
  justify-content: center;
  width: 2.25rem;
}

.platform-empresa-nombre {
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
}

.platform-empresa-nit {
  color: var(--platform-muted);
  font-size: 0.75rem;
}

.platform-badge {
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.22rem 0.65rem;
}

.platform-badge--activa {
  border: 1px solid #22c55e;
  color: #4ade80;
}

.platform-badge--trial {
  border: 1px solid #a855f7;
  color: #c084fc;
}

.platform-badge--mora {
  border: 1px solid #f59e0b;
  color: #fbbf24;
}

.platform-badge--suspendida {
  border: 1px solid #ef4444;
  color: #f87171;
}

.platform-plan {
  border-radius: 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
}

.platform-plan--starter { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.platform-plan--pro { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.platform-plan--enterprise { background: rgba(168, 85, 247, 0.2); color: #c084fc; }
.platform-plan--trial { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }

.platform-usage {
  min-width: 120px;
}

.platform-usage-bar {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  height: 6px;
  margin-top: 0.35rem;
  overflow: hidden;
}

.platform-usage-fill {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 999px;
  height: 100%;
}

.platform-usage-fill--warn { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.platform-usage-fill--danger { background: linear-gradient(90deg, #ef4444, #f87171); }

.platform-usage-label {
  color: var(--platform-muted);
  font-size: 0.7rem;
}

.platform-table-footer {
  align-items: center;
  border-top: 1px solid var(--platform-border);
  color: var(--platform-muted);
  display: flex;
  font-size: 0.8rem;
  justify-content: space-between;
  padding: 0.85rem 1rem;
}

.platform-link {
  color: #93c5fd;
  text-decoration: none;
}

.platform-link:hover {
  color: #bfdbfe;
}

.platform-login-wrap {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.platform-login-card {
  background: var(--platform-surface);
  border: 1px solid var(--platform-border);
  border-radius: 0.75rem;
  max-width: 400px;
  padding: 2rem;
  width: 100%;
}

.platform-detail-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 1.5rem;
}

.platform-detail-card {
  background: var(--platform-surface);
  border: 1px solid var(--platform-border);
  border-radius: 0.75rem;
  padding: 1.1rem 1.25rem;
}

.platform-detail-card h3 {
  color: var(--platform-muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.platform-detail-card p {
  color: #fff;
  font-size: 0.95rem;
  margin: 0;
}

.platform-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.platform-btn {
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
}

.platform-btn-outline {
  background: transparent;
  border: 1px solid var(--platform-border);
  color: #e8edf5;
}

.platform-btn-outline:hover {
  background: rgba(55, 138, 221, 0.08);
  border-color: var(--platform-accent);
  color: #fff;
}

.platform-btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: #fca5a5;
}

.platform-btn-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid #22c55e;
  color: #86efac;
}

.platform-coming-soon {
  background: rgba(59, 130, 246, 0.08);
  border: 1px dashed var(--platform-border);
  border-radius: 0.75rem;
  color: var(--platform-muted);
  font-size: 0.875rem;
  margin-top: 1.5rem;
  padding: 1.25rem;
}

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

.platform-select--sm {
  font-size: 0.75rem;
  max-width: 8rem;
  padding: 0.3rem 0.5rem;
}

.platform-btn--sm {
  font-size: 0.75rem;
  padding: 0.3rem 0.55rem;
}

.platform-factura-estado {
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.18rem 0.5rem;
}

.platform-factura-estado--pagada { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.platform-factura-estado--pendiente { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }
.platform-factura-estado--vencida { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.platform-factura-estado--anulada { background: rgba(107, 114, 128, 0.2); color: #9ca3af; }

input[type="month"].platform-select {
  color-scheme: dark;
}

.platform-etapa-info {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid var(--platform-border);
  border-radius: 0.75rem;
  color: var(--platform-muted);
  font-size: 0.8125rem;
  line-height: 1.5;
  padding: 0.85rem 1rem;
}

.platform-etapa-info code {
  color: #93c5fd;
}

/* Usuarios globales */
.platform-role {
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.18rem 0.5rem;
  white-space: nowrap;
}

.platform-role--admin { background: rgba(124, 58, 237, 0.2); color: #c4b5fd; }
.platform-role--supervisor { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.platform-role--tecnico { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.platform-role--usuario { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }

.platform-user-estado {
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.18rem 0.5rem;
}

.platform-user-estado--activo { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.platform-user-estado--bloqueado { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.platform-user-estado--inactivo { background: rgba(107, 114, 128, 0.2); color: #9ca3af; }

.platform-dropdown-menu {
  background: var(--platform-surface);
  border: 1px solid var(--platform-border);
  font-size: 0.8125rem;
}

.platform-dropdown-menu .dropdown-item {
  color: #e5e7eb;
}

.platform-dropdown-menu .dropdown-item:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.platform-dropdown-menu .dropdown-item:disabled {
  color: #6b7280;
}

.platform-modal .modal-content {
  background: var(--platform-surface);
  border: 1px solid var(--platform-border);
  color: #e5e7eb;
}

.platform-modal .modal-title {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
}

.platform-audit-notice {
  align-items: flex-start;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 0.5rem;
  color: #bfdbfe;
  display: flex;
  font-size: 0.8125rem;
  padding: 0.85rem 1rem;
}

.platform-audit-notice strong {
  color: #fff;
}

.platform-textarea {
  background: var(--platform-surface-2);
  border: 1px solid var(--platform-border);
  color: #fff;
  font-size: 0.875rem;
}

.platform-textarea:focus {
  background: var(--platform-surface-2);
  border-color: var(--platform-accent);
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.2);
  color: #fff;
}

/* Configuración — planes y tabs */
.platform-tabs-wrap {
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
  max-width: 100%;
  overflow-x: auto;
}

.platform-tabs {
  border-bottom: 1px solid var(--platform-border);
  flex-wrap: nowrap;
  gap: 0.25rem;
  min-width: max-content;
  width: max-content;
}

.platform-tabs .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--platform-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.65rem 1rem;
}

.platform-tabs .nav-link:hover {
  color: #e5e7eb;
}

.platform-tabs .nav-link.active {
  background: transparent;
  border-bottom: 2px solid var(--platform-accent);
  color: #fff;
  font-weight: 600;
}

.platform-plan-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  max-width: 100%;
}

@media (min-width: 1400px) {
  .platform-plan-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  }
}

.platform-plan-card {
  background: var(--platform-surface);
  border: 1px solid var(--platform-border);
  border-radius: 0.75rem;
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
  padding: 1.1rem;
  position: relative;
  width: 100%;
}

.platform-plan-card--featured {
  border-color: var(--platform-accent);
  box-shadow: 0 0 0 1px rgba(55, 138, 221, 0.35);
}

.platform-plan-badge-popular {
  background: var(--platform-popular);
  border-radius: 999px;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 700;
  left: 50%;
  letter-spacing: 0.07em;
  padding: 0.22rem 0.7rem;
  position: absolute;
  top: -0.55rem;
  transform: translateX(-50%);
}

.platform-plan-card-head {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  margin-bottom: 1rem;
  margin-top: 0.35rem;
}

.platform-plan-card-title {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}

.platform-plan-price-row {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
  min-width: 0;
}

.platform-plan-price-field {
  min-width: 0;
  width: 100%;
}

.platform-field-label {
  color: var(--platform-muted);
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.platform-price-input-wrap {
  align-items: center;
  background: var(--platform-input-bg);
  border: 1px solid var(--platform-border);
  border-radius: 0.5rem;
  box-sizing: border-box;
  display: flex;
  max-width: 100%;
  min-width: 0;
  padding: 0.4rem 0.55rem;
  width: 100%;
}

.platform-price-prefix,
.platform-price-suffix {
  color: var(--platform-muted);
  flex-shrink: 0;
  font-size: 0.75rem;
  white-space: nowrap;
}

.platform-price-input {
  background: transparent;
  border: none;
  box-sizing: border-box;
  color: #fff;
  flex: 1 1 0;
  font-size: 1.05rem;
  font-weight: 700;
  min-width: 0;
  outline: none;
  padding: 0 0.25rem;
  width: 0;
}

.platform-plan-price-field .platform-select {
  box-sizing: border-box;
  max-width: 100%;
  width: 100%;
}

.platform-plan-limits {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 1rem;
  min-width: 0;
}

.platform-plan-limits > div {
  min-width: 0;
}

.platform-plan-limits .platform-select {
  box-sizing: border-box;
  max-width: 100%;
  width: 100%;
}

.platform-plan-features {
  border-top: 1px solid var(--platform-border);
  padding-top: 0.85rem;
}

.platform-feat-row {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  min-width: 0;
}

.platform-feat-row .platform-select {
  flex: 1 1 auto;
  min-width: 0;
  width: 0;
}

.platform-feat-check {
  align-items: center;
  background: var(--platform-input-bg);
  border: 1px solid var(--platform-border);
  border-radius: 0.35rem;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
  height: 2rem;
  justify-content: center;
  margin: 0;
  width: 2rem;
}

.platform-feat-check input {
  display: none;
}

.platform-feat-check input:checked + i {
  color: var(--platform-success);
}

.platform-toggle {
  align-items: center;
  color: var(--platform-muted);
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 1;
  font-size: 0.72rem;
  gap: 0.4rem;
  line-height: 1.35;
  user-select: none;
  white-space: normal;
}

.platform-toggle input {
  accent-color: var(--platform-accent-strong);
}

.platform-plan-card--new {
  background: rgba(30, 37, 51, 0.55);
  border: 1px dashed var(--platform-border);
  min-height: 320px;
  padding: 0;
}

.platform-plan-card-new-inner {
  align-items: center;
  color: var(--platform-muted);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  justify-content: center;
  padding: 2rem 1rem;
}

.platform-plan-card--new .border-secondary {
  border-color: var(--platform-border) !important;
}

.platform-card .table-responsive {
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  overflow-x: auto;
}
