:root {
  --bg: #f4f6f8; --card: #fff; --text: #1b1f24; --muted: #5f6b7a; --line: #dfe3e8; --primary: #1f5eff; --primary-weak: #e8eefc;
  --ok: #1e7d32; --ok-bg: #e7f5ea; --warn: #9a5b00; --warn-bg: #fff4e0; --bad: #b3261e; --bad-bg: #fdecea; --info: #1f5eff; --info-bg: #e8eefc;
  --radius: 12px; --tap: 44px; --shadow: 0 1px 3px rgba(20, 30, 40, .08), 0 4px 14px rgba(20, 30, 40, .05);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text); background: var(--bg); font-size: 16px; line-height: 1.45;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 70px; scroll-padding-bottom: 90px; }
body { margin: 0; background: var(--bg); -webkit-text-size-adjust: 100%; }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; } h2 { font-size: 1.2rem; margin: 0 0 .6rem; } h3 { font-size: 1.02rem; margin: .8rem 0 .5rem; } h4 { margin: 0 0 .4rem; }
a { color: var(--primary); }
p { margin: .4rem 0; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .bad { color: var(--bad); } .warn { color: var(--warn); }
.center { display: grid; place-items: center; min-height: 60vh; }
.row { display: flex; gap: .5rem; align-items: center; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.end { justify-content: flex-end; margin-top: .6rem; }
.grow { flex: 1 1 auto; min-width: 0; } .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .break { word-break: break-all; display: block; padding: .5rem; background: #f7f8fa; border-radius: 8px; margin: .4rem 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .8rem; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.btn { min-height: var(--tap); padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--text); font-size: .98rem; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; text-decoration: none; justify-content: center; }
.btn:hover { border-color: #b8c0cc; } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); } .btn.danger { color: var(--bad); border-color: #f0b8b3; }
.btn.big { min-height: 50px; font-size: 1.05rem; padding: 0 20px; } .btn.block { width: 100%; justify-content: space-between; }
button.icon { background: none; border: 0; font-size: 1.3rem; min-width: var(--tap); min-height: var(--tap); cursor: pointer; }
.linklike { background: none; border: 0; padding: 0; color: var(--text); font-size: 1.05rem; font-weight: 600; cursor: pointer; text-align: left; }
input, select, textarea { font: inherit; font-size: 16px; min-height: var(--tap); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; width: 100%; color: var(--text); }
textarea { min-height: 70px; } input[type=checkbox] { width: 22px; height: 22px; min-height: 0; }
input[type=range] { padding: 0; border: 0; min-height: 36px; }
.field { display: flex; flex-direction: column; gap: 4px; margin: .5rem 0; } .field-label { font-size: .9rem; font-weight: 600; } .field-help { font-size: .8rem; color: var(--muted); }
.check { display: inline-flex; gap: .45rem; align-items: center; margin: .3rem .8rem .3rem 0; font-size: .92rem; }
.chip { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.warn { background: var(--warn-bg); color: var(--warn); } .chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.info { background: var(--info-bg); color: var(--info); } .chip.muted { background: #eef0f3; color: var(--muted); }
.notice { border-radius: 10px; padding: 10px 12px; margin: .5rem 0; } .notice.warn { background: var(--warn-bg); } .notice.info { background: var(--info-bg); } .notice.ok { background: var(--ok-bg); }
.errorbox { background: var(--bad-bg); border-left: 4px solid var(--bad); border-radius: 8px; padding: 10px 12px; margin: .5rem 0; }
.errorbox .hint { color: #5b1a15; font-weight: 500; }
.spinner { width: 22px; height: 22px; border: 3px solid #cfd8e3; border-top-color: var(--primary); border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; vertical-align: middle; }
.spinner.small { width: 14px; height: 14px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { position: relative; height: 22px; background: #eef1f5; border-radius: 11px; overflow: hidden; margin: .4rem 0; }
.progress .bar { height: 100%; background: linear-gradient(90deg, #4f82ff, var(--primary)); transition: width .4s; }
.progress .bar.indeterminate { width: 35%; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.progress-label { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 10px; font-size: .78rem; color: #1b2a44; white-space: nowrap; overflow: hidden; }
.stages { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 0; margin: .5rem 0; font-size: .82rem; }
.stages li { display: flex; align-items: center; gap: 5px; color: var(--muted); } .stages .dot { width: 10px; height: 10px; border-radius: 50%; background: #cfd5dd; }
.stages li.done { color: var(--ok); } .stages li.done .dot { background: var(--ok); } .stages li.now { color: var(--primary); font-weight: 600; } .stages li.now .dot { background: var(--primary); animation: pulse 1s infinite alternate; }
.stages li.err { color: var(--bad); font-weight: 600; } .stages li.err .dot { background: var(--bad); } .stages li.wait { color: var(--warn); font-weight: 600; } .stages li.wait .dot { background: #ffb020; }
@keyframes pulse { to { opacity: .35; } }
/* --- estructura --- */
.app { min-height: 100vh; padding-bottom: 80px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: #fff; border-bottom: 1px solid var(--line); padding-top: max(8px, env(safe-area-inset-top)); }
.brand { font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; }
.tabs { display: flex; gap: 4px; margin-left: 10px; } .tabs button { min-height: 40px; border: 0; background: none; padding: 0 14px; border-radius: 10px; font-size: 1rem; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--primary-weak); color: var(--primary); font-weight: 600; }
.badge { display: inline-block; background: var(--primary); color: #fff; border-radius: 10px; font-size: .72rem; padding: 0 6px; margin-left: 6px; }
.study-switch { width: auto; max-width: 30vw; min-height: 38px; margin-left: auto; }
.menu { position: relative; margin-left: auto; } .study-switch + .menu { margin-left: 0; }
.menu-btn { display: flex; gap: 8px; align-items: center; background: none; border: 0; min-height: var(--tap); cursor: pointer; font-size: .95rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; }
.menu-pop { position: absolute; right: 0; top: 48px; background: #fff; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.18); padding: 6px; min-width: 240px; z-index: 30; }
.menu-pop button { display: block; width: 100%; text-align: left; min-height: var(--tap); border: 0; background: none; border-radius: 8px; padding: 0 12px; font-size: 1rem; cursor: pointer; }
.menu-pop button:hover { background: var(--primary-weak); } .menu-who { padding: 8px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.content { max-width: 1400px; margin: 0 auto; padding: 14px; }
.bottombar { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); display: flex; z-index: 20; padding-bottom: env(safe-area-inset-bottom); }
.bottombar button { flex: 1; min-height: 58px; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .78rem; gap: 2px; color: var(--muted); }
.bottombar button span[aria-hidden] { font-size: 1.25rem; } .bottombar button.on { color: var(--primary); font-weight: 700; }
.disclaimer { text-align: center; font-size: .75rem; color: var(--muted); padding: 0 16px 16px; }
.mobile-only { display: none; }
@media (max-width: 820px) { .desktop-only { display: none !important; } .mobile-only { display: flex; } .content { padding: 10px; } .grid2 { grid-template-columns: 1fr; } }
/* --- estudios --- */
.studies-layout { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 14px; align-items: start; }
@media (max-width: 980px) { .studies-layout { grid-template-columns: 1fr; } }
.seg { display: flex; background: #eef1f5; padding: 4px; border-radius: 12px; gap: 4px; margin: .4rem 0 .6rem; } .seg.wrap { flex-wrap: wrap; }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: none; font-size: .93rem; cursor: pointer; color: var(--muted); text-transform: none; }
.seg button.on { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.drop { border: 2px dashed #c5cfdb; border-radius: 12px; padding: 14px; background: #fafbfd; } .drop.on { border-color: var(--primary); background: var(--primary-weak); }
.picked { font-weight: 600; margin-top: .6rem; }
.upload-row { padding: .4rem 0; border-top: 1px solid var(--line); }
.search { max-width: 220px; min-height: 38px; }
.study { border-top: 1px solid var(--line); padding: 12px 0; } .study:first-of-type { border-top: 0; }
.study .actions { margin-top: .4rem; }
.series-list { display: flex; flex-direction: column; gap: 8px; } .series { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.series.sel { border-color: var(--primary); background: var(--primary-weak); } .series img { border-radius: 6px; background: #000; }
.thumb-ph { width: 96px; height: 96px; display: grid; place-items: center; background: #eef1f5; border-radius: 6px; color: var(--muted); }
.kv { list-style: none; padding: 0; margin: .3rem 0; } .kv li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid #f0f2f5; font-size: .9rem; }
.kv li span { color: var(--muted); } .kv li b { text-align: right; font-weight: 600; }
.warnlist { padding-left: 18px; color: var(--warn); font-size: .88rem; } .violations { padding-left: 18px; color: var(--bad); font-size: .9rem; }
.good { color: var(--ok); }
.fit { list-style: none; padding: 8px 10px; margin: .3rem 0 .5rem; background: #f4f6f8; border-radius: 8px; font-size: .88rem; } .fit li { padding: 2px 0; }
.card h4 { margin: .9rem 0 .3rem; font-size: .92rem; }
.events { list-style: none; padding: 0; font-size: .82rem; max-height: 240px; overflow: auto; } .events li.error { color: var(--bad); } .events li.warning { color: var(--warn); }
.empty { text-align: center; padding: 24px 10px; color: var(--muted); }
.picklist { list-style: none; padding: 0; display: grid; gap: 8px; }
/* --- modal --- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 20, 30, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
.modal.wide { max-width: 900px; }
@media (min-width: 821px) { .modal-bg { align-items: center; } .modal { border-radius: 16px; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; }
.modal-head h2 { margin: 0; font-size: 1.1rem; } .modal-body { padding: 14px 16px 18px; }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 76px; z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 520px); }
.toast { padding: 12px 14px; border-radius: 12px; color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.2); background: #26303d; } .toast.ok { background: #1e7d32; } .toast.error { background: #b3261e; } .toast .hint { opacity: .9; font-size: .88rem; margin-top: 4px; }
/* --- planificación --- */
.plan-head { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.plan-body { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; align-items: start; }
.plan-view, .plan-side, .library, .col-left { min-width: 0; }
@media (max-width: 1100px) { .plan-body { grid-template-columns: minmax(0, 1fr); } }
.plan-side .card { margin-bottom: 12px; }
.loading-box { padding: 40px; text-align: center; color: var(--muted); }
.slices { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.slice { position: relative; margin: 0; background: #000; border-radius: 10px; overflow: hidden; }
.slice canvas { display: block; width: 100% !important; height: auto !important; }
.slice-title { position: absolute; top: 6px; left: 8px; max-width: calc(100% - 60px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; font-size: .78rem; background: rgba(0,0,0,.55); padding: 2px 6px; border-radius: 6px; }
.ol { position: absolute; color: #ffd978; font-weight: 700; font-size: .8rem; background: rgba(0,0,0,.55); padding: 1px 5px; border-radius: 5px; pointer-events: none; }
.ol.l { left: 4px; top: 50%; } .ol.r { right: 4px; top: 50%; } .ol.t { top: 32px; left: 50%; transform: translateX(-50%); } .ol.b { bottom: 44px; left: 50%; transform: translateX(-50%); }
.scalebar { position: absolute; right: 12px; bottom: 46px; height: 4px; background: #fff; border-radius: 2px; pointer-events: none; }
.scalebar i { position: absolute; right: 0; bottom: 6px; color: #fff; font-style: normal; font-size: .72rem; white-space: nowrap; background: rgba(0,0,0,.55); padding: 0 4px; border-radius: 4px; }
.zoomctl { position: absolute; right: 6px; top: 6px; display: flex; flex-direction: column; gap: 4px; }
.zoomctl button { width: 36px; height: 36px; border-radius: 8px; border: 0; background: rgba(255,255,255,.85); font-size: 1.1rem; cursor: pointer; }
.slice .slider { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.6); border-radius: 0; padding: 0 10px; }
.view3d-canvas { width: 100%; border-radius: 10px; overflow: hidden; touch-action: none; }
.view3d-canvas canvas { display: block; width: 100% !important; }
.implant-slices { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.view3d-tools { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-top: 6px; font-size: .9rem; } .view3d-tools select { width: auto; min-height: 36px; margin-left: 4px; }
.view-tools { margin-top: 8px; font-size: .9rem; } .view-tools input[type=range] { width: 110px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .78rem; color: var(--muted); } .legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -2px; border: 1px solid rgba(0,0,0,.15); }
.sites { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.site { width: 100%; display: flex; align-items: center; gap: 10px; min-height: var(--tap); border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 10px; cursor: pointer; text-align: left; }
.site b { font-size: 1.1rem; min-width: 30px; } .site.sel { border-color: var(--primary); background: var(--primary-weak); }
.pad { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: .4rem 0; }
.pad button { min-height: 46px; border-radius: 10px; border: 1px solid var(--line); background: #f7f9fc; font-size: .95rem; cursor: pointer; } .pad button:active { background: var(--primary-weak); }
.teeth-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; } .tooth { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.tooth.uncertain { border-color: #ffb020; background: var(--warn-bg); }
.history { list-style: none; padding: 0; } .history li { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; } .history li.cur { border-color: var(--primary); }
/* --- informe, cuenta --- */
.report-layout, .account-layout { max-width: 900px; margin: 0 auto; }
.previous ul { list-style: none; padding: 0; } .previous li { padding: 4px 0; }
.shares { list-style: none; padding: 0; } .shares li { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding: 6px 0; } .shares li.revoked { opacity: .6; }
.sessions { list-style: none; padding: 0; } .sessions li { display: flex; gap: 10px; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); padding: 6px 0; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; } .plan { border: 1px solid var(--line); border-radius: 12px; padding: 12px; } .plan.cur { border-color: var(--primary); }
.price { font-size: 1.3rem; font-weight: 700; margin: .2rem 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: .85rem; display: block; overflow-x: auto; } .tbl th, .tbl td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; } .auth-card { width: min(460px, 100%); }
details summary { cursor: pointer; min-height: 36px; display: flex; align-items: center; font-weight: 600; }
/* acciones de planificación en móvil: principal + menú «Más» */
.more-menu { margin-left: 0; }
.more-menu .menu-pop { top: 52px; }
@media (max-width: 820px) { .plan-head h2 { font-size: 1.15rem; } .plan-actions { width: 100%; } .plan-actions .btn.primary { flex: 1; } }
.version-notice { background: var(--warn-bg); color: var(--text); border-bottom: 2px solid var(--warn); padding: 10px 14px; font-weight: 600; font-size: .95rem; line-height: 1.35; text-align: center; }
.version-notice .btn { margin-left: 8px; }
