:root { --primary: #1a4b8c; --text: #000; --border: #ccc; }
* { box-sizing: border-box; }
body { font-family: 'Roboto', sans-serif; background: #f0f2f5; margin: 0; padding: 10px; }
.main-container { max-width: 900px; margin: 0 auto; }

/* BARRA PROGRESO */
.progress-container { width: 100%; height: 4px; background: #ccc; position: fixed; top: 0; left: 0; z-index: 2000; }
.progress-bar { height: 4px; background: var(--primary); width: 0%; transition: width 0.2s; }

/* HEADER */
.main-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 10px 0; width: 100%; }
.header-logo { flex: 0 0 180px; max-width: 180px; }
.img-logo { width: 100%; height: auto; display: block; }
.header-info { flex: 1; text-align: center; }
.clinic-name-header { font-size: 2.2rem; color: #1a4b8c; margin: 0; font-family: 'Impact', sans-serif; line-height: 1.1; }
.clinic-sub-header { font-size: 1.4rem; font-weight: bold; margin: 0; }
.clinic-details { font-size: 0.85rem; margin-top: 5px; color: #333; }

/* GRIDS */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.grid-address { display: grid; grid-template-columns: 4fr 1fr; gap: 15px; }

@media (max-width: 768px) {
    .main-header { flex-direction: column; text-align: center; }
    .header-logo { width: 130px; margin: 0 auto; }
    .grid-2, .grid-3, .grid-address { grid-template-columns: 1fr !important; }
    .medical-checklist { grid-template-columns: 1fr 1fr !important; }
}

/* TARJETA */
.tarjeta { background: #fff; border-radius: 4px; box-shadow: 0 0 10px rgba(0,0,0,0.1); }
.tarjeta-contenido { padding: 25px 40px; }
.section-title { background: var(--primary); color: #fff; padding: 6px 12px; margin: 15px 0 10px; font-weight: bold; font-size: 0.85rem; }
.separator { border: none; border-top: 1px solid #ddd; margin: 10px 0; }

/* MEDICAL HISTORY */
.medical-history-box { background: #fdfdfd; padding: 12px; border: 1px solid #eee; }
.medical-checklist { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.medical-checklist label { font-size: 0.8rem; display: flex; align-items: center; gap: 5px; cursor: pointer; }
.consent-legal-box { background: #f9f9f9; padding: 12px; border: 1px solid #eee; font-size: 0.85rem; }
.lang-en { font-style: italic; color: #555; margin-top: 5px; }

/* FIRMAS */
.auth-box { margin-bottom: 15px; position: relative; }
.signature-wrapper { border-bottom: 2px solid #000; height: 120px; position: relative; touch-action: none; }
.sig-canvas { width: 100% !important; height: 100% !important; }
.signature-tools { position: absolute; top: 5px; right: 5px; z-index: 10; }
.signature-tools button { font-size: 10px; background: #eee; cursor: pointer; }
.signature-line-text { text-align: center; font-size: 0.75rem; font-weight: bold; padding-top: 4px; }

/* SELECTOR MODO */
.mode-selector { display: flex; justify-content: center; align-items: center; gap: 15px; background: #fff; padding: 10px; border-radius: 30px; margin-bottom: 10px; font-weight: bold; }
.switch { position: relative; width: 44px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #ccc; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background: var(--primary); }
input:checked + .slider:before { transform: translateX(22px); }
.active-mode { color: var(--primary); }

input, select { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 16px; }
.btn-container { display: flex; gap: 10px; margin-top: 20px; }
.btn { flex: 1; padding: 15px; border: none; font-weight: bold; color: #fff; border-radius: 4px; cursor: pointer; }
.btn-clear { background: #555; }
.btn-print { background: var(--primary); }

/* IMPRESIÓN PDF OPTIMIZADA */
@media print {
    @page { margin: 0.4cm; size: portrait; }
    .no-print, .mode-selector, .signature-tools, .progress-container, .btn-container { display: none !important; }
    .main-header { padding: 0 !important; margin-bottom: 5px !important; }
    .header-logo { flex: 0 0 90px !important; max-width: 90px !important; }
    .clinic-name-header { font-size: 1.4rem !important; }
    .clinic-sub-header { font-size: 0.9rem !important; }
    .clinic-details { font-size: 0.65rem !important; }
    .section-title { margin: 8px 0 4px !important; padding: 3px !important; background: #eee !important; color: #000 !important; -webkit-print-color-adjust: exact; }
    .tarjeta-contenido { padding: 0 !important; }
    .signature-wrapper { height: 80px !important; }
    .tarjeta { border: none; box-shadow: none; }
}