:root {
    --brand-primary: #d26c3f; --brand-primary-hover: #bb5f35; --brand-secondary: #585857; --brand-accent: #006eff;
    --surface-1: #f5f7fa; --surface-2: #ffffff; --surface-3: #f8fafc; --surface-4: #eef2f7; --surface-dark: #1f2937;
    --text-1: #1f2937; --text-2: #4b5563; --text-3: #8a94a6;
    --border-color: #e6ebf2; --border-strong: #d7dee8;
    --danger: #dc2626;
    --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.06); --shadow-md: 0 18px 40px rgba(15, 23, 42, 0.12); --shadow-lg: 0 24px 50px rgba(15, 23, 42, 0.18);
    --radius-md: 14px; --radius-lg: 18px;
    --font-body: 'Inter', sans-serif; --font-title: 'Oxanium', sans-serif;
}

* { box-sizing: border-box; font-family: var(--font-body); }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; background: radial-gradient(circle at top left, rgba(210,108,63,0.06), transparent 20%), linear-gradient(180deg, #f8fafc 0%, #f2f5f9 100%); color: var(--text-1); }
body { display: flex; }
h1, h2, h3, h4 { font-family: var(--font-title); margin: 0; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background: #cfd7e3; border-radius: 999px; } ::-webkit-scrollbar-thumb:hover { background: #b5c0cf; }

#sidebar { width: 380px; background: rgba(255,255,255,0.9); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); display: flex; flex-direction: column; z-index: 10; border-right: 1px solid rgba(230,235,242,0.9); box-shadow: 8px 0 30px rgba(15, 23, 42, 0.08); flex-shrink: 0; position: relative; max-height: 100vh; }
#sidebar::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(255,255,255,0.3), transparent 140px); }
.header { padding: 16px 20px 12px; text-align: left; border-bottom: 1px solid var(--border-color); background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(248,250,252,0.88)); position: relative; flex-shrink: 0; }
.header::after { content: ""; position: absolute; left: 20px; bottom: 0; width: 72px; height: 3px; border-radius: 999px; background: linear-gradient(90deg, var(--brand-primary), rgba(210,108,63,0.18)); }
.brand-chip { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; padding: 5px 9px; border-radius: 999px; background: rgba(210,108,63,0.08); color: var(--brand-primary); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.brand-chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-primary); box-shadow: 0 0 0 4px rgba(210,108,63,0.12); }
.header h2 { font-size: 1.5rem; line-height: 1.1; letter-spacing: 0.03em; text-transform: uppercase; }
.empresa-link { color: var(--text-1); text-decoration: none; transition: color 0.2s; } .empresa-link:hover { color: var(--brand-primary); }
.header .sub-header { font-size: 0.72rem; color: var(--text-3); margin-top: 6px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }

.botones { padding: 12px 20px; border-bottom: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 10px; background: transparent; flex-shrink: 0; }
.panel-card { background: var(--surface-2); border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); }
.panel-step { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.step-badge { min-width: 26px; height: 26px; border-radius: 999px; background: rgba(210,108,63,0.1); color: var(--brand-primary); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; border: 1px solid rgba(210,108,63,0.18); }
.step-label { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); font-weight: 800; }
.instruccion { margin-top: 5px; margin-bottom: 10px; padding: 12px; background: rgba(0,110,255,0.05); border-radius: 8px; border-left: 3px solid var(--brand-accent); font-size: 0.85rem; color: var(--text-2); line-height: 1.4; }
.instruccion strong { color: var(--brand-primary); font-family: var(--font-title); font-weight: 700; }

.search-box { display: flex; gap: 8px; margin-bottom: 2px; width: 100%; }
.search-box input, .form-grid input, .form-grid select, .form-grid textarea { flex: 1 1 auto; min-width: 0; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: var(--radius-md); font-size: 0.9rem; outline: none; transition: all 0.25s ease; background: #fff; color: var(--text-1); }
.search-box input:focus, .form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { border-color: rgba(210,108,63,0.45); box-shadow: 0 0 0 4px rgba(210,108,63,0.12); }

button { width: 100%; min-height: 40px; padding: 10px 14px; border: 1px solid transparent; border-radius: var(--radius-md); cursor: pointer; font-weight: 700; font-size: 0.88rem; transition: transform 0.15s ease, box-shadow 0.25s ease, opacity 0.25s ease; display: inline-flex; justify-content: center; align-items: center; gap: 8px; }
button:hover:not(:disabled) { transform: translateY(-1px); } button:active:not(:disabled) { transform: translateY(0); } button:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn-principal { background: linear-gradient(180deg, var(--brand-primary), var(--brand-primary-hover)); color: #fff; box-shadow: 0 12px 24px rgba(210,108,63,0.22); }
.btn-secundario { background: #fff; color: var(--text-1); border-color: var(--border-color); box-shadow: var(--shadow-soft); }
.btn-peligro { background: #fff; color: var(--danger); border-color: rgba(220,38,38,0.2); }
.btn-accion { background: linear-gradient(180deg, var(--brand-accent), #005fde); color: #fff; box-shadow: 0 12px 24px rgba(0,110,255,0.2); }
.btn-icon { width: 40px; min-width: 40px; padding: 0; flex-shrink: 0; border-radius: 12px; }

.toolbar-row { display: flex; gap: 8px; } .toolbar-row button { flex: 1; min-height: 38px; font-size: 0.82rem; }
.catalogo { padding: 12px 14px 18px; overflow-y: auto; flex-grow: 1; display: none; background: transparent; }
.categoria-wrapper { margin-bottom: 10px; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border-color); background: var(--surface-2); box-shadow: var(--shadow-soft); }
.categoria-titulo { background: linear-gradient(180deg, #fbfcfe, #f5f8fb); padding: 12px 16px; font-weight: 700; font-size: 0.88rem; color: var(--text-1); margin: 0; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.categoria-contenido { background: #fff; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; }

.item { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 10px; border: 1px solid #f0f4f8; border-radius: 12px; cursor: pointer; transition: all 0.2s ease; gap: 6px; }
.item:hover { background: linear-gradient(180deg, #fffaf7, #fffdfb); border-color: rgba(210,108,63,0.3); transform: translateY(-2px); }
.item img { width: 100%; height: 65px; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(15,23,42,0.08)); background: #fff; border-radius: 10px; padding: 5px; border: 1px solid var(--border-color); }
.item-info { display: flex; flex-direction: column; align-items: center; width: 100%; }
.item-nombre { font-size: 0.72rem; font-weight: 700; color: var(--text-1); line-height: 1.15; margin-bottom: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-medida { font-size: 0.7rem; color: var(--brand-accent); font-weight: 700; margin-top: 2px; }
.btn-detalle { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; padding: 4px 8px; background: rgba(210,108,63,0.08); color: var(--brand-primary) !important; font-size: 0.65rem; border-radius: 999px; text-decoration: none; font-weight: 800; text-transform: uppercase; }

#area-trabajo { flex-grow: 1; position: relative; display: flex; justify-content: center; align-items: center; padding: 18px; background: linear-gradient(180deg, #f3f6fa 0%, #eef3f8 100%); touch-action: none; }
#map { width: calc(100% - 18px); height: calc(100% - 18px); position: absolute; top: 9px; left: 9px; z-index: 1; border-radius: 22px; overflow: hidden; box-shadow: var(--shadow-md); border: 1px solid rgba(255,255,255,0.75); }
#canvas-wrapper { display: none; width: 100%; height: 100%; background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(252,253,255,0.96)); box-shadow: var(--shadow-lg); border: 1px solid var(--border-strong); border-radius: 24px; position: relative; z-index: 2; overflow: hidden; }
#plano-canvas { border-radius: 16px; touch-action: none; }

.vineta-plano { position: absolute; bottom: 24px; right: 24px; border: 1px solid rgba(31,41,55,0.12); background: rgba(255,255,255,0.92); backdrop-filter: blur(10px); padding: 12px 16px; font-size: 11px; z-index: 5; pointer-events: auto; display: flex; align-items: center; gap: 16px; box-shadow: 0 14px 28px rgba(15,23,42,0.12); border-radius: 16px; }
.vineta-plano strong { font-family: var(--font-title); font-size: 16px; border-right: 1px solid #dde4ee; padding-right: 15px; margin: 0; letter-spacing: 0.03em; } .vineta-plano strong a { color: var(--brand-primary); text-decoration: none; }
.vineta-detalles { display: flex; flex-direction: column; color: var(--text-2); }

#panel-final { display: none; border-top: 1px solid var(--border-color); background: rgba(255,255,255,0.9); backdrop-filter: blur(10px); padding-top: 14px; flex-shrink: 0; }
#modal-cotizacion { display: none; position: fixed; inset: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.42); z-index: 100; justify-content: center; align-items: center; backdrop-filter: blur(8px); padding: 20px; }
.modal-content { background: rgba(255,255,255,0.96); padding: 30px; border-radius: 24px; width: 720px; max-width: 95%; max-height: 90vh; overflow-y: auto; box-shadow: 0 35px 70px rgba(15,23,42,0.22); position: relative; }
.modal-header h3 { font-size: 1.55rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 24px; } .form-group { display: flex; flex-direction: column; gap: 7px; } .form-group label { font-size: 0.84rem; font-weight: 700; color: var(--text-2); } .span-2 { grid-column: span 2; } .modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 10px; }

.upload-box { border: 1px dashed var(--border-strong); padding: 16px; }

#banner-instrucciones {
    position: fixed; top: 30px; left: 50%; transform: translateX(-50%);
    background: rgba(0, 110, 255, 0.95); color: #ffffff; padding: 14px 28px;
    border-radius: 999px; font-size: 15px; font-weight: 500; z-index: 999999; 
    box-shadow: 0 12px 30px rgba(0, 110, 255, 0.3); display: none; 
    pointer-events: none; text-align: center; backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.2); transition: all 0.3s ease;
}
#banner-instrucciones strong { font-weight: 800; font-family: var(--font-title); }

#map-tooltip { position: fixed; background: rgba(255, 255, 255, 0.95); border: 2px solid #006EFF; color: #006EFF; padding: 6px 10px; border-radius: 8px; font-family: 'Oxanium', sans-serif; font-weight: bold; font-size: 15px; pointer-events: none; z-index: 999999; display: none; box-shadow: 0 4px 12px rgba(0,0,0,0.15); transform: translate(15px, 15px); text-align: center; line-height: 1.2; }
#map-tooltip small { display: block; font-size: 10px; color: var(--text-2); font-family: var(--font-body); font-weight: 500; margin-top: 2px; }

@media (max-width: 768px) {
    body { flex-direction: column-reverse; } 
    #sidebar { width: 100%; height: 50vh; max-height: 50vh; border-right: none; border-top: 1px solid var(--border-color); box-shadow: 0 -8px 20px rgba(0,0,0,0.08); border-radius: 20px 20px 0 0; overflow-y: auto; padding-bottom: 20px; } 
    .catalogo { overflow-y: visible; height: auto; } 
    .toolbar-row { flex-wrap: wrap; } 
    #area-trabajo { width: 100%; height: 50vh; padding: 10px; overflow: hidden; align-items: flex-start; justify-content: flex-start; } 
    #map { width: calc(100% - 20px); height: calc(100% - 20px); top: 10px; left: 10px; } 
    #canvas-wrapper { width: 100%; height: 100%; transform: none; margin: 0; border-radius: 14px; } 
    .vineta-plano { bottom: 10px; right: 10px; transform: scale(0.9); transform-origin: bottom right; } 
    .form-grid { grid-template-columns: 1fr; } 
    .span-2 { grid-column: span 1; } 
    .modal-content { width: 95%; padding: 20px; }
    #banner-instrucciones { width: 90%; font-size: 13px; top: 40px; padding: 10px 20px; }
}