/* ============================================================================
   TailAdmin v4 Design System — DEV Cloud Master Control (Dark / Light)
   ============================================================================ */
:root,
html[data-theme="dark"] {
  --brand-50: #ecf3ff;
  --brand-100: #dde9ff;
  --brand-200: #c2d6ff;
  --brand-400: #7592ff;
  --brand-500: #465fff;
  --brand-600: #3641f5;
  --brand-950: #161950;

  --bg-primary: #101828;
  --bg-sidebar: #111927;
  --bg-topbar: rgba(16, 24, 40, 0.92);
  --bg-card: #171f2f;
  --bg-card-subtle: #111827;
  --bg-card-hover: #1d2939;
  --bg-input: #101828;
  --border-color: #263244;
  --border-subtle: rgba(255, 255, 255, 0.06);

  --text-main: #f9fafb;
  --text-secondary: #d0d5dd;
  --text-muted: #98a2b3;

  --accent-cyan: #7592ff;
  --accent-blue: #465fff;
  --accent-green: #12b76a;
  --accent-yellow: #f79009;
  --accent-red: #f04438;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-modal: 0 25px 60px -15px rgba(0, 0, 0, 0.85);
  --font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

html[data-theme="light"] {
  --bg-primary: #f9fafb;
  --bg-sidebar: #ffffff;
  --bg-topbar: rgba(255, 255, 255, 0.92);
  --bg-card: #ffffff;
  --bg-card-subtle: #f2f4f7;
  --bg-card-hover: #f9fafb;
  --bg-input: #ffffff;
  --border-color: #e4e7ec;
  --border-subtle: #f2f4f7;

  --text-main: #101828;
  --text-secondary: #344054;
  --text-muted: #667085;

  --accent-cyan: #465fff;
  --accent-blue: #3641f5;
  --accent-green: #039855;
  --accent-yellow: #dc6803;
  --accent-red: #d92d20;

  --shadow-card: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.03);
  --shadow-modal: 0 25px 50px -12px rgba(16, 24, 40, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   TailAdmin Shell: Sidebar + Sticky Topbar + Workspace
   ========================================================================== */
.ta-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.ta-sidebar {
  width: 274px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 40;
  transition: width 0.2s ease, transform 0.22s ease;
}

.ta-shell.sidebar-collapsed .ta-sidebar {
  width: 0;
  padding-left: 0;
  padding-right: 0;
  border-right: none;
  overflow: hidden;
}

.ta-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.55);
  backdrop-filter: blur(3px);
  z-index: 35;
}

.ta-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 18px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--brand-500);
  color: #ffffff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(70, 95, 255, 0.35);
}

.logo-text h1 {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.logo-text p {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.ta-nav-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 12px 6px;
}

.ta-nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.ta-sidebar .ta-nav-list .btn {
  width: 100%;
  justify-content: flex-start;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  box-shadow: none;
  transform: none;
}

.ta-sidebar .ta-nav-list .btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.ta-sidebar .ta-nav-list .btn.btn-primary {
  background: rgba(70, 95, 255, 0.14);
  color: var(--brand-400);
  border-color: rgba(70, 95, 255, 0.28);
}

html[data-theme="light"] .ta-sidebar .ta-nav-list .btn.btn-primary {
  background: var(--brand-50);
  color: var(--brand-600);
  border-color: var(--brand-200);
}

.ta-sidebar-footer {
  margin-top: auto;
  padding: 14px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  font-size: 0.74rem;
  color: var(--text-muted);
}

.ta-sidebar-footer strong {
  display: block;
  color: var(--text-main);
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.ta-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ta-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 70px;
  height: auto;
  background: var(--bg-topbar);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.ta-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ta-sidebar-toggle {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.ta-sidebar-toggle:hover {
  border-color: var(--brand-500);
  color: var(--text-main);
}

.ta-topbar-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ta-topbar-title strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ta-topbar-title span {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ta-content {
  width: 100%;
  max-width: 1520px;
  margin: 0 auto;
  padding: 24px 28px 36px;
}

.container {
  max-width: 1520px;
  margin: 0 auto;
  padding: 24px;
}

.ta-theme-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.15s ease;
}

.ta-theme-btn:hover {
  border-color: var(--brand-500);
  color: var(--brand-500);
}

/* Badges Live */
.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(18, 183, 106, 0.12);
  border: 1px solid rgba(18, 183, 106, 0.28);
  color: #32d583;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}

html[data-theme="light"] .badge-live {
  background: #ecfdf3;
  border-color: #abefc6;
  color: #027a48;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(18, 183, 106, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(18, 183, 106, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(18, 183, 106, 0); }
}

/* Botones TailAdmin */
.btn {
  padding: 9px 16px;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.84rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--brand-500);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

.btn-primary:hover {
  background: var(--brand-600);
}

.btn-outline {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--brand-400);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.76rem;
  border-radius: 8px;
}

.btn-xs {
  padding: 4px 10px;
  font-size: 0.72rem;
  border-radius: 8px;
}

/* Agrupador de botones de acción */
.actions-cluster {
  display: inline-flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-end;
}

.actions-cluster .actions-row {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.actions-cluster .actions-row.row-bottom {
  justify-content: flex-end;
}

.btn-add-header {
  width: 26px;
  height: 26px;
  background: rgba(18, 183, 106, 0.14);
  border: 1px solid rgba(18, 183, 106, 0.4);
  color: var(--accent-green);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-add-header:hover {
  background: var(--accent-green);
  color: #ffffff;
}

.btn-action-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.86rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-action-icon:hover {
  background: rgba(70, 95, 255, 0.14);
  border-color: var(--brand-500);
}

.btn-action-icon.btn-danger:hover {
  background: rgba(240, 68, 56, 0.15);
  border-color: var(--accent-red);
}

/* ==========================================================================
   Metric Cards TailAdmin
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease;
}

.stat-card:hover {
  border-color: var(--brand-400);
}

.ta-metric-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 14px;
}

.stat-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.stat-meta {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Sub-métricas */
.stats-subgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.stat-subcard {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-card);
}

.stat-subcard .sub-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-subcard .sub-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
}

/* ==========================================================================
   Secciones, Filtros y Tablas TailAdmin
   ========================================================================== */
.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
}

.filter-pill {
  padding: 7px 13px;
  border-radius: 10px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  color: var(--text-main);
  border-color: var(--brand-400);
}

.filter-pill.active {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #ffffff;
}

.filter-pill .pill-count {
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.68rem;
  font-family: var(--font-mono);
}

.search-input-wrapper {
  flex: 1;
  min-width: 220px;
  position: relative;
}

.search-input-wrapper input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border-radius: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.82rem;
  outline: none;
}

.search-input-wrapper input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(70, 95, 255, 0.16);
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: var(--text-muted);
  pointer-events: none;
}

.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow-x: auto;
  box-shadow: var(--shadow-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 15px 18px;
  font-size: 0.84rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

tr:hover td {
  background: var(--bg-card-hover);
}

.client-name {
  font-weight: 600;
  color: var(--text-main);
}

.client-id {
  font-size: 0.72rem;
  color: var(--brand-400);
  font-family: var(--font-mono);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-green, .badge-emerald {
  background: rgba(18, 183, 106, 0.14);
  color: #32d583;
  border: 1px solid rgba(18, 183, 106, 0.28);
}

.badge-yellow, .badge-amber {
  background: rgba(247, 144, 9, 0.14);
  color: #fdb022;
  border: 1px solid rgba(247, 144, 9, 0.28);
}

.badge-red {
  background: rgba(240, 68, 56, 0.14);
  color: #f97066;
  border: 1px solid rgba(240, 68, 56, 0.28);
}

.badge-gray {
  background: rgba(152, 162, 179, 0.14);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.badge-purple {
  background: rgba(158, 119, 237, 0.14);
  color: #b692f6;
  border: 1px solid rgba(158, 119, 237, 0.3);
}

.badge-cyan, .badge-blue, .badge-indigo {
  background: rgba(70, 95, 255, 0.14);
  color: var(--brand-400);
  border: 1px solid rgba(70, 95, 255, 0.3);
}

.badge-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border-color);
}

html[data-theme="light"] .badge-green, html[data-theme="light"] .badge-emerald {
  background: #ecfdf3; color: #027a48; border-color: #abefc6;
}
html[data-theme="light"] .badge-yellow, html[data-theme="light"] .badge-amber {
  background: #fffaeb; color: #b54708; border-color: #fedf89;
}
html[data-theme="light"] .badge-red {
  background: #fef3f2; color: #b42318; border-color: #fecdca;
}
html[data-theme="light"] .badge-cyan, html[data-theme="light"] .badge-blue, html[data-theme="light"] .badge-indigo {
  background: #ecf3ff; color: #3641f5; border-color: #c2d6ff;
}
html[data-theme="light"] .badge-purple {
  background: #f4f3ff; color: #5925dc; border-color: #d9d6fe;
}

/* Gobernanza Modular */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 16px;
}

.module-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.module-card:hover {
  border-color: var(--brand-400);
}

.module-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.module-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.module-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--border-color);
  transition: .25s;
  border-radius: 999px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: .25s;
  border-radius: 50%;
}

input:checked + .slider {
  background: var(--brand-500);
}

input:checked + .slider:before {
  transform: translateX(18px);
}

/* Modales TailAdmin */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.75);
  backdrop-filter: blur(6px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex !important;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 26px 28px;
  box-shadow: var(--shadow-modal);
  color: var(--text-main);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 3px;
}

.close-btn {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 1.25rem;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: rgba(240, 68, 56, 0.15);
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.backup-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 380px;
  padding-right: 4px;
}

.backup-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

/* Formularios */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control,
.input-text {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 10px;
  color: var(--text-main) !important;
  font-family: inherit;
  font-size: 0.86rem;
  outline: none;
}

.form-control:focus,
.input-text:focus {
  border-color: var(--brand-500) !important;
  box-shadow: 0 0 0 3px rgba(70, 95, 255, 0.16);
}

.alert-box {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  margin-bottom: 18px;
  display: none;
}

.alert-error {
  background: rgba(240, 68, 56, 0.14);
  border: 1px solid rgba(240, 68, 56, 0.3);
  color: #f97066;
}

/* ==========================================================================
   TailAdmin Split-Screen Auth (login.html)
   ========================================================================== */
.ta-auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--bg-primary);
}

@media (min-width: 960px) {
  .ta-auth-page {
    grid-template-columns: 1fr 1fr;
  }
}

.ta-auth-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 32px 24px;
  position: relative;
}

.ta-auth-card {
  width: 100%;
  max-width: 440px;
}

.ta-auth-hero {
  display: none;
  background-color: #161950;
  color: #ffffff;
  position: relative;
  overflow: hidden;
  padding: 48px;
  align-items: center;
  justify-content: center;
}

@media (min-width: 960px) {
  .ta-auth-hero {
    display: flex;
  }
}

.ta-auth-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.ta-auth-hero-inner {
  position: relative;
  z-index: 2;
  max-width: 420px;
  text-align: center;
}

.ta-auth-hero-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--brand-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  box-shadow: 0 12px 30px rgba(70, 95, 255, 0.4);
}

.ta-auth-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
}

.ta-auth-pill {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e0e7ff;
}

.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  width: 100%;
  max-width: 430px;
  padding: 32px;
  box-shadow: var(--shadow-modal);
}

/* Badge perfil en topbar */
.user-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
}

.user-profile-badge .badge-role {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  background: rgba(70, 95, 255, 0.16);
  color: var(--brand-400);
  border: 1px solid rgba(70, 95, 255, 0.3);
}

.badge-role-pos { background: rgba(59, 130, 246, 0.15) !important; color: #60a5fa !important; }
.badge-role-agro { background: rgba(18, 183, 106, 0.15) !important; color: #32d583 !important; }
.badge-role-cont { background: rgba(158, 119, 237, 0.15) !important; color: #b692f6 !important; }

/* Ajustes automáticos de contraste cuando el usuario activa Modo Claro */
html[data-theme="light"] .modal-card h3,
html[data-theme="light"] .modal-card h4,
html[data-theme="light"] .modal-card label,
html[data-theme="light"] .modal-card strong,
html[data-theme="light"] .stat-subcard .sub-val {
  color: var(--text-main) !important;
}

html[data-theme="light"] .modal-card > div[style*="rgba(255,255,255"],
html[data-theme="light"] .modal-card form[style*="rgba(255,255,255"] {
  background: var(--bg-card-subtle) !important;
  border-color: var(--border-color) !important;
}

html[data-theme="light"] #saasHistorialPagosBox,
html[data-theme="light"] #profHistorialPagosBox,
html[data-theme="light"] #bovedaHistorialPagosBox,
html[data-theme="light"] #contadorComerciosCheckboxes {
  background: var(--bg-card-subtle) !important;
  color: var(--text-secondary) !important;
}

html[data-theme="light"] #contadorComerciosCheckboxes label {
  color: var(--text-main) !important;
}

html[data-theme="light"] #discoveryList > div {
  background: #ffffff !important;
  border-color: var(--border-color) !important;
  color: var(--text-main) !important;
}

/* Responsive Sidebar Drawer */
@media (max-width: 1024px) {
  .ta-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
  }
  .ta-shell.sidebar-open .ta-sidebar {
    transform: translateX(0);
    width: 274px;
  }
  .ta-shell.sidebar-open .ta-sidebar-overlay {
    display: block;
  }
  .ta-content {
    padding: 18px 16px 28px;
  }
}

/* Switch Habilitar / Deshabilitar Planes y Controles 100% Responsive */
.ta-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.ta-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.ta-switch-slider {
  position: relative;
  width: 42px;
  height: 24px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}

.ta-switch-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.ta-switch input:checked + .ta-switch-slider {
  background: var(--brand-500);
  border-color: var(--brand-500);
}

.ta-switch input:checked + .ta-switch-slider::after {
  transform: translateX(18px);
  background: #ffffff;
}

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

.ta-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 768px) {
  .ta-topbar {
    padding: 12px 14px;
    gap: 8px;
  }
  .ta-topbar-title {
    font-size: 0.92rem;
  }
  .ta-topbar-sub {
    display: none;
  }
  .user-profile-badge {
    padding: 4px 10px;
    font-size: 0.72rem;
  }
  .metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
  }
  .section-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-pills {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }
  .table-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modal-card {
    padding: 18px 16px;
    border-radius: 14px;
    max-height: 94vh;
  }
}

@media (max-width: 640px) {
  .ta-grid-2,
  .ta-grid-3 {
    grid-template-columns: 1fr;
  }
  .modal-card form > div[style*="grid-template-columns"],
  .modal-card div[style*="grid-template-columns: 1fr 1fr"],
  .modal-card div[style*="grid-template-columns: 1fr 2fr"] {
    grid-template-columns: 1fr !important;
  }
  .modal-card div[style*="display: flex"] {
    flex-wrap: wrap;
  }
  .login-card {
    padding: 24px 18px;
  }
}


/* ============================================================================
   PULIDO DE AUDITORÍA PROFUNDA: CONTRASTE CLARO WCAG, TABLAS Y RENDIMIENTO
   ============================================================================ */

*, *::before, *::after {
  box-sizing: border-box;
}

select.form-control,
input.form-control,
.form-control,
.input-text {
  min-width: 0;
  max-width: 100%;
  text-overflow: ellipsis;
}

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

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

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.filter-pill {
  white-space: nowrap;
  flex-shrink: 0;
}

.badge,
.btn-xs,
.btn-sm {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.table-wrapper th,
.table-card th {
  padding: 11px 12px;
  white-space: nowrap;
}

.table-wrapper td,
.table-card td {
  padding: 11px 12px;
  vertical-align: middle;
}

.discovery-card-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 13px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.discovery-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 6px;
}

.modal-card div[style*="grid-template-columns: 1fr 1fr"] {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

/* Contraste WCAG AA garantizado en Modo Claro */
html[data-theme="light"] .badge-green,
html[data-theme="light"] .badge-emerald {
  color: #027a48 !important;
  background: rgba(18, 183, 106, 0.14) !important;
}

html[data-theme="light"] .badge-yellow,
html[data-theme="light"] .badge-amber {
  color: #b54708 !important;
  background: rgba(247, 144, 9, 0.14) !important;
}

html[data-theme="light"] .badge-red {
  color: #b42318 !important;
  background: rgba(240, 68, 56, 0.14) !important;
}

html[data-theme="light"] .badge-purple {
  color: #5925dc !important;
  background: rgba(127, 86, 217, 0.14) !important;
}

html[data-theme="light"] .badge-cyan,
html[data-theme="light"] .badge-blue,
html[data-theme="light"] .badge-indigo {
  color: #0369a1 !important;
  background: rgba(2, 132, 199, 0.12) !important;
}

html[data-theme="light"] .badge-gray {
  color: #344054 !important;
  background: #e4e7ec !important;
}

html[data-theme="light"] .user-profile-badge .badge-role {
  color: #3538cd !important;
  background: #eef2ff !important;
}

html[data-theme="light"] .badge-role-pos {
  color: #1d4ed8 !important;
  background: rgba(37, 99, 235, 0.12) !important;
}

html[data-theme="light"] .badge-role-agro {
  color: #047857 !important;
  background: rgba(5, 150, 105, 0.12) !important;
}

html[data-theme="light"] .badge-role-cont {
  color: #6d28d9 !important;
  background: rgba(124, 58, 237, 0.12) !important;
}

html[data-theme="light"] #statLicencias,
html[data-theme="light"] #subStatConContador {
  color: #5925dc !important;
}

html[data-theme="light"] #statBackups,
html[data-theme="light"] #subStatSolicitudes,
html[data-theme="light"] #btnToggleAutoCuarentena {
  color: #b54708 !important;
  border-color: rgba(181, 71, 8, 0.4) !important;
}

html[data-theme="light"] #subStatSnapshots,
html[data-theme="light"] #subStatMrrSaas {
  color: #0369a1 !important;
}

html[data-theme="light"] #subStatIncidentes {
  color: #b42318 !important;
}

html[data-theme="light"] #statVentasHoyUsd,
html[data-theme="light"] #subStatCloud {
  color: #0e7490 !important;
}

html[data-theme="light"] [style*="color: #fff"],
html[data-theme="light"] [style*="color:#fff"],
html[data-theme="light"] [style*="color: #e5e7eb"],
html[data-theme="light"] [style*="color:#e5e7eb"],
html[data-theme="light"] [style*="color: #cbd5e1"],
html[data-theme="light"] [style*="color:#cbd5e1"] {
  color: var(--text-main) !important;
}

html[data-theme="light"] [style*="color:#32d583"],
html[data-theme="light"] [style*="color: #32d583"],
html[data-theme="light"] [style*="color: #34d399"] {
  color: #027a48 !important;
}

html[data-theme="light"] [style*="color:#fcd34d"],
html[data-theme="light"] [style*="color: #fcd34d"] {
  color: #b54708 !important;
}

html[data-theme="light"] [style*="color:#38bdf8"],
html[data-theme="light"] [style*="color: #38bdf8"] {
  color: #0369a1 !important;
}

html[data-theme="light"] [style*="background: rgba(255,255,255,0.06)"],
html[data-theme="light"] [style*="background: rgba(0,0,0,0.3)"] {
  background: var(--bg-card-subtle) !important;
  color: var(--text-main) !important;
}

html[data-theme="light"] .discovery-card-item {
  background: #ffffff;
  border-color: var(--border-color);
  color: var(--text-main);
}

@media (max-width: 768px) {
  .ta-topbar {
    padding: 8px 12px;
    gap: 6px;
  }
  .ta-topbar-left {
    flex: 1 1 auto;
  }
  .header-actions {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }
  .badge-live {
    display: none;
  }
}


/* Pulido final WCAG AA Modo Claro + anti-CLS en /dev-cloud/ */
html[data-theme="light"] button[data-action="plan-boveda"],
html[data-theme="light"] button[data-action="modulos"] {
  color: #0e7490 !important;
  border-color: rgba(14, 116, 144, 0.4) !important;
  background: rgba(14, 116, 144, 0.08) !important;
}

html[data-theme="light"] button[data-action="usuarios"] {
  color: #3730a3 !important;
  border-color: rgba(55, 48, 163, 0.35) !important;
  background: rgba(79, 70, 229, 0.08) !important;
}

html[data-theme="light"] button[data-action="asignar-cpc"],
html[data-theme="light"] button[data-action="portal-contador"] {
  color: #3538cd !important;
  border-color: rgba(53, 56, 205, 0.35) !important;
}

html[data-theme="light"] .client-id {
  color: #3538cd !important;
}

html[data-theme="light"] #discoverySection > div {
  background: rgba(254, 242, 242, 0.92) !important;
  border-color: rgba(220, 38, 38, 0.3) !important;
}

html[data-theme="light"] #discoverySection p,
html[data-theme="light"] #discoverySection span[style*="color: var(--text-muted)"] {
  color: #344054 !important;
}

html[data-theme="light"] #sectionCloudInstances div[style*="rgba(6, 182, 212"],
html[data-theme="light"] #sectionCloudInstances div[style*="rgba(6,182,212"] {
  background: rgba(2, 132, 199, 0.08) !important;
  border-color: rgba(2, 132, 199, 0.25) !important;
  color: #0c4a6e !important;
}

html[data-theme="light"] #sectionCloudInstances div[style*="rgba(6, 182, 212"] *,
html[data-theme="light"] #sectionCloudInstances div[style*="rgba(6,182,212"] * {
  color: #0c4a6e !important;
}

html[data-theme="light"] #contadorCrudModal input,
html[data-theme="light"] #contadorCrudModal select {
  background: var(--bg-input) !important;
  color: var(--text-main) !important;
}

#sectionCloudInstances th,
#sectionCloudInstances td {
  padding: 9px 8px;
  font-size: 0.78rem;
}

#sectionCloudInstances th {
  font-size: 0.68rem;
}
