*{box-sizing:border-box} :root{--navy:#123e69;--blue:#176ba5;--lime:#b8c91b;--ink:#172b4d;--muted:#64748b;--line:#dce6f0}body{margin:0;background:#f4f7fb;color:var(--ink);font:15px system-ui,-apple-system,Segoe UI,sans-serif}.app-shell{min-height:100vh;display:flex}.sidebar{width:255px;flex:0 0 255px;background:#102f50;color:white;display:flex;flex-direction:column;padding:24px 16px;min-height:100vh}.brand{display:flex;align-items:center;gap:10px;color:white;text-decoration:none;padding:0 8px 28px;border-bottom:1px solid #ffffff25}.brand-mark{width:42px;height:42px;display:grid;place-items:center;background:var(--lime);color:#17334e;border-radius:12px;font-weight:900}.brand b{display:block;font-size:15px;letter-spacing:.5px}.brand small{display:block;font-size:11px;letter-spacing:2px;color:#cbd8e5}.side-label{font-size:10px;letter-spacing:1.6px;color:#9eb2c8;margin:25px 10px 12px}.side-nav{display:grid;gap:7px}.side-nav a{display:flex;align-items:center;gap:12px;padding:12px;border-radius:9px;color:#dbe6f1;text-decoration:none;font-weight:550}.side-nav a span{width:22px;text-align:center;font-size:19px}.side-nav a:hover,.side-nav a:focus{background:#ffffff17;color:white}.side-nav a[href="users.php"]{ } .side-user{margin-top:auto;border-top:1px solid #ffffff25;padding:18px 4px 0;display:flex;align-items:center;gap:10px}.avatar{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;background:#dce9f4;color:var(--navy);font-weight:800}.user-meta{min-width:0;flex:1}.user-meta b,.user-meta small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.user-meta b{font-size:13px}.user-meta small{font-size:12px;color:#aebfd0;margin-top:3px}.logout{color:white;text-decoration:none;font-size:22px}.main-area{min-width:0;flex:1;display:flex;flex-direction:column}.topbar{height:84px;background:#fff;border-bottom:1px solid var(--line);padding:16px 32px;display:flex;align-items:center;justify-content:space-between;gap:20px}.topbar strong,.eyebrow{display:block}.topbar strong{font-size:21px;color:var(--navy);margin-top:2px}.eyebrow{font-size:10px;letter-spacing:1.5px;color:var(--muted)}.online{font-size:12px;color:#46617a}.online i{display:inline-block;width:7px;height:7px;border-radius:50%;background:#22a06b;margin-right:6px}.wrap{width:100%;max-width:1500px;margin:0 auto;padding:28px 32px;flex:1}.card{background:white;padding:24px;border:1px solid #e5ebf2;border-radius:14px;box-shadow:0 5px 20px #163b5c08;margin-bottom:20px}h1{margin:0 0 22px;color:var(--navy);font-size:27px}h2{font-size:19px;margin-top:0;color:var(--navy)}label{display:block;font-weight:650;margin:10px 0 5px}input,select,textarea{width:100%;padding:11px;border:1px solid #cbd5e1;border-radius:7px;background:white;font:inherit;color:var(--ink)}input:focus,select:focus,textarea:focus{outline:2px solid #b7d7ef;border-color:var(--blue)}textarea{min-height:80px}.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.btn{display:inline-block;background:var(--blue);color:white;border:0;padding:11px 16px;border-radius:7px;text-decoration:none;font-weight:650;cursor:pointer}.btn:hover{filter:brightness(.94)}.btn.secondary{background:#e8eff7;color:var(--navy)}.btn.danger{background:#a12b36}.actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:18px}table{width:100%;border-collapse:collapse;background:white}th,td{padding:12px;border-bottom:1px solid #e2e8f0;text-align:left;vertical-align:top}th{background:#edf3f8;color:#244867;font-size:13px}tr:hover td{background:#fafcff}.tablewrap{overflow:auto}.muted{color:var(--muted)}.total{text-align:right;font-size:18px;font-weight:750}.error{background:#fee2e2;padding:12px;border-radius:8px;color:#991b1b}.success{background:#dcfce7;padding:12px;border-radius:8px;color:#166534}.small{font-size:13px}.login{max-width:440px;margin:8vh auto}.login-wrap{max-width:520px}.app-footer{text-align:center;color:#8190a2;font-size:12px;padding:16px;border-top:1px solid var(--line)}footer{text-align:center;color:#64748b;padding:30px}.table-actions{display:flex;gap:7px;flex-wrap:wrap}.table-actions .btn{padding:7px 10px;font-size:12px}.status{display:inline-block;padding:4px 8px;border-radius:20px;font-size:12px;background:#dcfce7;color:#166534}.status.off{background:#f1f5f9;color:#64748b}.section-head{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}@media(max-width:800px){.sidebar{width:72px;flex-basis:72px;padding:18px 8px}.brand{padding:0 5px 20px;justify-content:center}.brand>span:last-child,.side-label,.side-nav a:not(:first-child),.user-meta,.logout{display:none}.side-nav a{justify-content:center;padding:13px 5px}.side-nav a span{font-size:22px}.side-user{justify-content:center}.topbar{padding:14px 18px}.wrap{padding:20px 14px}}@media(max-width:560px){.grid{grid-template-columns:1fr}.card{padding:16px}h1{font-size:23px}.online{display:none}}@media print{.sidebar,.topbar,.app-footer,footer,.no-print{display:none!important}.main-area{display:block}.wrap{max-width:none;margin:0;padding:0}.card{box-shadow:none;border:0;padding:5px}table{font-size:12px}}

/* Seguimiento y analítica */
.badge{display:inline-block;background:#eaf3fb;color:#164f7e;border-radius:20px;padding:5px 10px;font-size:12px;font-weight:700}.follow-form{display:grid;grid-template-columns:130px minmax(160px,1fr) 145px auto;gap:6px;min-width:540px}.follow-form input,.follow-form select{width:100%;min-width:0;padding:8px;border:1px solid #d3dfeb;border-radius:7px;background:white}.muted{color:#718096}.card h2{margin-top:0}@media(max-width:760px){.follow-form{grid-template-columns:1fr;min-width:0}.grid{grid-template-columns:1fr}}

/* Plantilla de cotización: impresión en tamaño carta */
.quote-sheet{max-width:8.5in;min-height:10.5in;margin:0 auto 24px;padding:0.28in;background:#fff;border-radius:0}
.quote-header{display:flex;justify-content:space-between;align-items:flex-start;gap:18px;flex-wrap:nowrap;border-bottom:3px solid var(--blue);padding-bottom:12px}
.quote-header>div:first-child{min-width:0;flex:1;font-size:11px;line-height:1.45;overflow-wrap:anywhere}
.quote-header>div:last-child{flex:0 0 180px;text-align:right;font-size:12px}
.quote-header h1{font-size:20px;line-height:1.15;margin:0 0 7px}
.quote-header p{margin:8px 0 0;line-height:1.5}
.quote-parties{grid-template-columns:1fr 1fr;gap:18px;margin:14px 0!important;font-size:11px;line-height:1.45}
.quote-parties h2{font-size:13px;margin:0 0 5px;padding-bottom:4px;border-bottom:1px solid var(--line)}
.quote-parties p{margin:4px 0;overflow-wrap:anywhere}
.quote-sheet .tablewrap{overflow:visible}
.quote-sheet table{table-layout:fixed;font-size:10px}
.quote-sheet th,.quote-sheet td{padding:6px 5px;overflow-wrap:anywhere;word-break:normal}
.quote-sheet th{font-size:9px;line-height:1.2}
.quote-sheet th:nth-child(1),.quote-sheet td:nth-child(1){width:5%;text-align:center}
.quote-sheet th:nth-child(2),.quote-sheet td:nth-child(2){width:13%}
.quote-sheet th:nth-child(3),.quote-sheet td:nth-child(3){width:32%}
.quote-sheet th:nth-child(4),.quote-sheet td:nth-child(4){width:9%;text-align:right}
.quote-sheet th:nth-child(5),.quote-sheet td:nth-child(5){width:14%;text-align:right}
.quote-sheet th:nth-child(6),.quote-sheet td:nth-child(6){width:9%;text-align:right}
.quote-sheet th:nth-child(7),.quote-sheet td:nth-child(7){width:18%;text-align:right}
.quote-totals{display:flex;justify-content:flex-end;margin-top:12px}
.quote-totals-inner{width:250px;max-width:100%;font-size:11px}
.quote-totals-inner p{margin:5px 0;display:flex;justify-content:space-between;gap:12px}
.quote-totals-inner p strong{white-space:nowrap}
.quote-grand-total{display:flex;justify-content:space-between;gap:10px;background:#164f7e;color:#fff;padding:10px;margin:8px 0 0;font-size:16px}
.quote-grand-total span{white-space:nowrap}
.quote-sheet>h2{font-size:13px;margin:15px 0 5px}
.quote-sheet>p{font-size:11px;line-height:1.45}
.quote-signature{margin-top:24px!important;line-height:1.55}
@page{size:letter portrait;margin:0.35in}
@media print{
  html,body{width:auto!important;min-height:0!important;background:#fff!important;margin:0!important;padding:0!important;font-size:10pt;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .app-shell,.main-area{display:block!important;min-height:0!important;width:auto!important}
  .sidebar,.topbar,.app-footer,footer,.no-print{display:none!important}
  .wrap{display:block!important;width:auto!important;max-width:none!important;margin:0!important;padding:0!important;flex:none!important}
  .quote-sheet{width:auto!important;max-width:none!important;min-height:0!important;margin:0!important;padding:0!important;border:0!important;border-radius:0!important;box-shadow:none!important;overflow:visible!important}
  .quote-header{break-inside:avoid;page-break-inside:avoid}
  .quote-parties{break-inside:avoid;page-break-inside:avoid}
  .quote-sheet .tablewrap{overflow:visible!important}
  .quote-sheet table{width:100%!important;font-size:8.5pt!important}
  .quote-sheet th,.quote-sheet td{padding:4px 3px!important}
  .quote-sheet tr{break-inside:avoid;page-break-inside:avoid}
  .quote-totals,.quote-totals-inner,.quote-grand-total{break-inside:avoid;page-break-inside:avoid}
  .quote-signature{break-inside:avoid;page-break-inside:avoid;margin-top:18px!important}
  a{color:inherit;text-decoration:none}
}

/* Imágenes de catálogo y cotización */
.product-thumb{width:58px;height:48px;object-fit:contain;background:#fff;border:1px solid #e2e8f0;border-radius:5px;padding:2px}
.product-image-preview{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:8px}
.product-image-preview img{max-width:130px;max-height:100px;object-fit:contain;border:1px solid #dbe2ea;border-radius:6px;padding:4px;background:#fff}
.quote-sheet .quote-product-image{width:58px;text-align:center}
.quote-sheet .quote-product-image img{max-width:54px;max-height:48px;object-fit:contain;display:block;margin:0 auto}
.quote-sheet th:nth-child(1),.quote-sheet td:nth-child(1){width:4%;text-align:center}
.quote-sheet th:nth-child(2),.quote-sheet td:nth-child(2){width:9%;text-align:center}
.quote-sheet th:nth-child(3),.quote-sheet td:nth-child(3){width:10%}
.quote-sheet th:nth-child(4),.quote-sheet td:nth-child(4){width:28%}
.quote-sheet th:nth-child(5),.quote-sheet td:nth-child(5){width:8%;text-align:right}
.quote-sheet th:nth-child(6),.quote-sheet td:nth-child(6){width:13%;text-align:right}
.quote-sheet th:nth-child(7),.quote-sheet td:nth-child(7){width:8%;text-align:right}
.quote-sheet th:nth-child(8),.quote-sheet td:nth-child(8){width:20%;text-align:right}

/* Logotipo original del Excel en la cotización */
.quote-brand{display:flex;align-items:center;gap:14px;min-width:0}.quote-logo{width:92px;height:92px;object-fit:contain;flex:0 0 92px}.quote-header{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;border-bottom:3px solid var(--lime);padding-bottom:14px;margin-bottom:18px}.quote-header>div:last-child{text-align:right;flex:0 0 auto}.quote-header h1{font-size:22px}.quote-sheet{color:#172b4d;background:#fff}.quote-product-image img{max-width:58px;max-height:48px;object-fit:contain}@page{size:letter portrait;margin:10mm}@media print{.quote-sheet{padding:0!important}.quote-logo{width:78px;height:78px;flex-basis:78px}.quote-header{break-inside:avoid}.quote-brand{gap:10px}}

/* Pie comercial de la cotización */
.quote-terms{margin-top:16px;border:1px solid #cbd5e1;break-inside:avoid;page-break-inside:avoid;font-size:9.5px;line-height:1.35}
.quote-terms h2{margin:0;padding:6px 8px;background:#123e69;color:#fff;font-size:11px;letter-spacing:.35px}
.quote-terms ul{margin:0;padding:7px 10px 4px 25px}
.quote-terms li{padding:2px 0}
.quote-bank{margin:0;padding:4px 10px 8px;border-top:1px solid #dce6f0;overflow-wrap:anywhere}
.quote-contact-footer{margin-top:8px;text-align:center;font-size:9.5px;line-height:1.35;border-top:1px solid #cbd5e1;padding-top:6px;break-inside:avoid;page-break-inside:avoid}
.quote-contact-footer p{margin:3px 0}
.quote-contact-footer .quote-thanks{margin-top:7px;padding:6px 4px;background:#edf3f8;color:#123e69;font-weight:700}
@media print{
  .quote-terms,.quote-contact-footer{break-inside:avoid!important;page-break-inside:avoid!important}
  .quote-terms{font-size:8pt!important;margin-top:10px!important}
  .quote-terms h2{font-size:9pt!important;padding:4px 6px!important}
  .quote-terms ul{padding-top:4px!important;padding-bottom:2px!important}
  .quote-terms li{padding:1px 0!important}
  .quote-bank{padding:3px 7px 5px!important}
  .quote-contact-footer{font-size:8pt!important;margin-top:5px!important;padding-top:4px!important}
  .quote-contact-footer .quote-thanks{padding:4px!important;margin-top:4px!important}
}
