:root {
  --bg: #ffffff;
  --panel: #f5f7fb;
  --panel-2: #eef2f8;
  --accent: #006020;
  --accent-2: #70a080;
  --text: #0e1320;
  --muted: #5b6b82;
}

* {
  box-sizing: border-box;
}

body.bg-app {
  font-family: 'Manrope', system-ui, sans-serif;
  background: #ffffff;
  color: var(--text);
  min-height: 100vh;
}

.app-shell {
  min-height: 100vh;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(14, 19, 32, 0.08);
}

.brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  color: #004020;
}

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

.brand-title i {
  color: #004020;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.user-pill {
  background: var(--panel-2);
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text);
  text-decoration: none;
  border: 1px solid rgba(14, 19, 32, 0.08);
}

.user-pill:hover,
.user-pill:focus {
  color: var(--text);
  text-decoration: none;
}

.user-pill span {
  color: var(--accent);
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
}

.hero {
  background: linear-gradient(135deg, rgba(30, 136, 255, 0.12), rgba(34, 211, 168, 0.12));
  padding: 1.5rem;
  border-radius: 1rem;
  border: 1px solid rgba(30, 136, 255, 0.18);
  margin-bottom: 1.5rem;
}

.hero h2 {
  margin: 0 0 0.5rem;
}

.stat-card {
  background: var(--panel);
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(14, 19, 32, 0.06);
  text-align: center;
}

.stat-card span {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-card strong {
  display: block;
  font-size: 1.6rem;
  margin-top: 0.4rem;
}

.app-card {
  background: var(--panel);
  border: 1px solid rgba(14, 19, 32, 0.06);
  color: var(--text);
}

.status-pendiente {
  background: rgba(220, 53, 69, 0.15);
  color: #b02a37;
}

.status-entregado {
  background: rgba(0, 80, 32, 0.16);
  color: #005020;
}

.status-aprobado {
  background: rgba(112, 160, 128, 0.25);
  color: #006020;
}

.status-cambios_solicitados {
  background: rgba(255, 193, 7, 0.25);
  color: #856404;
}

.panel-modulos {
  background: var(--panel-2);
  color: var(--text);
  width: min(88vw, 360px);
}

.panel-modulos .list-group-item {
  background: #ffffff;
  color: var(--text);
  border: 1px solid rgba(14, 19, 32, 0.08);
  margin-bottom: 0.6rem;
  border-radius: 0.75rem;
}

.panel-modulos .list-group-item i {
  margin-right: 0.5rem;
  color: var(--accent);
}

.auth-container {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 120px);
}

.auth-logo {
  width: 520px;
  height: 320px;
  border-radius: 0;
  background: transparent;
  display: grid;
  place-items: center;
  margin: 6rem 0 1.5rem;
  border: none;
  box-shadow: none;
  z-index: 2;
}

.auth-logo i {
  font-size: 2rem;
  color: var(--accent);
}

.auth-logo img {
  width: 500px;
  height: 300px;
  object-fit: contain;
}

@media (max-width: 768px) {
  .auth-logo {
    width: 320px;
    height: 220px;
  }
  .auth-logo img {
    width: 300px;
    height: 200px;
  }
}

.auth-card {
  background: var(--panel);
  padding: 2rem;
  border-radius: 1.5rem;
  width: min(420px, 100%);
  border: 1px solid rgba(14, 19, 32, 0.08);
  box-shadow: 0 18px 40px rgba(14, 19, 32, 0.12);
}

.auth-card h1 {
  margin-bottom: 0.4rem;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
  font-size: 0.85rem;
}

.auth-links a {
  color: var(--accent);
}

.empty-state {
  padding: 2rem;
  text-align: center;
  border: 1px dashed rgba(14, 19, 32, 0.2);
  border-radius: 1rem;
  color: var(--muted);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.6rem;
}

.preview-img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 0.75rem;
  border: 1px solid rgba(14, 19, 32, 0.08);
  background: #ffffff;
}

.preview-link {
  display: block;
  background: transparent;
  border: none;
  padding: 0;
}

.preview-link .preview-img {
  cursor: zoom-in;
}

.preview-figure {
  margin: 0;
  display: grid;
  gap: 0.35rem;
}

.preview-figure figcaption {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

.preview-section {
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(14, 19, 32, 0.08);
}

.preview-section:last-child {
  border-bottom: none;
}

.btn-preview {
  border: 1px solid rgba(14, 19, 32, 0.2);
  background: #ffffff;
  color: var(--text);
}

.compact-card .card-body {
  padding: 0.65rem 0.75rem;
}

.compact-card strong {
  font-size: 0.9rem;
}

.compact-card .small {
  font-size: 0.78rem;
}

.compact-card .badge {
  font-size: 0.65rem;
  padding: 0.18rem 0.45rem;
}

.compact-card .btn-preview {
  padding: 0.3rem 0.45rem;
}

.compact-card .btn-preview i {
  font-size: 0.9rem;
}

.compact-card p {
  margin-bottom: 0.4rem;
}

.company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.company-card {
  background: var(--panel);
  border: 1px solid rgba(14, 19, 32, 0.08);
  border-radius: 1rem;
  padding: 1rem;
  text-align: center;
}

.company-logo {
  width: 100%;
  height: 120px;
  object-fit: contain;
  background: #ffffff;
  border-radius: 0.75rem;
  border: 1px solid rgba(14, 19, 32, 0.08);
  padding: 0.5rem;
}

.company-placeholder {
  width: 100%;
  height: 120px;
  border-radius: 0.75rem;
  border: 1px dashed rgba(14, 19, 32, 0.2);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 1.6rem;
}

.company-name {
  margin-top: 0.75rem;
  font-weight: 600;
}

.logo-mini {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 0.4rem;
  border: 1px solid rgba(14, 19, 32, 0.08);
  background: #ffffff;
  margin-right: 0.4rem;
}

.company-checks {
  display: grid;
  gap: 0.4rem;
}

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 1rem;
  object-fit: cover;
  border: 1px solid rgba(14, 19, 32, 0.08);
  background: #ffffff;
}

.profile-avatar.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 2rem;
}

.timeline {
  border-left: 1px solid rgba(14, 19, 32, 0.12);
  padding-left: 0.8rem;
  display: grid;
  gap: 0.5rem;
}

.timeline-item {
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -0.95rem;
  top: 0.4rem;
  width: 0.5rem;
  height: 0.5rem;
  background: var(--accent);
  border-radius: 999px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #ffffff;
  font-weight: 600;
}

.btn-outline-light {
  border-color: rgba(14, 19, 32, 0.2);
  color: var(--text);
}

.menu-btn i {
  color: var(--accent);
}

@media (max-width: 768px) {
  .app-header {
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
  }
  .brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    flex: 1 1 auto;
    text-align: center;
  }
  .brand-title {
    width: 100%;
    justify-content: center;
  }
  .profile-btn {
    width: 100%;
    justify-content: flex-start;
  }
  .header-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 0.5rem;
  }
  .header-actions .user-pill {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
  }
  .menu-btn {
    height: 44px;
    width: 44px;
    padding: 0;
  }
  .menu-text {
    display: none;
  }
  .menu-btn i {
    font-size: 1.25rem;
  }
}

@media (min-width: 992px) {
  .auth-container {
    min-height: calc(100vh - 140px);
  }
}
