:root {
  --azul: #0f2a4a;
  --azul2: #15406e;
  --azul-claro: #e8f0f9;
  --acento: #1e88c7;
  --texto: #14202c;
  --muted: #5b6b7a;
  --borde: #d7e1ea;
  --ok: #1a7f4e;
  --warn: #b45309;
  --danger: #b42318;
  --radio: 10px;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  background: #f4f7fb;
  color: var(--texto);
  line-height: 1.5;
}

.topbar {
  background: var(--azul);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar__brand { font-weight: 700; font-size: 1.1rem; letter-spacing: .02em; }
.topbar__brand span { color: #8fc7f5; font-weight: 400; }
.topbar__user { display: flex; align-items: center; gap: 12px; font-size: .9rem; }

main#app { max-width: 980px; margin: 0 auto; padding: 24px 20px 64px; }

.view__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

h1 { font-size: 1.5rem; margin: 0 0 4px; color: var(--azul); }
h2 { font-size: 1.2rem; color: var(--azul); margin-top: 0; }
h3 { font-size: 1.05rem; color: var(--azul2); margin: 0 0 10px; }
.muted { color: var(--muted); }

.card {
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 24px;
  box-shadow: 0 2px 10px rgba(15,42,74,.05);
}
.card--narrow { max-width: 380px; margin: 60px auto; }

label { display: block; font-size: .85rem; font-weight: 600; margin: 14px 0 6px; color: var(--azul2); }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--borde);
  border-radius: 8px;
  font-size: .95rem;
  font-family: inherit;
  background: #fff;
  color: var(--texto);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--acento);
  outline-offset: 1px;
  border-color: var(--acento);
}
textarea { min-height: 80px; resize: vertical; }

.btn {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: .9rem;
  font-weight: 600;
  min-height: 40px;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn--primary { background: var(--azul); color: #fff; margin-top: 18px; }
.btn--primary:hover { background: var(--azul2); }
.btn--ghost { background: transparent; color: var(--azul2); border: 1px solid var(--borde); }
.btn--ghost:hover { background: var(--azul-claro); }
.btn--sm { padding: 6px 12px; min-height: 32px; font-size: .82rem; }
.btn--danger { background: #fff; color: var(--danger); border: 1px solid #f0b4ab; }
.btn--danger:hover { background: #fdeceb; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.error { color: var(--danger); font-size: .85rem; margin-top: 10px; }
.success { color: var(--ok); font-size: .85rem; margin-top: 10px; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-top: 18px; }

.proyecto-card {
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 16px 18px;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
}
.proyecto-card:hover { box-shadow: 0 4px 14px rgba(15,42,74,.1); border-color: var(--acento); }
.proyecto-card h3 { margin: 0 0 4px; }
.proyecto-card .meta { font-size: .8rem; color: var(--muted); margin-top: 8px; }
.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.badge--preliminar { background: #fff3cd; color: #8a6400; }
.badge--completo { background: #d7f0e4; color: var(--ok); }

.tabs { display: flex; gap: 6px; margin: 18px 0; flex-wrap: wrap; border-bottom: 1px solid var(--borde); padding-bottom: 0; }
.tab {
  cursor: pointer;
  padding: 10px 16px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--muted);
  border: none;
  background: none;
  border-bottom: 3px solid transparent;
  min-height: 44px;
}
.tab:hover { color: var(--azul2); }
.tab.is-active { color: var(--azul); border-bottom-color: var(--acento); }

.panel { background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); padding: 22px; margin-bottom: 18px; }
.panel + .panel { margin-top: 18px; }

.field-grid { display: grid; gap: 4px 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.pendientes {
  background: #fff8e8;
  border: 1px solid #f0d99a;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: .85rem;
  color: #8a6400;
  margin-bottom: 16px;
}

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--borde); }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
td.num { text-align: right; }
tfoot td { font-weight: 700; border-bottom: none; }

.dato-tag { font-size: .72rem; padding: 2px 7px; border-radius: 12px; font-weight: 600; }
.dato-verificado { background: #d7f0e4; color: var(--ok); }
.dato-calculo { background: #dbeafe; color: #1d4ed8; }
.dato-supuesto { background: #fde7e3; color: var(--danger); }
.dato-recomendacion { background: #ede7fb; color: #5b21b6; }

.equipo-card { border: 1px solid var(--borde); border-radius: 8px; padding: 12px; display: flex; gap: 12px; margin-bottom: 10px; }
.equipo-card img { width: 64px; height: 64px; object-fit: contain; flex-shrink: 0; background: #f4f7fb; border-radius: 6px; }
.equipo-card .info { flex: 1; min-width: 0; }
.equipo-card .info strong { display: block; font-size: .92rem; }
.equipo-card .info .muted { font-size: .8rem; }
.equipo-card .precio { font-weight: 700; color: var(--azul); white-space: nowrap; }

.resultado-calc {
  background: var(--azul-claro);
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 14px;
  font-size: .9rem;
}
.resultado-calc strong { color: var(--azul); }

.modal { position: fixed; inset: 0; background: rgba(15,42,74,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal__box { background: #fff; border-radius: var(--radio); padding: 28px; max-width: 420px; width: 100%; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.modal__actions .btn--primary { margin-top: 0; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--azul); color: #fff; padding: 12px 20px; border-radius: 8px;
  font-size: .9rem; z-index: 100; box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
.toast.is-error { background: var(--danger); }

.inline-actions { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }

.prospecto-resultados {
  border: 1px solid var(--borde);
  border-radius: 8px;
  margin-top: 6px;
  max-height: 180px;
  overflow-y: auto;
}
.prospecto-resultado {
  padding: 8px 12px;
  cursor: pointer;
  font-size: .85rem;
  border-bottom: 1px solid var(--borde);
}
.prospecto-resultado:last-child { border-bottom: none; }
.prospecto-resultado:hover { background: var(--azul-claro); }
.prospecto-resultado strong { display: block; }
.prospecto-vinculo {
  background: var(--azul-claro);
  border: 1px solid #bcd8f0;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: .88rem;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.empty-state { text-align: center; color: var(--muted); padding: 40px 0; }

@media (max-width: 600px) {
  main#app { padding: 16px 14px 48px; }
  .view__header { flex-direction: column; align-items: stretch; }
}
