/* ==================================================================
   TEVALCOR · Panel de administración
   ================================================================== */
:root{
  --brand:#7a1f2b;          /* granate corporativo */
  --brand-dark:#5c1620;
  --brand-soft:#f6ecee;
  --ink:#1d1d1f;
  --muted:#6b7280;
  --line:#e5e7eb;
  --bg:#f3f4f6;
  --card:#ffffff;
  --ok:#15803d;
  --off:#9ca3af;
  --danger:#b91c1c;
  --radius:10px;
}
*{box-sizing:border-box;margin:0;padding:0;}
[hidden]{display:none !important;}
body{font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;background:var(--bg);color:var(--ink);font-size:14px;}
button{font:inherit;cursor:pointer;}
input,select,textarea{font:inherit;padding:7px 10px;border:1px solid var(--line);border-radius:7px;background:#fff;width:100%;}
textarea{resize:vertical;max-width:100%;min-height:38px;}
input:focus:not([type="checkbox"]),select:focus,textarea:focus{outline:2px solid var(--brand);outline-offset:1px;border-color:var(--brand);}
label{font-size:12px;font-weight:600;color:var(--muted);display:block;margin-bottom:4px;}
h2{font-size:19px;margin-bottom:14px;}
h3{font-size:15px;margin:16px 0 8px;}

/* ---------- Login ---------- */
.login-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;background:linear-gradient(160deg,var(--brand) 0%,var(--brand-dark) 100%);}
.login-card{background:#fff;border-radius:14px;padding:36px;width:360px;box-shadow:0 20px 60px rgba(0,0,0,.35);}
.login-card .logo{font-size:24px;font-weight:800;letter-spacing:.5px;color:var(--brand);margin-bottom:2px;}
.login-card .sub{color:var(--muted);font-size:13px;margin-bottom:22px;}
.login-card .field{margin-bottom:14px;}
.login-card .forgot{background:none;border:none;color:var(--brand);font-size:12px;margin-top:12px;text-decoration:underline;}

/* ---------- Layout con sidebar ---------- */
.app{display:flex;min-height:100vh;}
.sidebar{width:210px;background:var(--brand-dark);color:#fff;display:flex;flex-direction:column;position:sticky;top:0;height:100vh;}
.sidebar .logo{padding:20px 18px;font-weight:800;font-size:18px;letter-spacing:.5px;border-bottom:1px solid rgba(255,255,255,.12);}
.sidebar .logo small{display:block;font-weight:400;font-size:10.5px;opacity:.75;letter-spacing:1.4px;margin-top:2px;}
.sidebar nav{flex:1;padding:12px 8px;display:flex;flex-direction:column;gap:2px;}
.sidebar nav button{background:none;border:none;color:rgba(255,255,255,.82);text-align:left;padding:10px 12px;border-radius:8px;font-size:13.5px;display:flex;align-items:center;gap:9px;}
.sidebar nav button:hover{background:rgba(255,255,255,.08);}
.sidebar nav button.active{background:rgba(255,255,255,.16);color:#fff;font-weight:600;}
.sidebar .whoami{padding:14px 16px;border-top:1px solid rgba(255,255,255,.12);font-size:12px;line-height:1.5;}
.sidebar .whoami b{display:block;}
.sidebar .whoami button{background:none;border:none;color:rgba(255,255,255,.65);text-decoration:underline;font-size:11.5px;padding:0;margin-top:4px;}

.main{flex:1;padding:24px 28px;max-width:1200px;}
body.map-tab-active .main{max-width:none;padding:16px 18px;}
body.map-tab-active #tab-map{height:calc(100vh - 32px);display:flex;flex-direction:column;}

/* ---------- Componentes ---------- */
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:18px;margin-bottom:16px;}
.famtag{font-size:10px;font-weight:700;color:var(--brand);background:var(--brand-soft);border-radius:4px;padding:2px 6px;display:inline-block;}
details > summary{cursor:pointer;list-style:none;}
details > summary::-webkit-details-marker{display:none;}
details > summary .hint{margin-top:0;}
.cfg-section{padding:0;overflow:hidden;}
.cfg-section > summary,
.subsection > summary,
.picker-family > summary,
.product-spec-card > summary{display:flex;align-items:center;justify-content:space-between;gap:12px;}
.cfg-section > summary{padding:14px 18px;font-weight:800;color:var(--brand);}
.cfg-section > summary::after,
.subsection > summary::after,
.picker-family > summary::after,
.product-spec-card > summary::after{content:"⌄";color:var(--muted);font-size:15px;transition:transform .15s;}
.cfg-section[open] > summary::after,
.subsection[open] > summary::after,
.picker-family[open] > summary::after,
.product-spec-card[open] > summary::after{transform:rotate(180deg);}
.cfg-content{border-top:1px solid var(--line);padding:16px 18px 18px;}
.subsection{border:1px solid var(--line);border-radius:8px;background:#fff;margin-bottom:8px;overflow:hidden;}
.subsection > summary{padding:10px 12px;font-weight:700;}
.subsection-body{border-top:1px solid var(--line);padding:0;}
.toolbar{display:flex;gap:10px;flex-wrap:wrap;align-items:end;margin-bottom:14px;}
.toolbar .field{min-width:150px;flex:0 1 auto;}
.toolbar .grow{flex:1;min-width:200px;}
.project-order-actions{display:flex;align-items:flex-end;gap:10px;}
.project-order-actions > .btn{margin-bottom:12px;}
.page-title-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;}
.page-title-row h2{margin:0;}
.filter-chips{display:flex;gap:7px;flex-wrap:wrap;align-items:center;margin:-2px 0 12px;}
.filter-chip{border:1px solid var(--line);background:#fff;color:var(--brand);border-radius:999px;padding:5px 9px;font-size:12px;font-weight:800;}
.filter-chip:hover{background:var(--brand-soft);}
.filter-chip.clear{color:var(--muted);}
.project-row-actions{white-space:nowrap;display:flex;gap:6px;align-items:center;}
.autosave-state{align-self:center;color:var(--muted);font-size:12px;font-weight:700;}
.project-detail-history{border:1px solid var(--line);border-radius:16px;background:#fff;max-height:260px;overflow:auto;padding:10px;}
.history-list{display:grid;gap:8px;}
.history-event{border:1px solid #dbeefa;border-radius:14px;background:linear-gradient(180deg,#fff,#f7fbff);padding:10px 12px;}
.history-event>div{display:flex;justify-content:space-between;gap:10px;color:var(--brand);}
.history-event span,.history-event small{color:var(--muted);font-size:11px;font-weight:700;}
.history-event p{margin:6px 0;color:#37536c;font-size:12px;}
.history-event code{display:block;background:#eef7ff;border:1px solid #d4eaff;border-radius:10px;padding:6px 8px;color:#0e2946;white-space:pre-wrap;}
.btn{background:var(--brand);color:#fff;border:none;border-radius:8px;padding:9px 16px;font-weight:600;font-size:13.5px;}
.btn:hover{background:var(--brand-dark);}
.btn.secondary{background:#fff;color:var(--ink);border:1px solid var(--line);}
.btn.secondary:hover{background:var(--bg);}
.btn.danger{background:#fff;color:var(--danger);border:1px solid #f3c6c6;}
.btn.danger:hover{background:#fef2f2;}
.btn.small{padding:5px 10px;font-size:12px;}

table.list{width:100%;border-collapse:collapse;}
table.list th{font-size:11px;text-transform:uppercase;letter-spacing:.5px;color:var(--muted);text-align:left;padding:8px 10px;border-bottom:1px solid var(--line);}
table.list td{padding:9px 10px;border-bottom:1px solid var(--line);vertical-align:middle;}
table.list tr.rowlink{cursor:pointer;}
table.list tr.rowlink:hover{background:var(--brand-soft);}
tr.off td{opacity:.45;}                    /* proyecto desactivado: grisáceo */
tr.off td.keep{opacity:1;}                 /* el interruptor se ve normal */

.chip{display:inline-flex;align-items:center;gap:5px;font-size:11.5px;font-weight:600;padding:3px 9px;border-radius:99px;background:var(--bg);white-space:nowrap;}
.chip .dot{width:8px;height:8px;border-radius:50%;}
.badge{display:inline-block;font-size:10.5px;font-weight:700;letter-spacing:.4px;padding:2px 7px;border-radius:5px;margin-right:3px;}
.badge.gv{background:#eef2ff;color:#3730a3;}
.badge.taga{background:#ecfdf5;color:#065f46;}

/* interruptor on/off */
.switch{position:relative;width:38px;height:21px;display:inline-block;flex:none;}
.switch input{opacity:0;width:0;height:0;}
.switch .track{position:absolute;inset:0;background:var(--off);border-radius:99px;transition:.15s;}
.switch .track::after{content:"";position:absolute;left:2.5px;top:2.5px;width:16px;height:16px;background:#fff;border-radius:50%;transition:.15s;}
.switch input:checked + .track{background:var(--ok);}
.switch input:checked + .track::after{transform:translateX(17px);}

.thumb{width:52px;height:38px;object-fit:cover;border-radius:6px;border:1px solid var(--line);background:var(--bg);display:block;}

/* ---------- Modal ---------- */
dialog{border:none;border-radius:14px;padding:0;width:min(880px,94vw);max-height:92vh;box-shadow:0 24px 80px rgba(0,0,0,.3);}
#dlg-project{width:min(980px,96vw);max-height:94vh;margin:auto;}
dialog::backdrop{background:rgba(20,10,12,.45);}
dialog .dlg-head{display:flex;justify-content:space-between;align-items:center;padding:16px 22px;border-bottom:1px solid var(--line);position:sticky;top:0;background:#fff;z-index:2;border-radius:14px 14px 0 0;}
dialog .dlg-head h2{margin:0;font-size:17px;}
dialog .dlg-body{padding:20px 22px;overflow:auto;}
dialog .dlg-foot{display:flex;justify-content:space-between;gap:10px;padding:14px 22px;border-top:1px solid var(--line);position:sticky;bottom:0;background:#fff;border-radius:0 0 14px 14px;}
.close-x{background:none;border:none;font-size:20px;color:var(--muted);line-height:1;}

.grid2{display:grid;grid-template-columns:1fr 1fr;gap:12px;}
.grid3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:12px;}
.field{margin-bottom:12px;}
.checkrow{display:flex;align-items:center;gap:8px;font-size:13.5px;}
.checkrow input{width:auto;}
.hint{font-size:11.5px;color:var(--muted);margin-top:3px;}
.section-label{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.8px;color:var(--brand);margin:20px 0 8px;padding-bottom:5px;border-bottom:2px solid var(--brand-soft);}

/* selector de productos agrupado por familia */
.prodpicker{border:1px solid var(--line);border-radius:8px;max-height:220px;overflow:auto;padding:8px;margin-bottom:16px;}
.prodpicker .fam{font-size:11px;font-weight:700;color:var(--muted);margin:8px 0 3px;letter-spacing:.5px;}
.prodpicker .fam:first-child{margin-top:0;}
.prodpicker label{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:400;color:var(--ink);padding:4px 6px;border-radius:6px;margin:0;}
.prodpicker label:hover{background:var(--bg);}
.prodpicker input{width:auto;}
.prodpicker .disc{color:var(--muted);font-style:italic;}
.picker-family{border:1px solid var(--line);border-radius:7px;margin-bottom:6px;background:#fff;overflow:hidden;}
.picker-family:last-child{margin-bottom:0;}
.picker-family > summary{padding:8px 10px;font-size:12px;font-weight:700;color:var(--muted);}
.picker-family-body{border-top:1px solid var(--line);padding:5px;}

#pe-prodspecs{padding-top:6px;}
.product-spec-card{border:1px solid var(--line);border-radius:8px;background:#fff;margin-top:12px;overflow:hidden;}
.product-spec-card > summary{padding:11px 13px;font-weight:700;}
.product-spec-body{border-top:1px solid var(--line);padding:10px 12px 12px;}

/* tabla de características */
table.chars{width:100%;border-collapse:collapse;}
table.chars th{font-size:11px;color:var(--muted);text-align:left;padding:6px 8px;border-bottom:1px solid var(--line);}
table.chars td{padding:6px 8px;border-bottom:1px solid var(--line);}
table.chars td input{padding:5px 8px;}
table.chars select.vis{width:auto;padding:4px 8px;font-size:12.5px;}
table.chars select.vis.on{color:var(--ok);font-weight:600;}
table.chars select.vis.forceoff{color:var(--danger);font-weight:600;}

/* fotos */
.dropzone{border:2px dashed var(--line);border-radius:10px;padding:22px;text-align:center;color:var(--muted);font-size:13px;transition:.15s;}
.dropzone.drag{border-color:var(--brand);background:var(--brand-soft);color:var(--brand);}
.photogrid{display:flex;flex-wrap:wrap;gap:10px;margin-top:12px;}
.photocard{width:132px;border:1px solid var(--line);border-radius:9px;overflow:hidden;background:#fff;cursor:grab;}
.photocard.dragging{opacity:.4;}
.photocard img{width:100%;height:88px;object-fit:cover;display:block;}
.photocard .pc-actions{display:flex;justify-content:space-between;padding:6px 8px;}
.photocard .pc-actions button{background:none;border:none;font-size:19px;color:var(--muted);padding:3px 6px;cursor:pointer;line-height:1;}
.photocard .pc-actions button:hover{color:var(--brand);}
.photocard.cover{outline:2px solid var(--brand);}
.photocard .coverlabel{font-size:9.5px;font-weight:700;color:var(--brand);text-align:center;background:var(--brand-soft);padding:2px;}
.photocard img{cursor:zoom-in;}
.project-product-photo-section{border:1px solid var(--line);border-radius:16px;background:#fff;padding:12px;margin:12px 0;}
.project-product-photo-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:10px 0 8px;}
.project-product-photo-drop{padding:14px;margin-top:10px;}
.project-product-photo-hint{margin:8px 0 4px;}
.product-photo-card{position:relative;}
.product-photo-card.is-photo-hidden{opacity:.55;filter:saturate(.35);}
.product-photo-card.is-photo-hidden img{filter:grayscale(.8);}
.product-photo-badge{position:absolute;left:7px;top:7px;z-index:1;font-size:9px;font-weight:800;letter-spacing:.4px;text-transform:uppercase;border-radius:999px;padding:3px 7px;background:rgba(255,255,255,.92);color:var(--brand);box-shadow:0 4px 12px rgba(7,55,99,.14);}
.product-photo-badge.project{color:#0f766e;}
.product-photo-badge.catalog{color:#6b7280;}
.admin-lightbox{position:fixed;inset:0;background:rgba(3,18,34,.82);display:none;align-items:center;justify-content:center;z-index:99999;padding:34px;}
.admin-lightbox.open{display:flex;}
.admin-lightbox img{max-width:min(1100px,92vw);max-height:86vh;object-fit:contain;border-radius:18px;box-shadow:0 25px 80px rgba(0,0,0,.45);background:#fff;}
.admin-lightbox-close,.admin-lightbox-nav{position:absolute;border:0;background:rgba(255,255,255,.92);color:var(--brand);box-shadow:0 12px 30px rgba(0,0,0,.25);cursor:pointer;}
.admin-lightbox-close{right:24px;top:22px;width:42px;height:42px;border-radius:999px;font-size:30px;line-height:1;}
.admin-lightbox-nav{top:50%;transform:translateY(-50%);width:48px;height:64px;border-radius:16px;font-size:44px;line-height:1;}
.admin-lightbox-nav.prev{left:28px;}
.admin-lightbox-nav.next{right:28px;}
.admin-lightbox-count{position:absolute;bottom:22px;left:50%;transform:translateX(-50%);background:rgba(255,255,255,.92);border-radius:999px;padding:7px 14px;font-size:12px;font-weight:800;color:var(--brand);}

/* mapa */
#adminmap{height:calc(100vh - 170px);min-height:520px;border-radius:var(--radius);border:1px solid var(--line);}
.mapfilters{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px;align-items:center;}
.mapfilters .chip{cursor:pointer;border:1px solid var(--line);background:#fff;}
.mapfilters .chip.inactive{opacity:.35;}

/* toasts */
#toast{position:fixed;bottom:22px;left:50%;transform:translateX(-50%);background:var(--ink);color:#fff;padding:10px 18px;border-radius:9px;font-size:13.5px;opacity:0;pointer-events:none;transition:.2s;z-index:99;}
#toast.show{opacity:1;}
#toast.err{background:var(--danger);}

.empty{color:var(--muted);text-align:center;padding:26px;font-size:13.5px;}
@media(max-width:820px){
  body.map-tab-active .main{padding:10px;}
  body.map-tab-active #tab-map{height:calc(100vh - 20px);}
  .client-preview{min-height:520px;}
  .sidebar{width:60px;}
  .sidebar .logo{font-size:11px;padding:14px 6px;text-align:center;}
  .sidebar .logo small,.sidebar nav button span,.sidebar .whoami{display:none;}
  .main{padding:14px;}
  .grid2,.grid3{grid-template-columns:1fr;}
}

/* Selector Vista cliente / Vista admin del mapa */
.map-head{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;margin-bottom:12px;}
.map-head h2{margin:0;}
.view-toggle{display:inline-flex;border:1px solid var(--line);border-radius:10px;overflow:hidden;background:#fff;}
.view-toggle button{border:0;background:#fff;padding:8px 12px;font:inherit;font-size:13px;font-weight:700;cursor:pointer;color:var(--muted);}
.view-toggle button + button{border-left:1px solid var(--line);}
.view-toggle button.active{background:var(--brand);color:#fff;}
.client-preview{flex:1;height:auto;min-height:640px;border:1px solid var(--line);border-radius:14px;overflow:hidden;background:#fff;}
.client-preview iframe{width:100%;height:100%;border:0;display:block;}
#map-admin-wrap[hidden], #map-client-wrap[hidden]{display:none !important;}

.discontinued-badge{margin-left:8px;font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.03em;color:#8a1224;background:#f8e7eb;border:1px solid #efc7d0;border-radius:999px;padding:2px 8px;vertical-align:middle;}

/* Mejoras del editor de proyecto: catálogo amplio y proveedor por producto */
#dlg-project{width:min(1120px,97vw);}
#dlg-project .dlg-body{padding-left:26px;padding-right:26px;}
.project-sector-field{max-width:560px;}
.project-products-panel{margin-top:18px;margin-bottom:18px;}
.project-products-panel .section-label{margin-top:0;}
.project-products-layout{display:grid;grid-template-columns:minmax(360px,1fr) minmax(380px,1fr);gap:18px;align-items:start;}
.product-column{min-width:0;}
.product-column-title{font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.8px;color:var(--brand);margin:0 0 8px;}
.product-column-catalog .prodpicker{max-height:430px;margin-bottom:0;}
.product-column-selected #pe-prodspecs{padding-top:0;max-height:430px;overflow:auto;padding-right:4px;}
.product-column-selected .product-spec-card:first-child{margin-top:0;}
.selected-empty{border:1px dashed var(--line);border-radius:8px;background:#fff;}
.product-supplier-row{display:grid;grid-template-columns:120px minmax(180px,1fr);gap:10px;align-items:center;margin-bottom:12px;}
.product-supplier-row label{font-size:11px;text-transform:uppercase;letter-spacing:.5px;color:var(--muted);font-weight:800;}
.product-supplier-row select{width:100%;}

@media(max-width:980px){
  .project-products-layout{grid-template-columns:1fr;}
  .product-column-catalog .prodpicker,
  .product-column-selected #pe-prodspecs{max-height:360px;}
}

/* Mejoras: proveedor con buscador y vista admin de mapa más clara */
.supplier-search-wrap{position:relative;width:100%;}
.supplier-search-wrap input{padding-right:34px;}
.supplier-clear{position:absolute;right:6px;top:50%;transform:translateY(-50%);width:24px;height:24px;border:0;border-radius:999px;background:transparent;color:var(--muted);font-size:18px;line-height:1;display:flex;align-items:center;justify-content:center;}
.supplier-clear:hover{background:var(--brand-soft);color:var(--brand);}

.mapfilters{display:block;margin-bottom:12px;}
.map-admin-toolbar{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:12px;}
.map-admin-title{font-size:15px;font-weight:800;color:var(--brand);text-transform:uppercase;letter-spacing:.7px;}
.map-count{font-size:12px;font-weight:800;color:var(--brand);background:var(--brand-soft);border-radius:999px;padding:6px 10px;white-space:nowrap;}
.map-admin-controls{display:grid;grid-template-columns:minmax(260px,1fr) minmax(170px,220px) minmax(160px,200px);gap:10px;margin-bottom:10px;}
.map-tech-chips{display:flex;gap:8px;flex-wrap:wrap;align-items:center;}
.map-tech-chips .chip{cursor:pointer;border:1px solid var(--line);background:#fff;}
.map-tech-chips .chip.inactive{opacity:.35;}
#adminmap{flex:1;height:auto;min-height:560px;}

@media(max-width:900px){
  .map-admin-controls{grid-template-columns:1fr;}
  .map-admin-toolbar{flex-direction:column;align-items:stretch;}
  .map-count{align-self:flex-start;}
}

/* Ajustes finales: modal de proyecto más amplio, secciones de producto desplegables y visibilidad pública por producto */
#dlg-project{width:min(1320px,98.5vw);}
#dlg-project .dlg-body{padding-left:30px;padding-right:30px;}
.project-products-layout{grid-template-columns:minmax(520px,1.25fr) minmax(430px,.9fr);gap:22px;}
.product-column-catalog .prodpicker{max-height:540px;}
.product-column-selected #pe-prodspecs{max-height:540px;}
.product-family-section{padding:0;overflow:hidden;}
.product-family-section > summary{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:13px 16px;font-weight:800;color:var(--brand);cursor:pointer;}
.product-family-section > summary::after{content:"⌄";color:var(--muted);font-size:15px;transition:transform .15s;}
.product-family-section[open] > summary::after{transform:rotate(180deg);}
.product-family-body{border-top:1px solid var(--line);}
.product-options-row{border:1px solid var(--line);background:#fafafa;border-radius:8px;padding:9px 10px;margin-bottom:12px;}
.product-public-toggle{display:flex;align-items:center;gap:8px;margin:0;color:var(--ink);font-weight:700;font-size:13px;}
.product-public-toggle input{width:auto;}
.product-public-toggle span{line-height:1.25;}
@media(max-width:1100px){
  .project-products-layout{grid-template-columns:1fr;}
  .product-column-catalog .prodpicker,
  .product-column-selected #pe-prodspecs{max-height:420px;}
}

/* Control global para mostrar/ocultar todos los productos seleccionados */
.product-bulk-visibility{
  border:1px solid var(--line);
  background:var(--brand-soft);
  border-radius:10px;
  padding:10px 12px;
  margin:0 0 12px;
}
.product-public-toggle-all{font-size:13.5px;}
.product-public-toggle-all input{transform:scale(1.05);}

/* Visibilidad masiva de características dentro de cada producto seleccionado */
.spec-bulk-row{
  background:#fff7f0;
  border-style:dashed;
}
.spec-bulk-row .product-public-toggle{font-weight:700;}
.geo-search-row{display:flex;gap:8px;align-items:center;}
.geo-search-row input{flex:1;min-width:0;}
.geo-search-row .btn{white-space:nowrap;}
@media(max-width:720px){
  .geo-search-row{flex-direction:column;align-items:stretch;}
}

/* Mejora visual: popup de chincheta en Vista admin y proyectos ocultos en gris */
.admin-map-popup .leaflet-popup-content-wrapper{
  border-radius:14px;
  overflow:hidden;
  padding:0;
  box-shadow:0 16px 42px rgba(15,23,42,.26);
  border:1px solid rgba(122,31,43,.10);
}
.admin-map-popup .leaflet-popup-content{margin:0;width:265px !important;font-family:var(--font, 'Inter', system-ui, sans-serif);}
.admin-map-popup .leaflet-popup-tip-container{display:none;}
.admin-pin-card{background:#fff;color:var(--ink);}
.admin-pin-card.is-off{filter:saturate(.65);}
.admin-pin-photo{display:block;width:100%;height:132px;object-fit:cover;background:#eee;border-bottom:1px solid var(--line);}
.admin-pin-photo-empty{background:linear-gradient(135deg,#f1f1f1,#e5e7eb);}
.admin-pin-body{padding:12px 14px 13px;}
.admin-pin-title-row{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;margin-bottom:5px;}
.admin-pin-title{font-weight:900;font-size:13.5px;line-height:1.25;text-transform:uppercase;letter-spacing:.25px;color:var(--ink);}
.admin-pin-status{flex:none;font-size:9.5px;font-weight:900;letter-spacing:.45px;text-transform:uppercase;color:#6b7280;background:#f3f4f6;border:1px solid #e5e7eb;border-radius:999px;padding:3px 7px;}
.admin-pin-status.on{color:#137a3a;background:#e8f6ee;border-color:#c9ead5;}
.admin-pin-place{font-size:12px;color:var(--muted);line-height:1.35;margin-bottom:8px;}
.admin-pin-meta{display:flex;align-items:center;gap:7px;font-size:12px;font-weight:700;color:var(--ink);margin-bottom:7px;}
.admin-pin-dot{width:9px;height:9px;border-radius:50%;flex:none;}
.admin-pin-company{font-size:11px;color:var(--muted);font-weight:800;letter-spacing:.45px;margin-bottom:9px;}
.leaflet-interactive.admin-pin-off{filter:grayscale(1);}

/* ==================================================================
   PREMIUM TEVALCOR UI — rediseño corporativo azul
   ================================================================== */
:root{
  --brand:#073763;
  --brand-dark:#041f38;
  --brand-2:#0b4d83;
  --brand-soft:#edf5fb;
  --brand-soft-2:#f7fbfe;
  --brand-line:#d7e7f4;
  --ink:#102033;
  --muted:#66768a;
  --line:#dbe7f0;
  --bg:#f3f7fb;
  --card:#ffffff;
  --ok:#16824a;
  --danger:#b42336;
  --radius:16px;
  --font:'Inter',system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  --title:'Archivo',var(--font);
  --shadow:0 18px 46px rgba(7,55,99,.12);
}
body{
  font-family:var(--font);
  color:var(--ink);
  background:
    radial-gradient(circle at 4% -10%, rgba(7,55,99,.16), transparent 30%),
    radial-gradient(circle at 95% 0%, rgba(11,77,131,.10), transparent 34%),
    linear-gradient(180deg,#f8fbfe 0%,#edf5fa 100%);
}
h2,h3,.map-admin-title,.section-label{font-family:var(--title);letter-spacing:-.01em;}
input,select,textarea{
  border-color:var(--line);border-radius:12px;background:#fff;min-height:38px;
  transition:border .15s, box-shadow .15s, background .15s;
}
input:focus:not([type="checkbox"]),select:focus,textarea:focus{
  outline:none;border-color:var(--brand-2);box-shadow:0 0 0 4px rgba(7,55,99,.10);
}

/* Checkboxes en toda la app: sin el recuadro cuadrado feo del focus nativo,
   solo un anillo fino y redondeado al navegar con teclado. No toca .switch
   (los toggles ocultan su checkbox real y pintan un carril/bolita aparte). */
input[type="checkbox"]:focus{
  outline:none;
  box-shadow:none;
}
input[type="checkbox"]:focus-visible{
  outline:2px solid rgba(10,82,136,.35);
  outline-offset:2px;
  border-radius:3px;
}
.switch input:focus,
.switch input:focus-visible{
  outline:none;
}
label{color:var(--muted);font-weight:800;text-transform:none;}

.login-wrap{
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.16), transparent 22%),
    linear-gradient(145deg,#041f38 0%,#073763 54%,#0b4d83 100%);
}
.login-card{border-radius:28px;padding:40px;box-shadow:0 32px 90px rgba(0,0,0,.34);border:1px solid rgba(255,255,255,.28);}
.login-logo img{display:block;height:56px;width:auto;max-width:100%;object-fit:contain;margin-bottom:12px;}
.login-card .logo{display:none;}
.login-card .sub{color:var(--muted);font-size:13.5px;margin-bottom:24px;}
.login-card .field{margin-bottom:16px;}
.login-card .forgot{color:var(--brand);font-weight:700;}

.app{min-height:100vh;padding:14px;gap:14px;}
.sidebar{
  width:250px;height:calc(100vh - 28px);top:14px;border-radius:24px;
  background:linear-gradient(180deg,#ffffff 0%,#f7fbfe 100%);
  color:var(--ink);border:1px solid var(--line);box-shadow:var(--shadow);overflow:hidden;
}
.sidebar .logo{padding:18px 18px 16px;border-bottom:1px solid var(--line);}
.sidebar .logo img{display:block;width:180px;max-width:100%;height:auto;object-fit:contain;margin-bottom:10px;}
.sidebar .logo small{color:var(--muted);font-weight:900;letter-spacing:1.6px;font-size:10px;}
.sidebar nav{padding:14px 10px;gap:6px;}
.sidebar nav button{
  color:#30445d;border:1px solid transparent;border-radius:15px;padding:12px 13px;
  background:transparent;font-weight:700;transition:all .14s;
}
.sidebar nav button:hover{background:var(--brand-soft);color:var(--brand);border-color:var(--brand-line);transform:translateX(2px);}
.sidebar nav button.active{background:linear-gradient(135deg,var(--brand),var(--brand-2));color:#fff;box-shadow:0 12px 26px rgba(7,55,99,.22);}
.sidebar .whoami{border-top:1px solid var(--line);color:var(--muted);background:#fff;}
.sidebar .whoami b{color:var(--ink);}
.sidebar .whoami button{color:var(--brand);font-weight:800;}
.main{padding:8px 4px 8px 0;max-width:1260px;}
body.map-tab-active .main{padding:0;}
body.map-tab-active #tab-map{height:calc(100vh - 28px);}

.card,dialog,#map-admin-wrap,.client-preview{
  border-radius:22px;border-color:var(--line);box-shadow:var(--shadow);background:rgba(255,255,255,.96);
}
.card{padding:20px;margin-bottom:18px;}
.toolbar{background:linear-gradient(180deg,#fff,#f8fbfe);border:1px solid var(--line);border-radius:18px;padding:14px;margin-bottom:16px;}
.btn{border-radius:13px;background:linear-gradient(135deg,var(--brand),var(--brand-2));box-shadow:0 8px 18px rgba(7,55,99,.14);font-weight:800;}
.btn:hover{background:linear-gradient(135deg,#052b4d,var(--brand));transform:translateY(-1px);}
.btn.secondary{background:#fff;color:var(--brand);border:1px solid var(--brand-line);box-shadow:none;}
.btn.secondary:hover{background:var(--brand-soft);}
.btn.danger{background:#fff;color:var(--danger);border-color:#f1c5ce;box-shadow:none;}
.btn.small{border-radius:10px;}

.famtag,.badge{border-radius:999px;}
.famtag{background:var(--brand-soft);color:var(--brand);padding:4px 9px;}
.chip{border-color:var(--brand-line);background:#fff;border-radius:999px;padding:5px 10px;box-shadow:0 3px 10px rgba(7,55,99,.05);}
table.list{border-collapse:separate;border-spacing:0;overflow:hidden;}
table.list th{background:#f7fbfe;color:var(--muted);padding:12px 12px;border-bottom:1px solid var(--line);}
table.list td{padding:12px;border-bottom:1px solid var(--line);}
table.list tr.rowlink:hover{background:#f4f9fd;}
.thumb{border-radius:11px;border-color:var(--brand-line);}
.switch .track{background:#b7c4d2;}
.switch input:checked + .track{background:linear-gradient(135deg,#13844a,#24a061);}

/* Modales premium */
dialog{border-radius:26px;box-shadow:0 34px 100px rgba(7,21,38,.34);border:1px solid rgba(255,255,255,.35);}
#dlg-project{width:min(1460px,99vw);}
dialog::backdrop{background:rgba(3,20,35,.54);backdrop-filter:blur(6px);}
dialog .dlg-head{padding:20px 26px;background:linear-gradient(180deg,#fff,#f7fbfe);border-radius:26px 26px 0 0;}
dialog .dlg-head h2{font-family:var(--title);font-size:21px;color:var(--brand);}
dialog .dlg-body{padding:24px 30px;background:#fff;}
dialog .dlg-foot{padding:16px 26px;background:#f8fbfe;border-radius:0 0 26px 26px;}
.section-label{color:var(--brand);border-bottom:1px solid var(--brand-line);padding-bottom:8px;margin-top:22px;}
.project-products-layout{grid-template-columns:minmax(620px,1.35fr) minmax(520px,1fr);gap:24px;}
.product-column-title{font-family:var(--title);color:var(--brand);font-size:12px;letter-spacing:.09em;}
.prodpicker,.product-column-selected #pe-prodspecs{border-radius:18px;border-color:var(--line);background:#f8fbfe;}
.product-column-catalog .prodpicker,.product-column-selected #pe-prodspecs{max-height:620px;}
.picker-family,.product-spec-card,.product-family-section,.subsection,.cfg-section{border-radius:16px;border-color:var(--line);box-shadow:0 5px 16px rgba(7,55,99,.04);}
.picker-family > summary,.product-family-section > summary,.product-spec-card > summary,.cfg-section > summary{color:var(--brand);background:#fff;font-family:var(--title);}
.product-spec-body,.cfg-content,.subsection-body,.picker-family-body{background:#fff;}
.product-options-row,.product-bulk-visibility{background:linear-gradient(180deg,#f7fbfe,#fff);border-color:var(--brand-line);border-radius:15px;}
table.chars th{background:#f7fbfe;}
.photocard,.dropzone{border-radius:16px;border-color:var(--line);}
.photocard img{border-radius:16px 16px 0 0;}

/* Mapa admin premium */
.map-head{background:#fff;border:1px solid var(--line);border-radius:22px;padding:14px 16px;box-shadow:var(--shadow);}
.map-head h2{font-size:22px;color:var(--brand);}
.view-toggle{border-radius:16px;border-color:var(--brand-line);box-shadow:0 4px 14px rgba(7,55,99,.06);}
.view-toggle button{padding:10px 14px;font-weight:900;}
.view-toggle button.active{background:linear-gradient(135deg,var(--brand),var(--brand-2));}
.map-admin-title{font-size:16px;color:var(--brand);}
.map-count{background:var(--brand-soft);color:var(--brand);border:1px solid var(--brand-line);border-radius:999px;padding:8px 12px;}
.map-admin-controls{gap:12px;}
#adminmap{border-radius:20px;border-color:var(--line);min-height:620px;box-shadow:inset 0 0 0 1px rgba(255,255,255,.5);}
.client-preview{border-radius:24px;overflow:hidden;min-height:760px;}
.admin-map-popup .leaflet-popup-content-wrapper{border-radius:20px;box-shadow:0 24px 70px rgba(7,55,99,.28);}
.admin-pin-title{color:#0e2946;font-family:var(--title);}
.admin-pin-status.on{color:#0e6f41;background:#e9f8ef;border-color:#c5ebd4;}
.admin-pin-status{border-radius:999px;}
.leaflet-interactive.admin-pin-off{filter:grayscale(1) opacity(.58);}

#toast{border-radius:999px;background:#0e2946;box-shadow:0 18px 40px rgba(7,55,99,.24);}

@media(max-width:820px){
  .app{padding:8px;gap:8px;}
  .sidebar{width:64px;height:calc(100vh - 16px);top:8px;border-radius:18px;}
  .sidebar .logo img{display:none;}
  .main{padding:0;}
  dialog .dlg-body{padding:18px;}
  .project-products-layout{grid-template-columns:1fr;}
}

.partner-logos{display:flex;align-items:center;gap:8px;margin-top:12px;opacity:.72;}
.partner-logos img{height:18px;width:auto;max-width:82px;object-fit:contain;mix-blend-mode:multiply;}
.login-partners{display:flex;gap:12px;align-items:center;margin:0 0 22px;}
.login-partners img{height:20px;width:auto;max-width:105px;object-fit:contain;mix-blend-mode:multiply;opacity:.75;}


/* ChatGPT: sidebar solo Tevalcor */
.partner-logos{display:none !important;}
.sidebar .logo{overflow:hidden;}
.sidebar .logo img{margin-bottom:8px;}

/* ChatGPT: configuración en modo lectura con edición explícita */
.cfg-help{margin:0 0 14px;padding:12px 14px;border:1px solid var(--brand-line);border-radius:16px;background:linear-gradient(180deg,#f7fbfe,#fff);}
.cfg-list .cfg-readonly-value{font-weight:750;color:#102b46;}
.cfg-actions{white-space:nowrap;text-align:right;width:190px;display:table-cell;}
.cfg-actions .btn{margin-left:6px;}
.cfg-color-dot{display:inline-block;width:22px;height:22px;border-radius:999px;border:3px solid #fff;box-shadow:0 0 0 1px var(--line),0 5px 12px rgba(7,55,99,.12);vertical-align:middle;}
.cfg-add-row{margin-top:14px;margin-bottom:0;}
.btn[disabled],button[disabled],select[disabled],input[disabled]{opacity:.55;cursor:not-allowed;}
.btn[disabled]:hover{transform:none;}

/* ==================================================================
   MEJORAS PREMIUM: búsquedas, historial, confirmaciones y estados vacíos
   ================================================================== */
.product-search{margin:8px 0 10px;border-radius:12px;background:#fff;box-shadow:0 6px 18px rgba(7,55,99,.05);}
.picker-family-body label{display:flex;align-items:flex-start;gap:9px;padding:8px 10px;border-radius:10px;transition:background .16s ease;}
.picker-family-body label:hover{background:var(--brand-soft);}
.picker-family-body label small{display:block;color:var(--muted);font-size:10.5px;margin-top:2px;}
.pretty-empty{padding:28px 18px;text-align:center;background:linear-gradient(180deg,#fff,#f7fbff);border:1px dashed var(--brand-line);border-radius:16px;color:var(--muted);}
.pretty-empty b{display:block;color:var(--ink);font-family:'Archivo',sans-serif;margin-bottom:6px;font-size:14px;}
.pretty-empty span{display:block;color:var(--muted);}
.confirm-backdrop{position:fixed;inset:0;background:rgba(8,23,39,.46);backdrop-filter:blur(6px);z-index:9999;display:flex;align-items:center;justify-content:center;padding:22px;}
.confirm-card{width:min(420px,94vw);background:#fff;border:1px solid rgba(7,55,99,.10);border-radius:24px;box-shadow:0 30px 90px rgba(7,55,99,.28);padding:24px;text-align:center;animation:popIn .16s ease-out;}
.confirm-icon{width:44px;height:44px;border-radius:50%;background:var(--brand-soft);color:var(--brand);display:inline-flex;align-items:center;justify-content:center;font-weight:900;margin-bottom:12px;}
.confirm-icon.danger{background:#fff1f2;color:#b91c1c;}
.confirm-title{font-family:'Archivo',sans-serif;font-size:20px;font-weight:800;color:var(--ink);margin-bottom:8px;}
.confirm-message{color:var(--muted);line-height:1.45;margin-bottom:18px;}
.confirm-actions{display:flex;gap:10px;justify-content:center;}
.btn.danger.solid{background:#b91c1c;color:#fff;border-color:#b91c1c;}
.audit-action{display:inline-flex;padding:5px 10px;border-radius:999px;background:var(--brand-soft);color:var(--brand);font-weight:800;font-size:12px;}
.audit-card table.list td{padding-top:12px;padding-bottom:12px;}
.audit-filters{margin-top:16px;align-items:flex-end;}
.audit-filters .flatpickr-input,.audit-filters input.audit-date{min-width:168px;cursor:pointer;background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%230b5b9d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E") no-repeat right 12px center;padding-right:42px;}
.audit-filters .btn{margin-bottom:12px;}
.audit-result-summary{margin:-3px 0 10px;color:var(--muted);font-size:12px;font-weight:700;}
.audit-more-wrap{display:flex;justify-content:center;padding:16px 0 2px;}
.flatpickr-calendar{border:0;border-radius:18px;box-shadow:0 0 0 1px #c8e3fb,0 20px 48px rgba(7,55,99,.18);padding:8px 0;background:linear-gradient(180deg,#fff,#f7fbff);font-family:'Inter',sans-serif;overflow:hidden;}
.flatpickr-months{padding:2px 2px 7px;}
.flatpickr-current-month{font-family:'Archivo',sans-serif;font-weight:800;color:var(--ink);}
.flatpickr-current-month input.cur-year{font-weight:800;color:var(--ink);}
.flatpickr-months .flatpickr-month{height:34px;color:var(--ink);fill:var(--brand);}
.flatpickr-months .flatpickr-prev-month,.flatpickr-months .flatpickr-next-month{top:10px;padding:5px 9px;color:var(--brand);fill:var(--brand);border-radius:9px;}
.flatpickr-months .flatpickr-prev-month:hover,.flatpickr-months .flatpickr-next-month:hover{background:#eaf6ff;color:var(--brand);fill:var(--brand);}
span.flatpickr-weekday{color:#6f8aa5;font-size:10px;font-weight:800;text-transform:uppercase;}
.flatpickr-day{border-radius:10px;color:#244863;font-weight:700;width:14.2857143%;max-width:none;height:34px;line-height:34px;margin:0;box-sizing:border-box;}
.flatpickr-day:hover,.flatpickr-day:focus{background:#e4f4ff;border-color:#e4f4ff;color:var(--brand);}
.flatpickr-day.today{border-color:#65bceb;color:var(--brand);}
.flatpickr-day.selected,.flatpickr-day.selected:hover,.flatpickr-day.selected:focus{background:linear-gradient(135deg,#075a9d,#1099d1);border-color:#075a9d;color:#fff;box-shadow:0 5px 12px rgba(7,91,157,.25);}
/* El historial usa un calendario de un solo mes: no enseñamos los días
   auxiliares del mes anterior/siguiente que Flatpickr añade por defecto. */
.flatpickr-day.prevMonthDay,.flatpickr-day.nextMonthDay{visibility:hidden;pointer-events:none;}
button:disabled,input:disabled,select:disabled{opacity:.55;cursor:not-allowed;}
.product-bulk-visibility,.spec-bulk-row{border:1px solid var(--brand-line);background:linear-gradient(180deg,#fff,#f7fbff);border-radius:14px;padding:12px;margin-bottom:12px;}
@keyframes popIn{from{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:no-preference){
  .card,.toolbar,.list tr,.product-spec-card,.cfg-section,.subsection,dialog{transition:box-shadow .18s ease, transform .18s ease, background .18s ease;}
  .card:hover{box-shadow:0 18px 44px rgba(7,55,99,.08);}
  dialog[open]{animation:popIn .18s ease-out;}
}


.duplicate-start-panel{
  display:grid;grid-template-columns:minmax(230px,.55fr) minmax(420px,1fr);gap:10px 14px;
  padding:12px 14px;margin:10px 0 14px;border:1px solid var(--line);
  border-radius:16px;background:linear-gradient(135deg,#f7fbff,#ffffff);
  box-shadow:0 10px 26px rgba(7,55,99,.06);
}
.duplicate-start-copy{align-self:center;}
.duplicate-start-copy b{font-size:13px;}
.duplicate-start-copy .hint{font-size:11px;line-height:1.3;}
.duplicate-start-actions{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:end;min-width:0;}
.duplicate-search-box{flex:1;min-width:0;}
.duplicate-search-box label{display:block;font-size:10.5px;font-weight:900;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;margin-bottom:4px;}
.duplicate-search-box input{width:100%;}
.duplicate-selected{margin-top:4px;font-size:10.5px;}
.duplicate-search-results{grid-column:1/-1;display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:7px;max-height:174px;overflow:auto;padding:1px 2px 3px;scrollbar-width:thin;}
.duplicate-base-card{appearance:none;border:1px solid var(--line);background:#fff;border-radius:12px;padding:9px 10px;text-align:left;cursor:pointer;box-shadow:0 6px 16px rgba(7,55,99,.04);}
.duplicate-base-card:hover{border-color:var(--brand-line);box-shadow:0 9px 20px rgba(7,55,99,.08);}
.duplicate-base-card.active{border-color:var(--brand);background:linear-gradient(180deg,#f3f9ff,#fff);box-shadow:0 0 0 3px rgba(10,92,164,.12);}
.duplicate-base-title{display:block;color:var(--ink);font-weight:800;line-height:1.18;margin-bottom:4px;font-size:12.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.duplicate-base-title strong{display:inline-flex;margin-right:6px;color:var(--brand);}
.duplicate-base-meta{display:block;color:var(--muted);font-size:11px;margin-bottom:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.duplicate-base-badges{display:flex;flex-wrap:wrap;gap:5px;}
.duplicate-base-badges em{font-style:normal;font-size:10px;font-weight:800;color:#52708c;background:#eef6ff;border:1px solid #d7e9fa;border-radius:999px;padding:2px 6px;}
@media (max-width:900px){.duplicate-start-panel{grid-template-columns:1fr}.duplicate-start-actions{grid-template-columns:1fr}.duplicate-search-results{grid-template-columns:1fr;max-height:210px}}

/* ChatGPT: editor de proyecto más limpio, mapa cuadrado y scrolls embebidos */
#dlg-project{
  width:min(1540px,99vw);
  max-height:96vh;
  overflow:hidden;
}
#dlg-project .dlg-body{
  overflow:auto;
  overflow-x:hidden;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
  padding:26px 34px;
}
#dlg-project .dlg-body,
.prodpicker,
.product-column-selected #pe-prodspecs,
.picker-family-body,
.product-spec-body,
.product-spec-card table.chars,
.dlg-body select,
.dlg-body textarea{
  scrollbar-width:thin;
  scrollbar-color:rgba(7,55,99,.28) transparent;
}
#dlg-project .dlg-body::-webkit-scrollbar,
.prodpicker::-webkit-scrollbar,
.product-column-selected #pe-prodspecs::-webkit-scrollbar,
.picker-family-body::-webkit-scrollbar,
.product-spec-body::-webkit-scrollbar{
  width:10px;
  height:10px;
}
#dlg-project .dlg-body::-webkit-scrollbar-track,
.prodpicker::-webkit-scrollbar-track,
.product-column-selected #pe-prodspecs::-webkit-scrollbar-track,
.picker-family-body::-webkit-scrollbar-track,
.product-spec-body::-webkit-scrollbar-track{
  background:transparent;
  margin:14px 0;
  border-radius:999px;
}
#dlg-project .dlg-body::-webkit-scrollbar-thumb,
.prodpicker::-webkit-scrollbar-thumb,
.product-column-selected #pe-prodspecs::-webkit-scrollbar-thumb,
.picker-family-body::-webkit-scrollbar-thumb,
.product-spec-body::-webkit-scrollbar-thumb{
  background:linear-gradient(180deg,rgba(7,55,99,.26),rgba(7,55,99,.44));
  border:3px solid transparent;
  background-clip:padding-box;
  border-radius:999px;
}
#dlg-project .dlg-body::-webkit-scrollbar-corner,
.prodpicker::-webkit-scrollbar-corner,
.product-column-selected #pe-prodspecs::-webkit-scrollbar-corner{background:transparent;}

.location-editor-card{
  display:grid;
  grid-template-columns:minmax(360px,.82fr) minmax(420px,1fr);
  gap:22px;
  align-items:stretch;
  margin:12px 0 18px;
  padding:18px;
  border:1px solid var(--line);
  border-radius:24px;
  background:linear-gradient(135deg,#f8fbfe,#fff);
  box-shadow:0 14px 38px rgba(7,55,99,.06);
  overflow:hidden;
}
.location-editor-form{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.location-editor-title{
  font-family:var(--title);
  font-size:15px;
  font-weight:900;
  color:var(--brand);
  text-transform:uppercase;
  letter-spacing:.08em;
}
.location-map-shell{
  min-width:0;
  width:100%;
  aspect-ratio:1 / 1;
  min-height:390px;
  max-height:540px;
  align-self:center;
  border-radius:24px;
  overflow:hidden;
  border:1px solid var(--line);
  background:#dfe8ef;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.6),0 16px 42px rgba(7,55,99,.10);
}
.location-map-shell #pe-map{
  width:100%;
  height:100%;
  border:0;
  border-radius:0;
  margin:0;
}
.location-actions{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  padding:10px 12px;
  border:1px solid var(--brand-line);
  border-radius:16px;
  background:#fff;
}
.coordinates-details{
  border:1px solid var(--line);
  border-radius:16px;
  padding:12px 14px;
  background:#fff;
}
.coordinates-details summary{
  cursor:pointer;
  color:var(--brand);
  font-weight:850;
  font-size:13px;
}

.project-products-panel{
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:26px;
  padding:18px;
  background:linear-gradient(135deg,#f8fbfe,#fff 42%,#f7fbff);
  box-shadow:0 18px 48px rgba(7,55,99,.07);
}
.project-products-layout{
  grid-template-columns:minmax(560px,1.1fr) minmax(560px,1fr);
  gap:20px;
}
.product-column{
  min-width:0;
  border:1px solid var(--line);
  border-radius:22px;
  background:#fff;
  padding:14px;
  overflow:hidden;
  box-shadow:0 10px 28px rgba(7,55,99,.05);
}
.product-column-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
}
.product-search{
  position:sticky;
  top:0;
  z-index:2;
  margin:0 0 12px;
}
.prodpicker,
.product-column-selected #pe-prodspecs{
  max-height:min(640px,58vh);
  overflow:auto;
  overscroll-behavior:contain;
  border-radius:18px;
  padding:10px;
  background:#f8fbfe;
  scrollbar-gutter:stable;
}
.picker-family,
.product-spec-card{
  overflow:hidden;
  border-radius:18px;
  border:1px solid var(--line);
  background:#fff;
  box-shadow:0 8px 22px rgba(7,55,99,.04);
}
.picker-family > summary,
.product-spec-card > summary{
  min-height:48px;
  padding:13px 15px;
}
.picker-family-body{
  max-height:320px;
  overflow:auto;
  padding:8px;
  overscroll-behavior:contain;
}
.picker-family-body label{
  display:grid;
  grid-template-columns:auto 1fr;
  gap:10px;
  align-items:start;
  margin:0 0 6px;
  border:1px solid transparent;
}
.picker-family-body label:hover{
  border-color:var(--brand-line);
  box-shadow:0 8px 20px rgba(7,55,99,.06);
}
.product-spec-body{
  max-height:520px;
  overflow:auto;
  overscroll-behavior:contain;
  padding:14px;
}
.product-spec-card table.chars{
  display:block;
  max-height:300px;
  overflow:auto;
  border:1px solid var(--line);
  border-radius:16px;
  background:#fff;
}
.product-spec-card table.chars thead,
.product-spec-card table.chars tbody,
.product-spec-card table.chars tr{
  display:table;
  width:100%;
  table-layout:fixed;
}
.product-spec-card table.chars thead{
  position:sticky;
  top:0;
  z-index:1;
}
.product-spec-card table.chars th,
.product-spec-card table.chars td{
  word-break:break-word;
}
.product-bulk-visibility,
.spec-bulk-row,
.product-options-row,
.product-supplier-row{
  border-radius:16px;
}
.product-supplier-row{
  grid-template-columns:110px minmax(0,1fr);
  padding:12px;
  border:1px solid var(--line);
  background:#fff;
}

@media(max-width:1180px){
  .location-editor-card,
  .project-products-layout{grid-template-columns:1fr;}
  .location-map-shell{max-width:560px;justify-self:center;}
  .prodpicker,.product-column-selected #pe-prodspecs{max-height:480px;}
}

/* ChatGPT fix: recuperar scroll del editor y evitar que el mapa invada el pie */
#dlg-project[open]{
  display:flex;
  flex-direction:column;
  height:min(96vh,920px);
  max-height:96vh;
  overflow:hidden;
}
#dlg-project .dlg-head,
#dlg-project .dlg-foot{
  flex:0 0 auto;
  position:relative;
  z-index:10;
}
#dlg-project .dlg-body{
  flex:1 1 auto;
  min-height:0;
  max-height:none;
  overflow-y:auto !important;
  overflow-x:hidden !important;
  padding-bottom:34px;
}
#dlg-project .dlg-foot{
  box-shadow:0 -14px 28px rgba(7,55,99,.08);
}
.location-editor-card{
  align-items:start;
}
.location-map-shell{
  height:auto;
  aspect-ratio:1 / 1;
  min-height:0;
  max-height:min(460px,52vh);
}
.location-map-shell #pe-map{
  min-height:0 !important;
}
.project-products-panel{
  margin-top:18px;
}
.prodpicker,
.product-column-selected #pe-prodspecs{
  max-height:min(520px,46vh);
}
.picker-family-body{
  max-height:260px;
}
.product-spec-body{
  max-height:420px;
}
.product-spec-card table.chars{
  max-height:240px;
}
@media(max-height:820px){
  #dlg-project[open]{height:96vh;}
  #dlg-project .dlg-body{padding-top:18px;padding-bottom:24px;}
  .location-map-shell{max-height:390px;}
  .location-editor-card{grid-template-columns:minmax(340px,.95fr) minmax(360px,1fr);gap:16px;padding:16px;}
  .prodpicker,.product-column-selected #pe-prodspecs{max-height:390px;}
}
@media(max-width:1180px){
  #dlg-project[open]{height:96vh;}
  .location-map-shell{width:min(100%,520px);max-height:420px;}
}


/* Confirmaciones bonitas siempre por encima de cualquier modal abierto */
.confirm-dialog{
  width:min(460px,94vw);
  max-height:none;
  padding:0;
  border:none;
  border-radius:28px;
  background:transparent;
  box-shadow:none;
  overflow:visible;
}
.confirm-dialog::backdrop{
  background:rgba(8,23,39,.52);
  backdrop-filter:blur(8px);
}
.confirm-dialog .confirm-card{
  width:100%;
  margin:0;
}

/* ChatGPT fix: centrar las confirmaciones bonitas en la ventana */
.confirm-dialog[open]{
  position:fixed;
  inset:auto;
  top:50%;
  left:50%;
  transform:translate(-50%,-50%);
  margin:0;
}
.confirm-dialog .confirm-card{
  max-height:calc(100vh - 48px);
  overflow:auto;
}

/* ChatGPT: editor de proyecto sin scrolls anidados ni acordeones embarullados */
#dlg-project .dlg-body{
  overflow-y:auto;
  overflow-x:hidden;
  max-height:calc(94vh - 142px);
  scrollbar-gutter:stable;
}
.project-products-panel{
  border:1px solid var(--line);
  background:linear-gradient(180deg,#fff,#f8fbfe);
  border-radius:24px;
  padding:18px;
  box-shadow:0 16px 42px rgba(7,55,99,.08);
}
.project-products-layout{
  grid-template-columns:minmax(420px,.82fr) minmax(620px,1.18fr) !important;
  gap:20px !important;
  align-items:start;
}
.product-column{
  border:1px solid var(--brand-line);
  background:#fff;
  border-radius:22px;
  padding:14px;
  min-width:0;
}
.product-column-title{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:10px;
}
.product-column-catalog .prodpicker,
.product-column-selected #pe-prodspecs{
  max-height:none !important;
  overflow:visible !important;
  border:0;
  padding:0;
  background:transparent;
}
.prodpicker{
  max-height:none !important;
  overflow:visible !important;
}
.picker-family{
  overflow:hidden;
  margin-bottom:10px;
}
.picker-family > summary{
  min-height:52px;
}
.picker-family-body{
  max-height:none !important;
  overflow:visible !important;
  padding:8px;
}
.picker-family-body label{
  min-height:50px;
}
.product-search{
  margin:0 0 14px;
  height:42px;
}
.year-public-field{
  display:grid;
  gap:7px;
}
.pe-title-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:4px;
}
.pe-title-head label{margin-bottom:0;}
.pe-lang-tabs{
  display:flex;
  gap:4px;
}
.pe-lang-tab{
  position:relative;
  border:1px solid var(--line, #d8dee5);
  background:transparent;
  color:var(--muted);
  border-radius:6px;
  padding:3px 10px;
  font-size:11.5px;
  font-weight:600;
  cursor:pointer;
}
.pe-lang-tab.active{
  background:var(--brand, #073763);
  border-color:var(--brand, #073763);
  color:#fff;
}
.pe-lang-missing-dot{
  display:inline-block;
  width:6px;
  height:6px;
  margin-left:4px;
  border-radius:50%;
  background:#d64545;
  vertical-align:middle;
}
.pe-lang-hint{
  margin-top:6px;
}
.pe-lang-panel .field{
  margin-bottom:8px;
}
.pe-lang-panel .field:last-child{
  margin-bottom:0;
}
.year-public-check{
  align-items:center;
  gap:7px;
  font-size:11.5px;
  color:var(--muted);
}
.year-public-check span{
  line-height:1.25;
}
.product-bulk-visibility-clean{
  margin:0 0 14px;
}
.selected-products-workbench{
  display:grid;
  grid-template-columns:minmax(230px,.9fr) minmax(360px,1.35fr);
  gap:14px;
  align-items:start;
}
.selected-list-panel,
.selected-detail-panel{
  min-width:0;
}
.selected-list-title,
.selected-detail-kicker{
  font-size:10.5px;
  text-transform:uppercase;
  letter-spacing:.12em;
  font-weight:900;
  color:var(--muted);
  margin-bottom:8px;
}
.selected-product-cards{
  display:grid;
  gap:9px;
}
.selected-product-tile{
  width:100%;
  border:1px solid var(--line);
  background:#fff;
  border-radius:16px;
  padding:12px;
  text-align:left;
  color:var(--ink);
  box-shadow:0 6px 16px rgba(7,55,99,.04);
  transition:transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
.selected-product-tile:hover{
  transform:translateY(-1px);
  border-color:var(--brand-line);
  box-shadow:0 12px 24px rgba(7,55,99,.09);
}
.selected-product-tile.active{
  border-color:var(--brand-2);
  background:linear-gradient(180deg,#f6fbff,#fff);
  box-shadow:0 12px 28px rgba(7,55,99,.14);
}
.selected-product-tile.is-hidden-public{
  opacity:.68;
  filter:saturate(.75);
}
.selected-product-tile.is-modified{
  border-color:#e2b35c;
  background:linear-gradient(180deg,#fffaf0,#fff);
}
.selected-product-main{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
  margin-bottom:8px;
}
.selected-product-main strong{
  font-size:13px;
  line-height:1.25;
}
.selected-product-meta{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}
.selected-product-meta span{
  font-size:10.5px;
  color:var(--muted);
  background:var(--brand-soft-2);
  border:1px solid var(--line);
  border-radius:999px;
  padding:3px 7px;
}
.modified-badge{
  display:inline-flex;
  align-items:center;
  border:1px solid #e2b35c;
  background:#fff6df;
  color:#8a5a05;
  border-radius:999px;
  padding:3px 7px;
  font-size:10px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.04em;
}
.selected-product-detail{
  border:1px solid var(--brand-line);
  border-radius:20px;
  background:#fff;
  padding:16px;
  box-shadow:0 14px 34px rgba(7,55,99,.08);
}
.selected-detail-head{
  display:flex;
  justify-content:space-between;
  gap:14px;
  align-items:flex-start;
  padding-bottom:12px;
  border-bottom:1px solid var(--line);
  margin-bottom:14px;
}
.selected-detail-head h3{
  margin:0;
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
  font-size:17px;
  color:var(--brand);
}
.selected-detail-stats{
  display:flex;
  gap:7px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.selected-detail-stats span{
  font-size:11px;
  font-weight:800;
  color:var(--brand);
  background:var(--brand-soft);
  border:1px solid var(--brand-line);
  border-radius:999px;
  padding:5px 8px;
  white-space:nowrap;
}
.selected-detail-stats .modified-stat{
  color:#8a5a05;
  background:#fff6df;
  border-color:#e2b35c;
}
.selected-detail-controls{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin-bottom:12px;
}
.selected-detail-controls .product-public-toggle{
  border:1px solid var(--line);
  border-radius:15px;
  background:linear-gradient(180deg,#fff,#f8fbfe);
  padding:12px;
}
.selected-supplier-row{
  grid-template-columns:100px minmax(0,1fr);
  border:1px solid var(--line);
  border-radius:16px;
  padding:12px;
  margin-bottom:14px;
  background:#fff;
}
.selected-units-row{
  grid-template-columns:120px 160px minmax(0,1fr);
  align-items:center;
  border:1px solid var(--line);
  border-radius:16px;
  padding:12px;
  margin-bottom:14px;
  background:#fff;
}
.selected-units-row input{
  min-height:38px;
}
.selected-units-public-row{
  justify-self:start;
  width:auto;
  margin:0;
  padding:8px 10px;
  border:0;
  border-radius:999px;
  background:#f3f8fc;
  color:var(--brand);
  font-size:12px;
}
.selected-characteristics-panel{
  border:1px solid var(--line);
  border-radius:18px;
  overflow:hidden;
  background:#fff;
}
.selected-characteristics-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:center;
  padding:12px 14px;
  background:#f7fbfe;
  border-bottom:1px solid var(--line);
}
.characteristic-rows{
  display:grid;
}
.characteristic-row{
  display:grid;
  grid-template-columns:minmax(180px,1fr) minmax(150px,.75fr) 110px 128px;
  gap:10px;
  align-items:center;
  padding:10px 12px;
  border-bottom:1px solid var(--line);
}
.characteristic-row:last-child{border-bottom:0;}
.characteristic-row.is-modified{
  background:#fff9ea;
  box-shadow:inset 3px 0 0 #d89624;
}
.characteristic-name strong{font-size:13px;}
.characteristic-name .modified-badge{
  margin-left:8px;
}
.standard-value{
  display:block;
  margin-top:4px;
  color:#9a6a13;
  font-size:10.5px;
  font-weight:700;
}
.characteristic-value,.characteristic-unit{min-height:36px;}
.characteristic-row select.vis{min-height:36px;}

@media(max-width:1180px){
  .project-products-layout,
  .selected-products-workbench{grid-template-columns:1fr !important;}
  .selected-product-cards{grid-template-columns:repeat(auto-fit,minmax(220px,1fr));}
}
@media(max-width:720px){
  .selected-detail-head,.selected-detail-controls{grid-template-columns:1fr;display:grid;}
  .selected-detail-stats{justify-content:flex-start;}
  .characteristic-row{grid-template-columns:1fr;gap:6px;}
}

/* ChatGPT: editor de proyecto extra ancho para que no se corten controles */
#dlg-project{
  width:min(1840px,99.4vw) !important;
  height:min(96.5vh,1040px) !important;
  max-height:96.5vh !important;
}
#dlg-project .dlg-body{
  padding-left:32px !important;
  padding-right:32px !important;
}
.project-products-panel{
  padding:20px !important;
}
.project-products-layout{
  grid-template-columns:minmax(450px,.62fr) minmax(920px,1.38fr) !important;
  gap:24px !important;
}
.selected-products-workbench{
  grid-template-columns:minmax(260px,.52fr) minmax(700px,1.48fr) !important;
  gap:18px !important;
}
.selected-product-detail{
  padding:18px !important;
}
.selected-detail-controls{
  grid-template-columns:repeat(2,minmax(260px,1fr)) !important;
}
.selected-supplier-row{
  grid-template-columns:120px minmax(360px,1fr) !important;
}
.characteristic-row{
  grid-template-columns:minmax(180px,1fr) minmax(180px,.75fr) 110px 150px !important;
  gap:14px !important;
}
.characteristic-row select.vis{
  width:100% !important;
  min-width:136px !important;
}
.characteristic-value,.characteristic-unit{
  width:100% !important;
}
@media(max-width:1500px){
  .project-products-layout{grid-template-columns:1fr !important;}
  .selected-products-workbench{grid-template-columns:minmax(240px,.55fr) minmax(620px,1.45fr) !important;}
}
@media(max-width:1180px){
  .selected-products-workbench{grid-template-columns:1fr !important;}
  .selected-detail-controls{grid-template-columns:1fr !important;}
  .characteristic-row{grid-template-columns:1fr !important;}
}


/* ChatGPT final: contadores alineados, esquinas totalmente redondeadas y pulido premium */
.cfg-section > summary.section-summary--counted,
.product-family-section > summary.section-summary--counted{
  display:grid !important;
  grid-template-columns:minmax(0,1fr) 180px 20px;
  align-items:center;
  gap:16px;
}
.cfg-section > summary.section-summary--counted::after,
.product-family-section > summary.section-summary--counted::after{
  display:none !important;
  content:none !important;
}
.section-summary-title{
  min-width:0;
  display:block;
}
.section-summary-meta{
  justify-self:center;
  width:100%;
  text-align:center;
  font-size:12px;
  font-weight:800;
  color:var(--muted);
  white-space:nowrap;
}
.section-summary-caret{
  justify-self:end;
  color:var(--muted);
  font-size:15px;
  line-height:1;
  transition:transform .16s ease;
}
.cfg-section[open] > summary .section-summary-caret,
.product-family-section[open] > summary .section-summary-caret{
  transform:rotate(180deg);
}

:where(
  button,
  .btn,
  input,
  select,
  textarea,
  .card,
  .toolbar,
  .sidebar,
  .sidebar nav button,
  .sidebar .whoami,
  .chip,
  .badge,
  .famtag,
  .thumb,
  .dropzone,
  .photocard,
  .product-column,
  .project-products-panel,
  .cfg-section,
  .subsection,
  .picker-family,
  .product-spec-card,
  .selected-product-tile,
  .selected-product-detail,
  .selected-characteristics-panel,
  .selected-characteristics-head,
  .characteristic-row,
  .map-count,
  .view-toggle,
  .view-toggle button,
  #adminmap,
  .client-preview,
  .cfg-help,
  .duplicate-start-panel,
  .duplicate-start-actions,
  .location-editor-card,
  .location-map-shell,
  .location-actions,
  .coordinates-details,
  .pretty-empty,
  .confirm-card,
  #toast,
  .switch .track,
  .switch .track::after,
  .leaflet-popup-content-wrapper,
  .leaflet-popup-tip,
  .leaflet-control-zoom a,
  .product-options-row,
  .product-bulk-visibility,
  .spec-bulk-row,
  .product-supplier-row,
  .selected-supplier-row,
  .selected-detail-controls .product-public-toggle,
  .product-search,
  dialog,
  dialog .dlg-head,
  dialog .dlg-foot,
  table.list,
  table.chars,
  .search,
  .search-enhanced,
  .search-enhanced input
){
  border-radius:18px;
}

.list tr > :first-child{border-top-left-radius:16px;border-bottom-left-radius:16px;}
.list tr > :last-child{border-top-right-radius:16px;border-bottom-right-radius:16px;}
.product-spec-card table.chars tr > :first-child{border-top-left-radius:14px;border-bottom-left-radius:14px;}
.product-spec-card table.chars tr > :last-child{border-top-right-radius:14px;border-bottom-right-radius:14px;}
.leaflet-control-zoom a:first-child{border-top-left-radius:14px;border-top-right-radius:14px;}
.leaflet-control-zoom a:last-child{border-bottom-left-radius:14px;border-bottom-right-radius:14px;}

@media(max-width:960px){
  .cfg-section > summary.section-summary--counted,
  .product-family-section > summary.section-summary--counted{
    grid-template-columns:minmax(0,1fr) 132px 18px;
    gap:10px;
  }
  .section-summary-meta{font-size:11px;}
}


/* ChatGPT: subsecciones de características alineadas como productos */
.cfg-char-section > summary.section-summary--counted{
  display:grid !important;
  grid-template-columns:minmax(0,1fr) 180px 20px;
  align-items:center;
  gap:16px;
}
.cfg-char-section > summary.section-summary--counted::after{
  display:none !important;
  content:none !important;
}
.cfg-char-section[open] > summary .section-summary-caret{
  transform:rotate(180deg);
}
@media(max-width:960px){
  .cfg-char-section > summary.section-summary--counted{
    grid-template-columns:minmax(0,1fr) 132px 18px;
    gap:10px;
  }
}

/* ==================================================================
   CHATGPT ULTRA PREMIUM PASS — acabado visual más corporativo
   ================================================================== */
:root{
  --glass:rgba(255,255,255,.78);
  --glass-strong:rgba(255,255,255,.94);
  --premium-shadow:0 28px 72px rgba(7,55,99,.14);
  --premium-shadow-soft:0 14px 34px rgba(7,55,99,.08);
  --premium-ring:0 0 0 1px rgba(255,255,255,.72) inset;
}
body{
  background:
    radial-gradient(circle at 10% -8%, rgba(7,55,99,.22), transparent 32%),
    radial-gradient(circle at 100% 4%, rgba(32,115,172,.14), transparent 30%),
    linear-gradient(145deg,#f8fbff 0%,#edf5fb 48%,#e7f0f7 100%);
}
.main h2{
  color:var(--brand);
  font-size:24px;
  letter-spacing:-.035em;
  margin-bottom:16px;
}
.main > .tab:not([hidden]){
  animation:premiumFadeUp .22s ease-out;
}
.sidebar{
  background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(248,251,254,.92));
  backdrop-filter:blur(18px);
  box-shadow:0 30px 90px rgba(7,55,99,.16), var(--premium-ring);
}
.sidebar .logo{
  background:linear-gradient(180deg,#fff,#f8fbfe);
}
.sidebar nav button{
  min-height:46px;
  letter-spacing:-.01em;
}
.sidebar nav button.active{
  box-shadow:0 18px 38px rgba(7,55,99,.28), inset 0 1px 0 rgba(255,255,255,.22);
}
.sidebar nav button.active::after{
  content:"";
  margin-left:auto;
  width:7px;
  height:7px;
  border-radius:999px;
  background:#fff;
  box-shadow:0 0 0 4px rgba(255,255,255,.18);
}
.card,.toolbar,#map-admin-wrap,.project-products-panel,.product-column,.selected-product-detail,.client-preview,.cfg-section,.subsection,.product-family-section,.picker-family,.selected-characteristics-panel{
  background:linear-gradient(180deg,var(--glass-strong),rgba(255,255,255,.88));
  border-color:rgba(180,211,233,.88);
  box-shadow:var(--premium-shadow-soft), var(--premium-ring);
}
.card:hover,.cfg-section:hover,.product-family-section:hover,.subsection:hover,.selected-product-tile:hover{
  border-color:rgba(88,151,196,.50);
}
.toolbar{
  padding:16px;
  box-shadow:0 18px 44px rgba(7,55,99,.09), inset 0 1px 0 rgba(255,255,255,.9);
}
input,select,textarea{
  border-color:#cfe1ef;
  background:linear-gradient(180deg,#fff,#fbfdff);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.86);
}
input:hover,select:hover,textarea:hover{
  border-color:#adcbe2;
}
.btn{
  background:linear-gradient(135deg,#062f55,#0b5792 58%,#0f6daa);
  box-shadow:0 14px 28px rgba(7,55,99,.22), inset 0 1px 0 rgba(255,255,255,.22);
  letter-spacing:-.01em;
}
.btn:hover{
  box-shadow:0 18px 36px rgba(7,55,99,.28), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn.secondary{
  background:linear-gradient(180deg,#fff,#f7fbff);
  border-color:#cfe1ef;
  box-shadow:0 8px 18px rgba(7,55,99,.07);
}
.btn.danger{
  background:linear-gradient(180deg,#fff,#fff7f8);
  border-color:#efc5cd;
}
.section-label,.product-column-title,.selected-detail-kicker,.selected-list-title,.map-admin-title{
  color:#06345e;
  letter-spacing:.12em;
}
.section-label{
  border-bottom:1px solid transparent;
  background:linear-gradient(90deg,rgba(7,55,99,.22),transparent) bottom/100% 1px no-repeat;
}
.cfg-section > summary,.subsection > summary,.product-family-section > summary,.picker-family > summary{
  background:linear-gradient(180deg,#fff,#f8fbff);
}
.section-summary-meta,.hint{
  color:#667b91;
}
.section-summary-meta{
  font-variant-numeric:tabular-nums;
}
table.list th{
  background:linear-gradient(180deg,#f7fbff,#eff6fb);
  color:#526981;
  font-weight:900;
}
table.list td{
  background:rgba(255,255,255,.76);
}
table.list tbody tr:hover td{
  background:#f5faff;
}
.chip,.badge,.famtag,.selected-product-meta span,.selected-detail-stats span,.map-count,.audit-action{
  box-shadow:0 8px 18px rgba(7,55,99,.07), inset 0 1px 0 rgba(255,255,255,.86);
}
.selected-product-tile{
  background:linear-gradient(180deg,#fff,#f8fbff);
  box-shadow:0 12px 28px rgba(7,55,99,.08), inset 0 1px 0 rgba(255,255,255,.9);
}
.selected-product-tile.active{
  border-color:#2471aa;
  box-shadow:0 20px 42px rgba(7,55,99,.18), 0 0 0 4px rgba(11,77,131,.08);
}
.selected-product-tile.active .selected-product-main strong{
  color:var(--brand);
}
.selected-characteristics-head{
  background:linear-gradient(180deg,#f9fcff,#f0f7fd);
}
.characteristic-row{
  background:#fff;
  transition:background .14s ease, transform .14s ease;
}
.characteristic-row:hover{
  background:#f7fbff;
}
.photocard{
  box-shadow:0 12px 28px rgba(7,55,99,.10);
  transition:transform .16s ease, box-shadow .16s ease;
}
.photocard:hover{
  transform:translateY(-2px);
  box-shadow:0 18px 38px rgba(7,55,99,.16);
}
dialog{
  box-shadow:0 40px 120px rgba(7,21,38,.42), 0 0 0 1px rgba(255,255,255,.28) inset;
}
dialog .dlg-head{
  background:linear-gradient(180deg,#fff 0%,#f7fbff 100%);
  box-shadow:0 1px 0 rgba(207,225,239,.72);
}
dialog .dlg-foot{
  background:linear-gradient(180deg,#f8fbff,#edf5fb);
}
.close-x,.d-close{
  border-radius:999px;
  transition:background .14s ease,color .14s ease,transform .14s ease;
}
.close-x:hover,.d-close:hover{
  background:var(--brand-soft);
  color:var(--brand);
  transform:rotate(90deg);
}
#adminmap,.location-map-shell,#pe-map{
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.72),0 18px 48px rgba(7,55,99,.12);
}
.leaflet-control-zoom a{
  color:var(--brand) !important;
  font-weight:900;
}
.admin-map-popup .leaflet-popup-content-wrapper{
  box-shadow:0 30px 80px rgba(7,55,99,.30);
}
.confirm-card{
  background:linear-gradient(180deg,#fff,#f8fbff);
  box-shadow:0 36px 110px rgba(7,55,99,.34), inset 0 1px 0 rgba(255,255,255,.9);
}
.pretty-empty{
  background:
    radial-gradient(circle at 50% 0%, rgba(7,55,99,.08), transparent 42%),
    linear-gradient(180deg,#fff,#f7fbff);
  border-style:solid;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.92);
}
#toast{
  background:linear-gradient(135deg,#092f53,#0b5792);
  box-shadow:0 24px 55px rgba(7,55,99,.32);
}
.switch .track{
  box-shadow:inset 0 2px 5px rgba(15,23,42,.18);
}
.switch input:checked + .track{
  background:linear-gradient(135deg,#0f7a45,#22a466);
}
::-webkit-scrollbar{width:12px;height:12px;}
::-webkit-scrollbar-track{background:rgba(237,245,251,.55);border-radius:999px;}
::-webkit-scrollbar-thumb{background:linear-gradient(180deg,rgba(7,55,99,.30),rgba(7,55,99,.52));border:3px solid transparent;background-clip:padding-box;border-radius:999px;}
::-webkit-scrollbar-thumb:hover{background:linear-gradient(180deg,rgba(7,55,99,.44),rgba(7,55,99,.70));border:3px solid transparent;background-clip:padding-box;}
@keyframes premiumFadeUp{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:no-preference){
  .btn,.card,.cfg-section,.subsection,.product-family-section,.selected-product-tile,.photocard,.sidebar nav button,input,select,textarea{
    transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease,background .16s ease,color .16s ease;
  }
}

/* ChatGPT: controles Leaflet sin recuadro exterior */
.leaflet-control-zoom,
.leaflet-bar{
  border:0 !important;
  background:transparent !important;
  box-shadow:none !important;
}
.leaflet-control-zoom a,
.leaflet-bar a{
  border:1px solid var(--brand-line) !important;
  box-shadow:0 8px 20px rgba(7,55,99,.12) !important;
  margin:0 0 6px !important;
  border-radius:14px !important;
}
.leaflet-control-zoom a + a,
.leaflet-bar a + a{
  border-top:1px solid var(--brand-line) !important;
}


/* ChatGPT: cluster premium en mapa admin */
.admin-cluster-ic{
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  background:linear-gradient(135deg,#0a4478 0%,#0b5f9d 100%);
  color:#fff;
  border:3px solid rgba(255,255,255,.96);
  box-shadow:0 16px 36px rgba(7,55,99,.28), inset 0 1px 0 rgba(255,255,255,.22);
  font-family:'Archivo', var(--font, system-ui, sans-serif);
  font-weight:800;
  letter-spacing:-.02em;
}
.admin-cluster-ic span{
  line-height:1;
  transform:translateY(.5px);
}
.admin-cluster-ic.marker-cluster-small,
.admin-cluster-ic.marker-cluster-medium,
.admin-cluster-ic.marker-cluster-large{
  background:linear-gradient(135deg,#0a4478 0%,#0b5f9d 100%);
}


/* ChatGPT locura premium: admin map, clusters, hover y acabados */
.admin-cluster-ic{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  background:linear-gradient(145deg,#073763 0%,#0b5f9d 55%,#1787c8 100%);
  color:#fff;
  border:3px solid rgba(255,255,255,.98);
  box-shadow:0 18px 42px rgba(7,55,99,.34),0 0 0 7px rgba(11,77,131,.10),inset 0 1px 0 rgba(255,255,255,.32);
  font-family:'Archivo',var(--font,system-ui,sans-serif);
  font-weight:900;
  letter-spacing:-.03em;
  transition:transform .18s ease,box-shadow .18s ease,filter .18s ease;
}
.admin-cluster-ic span{position:relative;z-index:2;line-height:1;transform:translateY(.5px);}
.admin-cluster-ic::after{
  content:"";
  position:absolute;
  inset:-8px;
  border-radius:inherit;
  background:radial-gradient(circle,rgba(11,95,157,.22),transparent 64%);
  opacity:.9;
  z-index:-1;
}
.admin-cluster-ic.has-hidden{
  background:linear-gradient(145deg,#5f6f80 0%,#8a9aaa 54%,#b8c3cf 100%);
  box-shadow:0 18px 42px rgba(70,85,100,.28),0 0 0 7px rgba(120,135,150,.12),inset 0 1px 0 rgba(255,255,255,.34);
}
.admin-cluster-ic:hover{
  transform:translateY(-2px) scale(1.06);
  filter:saturate(1.08);
  box-shadow:0 24px 58px rgba(7,55,99,.42),0 0 0 9px rgba(11,77,131,.13),inset 0 1px 0 rgba(255,255,255,.38);
}
.leaflet-marker-icon.admin-cluster-ic{animation:clusterPop .22s ease-out;}
.leaflet-interactive.admin-pin{transition:filter .16s ease, opacity .16s ease;filter:drop-shadow(0 8px 16px rgba(7,55,99,.25));}
.leaflet-interactive.admin-pin:hover{filter:drop-shadow(0 12px 24px rgba(7,55,99,.35));}
.admin-map-popup .leaflet-popup-content-wrapper{
  border-radius:24px!important;
  background:linear-gradient(180deg,#ffffff 0%,#f7fbff 100%);
  box-shadow:0 36px 94px rgba(7,55,99,.34),0 0 0 1px rgba(255,255,255,.72) inset!important;
}
.admin-pin-card{border-radius:24px;overflow:hidden;background:linear-gradient(180deg,#fff,#f8fbff);}
.admin-pin-photo{height:148px;box-shadow:inset 0 -42px 55px rgba(7,55,99,.14);}
.admin-pin-body{padding:14px 16px 16px;}
.admin-pin-title{font-size:14.5px;letter-spacing:.01em;color:var(--brand)!important;}
.admin-pin-place{font-size:12.5px;}
.admin-pin-status{box-shadow:inset 0 1px 0 rgba(255,255,255,.7);}
.map-tech-chips .chip,.mapfilters .chip{
  transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease,opacity .16s ease;
}
.map-tech-chips .chip:hover,.mapfilters .chip:hover{
  transform:translateY(-1px);
  border-color:var(--brand-line);
  box-shadow:0 13px 28px rgba(7,55,99,.12);
}
.location-map-shell::after{content:"";pointer-events:none;}
.leaflet-control-zoom a,.leaflet-bar a{
  background:rgba(255,255,255,.92)!important;
  backdrop-filter:blur(10px);
  color:var(--brand)!important;
  transition:transform .14s ease,box-shadow .14s ease,background .14s ease!important;
}
.leaflet-control-zoom a:hover,.leaflet-bar a:hover{
  transform:translateY(-1px);
  background:#fff!important;
  box-shadow:0 14px 30px rgba(7,55,99,.20)!important;
}
@keyframes clusterPop{from{opacity:.55;transform:scale(.88)}to{opacity:1;transform:scale(1)}}


/* ChatGPT fix: avisos siempre encima de modales/formularios */
#toast{
  z-index:2147483647 !important;
  position:fixed !important;
  left:50% !important;
  bottom:26px !important;
  transform:translateX(-50%) !important;
  pointer-events:none !important;
  max-width:min(680px,calc(100vw - 32px));
  text-align:center;
}
dialog #toast{
  position:fixed !important;
  z-index:2147483647 !important;
}
dialog:has(#toast){
  overflow:visible !important;
}
#toast.err{
  background:linear-gradient(135deg,#b91c1c,#dc2626) !important;
  color:#fff !important;
  box-shadow:0 28px 70px rgba(185,28,28,.34), inset 0 1px 0 rgba(255,255,255,.22) !important;
}


/* ChatGPT: publicación arriba, acciones de desplegables y caudal */
.project-dlg-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}
.project-head-actions{
  display:flex;
  align-items:center;
  gap:12px;
  margin-left:auto;
}
.project-published-top{
  display:flex;
  align-items:center;
  gap:9px;
  padding:9px 12px;
  border:1px solid var(--brand-line);
  border-radius:999px;
  background:linear-gradient(180deg,rgba(255,255,255,.96),rgba(239,247,252,.92));
  box-shadow:0 10px 24px rgba(7,55,99,.10), inset 0 1px 0 rgba(255,255,255,.86);
  font-size:12.5px;
  font-weight:800;
  color:var(--brand);
  white-space:nowrap;
}
.project-published-top input{margin:0;accent-color:var(--brand);}
.flow-field-card{
  display:grid;
  grid-template-columns:minmax(220px,1fr) minmax(160px,.35fr);
  gap:12px;
  padding:14px;
  margin:12px 0 16px;
  border:1px solid var(--brand-line);
  border-radius:22px;
  background:linear-gradient(180deg,#fff,#f7fbff);
  box-shadow:0 16px 36px rgba(7,55,99,.08), inset 0 1px 0 rgba(255,255,255,.88);
}
.product-column-title-actions{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.mini-actions{
  display:flex;
  gap:7px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
@media(max-width:760px){
  .project-dlg-head{align-items:flex-start;}
  .project-head-actions{flex-wrap:wrap;justify-content:flex-end;}
  .project-published-top{white-space:normal;}
  .flow-field-card{grid-template-columns:1fr;}
  .product-column-title-actions{align-items:flex-start;flex-direction:column;}
}

/* ================= MÉTRICAS PREMIUM ================= */
.sidebar nav button[data-tab="metrics"]{position:relative;}
.metrics-hero{display:flex;align-items:center;justify-content:space-between;gap:18px;margin-bottom:18px;padding:22px 24px;border:1px solid rgba(184,215,242,.85);border-radius:28px;background:linear-gradient(135deg,rgba(255,255,255,.96),rgba(236,246,255,.92));box-shadow:0 22px 70px rgba(7,55,99,.10);}
.metrics-hero h2{font-family:var(--title);font-size:30px;line-height:1;margin:4px 0 8px;color:var(--brand);letter-spacing:-.03em;}
.metrics-hero p{color:#55708d;font-weight:650;margin:0;}
.metrics-hero .eyebrow{font-family:var(--title);font-size:12px;letter-spacing:.18em;text-transform:uppercase;color:#0b5798;}
.metrics-filters{display:grid;grid-template-columns:repeat(6,minmax(130px,1fr));gap:12px;margin-bottom:18px;padding:16px;border:1px solid rgba(184,215,242,.8);border-radius:24px;background:rgba(255,255,255,.82);box-shadow:0 18px 55px rgba(7,55,99,.08);}
.metrics-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:18px;}
.metric-kpi{position:relative;min-height:132px;padding:18px;border-radius:24px;background:linear-gradient(180deg,#fff,#f7fbff);border:1px solid rgba(184,215,242,.9);box-shadow:0 18px 55px rgba(7,55,99,.09);overflow:hidden;}
.metric-kpi:before{content:"";position:absolute;right:-34px;top:-38px;width:112px;height:112px;border-radius:50%;background:radial-gradient(circle,rgba(11,87,152,.16),rgba(11,87,152,0) 68%);}
.metric-kpi span{display:block;font-family:var(--title);font-size:11px;letter-spacing:.13em;text-transform:uppercase;color:#6c83a0;margin-bottom:12px;}
.metric-kpi b{display:block;font-family:var(--title);font-size:24px;line-height:1.08;color:#063a67;word-break:break-word;}
.metric-kpi small{display:block;margin-top:9px;color:#6e829a;font-weight:650;line-height:1.25;}
.metrics-grid.two{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin-bottom:18px;}
.metrics-grid.two.compact{margin-top:18px;margin-bottom:0;}
.metrics-card{padding:20px;border-radius:28px;border:1px solid rgba(184,215,242,.9);background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(248,252,255,.94));box-shadow:0 22px 70px rgba(7,55,99,.10);}
.metrics-card-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:16px;}
.metrics-card-head h3{margin:0;font-family:var(--title);font-size:18px;color:#063a67;}
.metrics-card-head span{font-size:11px;font-weight:900;text-transform:uppercase;letter-spacing:.12em;color:#7b92aa;background:#eef7ff;border:1px solid #d4eaff;border-radius:999px;padding:6px 10px;white-space:nowrap;}
.commercial-interest-card{margin-bottom:20px;}
.commercial-interest-card .metrics-kpis{grid-template-columns:repeat(5,minmax(0,1fr));}
.interest-head{align-items:center;}
.interest-head .hint{margin:5px 0 0;max-width:700px;}
.interest-period{display:flex;align-items:center;gap:8px;}
.interest-period label{font-size:11px;font-weight:800;color:#627d98;text-transform:uppercase;letter-spacing:.08em;}
.interest-period select{min-width:166px;}
.interest-period span{display:none;}
.interest-rank-panel{padding:16px;border:1px solid #d9eafa;border-radius:18px;background:linear-gradient(180deg,#fff,#f8fbfe);}
.interest-rank-panel h4{padding-bottom:10px;margin-bottom:12px;border-bottom:1px solid #e2eff9;}
.metric-bars{display:grid;gap:12px;}
.metric-bar-row{display:grid;grid-template-columns:minmax(160px,1fr) 1.2fr 54px;align-items:center;gap:12px;}
.metric-bar-label{display:flex;align-items:center;justify-content:space-between;gap:10px;color:#153a5b;font-weight:850;min-width:0;}
.metric-bar-label span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.metric-bar-label b{font-family:var(--title);color:#0b5798;}
.metric-bar-track{height:12px;border-radius:999px;background:#e8f2fb;box-shadow:inset 0 1px 3px rgba(7,55,99,.08);overflow:hidden;}
.metric-bar-track i{display:block;height:100%;border-radius:999px;background:linear-gradient(90deg,#0b5798,#61b8ed);box-shadow:0 4px 18px rgba(11,87,152,.24);}
.metric-bar-pct{font-family:var(--title);font-size:12px;color:#7187a0;text-align:right;}
.metric-years{height:205px;display:flex;align-items:end;gap:12px;padding:12px 2px 0;overflow-x:auto;}
.metric-year-col{min-width:54px;flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:6px;color:#657c94;}
.metric-year-bar{width:100%;max-width:54px;border-radius:16px 16px 8px 8px;background:linear-gradient(180deg,#61b8ed,#0b5798);box-shadow:0 12px 28px rgba(11,87,152,.18);}
.metric-year-col b{font-family:var(--title);color:#063a67;}
.metric-year-col span{font-size:11px;font-weight:800;}
.model-ranking{display:grid;gap:9px;}
.model-ranking>div{display:grid;grid-template-columns:34px 1fr auto;align-items:center;gap:10px;padding:10px 12px;border-radius:18px;background:#f7fbff;border:1px solid #dbeefa;}
.model-ranking b{display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:#0b5798;color:#fff;font-family:var(--title);font-size:12px;}
.model-ranking strong{display:block;color:#063a67;}
.model-ranking small{display:block;color:#7890a8;font-weight:700;margin-top:2px;}
.model-ranking em{font-style:normal;font-family:var(--title);font-size:12px;color:#0b5798;white-space:nowrap;}
.flow-summary{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;}
.flow-summary>div{padding:18px;border-radius:22px;background:linear-gradient(135deg,#063a67,#0b5798);color:#fff;box-shadow:0 18px 50px rgba(7,55,99,.18);}
.flow-summary span{font-size:11px;text-transform:uppercase;letter-spacing:.12em;font-weight:900;opacity:.75;}
.flow-summary b{display:block;font-family:var(--title);font-size:28px;margin:8px 0 4px;}
.flow-summary small{opacity:.78;font-weight:700;}
.flow-list{display:grid;gap:9px;}
.flow-list>div{display:grid;grid-template-columns:1fr auto;gap:8px;padding:11px 12px;border-radius:18px;background:#fff;border:1px solid #dbeefa;align-items:center;}
.flow-list span{font-weight:850;color:#063a67;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.flow-list b{font-family:var(--title);color:#0b5798;white-space:nowrap;}
.flow-list small{grid-column:1/-1;color:#7890a8;font-weight:700;}
.metrics-card h4{font-family:var(--title);color:#063a67;margin:0 0 10px;}
.metrics-table-toolbar{display:flex;gap:10px;align-items:center;margin-bottom:12px;}
.metrics-table-toolbar input{flex:1;}
.metrics-table-wrap{overflow:auto;border-radius:20px;border:1px solid #dbeefa;}
.metrics-table{background:#fff;margin:0;min-width:980px;}
.metrics-table th button{background:none;border:0;font:inherit;color:inherit;font-weight:900;cursor:pointer;}
.metrics-table td{vertical-align:top;}
.metrics-empty{padding:18px;border-radius:18px;background:#f7fbff;border:1px dashed #c8e1f5;color:#7890a8;font-weight:750;text-align:center;}
.metrics-hero-actions{display:flex;gap:10px;align-items:center;justify-content:flex-end;flex-wrap:wrap;}
.quality-kpis .metric-kpi:nth-child(2) b{color:#b45309;}
.quality-kpis .metric-kpi:nth-child(3) b{color:#15803d;}
.quality-table .quality-row-warn{background:linear-gradient(90deg,rgba(255,247,237,.72),transparent 60%);}
.quality-issue{display:inline-flex;margin:2px 4px 2px 0;padding:4px 8px;border-radius:999px;background:#fff7ed;border:1px solid #fed7aa;color:#9a3412;font-size:11px;font-weight:850;white-space:nowrap;}
.quality-ok{display:inline-flex;margin:2px 0;padding:4px 8px;border-radius:999px;background:#ecfdf5;border:1px solid #bbf7d0;color:#166534;font-size:11px;font-weight:850;}
.quality-warn{display:inline-flex;margin:2px 0;padding:4px 8px;border-radius:999px;background:#fef2f2;border:1px solid #fecaca;color:#991b1b;font-size:11px;font-weight:850;}

/* contador de modelos del picker siempre en una linea */
.picker-family > summary.picker-family-summary{display:grid!important;grid-template-columns:minmax(0,1fr) auto 18px;align-items:center;gap:12px;}
.picker-family > summary.picker-family-summary::after{content:"⌄";position:static;transform:none;justify-self:end;}
.picker-family[open] > summary.picker-family-summary::after{transform:rotate(180deg);}
.picker-family-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:normal;}
.picker-family-count{white-space:nowrap!important;display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:900;color:#6c83a0;background:#eef7ff;border:1px solid #d4eaff;border-radius:999px;padding:5px 10px;line-height:1;}

@media (max-width:1200px){
  .metrics-filters{grid-template-columns:repeat(3,1fr);}
  .metrics-kpis{grid-template-columns:repeat(2,1fr);}
  .metrics-grid.two{grid-template-columns:1fr;}
  .interest-head{align-items:flex-start;flex-direction:column;}
}
@media (max-width:760px){
  .metrics-hero{align-items:flex-start;flex-direction:column;}
  .metrics-filters,.metrics-kpis,.flow-summary{grid-template-columns:1fr;}
  .metric-bar-row{grid-template-columns:1fr;}
  .metric-bar-pct{text-align:left;}
}

/* ChatGPT: checkbox limpio en pill de publicación */
.project-published-top input[type="checkbox"]{
  appearance:auto!important;
  -webkit-appearance:checkbox!important;
  width:16px!important;
  height:16px!important;
  min-width:16px!important;
  flex:0 0 16px!important;
  padding:0!important;
  margin:0!important;
  border:0!important;
  border-radius:3px!important;
  background:transparent!important;
  box-shadow:none!important;
  outline:none!important;
  accent-color:var(--brand);
}
.project-published-top input[type="checkbox"]:focus{
  outline:2px solid rgba(10,82,136,.22)!important;
  outline-offset:2px!important;
}
.project-published-top span{line-height:1;}

/* ChatGPT FIX: publicacion sin recuadro heredado del checkbox nativo */
.project-published-top{
  position:relative!important;
  display:inline-flex!important;
  align-items:center!important;
  gap:0!important;
  overflow:hidden!important;
  isolation:isolate!important;
}
.project-published-top input#pe-published,
.project-published-top input[type="checkbox"]#pe-published{
  position:absolute!important;
  left:14px!important;
  top:50%!important;
  width:1px!important;
  height:1px!important;
  min-width:1px!important;
  opacity:0!important;
  appearance:none!important;
  -webkit-appearance:none!important;
  border:0!important;
  background:transparent!important;
  box-shadow:none!important;
  outline:0!important;
  padding:0!important;
  margin:0!important;
  transform:none!important;
  pointer-events:none!important;
}
.project-published-top span{
  display:inline-flex!important;
  align-items:center!important;
  gap:9px!important;
  line-height:1!important;
  position:relative!important;
  z-index:1!important;
}
.project-published-top span::before{
  content:"";
  display:inline-grid;
  place-items:center;
  width:16px;
  height:16px;
  min-width:16px;
  border-radius:5px;
  border:1.5px solid #b8d7f2;
  background:#fff;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.9), 0 3px 9px rgba(7,55,99,.10);
}
.project-published-top input#pe-published:checked + span::before{
  content:"✓";
  border-color:var(--brand);
  background:linear-gradient(135deg,var(--brand),#0b5798);
  color:#fff;
  font-size:12px;
  font-weight:1000;
  line-height:16px;
}
.project-published-top input#pe-published:focus-visible + span::before{
  box-shadow:0 0 0 4px rgba(11,87,152,.16), inset 0 1px 0 rgba(255,255,255,.9);
}

/* ChatGPT FIX 2: checkbox de publicacion centrado y sin recorte */
.project-published-top{
  min-height:42px!important;
  height:42px!important;
  padding:0 14px!important;
  overflow:visible!important;
  align-items:center!important;
  justify-content:center!important;
  box-sizing:border-box!important;
}
.project-published-top span{
  min-height:42px!important;
  height:42px!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:9px!important;
  line-height:1!important;
  white-space:nowrap!important;
  transform:none!important;
  padding:0!important;
  margin:0!important;
}
.project-published-top span::before{
  width:17px!important;
  height:17px!important;
  min-width:17px!important;
  flex:0 0 17px!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  box-sizing:border-box!important;
  margin:0!important;
  transform:none!important;
  line-height:17px!important;
  position:relative!important;
  top:0!important;
}
.project-published-top input#pe-published:checked + span::before{
  font-size:12px!important;
  line-height:17px!important;
}
.project-head-actions{align-items:center!important;}
#dlg-project .dlg-head.project-dlg-head{overflow:visible!important;}

/* Ajuste caudal diario/horario separados */
.flow-field-card.flow-field-card-split{
  grid-template-columns:repeat(2,minmax(220px,1fr));
  align-items:stretch;
  border:0;
  background:none;
  box-shadow:none;
  padding:0;
}
.flow-field-card.flow-field-card-split > .field.year-public-field{
  border:1px solid var(--brand-line);
  border-radius:22px;
  background:linear-gradient(180deg,#fff,#f7fbff);
  box-shadow:0 16px 36px rgba(7,55,99,.08), inset 0 1px 0 rgba(255,255,255,.88);
  padding:14px;
  margin:0;
}
.flow-field-card.flow-field-card-single{
  grid-template-columns:minmax(220px,1fr);
  width:50%;
  min-width:260px;
}
@media(max-width:760px){
  .flow-field-card.flow-field-card-single{width:100%;}
}
.flow-field-card .unit-label{
  font-size:11px;
  color:var(--muted);
  font-weight:900;
  letter-spacing:.02em;
}
.flow-summary{
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
}
.flow-counter-start-inline{
  margin-top:8px;
  padding-top:8px;
  border-top:1px dashed var(--brand-line);
}
.flow-counter-start-inline label{
  font-size:11px;
  margin-bottom:3px;
}
.flow-counter-start-inline .hint{
  margin-top:4px;
  font-size:10.5px;
}
.flow-counter-start-inline input{
  max-width:155px;
}
.flow-counter-start-inline .flatpickr-input,
.flow-counter-start-inline input.pe-date-picker{
  cursor:pointer;
  background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%230b5b9d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E") no-repeat right 10px center;
  padding-right:36px;
}
@media(max-width:760px){
  .flow-field-card.flow-field-card-split{grid-template-columns:1fr;}
}

/* Desplegable de categorías con multi-selección (mínimo 1) */
.pe-cat-dropdown{position:relative;}
.pe-cat-toggle{
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  width:100%;text-align:left;cursor:pointer;
  font:inherit;padding:7px 10px;border:1px solid var(--line);border-radius:7px;background:#fff;
}
.pe-cat-toggle:hover{border-color:var(--brand);}
.pe-cat-toggle-label,#pe-cat-toggle-label.placeholder{color:var(--muted);}
.pe-cat-toggle-arrow{color:var(--muted);font-size:11px;flex:none;}
.pe-cat-panel{
  position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:20;
  background:#fff;border:1px solid var(--line);border-radius:10px;
  box-shadow:0 16px 36px rgba(7,55,99,.16);padding:6px;
  max-height:240px;overflow:auto;
}
.pe-cat-option{
  display:flex;align-items:center;gap:8px;padding:7px 8px;border-radius:7px;cursor:pointer;font-size:13px;color:var(--ink);
}
.pe-cat-option:hover{background:var(--brand-soft, #f1f8fd);}
.pe-cat-option input{width:auto;margin:0;accent-color:var(--brand);}

/* ChatGPT: usar todo el ancho disponible del panel */
.main{
  width:100% !important;
  max-width:none !important;
  min-width:0;
  padding:24px 28px !important;
}
body.map-tab-active .main{
  padding:16px 18px !important;
}
.main > section{
  width:100%;
  min-width:0;
}
.metrics-kpis{
  grid-template-columns:repeat(4,minmax(0,1fr)) !important;
}
.quality-kpis{
  grid-template-columns:repeat(3,minmax(0,1fr)) !important;
}
.metric-kpi{
  min-height:132px;
}
@media(max-width:1200px){
  .metrics-kpis{grid-template-columns:repeat(2,minmax(0,1fr)) !important;}
}
@media(max-width:760px){
  .main{padding:14px !important;}
  body.map-tab-active .main{padding:10px !important;}
  .metrics-kpis{grid-template-columns:1fr !important;}
}
