:root{--blue:#095aa5;--dark:#111;--bg:#c9ced3;--card:#fff;--line:#d8dee6;--ok:#0f7b3f;--danger:#c62828}*{box-sizing:border-box}body{margin:0;background:var(--bg);font-family:Arial,Helvetica,sans-serif;color:#1d2430}.top{position:sticky;top:0;z-index:10;display:flex;align-items:center;gap:24px;background:linear-gradient(#e7eaee,#b5bbc2);border-bottom:1px solid #777;padding:8px 18px}.brand{font-size:22px;font-weight:700;margin-right:auto}nav a{color:#111;text-decoration:none;margin-right:18px;font-weight:700;font-size:13px;letter-spacing:.08em}.user{font-size:12px}.wrap{padding:18px}.foot{text-align:center;padding:16px;color:#555}.card{background:var(--card);border-radius:12px;box-shadow:0 2px 14px rgba(0,0,0,.08);padding:18px;margin-bottom:18px}.login{max-width:420px;margin:60px auto}.grid{display:grid;gap:16px}.kpis{grid-template-columns:repeat(3,minmax(0,1fr))}.kpis b{font-size:34px;display:block;color:var(--blue)}.kpis span{color:#667}label{display:block;font-size:13px;margin-bottom:10px}input,select,textarea{width:100%;border:1px solid var(--line);border-radius:7px;padding:9px;background:#fff;font:inherit}button,.btn{display:inline-block;background:var(--blue);color:#fff;border:0;border-radius:7px;padding:10px 18px;text-decoration:none;cursor:pointer}.secondary{background:#5d6978}.alert{background:#ffe1df;color:#8b0000;padding:10px;border-radius:8px;margin:10px 0}.ok{background:#dff5e8;color:var(--ok);padding:10px;border-radius:8px}.form-grid{display:grid;grid-template-columns:repeat(5,minmax(180px,1fr));gap:12px}.full{grid-column:1/-1}.actions{display:flex;gap:10px}.axis-grid{display:grid;grid-template-columns:repeat(5,minmax(220px,1fr));gap:10px;overflow:auto}fieldset{border:1px solid var(--line);border-radius:10px;padding:12px;min-width:220px}legend{font-weight:700;color:var(--blue)}.photo-grid{display:grid;grid-template-columns:repeat(4,minmax(220px,1fr));gap:14px}.photo-box{background:#f8fafc;border:1px solid var(--line);border-radius:10px;padding:10px}.photo-box img{width:100%;height:130px;object-fit:cover;border-radius:8px;margin:8px 0}.empty{height:130px;background:#e8edf2;border-radius:8px;display:grid;place-items:center;color:#667;margin:8px 0}.table-wrap{overflow:auto}table{width:100%;border-collapse:collapse;background:#fff}th,td{border:1px solid #222;padding:7px;text-align:center;font-size:12px}th{background:#eef1f4}.search{display:flex;gap:8px;margin-bottom:12px}.certificate{background:#fff;color:#000;max-width:1180px;margin:auto;padding:18px}.cert-head{background:#950000;color:#fff;text-align:center;padding:10px}.certificate h1{margin:0;letter-spacing:.2em}.certificate h2{background:#dfe4e8;text-align:center;padding:7px;margin:12px 0 0;font-size:15px}.box{border:1px solid #333;min-height:80px;padding:12px}.qr img{width:130px;height:130px}.qr small{display:block;font-size:10px}.no-print{margin-top:16px;display:flex;gap:10px}@media(max-width:900px){.top{flex-wrap:wrap}.brand{width:100%;font-size:18px}.kpis,.form-grid,.photo-grid{grid-template-columns:1fr}.axis-grid{grid-template-columns:1fr}.wrap{padding:10px}nav a{display:inline-block;margin:5px 10px 5px 0}.search{display:block}.search button{margin-top:8px;width:100%}table{min-width:780px}.certificate{padding:6px}.certificate h1{font-size:16px}.cert-head{padding:8px}}@media print{.top,.foot,.no-print{display:none}.wrap{padding:0}.certificate{box-shadow:none;max-width:none}.certificate table{page-break-inside:auto}body{background:#fff}}
.muted{color:#5f6b7a}.section-title{background:#095aa5;color:#fff;text-align:center;font-weight:700;padding:9px;border-radius:6px;text-transform:uppercase;letter-spacing:.03em}.form-complete label{font-weight:600}.inner-grid{grid-template-columns:repeat(4,minmax(170px,1fr))}.two-cols{display:grid;grid-template-columns:1fr 1fr;gap:14px}.responsive-table{overflow:auto}.mini-table input{border:0;border-radius:0;padding:7px;min-width:120px}.mini-table th,.mini-table td{padding:3px}.axis-wide fieldset{min-width:250px}.doc-preview{display:grid;place-items:center;height:130px;background:#eef1f4;border-radius:8px;color:#095aa5;text-decoration:none;font-weight:700;margin:8px 0}.cert-title{border:3px solid #111;border-bottom:0;display:flex;justify-content:center;position:relative;padding:5px;font-size:15px;letter-spacing:.05em}.cert-title span{position:absolute;right:8px;font-size:10px;letter-spacing:0}.cert-full{font-family:Arial,Helvetica,sans-serif;max-width:1120px}.cert-full h2{background:#d7d7d7;border:2px solid #111;border-bottom:0;margin:0;padding:5px;font-size:13px}.cert-full table{margin:0 0 8px 0;table-layout:fixed}.cert-full th,.cert-full td{border:2px solid #111;font-size:10px;line-height:1.25;padding:4px;vertical-align:middle}.cert-full th{background:#fff}.cert-full .cert-split{display:grid;grid-template-columns:2fr 1fr;gap:0}.cert-full .cert-split>div{min-width:0}.cert-full .qr img{width:110px;height:110px}.cert-full .box{border:2px solid #111;min-height:58px;margin:0 0 8px 0;font-size:11px}
@media(max-width:1100px){.two-cols{grid-template-columns:1fr}.inner-grid{grid-template-columns:1fr}.cert-full{overflow:auto}.cert-full .cert-split{grid-template-columns:1fr}.cert-full table{min-width:980px}}@media print{@page{size:A4 portrait;margin:7mm}.cert-full{width:100%;max-width:none;padding:0}.cert-full th,.cert-full td{font-size:7.5px;padding:2px;border-width:1px}.cert-full h2{font-size:9px;padding:2px;border-width:1px}.cert-title{border-width:1px;font-size:11px}.cert-full .qr img{width:75px;height:75px}.cert-full table{min-width:0}.cert-full .cert-split{grid-template-columns:2fr 1fr}.cert-full .box{min-height:35px;border-width:1px}}

/* Visual refresh */
body{background:linear-gradient(180deg,#e9eef5 0,#d8e0ea 100%)}
.top{background:linear-gradient(135deg,#0b1731 0%, #13408d 58%, #1f68c2 100%);color:#fff;border-bottom:0;box-shadow:0 6px 18px rgba(15,23,42,.18)}
.brand{color:#fff;letter-spacing:.02em}
.top nav a{color:rgba(255,255,255,.92);padding:9px 12px;border-radius:8px;transition:.18s;background:transparent}
.top nav a:hover{background:rgba(255,255,255,.12)}
.user{color:rgba(255,255,255,.92)}
.card{border:1px solid rgba(9,90,165,.08);box-shadow:0 10px 28px rgba(15,23,42,.08)}
.page-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:10px}
button,.btn{background:linear-gradient(135deg,#0a5db5,#0f77d5);box-shadow:0 8px 16px rgba(15,119,213,.18);font-weight:700}
button:hover,.btn:hover{filter:brightness(1.03)}
.secondary{background:linear-gradient(135deg,#5b6878,#697789)}
.btn-danger{background:linear-gradient(135deg,#c62828,#e14b4b)}
input,select,textarea{background:#fbfdff;border:1px solid #d8e2ef;box-shadow:inset 0 1px 2px rgba(15,23,42,.03)}
input:focus,select:focus,textarea:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 3px rgba(59,130,246,.15)}
.section-title{background:linear-gradient(135deg,#0a4f93,#0d6bc1)}
.sticky-actions{position:sticky;bottom:10px;z-index:5;background:#fff;padding:10px;border-radius:12px;box-shadow:0 -5px 18px rgba(15,23,42,.08)}
.upload-card{padding-top:16px}
.upload-head{display:flex;justify-content:space-between;align-items:flex-start;gap:10px;margin-bottom:14px}
.upload-head h2{margin:0 0 6px 0}
.pill{background:#e8f1fc;color:#0a5db5;font-weight:700;border-radius:999px;padding:8px 12px;font-size:12px;white-space:nowrap}
.enhanced-grid{grid-template-columns:repeat(4,minmax(230px,1fr))}
.enhanced-box{position:relative;display:flex;flex-direction:column;gap:8px;background:linear-gradient(180deg,#fbfdff,#f3f7fb);border:1px solid #d9e4f0;padding:12px;border-radius:16px}
.slot-number{position:absolute;top:10px;right:10px;background:#0f67be;color:#fff;border-radius:999px;padding:4px 9px;font-size:11px;font-weight:700;letter-spacing:.06em}
.preview-shell{position:relative}
.preview-image{display:none;width:100%;height:160px;object-fit:cover;border-radius:12px;border:1px solid #d3dfeb;background:#eef3f8}
.preview-image.visible{display:block}
.preview-placeholder{height:160px;border:2px dashed #c8d7e8;background:#f6f9fc;border-radius:12px;color:#6d7e91;font-weight:700}
.file-label{display:flex;align-items:center;justify-content:center;background:#eef4fb;border:1px solid #cfe0f2;border-radius:10px;padding:10px 12px;cursor:pointer;position:relative;overflow:hidden;margin:0}
.file-label span{font-weight:700;color:#0a5db5}
.file-label input[type=file]{position:absolute;inset:0;opacity:0;cursor:pointer}
.file-label.disabled{opacity:.6;cursor:not-allowed}
.meta{color:#6a7685;font-size:12px}
.upload-form,.delete-form{display:flex;flex-direction:column;gap:8px;margin:0}
.upload-actions{display:flex;gap:8px}
.upload-actions button,.full-delete{width:100%}
.full-delete{padding:9px 12px}
.cert-number-bar{border-left:3px solid #111;border-right:3px solid #111;border-bottom:2px solid #111;padding:4px 8px;text-align:center;font-size:12px;font-weight:700;letter-spacing:.03em;background:#f7f7f7}
.photos-certificate-table td{padding:6px;vertical-align:top}
.photo-cell-title{font-size:9px;font-weight:700;text-transform:uppercase;min-height:24px;margin-bottom:5px}
.cert-photo{width:100%;height:110px;object-fit:cover;border:1px solid #111;background:#fff}
.cert-photo-placeholder{height:110px;border:1px dashed #444;display:grid;place-items:center;font-size:10px;background:#fafafa}
@media(max-width:1100px){.enhanced-grid{grid-template-columns:repeat(2,minmax(220px,1fr))}}
@media(max-width:700px){.page-heading,.upload-head{flex-direction:column}.enhanced-grid{grid-template-columns:1fr}.sticky-actions{position:static}}
@media print{.cert-number-bar{border-width:1px;font-size:8px;padding:2px}.photo-cell-title{font-size:6px;min-height:16px}.cert-photo,.cert-photo-placeholder{height:58px}.cert-full .qr img{width:72px;height:72px}}

/* Login redesign */
.login-screen{display:grid;grid-template-columns:1.2fr .8fr;gap:22px;align-items:stretch;min-height:calc(100vh - 130px)}
.login-showcase{border-radius:22px;overflow:hidden;position:relative;min-height:620px;background:url('/assets/img/login-truck.jpg') center center/cover no-repeat;box-shadow:0 16px 40px rgba(15,23,42,.14)}
.login-showcase::before{content:"";position:absolute;inset:0;background:linear-gradient(135deg,rgba(10,22,52,.88) 0%,rgba(9,93,181,.64) 55%,rgba(242,146,33,.55) 100%)}
.login-overlay{position:relative;z-index:1;color:#fff;padding:40px;display:flex;flex-direction:column;justify-content:flex-end;height:100%}
.login-kicker{display:inline-flex;align-self:flex-start;background:rgba(255,255,255,.14);border:1px solid rgba(255,255,255,.24);backdrop-filter:blur(4px);padding:8px 12px;border-radius:999px;font-size:12px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;margin-bottom:18px}
.login-overlay h1{font-size:38px;line-height:1.08;margin:0 0 14px 0;max-width:580px}
.login-overlay p{font-size:17px;line-height:1.5;max-width:560px;color:rgba(255,255,255,.92)}
.login-badges{display:flex;flex-wrap:wrap;gap:10px;margin-top:18px}
.login-badges span{background:rgba(255,255,255,.14);border:1px solid rgba(255,255,255,.18);padding:8px 12px;border-radius:999px;font-weight:700;font-size:13px}
.login-panel{max-width:520px;width:100%;margin:auto;display:flex;flex-direction:column;justify-content:center;padding:28px 26px;border-radius:20px}
.login-panel-head{display:flex;gap:14px;align-items:center;margin-bottom:12px}
.login-panel-head h2{margin:0 0 5px 0;font-size:28px}
.login-logo-mark{width:58px;height:58px;border-radius:16px;background:linear-gradient(135deg,#0d62ba,#f29221);color:#fff;display:grid;place-items:center;font-weight:800;box-shadow:0 10px 24px rgba(15,119,213,.18)}
.login-form-modern{display:grid;gap:14px;margin-top:10px}.login-form-modern button{width:100%;padding:12px 18px;font-size:15px}.login-footer-note{margin-top:14px;color:#64748b;font-size:13px;line-height:1.5}

/* Certificate photo scaling */
.photos-certificate-table{table-layout:fixed;width:100%}
.photos-certificate-table td{width:25%;padding:4px;vertical-align:top;overflow:hidden}
.photo-cell-title{font-size:8px;font-weight:700;text-transform:uppercase;min-height:22px;line-height:1.15;margin-bottom:4px}
.cert-photo,.cert-photo-placeholder{display:block;width:100%;max-width:100%;height:72px;object-fit:cover;border:1px solid #111;background:#fff;overflow:hidden}
.cert-photo-placeholder{display:grid;place-items:center;font-size:9px;background:#fafafa}

@media(max-width:1100px){.login-screen{grid-template-columns:1fr}.login-showcase{min-height:320px}.login-overlay h1{font-size:28px}.login-panel{max-width:none}}
@media(max-width:700px){.login-showcase{min-height:260px}.login-overlay{padding:24px}.login-overlay h1{font-size:24px}.login-overlay p{font-size:15px}}
@media print{.photos-certificate-table td{padding:2px}.photo-cell-title{font-size:5.5px;min-height:13px;margin-bottom:2px}.cert-photo,.cert-photo-placeholder{height:42px;font-size:6px}}


/* v6 certificate image containment - stronger override */
.photos-certificate-table{
  table-layout:fixed !important;
  width:100% !important;
}
.photos-certificate-table td{
  width:25% !important;
  max-width:25% !important;
  padding:3px !important;
  overflow:hidden !important;
  vertical-align:top !important;
}
.photos-certificate-table img.cert-photo{
  width:100% !important;
  max-width:100% !important;
  height:64px !important;
  object-fit:cover !important;
  display:block !important;
  border:1px solid #111 !important;
}
@media print{
  .photos-certificate-table img.cert-photo,
  .cert-photo-placeholder{
    height:38px !important;
  }
}

/* v7 logo login */
.logo-image-mark{
  background:rgba(4,12,24,.98) !important;
  border:2px solid rgba(242,146,33,.85) !important;
  padding:7px !important;
}
.logo-image-mark img{
  width:100% !important;
  height:100% !important;
  object-fit:contain !important;
  display:block !important;
}

/* v8 delete controls */
.actions-cell{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  flex-wrap:wrap;
}
.inline-delete-form{
  display:inline;
  margin:0;
}
.link-danger{
  background:transparent !important;
  box-shadow:none !important;
  border:0 !important;
  color:#c62828 !important;
  padding:0 !important;
  font:inherit !important;
  font-weight:700 !important;
  text-decoration:underline !important;
  cursor:pointer !important;
}
.heading-actions{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}
.heading-actions form{
  margin:0;
}

/* v9 compact action buttons */
.units-table th,
.units-table td{
  vertical-align:middle;
}
.row-actions{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
}
.row-actions form{
  margin:0;
  display:inline-flex;
}
.btn-sm{
  padding:8px 13px !important;
  border-radius:9px !important;
  font-size:13px !important;
  line-height:1.1 !important;
}
.btn-mini,
.btn-mini:visited{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
  padding:6px 9px;
  border-radius:8px;
  background:#eaf2fb;
  color:#0a5db5;
  border:1px solid #cfe0f2;
  font-weight:800;
  font-size:12px;
  text-decoration:none;
  box-shadow:none;
  cursor:pointer;
  white-space:nowrap;
}
.btn-mini:hover{
  filter:brightness(.98);
}
.btn-mini-secondary{
  background:#eef1f5;
  color:#485465;
  border-color:#d7dde6;
}
.btn-mini-danger{
  background:#fff0f0 !important;
  color:#c62828 !important;
  border:1px solid #f0c6c6 !important;
  box-shadow:none !important;
  font:inherit !important;
  font-weight:800 !important;
  font-size:12px !important;
}
.confirm-delete-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
@media(max-width:700px){
  .row-actions{
    justify-content:flex-start;
  }
}

/* v12 - TAD inline upload + 16:9 certificate photos */
.inline-upload-head{display:flex;justify-content:space-between;align-items:center;gap:14px;background:#f6f9fc;border:1px solid #dce7f3;border-radius:12px;padding:12px}.inline-upload-head p{margin:0;color:#425466;line-height:1.45}.inline-file-grid{margin-top:0}.final-save-actions{position:sticky;bottom:0;background:rgba(255,255,255,.98);border-top:1px solid #dbe5f0;padding:14px;border-radius:12px;box-shadow:0 -10px 24px rgba(15,23,42,.08);justify-content:center}.final-save-actions button{min-width:260px;font-size:15px;padding:13px 20px}.hidden-form{display:none}.calc-panel{display:flex;align-items:center;justify-content:space-between;gap:12px;background:#fff8e8;border:1px solid #f4ce8a;border-radius:12px;padding:12px;color:#27364a}.calc-msg{font-weight:700;color:#0a5db5}.preview-shell{aspect-ratio:16/9;width:100%;background:#fff;border-radius:12px;overflow:hidden;border:1px solid #d3dfeb}.preview-image{display:none;width:100%;height:100%;object-fit:contain;background:#fff}.preview-image.visible{display:block}.preview-placeholder{height:100%;border:2px dashed #c8d7e8;background:#f6f9fc;border-radius:12px;color:#6d7e91;font-weight:700}.pdf-shell{aspect-ratio:16/9}.doc-preview{height:100%;margin:0;border-radius:12px}.empty-doc,.selected-doc{display:grid;place-items:center;text-align:center;padding:10px}.selected-doc{background:#e7f7ec!important;color:#0f7b3f!important}
.photos-certificate-table{table-layout:fixed!important;width:100%!important;border-collapse:collapse!important}.photos-certificate-table td{width:33.333%!important;max-width:33.333%!important;padding:3px!important;vertical-align:top!important;overflow:hidden!important}.photo-cell-title{font-size:7.5px!important;font-weight:800!important;text-transform:uppercase!important;min-height:16px!important;line-height:1.05!important;margin-bottom:2px!important}.cert-photo-frame{aspect-ratio:16/9!important;width:100%!important;border:1px dashed #555!important;background:#fff!important;display:grid!important;place-items:center!important;overflow:hidden!important}.cert-photo{width:100%!important;height:100%!important;object-fit:contain!important;display:block!important;border:0!important;background:#fff!important}.cert-photo-placeholder{width:100%!important;height:100%!important;display:grid!important;place-items:center!important;font-size:8px!important;background:#fafafa!important;color:#111!important;border:0!important}.cert-pdf-ok{width:100%;height:100%;display:grid;place-items:center;font-size:8px;font-weight:800;background:#f7f7f7;color:#111}.cert-pdf-frame{border-style:solid!important}.cert-full .photos-certificate-table{margin-bottom:8px!important}
@media(max-width:900px){.inline-upload-head,.calc-panel{flex-direction:column;align-items:flex-start}.final-save-actions{position:static}.final-save-actions button{width:100%;min-width:0}.photos-certificate-table td{width:100%!important;display:block!important;max-width:100%!important}}
@media print{.photos-certificate-table td{padding:2px!important}.photo-cell-title{font-size:5.2px!important;min-height:11px!important}.cert-photo-frame{aspect-ratio:16/9!important}.cert-pdf-ok,.cert-photo-placeholder{font-size:5.5px!important}.final-save-actions{position:static!important}}


/* v13 fix badge overlap in upload cards */
.file-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:8px}
.file-card-title{display:block;flex:1;line-height:1.18;padding-right:0;max-width:calc(100% - 98px)}
.slot-number{position:static !important;flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;background:#0f67be;color:#fff;border-radius:999px;padding:4px 9px;font-size:11px;font-weight:800;letter-spacing:.03em;line-height:1}
.enhanced-box{padding-top:12px}
@media(max-width:700px){.file-card-head{gap:8px}.file-card-title{max-width:calc(100% - 88px)}.slot-number{font-size:10px;padding:4px 8px}}


/* v14 premium polish - carga TAD */
.inline-upload-head{
  align-items:center !important;
  background:linear-gradient(180deg,#f8fbff,#f1f6fc) !important;
  border:1px solid #d8e6f5 !important;
  box-shadow:0 6px 16px rgba(15,23,42,.04) !important;
}
.inline-upload-head .pill{
  font-size:12px !important;
  padding:7px 11px !important;
  background:#0f67be !important;
  color:#fff !important;
  box-shadow:0 5px 12px rgba(15,103,190,.18) !important;
}
.enhanced-grid{
  grid-template-columns:repeat(4,minmax(235px,1fr)) !important;
  gap:14px !important;
}
.enhanced-box{
  min-height:0 !important;
  padding:12px !important;
  border-radius:15px !important;
  background:linear-gradient(180deg,#ffffff,#f7fbff) !important;
  border:1px solid #d8e5f2 !important;
  box-shadow:0 8px 20px rgba(15,23,42,.055) !important;
}
.file-card-head{
  display:grid !important;
  grid-template-columns:minmax(0,1fr) auto !important;
  align-items:start !important;
  gap:8px !important;
  min-height:40px !important;
  margin-bottom:8px !important;
}
.file-card-title{
  font-size:15px !important;
  line-height:1.15 !important;
  font-weight:800 !important;
  color:#172337 !important;
  letter-spacing:.01em !important;
  display:-webkit-box !important;
  -webkit-line-clamp:2 !important;
  -webkit-box-orient:vertical !important;
  overflow:hidden !important;
  max-width:none !important;
}
.slot-number{
  position:static !important;
  height:22px !important;
  min-width:72px !important;
  padding:4px 8px !important;
  border-radius:999px !important;
  font-size:10px !important;
  line-height:1 !important;
  letter-spacing:.04em !important;
  background:linear-gradient(135deg,#0b5fb3,#0d7ad7) !important;
  box-shadow:0 4px 10px rgba(15,103,190,.18) !important;
}
.preview-shell{
  border-radius:13px !important;
  border:1px solid #d4e1ef !important;
  background:#fff !important;
}
.preview-placeholder{
  border:2px dashed #cbd9e8 !important;
  color:#6b7d90 !important;
  font-size:14px !important;
}
.doc-preview{
  font-size:14px !important;
  color:#52657a !important;
}
.meta{
  min-height:16px !important;
  font-size:12px !important;
  color:#6b7787 !important;
}
.file-label{
  min-height:37px !important;
  border-radius:10px !important;
  background:#eef6ff !important;
  border:1px solid #cfe2f6 !important;
}
.file-label span{
  color:#0b5fb3 !important;
  font-size:13px !important;
}
.full-delete{
  min-height:34px !important;
  border-radius:10px !important;
  padding:8px 10px !important;
  font-size:13px !important;
}
.final-save-actions{
  margin-top:6px !important;
  border-radius:16px !important;
  background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(245,249,253,.98)) !important;
}
.final-save-actions button{
  border-radius:12px !important;
}
.calc-panel{
  box-shadow:0 6px 16px rgba(242,146,33,.08) !important;
}
.form-complete fieldset{
  background:#fbfdff !important;
}
.units-table td,
.units-table th{
  font-size:12px !important;
}
.row-actions .btn-mini,
.row-actions .btn-mini-danger{
  min-height:27px !important;
  padding:5px 8px !important;
  font-size:11.5px !important;
}

/* Certificado: fotos completas y proporcionadas */
.cert-photo-frame{
  background:#fff !important;
}
.cert-photo{
  object-fit:contain !important;
}
.photo-cell-title{
  overflow:hidden !important;
  text-overflow:ellipsis !important;
}

/* Responsive refinado */
@media(max-width:1200px){
  .enhanced-grid{grid-template-columns:repeat(3,minmax(220px,1fr)) !important;}
}
@media(max-width:900px){
  .enhanced-grid{grid-template-columns:repeat(2,minmax(210px,1fr)) !important;}
  .file-card-head{min-height:36px !important;}
}
@media(max-width:620px){
  .enhanced-grid{grid-template-columns:1fr !important;}
  .file-card-title{font-size:14px !important;}
  .slot-number{min-width:68px !important;font-size:9.5px !important;}
  .inline-upload-head .pill{align-self:flex-start !important;}
}
@media print{
  .enhanced-box{box-shadow:none !important;}
}


/* v15 - certificado: grilla estable y fotos completas */
.cert-files-grid{
  display:grid !important;
  grid-template-columns:repeat(3, minmax(0, 1fr)) !important;
  gap:3px !important;
  border:2px solid #111 !important;
  border-top:0 !important;
  margin-bottom:8px !important;
  background:#111 !important;
}
.cert-file-card{
  background:#fff !important;
  min-width:0 !important;
  padding:3px !important;
  display:flex !important;
  flex-direction:column !important;
  gap:2px !important;
}
.cert-file-pdf{
  grid-row:span 1 !important;
}
.cert-files-grid .photo-cell-title{
  min-height:14px !important;
  height:14px !important;
  line-height:1.05 !important;
  font-size:6.8px !important;
  font-weight:900 !important;
  text-align:center !important;
  text-transform:uppercase !important;
  overflow:hidden !important;
  white-space:nowrap !important;
  text-overflow:ellipsis !important;
  margin:0 !important;
}
.cert-files-grid .cert-photo-frame{
  width:100% !important;
  aspect-ratio:16/9 !important;
  height:auto !important;
  min-height:0 !important;
  border:1px dashed #555 !important;
  background:#fff !important;
  display:grid !important;
  place-items:center !important;
  overflow:hidden !important;
}
.cert-files-grid .cert-photo{
  display:block !important;
  width:100% !important;
  height:100% !important;
  max-width:100% !important;
  max-height:100% !important;
  object-fit:contain !important;
  object-position:center center !important;
  border:0 !important;
  background:#fff !important;
}
.cert-files-grid .cert-photo-placeholder,
.cert-files-grid .cert-pdf-ok{
  width:100% !important;
  height:100% !important;
  display:grid !important;
  place-items:center !important;
  font-size:7px !important;
  line-height:1 !important;
  background:#fafafa !important;
  color:#111 !important;
  border:0 !important;
}
@media print{
  .cert-files-grid{
    gap:2px !important;
    border-width:1px !important;
  }
  .cert-file-card{
    padding:2px !important;
  }
  .cert-files-grid .photo-cell-title{
    height:10px !important;
    min-height:10px !important;
    font-size:5px !important;
  }
}
@media(max-width:900px){
  .cert-files-grid{
    grid-template-columns:1fr !important;
  }
}


/* v16 - impresión/PDF: el bloque de imágenes no debe agrandarse ni cortar hoja */
@media print{
  /* Mantener el certificado dentro de una sola escala lógica de A4 */
  body{
    background:#fff !important;
  }

  .cert-full{
    width:100% !important;
    max-width:100% !important;
    overflow:visible !important;
  }

  /* La grilla de fotos vuelve a ser compacta en impresión */
  .cert-files-grid{
    display:grid !important;
    grid-template-columns:repeat(3, 1fr) !important;
    gap:1px !important;
    border:1px solid #111 !important;
    background:#111 !important;
    margin-bottom:4px !important;
    page-break-inside:avoid !important;
    break-inside:avoid !important;
  }

  .cert-file-card{
    background:#fff !important;
    padding:1px !important;
    gap:1px !important;
    min-width:0 !important;
    page-break-inside:avoid !important;
    break-inside:avoid !important;
  }

  .cert-files-grid .photo-cell-title{
    height:8px !important;
    min-height:8px !important;
    max-height:8px !important;
    line-height:1 !important;
    font-size:4.5px !important;
    margin:0 !important;
    padding:0 !important;
    white-space:nowrap !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
  }

  /* Altura fija chica para impresión, sin depender del ancho de pantalla */
  .cert-files-grid .cert-photo-frame{
    width:100% !important;
    height:34px !important;
    max-height:34px !important;
    min-height:34px !important;
    aspect-ratio:auto !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    overflow:hidden !important;
    border:1px dashed #555 !important;
    background:#fff !important;
  }

  .cert-files-grid .cert-photo{
    width:auto !important;
    height:auto !important;
    max-width:100% !important;
    max-height:32px !important;
    object-fit:contain !important;
    object-position:center center !important;
    border:0 !important;
    background:#fff !important;
  }

  .cert-files-grid .cert-photo-placeholder,
  .cert-files-grid .cert-pdf-ok{
    width:100% !important;
    height:32px !important;
    max-height:32px !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    font-size:4.8px !important;
    line-height:1 !important;
    background:#fafafa !important;
    color:#111 !important;
  }

  .cert-full h2{
    margin-top:3px !important;
    margin-bottom:0 !important;
  }

  .cert-full table{
    margin-bottom:3px !important;
  }
}

/* v16 - vista web del certificado: recuadro visual estable 16:9, pero sin crecer de más */
.cert-files-grid .cert-photo-frame{
  max-height:150px;
}
.cert-files-grid .cert-photo{
  object-fit:contain !important;
}
