* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #1e1e24;
    color: #e0e0e0;
}

#app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

#sidebar {
    width: 320px;
    background-color: #2b2d42;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.subtitle {
    font-size: 0.85rem;
    color: #8d99ae;
}

/* Estilos de Pestañas */
.nav-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    background: #1d1e2c;
    padding: 4px;
    border-radius: 6px;
}

.tab-btn {
    flex: 1 1 auto;
    background: transparent;
    border: none;
    color: #8d99ae;
    padding: 8px 1px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #4cc9f0;
    color: #0f172a;
}

.view-content {
    display: none;
    flex-direction: column;
    gap: 15px;
}

.view-content.active {
    display: flex;
}

.form-group {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.85rem;
}

.form-group input,
.form-group select {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #4a4e69;
    background: #121214;
    color: #fff;
    font-size: 0.9rem;
}

.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary {
    background-color: #4cc9f0;
    color: #0f172a;
}

.btn-primary:hover {
    background-color: #3a0ca3;
    color: #fff;
}

.info-card, .legend {
    background: #1d1e2c;
    padding: 15px;
    border-radius: 8px;
}

.info-card h3, .legend h3 {
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: #f72585;
}

.info-card ul {
    list-style: none;
    font-size: 0.85rem;
}

.info-card li {
    margin-bottom: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.color-box {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    display: inline-block;
}

/* Colores idénticos a CONFIG.COLORS en js/config.js */
.color-box.res { background: #64748b; }
.color-box.edu { background: #eab308; }
.color-box.inst { background: #f97316; }
.color-box.health { background: #ef4444; }
.color-box.gov { background: #a855f7; }
.color-box.worship { background: #b45309; }
.color-box.market { background: #0d9488; }
.color-box.green { background: #22c55e; }
.color-box.road { background: #334155; }
.color-box.panaderia { background: #f59e0b; }
.color-box.farmacia { background: #34d399; }
.color-box.bar { background: #f472b6; }
.color-box.tienda { background: #22d3ee; }
.color-box.plaza { background: #e2d5ae; }
.color-box.sidewalk { background: #a8b3c4; }
.color-box.garage { background: #38bdf8; border-radius: 50%; }

.warning {
    margin-top: 10px;
    padding: 8px;
    border-radius: 4px;
    background: #4a1d2a;
    color: #ffb3c1;
    font-size: 0.8rem;
}

#sidebar { overflow-y: auto; }

#canvas-container {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #121214;
    padding: 20px;
}

#city-canvas {
    background-color: #e9ecef;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    border-radius: 4px;
}
/* Pestaña Población */
.pyr-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.pyr-label { width: 42px; font-size: 0.75rem; color: #8d99ae; text-align: right; }
.pyr-track { flex: 1; display: flex; justify-content: center; height: 14px; background: #262838; border-radius: 3px; }
.pyr-bar { height: 100%; background: #4cc9f0; border-radius: 3px; }
.pyr-input { width: 58px; padding: 3px 4px; border-radius: 4px; border: 1px solid #4a4e69; background: #121214; color: #fff; font-size: 0.8rem; }
.pyr-unit { font-size: 0.75rem; color: #8d99ae; }
.pct-sum { margin: 8px 0; font-size: 0.8rem; }
.pct-sum.ok { color: #86efac; }
.pct-sum.bad { color: #ffb3c1; }
.btn-row { display: flex; gap: 8px; }
.btn-secondary { background: #3a3d5c; color: #e0e0e0; padding: 8px; font-size: 0.8rem; }
.btn-secondary:hover { background: #4a4e69; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.data-table th { text-align: left; color: #8d99ae; font-weight: 600; padding: 3px 4px; }
.data-table td { padding: 3px 4px; border-top: 1px solid #2b2d42; }
.data-table th:not(:first-child), .data-table td:not(:first-child) { text-align: right; }
.data-table tr.total td { font-weight: 700; border-top: 1px solid #4a4e69; }
.data-table small { color: #8d99ae; }


.color-box.bike { background: #1d4ed8; }
.hint { font-size: 0.75rem; color: #8d99ae; margin: 0 0 10px; }

.bad { color: #ff6b6b; }
#hs-headship .pyr-row { grid-template-columns: 56px 1fr 14px; }
#hs-headship .pyr-label { white-space: nowrap; }
#hs-headship .pyr-input { width: 100%; }

#calc-content .info-card { margin-bottom: 12px; }
#calc-content .data-table td:last-child { text-align: right; }
code { font-size: 0.78rem; }

#opt-chart { width: 100%; height: 110px; background: #1b1d33; border: 1px solid #2b2d42; border-radius: 4px; margin-bottom: 8px; }
#opt-result .data-table { margin-bottom: 8px; }
#opt-result .btn-row { margin-bottom: 8px; }
#opt-run-btns { margin-bottom: 8px; }
[hidden] { display: none !important; }
#opt-table td { white-space: nowrap; }

#canvas-container { position: relative; }
#view3d { position: absolute; inset: 0; background: #cfe3f3; overflow: hidden; }
#view3d canvas { display: block; }
#toolbar3d { position: absolute; top: 12px; left: 12px; z-index: 5; display: flex; gap: 6px; }
#toolbar3d .btn { width: auto; padding: 8px 12px; background: rgba(30, 30, 36, 0.85); }
#help3d { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 5; background: rgba(30, 30, 36, 0.85); color: #e0e0e0; font-size: 0.8rem; padding: 6px 12px; border-radius: 6px; pointer-events: none; }

/* ---- Asistente inicial (js/wizard.js) ---- */
.wz-screen { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(ellipse at 50% 45%, rgba(20,22,34,.45), rgba(20,22,34,.78) 95%), linear-gradient(rgba(20,22,34,.28), rgba(20,22,34,.28)), #1e1e24 url(../assets/fondo.jpg) center / cover no-repeat; }
.wz-screen.hidden-wz { display: none; }
.wz-center { text-align: center; }
.wz-title { font-size: 4rem; color: #fff; letter-spacing: .04em; text-shadow: 0 2px 24px rgba(0,0,0,.6); }
.wz-sub { color: #e3e8f0; text-shadow: 0 1px 12px rgba(0,0,0,.7); font-size: 1.25rem; margin: 10px 0 44px; }
.wz-card { width: min(640px, 92vw); background: #2b2d42; border-radius: 16px; padding: 36px 44px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.wz-step { color: #8d99ae; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }
.wz-dots { display: flex; gap: 6px; margin: 10px 0 28px; }
.wz-dots i { height: 5px; flex: 1; border-radius: 3px; background: #3d405b; }
.wz-dots i.on { background: #4cc9f0; }
.wz-card h2 { font-size: 1.6rem; color: #fff; margin-bottom: 6px; }
.wz-q { color: #8d99ae; margin-bottom: 30px; line-height: 1.4; }
.wz-val { display: flex; align-items: baseline; justify-content: center; gap: 10px; margin-bottom: 18px; }
.wz-val input { width: 8ch; min-width: 4ch; background: transparent; border: 0; border-bottom: 2px solid transparent; color: #4cc9f0;
    font-size: 4rem; font-weight: 600; text-align: center; field-sizing: content; outline: none; }
.wz-val input:focus { border-bottom-color: #4cc9f0; }
.wz-val span { font-size: 1.25rem; color: #8d99ae; }
#wz-range { width: 100%; accent-color: #4cc9f0; height: 6px; cursor: pointer; }
.wz-lim { display: flex; justify-content: space-between; color: #8d99ae; font-size: .75rem; margin-top: 12px; }
.wz-hint { margin-top: 24px; background: #23253a; border-radius: 10px; padding: 12px 16px; font-size: .85rem; color: #8d99ae; line-height: 1.45; }
.wz-row { display: flex; justify-content: space-between; margin-top: 30px; }
.wz-btn { padding: 12px 26px; border-radius: 10px; font-size: 1rem; border: 0; cursor: pointer; }
.wz-sec { background: #3d405b; color: #e0e0e0; }
.wz-pri { background: #4cc9f0; color: #13141a; font-weight: 600; }
.wz-big { padding: 16px 44px; font-size: 1.15rem; border-radius: 12px; }
.wz-link { display: block; margin: 18px auto 0; background: none; border: 0; color: #8d99ae; cursor: pointer; font-size: .8rem; text-decoration: underline; }
#wz-summary table { width: 100%; border-collapse: collapse; }
#wz-summary td { padding: 10px 4px; border-bottom: 1px solid #3d405b; }
#wz-summary td:last-child { text-align: right; color: #4cc9f0; font-weight: 600; }
.wz-val input::-webkit-outer-spin-button, .wz-val input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.wz-val input { -moz-appearance: textfield; appearance: textfield; }

#auto-banner { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 16px;
    background: #2b2d42; border: 1px solid #4cc9f0; color: #e0e0e0; padding: 10px 14px 10px 20px; border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.5); }
#auto-banner b { color: #4cc9f0; }
#auto-banner .wz-btn { padding: 6px 14px; font-size: .85rem; }

/* ---- Pantalla de resumen (js/summary.js) ---- */
.sm-screen { position: fixed; inset: 0; z-index: 90; overflow: auto; background: #10131c; color: #fff; }
.sm-bg { position: fixed; inset: 0; background: #1b2233 center/cover; filter: blur(6px) brightness(.45) saturate(1.1); transform: scale(1.04); }
.sm-shade { position: fixed; inset: 0; background: linear-gradient(180deg, rgba(16,19,28,.55), rgba(16,19,28,.92)); }
.sm-wrap { position: relative; max-width: 1280px; margin: 0 auto; padding: 34px 56px; }
.sm-top { display: flex; justify-content: space-between; align-items: center; color: #9fb0c8; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; }
.sm-x { background: rgba(255,255,255,.12); border: 0; padding: 8px 16px; border-radius: 20px; color: #fff; cursor: pointer; letter-spacing: 0; text-transform: none; font-size: .85rem; }
.sm-wrap h1 { font-size: clamp(1.8rem, 3.6vw, 3.1rem); line-height: 1.1; margin: 22px 0 6px; font-weight: 700; }
.sm-wrap h1 em { font-style: normal; color: #5eead4; }
.sm-sub { color: #b8c4d8; font-size: 1.15rem; margin-bottom: 26px; }
.sm-card { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); backdrop-filter: blur(10px); border-radius: 18px; padding: 20px 22px; }
.sm-hero { display: flex; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.sm-big { flex: 1.5 1 420px; background: linear-gradient(135deg, rgba(94,234,212,.22), rgba(76,201,240,.12)); border-color: rgba(94,234,212,.5); }
.sm-big .sm-n { font-size: clamp(3.4rem, 6vw, 5.2rem); font-weight: 700; color: #5eead4; line-height: 1; }
.sm-big .sm-n small { font-size: 2rem; }
.sm-t { font-size: 1.25rem; margin-top: 6px; }
.sm-s { color: #b8c4d8; font-size: .9rem; margin-top: 8px; }
.sm-k { flex: 1 1 220px; }
.sm-i { font-size: 1.6rem; margin-bottom: 6px; }
.sm-n2 { font-size: clamp(1.7rem, 2.6vw, 2.6rem); font-weight: 700; line-height: 1.05; }
.sm-l { color: #b8c4d8; font-size: .9rem; margin-top: 6px; line-height: 1.35; }
.sm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.sm-bars { margin-top: 14px; }
.sm-r { display: flex; align-items: center; gap: 10px; font-size: .8rem; color: #cfd8e6; margin: 5px 0; }
.sm-r span { width: 110px; } .sm-r b { width: 62px; text-align: right; color: #fff; }
.sm-b { flex: 1; height: 8px; border-radius: 4px; background: rgba(255,255,255,.12); position: relative; }
.sm-b i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: #5eead4; }
.sm-foot { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 20px; color: #8fa0b8; font-size: .75rem; }
.sm-btns { display: flex; gap: 10px; }
.sm-btn { padding: 11px 22px; border-radius: 12px; background: #5eead4; color: #0b1b1a; font-weight: 600; font-size: .9rem; border: 0; cursor: pointer; }
.sm-btn.sm-s2 { background: rgba(255,255,255,.14); color: #fff; }

/* ---- Pantalla de progreso tras el asistente ---- */
.wz-run { width: min(680px, 94vw); }
.wz-run h2 { font-size: 1.5rem; color: #fff; margin: 6px 0 22px; }
.wz-steps { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.wz-steps li { display: flex; gap: 14px; align-items: flex-start; color: #6b7390; transition: color .3s; }
.wz-steps li > div { flex: 1; min-width: 0; }
.wz-steps li > div > b { display: block; font-weight: 500; }
.wz-steps li span b { color: #4cc9f0; font-weight: 600; }
.wz-steps li span { display: block; font-size: .85rem; margin-top: 2px; color: #8d99ae; min-height: 1em; }
.wz-steps li i { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #3d405b; margin-top: 1px; box-sizing: border-box; }
.wz-steps li.run { color: #fff; }
.wz-steps li.run i { border-color: #4cc9f0; border-top-color: transparent; animation: wzspin .9s linear infinite; }
.wz-steps li.done { color: #e0e0e0; }
.wz-steps li.done i { background: #4cc9f0 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='%232b2d42' stroke-width='3'/%3E%3C/svg%3E") center / 80% no-repeat; border-color: #4cc9f0; }
.wz-prog { height: 6px; background: #3d405b; border-radius: 3px; margin: 10px 0 8px; overflow: hidden; }
#wz-progbar { height: 100%; width: 0; background: #4cc9f0; transition: width .25s; }
#wz-chart { width: 100%; height: auto; background: #23253a; border-radius: 8px; }
@keyframes wzspin { to { transform: rotate(360deg); } }

/* ---- Ventana de exportación ---- */
.ex-screen { position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center; background: rgba(10,12,20,.65); }
.ex-screen[hidden] { display: none; }
.ex-card { width: min(640px, 94vw); max-height: 94vh; overflow: auto; background: #2b2d42; color: #e0e0e0; border-radius: 16px; padding: 28px 30px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.ex-card h2 { color: #fff; font-size: 1.4rem; margin-bottom: 6px; }
.ex-sub { color: #8d99ae; font-size: .85rem; line-height: 1.4; margin-bottom: 16px; }
.ex-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.ex-item { text-align: left; background: #23253a; border: 1px solid #3d405b; color: #fff; border-radius: 10px; padding: 10px 14px; cursor: pointer; font: inherit; }
.ex-item:hover:not(:disabled) { border-color: #4cc9f0; }
.ex-item span { display: block; color: #8d99ae; font-size: .8rem; margin-top: 2px; }
.ex-msg { min-height: 1.2em; color: #4cc9f0; font-size: .85rem; margin-bottom: 10px; }
.ex-loc { margin-bottom: 16px; }
.ex-coords { color: #8d99ae; font-size: .8rem; margin-top: 6px; min-height: 1.2em; }
.ex-viewbtn { width: 100%; margin-top: 8px; }
.mv-screen { position: fixed; inset: 0; z-index: 140; background: #11131c; color: #e0e0e0; }
.mv-screen[hidden] { display: none; }
.mv-top { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: rgba(27,29,45,.92); }
.mv-top input { flex: 0 1 320px; background: #23253a; border: 1px solid #3d405b; color: #fff; border-radius: 8px; padding: 8px 12px; font: inherit; }
.mv-msg { flex: 1; color: #8d99ae; font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#mv-map { position: absolute; inset: 0; }
.mv-panel { position: absolute; left: 16px; bottom: 28px; z-index: 3; width: 290px; background: rgba(27,29,45,.92); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; font-size: .85rem; }
.mv-lay { display: flex; gap: 12px; flex-wrap: wrap; }
.mv-lay label { cursor: pointer; }
.mv-rot { display: flex; align-items: center; gap: 8px; color: #8d99ae; }
.mv-rot input { flex: 1; accent-color: #4cc9f0; min-width: 0; }
.mv-coords { color: #8d99ae; font-size: .8rem; }
.mv-hint { color: #8d99ae; font-size: .78rem; line-height: 1.35; }
.mv-screen .maplibregl-ctrl-top-right { top: 58px; }
.sm-mapband { display: flex; align-items: center; gap: 18px; width: 100%; margin: 14px 0 6px; padding: 18px 24px; border: 0; border-radius: 16px; cursor: pointer; text-align: left; color: #fff;
  background: linear-gradient(100deg, #e63946, #ff7a3d); box-shadow: 0 8px 26px rgba(230,57,70,.35); font: inherit; }
.sm-mapband:hover { filter: brightness(1.08); transform: translateY(-1px); }
.sm-mapband b { display: block; font-size: 1.15rem; }
.sm-mapband small { display: block; font-size: .85rem; opacity: .92; margin-top: 2px; }
.sm-mi { font-size: 2rem; }
.sm-ma { margin-left: auto; font-size: 1.8rem; }

/* Selector de idioma (js/i18n.js): pequeño, fijo arriba a la derecha y por encima de todas las pantallas */
#lang-select { position: fixed; top: 10px; right: 12px; z-index: 200; appearance: none; -webkit-appearance: none;
    background: rgba(27, 29, 45, .82) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%239fb0c8'/%3E%3C/svg%3E") no-repeat right 8px center;
    color: #e6ebf5; border: 1px solid rgba(159, 176, 200, .35); border-radius: 8px; padding: 4px 22px 4px 9px;
    font: 600 .75rem/1.2 system-ui, sans-serif; letter-spacing: .04em; cursor: pointer; }
#lang-select:hover, #lang-select:focus-visible { border-color: #4cc9f0; outline: none; }
#lang-select option { background: #1b1d2d; color: #e6ebf5; }
.mv-top { padding-right: 76px; }
.sm-top { padding-right: 64px; }

/* v1.3: resumen un 10 % más pequeño y banda del mapa bajo el título */
.sm-wrap { zoom: .9; }
.sm-wrap .sm-mapband { margin: 16px 0 20px; }

/* v1.4: tarjetas del resumen clicables y tabla de servicios desplegable */
.sm-card[data-go] { cursor: pointer; transition: transform .15s ease, border-color .15s ease, background-color .15s ease; }
.sm-card[data-go]:hover, .sm-card[data-go]:focus-visible { transform: translateY(-2px); border-color: rgba(94, 234, 212, .7); outline: none; }
.sm-tblwrap { margin: 4px 0 18px; }
.sm-tblbtn { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); color: #e6ebf5; border-radius: 12px; padding: 10px 18px; font: 600 .92rem/1.2 inherit; cursor: pointer; }
.sm-tblbtn:hover, .sm-tblbtn:focus-visible { border-color: #5eead4; outline: none; }
.sm-tbl { margin-top: 12px; background: rgba(20, 24, 36, .82); border: 1px solid rgba(255,255,255,.1); border-radius: 16px; padding: 14px 18px; overflow-x: auto; }
.sm-tbl[hidden] { display: none; }
.sm-tbl table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
.sm-tbl th { text-align: right; color: #9fb0c8; font-weight: 600; font-size: .78rem; padding: 6px 10px; border-bottom: 1px solid rgba(255,255,255,.14); }
.sm-tbl td { text-align: right; padding: 7px 10px; border-bottom: 1px solid rgba(255,255,255,.06); }
.sm-tbl th:first-child, .sm-tbl td:first-child { text-align: left; }
.sm-tbl td small { color: #9fb0c8; }
.sm-tbl .sm-tot td { font-weight: 700; border-bottom: 0; }
.sm-tbl p { margin: 10px 0 0; color: #9fb0c8; font-size: .78rem; }

/* v1.8: móvil y pantallas estrechas. El plano (2D/3D) va arriba y el panel lateral debajo; la página se desplaza. */
@media (max-width: 800px), (max-height: 520px) and (max-width: 1000px) {
    body, html { height: auto; overflow: auto; }
    #app-container { flex-direction: column; width: 100%; height: auto; min-height: 100vh; }
    #canvas-container { order: -1; flex: none; width: 100%; height: 62vh; height: 62svh; min-height: 340px; padding: 10px; }
    #sidebar { width: 100%; overflow-y: visible; box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3); padding: 16px; }
    #toolbar3d { flex-wrap: wrap; right: 64px; }
    #toolbar3d .btn { padding: 6px 9px; font-size: .8rem; }
    #help3d { width: max-content; max-width: calc(100% - 24px); white-space: normal; text-align: center; }
}
