/* ========================================================
   zPOS LICENSE STUDIO - DESIGN SYSTEM & STYLESHEET
   Aesthetics: Obsidian Dark / Linear Engineering / Glassmorphism
   ======================================================== */

:root {
  --bg-body: #070a12;
  --bg-surface: #0d1322;
  --bg-card: #111a2e;
  --bg-card-hover: #16223d;
  --bg-glass: rgba(17, 26, 46, 0.75);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #38bdf8;
  --border-active: rgba(99, 102, 241, 0.4);

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-cyan: #38bdf8;
  --accent-indigo: #6366f1;
  --accent-purple: #a855f7;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-subtle);
  --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.25);
}

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

body {
  background-color: var(--bg-body);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(56, 189, 248, 0.1) 0px, transparent 50%);
  background-attachment: fixed;
}

/* UTILIDADES BÁSICAS */
.hidden { display: none !important; }
.flex-1 { flex: 1; }
.flex-row { display: flex; flex-direction: row; }
.items-center { align-items: center; }
.space-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.font-mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mt-3 { margin-top: 0.75rem; }

.gradient-text {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ========================================================
   MODAL DE AUTENTICACIÓN / 2FA
   ======================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 14, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1.5rem;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), var(--shadow-glow);
  overflow: hidden;
  animation: authFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(15px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-header {
  padding: 1.75rem 1.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.auth-brand-wrap {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.auth-logo-img {
  height: 38px;
  width: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(3, 154, 161, 0.4));
}

.auth-divider {
  width: 1px;
  height: 34px;
  background: var(--border-subtle);
}

.auth-logo-badge {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(99, 102, 241, 0.25));
  border: 1px solid rgba(56, 189, 248, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
}

.auth-title-box h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.auth-tag {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.auth-body {
  padding: 1.75rem;
}

.auth-footer {
  padding: 0.9rem 1.5rem;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ALERTAS Y MENSAJES */
.alert-box {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.alert-box.error {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fda4af;
}

/* INPUTS Y FORMULARIOS */
.form-group {
  margin-bottom: 1.15rem;
}

.form-row {
  display: flex;
  gap: 1rem;
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.required {
  color: var(--accent-rose);
}

.label-link {
  float: right;
  font-size: 0.75rem;
  color: var(--accent-cyan);
  cursor: pointer;
  text-transform: none;
  font-weight: 500;
  transition: color 0.15s;
}
.label-link:hover {
  text-decoration: underline;
  color: #fff;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon svg {
  position: absolute;
  left: 0.9rem;
  color: var(--text-dim);
  pointer-events: none;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="url"],
select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.input-with-icon input {
  padding-left: 2.5rem;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
  background: #0f182b;
}

.code-input {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  font-weight: 600;
}

.input-help {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
}

.field-feedback {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
}
.field-feedback.valid {
  color: var(--accent-emerald);
}
.field-feedback.invalid {
  color: var(--accent-rose);
}

/* BOTONES */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-block { width: 100%; }
.btn-lg { padding: 0.85rem 1.4rem; font-size: 0.95rem; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  color: #fff;
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.45);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-subtle);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
}

.btn-whatsapp {
  background: #25d366;
  color: #0b2212;
  font-weight: 700;
}
.btn-whatsapp:hover {
  background: #20bd5a;
  transform: translateY(-1px);
}

.btn-danger-outline {
  background: transparent;
  border-color: rgba(244, 63, 94, 0.35);
  color: #fda4af;
}
.btn-danger-outline:hover {
  background: rgba(244, 63, 94, 0.15);
  border-color: var(--accent-rose);
}

/* SETUP TOTP SECTION */
.setup-totp-card {
  text-align: center;
}

.setup-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
}

.setup-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.qr-container {
  background: #fff;
  padding: 0.75rem;
  border-radius: var(--radius-lg);
  display: inline-block;
  margin: 0 auto 1rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.qr-container img {
  display: block;
  width: 220px;
  height: 220px;
}

.secret-manual-box {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.8rem;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}
.secret-label { color: var(--text-dim); }
.secret-manual-box code { color: var(--accent-cyan); font-family: var(--font-mono); font-weight: 600; }

/* ========================================================
   APLICACIÓN PRINCIPAL / HEADER & TABS
   ======================================================== */
.studio-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.studio-header {
  height: 64px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 2.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.95rem;
}

.brand-logo-wrap {
  display: flex;
  align-items: center;
}

.brand-logo-img {
  height: 28px;
  width: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 1px 6px rgba(3, 154, 161, 0.4));
}

.brand-divider {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.35);
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.nav-tabs {
  display: flex;
  gap: 0.4rem;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.nav-tab.active {
  color: #fff;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.security-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 0.35rem 0.7rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  color: #6ee7b7;
  font-weight: 600;
}

.indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.indicator-dot.online {
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

/* ========================================================
   MAIN CONTENT & CARDS
   ======================================================== */
.studio-main {
  flex: 1;
  padding: 2rem;
  max-width: 1540px;
  width: 100%;
  margin: 0 auto;
}

.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
  animation: tabFadeIn 0.25s ease;
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.pane-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.25fr;
  gap: 1.75rem;
  align-items: start;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: rgba(255, 255, 255, 0.015);
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.card-header p {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
}

.card-header-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-header-icon.accent-purple { background: rgba(168, 85, 247, 0.12); color: var(--accent-purple); }
.card-header-icon.accent-green { background: rgba(16, 185, 129, 0.12); color: var(--accent-emerald); }
.card-header-icon.accent-indigo { background: rgba(99, 102, 241, 0.12); color: var(--accent-indigo); }
.card-header-icon.accent-cyan { background: rgba(6, 182, 212, 0.12); color: #22d3ee; }

.card-body {
  padding: 1.5rem;
}

/* SWITCH CARD & TOGGLES */
.form-check-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

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

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

.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: 0.25s;
  border-radius: 9999px;
}

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

input:checked + .switch-slider {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
}

input:checked + .switch-slider:before {
  transform: translateX(20px);
}

.switch-label-box {
  display: flex;
  flex-direction: column;
}

.switch-label-box strong {
  font-size: 0.85rem;
  color: var(--text-main);
}

.switch-label-box span {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ========================================================
   MÓDULOS GRID Y PRESETS
   ======================================================== */
.modules-presets {
  padding: 0.85rem 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.presets-title {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
  margin-right: 0.25rem;
}

.preset-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.preset-pill.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.5);
  color: #fff;
}

.modules-grid {
  padding: 1.25rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  max-height: 520px;
  overflow-y: auto;
}

.module-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.module-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
}

.module-card.enabled {
  background: rgba(56, 189, 248, 0.05);
  border-color: rgba(56, 189, 248, 0.35);
}

.module-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}

.module-info {
  flex: 1;
}

.module-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

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

.module-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-weight: 600;
}

.module-desc {
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.35;
}

/* ========================================================
   RESULT CARD (LICENCIA EMITIDA)
   ======================================================== */
.result-card {
  margin-top: 1.75rem;
  border-color: rgba(16, 185, 129, 0.4);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.05) 0%, var(--bg-card) 40%);
  animation: resultPop 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes resultPop {
  from { opacity: 0; transform: scale(0.98) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.result-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.result-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--accent-emerald);
  font-weight: 700;
  font-size: 1.05rem;
}

.badge {
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
}
.badge-date {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
}

.result-body {
  padding: 1.5rem;
}

.key-box {
  background: #060911;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.key-label-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.copy-alert {
  color: var(--accent-emerald);
  font-weight: 700;
  animation: fadeIn 0.2s;
}

.key-pre {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent-cyan);
  white-space: pre-wrap;
  word-break: break-all;
  user-select: all;
  line-height: 1.45;
}

.result-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ========================================================
   KPI CARDS & TABLES (HISTORIAL & CLOUD)
   ======================================================== */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.metric-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  margin: 0.25rem 0;
}

.metric-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.text-success { color: var(--accent-emerald); }
.text-indigo { color: #818cf8; }
.text-cyan { color: var(--accent-cyan); }

.search-input-box {
  position: relative;
  width: 320px;
}
.search-input-box svg {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
}
.search-input-box input {
  padding-left: 2.3rem;
  font-size: 0.82rem;
}

.table-responsive {
  overflow-x: auto;
}

.studio-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.studio-table th {
  background: rgba(0, 0, 0, 0.25);
  padding: 0.85rem 1.25rem;
  text-align: left;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
}

.studio-table td {
  padding: 0.95rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

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

.table-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}

.cloud-info-box {
  padding: 0.9rem 1.5rem;
  background: rgba(6, 182, 212, 0.05);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cloud-pill {
  font-size: 0.75rem;
  font-weight: 700;
  color: #22d3ee;
  background: rgba(6, 182, 212, 0.15);
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
}

/* ========================================================
   BARRA DE FILTROS & TELEMETRÍA EN NUBE
   ======================================================== */
.cloud-toolbar {
  padding: 0.9rem 1.5rem;
  background: rgba(15, 23, 42, 0.45);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.status-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
}

.filter-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.filter-pill.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.filter-pill.status-active.active {
  background: rgba(34, 197, 94, 0.18);
  border-color: #22c55e;
  color: #4ade80;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.25);
}

.filter-pill.status-revoked.active {
  background: rgba(244, 63, 94, 0.18);
  border-color: #f43f5e;
  color: #fb7185;
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.25);
}

.cloud-summary-badge {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 500;
}

/* ========================================================
   MODALES CUSTOM DE ALTA ESTÉTICA (DIALOGS & KILL SWITCH)
   ======================================================== */
.custom-dialog-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 35px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: authFadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.killswitch-modal-card {
  max-width: 540px;
  border-color: rgba(244, 63, 94, 0.35);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9), 0 0 30px rgba(244, 63, 94, 0.2);
}

.custom-dialog-header {
  padding: 1.5rem 1.5rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.custom-dialog-header.destructive {
  background: linear-gradient(180deg, rgba(244, 63, 94, 0.08), transparent);
  border-bottom-color: rgba(244, 63, 94, 0.2);
}

.custom-dialog-header h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
}

.custom-dialog-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dialog-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dialog-icon-badge.danger {
  background: rgba(244, 63, 94, 0.18);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #f43f5e;
  box-shadow: 0 0 15px rgba(244, 63, 94, 0.25);
}

.dialog-icon-badge.success {
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #22c55e;
}

.dialog-icon-badge.info {
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.dialog-icon-badge.warning {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #f59e0b;
}

.custom-dialog-body {
  padding: 1.5rem;
}

.dlg-message-text {
  font-size: 0.92rem;
  color: #e2e8f0;
  line-height: 1.5;
  white-space: pre-wrap;
}

.target-terminal-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.target-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.target-field .label {
  color: var(--text-dim);
}

.callout-danger {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #fecdd3;
}

.callout-danger strong {
  color: #ff6b81;
}

.custom-dialog-footer {
  padding: 1rem 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.btn-danger-solid {
  background: linear-gradient(135deg, #e11d48, #be123c);
  color: #fff;
  border: 1px solid rgba(244, 63, 94, 0.5);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px rgba(225, 29, 72, 0.35);
  transition: all 0.2s ease;
}

.btn-danger-solid:hover {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  box-shadow: 0 6px 20px rgba(244, 63, 94, 0.5);
  transform: translateY(-1px);
}

.btn-danger-solid:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.activate-modal-card {
  max-width: 520px;
  border-color: rgba(34, 197, 94, 0.35);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9), 0 0 30px rgba(34, 197, 94, 0.2);
}

.custom-dialog-header.success {
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.08), transparent);
  border-bottom-color: rgba(34, 197, 94, 0.2);
}

.btn-success-solid {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  border: 1px solid rgba(34, 197, 94, 0.5);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px rgba(22, 163, 74, 0.35);
  transition: all 0.2s ease;
}

.btn-success-solid:hover {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
  transform: translateY(-1px);
}

.btn-success-solid:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-success-outline {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #4ade80;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-success-outline:hover {
  background: rgba(34, 197, 94, 0.22);
  border-color: #22c55e;
  color: #fff;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

/* ========================================================
   BARRA DE ACCIONES MASIVAS EN LOTE (BULK TOOLBAR)
   ======================================================== */
.cloud-bulk-bar {
  background: linear-gradient(90deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
  border-bottom: 1px solid rgba(56, 189, 248, 0.35);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  animation: authFadeIn 0.2s ease;
}

.bulk-count-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.bulk-badge {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
}

.btn-link-action {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0 0.2rem;
  transition: color 0.15s ease;
}

.btn-link-action:hover {
  color: #38bdf8;
}

.bulk-buttons-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-success-sm {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  border: 1px solid rgba(34, 197, 94, 0.5);
  padding: 0.42rem 0.95rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(22, 163, 74, 0.25);
}

.btn-success-sm:hover {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.4);
}

.btn-danger-solid-sm {
  background: linear-gradient(135deg, #e11d48, #be123c);
  color: #fff;
  border: 1px solid rgba(244, 63, 94, 0.5);
  padding: 0.42rem 0.95rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(225, 29, 72, 0.25);
}

.btn-danger-solid-sm:hover {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.4);
}

.btn-xs {
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
}

/* ========================================================
   TOAST NOTIFICATIONS FLOTANTES
   ======================================================== */
.toast-container {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 10000;
  pointer-events: none;
}

.toast-notification {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), 0 0 15px rgba(56, 189, 248, 0.15);
  animation: toastSlideIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 280px;
  max-width: 420px;
}

.toast-notification.success {
  border-color: rgba(34, 197, 94, 0.35);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), 0 0 15px rgba(34, 197, 94, 0.2);
}

.toast-notification.danger {
  border-color: rgba(244, 63, 94, 0.35);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), 0 0 15px rgba(244, 63, 94, 0.2);
}

.toast-notification.toast-out {
  animation: toastFadeOut 0.25s forwards;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastFadeOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(10px) scale(0.95); }
}


.security-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.crypto-meta-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.crypto-meta-item {
  display: flex;
  justify-content: space-between;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
}
.crypto-meta-item .label { color: var(--text-dim); }

/* ========================================================
   MODAL DE CERTIFICADO A4 FORMAL
   ======================================================== */
.cert-modal-card {
  background: #ffffff;
  color: #0f172a;
  border-radius: var(--radius-lg);
  max-width: 860px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.cert-modal-header {
  background: #0f172a;
  color: #f8fafc;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cert-sheet {
  padding: 2.5rem 3rem;
  overflow-y: auto;
  font-family: var(--font-sans);
  background: #ffffff;
  color: #111827;
  line-height: 1.4;
}

/* ESTILO FORMAL A4 (REGLA DE REPORTES CONTABLES) */
.cert-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 2px solid #0f172a;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.cert-company h1 {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #0f172a;
}
.cert-company p {
  font-size: 0.8rem;
  color: #475569;
}

.cert-title-badge {
  text-align: right;
}
.cert-title-badge h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #0f172a;
  text-transform: uppercase;
}
.cert-folio {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: #2563eb;
}

.cert-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
}

.cert-meta-col strong {
  color: #334155;
  display: inline-block;
  width: 140px;
}

.cert-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.8rem;
}
.cert-table th {
  background: #f1f5f9;
  border-top: 1px solid #0f172a;
  border-bottom: 1px solid #0f172a;
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-weight: 700;
  color: #0f172a;
}
.cert-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}

.cert-key-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
}
.cert-key-box span {
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  display: block;
  margin-bottom: 0.35rem;
}
.cert-key-box code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #0f172a;
  word-break: break-all;
}

.cert-instructions {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: #166534;
  margin-bottom: 2rem;
}
.cert-instructions ol {
  margin-left: 1.2rem;
  margin-top: 0.35rem;
}

.cert-signatures {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3rem;
  margin-top: 3rem;
  text-align: center;
}
.signature-line {
  border-top: 1px solid #94a3b8;
  padding-top: 0.5rem;
  font-size: 0.8rem;
  color: #475569;
}
.signature-title {
  font-weight: 700;
  color: #0f172a;
}

/* ========================================================
   ESTILOS DE IMPRESIÓN (PRINT MEDIA)
   ======================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 10mm 12mm 12mm 12mm;
  }
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
    overflow: visible !important;
    height: auto !important;
  }
  .modal-backdrop {
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
    display: block !important;
  }
  .studio-app,
  .no-print,
  #authModal,
  #customDialogModal,
  #killSwitchModal,
  #activateModal,
  #toastContainer {
    display: none !important;
  }
  #certModal {
    display: block !important;
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .cert-modal-card {
    max-width: 100% !important;
    max-height: none !important;
    height: auto !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .cert-sheet {
    padding: 0 !important;
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
  }
  thead {
    display: table-header-group !important;
  }
  tr {
    page-break-inside: avoid !important;
  }
}
