:root {
  --bg: #ffffff;
  --bg2: #f5f5f0;
  --accent: #1a1a2e;
  --accent2: #2d4a8a;
  --highlight: #e05c2a;
  --text: #1a1a1a;
  --text-muted: #777770;
  --border: #e0e0d8;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Lato', sans-serif;
  font-size: 17px;
  font-weight: 300;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* NAV */
nav {
  padding: 22px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}
.logo { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 22px; color: var(--accent); letter-spacing: -0.5px; }
.logo span { color: var(--highlight); }
nav p { font-size: 14px; color: var(--text-muted); font-weight: 400; }

/* HERO */
.hero {
  background: var(--accent);
  color: #fff;
  padding: 80px 48px 72px;
  position: relative;
  overflow: hidden;
}
.hero::after { content: ''; position: absolute; right: -60px; top: -60px; width: 400px; height: 400px; border: 1px solid rgba(255,255,255,0.07); border-radius: 50%; }
.hero::before { content: ''; position: absolute; right: 60px; bottom: -80px; width: 260px; height: 260px; border: 1px solid rgba(224,92,42,0.25); border-radius: 50%; }
.hero-tag { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--highlight); margin-bottom: 20px; }
.hero h1 { font-family: 'Syne', sans-serif; font-weight: 800; font-size: clamp(32px, 5vw, 52px); line-height: 1.1; max-width: 640px; margin-bottom: 20px; }
.hero h1 em { font-style: normal; color: var(--highlight); }
.hero p { font-size: 17px; color: rgba(255,255,255,0.65); max-width: 480px; line-height: 1.6; font-weight: 300; }

/* MAIN CONTENT */
.main-wrap { max-width: 780px; margin: 0 auto; padding: 60px 24px 80px; }

/* PROGRESS BAR */
.progress-wrap { margin-bottom: 48px; }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 10px; }
.progress-label span { font-size: 13px; color: var(--text-muted); font-weight: 400; }
.progress-label strong { font-size: 13px; color: var(--accent); font-family: 'Syne', sans-serif; font-weight: 700; }
.progress-track { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--highlight); border-radius: 2px; transition: width 0.4s ease; }
.steps-dots { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: all 0.3s; }
.dot.done { background: var(--highlight); }
.dot.active { background: var(--accent); transform: scale(1.4); }

/* STEP PANEL */
.step-panel { display: none; animation: fadeIn 0.3s ease; }
.step-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.step-header { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 36px; padding-bottom: 28px; border-bottom: 1px solid var(--border); }
.step-icon { font-size: 28px; flex-shrink: 0; margin-top: 2px; }
.step-header-text h2 { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 22px; color: var(--accent); margin-bottom: 4px; }
.step-header-text p { font-size: 15px; color: var(--text-muted); font-weight: 400; }

/* GYM STEP BADGE */
.gym-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #fff;
  background: var(--highlight);
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}

/* FIELDS */
.field-group { margin-bottom: 28px; }
label { display: block; font-size: 15px; font-weight: 400; color: var(--text); margin-bottom: 10px; }
label strong { font-weight: 700; }

input[type="text"], input[type="number"], select, textarea {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-family: 'Lato', sans-serif;
  font-size: 16px;
  font-weight: 300;
  color: var(--text);
  border-radius: 4px;
  transition: border-color 0.2s;
  outline: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent2); }
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23777770' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

/* RADIO / CHECK GRID */
.options-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.options-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.options-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.option-card { position: relative; }
.option-card input { position: absolute; opacity: 0; width: 0; height: 0; }
.option-card label {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 400;
  margin: 0;
  transition: all 0.2s;
  background: var(--bg);
  user-select: none;
}
.option-card label:hover { border-color: var(--accent2); background: #f0f4ff; }
.option-card input:checked + label { border-color: var(--accent); background: var(--accent); color: #fff; }
.option-icon { font-size: 16px; }

/* NUMBER INPUT */
.number-input-wrap {
  display: flex; align-items: center; gap: 0;
  max-width: 180px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.number-btn {
  width: 44px; height: 48px;
  background: var(--bg2);
  border: none; cursor: pointer;
  font-size: 20px; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-weight: 300; transition: background 0.2s; flex-shrink: 0;
}
.number-btn:hover { background: var(--border); }
.number-input-wrap input[type="number"] {
  border: none; border-radius: 0; text-align: center;
  font-size: 18px; font-weight: 700;
  font-family: 'Syne', sans-serif;
  width: 80px; padding: 8px 0;
}
.number-input-wrap input[type="number"]::-webkit-inner-spin-button,
.number-input-wrap input[type="number"]::-webkit-outer-spin-button { appearance: none; }

/* CONDITIONAL */
.conditional { display: none; margin-top: 20px; padding: 20px; background: var(--bg2); border-left: 3px solid var(--accent2); border-radius: 0 4px 4px 0; }
.conditional.visible { display: block; }

/* MISC */
.field-divider { height: 1px; background: var(--border); margin: 28px 0; }
.field-hint { font-size: 13px; color: var(--text-muted); margin-top: 6px; font-weight: 400; }

/* NAV BUTTONS */
.nav-buttons { display: flex; justify-content: space-between; align-items: center; margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border); }
.btn { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 15px; padding: 14px 32px; border-radius: 4px; cursor: pointer; border: none; transition: all 0.2s; letter-spacing: 0.3px; }
.btn-secondary { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); }
.btn-generate { background: var(--highlight); color: #fff; padding: 14px 40px; }
.btn-generate:hover { background: #c94d1f; transform: translateY(-1px); }

/* ============ RESULT PAGE ============ */
#result-page { display: none; padding: 0 0 80px; }

.result-hero {
  background: var(--accent); color: #fff;
  padding: 56px 48px; margin-bottom: 48px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.result-hero h2 { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 28px; margin-bottom: 6px; }
.result-hero p { font-size: 15px; color: rgba(255,255,255,0.6); font-weight: 300; }
.result-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-export { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px; padding: 12px 24px; border-radius: 4px; cursor: pointer; border: 1px solid rgba(255,255,255,0.3); background: transparent; color: #fff; transition: all 0.2s; letter-spacing: 0.3px; }
.btn-export:hover { background: rgba(255,255,255,0.1); }
.btn-export-solid { background: var(--highlight); border-color: var(--highlight); }
.btn-export-solid:hover { background: #c94d1f; border-color: #c94d1f; }

.result-content { max-width: 960px; margin: 0 auto; padding: 0 24px; }

/* ORG CHART BASE */
.org-wrap { overflow-x: auto; padding: 16px 0 32px; }
.org-chart { display: flex; flex-direction: column; align-items: center; gap: 0; min-width: 640px; }

.org-ceo {
  background: var(--accent); color: #fff;
  padding: 16px 40px; border-radius: 4px;
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: 16px;
  text-align: center; position: relative; min-width: 200px;
}
.org-ceo .company-name { font-size: 20px; font-weight: 800; display: block; margin-bottom: 2px; }
.org-ceo .ceo-role { font-size: 12px; font-weight: 400; color: rgba(255,255,255,0.6); letter-spacing: 1.5px; text-transform: uppercase; }

.connector-v { width: 2px; height: 32px; background: var(--border); margin: 0 auto; }

/* GEOGRAPHIC LAYER */
.country-row {
  display: flex; gap: 24px; justify-content: center; flex-wrap: wrap;
  padding: 0 16px;
}
.country-col { display: flex; flex-direction: column; align-items: center; gap: 0; }
.country-col::before { content: ''; width: 2px; height: 24px; background: var(--border); display: block; }

.country-node {
  background: var(--accent2); color: #fff;
  border-radius: 4px; padding: 12px 20px;
  text-align: center; min-width: 140px;
  position: relative;
}
.country-node .c-flag { font-size: 20px; display: block; margin-bottom: 4px; }
.country-node .c-name { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px; display: block; }
.country-node .c-sedes { font-size: 11px; color: rgba(255,255,255,0.65); display: block; margin-top: 2px; }

.geo-manager {
  background: var(--bg2); border: 1px dashed var(--accent2);
  border-radius: 4px; padding: 6px 14px;
  font-size: 12px; color: var(--accent2); font-weight: 700;
  margin-bottom: 8px; text-align: center;
}

/* DEPT ROW */
.dept-row {
  display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
  padding-top: 32px; position: relative;
}
.dept-col { display: flex; flex-direction: column; align-items: center; gap: 0; position: relative; }
.dept-col::before { content: ''; width: 2px; height: 32px; background: var(--border); display: block; }

.dept-node {
  border: 2px solid var(--accent); background: var(--bg);
  border-radius: 4px; padding: 14px 22px; text-align: center;
  min-width: 150px; max-width: 180px;
}
.dept-node.critical { border-color: var(--highlight); box-shadow: 0 0 0 3px rgba(224,92,42,0.15); }
.dept-node .dept-icon { font-size: 22px; display: block; margin-bottom: 6px; }
.dept-node .dept-name { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px; color: var(--accent); display: block; margin-bottom: 4px; }
.dept-node .dept-count { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; justify-content: center; gap: 4px; font-weight: 400; }
.dept-node .dept-count::before { content: ''; display: inline-block; width: 6px; height: 6px; background: var(--highlight); border-radius: 50%; }
.dept-node.critical .dept-name { color: var(--highlight); }

.subareas { display: flex; flex-direction: column; gap: 8px; margin-top: 0; align-items: center; }
.subarea-connector { width: 2px; height: 16px; background: var(--border); }
.subarea-node { background: var(--bg2); border: 1px solid var(--border); border-radius: 4px; padding: 8px 14px; font-size: 13px; color: var(--text-muted); text-align: center; min-width: 140px; max-width: 170px; font-weight: 400; }

/* INSIGHTS */
.insights-section { margin-top: 32px; }
.insights-section h3 { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 16px; color: var(--accent); margin-bottom: 16px; }
.insight-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.insight-card { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 18px 20px; }
.insight-card .i-type { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 6px; }
.insight-card .i-type.warn { color: #d97706; }
.insight-card .i-type.ok { color: #16a34a; }
.insight-card .i-type.tip { color: var(--accent2); }
.insight-card p { font-size: 14px; color: var(--text); line-height: 1.5; font-weight: 300; }

/* DIAGNOSTICO */
.diagnostico-section { margin-top: 32px; }
.diagnostico-section h3 { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 16px; color: var(--accent); margin-bottom: 16px; }
.diagnostico-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }

.diag-card {
  border-radius: 4px; padding: 20px;
  border: 1px solid var(--border);
}
.diag-card.critical { background: #fff3ed; border-color: var(--highlight); }
.diag-card.warning { background: #fffbeb; border-color: #d97706; }
.diag-card.ok { background: #f0fdf4; border-color: #16a34a; }

.diag-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.diag-card-rank { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 22px; color: var(--highlight); }
.diag-card.warning .diag-card-rank { color: #d97706; }
.diag-card-dept { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 15px; color: var(--accent); }
.diag-card-type { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); }
.diag-card p { font-size: 14px; color: var(--text); line-height: 1.5; font-weight: 300; margin-bottom: 8px; }
.diag-suggestion {
  font-size: 13px; color: var(--accent2);
  background: rgba(45,74,138,0.07);
  padding: 8px 12px; border-radius: 3px; margin-top: 8px;
  font-weight: 400;
}

/* PROMPT BOX */
.prompt-box { margin-top: 40px; padding: 24px; background: var(--bg2); border-radius: 4px; border: 1px solid var(--border); }
.prompt-box h3 { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 16px; color: var(--accent); margin-bottom: 12px; }
.prompt-box textarea { width: 100%; font-family: monospace; font-size: 13px; background: #1e1e1e; color: #d4d4d4; padding: 16px; border-radius: 6px; border: none; min-height: 200px; }
.prompt-copy-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.prompt-box .btn-copy { background: var(--accent); color: white; border: none; padding: 10px 24px; border-radius: 4px; cursor: pointer; font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px; transition: background 0.2s; }
.prompt-box .btn-copy:hover { background: var(--accent2); }
.copy-feedback { font-size: 13px; color: #16a34a; font-weight: 700; display: none; }
.copy-feedback.visible { display: inline; }

/* OBSERVATIONS */
.observations-box { margin-top: 40px; padding: 28px 32px; background: var(--bg2); border-left: 4px solid var(--highlight); border-radius: 0 4px 4px 0; }
.observations-box h3 { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 16px; color: var(--accent); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.obs-tag { display: inline-block; background: var(--highlight); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; padding: 2px 8px; border-radius: 2px; }
.observations-box p { font-size: 15px; color: var(--text); line-height: 1.65; font-weight: 300; white-space: pre-wrap; }

/* FOOTER */
footer { border-top: 1px solid var(--border); padding: 28px 48px; display: flex; justify-content: space-between; align-items: center; margin-top: 60px; flex-wrap: wrap; gap: 12px; }
footer p { font-size: 13px; color: var(--text-muted); font-weight: 400; }
footer a { color: var(--highlight); text-decoration: none; font-weight: 700; }

/* RESPONSIVE */
@media (max-width: 640px) {
  nav, .hero, .result-hero, footer { padding-left: 20px; padding-right: 20px; }
  .hero { padding-top: 52px; padding-bottom: 52px; }
  .options-grid { grid-template-columns: 1fr; }
  .options-grid.cols-2 { grid-template-columns: 1fr 1fr; }
  .options-grid.cols-3 { grid-template-columns: 1fr 1fr; }
  .dept-row { gap: 10px; }
  .dept-node { min-width: 120px; padding: 12px 14px; }
  .country-row { gap: 12px; }
}
