/* =========================================================
   ENS Adecuación Tool · Efika
   Colores corporativos Efika:
   Primary:   #487492  (azul pizarra - logo)
   Secondary: #5EBFBC  (teal - botones/icono)
   Accent:    #00ABD7  (azul brillante)
   Orange:    #E05A28  (naranja logo)
   Light:     #D7DFE5  (azul gris claro)
   ========================================================= */

:root {
  --primary:      #487492;
  --primary-dark: #3a5e78;
  --primary-light:#6090b0;
  --secondary:    #5EBFBC;
  --secondary-dk: #4aa8a5;
  --accent:       #00ABD7;
  --orange:       #E05A28;
  --tan:          #C4B87A;
  --light:        #D7DFE5;
  --lighter:      #EBF0F4;
  --dark:         #1e2d3a;
  --text:         #2c3e50;
  --text-muted:   #6c7a89;
  --white:        #ffffff;
  --border:       #cfd8e0;
  --success:      #27ae60;
  --warning:      #f39c12;
  --danger:       #e74c3c;
  --info:         #3498db;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow:       0 2px 8px rgba(0,0,0,0.10);
  --shadow-lg:    0 4px 20px rgba(0,0,0,0.15);
  --header-h:     64px;
  --sidebar-w:    250px;
  --transition:   0.2s ease;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--lighter);
  line-height: 1.5;
}

/* ── HEADER ─────────────────────────────────────────────── */
:root { --header-h: 70px; }
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--dark);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.header-left { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.logo-text {
  font-size: 22px;
  font-weight: 700;
  color: var(--secondary);
  letter-spacing: -0.5px;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 1px solid rgba(255,255,255,0.15);
  padding-left: 16px;
}
.header-badge { font-size: 20px; }
.header-title h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--white);
  line-height: 1.2;
}
.header-subtitle {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  display: block;
}

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

.project-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  margin-right: 6px;
}
.project-label { color: rgba(255,255,255,0.45); }
.project-name, .project-client {
  color: var(--secondary);
  font-weight: 500;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--secondary);
  color: var(--white);
}
.btn-primary:hover { background: var(--secondary-dk); transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.85);
}
.btn-outline:hover { border-color: var(--secondary); color: var(--secondary); }

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--lighter); }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #219150; }
.btn-danger  { background: var(--danger);  color: var(--white); }
.btn-warning { background: var(--warning); color: var(--white); }

/* ── LAYOUT ──────────────────────────────────────────────── */
.layout {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  overflow-y: auto;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-section { display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px; }

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 8px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  text-align: left;
  transition: all var(--transition);
  position: relative;
}
.nav-item:hover { background: var(--lighter); color: var(--primary); }
.nav-item.active {
  background: var(--primary);
  color: var(--white);
  font-weight: 600;
}
.nav-item.active .nav-badge { background: rgba(255,255,255,0.3); color: var(--white); }

.nav-icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--lighter);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 28px;
  text-align: center;
}
.nav-badge.done { background: var(--success); color: var(--white); }
.nav-badge.partial { background: var(--warning); color: var(--white); }

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.sidebar-filter select {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text);
  background: var(--white);
}

/* ── MAIN CONTENT ────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 24px;
  min-width: 0;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}
.page-header-title h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--dark);
}
.page-header-title p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── DASHBOARD ───────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  text-align: center;
}
.stat-card .stat-icon { font-size: 28px; margin-bottom: 8px; }
.stat-card .stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.stat-card.highlight { background: var(--primary); border-color: var(--primary); }
.stat-card.highlight .stat-value, .stat-card.highlight .stat-label { color: var(--white); }

.progress-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}
.progress-section h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 16px;
}

.global-progress {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.global-progress-bar {
  flex: 1;
  height: 14px;
  background: var(--lighter);
  border-radius: 7px;
  overflow: hidden;
}
.global-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary), var(--accent));
  border-radius: 7px;
  transition: width 0.5s ease;
}
.global-progress-pct {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  min-width: 50px;
  text-align: right;
}

.category-progress-list { display: flex; flex-direction: column; gap: 10px; }
.category-progress-item {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cat-label {
  width: 180px;
  font-size: 13px;
  color: var(--text);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-bar {
  flex: 1;
  height: 8px;
  background: var(--lighter);
  border-radius: 4px;
  overflow: hidden;
}
.cat-bar-fill {
  height: 100%;
  background: var(--secondary);
  border-radius: 4px;
  transition: width 0.4s ease;
}
.cat-pct {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 40px;
  text-align: right;
}

/* ── CONTROL CARDS ───────────────────────────────────────── */
.controls-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.controls-count {
  font-size: 13px;
  color: var(--text-muted);
}

.controls-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.control-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.control-card:hover { box-shadow: var(--shadow-lg); }
.control-card.completed { border-left: 4px solid var(--success); }
.control-card.partial   { border-left: 4px solid var(--warning); }
.control-card.pending   { border-left: 4px solid var(--border); }

.control-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 12px;
  cursor: pointer;
  user-select: none;
}
.control-card-header:hover { background: var(--lighter); }

.control-id {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: var(--lighter);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  font-family: monospace;
}

.control-title { flex: 1; }
.control-title h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--dark);
}
.control-title p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.control-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.level-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.level-basico { background: #e3f6f5; color: #2b8a85; }
.level-medio  { background: #fff3e0; color: #e65c00; }
.level-alto   { background: #fce4ec; color: #c62828; }

.control-progress-ring {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
.ring-bg   { fill: none; stroke: var(--lighter); stroke-width: 4; }
.ring-fill {
  fill: none;
  stroke: var(--secondary);
  stroke-width: 4;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 0.4s ease;
}
.ring-text {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
}

.control-expand { font-size: 12px; color: var(--text-muted); transition: transform var(--transition); }
.control-card.expanded .control-expand { transform: rotate(180deg); }

.control-card-body {
  display: none;
  padding: 0 20px 20px;
  border-top: 1px solid var(--lighter);
}
.control-card.expanded .control-card-body { display: block; }

.control-description {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  padding: 12px 0;
  border-bottom: 1px solid var(--lighter);
}

.control-notes {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #fff8e1;
  border-radius: var(--radius);
  border: 1px solid #ffe082;
  margin: 12px 0;
  font-size: 12px;
  color: #6d4c00;
}
.control-notes::before { content: '💡'; flex-shrink: 0; }

/* Checklist */
.checklist { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  transition: all var(--transition);
}
.checklist-item:hover { border-color: var(--secondary); background: var(--lighter); }
.checklist-item.checked {
  background: #f0faf9;
  border-color: var(--success);
}

.checklist-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  cursor: pointer;
  accent-color: var(--secondary);
  flex-shrink: 0;
}

.checklist-text {
  font-size: 13px;
  color: var(--text);
  flex: 1;
  line-height: 1.4;
}
.checklist-item.checked .checklist-text {
  color: var(--text-muted);
  text-decoration: line-through;
}

/* Scripts section */
.scripts-section { margin-top: 16px; }
.scripts-section h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.scripts-list { display: flex; flex-direction: column; gap: 8px; }

.script-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--lighter);
}

.script-target {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.target-m365    { background: #e3f2fd; color: #1565c0; }
.target-dominio { background: #e8f5e9; color: #2e7d32; }
.target-equipos { background: #fce4ec; color: #b71c1c; }

.script-info { flex: 1; }
.script-info strong { font-size: 13px; color: var(--dark); display: block; }
.script-info span   { font-size: 11px; color: var(--text-muted); }

.script-actions { display: flex; gap: 6px; }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-large { max-width: 860px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 18px; font-weight: 700; color: var(--dark); }
.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--lighter); color: var(--danger); }

.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  transition: border-color var(--transition);
  font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(94,191,188,0.15);
}
.form-group textarea { resize: vertical; }

/* Script viewer */
.script-description {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.script-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.script-viewer {
  background: #1e2d3a;
  color: #d4e6f1;
  padding: 16px;
  border-radius: var(--radius);
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  max-height: 460px;
  overflow-y: auto;
  white-space: pre;
}
.target-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 4px;
}

/* ── TOAST NOTIFICATIONS ─────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  min-width: 280px;
  max-width: 400px;
  animation: slideInRight 0.3s ease;
}
.toast-success { background: var(--success); color: var(--white); }
.toast-error   { background: var(--danger);  color: var(--white); }
.toast-info    { background: var(--primary); color: var(--white); }
.toast-warning { background: var(--warning); color: var(--white); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}

/* ── LOADING ─────────────────────────────────────────────── */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 16px;
  color: var(--text-muted);
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--lighter);
  border-top-color: var(--secondary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; color: var(--text); margin-bottom: 8px; }

/* ── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 1100px) {
  .header { grid-template-columns: auto 1fr auto; }
  .project-selector-bar { gap: 6px; }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 210px; }
  .project-selector-bar .btn-sm { padding: 4px 8px; font-size: 11px; }
}
@media (max-width: 640px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .project-selector-bar { display: none; }
}

/* ══════════════════════════════════════════════════════════
   v2 STYLES — MULTI-PROJECT, SCRIPTS, INFRA TOGGLE
   ══════════════════════════════════════════════════════════ */

/* ── PROJECT SELECTOR BAR ────────────────────────────────── */
.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.project-selector-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 6px 12px;
  min-width: 0;
  max-width: 640px;
  width: 100%;
}

.project-selector-label {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.project-select-wrap {
  flex: 1;
  min-width: 0;
}

.project-select-wrap select,
#projectSelect {
  width: 100%;
  padding: 5px 10px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 6px;
  color: var(--white);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  min-width: 0;
}
#projectSelect:focus {
  outline: none;
  border-color: var(--secondary);
  background: rgba(255,255,255,0.15);
}
#projectSelect option { background: var(--dark); color: var(--white); }

/* Buttons in header */
.header-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* Smaller btn-sm in dark header */
.header .btn-outline {
  border-color: rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.85);
}
.header .btn-outline:hover { border-color: var(--secondary); color: var(--secondary); }
.header .btn-primary { background: var(--secondary); color: var(--white); }
.header .btn-primary:disabled {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.35);
  cursor: not-allowed;
}
.header .btn-outline:disabled {
  color: rgba(255,255,255,0.3);
  border-color: rgba(255,255,255,0.1);
  cursor: not-allowed;
}
.btn-danger { background: var(--danger); color: var(--white); border: none; }
.btn-danger:hover { background: #c0392b; }
.btn-danger-outline { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-danger-outline:hover { background: var(--danger); color: var(--white); }

/* ── INFRA TOGGLE ────────────────────────────────────────── */
.infra-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}
.infra-toggle-sm { gap: 8px; }

.infra-option { cursor: pointer; }
.infra-option input[type="radio"] { display: none; }

.infra-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  transition: all var(--transition);
  text-align: center;
}
.infra-card:hover { border-color: var(--secondary); }
.infra-option input[type="radio"]:checked + .infra-card {
  border-color: var(--secondary);
  background: #f0faf9;
  box-shadow: 0 0 0 3px rgba(94,191,188,0.2);
}

.infra-icon { font-size: 24px; }
.infra-card strong { font-size: 13px; color: var(--dark); }
.infra-card small { font-size: 11px; color: var(--text-muted); line-height: 1.4; }

.infra-toggle-sm .infra-card { padding: 10px 8px; }
.infra-toggle-sm .infra-icon { font-size: 18px; }
.infra-toggle-sm .infra-card strong { font-size: 12px; }
.infra-toggle-sm .infra-card small { display: none; }

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.4;
}

/* ── FORM LAYOUT ─────────────────────────────────────────── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-group-wide { grid-column: 1 / -1; }

/* ── EMPTY STATE (improved) ──────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 32px;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}
.empty-icon { font-size: 56px; margin-bottom: 16px; }
.empty-state h2 { font-size: 22px; color: var(--dark); margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.empty-actions { margin-bottom: 32px; }
.empty-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  text-align: left;
}
.empty-feature {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text);
}
.empty-feature span { font-size: 16px; }

/* ── DASHBOARD v2 ────────────────────────────────────────── */
.dashboard { max-width: 1000px; }
.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.dashboard-header h2 { font-size: 22px; font-weight: 700; color: var(--dark); }
.dashboard-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.dashboard-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.infra-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  background: #e8eaf6;
  color: #3949ab;
  border-radius: 4px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}
.stat-card.stat-global { grid-column: span 1; background: var(--primary); border-color: var(--primary); }
.stat-card.stat-global .stat-value { color: var(--white); }
.stat-card.stat-global .stat-label { color: rgba(255,255,255,0.7); }
.stat-card.stat-controls { flex-direction: column; text-align: center; gap: 4px; justify-content: center; }
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.stat-number { font-size: 36px; font-weight: 800; color: var(--primary); line-height: 1; }
.stat-sub { font-size: 11px; color: var(--text-muted); }

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.category-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow);
}
.category-card:hover { border-color: var(--secondary); box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.category-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.category-name { font-size: 12px; font-weight: 600; color: var(--dark); }
.category-pct { font-size: 13px; font-weight: 700; color: var(--text-muted); }
.category-pct.pct-done { color: var(--success); }
.category-pct.pct-partial { color: var(--warning); }
.category-bar-wrap { height: 6px; background: var(--lighter); border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.category-bar { height: 100%; background: linear-gradient(90deg, var(--secondary), var(--accent)); border-radius: 3px; transition: width 0.4s ease; }
.category-count { font-size: 11px; color: var(--text-muted); }

/* ── CATEGORY VIEW ───────────────────────────────────────── */
.category-view { max-width: 900px; }
.category-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--lighter);
}
.category-view-header h2 { font-size: 22px; font-weight: 700; color: var(--dark); }
.cat-progress-text { font-size: 13px; color: var(--text-muted); }
.cat-header-ring { flex-shrink: 0; }
.no-controls-msg { color: var(--text-muted); font-size: 14px; padding: 32px; text-align: center; }

/* ── CONTROL CARD v2 ─────────────────────────────────────── */
.control-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 14px;
  transition: box-shadow var(--transition);
}
.control-card:hover { box-shadow: var(--shadow-lg); }
.control-card.completed { border-left-color: var(--success); }
.control-card.partial   { border-left-color: var(--warning); }
.control-card.pending   { border-left-color: var(--border); }

.control-card-header {
  padding: 16px 20px;
}
.control-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}
.control-card-title-row > div { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.control-name { font-size: 16px; font-weight: 700; color: var(--dark); margin-bottom: 4px; }
.control-description { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

.status-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}
.status-completed { background: #e8f5e9; color: var(--success); }
.status-partial   { background: #fff3e0; color: #e65c00; }
.status-pending   { background: var(--lighter); color: var(--text-muted); }

.ring-pct {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 9px;
  font-weight: 700;
  color: var(--text);
}

/* Checklist items (updated) */
.checklist { padding: 4px 20px 8px; display: flex; flex-direction: column; gap: 6px; }
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  transition: all var(--transition);
}
.checklist-item:hover { border-color: var(--secondary); background: #f7fffe; }
.checklist-item.completed { background: #f0faf9; border-color: #a8d8d6; }
.checklist-item.completed .checklist-text { color: var(--text-muted); text-decoration: line-through; }
.checkmark { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.checklist-text { font-size: 13px; color: var(--text); line-height: 1.4; }

/* ── SCRIPTS SECTION v2 ──────────────────────────────────── */
.scripts-section {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--lighter);
  margin-top: 4px;
}
.scripts-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.script-card {
  background: var(--lighter);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  transition: border-color var(--transition);
}
.script-card:hover { border-color: var(--secondary); }
.script-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 4px;
  gap: 8px;
  flex-wrap: wrap;
}
.script-card-info { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.script-name { font-size: 13px; font-weight: 600; color: var(--dark); }
.script-filename {
  font-size: 10px;
  font-family: monospace;
  color: var(--text-muted);
  background: rgba(0,0,0,0.06);
  padding: 2px 6px;
  border-radius: 3px;
}
.script-desc { font-size: 12px; color: var(--text-muted); margin: 4px 0 8px; line-height: 1.4; }
.script-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Target badges */
.target-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}
.target-m365      { background: #e3f2fd; color: #1565c0; }
.target-dominio   { background: #e8f5e9; color: #2e7d32; }
.target-equipos   { background: #fce4ec; color: #b71c1c; }
.target-workgroup { background: #f3e5f5; color: #6a1b9a; }

/* Custom / variant badges */
.script-custom-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: #fff9c4;
  color: #795548;
  border: 1px solid #ffe082;
}
.variant-available-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: #e8eaf6;
  color: #3949ab;
}

/* Notes */
.control-notes {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 14px;
  margin: 0 20px 16px;
  background: #fff8e1;
  border-radius: var(--radius);
  border: 1px solid #ffe082;
  font-size: 12px;
  color: #6d4c00;
  line-height: 1.5;
}
.notes-icon { flex-shrink: 0; }

/* ── SCRIPT MODAL v2 ─────────────────────────────────────── */
.modal-xlarge { max-width: 1000px; width: 95vw; }
.modal-sm { max-width: 420px; }
.modal-body-editor { padding: 12px 20px 16px; }

.script-modal-header-info { flex: 1; }
.script-modal-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.custom-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: #fff9c4;
  color: #795548;
  border: 1px solid #ffe082;
}
.filename-badge {
  font-size: 11px;
  font-family: monospace;
  color: var(--text-muted);
  background: var(--lighter);
  padding: 2px 8px;
  border-radius: 4px;
}

/* Variant tabs */
.script-variant-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  padding: 0 20px;
  background: var(--lighter);
}
.variant-tab {
  padding: 8px 18px;
  border: none;
  border-bottom: 3px solid transparent;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: -2px;
}
.variant-tab:hover { color: var(--primary); }
.variant-tab.active { color: var(--primary); border-bottom-color: var(--secondary); font-weight: 700; }

/* Script toolbar */
.script-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.script-toolbar-left, .script-toolbar-right { display: flex; gap: 6px; flex-wrap: wrap; }

/* Script editor area */
.script-editor-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.script-viewer {
  background: #1e2d3a;
  color: #d4e6f1;
  padding: 16px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.7;
  overflow: auto;
  max-height: 500px;
  white-space: pre;
  margin: 0;
}
.script-editor {
  width: 100%;
  min-height: 420px;
  max-height: 500px;
  background: #1e2d3a;
  color: #d4e6f1;
  padding: 16px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.7;
  border: none;
  resize: vertical;
  outline: none;
}
.script-editor:focus { box-shadow: inset 0 0 0 2px var(--secondary); }

/* Script description in modal */
.script-description {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding: 8px 12px;
  background: var(--lighter);
  border-radius: var(--radius);
  line-height: 1.4;
}

/* Buttons in content area */
.btn-outline.btn-sm {
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline.btn-sm:hover { border-color: var(--secondary); color: var(--primary); }

/* ── NAV BADGE COLORS ────────────────────────────────────── */
.nav-badge-done    { background: var(--success); color: var(--white); }
.nav-badge-partial { background: var(--warning); color: var(--white); }

/* ── TEXT HELPERS ────────────────────────────────────────── */
.text-danger { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* ── ERROR STATE ─────────────────────────────────────────── */
.error-state {
  text-align: center;
  padding: 60px 32px;
}
.error-state h2 { font-size: 20px; color: var(--danger); margin-bottom: 12px; }
.error-state p { color: var(--text-muted); margin-bottom: 20px; }

/* =========================================================
   AUTENTICACIÓN — Pantalla de Login
   ========================================================= */

.login-screen {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e2d3d 0%, #2c4256 50%, #1e2d3d 100%);
  background-size: 200% 200%;
}

.login-card {
  background: #fff; border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);
  padding: 48px 40px 40px;
  width: 100%; max-width: 400px;
  text-align: center;
}

.login-logo {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-bottom: 20px;
}
.login-brand {
  font-size: 22px; font-weight: 700; color: #487492;
  letter-spacing: -0.5px;
}
.login-title {
  font-size: 20px; font-weight: 700; color: var(--text-primary);
  margin: 0 0 4px;
}
.login-subtitle {
  font-size: 12px; color: var(--text-muted); margin: 0 0 28px;
}
.login-form { text-align: left; }
.login-form .form-group { margin-bottom: 16px; }
.login-form .form-group label {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; display: block;
  margin-bottom: 5px;
}
.login-form input[type=text],
.login-form input[type=password] {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; background: var(--bg-light);
  transition: border-color .2s, box-shadow .2s;
  box-sizing: border-box;
}
.login-form input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(94,191,188,.2);
}
.login-error {
  background: #fdecea; color: #c62828; border: 1px solid #ef9a9a;
  border-radius: 8px; padding: 8px 12px; font-size: 13px;
  margin-bottom: 12px;
}
.btn-block {
  width: 100%; padding: 11px; font-size: 15px;
  margin-top: 4px; border-radius: 8px;
}

/* ── USER PILL (header) ─────────────────────────────────── */
.header-sep {
  width: 1px; height: 24px; background: rgba(255,255,255,.2);
  align-self: center; margin: 0 4px;
}
.user-pill {
  position: relative; display: flex; align-items: center; gap: 8px;
  cursor: pointer; padding: 4px 10px 4px 6px;
  border-radius: 20px; border: 1px solid rgba(255,255,255,.2);
  transition: background .15s;
}
.user-pill:hover { background: rgba(255,255,255,.1); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--secondary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.user-name {
  font-size: 13px; color: rgba(255,255,255,.9); font-weight: 500;
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-menu {
  display: none; position: absolute; top: calc(100% + 6px); right: 0;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15); min-width: 180px;
  padding: 6px; z-index: 9999;
}
.user-pill.open .user-menu { display: block; }
.user-menu button {
  width: 100%; text-align: left; padding: 9px 12px;
  background: none; border: none; border-radius: 7px;
  font-size: 13px; cursor: pointer; color: var(--text-primary);
  transition: background .15s;
}
.user-menu button:hover { background: var(--bg-light); }

/* ── USUARIO MODAL ─────────────────────────────────────── */
.modal-users { max-width: 700px; }

.users-section { margin-bottom: 28px; }
.users-section h3 {
  font-size: 14px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
  margin: 0 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}

.users-list { display: flex; flex-direction: column; gap: 8px; }
.user-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-light); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px;
}
.user-row-info {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.user-row-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--secondary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.user-row-username { font-size: 12px; color: var(--text-muted); }
.user-row-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.role-badge {
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 10px;
}
.role-badge.role-admin { background: #fff3cd; color: #8a6900; }
.role-badge.role-user  { background: #e8f4fd; color: #1565c0; }

.projects-badge {
  font-size: 11px; background: #e8f5e9; color: #2e7d32;
  padding: 2px 8px; border-radius: 10px; font-weight: 500;
}
.current-user-tag {
  font-size: 11px; color: var(--text-muted); padding: 0 4px;
}

.project-checkbox-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 180px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; background: var(--bg-light);
}
.project-checkbox-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; cursor: pointer; padding: 3px 0;
}
.project-checkbox-item input[type=checkbox] {
  width: 15px; height: 15px; cursor: pointer; flex-shrink: 0;
}

.alert-warning {
  background: #fff3cd; border: 1px solid #ffc107;
  border-radius: 8px; padding: 10px 14px; font-size: 13px;
  color: #8a6900; margin-bottom: 16px;
}

.input-readonly {
  background: #f5f5f5 !important; cursor: default !important;
  color: var(--text-muted) !important;
}

.loading-text { color: var(--text-muted); font-size: 13px; padding: 8px 0; }
.label-optional { font-weight: 400; font-size: 11px; color: var(--text-muted); }
.text-danger { color: var(--danger); }


/* ═══════════════════════════════════════════════════════════
   INVENTARIO DE EQUIPOS
   ═══════════════════════════════════════════════════════════ */

.nav-separator {
  height: 1px; background: rgba(255,255,255,.15);
  margin: 8px 12px;
}

.computers-view { padding: 0; }

.computers-toolbar {
  display: flex; gap: 8px; align-items: center;
  padding: 16px 20px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.computers-toolbar .toolbar-title {
  font-size: 16px; font-weight: 600; color: var(--text);
  margin-right: auto;
}

.computers-table-wrap {
  padding: 16px 20px; overflow-x: auto;
}

.computers-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}

.computers-table th {
  text-align: left; padding: 10px 12px;
  background: var(--bg); border-bottom: 2px solid var(--border);
  font-weight: 600; color: var(--text-muted); white-space: nowrap;
}

.computers-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.computers-table tr:hover td { background: var(--bg); }

.computer-name-cell { font-weight: 600; color: var(--text); }
.computer-meta { font-size: 11px; color: var(--text-muted); }

/* Progress bar */
.comp-progress-wrap {
  display: flex; align-items: center; gap: 8px; min-width: 120px;
}
.comp-progress-bar {
  flex: 1; height: 8px; background: #e9ecef;
  border-radius: 4px; overflow: hidden;
}
.comp-progress-fill {
  height: 100%; border-radius: 4px; transition: width .3s;
  background: linear-gradient(90deg, #5EBFBC, #27ae60);
}
.comp-progress-pct { font-size: 11px; font-weight: 600; color: var(--text-muted); min-width: 30px; }

/* Expand row */
.computer-expand-btn {
  background: none; border: none; cursor: pointer;
  font-size: 12px; color: var(--primary); padding: 4px 8px;
  border-radius: 4px; white-space: nowrap;
}
.computer-expand-btn:hover { background: var(--primary-light); }

.computer-tasks-row td { padding: 0 !important; }

.computer-tasks-panel {
  padding: 16px 20px; background: var(--bg);
  border-bottom: 2px solid var(--primary-light);
}

.tasks-panel-title { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 10px; }

.computer-tasks-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
}

.computer-task-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; background: white; border-radius: 6px;
  border: 1px solid var(--border); cursor: pointer;
  transition: all .15s;
}
.computer-task-item:hover { border-color: var(--primary); }
.computer-task-item.done {
  background: #f0faf9; border-color: #5EBFBC;
}
.computer-task-item input[type=checkbox] { cursor: pointer; width: 14px; height: 14px; }
.computer-task-item label { cursor: pointer; font-size: 12px; flex: 1; }
.computer-task-item.done label { color: #27ae60; }

/* Empty state */
.computers-empty {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.computers-empty h3 { font-size: 18px; margin-bottom: 8px; }
.computers-empty p { font-size: 14px; margin-bottom: 20px; }

/* Import modal */
.import-dropzone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 40px 20px; text-align: center; cursor: pointer;
  transition: all .2s;
}
.import-dropzone:hover, .import-dropzone.drag-over {
  border-color: var(--primary); background: var(--primary-light);
}
.import-dropzone-icon { font-size: 40px; margin-bottom: 8px; }
.import-hint { font-size: 12px; color: var(--text-muted); }
.import-template-hint { text-align: center; margin-top: 12px; font-size: 13px; color: var(--text-muted); }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; text-decoration: underline; font-size: 13px; }

.import-preview-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.import-mode { display: flex; gap: 16px; font-size: 13px; }
.import-mode label { cursor: pointer; display: flex; align-items: center; gap: 4px; }

.import-table-wrap { overflow-x: auto; max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.import-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.import-table th { padding: 8px 12px; background: var(--bg); border-bottom: 1px solid var(--border); font-weight: 600; position: sticky; top: 0; }
.import-table td { padding: 7px 12px; border-bottom: 1px solid var(--border); }
.import-table tr:last-child td { border-bottom: none; }

/* Custom tasks modal */
.modal-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.custom-tasks-add { display: flex; gap: 8px; margin-bottom: 12px; }
.custom-tasks-list { display: flex; flex-direction: column; gap: 4px; max-height: 280px; overflow-y: auto; }
.custom-task-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: var(--bg); border-radius: 6px;
  border: 1px solid var(--border); font-size: 13px;
}
.custom-task-row .btn-delete { background: none; border: none; cursor: pointer; color: var(--danger); font-size: 14px; padding: 2px 6px; border-radius: 4px; }
.custom-task-row .btn-delete:hover { background: #fff0f0; }

/* Form helpers */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 500px) { .form-grid-2 { grid-template-columns: 1fr; } }
.form-error { color: var(--danger); font-size: 12px; margin-top: 8px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ══════════════════════════════════════════════════════
   DOCUMENTACIÓN — Sección de plantillas y documentos
   ══════════════════════════════════════════════════════ */

/* Page header */
.docs-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.docs-header h1 { font-size: 22px; color: var(--dark); font-weight: 700; }
.docs-header p   { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.docs-stats {
  display: flex; gap: 16px;
}
.docs-stat {
  text-align: center; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 18px; min-width: 80px;
}
.docs-stat .stat-num { font-size: 22px; font-weight: 700; color: var(--primary); }
.docs-stat .stat-lbl { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }

/* Block cards */
.docs-block {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 16px; overflow: hidden;
}
.docs-block-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: var(--bg-alt); border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none;
}
.docs-block-header:hover { background: #eef3f8; }
.docs-block-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 600; color: var(--dark);
}
.docs-block-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; padding: 2px 10px; font-size: 12px; color: var(--text-muted);
}
.docs-block-badge.all-done { background: #e8f8ef; border-color: #27ae60; color: #1a7a40; }
.docs-block-toggle { font-size: 12px; color: var(--text-muted); }
.docs-block-body { padding: 0; }

/* Document rows */
.doc-row {
  display: grid;
  grid-template-columns: 1fr 140px 160px 130px;
  align-items: center; gap: 12px;
  padding: 12px 18px; border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.doc-row:last-child { border-bottom: none; }
.doc-row:hover { background: #f8fbff; }

.doc-name { font-size: 13px; color: var(--text); font-weight: 500; }
.doc-id   { font-size: 11px; color: var(--text-muted); font-family: monospace; margin-top: 2px; }

.doc-status-badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; text-align: center;
}
.doc-status-badge.pending  { background: #fef3cd; color: #856404; }
.doc-status-badge.uploaded { background: #d4edda; color: #155724; }

.doc-date { font-size: 12px; color: var(--text-muted); }
.doc-date strong { color: var(--text); display: block; font-size: 13px; }

.doc-actions { display: flex; gap: 6px; justify-content: flex-end; }
.doc-actions .btn { padding: 5px 10px; font-size: 12px; white-space: nowrap; }

/* Upload modal extras */
.upload-doc-name {
  font-size: 14px; font-weight: 600; color: var(--primary);
  background: var(--bg-alt); border-radius: 6px; padding: 8px 12px;
  margin-bottom: 12px;
}
.upload-progress { margin-top: 10px; }
.upload-progress-bar {
  height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 6px;
}
.upload-progress-fill {
  height: 100%; background: var(--primary); border-radius: 3px; width: 0%; transition: width .3s;
}

/* Responsive tweaks */
@media (max-width: 700px) {
  .doc-row { grid-template-columns: 1fr 90px; }
  .doc-date, .doc-status-badge { display: none; }
}
