/* === RESET + BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Ketika', system-ui, -apple-system, sans-serif;
  font-weight: 300;
  color: var(--text-base);
  background: linear-gradient(135deg, #2a3a2a 0%, #1a1f1a 100%);
  overflow-x: hidden;
  min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { display: block; max-width: 100%; }
input, select, textarea {
  font-family: inherit; font-size: 14px; padding: 10px 14px;
  border: 1.5px solid rgba(0,0,0,.1); border-radius: var(--radius-sm);
  background: #fff; outline: none; transition: border-color var(--t-fast), box-shadow var(--t-fast);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--section-primary, var(--verde-3));
  box-shadow: 0 0 0 3px rgba(95,173,86,.15);
}
label { font-size: 12px; font-weight: 600; color: var(--text-soft); text-transform: uppercase; letter-spacing: .5px; display: block; margin-bottom: 6px; }


/* === TOP BAR === */
#top-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 68px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  background: rgba(20,30,20,.98);
  border-bottom: 1px solid rgba(255,255,255,.08);
  z-index: 500;
  color: #f4ece2;
}
.top-bar-left, .top-bar-right { display: flex; align-items: center; gap: 12px; }
.top-bar-center { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 42px; height: 42px; object-fit: contain; filter: drop-shadow(0 2px 8px rgba(0,0,0,.4)); }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-family: 'Vito', sans-serif; font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.brand-sub { font-family: 'Coolvetica', sans-serif; font-style: italic; font-size: 11px; opacity: .7; margin-top: 2px; }

.phase-pill, .location-pill, .date-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-pill);
  font-size: 13px;
}
.phase-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--verde-3);
  box-shadow: 0 0 0 0 rgba(95,173,86,.7);
  animation: pulse-dot 2.4s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(95,173,86,.7); }
  50% { box-shadow: 0 0 0 6px rgba(95,173,86,0); }
}
.phase-label { opacity: .6; text-transform: uppercase; font-size: 11px; letter-spacing: .5px; }
.phase-value { font-weight: 600; }
.location-pill img { width: 18px; height: 18px; object-fit: contain; }
.date-pill { font-family: 'Coolvetica', sans-serif; }

.alert-bell {
  position: relative;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  transition: all var(--t-fast);
}
.alert-bell:hover { background: rgba(255,255,255,.14); transform: scale(1.05); }
.alert-bell img { width: 22px; height: 22px; object-fit: contain; }
.alert-count {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  background: var(--accent-warn); color: #fff;
  border-radius: 50%;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 8px rgba(224,122,61,.5);
}
.alert-count.zero { display: none; }

.actions-menu { display: flex; gap: 6px; margin-left: 8px; }
.actions-menu button {
  width: 34px; height: 34px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  font-size: 14px; color: #f4ece2;
  transition: all var(--t-fast);
}
.actions-menu button:hover { background: rgba(255,255,255,.14); transform: translateY(-1px); }

/* === HUB ISOMÉTRICA === */
.view { display: none; padding-top: 68px; min-height: 100vh; }
.view.active { display: block; animation: fadeIn 320ms ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

#hub-view { position: relative; display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 68px); }
#hub-view.view.active { display: flex; }
.hub-stage {
  position: relative;
  aspect-ratio: 648 / 544;
  width: min(100%, calc((100vh - 68px) * 648 / 544));
  max-height: calc(100vh - 68px);
  margin: 0 auto;
  overflow: hidden;
  container-type: inline-size;
}
.hub-bg {
  width: 100%; height: 100%; object-fit: contain;
  filter: brightness(.95) contrast(1.02) saturate(1.05);
  pointer-events: none;
}

/* === HOTSPOTS === */
.hotspot {
  position: absolute;
  width: 11cqw; height: 11cqw;
  min-width: 40px; min-height: 40px;
  max-width: 80px; max-height: 80px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.92);
  border: 2px solid rgba(255,255,255,.6);
  border-radius: 50%;
  box-shadow: 0 6px 24px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.6);
  transition: all 280ms cubic-bezier(.34,1.56,.64,1);
  z-index: 10;
}
.hotspot img {
  width: 60%; height: 60%; object-fit: contain;
  pointer-events: none;
  transition: transform var(--t-base);
}
.hotspot-glow {
  position: absolute; inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(95,173,86,.4) 0%, rgba(95,173,86,0) 70%);
  animation: hotspot-pulse 2.6s ease-in-out infinite;
  pointer-events: none;
}
.hotspot-glow.alert {
  background: radial-gradient(circle, rgba(224,122,61,.5) 0%, rgba(224,122,61,0) 70%);
  animation-duration: 1.8s;
}
@keyframes hotspot-pulse {
  0%, 100% { opacity: .35; transform: scale(1); }
  50% { opacity: .75; transform: scale(1.15); }
}
.hotspot-label {
  position: absolute;
  bottom: -32px; left: 50%; transform: translateX(-50%);
  font-family: 'Vito', sans-serif;
  font-size: 12px; font-weight: 700;
  color: #fff;
  background: rgba(20,30,20,.98);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  opacity: 0;
  transition: all var(--t-base);
  pointer-events: none;
  letter-spacing: .3px;
}
.hotspot:hover {
  transform: scale(1.12);
  box-shadow: 0 12px 36px rgba(0,0,0,.35), 0 0 0 4px rgba(95,173,86,.25), inset 0 1px 0 rgba(255,255,255,.8);
  border-color: var(--verde-3);
}
.hotspot:hover img { transform: scale(1.1); }
.hotspot:hover .hotspot-label { opacity: 1; bottom: -38px; }
.hotspot:active { transform: scale(.96); }

/* === MINI-NAV === */
.mini-nav {
  position: fixed;
  bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 4px;
  background: rgba(20,30,20,.98);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-pill);
  padding: 6px;
  z-index: 200;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
}
.mini-nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  color: rgba(244,236,234,.7);
  transition: all var(--t-fast);
  font-size: 11px; font-weight: 600;
  font-family: 'Vito', sans-serif;
  letter-spacing: .3px;
}
.mini-nav-btn img { width: 22px; height: 22px; object-fit: contain; opacity: .85; transition: all var(--t-fast); }
.mini-nav-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.mini-nav-btn:hover img { opacity: 1; transform: translateY(-2px); }
.mini-nav-btn.active { background: var(--verde-3); color: #fff; }
.mini-nav-btn.active img { opacity: 1; }

/* === SECCIÓN GENÉRICA === */
.section {
  min-height: calc(100vh - 68px);
  padding: 32px 48px 100px;
  background: var(--section-bg-soft, #f4ece2);
  color: var(--text-base);
}
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 2px solid rgba(0,0,0,.06);
}
.section-title-group { display: flex; align-items: center; gap: 16px; }
.section-icon {
  width: 56px; height: 56px;
  background: var(--section-bg-card, #fff);
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center;
}
.section-icon img { width: 100%; height: 100%; object-fit: contain; }
.section-title {
  font-family: 'Vito', sans-serif;
  font-size: 32px;
  color: var(--section-primary);
  font-weight: 700;
  letter-spacing: -.5px;
}
.section-subtitle {
  font-family: 'Coolvetica', sans-serif;
  font-style: italic;
  font-size: 14px;
  color: var(--text-soft);
  margin-top: 2px;
}
.btn-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px;
  background: var(--section-bg-card, #fff);
  color: var(--section-primary);
  border-radius: var(--radius-pill);
  font-weight: 600; font-size: 13px;
  box-shadow: var(--shadow-sm);
  transition: all var(--t-fast);
  font-family: 'Vito', sans-serif;
}
.btn-back:hover { transform: translateX(-2px); box-shadow: var(--shadow-md); }

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  background: var(--section-primary);
  color: var(--section-text-on-primary, #fff);
  border-radius: var(--radius-pill);
  font-family: 'Vito', sans-serif;
  font-weight: 700; font-size: 13px;
  letter-spacing: .3px;
  box-shadow: var(--shadow-sm);
  transition: all var(--t-fast);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); filter: brightness(1.08); }
.btn:active { transform: translateY(0); }
.btn-ghost {
  background: transparent;
  color: var(--section-primary);
  border: 1.5px solid var(--section-primary);
  box-shadow: none;
}
.btn-ghost:hover { background: var(--section-primary); color: var(--section-text-on-primary); }
.btn-danger { background: var(--accent-danger); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 12px; }

/* === CARDS === */
.card {
  background: var(--section-bg-card, #fff);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: all var(--t-base);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

/* === MODAL === */
.modal-root {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.modal-root[hidden] { display: none !important; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(10,20,10,.80);
  animation: fadeIn 240ms ease-out;
}
.modal-content {
  position: relative;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
  width: 560px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 320ms cubic-bezier(.34,1.56,.64,1);
}
.modal-content.wide { width: 880px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,.06);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: all var(--t-fast);
}
.modal-close:hover { background: rgba(0,0,0,.12); transform: rotate(90deg); }
.modal-title {
  font-family: 'Vito', sans-serif;
  font-size: 24px;
  color: var(--section-primary, var(--verde-2));
  margin-bottom: 8px;
}
.modal-subtitle {
  font-family: 'Coolvetica', sans-serif; font-style: italic;
  color: var(--text-soft); font-size: 14px; margin-bottom: 24px;
}
.form-row { margin-bottom: 16px; }
.form-row-inline { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-actions {
  display: flex; gap: 12px; justify-content: flex-end;
  margin-top: 24px; padding-top: 20px;
  border-top: 1px solid rgba(0,0,0,.06);
}

/* === TOAST === */
.toast {
  position: fixed;
  bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(20,30,20,.95);
  color: #fff;
  padding: 14px 24px;
  border-radius: var(--radius-pill);
  font-family: 'Vito', sans-serif;
  font-size: 14px;
  z-index: 2000;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: all var(--t-base);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: rgba(40,90,40,.95); }
.toast.error { background: rgba(140,40,40,.95); }

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  background: var(--section-bg-card, #fff);
  border-radius: var(--radius-md);
  margin-top: 16px;
}
.empty-state img { width: 120px; margin: 0 auto 16px; opacity: .6; }
.empty-state h3 { font-family: 'Vito', sans-serif; color: var(--section-primary); font-size: 18px; margin-bottom: 8px; }
.empty-state p { color: var(--text-soft); font-size: 14px; }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,.04); }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.18); border-radius: 5px; }

/* === MÓVIL === */
@media (max-width: 768px) {
  /* Top bar */
  #top-bar {
    overflow: hidden;
    padding: 0 12px;
    height: 56px;
    background: rgba(20,30,20,.98);
  }
  .view { padding-top: 56px; }
  #hub-view { min-height: calc(100vh - 56px); }
  .hub-stage {
    width: min(100%, calc((100vh - 56px) * 648 / 544));
    max-height: calc(100vh - 56px);
  }
  .top-bar-center { display: none !important; }
  .actions-menu { display: none !important; }
  .brand-name { font-size: 14px; }
  .brand-sub { display: none; }
  .brand-logo { width: 32px; height: 32px; }

  /* Mini-nav compacto */
  .mini-nav {
    bottom: 12px;
    padding: 4px;
    gap: 2px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 96vw;
  }
  .mini-nav-btn { padding: 6px 8px; font-size: 10px; }
  .mini-nav-btn img { width: 18px; height: 18px; }

  /* Modales y secciones */
  .modal-content { width: 95vw; padding: 20px; }
  .modal-content.wide { width: 95vw; }
  .section { padding: 20px 16px 100px; }
}
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.28); }
