:root{
    --navy:#0B2A3B; --navy-2:#123c52; --sea:#1B8A9C; --sea-d:#13707f;
    --bg:#F4F2EC; --panel:#ffffff; --line:#d9d6cc; --ink:#1d2b33;
    --muted:#6b7780; --good:#1f7a4d; --warn:#a8521b; --danger:#9b2c2c;
  }
  *{box-sizing:border-box}
  body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
       background:var(--bg);color:var(--ink);font-size:15px;line-height:1.45}
  h1,h2,h3{margin:0;font-weight:650;letter-spacing:-.01em}
  button{font:inherit;cursor:pointer;border:none;border-radius:8px;padding:9px 14px;
         background:var(--sea);color:#fff;font-weight:600}
  button:hover{background:var(--sea-d)}
  button.ghost{background:transparent;color:var(--navy);border:1px solid var(--line)}
  button.ghost:hover{background:#0000000a}
  button.sm{padding:5px 10px;font-size:13px}
  button.danger{background:var(--danger)}
  input,select{font:inherit;padding:8px 10px;border:1px solid var(--line);border-radius:8px;
               background:#fff;color:var(--ink);width:100%}
  label{display:block;font-size:12px;color:var(--muted);margin:0 0 4px;font-weight:600;
        text-transform:uppercase;letter-spacing:.04em}
  .field{margin-bottom:12px}
  textarea{font:inherit;padding:8px 10px;border:1px solid var(--line);border-radius:8px;background:#fff;color:var(--ink);width:100%;resize:vertical}
  .row{display:flex;gap:12px;flex-wrap:wrap}
  .row > *{flex:1;min-width:120px}
  .card{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:18px;margin-bottom:16px}
  .muted{color:var(--muted)}
  .pill{display:inline-block;padding:2px 9px;border-radius:999px;font-size:12px;font-weight:600}
  .pill.planta{background:#0b2a3b14;color:var(--navy)}
  .pill.practicante{background:#1b8a9c1f;color:var(--sea-d)}
  table{width:100%;border-collapse:collapse}
  th,td{text-align:left;padding:8px 6px;border-bottom:1px solid var(--line);font-size:14px}
  th{font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted)}
  td.num,th.num{text-align:right;font-variant-numeric:tabular-nums}

  /* shell */
  header.app{background:var(--navy);color:#fff;padding:14px 20px;display:flex;
             align-items:center;justify-content:space-between;gap:12px}
  header.app .brand{display:flex;align-items:center;gap:12px}
  header.app .mark{width:34px;height:34px;border-radius:9px;background:var(--sea);
        display:grid;place-items:center;font-weight:800;color:#fff;letter-spacing:.05em}
  header.app small{color:#9fc4cc;display:block;font-weight:500}
  nav.tabs{display:flex;gap:4px;padding:10px 16px 0;flex-wrap:wrap;background:var(--navy)}
  nav.tabs button{background:#ffffff14;color:#cfe2e6;border-radius:9px 9px 0 0;font-weight:600}
  nav.tabs button.active{background:var(--bg);color:var(--navy)}
  main{max-width:980px;margin:0 auto;padding:20px}
  .sectionhead{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px;gap:10px;flex-wrap:wrap}
  .totbox{display:flex;justify-content:space-between;padding:6px 0;border-bottom:1px solid var(--line)}
  .totbox.neto{font-size:20px;font-weight:800;border-bottom:none;padding-top:10px;color:var(--navy)}
  .lineitem{display:flex;gap:8px;align-items:center;margin-bottom:8px}
  .lineitem input.concepto{flex:2}
  .lineitem input.monto{flex:1;max-width:130px;text-align:right}
  .addbar{display:flex;gap:6px;flex-wrap:wrap;margin:8px 0 4px}
  .addbar button{background:#0b2a3b10;color:var(--navy);font-size:13px;padding:6px 11px}
  .addbar button:hover{background:#0b2a3b1f}
  .letra{font-style:italic;color:var(--navy)}
  .status-good{color:var(--good);font-weight:600}
  .status-warn{color:var(--warn);font-weight:600}
  .notice{background:#fff7e6;border:1px solid #f0d8a0;border-radius:10px;padding:14px;margin-bottom:16px}
  .login{max-width:360px;margin:8vh auto;text-align:center}
  .login .mark{width:54px;height:54px;border-radius:14px;background:var(--navy);color:#fff;
       display:grid;place-items:center;font-weight:800;font-size:20px;margin:0 auto 14px}
  .hidden{display:none}
  .toast{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);background:var(--navy);
         color:#fff;padding:11px 18px;border-radius:10px;box-shadow:0 6px 20px #0003;z-index:50}

  /* recibo */
  #reciboPrint{display:none}
  .recibo{max-width:540px;margin:0 auto;font-size:13px;color:#10212b;border:1px solid var(--line);background:#fff;
          -webkit-print-color-adjust:exact;print-color-adjust:exact}
  .recibo .rhead{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 22px 12px;border-bottom:2.5px solid var(--navy)}
  .recibo .rhead img{height:62px;width:auto;display:block}
  .recibo .rhead .co{text-align:right;font-size:10.5px;color:#5a6b73;line-height:1.45}
  .recibo .rhead .co b{display:block;color:var(--navy);font-size:12px}
  .recibo .rbody{padding:16px 22px 22px}
  .recibo .who{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:6px}
  .recibo .who .nm{font-size:15px;font-weight:700;color:var(--navy)}
  .recibo .who .sub{font-size:11px;color:#5a6b73}
  .recibo .who .rt{text-align:right;font-size:11px;color:#5a6b73;line-height:1.5}
  .recibo .sec{font-size:11px;font-weight:700;letter-spacing:.09em;color:var(--sea-d);text-transform:uppercase;margin:14px 0 5px;border-bottom:1px solid var(--line);padding-bottom:3px}
  .recibo .ln{display:flex;justify-content:space-between;padding:3px 0;font-size:12.5px}
  .recibo .ln .v{font-variant-numeric:tabular-nums}
  .recibo .tot{display:flex;justify-content:space-between;padding:5px 0 2px;margin-top:2px;border-top:1px solid var(--line);font-weight:700;font-size:12.5px;color:var(--navy)}
  .recibo .neto{display:flex;justify-content:space-between;align-items:center;margin-top:14px;background:#1B8A9C14;border:1px solid #1B8A9C66;border-radius:9px;padding:10px 14px}
  .recibo .neto .lbl{font-weight:700;color:var(--navy)}
  .recibo .neto .amt{font-weight:800;font-size:18px;color:var(--navy)}
  .recibo .letra{font-style:italic;font-size:11.5px;color:var(--navy);margin-top:5px}
  .recibo .leg{font-size:10px;color:#5a6b73;margin-top:14px;line-height:1.5;padding-bottom:14px}
  .recibo .firma{margin:46px auto 14px;border-top:1px solid #10212b;width:62%;text-align:center;padding-top:8px;font-size:11px}

  .recibo .nom-title{background:var(--navy);color:#fff;text-align:center;font-weight:700;letter-spacing:.08em;padding:8px;font-size:14px}
  /* documento de cotización */
  .cotiz-doc{font-size:11px;color:#10212b;max-width:18cm;margin:0 auto}
  .cot-head{display:flex;justify-content:space-between;align-items:flex-start;gap:20px;border-bottom:2px solid #333;padding-bottom:10px}
  .cot-head img{height:52px}
  .cot-co{font-size:10.5px;line-height:1.55;text-align:left;min-width:9cm}
  .cot-presu{font-weight:700;margin:16px 0 10px;font-size:13px}
  .cot-vc{display:flex;gap:60px;font-size:11px;margin-bottom:16px;line-height:1.6}
  .cot-tbl{width:100%;border-collapse:collapse;font-size:10px}
  .cot-tbl th{background:#eceff2;text-align:left;padding:6px;font-size:9px;letter-spacing:.02em}
  .cot-tbl td{padding:9px 6px;vertical-align:top;border-bottom:1px solid #eee}
  .cot-tbl td.c{text-align:center;white-space:nowrap}
  .cot-tbl td.desc{width:38%}
  .cot-tot{margin-top:26px;margin-left:auto;width:300px;font-size:11px}
  .cot-tot .l{display:flex;justify-content:space-between;padding:4px 0}
  .cot-tot .l.total{font-weight:700;border-top:1px solid #333;margin-top:4px;padding-top:7px}
  .cot-firma-pg{page-break-before:always;padding-top:36px}
  .cot-firma-pg h3{font-size:13px;margin-bottom:16px}
  .cot-firma-pg p{font-size:11px;line-height:1.7;max-width:16cm}
  .cot-terms{page-break-before:always;font-size:8.7px;line-height:1.4;color:#1a1a1a}
  .cot-terms h3{text-align:center;font-size:15px;margin:0 0 10px}
  .cot-terms .pre{margin-bottom:8px;font-size:8.7px}
  .cot-terms .intro{font-weight:700;margin:8px 0 10px}
  .cot-terms .s{margin:6px 0}
  .cot-terms .s .tt{font-weight:700}
  .cot-bank{margin-top:16px;color:#0b5e6b;font-size:10px;line-height:1.7;font-weight:600}
  .cot-aprob{margin-top:30px;text-align:center;color:#0b5e6b}
  .cot-aprob .ln2{margin-bottom:6px;letter-spacing:.5px}
  .cot-aprob .ap-firma{font-weight:700;font-size:12px;margin-bottom:8px}
  .cot-aprob p{font-size:10px;line-height:1.6;max-width:15cm;margin:0 auto}
  .cot-sign{margin-top:90px;font-size:11px}
  /* recibo de apoyo (practicantes) */
  .recibo.apoyo{padding:0;color:#10212b}
  .apoyo-title{background:#5b6b86;color:#fff;text-align:center;font-weight:700;letter-spacing:.08em;padding:9px;font-size:14px}
  .apoyo-top{display:flex;justify-content:space-between;align-items:flex-start;padding:12px 16px 6px}
  .apoyo-top img{height:40px}
  .apoyo-meta{font-size:12px;line-height:1.7}
  .apoyo-body{padding:6px 16px 16px}
  .apoyo-boxes{display:flex;gap:10px}
  .apoyo-box{flex:1;border:1px solid #9bb0c9;border-radius:4px;padding:9px 11px;font-size:11.5px;line-height:1.55}
  .apoyo-box .bx-t{font-weight:700;color:#2b3a4a;margin-bottom:5px;letter-spacing:.03em}
  .apoyo-firma{margin-top:26px;font-size:11px}
  .apoyo-leg{margin-top:16px;font-size:9.5px;color:#5a6b73;text-align:center}

  @media print{
    @page{margin:10mm}
    body{background:#fff}
    header.app,nav.tabs,main,.toast{display:none !important}
    #reciboPrint{display:block !important}
    #previewOverlay{display:none !important}
    #reciboPrint,#reciboPrint *{ -webkit-print-color-adjust:exact; print-color-adjust:exact }
    .hoja{display:flex;gap:8mm;align-items:stretch;page-break-after:always;min-height:16cm}
    .hoja:last-child{page-break-after:auto}
    .hoja > .recibo{flex:0 0 48%;max-width:48%;border:1px solid #999;display:flex;flex-direction:column}
    .hoja > .recibo .rbody,.hoja > .recibo .apoyo-body{flex:1;display:flex;flex-direction:column}
    .cotiz-doc{ -webkit-print-color-adjust:exact; print-color-adjust:exact }
  }
  @media (max-width:640px){
    main{padding:12px}
    header.app{padding:12px 14px}
    table{display:block;overflow-x:auto;white-space:nowrap;-webkit-overflow-scrolling:touch}
    .sectionhead{flex-wrap:wrap;gap:8px}
    .row > *{min-width:140px}
  }

/* ============ RESPONSIVE (agregado) — no afecta escritorio ============ */
@media (max-width: 820px){
  main{ padding:14px }
  nav.tabs{ flex-wrap:nowrap; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:thin }
  nav.tabs button{ flex:0 0 auto; white-space:nowrap }
  .card{ padding:14px }
}
@media (max-width: 560px){
  .card{ padding:12px }
  .row{ flex-direction:column }
  .row > *{ min-width:0; width:100% }
  input, select, textarea{ font-size:16px } /* evita el zoom automático en iOS */
  .sectionhead h2, h2{ font-size:18px }
  header.app .brand-title, header.app b{ font-size:15px }
}
