:root {
  --orange: #f36c0a;
  --orange-dark: #d94f00;
  --orange-soft: #fff0e5;
  --yellow: #ffbd00;
  --graphite: #29282a;
  --gray: #6e6c70;
  --gray-light: #aaa9ab;
  --paper: #fffdf9;
  --canvas: #f5f2ed;
  --line: #e4ddd5;
  --white: #ffffff;
  --success: #1d8a63;
  --danger: #b42318;
  --shadow: 0 12px 35px rgba(45, 39, 34, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--graphite);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

button, input, select { font: inherit; }

.topbar {
  background: var(--white);
  border-bottom: 4px solid var(--orange);
  color: var(--graphite);
  box-shadow: 0 5px 18px rgba(45, 39, 34, .06);
}

.topbar-inner {
  width: min(1460px, calc(100% - 40px));
  min-height: 86px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand-logo { width: 225px; max-height: 64px; object-fit: contain; object-position: left center; }

.topbar-controls { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }

.language-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.language-button {
  min-width: 38px;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--gray);
  cursor: pointer;
  font-size: .75rem;
  font-weight: 900;
}

.language-button.active { background: var(--orange); color: white; }

.topbar-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 5px rgba(255, 189, 0, .14); }

.page { width: min(1460px, calc(100% - 40px)); margin: 28px auto 70px; }

.hero {
  min-height: 220px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 34px 48px;
  border-radius: 26px;
  background: linear-gradient(115deg, #fff7ea 0%, #ffe2bb 62%, #ffc05e 100%);
  border: 1px solid rgba(243, 108, 10, .22);
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -160px;
  width: 430px;
  height: 430px;
  border: 70px solid rgba(243, 108, 10, .11);
  border-radius: 50%;
}

.hero > div { max-width: 840px; position: relative; z-index: 1; }
.hero h1 { margin: 4px 0 10px; max-width: 760px; font-size: clamp(2rem, 4vw, 3.8rem); line-height: 1.02; letter-spacing: -0.04em; }
.hero p:last-child { margin: 0; max-width: 760px; font-size: 1.06rem; color: #5d5148; }
.hero-mark { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; position: relative; z-index: 1; box-shadow: 0 16px 35px rgba(181, 74, 0, .2); }

.eyebrow { margin: 0; color: var(--orange-dark); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

.workspace { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 22px; align-items: start; margin-top: 22px; }
.sidebar, .content { display: grid; gap: 18px; }
.sidebar { position: sticky; top: 18px; }

.panel, .results {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.panel { padding: 24px; }
.panel-dark { color: var(--white); background: linear-gradient(155deg, #2c2b2d, #1f1e20); border-color: #3d3c3f; }

.section-heading { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 22px; }
.section-heading.compact { margin-bottom: 16px; }
.section-heading h2 { margin: 1px 0 2px; font-size: 1.14rem; line-height: 1.2; }
.section-heading p { margin: 0; color: var(--gray); font-size: .86rem; }
.panel-dark .section-heading p { color: #c7c5c8; }

.step-number {
  width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center;
  border-radius: 10px; background: var(--orange); color: white; font-size: .82rem; font-weight: 900;
}

.file-drop {
  min-height: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 18px;
  cursor: pointer;
  border: 1px dashed #777478;
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  text-align: center;
  transition: border-color .2s, background .2s, transform .2s;
}
.file-drop:hover { border-color: var(--yellow); background: rgba(255, 189, 0, .06); transform: translateY(-1px); }
.file-drop svg { width: 28px; height: 28px; margin-bottom: 4px; fill: none; stroke: var(--yellow); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.file-drop strong { font-size: .94rem; }
.file-drop span { color: #c7c5c8; font-size: .78rem; }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.file-status { display: flex; align-items: center; gap: 10px; margin-top: 14px; min-width: 0; }
.file-status > div { min-width: 0; display: grid; }
.file-status strong, .file-status small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-status strong { font-size: .83rem; }
.file-status small { color: #aaa8ab; font-size: .72rem; }
.file-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; background: var(--success); color: white; font-size: .74rem; font-weight: 900; }

.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field > span { color: #514d4a; font-size: .78rem; font-weight: 750; }
.grow { flex: 1; margin-bottom: 0; }

input, select {
  width: 100%; min-height: 45px; border: 1px solid #d8d0c8; border-radius: 11px; background: white;
  color: var(--graphite); padding: 0 12px; outline: none; transition: border-color .18s, box-shadow .18s;
}
input:focus, select:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(243, 108, 10, .12); }
input:disabled, select:disabled { background: #eeeae5; color: #8c8884; }

.input-suffix { display: flex; align-items: center; border: 1px solid #d8d0c8; border-radius: 11px; background: white; overflow: hidden; }
.input-suffix:focus-within { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(243, 108, 10, .12); }
.input-suffix input { min-width: 0; border: 0; box-shadow: none; }
.input-suffix span { padding: 0 13px; color: var(--orange-dark); font-weight: 800; }
.helper { margin: 2px 0 0; color: var(--gray); font-size: .76rem; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.zone-service-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px; align-items: end; }
.zone-card { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 14px 16px; border: 1px solid #ffbd75; border-radius: 14px; background: var(--orange-soft); }
.zone-card span { color: #7d5030; font-size: .76rem; font-weight: 750; }
.zone-card strong { min-width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--orange); color: white; font-size: 1.25rem; }
.service-field { margin-bottom: 0; }
.extra-row { display: flex; gap: 12px; align-items: end; margin-top: 17px; padding-top: 17px; border-top: 1px solid var(--line); }

.button {
  min-height: 45px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 11px;
  padding: 0 18px; cursor: pointer; font-weight: 800; transition: transform .18s, box-shadow .18s, background .18s;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.button-primary { background: var(--orange); color: white; box-shadow: 0 8px 20px rgba(243,108,10,.25); }
.button-primary:hover { background: var(--orange-dark); }
.button-secondary { border: 1px solid #cfbeae; background: white; color: var(--graphite); }
.button-secondary:hover { border-color: var(--orange); color: var(--orange-dark); }
.button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.catalog-panel { padding: 0; overflow: hidden; }
.catalog-panel summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; cursor: pointer; list-style: none; }
.catalog-panel summary::-webkit-details-marker { display: none; }
.catalog-panel summary > span:first-child { display: grid; }
.catalog-panel summary small { color: var(--gray); margin-top: 2px; }
.summary-action { color: var(--orange-dark); font-size: .8rem; font-weight: 800; }
.catalog-panel[open] .summary-action { font-size: 0; }
.catalog-panel[open] .summary-action::after { content: "Cerrar"; font-size: .8rem; }
html[lang="en"] .catalog-panel[open] .summary-action::after { content: "Close"; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; }
.catalog-wrap { max-height: 450px; overflow: auto; margin: 0 24px 24px; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th { position: sticky; top: 0; z-index: 1; padding: 12px; background: #353336; color: white; text-align: left; font-size: .73rem; letter-spacing: .03em; text-transform: uppercase; }
td { padding: 11px 12px; border-bottom: 1px solid #eee8e2; vertical-align: middle; }
tbody tr:nth-child(even) { background: #fffaf4; }
tbody tr:last-child td { border-bottom: 0; }
.numeric { text-align: right; }
.center { text-align: center; }
td input[type="number"] { min-width: 110px; min-height: 38px; text-align: right; }
td input[type="checkbox"] { width: 18px; min-height: 18px; accent-color: var(--orange); }
.concept-cell strong { display: block; }
.concept-cell small { color: var(--gray); }
.remove-extra { border: 0; background: transparent; color: var(--danger); cursor: pointer; font-weight: 800; }
.empty-state { padding: 28px; border: 1px dashed #d8d0c8; border-radius: 13px; color: var(--gray); text-align: center; }

.results { padding: 26px; color: white; background: linear-gradient(145deg, #2e2c2f, #1f1e20); border-color: #3f3d40; overflow: hidden; position: relative; }
.results::after { content: ""; position: absolute; right: -85px; top: -120px; width: 290px; height: 290px; border: 45px solid rgba(255,189,0,.08); border-radius: 50%; pointer-events: none; }
.results-heading { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.results-heading h2 { margin: 3px 0 0; font-size: 1.45rem; }
.results .eyebrow { color: var(--yellow); }
.metric-grid { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-top: 22px; }
.metric-grid article { min-height: 104px; display: flex; flex-direction: column; justify-content: center; padding: 16px; border: 1px solid #4b494d; border-radius: 13px; background: rgba(255,255,255,.035); }
.metric-grid span { color: #c7c4c8; font-size: .76rem; }
.metric-grid strong { margin-top: 5px; font-size: 1.23rem; }
.metric-grid small { margin-top: 3px; color: var(--yellow); }
.final-total { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 13px; padding: 20px 22px; border-radius: 14px; background: linear-gradient(110deg, var(--orange), #f68915); }
.final-total > div { display: grid; }
.final-total span { font-weight: 800; }
.final-total small { color: #ffe7d3; }
.final-total strong { font-size: clamp(1.65rem, 3vw, 2.35rem); letter-spacing: -.03em; }

.alert { margin-top: 18px; padding: 14px 17px; border: 1px solid #f2b8b5; border-radius: 12px; background: #fff0ef; color: var(--danger); font-weight: 650; }
.alert.success { border-color: #a8dbc8; background: #ecfaf4; color: #176947; }

.loading-overlay { position: fixed; inset: 0; z-index: 999; display: grid; place-content: center; justify-items: center; gap: 14px; background: rgba(31,30,32,.92); color: white; transition: opacity .22s, visibility .22s; }
.loading-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader { width: 44px; height: 44px; border: 4px solid rgba(255,255,255,.2); border-top-color: var(--yellow); border-right-color: var(--orange); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

footer { min-height: 110px; display: flex; align-items: center; justify-content: center; gap: 28px; padding: 24px; border-top: 1px solid var(--line); background: white; color: var(--gray); }
footer img { width: 180px; }
footer p { margin: 0; font-size: .82rem; }

.mode-switch {
  display: inline-flex;
  align-items: center;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f3eee8;
}

.mode-button {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  padding: 0 17px;
  background: transparent;
  color: var(--gray);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 800;
}

.mode-button.active { background: var(--graphite); color: white; box-shadow: 0 4px 12px rgba(41,40,42,.18); }
.mode-button:last-child.active { background: var(--orange); }

.session-badge { display: flex; align-items: center; gap: 10px; font-size: .8rem; font-weight: 750; }
.session-badge[hidden] { display: none; }
.session-badge span::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--success); }
.session-badge button { border: 0; background: transparent; color: var(--orange-dark); cursor: pointer; font-weight: 800; }

.mode-client .internal-only { display: none !important; }
.mode-internal .client-only, .mode-internal .client-step { display: none !important; }
.mode-client .workspace { grid-template-columns: minmax(0, 1fr); }
.mode-client .content { max-width: 1120px; width: 100%; margin: 0 auto; }
.mode-client .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mode-client .results { max-width: 1120px; }

.button-save { width: 100%; margin-top: 15px; background: var(--yellow); color: #3b310e; }
.button-save:hover { background: #ffc928; }
.storage-status { display: block; margin-top: 9px; color: #c7c5c8; line-height: 1.35; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(29, 28, 30, .76);
  backdrop-filter: blur(5px);
}
.modal[hidden] { display: none; }
.login-card { width: min(440px, 100%); padding: 30px; border-radius: 20px; background: white; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.login-card > img { width: 190px; margin-bottom: 24px; }
.login-card h2 { margin: 4px 0 5px; font-size: 1.8rem; }
.login-card > p:not(.eyebrow) { margin: 0 0 22px; color: var(--gray); }
.login-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.login-error { margin-top: 10px; padding: 10px 12px; border-radius: 9px; background: #fff0ef; color: var(--danger); font-size: .82rem; font-weight: 650; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 1fr; }
  .sidebar { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-inner { flex-wrap: wrap; padding: 12px 0; }
  .topbar-controls { flex: 1; flex-wrap: wrap; }
  .session-badge { width: 100%; justify-content: flex-end; }
}

@media (max-width: 720px) {
  .topbar-inner, .page { width: min(100% - 24px, 1460px); }
  .topbar-inner { min-height: 76px; }
  .brand-logo { width: 176px; }
  .topbar-label { display: none; }
  .topbar-controls { width: 100%; justify-content: space-between; }
  .language-switch { order: 1; }
  .mode-switch { order: 3; width: 100%; }
  .mode-button { flex: 1; }
  .page { margin-top: 14px; }
  .hero { min-height: 0; padding: 28px 24px; }
  .hero-mark { display: none; }
  .sidebar { grid-template-columns: 1fr; }
  .panel, .results { padding: 19px; }
  .form-grid, .zone-service-row { grid-template-columns: 1fr; }
  .extra-row, .results-heading, .final-total { align-items: stretch; flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr; }
  .catalog-panel { padding: 0; }
  .catalog-wrap { margin: 0 16px 18px; }
  footer { flex-direction: column; gap: 8px; }
  .login-actions { flex-direction: column-reverse; }
}
