/* ESTILOS COMERFLOW COMPACTOS - NARANJA */
:root{
  --bg: #f4f4f4; 
  --primary-comercio: #FF7043;
  --primary-dark: #F4511E;
}
*{box-sizing:border-box}
html,body{
  height:100%;
  margin:0;
  font-family:'Poppins',sans-serif;
  background:var(--bg);
  color:#333;
  padding:8px;
}
.container{
  max-width:1200px;
  margin:8px auto;
  padding:12px;
  background:white;
  border-radius:8px;
  overflow:hidden;
  box-shadow:0 3px 10px rgba(0,0,0,0.08);
}
.header{
  background:linear-gradient(90deg, var(--primary-comercio), var(--primary-dark));
  color:white;
  padding:12px 15px;
  border-radius:6px;
  margin-bottom:12px;
  display:flex;
  gap:8px;
  align-items:center
}
.logo{width:50px;height:50px;border-radius:6px;background:rgba(255,255,255,0.2)}
h1{margin:0;font-size:1.2rem;color:white !important}
.small{color:rgba(255,255,255,0.8) !important; font-size:11px}
.form-grid{ display:grid; grid-template-columns:repeat(12,1fr); gap:6px; align-items:start }
.field{ background:#fdfdfd; padding:6px; border-radius:5px; border:1px solid #e0e0e0 }
.label{ font-size:11px; color:#444; margin-bottom:3px; display:block; font-weight:700; text-transform: uppercase; }
.input, textarea, select{ width:100%; padding:6px; border-radius:5px; border:1px solid #ccc; background:white; color:#333; font-size:13px; transition:border 0.2s }
.input:focus, textarea:focus, select:focus{ outline:none; border-color:var(--primary-comercio); box-shadow:0 0 0 2px rgba(255, 112, 67, 0.1) }
.col-12{grid-column:span 12} .col-6{grid-column:span 6} .col-4{grid-column:span 4} .col-3{grid-column:span 3} .col-2{grid-column:span 2} .col-8{grid-column:span 8} .col-9{grid-column:span 9}

.img-preview{ width:100px; height:80px; border-radius:5px; background:#f8f9fa; display:flex; align-items:center; justify-content:center; border:1px dashed #d0d0d0; overflow:hidden; margin-top:4px; }
.btn{ background:linear-gradient(90deg, var(--primary-comercio), var(--primary-dark)); color:#fff; padding:8px 16px; border-radius:6px; border:none; cursor:pointer; font-weight:700; transition:all 0.2s; font-size:13px; }
.btn:hover{ background:linear-gradient(90deg, var(--primary-dark), var(--primary-comercio)); transform:translateY(-1px); box-shadow:0 3px 8px rgba(0,0,0,0.15) }
.btn:disabled{opacity:0.6; cursor:not-allowed}
.code-img{ width:100%; height:130px; border-radius:6px; background:#f8f9fa; display:flex; align-items:center; justify-content:center; border:1px solid #e0e0e0; overflow:hidden; margin-top:4px; }
.result-small{ font-size:12px; color:#666; font-weight:500; }

/* --- CARNET COMERCIO --- */
.carnet-card {
  width: 320px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  box-shadow:0 3px 6px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  color: #333;
}

/* FIX: Altura ajustada a 45px para logo con eslogan */
.carnet-header { 
  flex: 0 0 45px; 
  background: linear-gradient(90deg, var(--primary-comercio), var(--primary-dark));
  display: flex;
  align-items: center;
  padding: 0 10px;
  justify-content: space-between;
}
.carnet-logo { height: 35px; }
.carnet-rol { color: #fff; font-size: 0.9rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.carnet-body { flex: 1; display: flex; padding: 8px; gap: 8px; align-items: center; overflow: hidden; }
.carnet-photo { width: 65px; height: 65px; background: white; border-radius: 4px; overflow: hidden; flex-shrink: 0; border: 1px solid #ddd; display: flex; align-items: center; justify-content: center; padding: 4px; }
.carnet-photo img { width: 100%; height: 100%; object-fit: contain !important; object-position: center; background: white; max-width: 100%; max-height: 100%; }
.carnet-info { flex: 1; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.carnet-name { font-size: 0.85rem; font-weight: 700; color: #000; margin-bottom: 2px; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.1; }
.carnet-data { font-size: 0.65rem; color: #555; margin-bottom: 1px; line-height: 1.1; }
.carnet-badge { margin-top: 3px; background: #ffebee; color: var(--primary-dark); padding: 2px 5px; border-radius: 3px; font-size: 0.55rem; font-weight: 600; align-self: flex-start; border: 1px solid #ffcdd2; line-height: 1.1; }
.carnet-footer { flex: 0 0 55px; background: #f8f9fa; border-top: 1px solid #eee; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.carnet-barcode { height: 40px; width: 110px; flex-shrink: 0; }
.carnet-municipio { font-size: 0.6rem; font-weight: 600; color: #333; text-align: center; flex: 1; padding: 0 4px; line-height: 1.1; }
.carnet-qr { width: 48px; height: 48px; flex-shrink: 0; padding: 2px; background: #fff; border-radius: 3px; }

.notice{ background: rgba(255, 112, 67, 0.1); padding: 8px 10px; border-radius: 5px; color: var(--primary-dark); font-weight: 600; text-align: center; border: 1px solid rgba(255, 112, 67, 0.3); margin: 12px 0; font-size: 12px; }

@media(max-width:900px){ .col-6,.col-4,.col-3,.col-2,.col-8,.col-9{grid-column:span 12} .carnet-card { width: 100%; max-width: 320px; } }
.img-preview img, .carnet-photo img { object-fit: contain !important; object-position: center; background: white; }
.carnet-photo { display: flex; align-items: center; justify-content: center; background: white !important; }