/* ============================================
   RESET & VARIABLES
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-dark: #0a0f1a;
  --bg-panel: #111827;
  --bg-card: #1a2235;
  --bg-card-hover: #1f2a40;
  --border: #2a3552;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --green: #2e9e5e;
  --yellow: #eab308;
  --red: #ef4444;
}

/* ============================================
   BASE
   ============================================ */
body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

/* ============================================
   TOP BAR
   ============================================ */
.topbar {
  height: 52px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
  position: relative;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), #06b6d4);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  color: white;
  letter-spacing: -0.5px;
}

.topbar-title { font-weight: 600; font-size: 15px; }
.topbar-subtitle { font-size: 12px; color: var(--text-muted); }

.topbar-center {
  display: flex;
  align-items: center;
  position: absolute;
  left: 340px;
}

.topbar-brand-logo {
  height: 34px;
  width: auto;
  object-fit: contain;
}

.topbar-stats {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-left: auto;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.stat-value {
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 16px;
  flex-shrink: 0;
}

.dashboard-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, var(--accent), #06b6d4);
  border-radius: 6px;
  color: white;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s;
}

.dashboard-link:hover { opacity: 0.85; }

/* ============================================
   LAYOUT
   ============================================ */
.main-container {
  display: flex;
  height: calc(100vh - 52px);
}

/* ============================================
   LOADING
   ============================================ */
.loading-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 15, 26, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  transition: opacity 0.4s;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============================================
   LOGIN SCREEN
   ============================================ */
.login-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.login-logo {
  height: 56px;
  width: auto;
  margin-bottom: 24px;
  object-fit: contain;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.login-field {
  text-align: left;
  margin-bottom: 16px;
}

.login-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.login-field input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-field input::placeholder {
  color: var(--text-muted);
}

.login-error {
  font-size: 12px;
  color: var(--red);
  min-height: 18px;
  margin-bottom: 8px;
  text-align: left;
}

.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: white;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.login-btn:hover { background: #2563eb; }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.login-footer {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 28px;
}

/* ============================================
   LOGOUT BUTTON (topbar)
   ============================================ */
.logout-btn {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--red);
  color: var(--red);
}

/* ============================================
   PREDIO STATUS BADGES (Estado_lev)
   ============================================ */
.status-pendiente           { background: rgba(165,165,175,0.2); color: #a5a5af; }
.status-en_campo            { background: rgba(234,179,8,0.15);  color: #eab308; }
.status-revision_registral  { background: rgba(59,130,246,0.15); color: #3b82f6; }
.status-completado          { background: rgba(46,158,94,0.15);  color: var(--green); }
