/* ════════════════════════════════════════════════
   CGV PLANILLAS — Sistema de Diseño
   eM Automatización · v1.0
   ════════════════════════════════════════════════ */

:root {
  --bg:        #0a0e17;
  --s1:        #0f1520;
  --s2:        #131b2e;
  --s3:        #1a2438;
  --s4:        #1e2d45;
  --border:    rgba(255,255,255,0.06);
  --border2:   rgba(255,255,255,0.1);
  --text:      #e2e8f0;
  --muted:     #64748b;
  --label:     #94a3b8;
  --green:     #22c55e;  --green-bg:  rgba(34,197,94,0.1);   --green-b:  rgba(34,197,94,0.3);
  --red:       #ef4444;  --red-bg:    rgba(239,68,68,0.1);    --red-b:    rgba(239,68,68,0.3);
  --blue:      #3b82f6;  --blue-bg:   rgba(59,130,246,0.1);   --blue-b:   rgba(59,130,246,0.3);
  --amber:     #f59e0b;  --amber-bg:  rgba(245,158,11,0.1);   --amber-b:  rgba(245,158,11,0.3);
  --purple:    #8b5cf6;  --purple-bg: rgba(139,92,246,0.1);   --purple-b: rgba(139,92,246,0.3);
  --cyan:      #06b6d4;  --cyan-bg:   rgba(6,182,212,0.1);    --cyan-b:   rgba(6,182,212,0.3);
  --font:      'Inter', -apple-system, sans-serif;
  --mono:      'JetBrains Mono', 'Courier New', monospace;
  --radius:    8px;
  --radius2:   12px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
  --shadow2:   0 8px 40px rgba(0,0,0,0.6);
  --nav-h:     52px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

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

/* ── Utilidades ── */
.hidden    { display: none !important; }
.mono      { font-family: var(--mono); }
.muted     { color: var(--muted); }
.label-c   { color: var(--label); }
.upper     { text-transform: uppercase; letter-spacing: 0.08em; font-size: 10px; font-weight: 700; }
.fw-500    { font-weight: 500; }
.fw-600    { font-weight: 600; }
.fw-700    { font-weight: 700; }
.ta-right  { text-align: right; }
.ta-center { text-align: center; }
.flex      { display: flex; }
.gap-8     { gap: 8px; }
.gap-12    { gap: 12px; }
.ai-center { align-items: center; }
.ml-auto   { margin-left: auto; }
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

/* ══════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════ */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}

.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--bg);
}
.login-grid {
  position: absolute;
  inset: -50%;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 56px 56px;
  transform: perspective(600px) rotateX(12deg);
  transform-origin: center top;
}
.login-bg::after {
  content: '';
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 700px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(34,197,94,0.07) 0%, transparent 65%);
  pointer-events: none;
}

.login-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.login-card {
  background: var(--s2);
  border: 1px solid var(--border2);
  border-radius: var(--radius2);
  padding: 36px 32px 28px;
  box-shadow: var(--shadow2), 0 0 0 1px var(--border);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}
.login-logo {
  width: 44px; height: 44px;
  background: var(--green-bg);
  border: 1px solid var(--green-b);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.login-logo svg { width: 22px; height: 22px; stroke: var(--green); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.login-brand-text { display: flex; flex-direction: column; gap: 2px; }
.login-company { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.2; }
.login-system  { font-size: 11px; color: var(--muted); font-family: var(--mono); letter-spacing: 0.02em; }

.login-divider { height: 1px; background: var(--border); margin-bottom: 24px; }

.login-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.login-sub   { font-size: 12px; color: var(--muted); margin-bottom: 24px; }

/* Alert */
.alert {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 16px; line-height: 1.4;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.alert-error   { background: var(--red-bg);   border: 1px solid var(--red-b);   color: var(--red);   }
.alert-success { background: var(--green-bg); border: 1px solid var(--green-b); color: var(--green); }
.alert-warning { background: var(--amber-bg); border: 1px solid var(--amber-b); color: var(--amber); }

/* Form group */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--label); margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--s3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--muted); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: rgba(34,197,94,0.4);
  box-shadow: 0 0 0 3px rgba(34,197,94,0.07);
}
.form-input:disabled, .form-select:disabled { opacity: 0.5; cursor: not-allowed; }
.form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
.form-textarea { resize: vertical; min-height: 80px; }

.input-wrap { position: relative; }
.input-wrap .form-input { padding-right: 40px; }
.input-eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted);
  padding: 4px; transition: color 0.15s; line-height: 0;
}
.input-eye:hover { color: var(--label); }
.input-eye svg { width: 16px; height: 16px; display: block; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; font-family: var(--font);
  border: 1px solid transparent;
  transition: all 0.15s; cursor: pointer; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.btn-primary { background: linear-gradient(135deg, #16a34a, #22c55e); color: #fff; border-color: transparent; }
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #15803d, #16a34a); box-shadow: 0 4px 12px rgba(34,197,94,0.3); transform: translateY(-1px); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-secondary { background: var(--s3); color: var(--label); border-color: var(--border2); }
.btn-secondary:hover:not(:disabled) { background: var(--s4); color: var(--text); }

.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border2); }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--s3); }

.btn-danger { background: var(--red-bg); color: var(--red); border-color: var(--red-b); }
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.2); }

.btn-blue { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-b); }
.btn-blue:hover:not(:disabled) { background: rgba(59,130,246,0.2); }

.btn-amber { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-b); }
.btn-amber:hover:not(:disabled) { background: rgba(245,158,11,0.2); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-sm svg { width: 13px; height: 13px; }

.btn-login {
  width: 100%; padding: 11px;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  border: none; border-radius: var(--radius);
  color: #fff; font-size: 14px; font-weight: 600; font-family: var(--font);
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; margin-top: 4px;
}
.btn-login:hover:not(:disabled) { background: linear-gradient(135deg, #15803d, #16a34a); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(34,197,94,0.3); }
.btn-login:active:not(:disabled) { transform: translateY(0); }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }

/* Spinner */
.spinner-sm { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
.spinner { width: 24px; height: 24px; border: 2px solid var(--border2); border-top-color: var(--green); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-footer {
  text-align: center; margin-top: 20px;
  padding-top: 16px; border-top: 1px solid var(--border);
}
.login-footer-text { font-size: 11px; color: var(--muted); font-family: var(--mono); }

/* Skeleton loading */
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position:  200% 0; }
}
.skel {
  background: linear-gradient(90deg, var(--s3) 25%, var(--s4) 50%, var(--s3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: 4px;
}
.skel-line { height: 12px; margin-bottom: 8px; }
.skel-line:last-child { width: 60%; }
