/* ===== Identidad KiK: paleta del sitio kikodontologia.com y Montserrat ===== */
:root {
  --bg: #f4f7f7;
  --surface: #ffffff;
  --surface-2: #f8fafa;
  --border: #dde4e5;
  --text: #2b2f33;
  --muted: #59676b;
  --soft: #839094;
  --primary: #14777c;
  --primary-600: #0f6267;
  --primary-50: #e4f2f2;
  --accent: #25aeb4;
  --accent-light: #79ccd0;
  --carbon: #252a30;
  --carbon-2: #31373e;
  --on-carbon: #e7eceb;
  --on-carbon-muted: #9aa6aa;
  --danger: #c2453d;   --danger-bg: #fbe8e6;
  --warning: #b7791f;  --warning-bg: #fbf1df;
  --success: #2e8b57;  --success-bg: #e5f3ea;
  --info: #3f6fb5;     --info-bg: #e7eef9;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 35, .05), 0 4px 14px rgba(20, 30, 35, .05);
  --sidebar: 236px;
  --font: "Montserrat", Arial, system-ui, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #14181b; --surface: #1d2226; --surface-2: #23292e; --border: #2e363c;
  --text: #e7eceb; --muted: #a9b5b8; --soft: #7e8b8f; --primary: #3fb9be; --primary-600: #34a3a8; --primary-50: #163537;
  --carbon: #101316; --carbon-2: #1b2025;
  --danger: #f08a80; --danger-bg: #3a1e1c; --warning: #f0b75c; --warning-bg: #352a15; --success: #6fd29c; --success-bg: #18301f; --info: #8db4f0; --info-bg: #1b2a40;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14.5px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 12px; }
h3 { font-size: 15px; font-weight: 700; margin: 0 0 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); background: var(--carbon); color: var(--on-carbon); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 20; transition: transform .2s; }
.sidebar .brand { padding: 18px 16px 6px; font-weight: 700; font-size: 14px; line-height: 1.25; color: #ffffff; display: flex; gap: 10px; align-items: center; }
.sidebar .brand-logo { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; flex: none; }
.sidebar .brand-mark { width: 42px; height: 42px; border-radius: 10px; background: #1b1f23; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; color: #dfe5e6; flex: none; letter-spacing: -0.5px; }
.sidebar .brand-mark span { color: var(--accent); }
.sidebar .clinic { padding: 0 16px 14px 68px; color: var(--on-carbon-muted); font-size: 11.5px; border-bottom: 1px solid #353c43; }
.sidebar nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: #c9d2d4; margin-bottom: 2px; font-weight: 500; min-height: 42px; }
.sidebar nav a:hover { background: var(--carbon-2); color: #ffffff; }
.sidebar nav a.active { background: var(--carbon-2); color: #ffffff; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar nav a .badge { margin-left: auto; background: var(--accent); color: #0e2a2c; border: 0; }
.sidebar nav .sep { font-size: 10px; text-transform: uppercase; color: #6f7b80; padding: 16px 12px 6px; letter-spacing: .14em; font-weight: 600; }
.sidebar .user { border-top: 1px solid #353c43; padding: 14px 16px; font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sidebar .user .avatar { width: 36px; height: 36px; font-size: 12px; background: #3a4249; color: #ffffff; }
.sidebar .user b { display: block; color: #ffffff; font-size: 12.5px; }
.sidebar .user .muted { color: var(--on-carbon-muted); }
.sidebar .user .btn { background: transparent; border-color: #454d55; color: #d5dcde; }
.sidebar .user .btn:hover { background: var(--carbon-2); }
.main { margin-left: var(--sidebar); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 62px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 22px; position: sticky; top: 0; z-index: 10; }
.topbar .search { flex: 1; max-width: 460px; position: relative; }
.topbar .search input { background: var(--bg); border-radius: 12px; padding: 10px 14px 10px 38px; }
.topbar .search .s-ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--soft); pointer-events: none; }
.topbar .search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 600 10px var(--font); color: var(--soft); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; background: var(--surface); pointer-events: none; }
.topbar .search .results { position: absolute; top: 46px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgba(20,30,35,.14); max-height: 360px; overflow: auto; padding: 6px; }
.topbar .search .results a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; color: var(--text); border-radius: 8px; }
.topbar .search .results a:hover, .topbar .search .results a.hl { background: var(--primary-50); }
.content { padding: 24px; max-width: 1440px; width: 100%; }
.menu-btn { display: none; }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .content { padding: 14px; }
  .topbar { padding: 0 12px; }
}

/* Botón "+ Nuevo" */
.quick { position: relative; }
.quick-menu { position: absolute; right: 0; top: 48px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 40px rgba(20,30,35,.16); padding: 6px; min-width: 230px; z-index: 30; }
.quick-menu a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 8px; color: var(--text); font-weight: 500; }
.quick-menu a:hover { background: var(--primary-50); color: var(--primary); }
.quick-menu a small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; }

/* Components */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }
.stat .label, .label { color: var(--soft); font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.stat .value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.stat .hint { color: var(--muted); font-size: 12px; margin-top: 2px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 9px 16px; min-height: 40px; border-radius: 10px; cursor: pointer; font: inherit; font-weight: 600; font-size: 13.5px; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--surface-2); border-color: #c9d3d5; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-600); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 5px 11px; min-height: 32px; font-size: 12.5px; border-radius: 8px; }
.btn.icon { padding: 6px 9px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 10.5px; font-weight: 600; color: var(--soft); text-transform: uppercase; letter-spacing: .08em; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; width: 100%; min-height: 40px; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--primary-50); border-color: var(--primary); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--primary); }
input[type=color] { padding: 2px; }
textarea { min-height: 84px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .span2 { grid-column: span 2; }
@media (max-width: 800px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span2 { grid-column: auto; } }

table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 10.5px; text-transform: uppercase; color: var(--soft); font-weight: 600; letter-spacing: .08em; padding: 11px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--primary-50); }
.table-wrap { overflow-x: auto; }
.empty { text-align: center; color: var(--muted); padding: 30px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a, .tabs button { display: inline-flex; align-items: center; gap: 7px; padding: 11px 15px; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.active, .tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.subtabs a, .subtabs button { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; min-height: 34px; display: inline-flex; align-items: center; }
.subtabs a.active, .subtabs button.active { background: var(--carbon); color: #fff; border-color: var(--carbon); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.badge.green { background: var(--success-bg); color: var(--success); border-color: transparent; }
.badge.red { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.badge.orange { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.badge.blue { background: var(--info-bg); color: var(--info); border-color: transparent; }
.badge.teal { background: var(--primary-50); color: var(--primary); border-color: transparent; }
.badge.gray { color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: 11.5px; font-weight: 600; white-space: nowrap; text-decoration: none; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip.ok { background: var(--success-bg); color: var(--success); }
.chip.warn { background: var(--warning-bg); color: var(--warning); }
.chip.alert { background: var(--danger-bg); color: var(--danger); }
.chip.info { background: var(--info-bg); color: var(--info); }
.chip.teal { background: var(--primary-50); color: var(--primary); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(20, 26, 30, .5); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--surface); border-radius: 16px; width: min(720px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 24px 70px rgba(0,0,0,.28); }
.modal.lg { width: min(1000px, 100%); }
.modal.sm { width: min(460px, 100%); }
.modal header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal header h3 { margin: 0; font-size: 16px; }
.modal .body { padding: 20px; overflow-y: auto; }
.modal footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.toast { position: fixed; bottom: 20px; right: 20px; background: var(--carbon); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 200; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-weight: 500; }
.toast.error { background: var(--danger); }

/* Patient header */
.patient-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 18px; flex: none; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; background: var(--primary-50); color: var(--primary); margin-right: 4px; }

/* Odontogram */
.odonto-wrap { overflow-x: auto; padding: 8px 0; }
.odonto { display: block; margin: 0 auto; user-select: none; }
.odonto .face { stroke: #7a8a96; stroke-width: 1; fill: #fff; cursor: pointer; }
.odonto .face:hover { fill: #e6f5f5; }
.odonto .face.sel { fill: #bfe6e6; }
.odonto .num { font-size: 11px; fill: var(--muted); text-anchor: middle; cursor: pointer; font-weight: 600; }
.odonto .num.sel { fill: var(--primary); }
.odonto .tooth-hit { fill: transparent; cursor: pointer; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

/* Perio */
.perio { border-collapse: collapse; font-size: 11px; }
.perio th, .perio td { border: 1px solid var(--border); padding: 0; text-align: center; min-width: 30px; }
.perio th { background: var(--surface-2); padding: 4px 2px; }
.perio td.lbl { text-align: left; padding: 2px 6px; white-space: nowrap; background: var(--surface-2); font-weight: 600; min-width: 110px; }
.perio input { width: 100%; border: 0; border-radius: 0; padding: 3px 0; text-align: center; font-size: 11px; background: transparent; min-width: 0; }
.perio .sites { display: flex; }
.perio .sites > * { flex: 1; min-width: 0; }
.perio .sites > * + * { border-left: 1px dotted var(--border); }
.perio input:focus { outline: 2px solid var(--primary); background: var(--primary-50); }
.perio .pd4 { background: #fdf1e3; }
.perio .pd6 { background: #fdeaea; }
.perio .flag { cursor: pointer; height: 20px; }
.perio .flag.on.bleed { background: #e25555; }
.perio .flag.on.plaque { background: #3a6fd8; }
.perio .flag.on.supp { background: #e6912e; }
.perio .absent { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 4px, var(--border) 4px, var(--border) 6px); }

/* Agenda */
.agenda { display: grid; border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; background: var(--surface); max-height: calc(100vh - 210px); }
.agenda .col-head { position: sticky; top: 0; background: var(--surface-2); border-bottom: 1px solid var(--border); padding: 8px; font-weight: 600; font-size: 13px; text-align: center; z-index: 2; }
.agenda .time { font-size: 11px; color: var(--muted); text-align: right; padding: 0 6px; border-right: 1px solid var(--border); position: sticky; left: 0; background: var(--surface); z-index: 1; }
.agenda .slot { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); cursor: pointer; }
.agenda .slot.hour { border-bottom-color: var(--border); }
.agenda .slot.half { border-bottom-style: dashed; }
.agenda .slot:hover { background: var(--primary-50); }
.agenda .col { position: relative; }
.appt { position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: 4px 6px; font-size: 12px; overflow: hidden; cursor: pointer; color: #1d2a33; border-left: 4px solid; box-shadow: var(--shadow); z-index: 1; }
.appt b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 20% 0%, #2f3a40 0%, var(--carbon) 60%); }
.login .card { width: min(420px, 100%); padding: 28px; }

/* Signature */
.sig { border: 1px dashed var(--border); border-radius: 8px; background: #fff; touch-action: none; width: 100%; height: 160px; }

/* Media */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.media-item { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.media-item img { width: 100%; height: 120px; object-fit: cover; display: block; cursor: zoom-in; }
.media-item .file { height: 120px; display: grid; place-items: center; font-size: 34px; }
.media-item .meta { padding: 8px; font-size: 12px; }

.timeline-item { border-left: 3px solid var(--primary); padding: 4px 0 12px 14px; margin-left: 6px; position: relative; }
.timeline-item::before { content: ""; position: absolute; left: -8px; top: 6px; width: 13px; height: 13px; border-radius: 50%; background: var(--surface); border: 3px solid var(--primary); }


/* ---------- Firma de documentos (pantalla del paciente) ---------- */
.btn.lg { padding: 13px 22px; font-size: 16px; }
.signsession { position: fixed; inset: 0; z-index: 150; background: #fff; color: #1d2a33; display: flex; flex-direction: column; padding: 18px max(18px, calc((100vw - 900px) / 2)); overflow-y: auto; }
.ss-head { display: flex; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--primary); padding-bottom: 10px; }
.ss-clinic { color: var(--primary); font-weight: 700; font-size: 15px; }
.ss-title { font-size: 20px; font-weight: 700; margin-top: 2px; }
.ss-patient { margin: 10px 0 0; font-size: 16px; }
.ss-text { white-space: pre-wrap; font-size: 16px; line-height: 1.6; background: #f8fafb; border: 1px solid #e3e8ec; border-radius: 10px; padding: 16px 18px; margin-top: 10px; max-height: 42vh; min-height: 160px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.ss-hint { text-align: center; color: var(--warning); font-weight: 600; margin-top: 6px; animation: pulse 1.6s infinite; }
.ss-block { border: 0; padding: 0; margin: 12px 0 0; min-width: 0; }
.ss-block:disabled { opacity: .45; }
.ss-check { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid #e3e8ec; border-radius: 10px; margin-bottom: 8px; font-size: 15px; line-height: 1.45; cursor: pointer; }
.ss-check input { width: 26px; height: 26px; flex: none; margin-top: 1px; accent-color: var(--primary); }
.ss-check.req { border-color: #bfe0e0; background: #f3fbfb; }
.ss-check em { color: var(--danger); font-style: normal; font-size: 12px; }
.ss-signer { display: grid; grid-template-columns: 1.1fr 1.6fr 1fr; gap: 10px; margin: 10px 0; }
.ss-signer input, .ss-signer select { font-size: 16px; padding: 10px; }
@media (max-width: 640px) { .ss-signer { grid-template-columns: 1fr; } }
.signpad { position: relative; margin-top: 6px; }
.signpad canvas { width: 100%; height: 220px; display: block; background: #fff; border: 2px dashed #b8c4cc; border-radius: 12px; touch-action: none; cursor: crosshair; }
.signpad-line { position: absolute; left: 24px; right: 24px; bottom: 44px; border-top: 1px solid #c9d3da; color: #9aa9b4; font-size: 12px; padding-top: 3px; pointer-events: none; }
.signpad-clear { position: absolute; top: 8px; right: 8px; }
.ss-foot { position: sticky; bottom: -18px; background: #fff; display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 0; margin-top: 10px; border-top: 1px solid #e3e8ec; }
.ss-thanks { margin: auto; text-align: center; }
.ss-ok { width: 110px; height: 110px; border-radius: 50%; background: var(--success); color: #fff; font-size: 64px; display: grid; place-items: center; margin: 0 auto 16px; animation: pop .4s ease; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes pulse { 50% { opacity: .45; } }

/* ---------- Kiosco ---------- */
.kiosk { min-height: 100vh; background: linear-gradient(160deg, #e6f5f5, #ffffff 60%); display: flex; flex-direction: column; color: #1d2a33; }
.kiosk-top { display: flex; align-items: center; padding: 12px 18px; color: var(--muted); font-size: 18px; }
.kiosk-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; gap: 10px; }
.kiosk-logo { font-size: 64px; }
.kiosk-center h1 { font-size: 30px; }
.kiosk-pulse { width: 16px; height: 16px; border-radius: 50%; background: var(--primary); animation: pulse 1.4s infinite; margin-top: 10px; }
.kiosk-doc { display: flex; flex-direction: column; gap: 4px; width: min(520px, 100%); text-align: left; background: #fff; border: 2px solid var(--primary); border-radius: 14px; padding: 18px 22px; font: inherit; font-size: 17px; cursor: pointer; box-shadow: var(--shadow); color: inherit; }
.kiosk-doc em { color: var(--primary); font-style: normal; font-weight: 600; }

/* ---------- Fotos antes / después ---------- */
.stage-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
@media (max-width: 900px) { .stage-grid { grid-template-columns: 1fr; } }
.stage-col { border: 2px dashed var(--border); border-radius: 10px; padding: 10px; background: var(--surface-2); transition: border-color .15s, background .15s; }
.stage-col.over { border-color: var(--primary); background: var(--primary-50); }
.stage-head { font-weight: 700; text-transform: uppercase; font-size: 12px; letter-spacing: .05em; margin-bottom: 8px; color: var(--primary); }
.stage-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 8px; }
.stage-photo { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 5px; display: flex; flex-direction: column; gap: 4px; }
.stage-photo img { width: 100%; height: 100px; object-fit: cover; border-radius: 5px; cursor: zoom-in; display: block; }
.cmp-fig { margin: 0; text-align: center; }
.cmp-fig img { width: 100%; max-height: 60vh; object-fit: contain; border-radius: 8px; background: #000; }
.cmp-fig figcaption { font-weight: 700; margin-top: 6px; }
.cmp-slider { position: relative; background: #000; border-radius: 10px; overflow: hidden; user-select: none; }
.cmp-slider img { display: block; width: 100%; max-height: 64vh; object-fit: contain; }
.cmp-slider img.top { position: absolute; inset: 0; height: 100%; }
.cmp-bar { position: absolute; top: 0; bottom: 0; width: 3px; background: #fff; box-shadow: 0 0 6px rgba(0,0,0,.6); transform: translateX(-50%); pointer-events: none; }
.cmp-tag { position: absolute; top: 10px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 4px; }
.cmp-tag.l { left: 10px; } .cmp-tag.r { right: 10px; }
.cmp-slider input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.timeline-item.system { border-left-color: var(--border); }
.timeline-item.system::before { border-color: #9aa9b4; }
.timeline-item.system > div:nth-child(2) { color: var(--muted); }

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main { margin: 0; }
  .card { box-shadow: none; border: 0; }
}
.doc-read { white-space: pre-wrap; font-size: 15px; line-height: 1.6; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; max-height: 58vh; overflow-y: auto; }
.ss-images { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.ss-images img { height: 110px; border-radius: 8px; border: 1px solid #e3e8ec; }
.btn.dictating { background: #fdeaea; border-color: #f2b8b8; color: #b52f2f; }
.dictate-live { color: var(--danger); margin-left: 6px; }
.brand-logo { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; flex: none; }
.hc-section { margin-top: 18px; }
.hc-section > h3 { color: var(--primary); border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.hc-q { display: grid; grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 1.2fr); gap: 10px; align-items: center; padding: 6px 4px; border-bottom: 1px dashed var(--border); }
.hc-q.yes { background: #fff5f5; }
.hc-q .yn { display: flex; gap: 4px; }
.hc-q .yn button { padding: 5px 12px; border: 1px solid var(--border); background: var(--surface); border-radius: 6px; cursor: pointer; font: inherit; }
.hc-q .yn button.on-si { background: var(--danger); color: #fff; border-color: var(--danger); }
.hc-q .yn button.on-no { background: var(--success); color: #fff; border-color: var(--success); }
.hc-q .yn button:disabled { cursor: default; opacity: .85; }
@media (max-width: 700px) { .hc-q { grid-template-columns: 1fr; } }
.ev-media { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ev-media a, .ev-media img { display: block; }
.ev-media img { height: 84px; width: 110px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); cursor: zoom-in; }
.ev-media .file { height: 84px; width: 110px; border: 1px solid var(--border); border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; padding: 4px; text-align: center; overflow: hidden; color: var(--text); background: var(--surface-2); }
.ev-sign { margin-top: 8px; padding: 8px 10px; background: #f0faf4; border: 1px solid #c4ead3; border-radius: 8px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ev-sign img { height: 46px; background: #fff; border-radius: 4px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.pick-item { border: 2px solid var(--border); border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--surface-2); position: relative; }
.pick-item.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-50); }
.pick-item img { width: 100%; height: 90px; object-fit: cover; display: block; }
.pick-item .ic { height: 90px; display: grid; place-items: center; font-size: 30px; }
.pick-item .nm { font-size: 11px; padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-item .chk { position: absolute; top: 4px; right: 4px; background: var(--primary); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; font-size: 13px; }
.ss-text.expanded { max-height: none; }

/* ===== Mi día ===== */
.next-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px; align-items: center; background: linear-gradient(135deg, var(--carbon) 0%, #2f3a40 100%); color: #ffffff; border-radius: 18px; padding: 22px 24px; margin-bottom: 16px; box-shadow: 0 14px 34px rgba(20, 30, 35, .18); }
.next-card h2 { color: #ffffff; font-size: 24px; margin: 2px 0 0; }
.next-card p { color: #b9c5c7; margin: 2px 0 10px; }
.avatar.big { width: 64px; height: 64px; font-size: 20px; background: var(--accent); color: #0e2a2c; }
.next-body .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.next-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.next-acts .btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2); color: #ffffff; }
.next-acts .btn:hover { background: rgba(255,255,255,.16); }
.next-acts .btn.primary { background: var(--accent); border-color: var(--accent); color: #0e2a2c; }
.next-when { text-align: right; display: flex; flex-direction: column; gap: 2px; }
.next-when b { font-size: 36px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.next-when small { color: var(--accent-light); font-weight: 600; }
.next-when .muted-light { color: #9aa6aa; font-weight: 500; }
@media (max-width: 760px) { .next-card { grid-template-columns: auto minmax(0, 1fr); } .next-when { grid-column: 1 / -1; text-align: left; flex-direction: row; gap: 10px; align-items: baseline; flex-wrap: wrap; } }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; color: var(--text); box-shadow: var(--shadow); }
a.kpi:hover { border-color: var(--accent-light); }
.kpi b { display: block; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); }
.day-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; }
.day-grid .card + .card { margin-top: 0; }
@media (max-width: 980px) { .day-grid { grid-template-columns: 1fr; } }
.timeline-day .slot { display: grid; grid-template-columns: 52px 12px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 6px; border-bottom: 1px dashed var(--border); }
.timeline-day .slot:last-child { border-bottom: 0; }
.timeline-day .slot.now { background: var(--primary-50); border-radius: 12px; border-bottom-color: transparent; }
.timeline-day .slot.done { opacity: .6; }
.timeline-day .h { font-weight: 700; font-variant-numeric: tabular-nums; }
.timeline-day .who { color: var(--text); min-width: 0; }
.timeline-day .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline-day .who small { color: var(--muted); }
.status-sel { width: auto; min-height: 32px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface); border-width: 1.5px; }
.todo { display: flex; flex-direction: column; gap: 8px; }
.todo .t { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: var(--text); }
a.todo-link:hover, .todo a.t:hover { background: var(--primary-50); }
.todo .t b { display: block; font-size: 13px; }
.todo .t small { color: var(--muted); }
.todo .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; font-size: 14px; }
.todo .ic.warn { background: var(--warning-bg); color: var(--warning); }
.todo .ic.info { background: var(--info-bg); color: var(--info); }
.todo .ic.teal { background: var(--primary-50); color: var(--primary); }
.note-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-top: 8px; border-radius: 10px; background: var(--warning-bg); color: var(--text); white-space: pre-wrap; }
.note-item span { flex: 1; }

/* ===== Agenda ===== */
.agenda { border-radius: 16px; box-shadow: var(--shadow); }
.agenda .col-head { background: var(--surface); padding: 10px 6px; }
.agenda .col-head small { display: block; text-transform: uppercase; letter-spacing: .1em; font-size: 10px; color: var(--soft); font-weight: 600; }
.agenda .col-head b { display: inline-grid; place-items: center; font-size: 18px; font-weight: 700; min-width: 32px; height: 32px; border-radius: 50%; }
.agenda .col-head.today b { background: var(--primary); color: #ffffff; }
.agenda .col-head.today small { color: var(--primary); }
.agenda .col-today { background-color: rgba(37, 174, 180, .04); }
.agenda .slot:hover { background: var(--primary-50); }
.appt { border-radius: 8px; box-shadow: none; padding: 5px 8px; font-size: 11.5px; color: var(--text); }
.appt b { font-weight: 700; }
.nowline { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 3; pointer-events: none; }
.nowline::before { content: ""; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }

/* ===== Ficha del paciente ===== */
.patient-card { padding: 20px 22px 14px; }
.patient-card h1 { font-size: 26px; }
.patient-card .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.pt-balance { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.pt-balance .value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.pt-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.tag { background: var(--primary-50); color: var(--primary); }

/* ===== Odontograma: ayuda y referencias ===== */
.odonto .face { stroke: #7a8a96; }
.odonto .face.sel { fill: #bfe6e8; }
.odonto .face:hover { fill: var(--primary-50); }
.odonto .num.sel { fill: var(--primary); }
.odo-help { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.odo-refs { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.odo-refs summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--primary); }
.refs-grid { display: grid; grid-template-columns: minmax(170px, 220px) minmax(0, 1fr); gap: 18px; margin-top: 10px; }
@media (max-width: 760px) { .refs-grid { grid-template-columns: 1fr; } }
.refs-col .label { margin-bottom: 6px; }
.refs-dx { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.ref { display: flex; align-items: center; gap: 9px; padding: 5px 8px; border-radius: 9px; font-size: 12.5px; }
.refs-dx .ref { cursor: pointer; border: 1px solid transparent; }
.refs-dx .ref:hover { background: var(--surface-2); }
.refs-dx .ref.on { border-color: var(--primary); background: var(--primary-50); }
.ref small { display: block; color: var(--soft); font-size: 10.5px; }
.ref .swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; }

/* ===== Ingreso ===== */
.login .card { width: min(420px, 100%); padding: 32px; border: 0; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-logo { width: 110px; height: 110px; object-fit: cover; border-radius: 20px; margin-bottom: 12px; }
.login-mark { width: 72px; height: 72px; border-radius: 16px; background: var(--carbon); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 22px; color: #dfe5e6; margin: 0 auto 12px; letter-spacing: -0.5px; }
.login-mark span { color: var(--accent); }
.login-name { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }

/* ===== Sugerencias ===== */
.sug-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.sug-item:last-child { border-bottom: 0; }
.sug-shot { max-height: 120px; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; margin-bottom: 8px; display: block; }
@media (max-width: 700px) { .hide-sm { display: none; } }

/* ===== Odontograma estilo JM ===== */
.odonto .face { stroke: #6b7c88; stroke-width: 2; cursor: default; }
.odonto .face.click { cursor: pointer; }
.odonto .face.click:hover { fill: #e4f2f2 !important; }
.odonto .num { cursor: pointer; }
.odonto .flash { animation: odoflash .9s ease; }
@keyframes odoflash { 0% { opacity: .35; } 100% { opacity: 1; } }
.odo-toolbar { border: 1px solid var(--border); border-radius: 14px; padding: 12px; margin-bottom: 12px; background: var(--surface-2); display: grid; gap: 10px; }
.odo-colors { display: flex; gap: 8px; flex-wrap: wrap; }
.odo-color { display: flex; align-items: center; gap: 8px; border: 2px solid var(--border); background: var(--surface); border-radius: 12px; padding: 8px 14px; cursor: pointer; font: inherit; color: var(--text); text-align: left; min-height: 44px; }
.odo-color b { font-size: 13px; }
.odo-color small { color: var(--muted); font-size: 11.5px; }
.odo-color.on { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.odo-color .dot { width: 16px; height: 16px; }
.odo-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.odo-tool { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 2px solid transparent; background: var(--surface); border-radius: 12px; padding: 8px 6px; cursor: pointer; font: inherit; font-size: 11.5px; font-weight: 600; color: var(--text); text-align: center; min-height: 72px; box-shadow: var(--shadow); }
.odo-tool:hover { border-color: var(--accent-light); }
.odo-tool.on { border-color: var(--primary); background: var(--primary-50); color: var(--primary); }
.odo-actions { align-items: center; }
.odo-more summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.odo-more { flex-basis: 100%; }
.odo-voice { border-top: 1px dashed var(--border); padding-top: 8px; display: grid; gap: 3px; }
.refs-dx .ref svg + svg { margin-left: -4px; }
.tool-glyph .face { stroke: #6b7c88; stroke-width: 3; }
