:root {
  --bg: #f3f6f8;
  --surface: #ffffff;
  --text: #172027;
  --muted: #64727d;
  --primary: #0b6f70;
  --primary-dark: #075354;
  --border: #dce4e8;
  --danger: #b42318;
  --warning: #a15c00;
  --success: #18794e;
  --shadow: 0 10px 28px rgba(27, 46, 53, .08);
}
* { box-sizing: border-box; }
body { margin:0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; color:var(--text); background:var(--bg); }
a { color:var(--primary); text-decoration:none; }
button, input, select, textarea { font:inherit; }
.app-shell { min-height:100vh; display:flex; }
.sidebar { width:245px; background:#102a2d; color:#fff; padding:22px 16px; position:fixed; inset:0 auto 0 0; display:flex; flex-direction:column; z-index:20; }
.brand { display:flex; gap:11px; align-items:center; padding:0 8px 22px; }
.brand-mark { width:42px; height:42px; border-radius:13px; background:#65c9bf; color:#0b3334; display:grid; place-items:center; font-size:24px; font-weight:900; }
.brand strong,.brand small { display:block; }.brand small { color:#a9c0c2; margin-top:2px; }
.sidebar nav { display:grid; gap:6px; }
.sidebar nav a { color:#d8e5e6; padding:11px 12px; border-radius:10px; display:flex; gap:11px; align-items:center; }
.sidebar nav a:hover,.sidebar nav a.active { background:#1d4447; color:#fff; }
.sidebar-footer { margin-top:auto; border-top:1px solid #315154; padding:16px 8px 0; display:grid; gap:4px; }
.sidebar-footer span { color:#aac1c2; font-size:13px; }.sidebar-footer a { color:#8be0d7; margin-top:8px; }
.main { margin-left:245px; width:calc(100% - 245px); min-width:0; }
.topbar { height:86px; background:var(--surface); border-bottom:1px solid var(--border); display:flex; align-items:center; gap:14px; padding:0 30px; position:sticky; top:0; z-index:10; }
.topbar h1 { margin:0; font-size:24px; }.topbar p { margin:3px 0 0; color:var(--muted); font-size:13px; }
.menu-button { display:none; border:0; background:transparent; font-size:24px; }
.content { padding:28px; max-width:1450px; width:100%; margin:0 auto; }
.footer { padding:10px 28px 24px; color:var(--muted); font-size:12px; }
.grid { display:grid; gap:18px; }.grid-2 { grid-template-columns:repeat(2,minmax(0,1fr)); }.grid-3 { grid-template-columns:repeat(3,minmax(0,1fr)); }.grid-4 { grid-template-columns:repeat(4,minmax(0,1fr)); }
.card { background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:20px; box-shadow:var(--shadow); min-width:0; }
.card h2,.card h3 { margin-top:0; }.card-header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:16px; }
.metric { padding:20px; }.metric .label { color:var(--muted); font-size:13px; }.metric .value { font-size:30px; font-weight:800; margin:6px 0 2px; }.metric .hint { color:var(--muted); font-size:12px; }
.btn { display:inline-flex; align-items:center; justify-content:center; gap:7px; border:1px solid transparent; border-radius:9px; padding:10px 14px; cursor:pointer; font-weight:700; line-height:1.1; }
.btn-primary { color:#fff; background:var(--primary); }.btn-primary:hover { background:var(--primary-dark); }.btn-secondary { color:var(--text); background:#fff; border-color:var(--border); }.btn-danger { color:#fff; background:var(--danger); }.btn-small { padding:7px 10px; font-size:13px; }
.actions { display:flex; gap:8px; flex-wrap:wrap; }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }.form-grid .full { grid-column:1/-1; }
label { display:block; font-weight:700; font-size:13px; margin-bottom:6px; }
input[type=text],input[type=email],input[type=password],input[type=date],input[type=time],input[type=number],input[type=tel],select,textarea { width:100%; border:1px solid #cbd7dc; border-radius:9px; background:#fff; padding:10px 11px; outline:none; }
input:focus,select:focus,textarea:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(11,111,112,.12); }
textarea { min-height:95px; resize:vertical; }.help { color:var(--muted); font-size:12px; margin-top:5px; }.required::after { content:' *'; color:var(--danger); }
.checkbox-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }.check { border:1px solid var(--border); border-radius:9px; padding:9px; display:flex; gap:8px; align-items:flex-start; font-weight:500; }
.table-wrap { overflow:auto; border:1px solid var(--border); border-radius:12px; } table { width:100%; border-collapse:collapse; min-width:760px; background:#fff; } th,td { text-align:left; padding:12px 13px; border-bottom:1px solid var(--border); vertical-align:top; } th { background:#f6f9fa; font-size:12px; color:#53626b; text-transform:uppercase; letter-spacing:.03em; } tr:last-child td { border-bottom:0; }
.badge { display:inline-flex; padding:5px 8px; border-radius:999px; background:#e8eef0; color:#45545c; font-size:12px; font-weight:800; white-space:nowrap; }
.risk-0 { background:#dff5e8; color:#176b43; }.risk-1 { background:#fff5c2; color:#745b00; }.risk-2 { background:#ffe1bc; color:#8a4700; }.risk-3 { background:#ffd6d3; color:#9c251c; }
.status-open { background:#ffd6d3; color:#9c251c; }.status-healing { background:#fff0c6; color:#795800; }.status-closed { background:#dff5e8; color:#176b43; }
.alert { border-radius:10px; padding:12px 14px; margin-bottom:14px; border:1px solid; }.alert-success { color:#146c43; background:#e2f7eb; border-color:#bce8ce; }.alert-danger { color:#9b2018; background:#fff0ef; border-color:#facac6; }.alert-warning { color:#7a4b00; background:#fff7df; border-color:#f1dc9a; }.alert-info { color:#075a6b; background:#e8f7fb; border-color:#bce2eb; }
.tabs { display:flex; gap:8px; overflow:auto; margin:0 0 18px; padding-bottom:4px; }.tabs a { background:#fff; border:1px solid var(--border); border-radius:999px; padding:8px 12px; white-space:nowrap; color:var(--text); }.tabs a.active { background:var(--primary); border-color:var(--primary); color:#fff; }
.patient-header { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; }.patient-name { margin:0 0 5px; }.meta { color:var(--muted); display:flex; gap:10px; flex-wrap:wrap; }
.section-title { margin:24px 0 12px; padding-bottom:8px; border-bottom:1px solid var(--border); }
.empty { text-align:center; color:var(--muted); padding:35px 15px; }.search { max-width:360px; }
.photo-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }.photo-card { border:1px solid var(--border); border-radius:12px; overflow:hidden; background:#fff; }.photo-card img { width:100%; aspect-ratio:4/3; object-fit:cover; display:block; }.photo-card div { padding:10px; font-size:12px; }
.progress { height:10px; background:#e5ecee; border-radius:999px; overflow:hidden; }.progress span { display:block; height:100%; background:var(--primary); }
.login-page { min-height:100vh; display:grid; place-items:center; padding:20px; background:linear-gradient(135deg,#e7f2f1,#f5f7f8); }.login-card { width:min(430px,100%); background:#fff; border:1px solid var(--border); border-radius:18px; padding:30px; box-shadow:var(--shadow); }.login-card h1 { margin-bottom:4px; }.login-card .brand-mark { margin-bottom:18px; }.stack { display:grid; gap:15px; }.muted { color:var(--muted); }.text-danger { color:var(--danger); }.text-success { color:var(--success); }.nowrap { white-space:nowrap; }
@media (max-width:1050px) { .grid-4 { grid-template-columns:repeat(2,1fr); }.grid-3 { grid-template-columns:repeat(2,1fr); }.photo-grid { grid-template-columns:repeat(2,1fr); }.checkbox-grid { grid-template-columns:repeat(2,1fr); } }
@media (max-width:760px) { .sidebar { transform:translateX(-100%); transition:.2s; }.sidebar.open { transform:translateX(0); }.main { margin-left:0; width:100%; }.menu-button { display:block; }.content { padding:18px; }.topbar { padding:0 18px; }.grid-2,.grid-3,.grid-4,.form-grid { grid-template-columns:1fr; }.checkbox-grid { grid-template-columns:1fr; }.photo-grid { grid-template-columns:1fr; }.patient-header { flex-direction:column; }.form-grid .full { grid-column:auto; } }
@media print { .sidebar,.topbar,.footer,.no-print,.btn,.tabs { display:none!important; }.main { margin:0; width:100%; }.content { padding:0; }.card { box-shadow:none; break-inside:avoid; } }

/* V2: expediente clínico integral */
.quick-actions { display:flex; gap:8px; flex-wrap:wrap; }
.info-box { border:1px solid #bcdfe0; background:#eefafa; border-radius:12px; padding:14px 16px; color:#164f52; }
.info-box strong { display:block; margin-bottom:4px; }
.subtle-box { border:1px dashed var(--border); border-radius:12px; padding:14px; background:#fafcfc; }
.document-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.document-card { border:1px solid var(--border); border-radius:12px; padding:14px; background:#fff; min-height:130px; display:flex; flex-direction:column; justify-content:space-between; }
.document-icon { width:42px; height:42px; border-radius:11px; display:grid; place-items:center; background:#e7f4f3; color:var(--primary); font-weight:900; }
.document-card h4 { margin:10px 0 4px; }
.document-card p { margin:0; color:var(--muted); font-size:12px; }
.timeline { display:grid; gap:12px; }
.timeline-item { border-left:3px solid var(--primary); padding:4px 0 4px 14px; }
.timeline-item h4 { margin:0 0 5px; }
.kv { display:grid; grid-template-columns:minmax(130px,180px) 1fr; gap:8px 14px; }
.kv > div:nth-child(odd) { font-weight:700; color:#43535c; }
.hero-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:14px; }
.section-note { color:var(--muted); margin-top:-4px; margin-bottom:14px; }
details.advanced { border:1px solid var(--border); border-radius:12px; padding:12px 14px; background:#fbfcfd; }
details.advanced summary { cursor:pointer; font-weight:800; color:var(--primary); }
.preview-modal { position:fixed; inset:0; background:rgba(4,18,21,.78); display:none; align-items:center; justify-content:center; padding:24px; z-index:100; }
.preview-modal.open { display:flex; }
.preview-panel { width:min(1100px,100%); height:min(85vh,850px); background:#fff; border-radius:16px; overflow:hidden; display:flex; flex-direction:column; }
.preview-toolbar { display:flex; justify-content:space-between; gap:10px; align-items:center; padding:12px 14px; border-bottom:1px solid var(--border); }
.preview-content { flex:1; min-height:0; display:grid; place-items:center; background:#eef2f3; }
.preview-content iframe,.preview-content img { width:100%; height:100%; border:0; object-fit:contain; }
.print-sheet { max-width:850px; margin:0 auto; background:#fff; }
.print-letterhead { border-bottom:2px solid var(--primary); padding-bottom:16px; margin-bottom:24px; display:flex; justify-content:space-between; gap:20px; }
.print-letterhead h1 { margin:0; font-size:24px; }
.print-signature { margin-top:70px; text-align:center; }
.print-signature .line { border-top:1px solid #333; width:280px; max-width:100%; margin:0 auto 8px; }
.item-row { border:1px solid var(--border); border-radius:12px; padding:14px; margin-bottom:12px; }
.treatment-chip { display:inline-flex; align-items:center; padding:5px 9px; border-radius:999px; background:#e8f5f4; color:#125b5b; font-size:12px; font-weight:800; }
.age-pediatric { background:#e8ecff; color:#394a96; }
.age-adult { background:#edf3f5; color:#41525a; }
@media (max-width:1050px) { .document-grid { grid-template-columns:repeat(2,1fr); } }
@media (max-width:760px) { .document-grid { grid-template-columns:1fr; } .kv { grid-template-columns:1fr; gap:4px; } .print-letterhead { flex-direction:column; } }
