/* Galenia — sistema de diseño.
   --brand y --brand-2 los reemplaza cada clínica (marca blanca) desde layouts/app.php. */
:root {
    --brand: #0E7C7B;
    --brand-2: #12263A;
    --brand-soft: color-mix(in srgb, var(--brand) 10%, #fff);
    --brand-line: color-mix(in srgb, var(--brand) 22%, #fff);
    --ink: #14213A;
    --ink-2: #3E4C63;
    --muted: #6F7C91;
    --line: #E5EAF1;
    --bg: #F4F6FA;
    --card: #FFFFFF;
    --ok: #0F8A5F; --ok-soft: #E4F6EE;
    --warn: #A15C00; --warn-soft: #FFF3DF;
    --bad: #B42318; --bad-soft: #FDECEA;
    --radius: 16px;
    --shadow: 0 1px 2px rgba(20,33,58,.05), 0 8px 24px rgba(20,33,58,.06);
    --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.015em; }
small, .muted { color: var(--muted); }

/* ---------- Estructura ---------- */
.g-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.g-side {
    background: var(--brand-2); color: #fff; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column; gap: 18px; overflow-y: auto;
}
.g-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 14px; border-bottom: 1px solid rgba(255,255,255,.1); }
.g-brand img { width: 40px; height: 40px; border-radius: 11px; background: #fff; object-fit: contain; padding: 3px; flex: 0 0 40px; }
.g-brand b { display: block; font-size: .98rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; }
.g-brand small { color: rgba(255,255,255,.6); font-size: .74rem; }
.g-nav { display: flex; flex-direction: column; gap: 3px; }
.g-nav .g-sec { font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.45); margin: 12px 10px 4px; font-weight: 700; }
.g-nav a {
    display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 11px;
    color: rgba(255,255,255,.82); font-weight: 600; font-size: .92rem; text-decoration: none;
}
.g-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.g-nav a.on { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(0,0,0,.18); }
.g-nav .i { width: 20px; text-align: center; }
.g-side-foot { margin-top: auto; font-size: .74rem; color: rgba(255,255,255,.45); padding: 0 10px; }

.g-main { min-width: 0; display: flex; flex-direction: column; }
.g-top {
    display: flex; align-items: center; gap: 14px; padding: 14px 28px; background: rgba(255,255,255,.85);
    backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.g-top form.g-search { flex: 1; max-width: 460px; position: relative; }
.g-top form.g-search input { width: 100%; padding-left: 38px; background: var(--bg); border-color: transparent; }
.g-top form.g-search::before { content: "⌕"; position: absolute; left: 13px; top: 50%; transform: translateY(-52%); color: var(--muted); font-size: 1.15rem; }
.g-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.g-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.g-user .who { line-height: 1.15; font-size: .86rem; }
.g-user .who small { display: block; font-size: .74rem; }
.g-top .g-burger { display: none; }
.g-content { padding: 26px 28px 60px; max-width: 1280px; width: 100%; }

/* ---------- Encabezado de página ---------- */
.g-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.g-head h1 { font-size: 1.6rem; font-weight: 800; }
.g-head p { margin: 4px 0 0; color: var(--muted); }
.g-crumb { font-size: .82rem; color: var(--muted); margin-bottom: 6px; }

/* ---------- Tarjetas ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); margin-bottom: 20px; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-h h2 { font-size: 1.02rem; font-weight: 700; }
.card-h .ico { width: 32px; height: 32px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; }
.card-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-b { padding: 18px 20px; }
.card-b.flush { padding: 0; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 1fr) 340px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center; }
.stat .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem; }
.stat b { display: block; font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.stat small { font-size: .8rem; }

/* ---------- Formularios ---------- */
label.l { display: block; font-size: .74rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=datetime-local], input[type=number], input[type=search], input[type=tel], select, textarea {
    width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1.5px solid #D9E0EA; border-radius: 11px;
    padding: 10px 13px; min-height: 44px; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
input[type=color] { width: 56px; height: 44px; border: 1.5px solid #D9E0EA; border-radius: 11px; padding: 3px; background: #fff; }
.field { margin-bottom: 16px; }
.row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: .9rem; }
.check input { margin-top: 4px; accent-color: var(--brand); }
.hint { font-size: .8rem; color: var(--muted); margin-top: 5px; }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; font-size: .92rem;
    padding: 10px 18px; min-height: 42px; border-radius: 11px; border: 1.5px solid transparent; cursor: pointer; text-decoration: none !important;
    background: var(--brand); color: #fff; transition: transform .12s, box-shadow .12s, background .12s;
    box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 28%, transparent);
}
.btn:hover { transform: translateY(-1px); }
.btn.ghost { background: #fff; color: var(--ink); border-color: #D9E0EA; box-shadow: none; }
.btn.ghost:hover { border-color: var(--brand-line); color: var(--brand); }
.btn.danger { background: var(--bad); box-shadow: none; }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: .84rem; border-radius: 9px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.inline { display: inline; }

/* ---------- Tablas ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 11px 16px; background: #FAFBFD; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 16px; border-bottom: 1px solid #EEF1F6; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.link:hover td { background: var(--brand-soft); cursor: pointer; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }

/* ---------- Chips y avisos ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: .76rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #EEF1F6; color: var(--ink-2); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.brand { background: var(--brand-soft); color: var(--brand); }
.alert { border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; font-size: .92rem; display: flex; gap: 10px; align-items: flex-start; border: 1px solid transparent; }
.alert.ok { background: var(--ok-soft); color: var(--ok); border-color: #BFE6D3; }
.alert.bad { background: var(--bad-soft); color: var(--bad); border-color: #F5C8C3; }
.alert.info { background: var(--brand-soft); color: var(--brand-2); border-color: var(--brand-line); }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: #F3D9A8; }
.empty { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty .big { font-size: 2rem; display: block; margin-bottom: 6px; }

/* ---------- Ficha de paciente ---------- */
.pt-hero { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.pt-hero .g-avatar { width: 62px; height: 62px; font-size: 1.3rem; border-radius: 18px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px 22px; margin: 0; }
.kv dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.kv dd { margin: 2px 0 0; font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 14px 20px; border-bottom: 1px solid #EEF1F6; display: flex; gap: 12px; align-items: flex-start; }
.timeline li:last-child { border-bottom: 0; }
.note-section { margin-bottom: 18px; }
.note-section h3 { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.note-section div { white-space: pre-wrap; }

/* ---------- Invitados (login / registro) ---------- */
.guest { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: #fff; }
.guest-art {
    background: radial-gradient(800px 500px at 0% 0%, rgba(255,255,255,.12), transparent 60%), linear-gradient(150deg, #12263A 0%, #0E4F5C 55%, #0E7C7B 100%);
    color: #fff; padding: 52px 60px; display: flex; flex-direction: column; justify-content: space-between;
}
.guest-art .logo { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.3rem; letter-spacing: -.01em; }
.guest-art .logo img { width: 42px; height: 42px; }
.guest-art h2 { font-size: 2.3rem; font-weight: 800; line-height: 1.12; margin-bottom: 14px; }
.guest-art p { color: rgba(255,255,255,.8); max-width: 440px; font-size: 1.02rem; }
.guest-art ul { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 12px; }
.guest-art li { display: flex; gap: 12px; align-items: center; }
.guest-art li span { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.12); display: inline-flex; align-items: center; justify-content: center; }
.guest-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.guest-card { width: 100%; max-width: 420px; background: #fff; border-radius: 22px; box-shadow: 0 24px 60px rgba(20,33,58,.1); border: 1px solid var(--line); padding: 36px 34px; }
.guest-card h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: 4px; }
.guest-card .sub { color: var(--muted); margin: 0 0 22px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Planes ---------- */
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.plan { border: 1.5px solid var(--line); border-radius: 18px; padding: 22px; background: #fff; display: flex; flex-direction: column; gap: 10px; }
.plan.pop { border-color: var(--brand); box-shadow: 0 16px 40px color-mix(in srgb, var(--brand) 16%, transparent); }
.plan h3 { font-size: 1.15rem; }
.plan .price { font-size: 1.9rem; font-weight: 800; }
.plan ul { padding-left: 18px; margin: 0; color: var(--ink-2); font-size: .9rem; }
.plan form { margin-top: auto; }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-side { grid-template-columns: 1fr; }
    .plans { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .g-shell { grid-template-columns: 1fr; }
    .g-side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
    body.nav-open .g-side { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
    .g-top .g-burger { display: inline-flex; }
    .g-top { padding: 12px 16px; }
    .g-user .who { display: none; }
    .g-content { padding: 18px 16px 50px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .guest { grid-template-columns: 1fr; }
    .guest-art { display: none; }
    .table.stack thead { display: none; }
    .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
    .table.stack tr { padding: 10px 16px; border-bottom: 1px solid #EEF1F6; }
    .table.stack td { border: 0; padding: 3px 0; }
    .table.stack td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: .8rem; }
}
@media print {
    .g-side, .g-top, .no-print { display: none !important; }
    .g-shell { display: block; }
    .card { box-shadow: none; }
}

/* Selector de archivo */
input[type=file] { width: 100%; font: inherit; font-size: .88rem; color: var(--muted); border: 1.5px dashed #CBD5E1; border-radius: 11px; padding: 7px; background: #FAFBFD; }
input[type=file]::file-selector-button { font: inherit; font-weight: 700; font-size: .84rem; border: 0; border-radius: 8px; padding: 7px 12px; margin-right: 10px; background: var(--brand-soft); color: var(--brand); cursor: pointer; }
input[type=file]:hover { border-color: var(--brand); }

/* ---------- Historia clínica completa ---------- */
.hc-layout { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 20px; align-items: start; }
.sec-nav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; }
.sec-nav a { padding: 7px 12px; border-radius: 9px; color: var(--ink-2); font-size: .86rem; font-weight: 600; text-decoration: none; border-left: 3px solid transparent; }
.sec-nav a:hover { background: #fff; color: var(--brand); }
.sec-nav a.on { background: #fff; color: var(--brand); border-left-color: var(--brand); box-shadow: var(--shadow); }
.hc section { scroll-margin-top: 84px; }
.grid-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 16px; }
.grid-fields textarea { min-height: 62px; }
.vitals { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 14px; }
.unit { position: relative; }
.unit input { padding-right: 52px; }
.unit span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .8rem; pointer-events: none; }
table.lines { width: 100%; border-collapse: collapse; }
table.lines th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 8px; background: #FAFBFD; border-bottom: 1px solid var(--line); }
table.lines td { padding: 6px 6px; border-bottom: 1px solid #EEF1F6; vertical-align: middle; }
table.lines input, table.lines select { min-height: 38px; padding: 7px 10px; font-size: .9rem; }
table.lines input[readonly] { background: var(--brand-soft); font-weight: 700; color: var(--brand); border-color: transparent; }
table.lines tr.filled input[data-ac] { border-color: var(--brand-line); }
table.meds td { min-width: 110px; }
table.meds td:first-child { min-width: 240px; }
.lines-empty { padding: 16px 18px; color: var(--muted); font-size: .9rem; }
.lines-add { padding: 10px 14px 16px; }
.ac-list { position: absolute; z-index: 100; list-style: none; margin: 0; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 44px rgba(20,33,58,.18); max-height: 320px; overflow-y: auto; font-size: .88rem; }
.ac-list li { padding: 8px 10px; border-radius: 8px; cursor: pointer; line-height: 1.35; }
.ac-list li b { color: var(--brand); margin-right: 6px; }
.ac-list li small { display: block; color: var(--muted); font-size: .74rem; }
.ac-list li.on, .ac-list li:hover { background: var(--brand-soft); }
.ac-list li.none { color: var(--muted); cursor: default; }
.pkg-card { border: 1.5px dashed var(--brand-line); background: linear-gradient(180deg, #fff, var(--brand-soft)); }
.save-bar { position: sticky; bottom: 12px; z-index: 15; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; box-shadow: 0 14px 34px rgba(20,33,58,.14); }
.hc-h { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); margin: 20px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.hc-kv { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.hc-kv dd { font-weight: 500; }
.vit-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.vit-chips span { background: var(--brand-soft); border-radius: 11px; padding: 7px 12px; font-size: .78rem; color: var(--ink-2); min-width: 92px; }
.vit-chips small { display: block; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
.vit-chips b { font-size: 1.1rem; color: var(--ink); margin-right: 3px; }
.doc-buttons { display: grid; gap: 8px; }
.doc-btn { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 11px; font-weight: 600; font-size: .9rem; }
.card.pkg.off { opacity: .6; }
@media (max-width: 1000px) { .hc-layout { grid-template-columns: 1fr; } .sec-nav { display: none; } }

/* ---------- Especialidades (v1.2): campos por ojo (OD/OI) o por lado, y tabla de lectura ---------- */
.esp-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.esp-grid .field.wide { grid-column: 1 / -1; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pair-cell { display: flex; align-items: center; gap: 6px; }
.pair-cell > input, .pair-cell > select, .pair-cell > .unit, .pair-cell > textarea { flex: 1; min-width: 0; }
.pair-lab { flex: 0 0 auto; font-size: .72rem; font-weight: 800; color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, #fff); border-radius: 6px; padding: 3px 6px; }
.esp-block { margin: 0 0 14px; }
.esp-title { font-size: .78rem; font-weight: 700; color: var(--ink-2); margin: 0 0 6px; }
.esp-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.esp-table th, .esp-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.esp-table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); text-align: center; }
.esp-table tbody th { width: 38%; font-weight: 600; color: var(--muted); }
.esp-table td { text-align: center; }
.esp-table td[colspan] { text-align: left; }
.spec-builder td select, .spec-builder td input { min-width: 90px; }
@media (max-width: 640px) { .pair { grid-template-columns: 1fr; } }
/* Paquetes: columnas con ancho mínimo (la tabla se desplaza horizontalmente en pantallas pequeñas). */
.pkg-lines { min-width: 1480px; }
.pkg-lines td:nth-child(1) select { min-width: 170px; }
.pkg-lines td:nth-child(2) select { min-width: 135px; }
.pkg-lines td:nth-child(4) input { min-width: 84px; }
.pkg-lines td:nth-child(6) select { min-width: 165px; }
.pkg-lines td:nth-child(7) input, .pkg-lines td:nth-child(8) input, .pkg-lines td:nth-child(9) input, .pkg-lines td:nth-child(10) input { min-width: 100px; }
/* Paquetes como bloque (v1.3): encabezado del paquete y sus procedimientos sangrados. */
tr.pkg-group td { background: color-mix(in srgb, var(--brand) 7%, #fff); border-left: 3px solid var(--brand); padding: 8px 12px; }
.pkg-group-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pkg-group-h small { color: var(--muted); font-weight: 600; }
tr.in-pkg > td:first-child { border-left: 3px solid color-mix(in srgb, var(--brand) 35%, #fff); padding-left: 16px; }
.pkg-code { display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .04em; color: #fff; background: var(--brand); border-radius: 6px; padding: 2px 7px; vertical-align: 2px; }
.pkg-includes { font-size: .82rem; margin: 0 0 8px; }
.pkg-includes-h { font-weight: 700; margin-bottom: 4px; }
.pkg-includes ul { margin: 0; padding-left: 18px; }
.pkg-includes li { margin: 1px 0; color: var(--ink-2); }
.pkg-includes li b { color: var(--brand); font-weight: 700; margin-right: 4px; }

/* ---------- RDA (Res. 1888/2025) ---------- */
.rda-box { border: 1px dashed var(--brand-line); background: color-mix(in srgb, var(--brand) 3%, #fff); border-radius: 12px; padding: 12px 14px 4px; margin: 6px 0 14px; }
.rda-box-h { font-weight: 800; font-size: .86rem; color: var(--brand-2); margin-bottom: 8px; }
.rda-box-h .muted { font-weight: 500; }
.tele-box { border-top: 1px solid var(--brand-line); margin-top: 6px; padding-top: 10px; }
.tele-box .check { margin-bottom: 6px; }
.rda-coded { border-top: 1px solid var(--line); }
.coded-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.coded-grid table.lines td { padding: 4px; }
.coded-grid select { max-width: 150px; }
.rda-check { list-style: none; margin: 0; padding: 0; }
.rda-check li { display: flex; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.rda-check li:last-child { border-bottom: 0; }
.rda-check .where { flex: 0 0 auto; }
.rda-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; background: #EEF1F6; padding: 2px 6px; border-radius: 6px; word-break: break-all; }
.rda-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.rda-stats a { text-decoration: none; }
.user-doc summary { cursor: pointer; font-size: .82rem; color: var(--ink-2); margin-top: 4px; list-style: none; }
.user-doc summary::-webkit-details-marker { display: none; }

/* ---------- v1.6: agenda, seguimiento, precios, odontograma, novedades ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar select, .toolbar input[type=date] { width: auto; min-height: 40px; }
.legend { display: flex; gap: 6px; flex-wrap: wrap; margin: -6px 0 16px; }
.chip.info { background: #E6F0FF; color: #1D4ED8; }
a.stat { color: inherit; text-decoration: none; transition: transform .12s, box-shadow .12s; }
a.stat:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(20,33,58,.06), 0 12px 28px rgba(20,33,58,.1); }
.stat.is-bad b { color: var(--bad); } .stat.is-bad .ico { background: var(--bad-soft); }
.stat.is-ok b { color: var(--ok); } .stat.is-ok .ico { background: var(--ok-soft); }
.txt-bad { color: var(--bad); font-weight: 700; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c, #94A3B8); margin-right: 6px; vertical-align: 0; flex: none; }
.sticky-card { position: sticky; top: 84px; }
.day-card.is-today { border-color: var(--brand-line); box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow); }
.appt-list { border-top: 1px solid var(--line); }
.appt { display: grid; grid-template-columns: 70px 1fr auto; gap: 12px; align-items: center; padding: 12px 18px 12px 14px; border-bottom: 1px solid #EEF1F6; border-left: 5px solid var(--c); }
.appt:last-child { border-bottom: 0; }
.appt-time b { display: block; font-size: 1.05rem; } .appt-time small { font-size: .75rem; }
.appt-main { min-width: 0; } .appt-main > a { margin-right: 6px; }
.appt-sub { font-size: .82rem; color: var(--muted); margin-top: 2px; }
.appt.st-cancelada, .appt.st-no_asistio { opacity: .62; }
.appt.st-cancelada .appt-main > a b { text-decoration: line-through; }
.appt.st-en_sala { background: #F5F9FF; }
.appt-act, .act-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
details.more { position: relative; }
details.more > summary { list-style: none; cursor: pointer; }
details.more > summary::-webkit-details-marker { display: none; }
.more-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(20,33,58,.16); padding: 12px; width: 280px; display: grid; gap: 8px; text-align: left; }
.more-pop .l { font-size: .75rem; font-weight: 700; color: var(--muted); display: block; margin-bottom: 4px; }
.more-st { display: flex; flex-wrap: wrap; gap: 6px; }
.btn.block { width: 100%; justify-content: center; }
.move-inline { display: inline-flex; gap: 6px; } .move-inline input { width: auto; min-height: 34px; }
.svc-cat { padding: 10px 20px 6px; font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: #F8FAFC; border-top: 1px solid var(--line); }
.svc-cat:first-child { border-top: 0; }
tr.is-off { opacity: .5; }
.price-inline { display: inline-flex; gap: 6px; justify-content: flex-end; }
.price-inline input { width: 130px; text-align: right; font-weight: 700; min-height: 34px; }
.strike { text-decoration: line-through; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 700; color: var(--ink-2); }
.tab:hover { text-decoration: none; border-color: var(--brand-line); }
.timeline.compact li { padding: 10px 18px; }
.practice-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.practice-opt { position: relative; cursor: pointer; }
.practice-opt input { position: absolute; opacity: 0; }
.practice-opt > span { display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 2px solid var(--line); border-radius: 14px; background: var(--card); transition: border-color .12s, background .12s; }
.practice-opt .big { font-size: 1.6rem; }
.practice-opt input:checked + span { border-color: var(--brand); background: var(--brand-soft); }
.practice-opt input:focus-visible + span { outline: 3px solid var(--brand-line); }
.release-card { background: linear-gradient(135deg, var(--brand-soft), #fff); border: 1px solid var(--brand-line); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.release-h { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; } .release-h .big { font-size: 1.8rem; } .release-h small { display: block; color: var(--muted); }
.release-v ul { margin: 6px 0 10px; padding-left: 20px; line-height: 1.65; font-size: .92rem; }
.release-act { display: flex; gap: 8px; flex-wrap: wrap; }
.g-side-foot a { color: inherit; }
/* Odontograma */
.odo-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 4px 0; }
.odo-svg { width: 100%; min-width: 620px; height: auto; display: block; }
.odo-svg .odo-n { font: 700 11px var(--font); fill: var(--ink-2); }
.odo-editor .odo-t { cursor: pointer; }
.odo-editor .odo-t polygon:hover { stroke: var(--brand); stroke-width: 2; }
.odo-bar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg label { cursor: pointer; } .seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 7px 14px; font-weight: 700; font-size: .85rem; color: var(--ink-2); }
.seg input:checked + span { background: var(--brand); color: #fff; }
.odo-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.odo-tools-h { width: 100%; font-size: .74rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }
.odo-tool { cursor: pointer; } .odo-tool input { position: absolute; opacity: 0; }
.odo-tool span { display: inline-flex; gap: 6px; align-items: center; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: .82rem; font-weight: 600; background: var(--card); }
.odo-tool span i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.odo-tool input:checked + span { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-line); background: var(--brand-soft); }
.odo-summary { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; font-size: .85rem; color: var(--muted); }
.odo-legend { display: flex; flex-wrap: wrap; gap: 10px 14px; font-size: .78rem; color: var(--muted); margin-top: 8px; }
.odo-legend span { display: inline-flex; align-items: center; gap: 5px; }
.odo-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,.08); }
@media (max-width: 860px) {
    .appt { grid-template-columns: 56px 1fr; }
    .appt-act { grid-column: 1 / -1; justify-content: flex-start; }
    .more-pop { left: 0; right: auto; }
    .sticky-card { position: static; }
    .price-inline input { width: 110px; }
}
@media print {
    .no-print, .g-side, .g-top, .release-card, .toolbar { display: none !important; }
    .stat { box-shadow: none; }
}
.card-h .right .btn, .g-head .btn, .appt-act .btn { white-space: nowrap; }
/* Membresía por módulos */
.mod-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.mod-opt { position: relative; cursor: pointer; }
.mod-opt input { position: absolute; opacity: 0; }
.mod-opt > span { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 16px; border: 2px solid var(--line); border-radius: 16px; background: var(--card); transition: border-color .12s, background .12s, box-shadow .12s; }
.mod-opt input:checked + span { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-line); }
.mod-opt input:focus-visible + span { outline: 3px solid var(--brand-line); }
.mod-top { display: flex; justify-content: space-between; align-items: center; }
.mod-top .big { font-size: 1.8rem; }
.mod-price { font-weight: 800; font-size: 1.15rem; color: var(--ink); } .mod-price small { font-weight: 600; color: var(--muted); font-size: .75rem; margin-left: 4px; }
.mod-opt small { line-height: 1.45; }
.quote-lines { display: grid; gap: 8px; font-size: .9rem; color: var(--ink-2); }
.quote-lines > div { display: flex; justify-content: space-between; gap: 10px; }
.quote-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-weight: 700; }
.quote-total b { font-size: 1.5rem; }
.quote-lines b { white-space: nowrap; }
/* Clínicas de ejemplo */
.demo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.demo-card { display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: 14px; background: var(--card); }
.demo-card form { margin-top: 8px; }
.demo-banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: #FFF7E6; border: 1px solid #F5D08A; color: #7A4B00; border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; }
/* Apps */
.apps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 16px; }
.apps-grid .card { margin: 0; }
.app-card ol { padding-left: 18px; margin: 0 0 14px; line-height: 1.7; font-size: .92rem; }
/* Consulta enfocada */
details.rda-auto > summary { cursor: pointer; list-style: none; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
details.rda-auto > summary::-webkit-details-marker { display: none; }
details.rda-auto .rda-edit { margin-left: auto; font-size: .8rem; font-weight: 700; color: var(--brand); }
details.rda-auto[open] .rda-edit { display: none; }
details.opt-block { margin-top: 12px; }
details.opt-block > summary { cursor: pointer; font-weight: 700; font-size: .88rem; color: var(--ink-2); }
.opt-bar .card-b { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
details.rda-patient > summary { cursor: pointer; list-style: none; }
details.rda-patient > summary::-webkit-details-marker { display: none; }
details.rda-patient .rda-edit { font-size: .8rem; font-weight: 700; color: var(--brand); margin-left: 6px; }
details.rda-patient[open] .rda-edit { display: none; }
form.no-col-lat .col-lat, form.no-col-tooth .col-tooth { display: none; }
.photo-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 6px; }
.photo-grid a { display: flex; flex-direction: column; gap: 2px; text-decoration: none; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #F4F6FA; }
@media (max-width: 640px) { .photo-compare { grid-template-columns: 1fr; } }
/* Consentimientos */
.sign-body { background: var(--bg); margin: 0; }
.sign-wrap { max-width: 820px; margin: 0 auto; padding: 18px 16px 60px; }
.sign-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0 14px; border-bottom: 3px solid var(--brand); margin-bottom: 16px; }
.sign-head b { display: block; font-size: 1.1rem; } .sign-head small { color: var(--muted); }
.sign-doc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; line-height: 1.6; }
.sign-doc h1 { font-size: 1.35rem; margin-bottom: 8px; } .sign-doc h2 { font-size: 1rem; margin: 16px 0 4px; color: var(--brand); }
.sign-doc p, .sign-doc li { color: var(--ink-2); } .sign-meta { background: var(--brand-soft); border-radius: 10px; padding: 10px 12px; }
.sign-form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin-top: 16px; }
.check.big { font-size: 1rem; padding: 10px 0; }
.sign-pad { position: relative; border: 2px dashed var(--brand-line); border-radius: 14px; background: #fff; margin: 6px 0 14px; }
.sign-pad canvas { width: 100%; height: 200px; display: block; touch-action: none; cursor: crosshair; }
.sign-pad [data-clear] { position: absolute; top: 8px; right: 8px; }
.big-btn { font-size: 1.05rem; padding: 14px; }
.sign-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.sign-choice .btn { flex-direction: column; padding: 14px; height: auto; white-space: normal; }
.sign-choice .btn small { font-weight: 500; opacity: .85; font-size: .8rem; }
.link-box { display: flex; gap: 8px; } .link-box input { flex: 1; font-size: .85rem; }
.consent-sig { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.consent-sig img { height: 110px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 6px; }
.consent-text p, .consent-text li { color: var(--ink-2); line-height: 1.6; }
.chip-consent { background: #FFF3DF; color: #A15C00; }
@media (max-width: 640px) { .sign-choice { grid-template-columns: 1fr; } .sign-doc, .sign-form { padding: 16px; } }
.photo-upload { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.photo-upload input[type=text] { flex: 1; min-width: 200px; }
.photo-pick { position: relative; overflow: hidden; cursor: pointer; }
.photo-pick input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
/* El panel derecho nunca baja más que el contenido central: se queda fijo y, si es más alto que la pantalla, se desplaza por dentro. */
@media (min-width: 1101px) {
    .grid-side > div:last-child { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-right: 2px; }
    .grid-side > div:last-child .sticky-card { position: static; }
}
.pt-two { gap: 16px; } .pt-two > .card { margin: 0; }
/* Caja y cobros */
.cash-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: #F1F5F9; border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin-bottom: 18px; }
.cash-banner.is-open { background: var(--ok-soft); border-color: #BFE6D3; }
.cash-banner input { min-height: 36px; }
.txt-ok { color: var(--ok); } .txt-warn { color: var(--warn); }
.pay-list { display: grid; gap: 6px; margin-bottom: 12px; max-height: 260px; overflow-y: auto; }
.pay-item { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.pay-item small { display: block; color: var(--muted); font-size: .76rem; } .pay-item input:checked ~ .pay-amt { color: var(--brand); }
.pay-big { font-size: 1.4rem; font-weight: 800; text-align: right; }
.pay-methods { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pay-methods label { cursor: pointer; } .pay-methods input { position: absolute; opacity: 0; }
.pay-methods span { display: inline-block; padding: 7px 12px; border: 1.5px solid var(--line); border-radius: 999px; font-weight: 700; font-size: .85rem; }
.pay-methods input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.pay-change { font-size: 1.3rem; font-weight: 800; color: var(--ok); padding: 6px 0; } .pay-change.bad { color: var(--bad); }
.receipt-amount { text-align: center; padding: 10px 0 18px; } .receipt-amount small { display: block; color: var(--muted); }
.receipt-amount b { display: block; font-size: 2.2rem; color: var(--brand); } .receipt-amount span { color: var(--ink-2); font-weight: 600; }
.denoms { width: 100%; border-collapse: collapse; } .denoms td { padding: 3px 4px; } .denoms td:first-child { font-weight: 600; } .denoms input { width: 90px; min-height: 32px; padding: 4px 8px; }
.bar { display: block; height: 8px; background: #EEF1F6; border-radius: 99px; overflow: hidden; } .bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
