/**
 * TGA Solutions — Master Super-Admin Design System
 * Aesthetic: Clean White Enterprise SaaS • Minimalist & High-End Corporate
 * Compatible with Stripe, Linear & Vercel design standards
 */

:root {
  /* Tokens de Color — shadcn/ui DESIGN.md */
  --color-canvas: #f5f5f5;
  --color-paper: #ffffff;
  --color-surface-alt: #fafafa;
  --color-ink: #0a0a0a;
  --color-ink-soft: #171717;
  --color-mid-gray: #737373;
  --color-hairline: #e5e5e5;
  --color-ember: #e7000b;

  /* Surfaces & Backgrounds */
  --bg-page: #f5f5f5;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #fafafa;
  --bg-surface-hover: #f5f5f5;
  --bg-backdrop: rgba(10, 10, 10, 0.4);

  /* Hairline Borders */
  --border-light: #e5e5e5;
  --border-medium: #d4d4d4;
  --border-focus: var(--brand-primary, #0a0a0a);
  --border-focus-ring: rgba(10, 10, 10, 0.12);

  /* Typography Colors */
  --text-heading: #0a0a0a;
  --text-body: #171717;
  --text-muted: #737373;
  --text-tertiary: #a3a3a3;
  --text-inverse: #fafafa;

  /* Executive Brand Palette & Accent Customization */
  --brand-primary: #0a0a0a; /* Por defecto Ink; adaptable a acento personalizado */
  --brand-hover: #262626;
  --brand-active: #171717;
  --brand-subtle: #f5f5f5;
  --brand-border: #e5e5e5;

  /* Semantic State Colors (Destructive Ember #e7000b) */
  --rose-base: #e7000b;
  --rose-subtle: #fef2f2;
  --rose-border: #fecaca;
  --rose-text: #e7000b;

  --emerald-base: #10b981;
  --emerald-subtle: #ecfdf5;
  --emerald-border: #a7f3d0;
  --emerald-text: #065f46;

  --amber-base: #d97706;
  --amber-subtle: #fffbeb;
  --amber-border: #fde68a;
  --amber-text: #92400e;

  --violet-base: #6366f1;
  --violet-subtle: #eef2ff;
  --violet-border: #c7d2fe;
  --violet-text: #3730a3;

  /* Geometry & Radii (Mid / Medium Tokens — Shadcn/UI Aesthetic) */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;       /* Botones, inputs, tabs */
  --radius-xl: 14px;       /* Tarjetas, modales, table-wrap */
  --radius-2xl: 14px;
  --radius-3xl: 16px;
  --radius-cards: 12px;
  --radius-buttons: 10px;
  --radius-inputs: 10px;
  --radius-badges: 8px;
  --radius-pill: 9999px;

  /* Elevation Shadows from DESIGN.md */
  --shadow-subtle: 0 0 0 1px rgba(23, 23, 23, 0.05), 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-subtle-2: 0 0 0 1px rgba(23, 23, 23, 0.05);
  --shadow-xs: 0 0 0 1px rgba(23, 23, 23, 0.05);
  --shadow-sm: 0 0 0 1px rgba(23, 23, 23, 0.05), 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 0 0 1px rgba(23, 23, 23, 0.05), 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 0 0 1px rgba(23, 23, 23, 0.08), 0 8px 24px -4px rgba(0, 0, 0, 0.08);
  --shadow-modal: 0 0 0 1px rgba(23, 23, 23, 0.08), 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

  /* Typography — Geist & Inter */
  --font-sans: 'Franklin Gothic Medium', 'Franklin Gothic', 'ITC Franklin Gothic', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;

  /* Transitions */
  --transition-fast: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-body);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Minimalist Card Container */
.glass-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}

.glass-panel:hover {
  border-color: var(--border-medium);
}

/* ============================================================
   ESTADOS DE CARGA (SKELETON SHIMMER & PLACEHOLDERS)
   ============================================================ */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-surface-subtle, #fafafa) 25%,
    var(--border-light, #e5e5e5) 50%,
    var(--bg-surface-subtle, #fafafa) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-sm, 6px);
  display: inline-block;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-row {
  height: 48px;
  width: 100%;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
}

/* ============================================================
   1. MASTER HEADER & BRAND NAVIGATION
   ============================================================ */
.master-header {
  height: 64px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: var(--shadow-xs);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.05rem;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.brand-text-block h1 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.01em;
  margin: 0;
}

.brand-text-block small {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
  display: block;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--emerald-subtle);
  border: 1px solid var(--emerald-border);
  color: var(--emerald-text);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--emerald-base);
  display: inline-block;
}

/* ============================================================
   2. MAIN CONTAINER & DASHBOARD LAYOUT
   ============================================================ */
.master-main {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

/* ============================================================
   3. KPI CARDS (Executive Metrics)
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  padding: 20px;
  position: relative;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-cards);
  box-shadow: var(--shadow-subtle);
  transition: var(--transition-fast);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-medium);
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

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

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.kpi-card.emerald .kpi-icon {
  background: var(--emerald-subtle);
  color: var(--emerald-base);
}

.kpi-card.purple .kpi-icon {
  background: var(--violet-subtle);
  color: var(--violet-base);
}

.kpi-card.amber .kpi-icon {
  background: var(--amber-subtle);
  color: var(--amber-base);
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 6px;
}

.kpi-card.emerald .kpi-value {
  color: var(--emerald-text);
}

.kpi-card.purple .kpi-value {
  color: var(--violet-text);
}

.kpi-card.amber .kpi-value {
  color: var(--amber-text);
}

.kpi-subtext {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ============================================================
   4. PLANS SHOWCASE SECTION
   ============================================================ */
.plans-showcase-section {
  margin-bottom: 28px;
}

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

.plan-tier-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-cards);
  box-shadow: var(--shadow-subtle);
  transition: var(--transition-fast);
}

.plan-tier-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-medium);
}

.plan-tier-card.featured {
  border: 2px solid var(--brand-primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.plan-badge-featured {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--brand-subtle);
  color: var(--brand-primary);
  border: 1px solid var(--brand-border);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}

.plan-tier-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-heading);
  margin-bottom: 4px;
}

.plan-tier-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-height: 38px;
  line-height: 1.4;
  margin-bottom: 14px;
}

.plan-price-block {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.plan-price-num {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.02em;
}

.plan-price-period {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.plan-feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.plan-feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-body);
}

.plan-feature-item svg {
  width: 16px;
  height: 16px;
  color: var(--brand-primary);
  flex-shrink: 0;
  background: var(--brand-subtle);
  padding: 2px;
  border-radius: 50%;
}

/* ============================================================
   5. TOOLBAR & SEARCH / FILTERS
   ============================================================ */
.content-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.search-filter-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-inputs);
  padding: 8px 14px;
  min-width: 300px;
  box-shadow: var(--shadow-xs);
  transition: var(--transition-fast);
}

.search-filter-box:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--border-focus-ring);
}

.search-filter-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-heading);
  font-size: 0.85rem;
  font-family: inherit;
  width: 100%;
}

.search-filter-box input::placeholder {
  color: var(--text-tertiary);
}

.filter-pills-row {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter-btn {
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-buttons);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.filter-btn:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-heading);
  border-color: var(--border-medium);
}

.filter-btn.active {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2);
}

/* ============================================================
   6. ENTERPRISE SAAS DATA TABLE
   ============================================================ */
.table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-cards);
  box-shadow: var(--shadow-subtle);
  overflow-x: auto;
}

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

.saas-table thead th {
  background: var(--bg-surface-subtle);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.saas-table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
  color: var(--text-body);
  vertical-align: middle;
  background: var(--bg-surface);
  transition: var(--transition-fast);
}

.saas-table tbody tr:hover td {
  background-color: var(--bg-surface-hover);
}

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

/* Table Badges & Tags */
.code-pill {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--bg-surface-subtle);
  color: var(--text-heading);
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-light);
  display: inline-block;
  letter-spacing: 0.03em;
}

.type-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}

.type-pill.restaurante {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.type-pill.tienda {
  background: #ecfeff;
  color: #0e7490;
  border: 1px solid #a5f3fc;
}

.plan-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
}

.plan-badge.basico,
.plan-badge.emprende {
  background: var(--emerald-subtle);
  color: var(--emerald-text);
  border: 1px solid var(--emerald-border);
}

.plan-badge.profesional {
  background: var(--brand-subtle);
  color: var(--brand-primary);
  border: 1px solid var(--brand-border);
}

.plan-badge.empresarial {
  background: var(--violet-subtle);
  color: var(--violet-text);
  border: 1px solid var(--violet-border);
}

/* Status switch button */
.status-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-fast);
}

.status-switch.active {
  background: var(--emerald-subtle);
  color: var(--emerald-text);
  border-color: var(--emerald-border);
}

.status-switch.suspended {
  background: var(--rose-subtle);
  color: var(--rose-text);
  border-color: var(--rose-border);
}

.status-switch:hover {
  filter: brightness(0.96);
}

/* ============================================================
   7. BUTTONS & CONTROLS
   ============================================================ */
.btn-primary-cyan,
.btn-primary-blue {
  background: var(--brand-primary);
  color: #ffffff;
  border: 1px solid var(--brand-primary);
  border-radius: var(--radius-buttons);
  padding: 9px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: var(--transition-fast);
}

.btn-primary-cyan:hover,
.btn-primary-blue:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-primary-cyan:active,
.btn-primary-blue:active {
  background: var(--brand-active);
  transform: scale(0.98);
}

.btn-secondary-slate {
  background: var(--bg-page);
  color: var(--text-body);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-buttons);
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-secondary-slate:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-heading);
  border-color: var(--border-medium);
}

.btn-secondary-slate:active {
  background: var(--border-light);
  transform: scale(0.98);
}

/* ============================================================
   8. FORMS & INPUT CONTROLS
   ============================================================ */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-inputs);
  padding: 10px 14px;
  font-size: 0.88rem;
  color: var(--text-heading);
  font-family: inherit;
  transition: var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--border-focus-ring);
}

.form-control::placeholder {
  color: var(--text-tertiary);
}

/* Password Visibility Toggle Button & Micro-Animation */
.password-toggle-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, transform 0.15s ease;
}

.password-toggle-btn:hover {
  color: var(--text-heading);
}

.password-toggle-btn:active {
  transform: translateY(-50%) scale(0.92);
}

.password-toggle-btn.active {
  color: var(--brand-primary, #0a0a0a);
}

@keyframes eyeSlashPulse {
  0% { transform: scale(0.75) rotate(-18deg); opacity: 0.3; }
  60% { transform: scale(1.18) rotate(6deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes eyeOpenPulse {
  0% { transform: scale(0.75) rotate(18deg); opacity: 0.3; }
  60% { transform: scale(1.18) rotate(-6deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.password-toggle-btn svg.anim-toggle-show {
  animation: eyeSlashPulse 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.password-toggle-btn svg.anim-toggle-hide {
  animation: eyeOpenPulse 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Radio select cards inside modal */
.plan-select-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 6px;
}

.plan-radio-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  cursor: pointer;
  text-align: center;
  transition: var(--transition-fast);
}

.plan-radio-card:hover {
  border-color: var(--border-medium);
  background: var(--bg-surface-subtle);
}

.plan-radio-card.active {
  border: 2px solid var(--brand-primary);
  background: var(--brand-subtle);
}

.plan-radio-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 2px;
}

.plan-radio-price {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand-primary);
  margin-bottom: 2px;
}

.plan-radio-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ============================================================
   9. MODALS & BACKDROP OVERLAY
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-backdrop);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-backdrop.active {
  display: flex;
  opacity: 1;
}

.modal-sheet {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-cards);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
  transform: translateY(8px);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.active .modal-sheet {
  transform: translateY(0);
}

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

.modal-sheet-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.02em;
}

.modal-sheet-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-close-icon {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  transition: var(--transition-fast);
}

.modal-close-icon:hover {
  color: var(--text-heading);
  background: var(--bg-surface-subtle);
}

/* ============================================================
   10. LOGIN WALL (Geometric Pattern & TGA Logo Watermark)
   ============================================================ */
/* ============================================================ */
/* NUEVO LOGIN WALL FULL-SCREEN SPLIT (ADMIN MASTER CONSOLE)    */
/* ============================================================ */
.admin-login-wall {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  background: #090d16;
  overflow: hidden;
  display: flex;
}

.admin-login-split {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  overflow: hidden;
}

.admin-login-console-col {
  background: #0b1120;
  padding: 50px 70px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-sizing: border-box;
}

.admin-login-brand-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.admin-login-topbar-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.admin-login-topbar-text {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.admin-login-topbar-text strong {
  color: var(--brand-primary, #50BDC6);
}

.admin-login-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  margin-bottom: 24px;
}

.admin-login-badge-pill img {
  height: 24px;
  width: auto;
  object-fit: contain;
}

.admin-login-brand-txt {
  font-size: 0.88rem;
  font-weight: 700;
  color: #f1f5f9;
}

.admin-login-brand-txt strong {
  color: var(--brand-primary, #50BDC6);
}

.admin-login-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  margin: 0 0 8px 0;
}

.admin-login-subtitle {
  font-size: 0.86rem;
  color: #94a3b8;
  line-height: 1.5;
  margin: 0 0 28px 0;
}

.admin-login-footer-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-back-pos-link {
  color: #38bdf8;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease;
}

.admin-back-pos-link:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

/* Columna Derecha: Dynamic SaaS Operations */
.admin-login-ops-col {
  background: radial-gradient(circle at 10% 20%, rgba(80, 189, 198, 0.15) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(99, 102, 241, 0.18) 0%, transparent 45%),
              linear-gradient(145deg, #0f172a 0%, #1e1b4b 60%, #090d16 100%);
  position: relative;
  overflow: hidden;
  padding: 60px 50px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.admin-ops-glow-orb-1 {
  position: absolute;
  top: -60px;
  right: -60px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: rgba(80, 189, 198, 0.18);
  filter: blur(60px);
  pointer-events: none;
}

.admin-ops-glow-orb-2 {
  position: absolute;
  bottom: -80px;
  left: -40px;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.2);
  filter: blur(70px);
  pointer-events: none;
}

.admin-ops-content {
  position: relative;
  z-index: 2;
  max-width: 580px;
  margin: 0 auto;
  width: 100%;
}

.admin-ops-top-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 24px;
}

.admin-ops-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 10px #34d399;
}

.admin-ops-card {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
  transition: transform 0.3s ease;
}

@keyframes adminFloat1 {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

@keyframes adminFloat2 {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(8px); }
}

.admin-ops-float-1 {
  animation: adminFloat1 7s ease-in-out infinite;
}

.admin-ops-float-2 {
  animation: adminFloat2 8s ease-in-out infinite;
}

@keyframes adminFloat3 {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
}

.admin-ops-float-3 {
  animation: adminFloat3 9s ease-in-out infinite;
}

.admin-ops-bg-pattern {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(80, 189, 198, 0.12) 1.5px, transparent 1.5px);
  background-size: 28px 28px;
  opacity: 0.6;
  pointer-events: none;
}

.admin-ops-flow-diagram {
  width: 100%;
  height: 30px;
  margin: 4px 0 8px 0;
  overflow: hidden;
}

.admin-ops-svg-flow {
  width: 100%;
  height: 100%;
}

@keyframes flowPacket {
  0% { stroke-dashoffset: 160; }
  100% { stroke-dashoffset: 0; }
}

@keyframes nodePulseAnim {
  0%, 100% { transform: scale(1); opacity: 1; filter: drop-shadow(0 0 3px currentColor); }
  50% { transform: scale(1.3); opacity: 0.8; filter: drop-shadow(0 0 6px currentColor); }
}

.admin-flow-packet {
  animation: flowPacket 3.5s linear infinite;
}

.admin-node-pulse {
  transform-origin: center;
  animation: nodePulseAnim 2.2s ease-in-out infinite;
}

.admin-ops-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-ops-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.admin-ops-status-pill {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 9999px;
  background: rgba(52, 211, 153, 0.18);
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.admin-ops-mini-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-ops-mini-metrics .metric-label {
  display: block;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  font-weight: 700;
}

.admin-ops-mini-metrics .metric-val {
  display: block;
  font-size: 0.88rem;
  color: #ffffff;
  font-weight: 800;
  margin-top: 2px;
}

.admin-ops-footer {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 900px) {
  .admin-login-wall {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .admin-login-split {
    grid-template-columns: 1fr;
    height: auto !important;
    min-height: 100vh;
  }
  .admin-login-ops-col {
    display: none;
  }
  .admin-login-console-col {
    padding: 36px 24px;
    min-height: 100vh;
    box-sizing: border-box;
  }
}

.login-wall {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: #0b1120;
  background-image: 
    radial-gradient(circle at 50% 30%, rgba(80, 189, 198, 0.15) 0%, transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(37, 99, 235, 0.12) 0%, transparent 50%),
    linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
  position: relative;
  overflow: hidden;
}

.login-wall::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../img/tga_logo.png'), url('/admin/img/tga_logo.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: min(420px, 60vw) auto;
  opacity: 0.045;
  pointer-events: none;
  z-index: 0;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 38px 34px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-cards, 20px);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
  text-align: center;
}

.login-icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--brand-subtle);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  border: 1px solid var(--brand-border);
}

/* ============================================================
   11. TOAST NOTIFICATION CONTAINER
   ============================================================ */
#admin-toast-content {
  background: var(--bg-surface);
  color: var(--text-heading);
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-lg);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .master-header {
    padding: 0 16px;
  }
  .master-main {
    padding: 16px 12px 36px;
  }
  .content-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .search-filter-box {
    min-width: 100%;
  }
  .plan-select-grid {
    grid-template-columns: 1fr;
  }
}

/* Danger action button in table */
.btn-danger-action {
  transition: all 0.15s ease;
}
.btn-danger-action:hover {
  background: #fff1f2 !important;
  color: #e11d48 !important;
  border-color: #fecdd3 !important;
}

/* ============================================================
   DESIGN.MD TYPOGRAPHIC SPEC & SHADCN/UI ELEVATIONS FOR ADMIN
   ============================================================ */
h1, h2, h3, .modal-sheet-title, .brand-text-block h1 {
  letter-spacing: -0.025em;
  font-weight: 600;
  color: var(--text-heading);
}

.kpi-label, .form-label, .plan-feature-item {
  letter-spacing: 0.03em;
}

.kpi-value {
  letter-spacing: -0.025em;
  font-weight: 600;
  color: var(--text-heading);
}

/* Hairline card boundary definition */
.kpi-card,
.plan-tier-card,
.table-wrap,
.modal-sheet,
.login-card {
  border: 1px solid var(--color-hairline) !important;
  box-shadow: var(--shadow-subtle) !important;
}

.form-control:focus {
  background: #ffffff !important;
  border-color: var(--brand-primary) !important;
  box-shadow: 0 0 0 1px var(--brand-primary) !important;
  outline: none !important;
}

/* ===== Esqueletos de carga con la forma del contenido real (admin-skeleton.js) ===== */
.skeleton.sk { display: inline-block; vertical-align: middle; max-width: 100%; }
.sk-fila td { vertical-align: middle; }
.sk-sr, .sk-sr-fila td { position: absolute !important; width: 1px; height: 1px; padding: 0 !important; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0 !important; }
.sk-sr-fila { height: 0; }
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; background: var(--border-light, #e5e5e5); opacity: 0.6; }
}

.plan-price-block {
  flex-wrap: wrap;
}
.plan-price-iva {
  display: block;
  flex-basis: 100%;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.plan-resumen-precio {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md, 10px);
  background: var(--bg-surface-subtle, #f8fafc);
  border: 1px solid var(--border-medium, #e2e8f0);
  font-size: 0.84rem;
  color: var(--text-heading);
}
.plan-resumen-precio:empty {
  display: none;
}
.plan-resumen-linea {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
}
.plan-resumen-total {
  border-top: 1px solid var(--border-medium, #e2e8f0);
  margin-top: 6px;
  padding-top: 6px;
  font-weight: 800;
}
.plan-modulo-opcion {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border-medium, #e2e8f0);
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
}
.plan-modulo-opcion.deshabilitado {
  opacity: 0.5;
  cursor: not-allowed;
}


/* ============================================================
   MASTER NAVIGATION TABS & INVOICES MONITOR (HACIENDA)
   ============================================================ */

.master-nav-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 12px;
  overflow-x: auto;
}

.master-nav-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.master-nav-tab-btn:hover {
  background: var(--bg-surface);
  color: var(--text-heading);
  border-color: var(--border-light);
}

.master-nav-tab-btn.active {
  background: var(--bg-surface);
  color: var(--brand-primary);
  border-color: var(--border-medium);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.tab-badge-pill {
  background: var(--rose-base);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 4px;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.08); }
}

/* Invoices Monitor Badges */
.badge-hacienda {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-hacienda-aceptado {
  background: var(--emerald-subtle);
  color: var(--emerald-text);
  border-color: var(--emerald-border);
}

.badge-hacienda-rechazado {
  background: var(--rose-subtle);
  color: var(--rose-text);
  border-color: var(--rose-border);
}

.badge-hacienda-procesando {
  background: var(--amber-subtle);
  color: var(--amber-text);
  border-color: var(--amber-border);
}

.badge-hacienda-simulado {
  background: #eef2ff;
  color: #3730a3;
  border-color: #c7d2fe;
}

.badge-hacienda-error-firma {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}

/* Expandable Rows */
.invoice-parent-row {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.invoice-parent-row:hover {
  background-color: var(--bg-surface-hover) !important;
}

.invoice-parent-row.is-expanded {
  background-color: var(--bg-surface-subtle) !important;
}

.btn-toggle-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-toggle-expand:hover {
  color: var(--text-heading);
  border-color: var(--border-medium);
}

.btn-toggle-expand svg {
  transition: transform 0.2s ease;
}

.invoice-parent-row.is-expanded .btn-toggle-expand svg {
  transform: rotate(90deg);
}

.invoice-expand-drawer {
  background: var(--bg-surface-subtle);
  border-top: 1px dashed var(--border-light);
  padding: 16px 20px;
}

.invoice-drawer-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .invoice-drawer-grid {
    grid-template-columns: 1fr;
  }
}

.invoice-diag-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.invoice-code-viewer {
  background: #0f172a;
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid #334155;
}

/* Spinner and Buttons */
.btn-retry-invoice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid var(--amber-border);
  background: var(--amber-subtle);
  color: var(--amber-text);
}

.btn-retry-invoice:hover:not(:disabled) {
  background: var(--amber-base);
  color: #fff;
  border-color: var(--amber-base);
}

.btn-retry-invoice:disabled,
.btn-retry-invoice.is-loading {
  opacity: 0.7;
  cursor: not-allowed;
}

.spin-icon {
  animation: spin 1s linear infinite;
}

.btn-loading-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
  margin-right: 6px;
}

button.is-loading {
  opacity: 0.78;
  cursor: wait !important;
  pointer-events: none;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ==================== Monitor de comprobantes: lista con scroll propio ==================== */
.inv-scroll-wrap {
  max-height: min(62vh, 640px);
  overflow: auto;
  overscroll-behavior: contain;
}
.inv-scroll-wrap .saas-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-surface);
  box-shadow: inset 0 -1px 0 var(--border-light);
}

/* ==================== Soporte técnico ==================== */
.sop-admin-filtros { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.sop-admin-grid { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.sop-admin-grid.con-scripts { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr) 290px; }
@media (max-width: 1180px) { .sop-admin-grid.con-scripts { grid-template-columns: minmax(240px, 310px) minmax(0, 1fr); } .sop-admin-scripts-panel { grid-column: 1 / -1; max-height: 320px; } }
@media (max-width: 900px) { .sop-admin-grid, .sop-admin-grid.con-scripts { grid-template-columns: 1fr; } }
.sop-admin-scripts-panel { background: var(--bg-surface); border: 1px solid var(--color-hairline); border-radius: var(--radius-cards); padding: 14px; display: flex; flex-direction: column; gap: 10px; max-height: 68vh; min-width: 0; }
.sop-admin-lista { max-height: 68vh; overflow: auto; padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.sop-admin-item { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--border-light); border-radius: 10px; background: var(--bg-surface); cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
.sop-admin-item:hover { background: var(--bg-surface-subtle); }
.sop-admin-item.activo { border-color: var(--brand-primary); background: var(--brand-subtle); }
.sop-admin-item:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }
.sop-admin-item .fila { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.sop-admin-item strong { font-size: 0.86rem; color: var(--text-heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sop-admin-item small { display: block; font-size: 0.74rem; color: var(--text-muted); margin-top: 3px; }
.sop-admin-item.sin-leer strong::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-primary); margin-right: 6px; vertical-align: middle; }
.sop-admin-urgente { color: var(--rose-text); font-weight: 800; }
.sop-admin-estado { display: inline-flex; align-items: center; justify-content: center; align-self: flex-start; height: auto; min-height: 24px; font-size: 0.72rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; white-space: nowrap; line-height: 1; box-sizing: border-box; }
.sop-admin-estado.abierto { background: var(--brand-subtle); color: var(--brand-primary); }
.sop-admin-estado.en_proceso { background: #fef3c7; color: #92400e; }
.sop-admin-estado.resuelto { background: var(--emerald-subtle); color: var(--emerald-text); }
.sop-admin-estado.cerrado { background: var(--bg-surface-subtle); color: var(--text-muted); }
.sop-admin-detalle { background: var(--bg-surface); border: 1px solid var(--color-hairline); border-radius: var(--radius-cards); padding: 16px; min-height: 320px; display: flex; flex-direction: column; gap: 12px; }
.sop-admin-vacio { color: var(--text-muted); font-size: 0.86rem; text-align: center; margin: auto 0; }
.sop-admin-cabeza { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.sop-admin-cabeza h3 { margin: 0; font-size: 1rem; color: var(--text-heading); }
.sop-admin-meta { font-size: 0.78rem; color: var(--text-muted); line-height: 1.6; }
.sop-admin-hilo { display: flex; flex-direction: column; gap: 10px; max-height: 46vh; overflow: auto; padding: 4px; }
.sop-admin-typing { display: flex; align-items: center; gap: 6px; font-size: 0.76rem; color: var(--brand-primary); font-style: italic; padding: 4px 8px; border-radius: 8px; background: var(--brand-subtle); width: fit-content; margin-top: 4px; animation: sopPulse 1.4s infinite ease-in-out; }
@keyframes sopPulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
.sop-admin-msg { max-width: 82%; display: flex; flex-direction: column; }
.sop-admin-msg.soporte { align-self: flex-end; align-items: flex-end; }
.sop-admin-msg .burbuja { padding: 9px 12px; border-radius: 12px; font-size: 0.86rem; line-height: 1.45; background: var(--bg-surface-subtle); color: var(--text-body, var(--text-heading)); overflow-wrap: anywhere; }
.sop-admin-msg.soporte .burbuja { background: var(--brand-primary); color: #fff; }
.sop-admin-msg small { font-size: 0.7rem; color: var(--text-muted); margin-top: 3px; }
.sop-admin-responder { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border-light); padding-top: 12px; }
.sop-admin-responder textarea { resize: vertical; min-height: 70px; font-family: inherit; }
.sop-admin-responder .acciones { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Banco de respuestas rápidas / scripts (panel lateral derecho) */
.sop-admin-scripts-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px;
  max-height: 64vh;
  min-width: 0;
}
.sop-admin-scripts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}
.sop-admin-scripts-list {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-y: auto;
  padding-right: 2px;
}
/* Respuestas rápidas agrupadas por categoría */
.sop-script-grupo { display: flex; flex-direction: column; align-items: stretch; gap: 5px; width: 100%; }
.sop-script-cat { font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.sop-script-grupo-btns { display: flex; flex-wrap: wrap; gap: 5px; }
.sop-admin-nota-cerrado[hidden] { display: none; }
/* Mensaje nuevo que entra al hilo sin recargar la conversación */
.sop-msg-entra { animation: sopMsgEntra 0.22s ease-out both; }
@keyframes sopMsgEntra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sop-msg-entra { animation: none; } }
.sop-admin-nota-cerrado { font-size: 0.78rem; line-height: 1.4; color: var(--amber-text, #92400e); background: var(--amber-subtle, #fffbeb); border: 1px solid var(--amber-border, #fde68a); border-radius: 8px; padding: 8px 10px; }
.sop-script-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium, #cbd5e1);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-heading);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sop-script-btn:hover {
  background: var(--brand-subtle);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  transform: translateY(-1px);
}
.sop-script-btn:active {
  transform: translateY(0);
}


/* ==================== Movimiento: modales y cambio de pestaña ====================
   Entradas cortas (≤ 220 ms) solo con opacidad y un desplazamiento leve; se desactivan con
   "reducir movimiento" del sistema. Se usan @keyframes porque el modal pasa de display:none a flex. */
@keyframes tgaFondoEntra { from { opacity: 0; } to { opacity: 1; } }
@keyframes tgaHojaEntra { from { opacity: 0; transform: translateY(10px) scale(0.99); } to { opacity: 1; transform: none; } }
@keyframes tgaSeccionEntra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes tgaContenidoListo { from { opacity: 0.35; } to { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .modal-backdrop.active { animation: tgaFondoEntra 0.18s ease-out both; }
  .modal-backdrop.active .modal-sheet { animation: tgaHojaEntra 0.22s cubic-bezier(0.16, 1, 0.3, 1) both; }
  #view-tenants-section, #view-invoices-section, #view-soporte-section { animation: tgaSeccionEntra 0.2s ease-out both; }
  tbody:not(:has(.sk-fila)) > tr { animation: tgaContenidoListo 0.18s ease-out both; }
}

/* ==================== Íconos Phosphor Bold (js/iconos.js) ==================== */
i[data-icono] { display: inline-block; width: 16px; height: 16px; flex-shrink: 0; }
svg.ico { display: inline-block; flex-shrink: 0; vertical-align: -0.18em; width: 1em; height: 1em; }
svg.ico[style*="width"] { vertical-align: middle; }
.filter-btn svg.ico, .btn-secondary-slate svg.ico, .btn-primary-blue svg.ico { width: 15px; height: 15px; }
svg.ico.spin-icon { animation: tgaGirar 0.9s linear infinite; }
@keyframes tgaGirar { to { transform: rotate(360deg); } }
.plan-recomendado { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px; font-size: 0.66rem; font-weight: 800; background: var(--brand-subtle); color: var(--brand-primary); vertical-align: middle; }

/* ==================== Responsive: tablet y celular ==================== */
/* Ningún bloque puede ensanchar la página: los hijos de flex y grid pueden encogerse */
.master-main, .master-main section, .master-main > div { min-width: 0; }
.content-toolbar > *, .kpi-grid > *, .sop-admin-grid > * { min-width: 0; }
.filter-pills-row { max-width: 100%; }
.filter-btn { white-space: nowrap; flex-shrink: 0; }
.table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; }
.modal-sheet { max-width: min(var(--modal-max, 640px), calc(100vw - 24px)); }

@media (max-width: 1024px) {
  .master-nav-tabs { flex-wrap: nowrap; scrollbar-width: none; }
  .master-nav-tabs::-webkit-scrollbar { display: none; }
  .master-nav-tab-btn { flex-shrink: 0; white-space: nowrap; }
}

@media (max-width: 768px) {
  .master-header { height: auto; min-height: 56px; padding: 8px 12px; gap: 8px; }
  .brand-text-block small, .status-pill span:not(.pulse-dot) { display: none; }
  .brand-text-block h1 { font-size: 1rem; white-space: nowrap; }
  .status-pill { padding: 6px; }
  .header-actions { gap: 8px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
  .kpi-card { padding: 14px; }
  .kpi-value { font-size: 1.4rem; }

  /* Matriz de planes: las tres pestañas una debajo de otra */
  .plans-showcase-section { padding: 16px !important; }
  .plans-showcase-section [role="tablist"] { grid-template-columns: 1fr !important; }
  .plans-showcase-section [role="tablist"] > button { padding: 10px 12px !important; }

  /* Barras de búsqueda y filtros */
  .content-toolbar { padding: 12px !important; }
  .content-toolbar > .search-filter-box { flex: 1 1 100% !important; min-width: 0 !important; width: 100%; }
  .content-toolbar > div { flex-wrap: wrap; min-width: 0; }
  .content-toolbar input[type="date"] { flex: 1 1 120px; width: auto !important; min-width: 0; }
  .content-toolbar select { flex: 1 1 160px; min-width: 0 !important; }
  .content-toolbar > button { width: 100%; justify-content: center; }
  .filter-pills-row { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; padding-bottom: 4px; }
  .filter-pills-row::-webkit-scrollbar { display: none; }
  #inv-pagination-bar { justify-content: center !important; }

  /* Modales: casi pantalla completa y formularios en una columna */
  .modal-backdrop { padding: 10px; align-items: flex-end; }
  .modal-sheet { padding: 18px 16px !important; max-height: 94vh; width: 100% !important; border-radius: 16px 16px 12px 12px; }
  .modal-sheet [style*="grid-template-columns: 1fr 1fr"], .modal-sheet [style*="grid-template-columns:1fr 1fr"],
  .modal-sheet [style*="grid-template-columns: repeat(3, 1fr)"], .modal-sheet .plan-select-grid { grid-template-columns: 1fr !important; }
  .modal-sheet .form-group[style*="grid-column"] { grid-column: auto !important; }

  /* Soporte */
  .sop-admin-filtros #sop-buscar { max-width: none !important; width: 100%; }
  .sop-admin-lista { max-height: 46vh; }
}

@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .master-nav-tab-btn { padding: 8px 10px; font-size: 0.82rem; }
}
@media (max-width: 768px) {
  .content-toolbar > .search-filter-box { flex-wrap: nowrap !important; }
  .search-filter-box input { min-width: 0; flex: 1 1 auto; }
}

/* El modal "Editar negocio" usa .form-input: mismo aspecto que .form-control */
.form-input { width: 100%; max-width: 100%; box-sizing: border-box; background: var(--bg-page); border: 1px solid var(--border-light); border-radius: var(--radius-inputs); padding: 10px 14px; font-size: 0.88rem; color: var(--text-heading); font-family: inherit; transition: var(--transition-fast); }
.form-input:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px var(--border-focus-ring); }
.form-input::placeholder { color: var(--text-tertiary); }
.modal-sheet input, .modal-sheet select, .modal-sheet textarea { max-width: 100%; box-sizing: border-box; }

@media (max-width: 900px) {
  /* Soporte en celular: el panel de conversación aparece solo al elegir una solicitud */
  .sop-admin-detalle:has(> .sop-admin-vacio) { display: none; }
  .sop-admin-detalle { min-height: 0; }
}
@media (max-width: 768px) {
  /* Cualquier rejilla de varias columnas dentro de un modal pasa a una sola columna */
  .modal-sheet [style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
}

/* ============================================================
   Terminales y dispositivos del comercio (modal y ficha)
   ============================================================ */
.dev-modal { max-width: 820px; width: 95vw; display: flex; flex-direction: column; gap: 16px; }
.dev-modal .modal-sheet-header { margin-bottom: 0; }
.dev-head { display: flex; gap: 12px; align-items: center; min-width: 0; }
.dev-head-ico { width: 38px; height: 38px; border-radius: var(--radius-sm); background: var(--brand-subtle); color: var(--brand-primary); display: grid; place-items: center; flex-shrink: 0; }
.dev-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.dev-stat { border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--bg-surface); min-width: 0; }
.dev-stat-lbl { font-size: 0.74rem; font-weight: 600; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.dev-stat-val { font-size: 1.35rem; font-weight: 800; color: var(--text-heading); margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.dev-stat-val small { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0; }
.dev-stat-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; line-height: 1.35; }
.dev-stat.lleno .dev-stat-val { color: var(--amber-text); }
.dev-lista { display: flex; flex-direction: column; gap: 8px; max-height: min(52vh, 460px); overflow-y: auto; padding-right: 2px; }
.dev-grupo-tit { font-size: 0.74rem; font-weight: 700; color: var(--text-muted); margin: 8px 2px 0; }
.dev-item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: start; border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--bg-surface); }
.dev-item.revocado { background: var(--bg-surface-subtle); }
.dev-item.revocado .dev-ico, .dev-item.revocado .dev-nombre { opacity: 0.6; }
.dev-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-surface-subtle); color: var(--text-body); }
.dev-ico.pos { background: var(--brand-subtle); color: var(--brand-primary); }
.dev-ico.cmd { background: var(--violet-subtle); color: var(--violet-text); }
.dev-cuerpo { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.dev-fila1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dev-nombre { font-size: 0.92rem; font-weight: 700; color: var(--text-heading); overflow-wrap: anywhere; }
.dev-renombrar { border: 0; background: transparent; color: var(--text-muted); padding: 3px; border-radius: 6px; cursor: pointer; display: inline-grid; place-items: center; }
.dev-renombrar:hover { color: var(--text-heading); background: var(--bg-surface-subtle); }
.dev-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.dev-chip.pos { background: var(--brand-subtle); color: var(--brand-primary); border-color: var(--brand-border); }
.dev-chip.cmd { background: var(--violet-subtle); color: var(--violet-text); border-color: var(--violet-border); }
.dev-chip.kds { background: var(--amber-subtle); color: var(--amber-text); border-color: var(--amber-border); }
.dev-chip.online { background: var(--emerald-subtle); color: var(--emerald-text); border-color: var(--emerald-border); }
.dev-chip.inactivo { background: var(--bg-surface-subtle); color: var(--text-muted); border-color: var(--border-light); }
.dev-chip.revocado { background: var(--rose-subtle); color: var(--rose-text); border-color: var(--rose-border); }
.dev-chip i, .dev-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.dev-datos { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.76rem; color: var(--text-muted); }
.dev-datos span { white-space: nowrap; }
.dev-datos b { font-weight: 600; color: var(--text-body); }
.dev-datos code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.74rem; color: var(--text-heading); }
.dev-acciones { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.dev-acciones button { font-size: 0.74rem; padding: 6px 10px; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.dev-acciones .dev-liberar { color: var(--rose-text); }
.dev-acciones .dev-liberar:hover { background: var(--rose-subtle); border-color: var(--rose-border); }
.dev-vacio { padding: 24px; text-align: center; color: var(--text-muted); font-size: 0.84rem; border: 1px dashed var(--border-medium); border-radius: var(--radius-sm); }
.dev-pie { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border-light); }
.dev-pie-nota { font-size: 0.74rem; color: var(--text-muted); }
@media (max-width: 680px) {
  .dev-stats { gap: 6px; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .dev-stat { padding: 8px 10px; }
  .dev-stat-lbl { font-size: 0.68rem; }
  .dev-stat-lbl .ico { display: none; }
  .dev-stat-val { font-size: 1.1rem; }
  .dev-stat-hint { display: none; }
  .dev-item { grid-template-columns: 36px minmax(0, 1fr); }
  .dev-ico { width: 36px; height: 36px; }
  .dev-acciones { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .dev-acciones button { flex: 1; }
}

/* ==================== ESTILOS PULL-TO-REFRESH PARA ADMIN ==================== */
.tga-ptr-indicator {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translate(-50%, -80px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.94);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  opacity: 0;
  pointer-events: none;
  z-index: 100010 !important; /* Siempre sobre el Login Wall (99999) */
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.tga-ptr-indicator.tga-ptr-tracking {
  transition: none;
}

.tga-ptr-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}

.tga-ptr-svg {
  width: 19px;
  height: 19px;
  color: #06b6d4;
  transition: transform 0.05s linear;
}

.tga-ptr-indicator.tga-ptr-ready {
  border-color: rgba(6, 182, 212, 0.7);
  box-shadow: 0 16px 36px rgba(6, 182, 212, 0.4), 0 0 0 1px rgba(6, 182, 212, 0.3);
}

.tga-ptr-indicator.tga-ptr-refreshing .tga-ptr-svg {
  animation: tgaPtrSpin 0.7s linear infinite !important;
}

@keyframes tgaPtrSpin {
  100% { transform: rotate(360deg); }
}

/* ============================================================
   Modales anchos: los formularios largos se ordenan en columnas
   (Editar negocio, Cambiar plan, Nuevo negocio, Ficha de cliente)
   ============================================================ */
.modal-sheet.modal-ancho { --modal-max: 1000px; width: 100%; max-width: min(1000px, calc(100vw - 32px)); }
.modal-sheet.modal-medio { --modal-max: 760px; width: 100%; max-width: min(760px, calc(100vw - 32px)); }
.modal-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.modal-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.modal-bloque { background: var(--bg-surface-subtle); border: 1px solid var(--border-medium); border-radius: var(--radius-md); padding: 16px; }
.modal-bloque .form-group:last-child { margin-bottom: 0; }
.modal-bloque-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.modal-bloque-titulo { margin: 0; font-size: 0.95rem; font-weight: 800; color: var(--text-heading); }
.modal-badge-codigo { font-size: 0.75rem; font-family: var(--font-mono); font-weight: 800; color: var(--text-muted); background: var(--bg-surface); padding: 2px 8px; border-radius: 4px; border: 1px solid var(--border-light); white-space: nowrap; }
.modal-grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.modal-grid-compacto { gap: 8px; }
.modal-ayuda { margin: 8px 0 0; font-size: 0.8rem; color: var(--text-muted); line-height: 1.45; }
.modal-acciones { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-light); }
.input-con-boton { display: flex; gap: 6px; align-items: center; }
.input-con-boton .btn-secondary-slate { padding: 9px 10px; flex-shrink: 0; }
.input-color { width: 44px; height: 40px; flex-shrink: 0; border: 1px solid var(--border-medium); border-radius: var(--radius-sm); cursor: pointer; padding: 2px; background: var(--bg-surface); }
.check-fila { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; color: var(--text-heading); cursor: pointer; margin-top: 8px; }
.check-fila input { width: 16px; height: 16px; flex-shrink: 0; }
.btn-compacto { padding: 6px 10px !important; font-size: 0.78rem !important; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--brand-primary); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.btn-link:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; border-radius: 2px; }

/* Buscador de clientes (propietario del negocio) */
.cli-buscador { position: relative; }
.cli-buscador-lista { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; margin: 0; padding: 4px; list-style: none; max-height: 260px; overflow-y: auto; background: var(--bg-surface); border: 1px solid var(--border-medium); border-radius: var(--radius-md); box-shadow: var(--shadow-modal); }
.cli-buscador-lista li { padding: 8px 10px; border-radius: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.cli-buscador-lista li[aria-selected="true"], .cli-buscador-lista li:hover { background: var(--bg-surface-subtle); }
.cli-op-nombre { font-weight: 700; font-size: 0.86rem; color: var(--text-heading); }
.cli-op-detalle { font-size: 0.76rem; color: var(--text-muted); }
.cli-op-vacio { color: var(--text-muted); font-size: 0.82rem; cursor: default !important; }
.cli-ficha { margin-top: 12px; background: var(--bg-surface); border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: 12px 14px; }
.cli-ficha-nombre { font-weight: 800; color: var(--text-heading); font-size: 0.95rem; margin-bottom: 8px; }
.cli-ficha-datos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.cli-ficha-datos dt { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }
.cli-ficha-datos dd { margin: 2px 0 0; font-size: 0.82rem; color: var(--text-heading); overflow-wrap: anywhere; }
.cli-ficha-acciones { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 860px) {
  .modal-cols, .modal-grid-2, .cli-ficha-datos { grid-template-columns: minmax(0, 1fr); }
}
