:root{
  --primary:#157347;
  --primary2:#0f5f3a;
  --bg:#f4f7f5;
  --panel:#ffffff;
  --text:#10251b;
  --muted:#667b70;
  --line:#cfe8dc;
  --soft:#eef3f0;
  --danger:#b42318;
  --success:#0f7a4f;
  --shadow:0 18px 40px rgba(17,73,47,.10);
  --radius:22px;
  --sidebar-w:282px;
  --sidebar-collapsed:88px;
}
.theme-blue{--primary:#1769aa;--primary2:#0d4776;--bg:#f4f7f5;--soft:#eef3f0;--line:#d8e4de;--success:#1769aa;--shadow:0 18px 40px rgba(23,105,170,.10)}
.theme-teal{--primary:#0f766e;--primary2:#115e59;--bg:#f4f7f5;--soft:#eef3f0;--line:#d8e4de;--success:#0f766e;--shadow:0 18px 40px rgba(15,118,110,.10)}
.theme-cyan{--primary:#0891b2;--primary2:#0e7490;--bg:#f4f7f5;--soft:#eef3f0;--line:#d8e4de;--success:#0891b2;--shadow:0 18px 40px rgba(8,145,178,.10)}

*{box-sizing:border-box;min-width:0}
html,body{width:100%;max-width:100%;height:100%;min-height:100%;overflow-x:hidden}
body{margin:0;background:var(--bg);color:var(--text);font-family:Inter,Arial,Helvetica,sans-serif;-webkit-user-select:none;user-select:none}
input,button{font:inherit}
input{text-transform:uppercase}
button{white-space:normal}
.hidden{display:none!important}

.boot-view{position:fixed;inset:0;z-index:50;display:grid;place-items:center;background:radial-gradient(circle at top,var(--soft),var(--bg));padding:22px}
.boot-card{background:var(--panel);border:1px solid var(--line);box-shadow:var(--shadow);border-radius:26px;padding:26px 30px;display:grid;gap:12px;justify-items:center;color:var(--text);text-align:center}
.login-view{min-height:100dvh;width:100%;display:grid;place-items:center;padding:22px;background:var(--bg)}
.login-card{width:min(430px,100%);background:var(--panel);padding:34px;border-radius:28px;box-shadow:var(--shadow);border:1px solid var(--line);text-align:center}
.brand-mark{width:86px;height:86px;margin:0 auto 14px;border-radius:22px;background:#fff;color:#fff;display:grid;place-items:center;font-weight:900;letter-spacing:.3px;flex:0 0 auto;overflow:hidden;position:relative;border:1px solid var(--line);box-shadow:0 10px 24px rgba(17,73,47,.10)}
.brand-mark.small{width:54px;height:54px;margin:0;border-radius:17px;background:#fff;border-color:rgba(255,255,255,.35)}
.brand-mark img{width:100%;height:100%;object-fit:contain;padding:6px;display:block}
.top-logo{width:82px;height:82px;border:1px solid var(--line);border-radius:22px;background:#fff;display:grid;place-items:center;overflow:hidden;box-shadow:0 10px 24px rgba(17,73,47,.08);flex:0 0 auto}
.top-logo img{width:100%;height:100%;object-fit:contain;padding:5px;display:block}
.login-card h1{margin:6px 0;font-size:28px;line-height:1.1}
.login-card p,.topbar p,.card p{color:var(--muted);margin:.25rem 0;line-height:1.35}
.form-stack{display:grid;gap:14px;text-align:left;margin-top:22px}
.form-stack label,.compact-label,.admin-form label{display:grid;gap:7px;font-weight:800;color:var(--text)}
.compact-label span{font-weight:600;color:var(--muted)}
input{width:100%;border:1px solid var(--line);border-radius:15px;padding:13px 14px;background:var(--panel);color:var(--text);outline:none}
input:focus{border-color:var(--primary);box-shadow:0 0 0 4px color-mix(in srgb,var(--primary) 15%,transparent)}

.btn,.icon-btn{border:0;border-radius:15px;padding:12px 16px;cursor:pointer;font-weight:900;display:inline-flex;align-items:center;justify-content:center;gap:9px;color:var(--text);background:var(--soft);border:1px solid var(--line);text-decoration:none}
.btn svg,.nav-item svg,.logout svg,.menu-toggle svg{width:20px;height:20px;min-width:20px}
.btn.primary{background:var(--primary);color:#fff;border-color:var(--primary)}
.btn.success{background:var(--success);color:#fff;border-color:var(--success)}
.btn.danger{color:var(--danger)}
.btn.ghost{background:transparent}
.btn.full{width:100%}
.btn:disabled{opacity:.65;cursor:not-allowed}
.msg{display:block;margin-top:12px;color:var(--danger);font-weight:800}

.app-shell{height:100dvh;min-height:100dvh;width:100%;max-width:100vw;display:flex;overflow:hidden;background:var(--bg)}
.sidebar{width:var(--sidebar-w);min-width:var(--sidebar-w);max-width:var(--sidebar-w);background:linear-gradient(180deg,var(--primary),var(--primary2));color:#fff;padding:20px 16px;position:sticky;top:0;height:100dvh;display:flex;flex-direction:column;gap:16px;transition:.2s;z-index:9;overflow:hidden}
.sidebar.collapsed{width:var(--sidebar-collapsed);min-width:var(--sidebar-collapsed);max-width:var(--sidebar-collapsed)}
.side-brand{display:flex;align-items:center;gap:13px;padding:4px 4px 14px;border-bottom:1px solid rgba(255,255,255,.18)}
.brand-text{min-width:0}
.brand-text strong,.brand-text span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.brand-text span{font-size:13px;opacity:.85;margin-top:4px}
.sidebar.collapsed .brand-text,.sidebar.collapsed .nav-item span,.sidebar.collapsed .logout span,.sidebar.collapsed .menu-toggle span{display:none}
.menu-toggle,.nav-item,.logout{width:100%;border:1px solid rgba(255,255,255,.18);background:rgba(255,255,255,.06);color:#fff;border-radius:16px;padding:14px 16px;display:flex;align-items:center;gap:14px;font-weight:900;cursor:pointer;overflow:hidden}
.nav-list{display:grid;gap:8px}
.nav-item{border-color:transparent;background:transparent;justify-content:flex-start;text-align:left}
.nav-item span,.logout span,.menu-toggle span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.nav-item.active,.nav-item:hover,.logout:hover,.menu-toggle:hover{background:rgba(255,255,255,.18)}
.logout{margin-top:auto;justify-content:center}
.sidebar-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.38);z-index:8}

.main-content{flex:1;width:100%;min-width:0;max-width:100%;height:100dvh;padding:24px;overflow-x:hidden;overflow-y:auto}
.topbar{background:var(--panel);border:1px solid var(--line);border-radius:26px;padding:20px;display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:14px;box-shadow:var(--shadow);margin-bottom:22px;max-width:100%;overflow:hidden}
.top-title{min-width:0;overflow:hidden}
.topbar h2{margin:0;font-size:clamp(18px,2.2vw,24px);line-height:1.15;white-space:normal;overflow-wrap:anywhere}
.top-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end;justify-self:end;max-width:100%}
.icon-btn{width:48px;height:48px;padding:0;flex:0 0 auto}
#mobileMenuBtn{display:none}

.section{display:none;width:100%;max-width:100%;overflow-x:hidden}
.section.active{display:block}
.stats-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin-bottom:18px;width:100%}
.stat-card,.card{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);min-width:0;max-width:100%;overflow:hidden}
.stat-card{padding:20px}
.stat-card span{display:block;color:var(--muted);font-weight:900;text-transform:uppercase;font-size:13px;letter-spacing:.2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.stat-card strong{font-size:clamp(22px,3vw,30px);color:var(--primary);line-height:1.2}
.work-grid{display:grid;grid-template-columns:minmax(0,1.18fr) minmax(320px,.82fr);gap:18px;width:100%;max-width:100%;overflow:hidden}
.card{padding:20px}
.card-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px;gap:12px}
.card h3{margin:0 0 3px;line-height:1.2}
.search-box{display:flex;align-items:center;gap:10px;border:1px solid var(--line);border-radius:16px;padding:0 12px;margin:12px 0;background:var(--soft);max-width:100%}
.search-box svg{width:20px;height:20px;min-width:20px;color:var(--primary)}
.search-box input{border:0;background:transparent;box-shadow:none!important}
.search-box + .exam-list,
.search-box + .admin-list{
  margin-top:30px;
  padding-top:4px;
}
.exam-list,.selected-list,.history-list,.admin-list{display:grid;gap:10px;max-height:58vh;overflow-y:auto;overflow-x:hidden;padding-right:4px;max-width:100%}
.empty-state{border:1px dashed var(--line);background:var(--soft);border-radius:18px;padding:18px;color:var(--muted);font-weight:850;line-height:1.35}
.exam-item,.selected-item,.history-item,.admin-item{border:1px solid var(--line);background:var(--panel);border-radius:18px;padding:14px;display:flex;align-items:center;justify-content:space-between;gap:12px;max-width:100%;overflow:hidden;transition:.16s ease}
.exam-item:hover,.admin-item:hover,.history-item:hover{border-color:var(--primary);box-shadow:0 10px 24px rgba(12,82,49,.08);transform:translateY(-1px)}
.exam-item>div:first-child,.selected-item>div:first-child,.history-item>div:first-child,.admin-item>div:first-child{min-width:0;overflow:hidden}
.exam-item b,.selected-item b,.history-item b,.admin-item b{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.25}
.exam-item small,.selected-item small,.history-item small,.admin-item small{display:block;color:var(--muted);font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-top:4px}
.price{font-weight:950;color:var(--primary);white-space:nowrap}
.mini-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap;min-width:0;max-width:50%;overflow:hidden}
.history-item .mini-actions,.admin-item .mini-actions{max-width:60%}
.mini{padding:8px 10px;border-radius:12px;min-height:36px}

.switch-row{display:flex;align-items:center;gap:12px;border:1px solid var(--line);border-radius:16px;padding:13px;background:var(--soft);margin:12px 0;max-width:100%;overflow:hidden}
.switch-row input{display:none}
.switch-row span{width:46px;height:26px;border-radius:99px;background:#b8c7be;position:relative;flex:0 0 46px}
.switch-row span:before{content:"";width:20px;height:20px;border-radius:50%;background:#fff;position:absolute;top:3px;left:3px;transition:.2s}
.switch-row input:checked+span{background:var(--primary)}
.switch-row input:checked+span:before{left:23px}
.switch-row strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.total-box{border-top:1px dashed var(--line);margin-top:14px;padding-top:14px;display:grid;gap:9px}
.total-box div{display:flex;justify-content:space-between;gap:10px}
.grand{font-size:22px;color:var(--primary)}
.actions-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-top:14px}
.profile-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(280px,.75fr);gap:18px;max-width:1040px}
.profile-card{max-width:100%}
.max-520{max-width:520px}
.theme-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:16px}
.theme-choice{border:1px solid var(--line);background:var(--soft);color:var(--text);border-radius:16px;padding:12px;font-weight:900;display:flex;align-items:center;gap:10px;cursor:pointer}
.theme-choice.active{outline:3px solid color-mix(in srgb,var(--primary) 22%,transparent);border-color:var(--primary)}
.dot{width:18px;height:18px;border-radius:50%;display:inline-block;flex:0 0 auto}.dot.green{background:#157347}.dot.blue{background:#1769aa}.dot.teal{background:#0f766e}.dot.cyan{background:#0891b2}

.admin-form{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px;align-items:end;margin-bottom:14px;max-width:100%;overflow:hidden}
.checkline{display:flex!important;gap:8px!important;align-items:center;align-self:center;padding:12px 0}
.checkline input{width:auto}

.modal{position:fixed;inset:0;background:rgba(0,0,0,.52);display:grid;place-items:center;padding:18px;z-index:20;overflow-x:hidden}
.modal-card{background:var(--panel);border-radius:24px;width:min(850px,calc(100vw - 28px));max-width:100%;max-height:92vh;overflow-y:auto;overflow-x:hidden;padding:18px;border:1px solid var(--line)}
.modal-head,.modal-actions{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.modal-head h3{margin:0}
.quote-paper{background:#fff;color:#111;border-radius:14px;padding:28px;margin:14px 0;border:1px solid #ddd;max-width:100%;overflow:hidden}
.quote-paper h2{text-align:center;margin:0;line-height:1.2;overflow-wrap:anywhere}
.quote-paper .muted{color:#555}
.quote-table{width:100%;border-collapse:collapse;margin-top:18px;table-layout:fixed}
.quote-table th,.quote-table td{border-bottom:1px solid #ddd;padding:10px;text-align:left;overflow-wrap:anywhere}
.quote-table th:last-child,.quote-table td:last-child{text-align:right;width:120px}
.quote-total{margin-left:auto;width:min(280px,100%);margin-top:18px}
.quote-total p,.quote-total h3{display:flex;justify-content:space-between;gap:12px}
.toast{position:fixed;right:20px;bottom:20px;background:var(--text);color:var(--panel);padding:14px 18px;border-radius:16px;font-weight:900;z-index:30;max-width:min(420px,calc(100vw - 40px));box-shadow:var(--shadow)}
.mobile-open{transform:translateX(0)!important}

@media(max-width:1100px){
  .work-grid{grid-template-columns:minmax(0,1fr)}
  .selected-card{order:-1}
  .exam-list,.selected-list,.history-list,.admin-list{max-height:42vh}
}
@media(max-width:920px){
  :root{--sidebar-w:282px}
  .app-shell{display:block;overflow-x:hidden;height:auto;min-height:100dvh}
  .sidebar{position:fixed;left:0;top:0;z-index:9;transform:translateX(-105%);box-shadow:var(--shadow);width:min(282px,86vw);min-width:0;max-width:86vw}
  .sidebar.collapsed{width:min(282px,86vw);max-width:86vw}
  .sidebar.collapsed .brand-text,.sidebar.collapsed .nav-item span,.sidebar.collapsed .logout span,.sidebar.collapsed .menu-toggle span{display:block}
  .main-content{padding:12px;width:100%;max-width:100vw;height:auto;min-height:100dvh}
  .topbar{align-items:flex-start;flex-wrap:wrap;border-radius:22px;padding:16px}
  .top-actions{margin-left:auto}
  .top-actions .btn{padding:10px 12px}
  #mobileMenuBtn{display:flex}
  .stats-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
  .stat-card{padding:14px;border-radius:18px}
  .work-grid{grid-template-columns:minmax(0,1fr);gap:12px}
  .card{padding:16px;border-radius:20px}
  .actions-grid{grid-template-columns:1fr}
  .profile-grid{grid-template-columns:1fr}
  .exam-list,.selected-list,.history-list,.admin-list{max-height:none}
  .exam-item,.selected-item,.history-item,.admin-item{align-items:flex-start;flex-wrap:wrap}
  .mini-actions,.history-item .mini-actions,.admin-item .mini-actions{width:100%;max-width:100%;justify-content:flex-start;min-width:0}
  .mini-actions .btn{flex:1 1 auto}
  .theme-options{grid-template-columns:1fr}
}
@media(max-width:520px){
  .login-card{padding:24px;border-radius:22px}
  .topbar h2{white-space:normal}
  .top-actions{width:100%}
  .top-actions .btn{width:100%}
  .stats-grid{grid-template-columns:1fr}
  .exam-item b,.selected-item b,.history-item b,.admin-item b,.exam-item small,.selected-item small,.history-item small,.admin-item small{white-space:normal;overflow-wrap:anywhere}
  .modal{padding:8px}
  .modal-card{width:calc(100vw - 16px);padding:12px;border-radius:18px}
  .quote-paper{padding:16px}
  .quote-table th:last-child,.quote-table td:last-child{width:92px}
}
@media print{
  body *{visibility:hidden!important}
  .quote-paper,.quote-paper *{visibility:visible!important}
  .quote-paper{position:absolute;left:0;top:0;width:100%;margin:0;border:0;border-radius:0;color:#111;background:#fff}
}

/* Ajustes v5: botones principales arriba y sin desplazamiento horizontal */
.selected-card{position:relative;display:flex;flex-direction:column;gap:12px}
.selected-card .card-head{margin-bottom:0}
.quote-actions-top{position:sticky;top:0;z-index:3;background:var(--panel);border:1px solid var(--line);border-radius:18px;padding:10px;margin:0 0 2px;box-shadow:0 10px 26px rgba(17,73,47,.07)}
.quote-actions-top .btn{min-height:44px}
.selected-list{max-height:34vh}
.modal-actions{justify-content:flex-end}
@media(max-width:920px){
  .quote-actions-top{position:sticky;top:8px;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
  .quote-actions-top .btn{padding:10px 8px;font-size:14px}
}
@media(max-width:420px){
  .quote-actions-top{grid-template-columns:1fr}
}

/* Ajustes v6: emergencia, modal profesional y botones más cómodos */
input{text-transform:none}
#clinicNameInput,#profileClinicName,#patientName,#adminCode,#adminName,#adminCategory{text-transform:uppercase}
#loginEmail,#loginPassword{text-transform:none!important}

.top-actions{align-items:center}
.emergency-btn{white-space:nowrap;min-height:48px;border-color:color-mix(in srgb,var(--primary) 25%,var(--line));background:#fff}
.emergency-btn.active{background:linear-gradient(135deg,#f59e0b,#ea580c);border-color:#ea580c;color:#fff}
.emergency-btn.scheduled:not(.active){border-color:#f59e0b;color:#9a3412;background:#fff7ed}
.clock-box{min-height:48px;display:inline-flex;align-items:center;justify-content:center;gap:8px;border:1px solid var(--line);border-radius:15px;padding:10px 14px;background:var(--panel);font-weight:950;color:var(--primary);white-space:nowrap}
.clock-box svg{width:19px;height:19px;min-width:19px}
.clock-box.emergency{background:#fff7ed;border-color:#fdba74;color:#c2410c}
.clock-box.scheduled:not(.emergency){background:#f0fdfa;border-color:#99f6e4;color:#0f766e}
.emergency-status{display:flex;align-items:flex-start;gap:10px;border:1px solid var(--line);background:var(--soft);border-radius:16px;padding:12px 13px;font-weight:850;color:var(--muted);line-height:1.35}
.emergency-status svg{width:18px;height:18px;min-width:18px;color:var(--primary);margin-top:1px}
.emergency-status.active{background:#fff7ed;border-color:#fdba74;color:#9a3412}
.emergency-status.active svg{color:#ea580c}

.quote-actions-top{display:flex!important;grid-template-columns:none!important;flex-wrap:wrap;align-items:center;gap:10px}
.quote-actions-top .btn{flex:1 1 128px;min-width:0;white-space:nowrap;padding-left:12px;padding-right:12px}

.modal-card{display:flex;flex-direction:column;position:relative}
.modal-head{position:sticky;top:0;z-index:5;background:var(--panel);padding-bottom:10px;border-bottom:1px solid var(--line)}
.sticky-modal-actions{position:sticky;top:58px;z-index:5;background:var(--panel);padding:10px 0;border-bottom:1px solid var(--line);justify-content:flex-end}
.sticky-modal-actions .btn{white-space:nowrap;min-height:44px}
.quote-paper{margin-top:14px}

.confirm-card{background:var(--panel);border:1px solid var(--line);border-radius:26px;width:min(430px,calc(100vw - 28px));box-shadow:var(--shadow);padding:26px;text-align:center}
.confirm-icon{width:58px;height:58px;margin:0 auto 14px;border-radius:20px;background:#fff7ed;color:#ea580c;display:grid;place-items:center}
.confirm-icon svg{width:28px;height:28px}
.confirm-card h3{margin:0 0 8px;font-size:22px}
.confirm-card p{margin:0;color:var(--muted);line-height:1.45;font-weight:750}
.confirm-actions{display:flex;justify-content:center;gap:10px;margin-top:22px;flex-wrap:wrap}
.confirm-actions .btn{min-width:140px}

@media(max-width:920px){
  .top-actions{width:100%;display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .top-actions .btn,.clock-box{width:100%}
  .clock-box{grid-column:1/-1}
  .quote-actions-top{display:flex!important;flex-wrap:wrap!important}
  .quote-actions-top .btn{flex:1 1 118px;font-size:14px;padding:10px 8px}
  .sticky-modal-actions{top:58px;justify-content:stretch}
  .sticky-modal-actions .btn{flex:1 1 130px}
}
@media(max-width:460px){
  .top-actions{grid-template-columns:1fr}
  .quote-actions-top .btn{flex:1 1 100%}
  .sticky-modal-actions .btn{flex:1 1 100%}
  .confirm-actions .btn{width:100%}
}


/* Ajustes v7: visualizador con contenido deslizable, botones arriba y textos finales */
.modal{align-items:center;justify-items:center;overflow:hidden}
.modal-card{max-height:92dvh;overflow:hidden;display:flex;flex-direction:column;padding:0}
.modal-head{position:relative;top:auto;z-index:6;padding:18px 18px 12px;border-bottom:1px solid var(--line);flex:0 0 auto}
.sticky-modal-actions{position:relative;top:auto;z-index:6;padding:12px 18px;border-bottom:1px solid var(--line);flex:0 0 auto;background:var(--panel);justify-content:flex-end}
.modal-scroll{flex:1 1 auto;overflow-y:auto;overflow-x:hidden;padding:0 18px 18px;min-height:0;-webkit-overflow-scrolling:touch}
.quote-paper{margin:14px 0 0}
#closePreview{background:var(--soft);border-color:var(--line)}
.empty-state{font-weight:800}
@media(max-width:520px){
  .modal-card{max-height:94dvh;width:calc(100vw - 14px);border-radius:18px}
  .modal-head{padding:14px 14px 10px}
  .sticky-modal-actions{padding:10px 14px;display:grid;grid-template-columns:1fr;gap:8px}
  .sticky-modal-actions .btn{width:100%;flex:unset}
  .modal-scroll{padding:0 12px 14px}
}


/* Ajustes v8: búsqueda sin historial del navegador, menú persistente y mejor adaptación móvil */
html,body{overscroll-behavior:none;}
body{min-height:100dvh;}
input:-webkit-autofill{transition:background-color 9999s ease-in-out 0s;}
#examSearch,#adminSearch{-webkit-appearance:none;appearance:none;}
.btn{min-width:0;overflow:hidden;}
.btn span,.btn{ text-overflow:ellipsis; }
.main-content{scrollbar-gutter:stable both-edges;}
.quote-actions-top{max-width:100%;}
.quote-actions-top .btn{min-width:112px;}
@media(max-width:1100px){
  .work-grid{grid-template-columns:minmax(0,1fr);}
  .selected-card,.catalog-card{width:100%;}
}
@media(max-width:920px){
  html,body{height:auto;min-height:100dvh;overflow-x:hidden;}
  .app-shell{min-height:100dvh;width:100vw;max-width:100vw;overflow-x:hidden;}
  .sidebar{height:100dvh;min-height:100dvh;padding-top:max(18px,env(safe-area-inset-top));padding-bottom:max(18px,env(safe-area-inset-bottom));}
  .main-content{padding:12px;overflow-x:hidden;width:100vw;max-width:100vw;}
  .topbar{position:relative;margin-bottom:12px;}
  .top-title{flex:1 1 180px;}
  .top-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;}
  .clock-box{grid-column:1/-1;}
  .quote-actions-top{position:sticky;top:8px;display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));}
  .quote-actions-top .btn{min-width:0;width:100%;white-space:normal;line-height:1.15;}
  .exam-list,.selected-list,.history-list,.admin-list{max-height:none;padding-right:0;}
}
@media(max-width:640px){
  .login-view{padding:12px;}
  .login-card{width:100%;padding:22px 18px;}
  .brand-mark{width:58px;height:58px;border-radius:19px;}
  .topbar{padding:12px;border-radius:18px;gap:10px;}
  .icon-btn{width:44px;height:44px;}
  .top-title h2{font-size:17px;}
  .top-title p{font-size:13px;}
  .stats-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;}
  .stat-card{padding:10px;border-radius:15px;}
  .stat-card span{font-size:11px;}
  .stat-card strong{font-size:18px;}
  .card{padding:12px;border-radius:18px;}
  .card-head{align-items:flex-start;}
  .search-box{border-radius:14px;margin:10px 0;}
  .exam-item,.selected-item,.history-item,.admin-item{padding:12px;border-radius:16px;}
  .mini-actions{gap:6px;}
  .mini-actions .btn,.mini-actions .price{flex:1 1 100%;text-align:center;}
  .quote-actions-top{grid-template-columns:1fr 1fr 1fr!important;gap:6px;padding:8px;border-radius:16px;}
  .quote-actions-top .btn{font-size:12.5px;padding:9px 6px;min-height:42px;gap:5px;}
  .quote-actions-top .btn svg{width:17px;height:17px;min-width:17px;}
  .top-actions{grid-template-columns:1fr;}
  .admin-form{grid-template-columns:1fr;}
  .modal{padding:6px;}
  .modal-card{width:calc(100vw - 12px);max-height:calc(100dvh - 12px);border-radius:16px;}
  .modal-head{padding:12px;}
  .sticky-modal-actions{padding:10px 12px;display:grid;grid-template-columns:1fr 1fr;gap:8px;}
  .sticky-modal-actions .btn{width:100%;font-size:13px;padding:10px 8px;}
  .modal-scroll{padding:0 10px 12px;}
  .quote-paper{padding:14px;border-radius:12px;font-size:13px;}
  .quote-table th,.quote-table td{padding:8px 6px;font-size:12.5px;}
  .quote-table th:last-child,.quote-table td:last-child{width:82px;}
}
@media(max-width:380px){
  .quote-actions-top{grid-template-columns:1fr!important;}
  .stats-grid{grid-template-columns:1fr;}
  .sticky-modal-actions{grid-template-columns:1fr;}
}

/* Ajustes v9: carga masiva por Excel y código sugerido */
.admin-import-panel{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:14px;
  margin:6px 0 14px;
  border:1px solid var(--line);
  border-radius:18px;
  background:linear-gradient(135deg,var(--soft),#ffffff);
}
.admin-import-panel h4{margin:0 0 4px;font-size:16px;color:var(--text)}
.admin-import-panel p{margin:0;color:var(--muted);font-weight:750;line-height:1.35}
.admin-import-actions{display:flex;gap:10px;align-items:center;justify-content:flex-end;flex-wrap:wrap;min-width:260px}
.file-btn{position:relative;overflow:hidden;cursor:pointer;display:inline-flex!important;align-items:center;justify-content:center;gap:8px}
.file-btn input{position:absolute;inset:0;opacity:0;cursor:pointer}
#adminCode{font-weight:950;color:var(--primary)}
@media(max-width:760px){
  .admin-import-panel{align-items:stretch;flex-direction:column}
  .admin-import-actions{min-width:0;width:100%;display:grid;grid-template-columns:1fr}
  .admin-import-actions .btn{width:100%}
}


/* Ajustes v11: corrección exclusiva para celular */
/* El celular usa el contenido principal como área de desplazamiento. */
@media (max-width: 768px){
  html,body{
    width:100%;
    height:100dvh;
    min-height:100dvh;
    overflow:hidden;
    position:relative;
  }
  .app-shell{
    width:100vw;
    height:100dvh;
    min-height:100dvh;
    overflow:hidden;
    display:block;
  }
  .main-content{
    width:100vw;
    max-width:100vw;
    height:100dvh;
    min-height:0;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch;
    padding:12px;
    padding-bottom:calc(28px + env(safe-area-inset-bottom));
    scroll-behavior:smooth;
  }
  .section,.work-grid,.profile-grid{
    overflow:visible!important;
  }
  .sidebar{
    height:100dvh;
    max-height:100dvh;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch;
  }
  .sidebar.mobile-open{
    transform:translateX(0)!important;
  }
  .sidebar-backdrop{
    touch-action:none;
  }
  /* En celular el buscador debe verse primero; la cotización baja después. */
  .catalog-card{order:1!important;}
  .selected-card{order:2!important;}
  .work-grid{display:flex!important;flex-direction:column;gap:12px;}
  .topbar{position:relative;z-index:1;}
  .search-box input{font-size:16px;}
}
@media (max-width: 640px){
  .main-content{padding:10px;padding-bottom:calc(32px + env(safe-area-inset-bottom));}
  .topbar{margin-bottom:10px;}
  .stats-grid{margin-bottom:10px;}
  .card-head p{font-size:13px;}
  .catalog-card .card-head{margin-bottom:8px;}
  .search-box{position:relative;z-index:1;}
  .exam-list{min-height:80px;}
}


/* Ajustes v12: celular siempre usa vista móvil, incluso con “ver como sitio de escritorio”.
   Esto evita que Chrome en Android intente mostrar la vista de PC y oculte el buscador. */
@media (hover:none) and (pointer:coarse){
  html,body{
    width:100%;
    height:100dvh;
    min-height:100dvh;
    overflow:hidden;
    position:relative;
  }
  .app-shell{
    width:100vw;
    height:100dvh;
    min-height:100dvh;
    overflow:hidden;
    display:block;
  }
  .main-content{
    width:100vw!important;
    max-width:100vw!important;
    height:100dvh!important;
    min-height:0!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch;
    padding:12px;
    padding-bottom:calc(32px + env(safe-area-inset-bottom));
    scroll-behavior:smooth;
  }
  .sidebar{
    position:fixed!important;
    left:0;
    top:0;
    z-index:9;
    transform:translateX(-105%);
    width:min(282px,86vw)!important;
    min-width:0!important;
    max-width:86vw!important;
    height:100dvh!important;
    max-height:100dvh!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    box-shadow:var(--shadow);
    padding-top:max(18px,env(safe-area-inset-top));
    padding-bottom:max(18px,env(safe-area-inset-bottom));
  }
  .sidebar.collapsed{
    width:min(282px,86vw)!important;
    min-width:0!important;
    max-width:86vw!important;
  }
  .sidebar.collapsed .brand-text,
  .sidebar.collapsed .nav-item span,
  .sidebar.collapsed .logout span,
  .sidebar.collapsed .menu-toggle span{display:block!important}
  .sidebar.mobile-open{transform:translateX(0)!important}
  #mobileMenuBtn{display:flex!important}
  .topbar{
    position:relative;
    z-index:1;
    align-items:flex-start;
    flex-wrap:wrap;
    border-radius:20px;
    padding:12px;
    gap:10px;
    margin-bottom:10px;
  }
  .top-title{flex:1 1 190px}
  .topbar h2{font-size:18px;white-space:normal}
  .topbar p{font-size:13px}
  .top-actions{
    width:100%;
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px;
    margin-left:0!important;
  }
  .top-actions .btn,.clock-box{width:100%;min-height:48px}
  .clock-box{grid-column:1/-1}
  .stats-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:6px;
    margin-bottom:10px;
  }
  .stat-card{padding:10px;border-radius:15px}
  .stat-card span{font-size:11px}
  .stat-card strong{font-size:18px}
  .work-grid{
    display:flex!important;
    flex-direction:column!important;
    gap:12px;
    overflow:visible!important;
  }
  .catalog-card{order:1!important}
  .selected-card{order:2!important}
  .profile-grid{grid-template-columns:1fr!important;overflow:visible!important}
  .section{overflow:visible!important}
  .card{padding:12px;border-radius:18px}
  .card-head{align-items:flex-start;margin-bottom:8px}
  .card-head p{font-size:13px}
  .search-box{position:relative;z-index:1;border-radius:14px;margin:10px 0}
  .search-box input{font-size:16px}
  .exam-list,.selected-list,.history-list,.admin-list{max-height:none!important;padding-right:0;min-height:80px}
  .exam-item,.selected-item,.history-item,.admin-item{
    padding:12px;
    border-radius:16px;
    align-items:flex-start;
    flex-wrap:wrap;
  }
  .exam-item b,.selected-item b,.history-item b,.admin-item b,
  .exam-item small,.selected-item small,.history-item small,.admin-item small{white-space:normal;overflow-wrap:anywhere}
  .mini-actions,.history-item .mini-actions,.admin-item .mini-actions{width:100%;max-width:100%;justify-content:flex-start}
  .mini-actions .btn,.mini-actions .price{flex:1 1 100%;text-align:center}
  .quote-actions-top{
    position:sticky;
    top:8px;
    z-index:4;
    display:grid!important;
    grid-template-columns:1fr 1fr 1fr!important;
    gap:6px;
    padding:8px;
    border-radius:16px;
  }
  .quote-actions-top .btn{
    min-width:0!important;
    width:100%;
    white-space:normal;
    line-height:1.15;
    font-size:12.5px;
    padding:9px 6px;
    min-height:42px;
    gap:5px;
  }
  .quote-actions-top .btn svg{width:17px;height:17px;min-width:17px}
  .admin-form{grid-template-columns:1fr!important}
  .admin-import-panel{align-items:stretch;flex-direction:column}
  .admin-import-actions{min-width:0;width:100%;display:grid;grid-template-columns:1fr}
  .admin-import-actions .btn{width:100%}
  .modal{padding:6px}
  .modal-card{width:calc(100vw - 12px);max-height:calc(100dvh - 12px);border-radius:16px}
  .modal-head{padding:12px}
  .sticky-modal-actions{padding:10px 12px;display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .sticky-modal-actions .btn{width:100%;font-size:13px;padding:10px 8px}
  .modal-scroll{padding:0 10px 12px}
  .quote-paper{padding:14px;border-radius:12px;font-size:13px}
  .quote-table th,.quote-table td{padding:8px 6px;font-size:12.5px}
  .quote-table th:last-child,.quote-table td:last-child{width:82px}
}
html.mobile-device,html.mobile-device body{
  width:100%;
  height:100dvh;
  min-height:100dvh;
  overflow:hidden;
  position:relative;
}
html.mobile-device .app-shell{
  width:100vw;
  height:100dvh;
  min-height:100dvh;
  overflow:hidden;
  display:block;
}
html.mobile-device .main-content{
  width:100vw!important;
  max-width:100vw!important;
  height:100dvh!important;
  min-height:0!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  -webkit-overflow-scrolling:touch;
  padding:12px;
  padding-bottom:calc(32px + env(safe-area-inset-bottom));
  scroll-behavior:smooth;
}
html.mobile-device .sidebar{
  position:fixed!important;
  left:0;
  top:0;
  z-index:9;
  transform:translateX(-105%);
  width:min(282px,86vw)!important;
  min-width:0!important;
  max-width:86vw!important;
  height:100dvh!important;
  max-height:100dvh!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  box-shadow:var(--shadow);
  padding-top:max(18px,env(safe-area-inset-top));
  padding-bottom:max(18px,env(safe-area-inset-bottom));
}
html.mobile-device .sidebar.collapsed{width:min(282px,86vw)!important;min-width:0!important;max-width:86vw!important}
html.mobile-device .sidebar.collapsed .brand-text,
html.mobile-device .sidebar.collapsed .nav-item span,
html.mobile-device .sidebar.collapsed .logout span,
html.mobile-device .sidebar.collapsed .menu-toggle span{display:block!important}
html.mobile-device .sidebar.mobile-open{transform:translateX(0)!important}
html.mobile-device #mobileMenuBtn{display:flex!important}
html.mobile-device .topbar{position:relative;z-index:1;align-items:flex-start;flex-wrap:wrap;border-radius:20px;padding:12px;gap:10px;margin-bottom:10px}
html.mobile-device .top-title{flex:1 1 190px}
html.mobile-device .topbar h2{font-size:18px;white-space:normal}
html.mobile-device .topbar p{font-size:13px}
html.mobile-device .top-actions{width:100%;display:grid!important;grid-template-columns:1fr!important;gap:8px;margin-left:0!important}
html.mobile-device .top-actions .btn,html.mobile-device .clock-box{width:100%;min-height:48px}
html.mobile-device .clock-box{grid-column:1/-1}
html.mobile-device .stats-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin-bottom:10px}
html.mobile-device .stat-card{padding:10px;border-radius:15px}
html.mobile-device .stat-card span{font-size:11px}
html.mobile-device .stat-card strong{font-size:18px}
html.mobile-device .work-grid{display:flex!important;flex-direction:column!important;gap:12px;overflow:visible!important}
html.mobile-device .catalog-card{order:1!important}
html.mobile-device .selected-card{order:2!important}
html.mobile-device .profile-grid{grid-template-columns:1fr!important;overflow:visible!important}
html.mobile-device .section{overflow:visible!important}
html.mobile-device .card{padding:12px;border-radius:18px}
html.mobile-device .card-head{align-items:flex-start;margin-bottom:8px}
html.mobile-device .card-head p{font-size:13px}
html.mobile-device .search-box{position:relative;z-index:1;border-radius:14px;margin:10px 0}
html.mobile-device .search-box input{font-size:16px}
html.mobile-device .exam-list,html.mobile-device .selected-list,html.mobile-device .history-list,html.mobile-device .admin-list{max-height:none!important;padding-right:0;min-height:80px}
html.mobile-device .exam-item,html.mobile-device .selected-item,html.mobile-device .history-item,html.mobile-device .admin-item{padding:12px;border-radius:16px;align-items:flex-start;flex-wrap:wrap}
html.mobile-device .exam-item b,html.mobile-device .selected-item b,html.mobile-device .history-item b,html.mobile-device .admin-item b,
html.mobile-device .exam-item small,html.mobile-device .selected-item small,html.mobile-device .history-item small,html.mobile-device .admin-item small{white-space:normal;overflow-wrap:anywhere}
html.mobile-device .mini-actions,html.mobile-device .history-item .mini-actions,html.mobile-device .admin-item .mini-actions{width:100%;max-width:100%;justify-content:flex-start}
html.mobile-device .mini-actions .btn,html.mobile-device .mini-actions .price{flex:1 1 100%;text-align:center}
html.mobile-device .quote-actions-top{position:sticky;top:8px;z-index:4;display:grid!important;grid-template-columns:1fr 1fr 1fr!important;gap:6px;padding:8px;border-radius:16px}
html.mobile-device .quote-actions-top .btn{min-width:0!important;width:100%;white-space:normal;line-height:1.15;font-size:12.5px;padding:9px 6px;min-height:42px;gap:5px}
html.mobile-device .quote-actions-top .btn svg{width:17px;height:17px;min-width:17px}
html.mobile-device .admin-form{grid-template-columns:1fr!important}
html.mobile-device .admin-import-panel{align-items:stretch;flex-direction:column}
html.mobile-device .admin-import-actions{min-width:0;width:100%;display:grid;grid-template-columns:1fr}
html.mobile-device .admin-import-actions .btn{width:100%}
html.mobile-device .modal{padding:6px}
html.mobile-device .modal-card{width:calc(100vw - 12px);max-height:calc(100dvh - 12px);border-radius:16px}
html.mobile-device .modal-head{padding:12px}
html.mobile-device .sticky-modal-actions{padding:10px 12px;display:grid;grid-template-columns:1fr 1fr;gap:8px}
html.mobile-device .sticky-modal-actions .btn{width:100%;font-size:13px;padding:10px 8px}
html.mobile-device .modal-scroll{padding:0 10px 12px}
html.mobile-device .quote-paper{padding:14px;border-radius:12px;font-size:13px}
html.mobile-device .quote-table th,html.mobile-device .quote-table td{padding:8px 6px;font-size:12.5px}
html.mobile-device .quote-table th:last-child,html.mobile-device .quote-table td:last-child{width:82px}
@media(max-width:380px){
  html.mobile-device .quote-actions-top{grid-template-columns:1fr!important}
  html.mobile-device .stats-grid{grid-template-columns:1fr}
  html.mobile-device .sticky-modal-actions{grid-template-columns:1fr}
}


/* Ajustes v15: perfiles rápidos y administración de perfiles */
.quick-profiles-panel{
  border:1px solid var(--line);
  background:linear-gradient(135deg,var(--soft),#ffffff);
  border-radius:18px;
  padding:14px;
  margin:10px 0 12px;
  max-width:100%;
  overflow:hidden;
}
.quick-profiles-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:10px}
.quick-profiles-head h4,.profile-builder h4{margin:0;color:var(--text);font-size:16px;line-height:1.2}
.quick-profiles-head small{display:block;color:var(--muted);font-weight:750;margin-top:3px;line-height:1.3}
.profile-quick-list{display:flex;gap:8px;flex-wrap:wrap;max-width:100%;overflow:hidden}
.profile-chip{
  border:1px solid color-mix(in srgb,var(--primary) 28%,var(--line));
  background:#fff;
  color:var(--text);
  border-radius:16px;
  padding:10px 12px;
  display:inline-flex;
  align-items:center;
  gap:8px;
  cursor:pointer;
  font-weight:950;
  max-width:100%;
  box-shadow:0 8px 18px rgba(17,73,47,.06);
}
.profile-chip:hover{border-color:var(--primary);transform:translateY(-1px)}
.profile-chip svg{width:18px;height:18px;min-width:18px;color:var(--primary)}
.profile-chip span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:220px}
.profile-chip small{color:var(--muted);font-weight:850;white-space:nowrap}
.compact-empty{padding:12px;font-size:13px}
.admin-profile-card{margin-top:18px}
.profile-builder{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(280px,.9fr);
  gap:14px;
  margin:12px 0 14px;
  max-width:100%;
}
.profile-builder-col{
  border:1px solid var(--line);
  background:var(--soft);
  border-radius:18px;
  padding:14px;
  max-width:100%;
  overflow:hidden;
}
.compact-admin-list{max-height:36vh}
.profile-selected-list{max-height:36vh}
.admin-item.compact{background:#fff}
@media(max-width:920px){
  .profile-builder{grid-template-columns:1fr;gap:10px}
  .profile-quick-list{display:grid;grid-template-columns:1fr 1fr}
  .profile-chip{width:100%;justify-content:flex-start}
  .profile-chip span{max-width:100%}
}
@media(max-width:560px){
  .quick-profiles-panel{padding:12px;border-radius:16px}
  .profile-quick-list{grid-template-columns:1fr}
  .profile-chip{padding:11px 12px}
  .profile-chip span{white-space:normal;overflow-wrap:anywhere}
  .profile-chip small{margin-left:auto}
  .profile-builder-col{padding:12px;border-radius:16px}
}
html.mobile-device .profile-builder{grid-template-columns:1fr!important;gap:10px}
html.mobile-device .profile-quick-list{display:grid;grid-template-columns:1fr!important}
html.mobile-device .profile-chip{width:100%;justify-content:flex-start;padding:11px 12px}
html.mobile-device .profile-chip span{white-space:normal;overflow-wrap:anywhere;max-width:100%}
html.mobile-device .profile-chip small{margin-left:auto}
html.mobile-device .compact-admin-list,html.mobile-device .profile-selected-list{max-height:none!important}

/* Control de altura para que el buscador siga visible aunque existan muchos perfiles */
.profile-quick-list{max-height:190px;overflow-y:auto;padding-right:2px}
@media(max-width:560px){.profile-quick-list{max-height:170px}}
html.mobile-device .profile-quick-list{max-height:170px;overflow-y:auto}

/* Ajuste v16: evita que el botón de perfiles rápidos se corte en móvil al seleccionarlo */
.profile-quick-list{
  padding:4px 4px 8px!important;
  box-sizing:border-box;
}
.profile-chip{
  margin:2px 0;
  transform:none!important;
  min-height:52px;
}
.profile-chip:hover,
.profile-chip:focus,
.profile-chip:active{
  transform:none!important;
}
.quick-profiles-panel{
  overflow:visible!important;
}
html.mobile-device .quick-profiles-panel{
  overflow:visible!important;
}
html.mobile-device .profile-quick-list{
  padding:6px 4px 10px!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  -webkit-overflow-scrolling:touch;
}
html.mobile-device .profile-chip{
  margin:3px 0;
  min-height:56px;
}
@media(max-width:560px){
  .profile-quick-list{
    padding:6px 4px 10px!important;
  }
  .profile-chip{
    margin:3px 0;
    min-height:56px;
  }
}

/* v17: panel de cotizaciones visible solo para administradores */
.admin-quotes-card{margin:18px 0;}
.admin-quote-toolbar{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:center;margin-bottom:12px;}
.admin-quote-search{margin:0;}
.admin-quotes-list{max-height:52vh;}
.admin-quote-item b{max-width:100%;}
@media(max-width:760px){
  .admin-quote-toolbar{grid-template-columns:1fr;}
  .admin-quote-toolbar .btn{width:100%;}
  .admin-quotes-list{max-height:none;}
}
html.mobile-device .admin-quote-toolbar{grid-template-columns:1fr!important;}
html.mobile-device .admin-quote-toolbar .btn{width:100%;}
html.mobile-device .admin-quotes-list{max-height:none!important;}

/* v19: menú principal tipo tabla, sin barra lateral */
.app-shell{display:block;overflow:hidden}
.sidebar,.sidebar-backdrop,#mobileMenuBtn{display:none!important}
.main-content{width:100%;height:100dvh;max-width:1280px;margin:0 auto;padding:22px;overflow-y:auto;overflow-x:hidden}
.topbar{align-items:center}
.top-actions{display:grid;grid-template-columns:auto auto auto auto;align-items:center}
.logout-top{background:#fff;color:var(--danger);border-color:color-mix(in srgb,var(--danger) 22%,var(--line))}
.home-menu{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(280px,1fr));
  gap:16px;
  margin:0 0 22px;
  width:100%;
}
.start-section{
  min-height:calc(100dvh - 150px);
  align-content:start;
}
.home-notice-area{
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
  margin:0 0 18px;
  align-items:stretch;
}
.home-notice{
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  grid-template-rows:auto auto;
  gap:5px 12px;
  align-items:center;
  justify-content:stretch;
  padding:16px 18px;
  min-height:92px;
  border:1px solid var(--line);
  border-radius:20px;
  background:var(--panel);
  color:var(--text);
  box-shadow:var(--shadow);
  width:100%;
}
.home-notice svg{
  grid-row:1/3;
  width:36px;
  height:36px;
  padding:7px;
  border-radius:14px;
  background:var(--soft);
  color:var(--primary);
}
.home-notice b{
  display:block;
  font-size:17px;
  line-height:1.2;
  margin-bottom:4px;
  color:var(--text);
  overflow-wrap:anywhere;
}
.home-notice p{
  margin:0;
  color:var(--muted);
  font-weight:750;
  font-size:13px;
  line-height:1.35;
  overflow-wrap:anywhere;
}
.admin-module-menu{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(160px,1fr));
  gap:10px;
  margin:0 0 16px;
}
.admin-module-btn{
  border:1px solid var(--line);
  background:var(--panel);
  color:var(--primary);
  border-radius:18px;
  padding:14px 16px;
  min-height:64px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  font-weight:950;
  cursor:pointer;
  box-shadow:0 10px 24px rgba(17,73,47,.06);
  min-width:0;
  text-align:center;
}
.admin-module-btn svg{width:21px;height:21px;min-width:21px}
.admin-module-btn span{
  min-width:0;
  max-width:100%;
  white-space:normal;
  overflow-wrap:anywhere;
  line-height:1.15;
}
.admin-module-btn.active{
  background:var(--primary);
  border-color:var(--primary);
  color:#fff;
}
.admin-module-panel{display:none}
.admin-module-panel.active{display:block}
.admin-select{
  width:100%;
  min-height:48px;
  border-radius:15px;
  border:1px solid var(--line);
  background:var(--panel);
  color:var(--text);
  padding:0 12px;
  font-weight:850;
}
.admin-notices-card{margin-bottom:18px}
.notice-admin-list,.admin-user-list{max-height:42vh}
.section-toolbar{
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-start;
  align-items:center;
  gap:10px;
  margin:0 0 14px;
}
.section-toolbar .btn{
  min-height:44px;
  flex:0 0 auto;
}
.section-toolbar .nav-item{
  width:auto;
}
.section-toolbar .nav-item[data-section="inicio"]{
  background:var(--primary);
  border-color:var(--primary);
  color:#fff;
}
.section-toolbar .nav-item[data-section="inicio"] svg{
  color:#fff;
}
.section-toolbar .toolbar-home-btn{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:8px!important;
}
.section-toolbar .toolbar-home-btn svg{
  width:19px!important;
  height:19px!important;
  min-width:19px!important;
  display:block!important;
  color:#061511!important;
  stroke:#061511!important;
}
.app-back-btn.disabled{
  opacity:.55;
}
.home-menu-btn{
  border:1px solid var(--line);
  background:var(--panel);
  color:var(--text);
  box-shadow:var(--shadow);
  border-radius:20px;
  padding:22px;
  min-height:138px;
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  grid-template-rows:auto auto;
  align-items:center;
  justify-content:stretch;
  gap:5px 12px;
  text-align:left;
  cursor:pointer;
}
.home-menu-btn,
.home-menu-btn span,
.home-menu-btn b,
.home-menu-btn h3,
.home-menu-btn p,
.home-notice,
.home-notice span,
.home-notice b,
.home-notice h3,
.home-notice p{
  color:var(--text);
}
.home-menu-btn small{color:var(--muted)}
.home-notice p{color:var(--muted)}
.home-menu-btn.active,.home-menu-btn.active span{
  color:var(--text);
}
.home-menu-btn svg{
  grid-row:1/3;
  width:44px;
  height:44px;
  color:var(--primary);
  padding:9px;
  border-radius:16px;
  background:var(--soft);
}
.home-menu-btn span{
  display:block!important;
  font-size:clamp(16px,1.55vw,19px);
  font-weight:950;
  line-height:1.15;
  overflow:visible;
  text-overflow:clip;
  white-space:normal;
  overflow-wrap:normal;
  word-break:normal;
  hyphens:none;
}
.home-menu-btn small{
  display:block;
  color:var(--muted);
  font-weight:750;
  font-size:13.5px;
  line-height:1.3;
}
.home-menu-btn.active{
  border-color:var(--primary);
  background:linear-gradient(135deg,var(--soft),#fff);
  outline:3px solid color-mix(in srgb,var(--primary) 18%,transparent);
}
.home-menu-btn.active svg{
  background:var(--primary);
  color:#fff;
}
.help-page-card{max-width:1120px;margin:0 auto}
.help-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(280px,1fr));
  gap:12px;
}
.help-card{
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  gap:12px;
  align-items:flex-start;
  border:1px solid var(--line);
  background:var(--panel);
  border-radius:18px;
  padding:16px;
  box-shadow:0 10px 24px rgba(17,73,47,.06);
}
.help-card svg{
  width:42px;
  height:42px;
  padding:9px;
  border-radius:15px;
  background:var(--soft);
  color:var(--primary);
}
.help-card h4{
  margin:0 0 6px;
  font-size:16px;
  line-height:1.2;
  color:var(--text);
}
.help-card p{
  margin:0;
  color:var(--muted);
  font-weight:750;
  line-height:1.42;
  overflow-wrap:anywhere;
}
.app-footer{
  margin:22px 0 4px;
  padding:14px 12px;
  text-align:center;
  color:var(--muted);
  font-size:12px;
  font-weight:950;
  letter-spacing:.08em;
}
.express-layout{
  display:grid;
  grid-template-columns:minmax(0,1.05fr) minmax(320px,.95fr);
  gap:16px;
}
.express-card{
  min-height:360px;
}
.express-exam-list,.express-selected-list{
  max-height:52vh;
}
.express-actions{
  margin-top:16px;
}
.express-actions .btn{
  min-height:48px;
}
@media(max-width:1020px){
  .main-content{padding:14px;max-width:100%}
  .home-menu{grid-template-columns:repeat(2,minmax(0,1fr))}
  .express-layout{grid-template-columns:1fr}
  .topbar{grid-template-columns:1fr}
  .top-actions{justify-self:stretch;width:100%}
  .top-actions{grid-template-columns:1fr 1fr}
  .clock-box,.logout-top{width:100%}
}
@media(max-width:560px){
  .main-content{padding:10px;padding-bottom:calc(28px + env(safe-area-inset-bottom))}
  .topbar{padding:12px;border-radius:20px}
  .top-actions{grid-template-columns:1fr;width:100%}
  .start-section{min-height:auto}
  .section-toolbar{position:sticky;top:0;z-index:5;background:var(--bg);padding:0 0 8px}
  .section-toolbar .btn{flex:0 0 auto}
  .home-menu{grid-template-columns:1fr;gap:9px}
  .express-layout{grid-template-columns:1fr;gap:10px}
  .express-card{min-height:0}
  .express-actions{grid-template-columns:1fr}
  .home-menu-btn{min-height:124px;padding:20px;border-radius:18px}
  .home-menu-btn svg{width:40px;height:40px;padding:8px}
  .home-menu-btn span{font-size:18px}
  .home-menu-btn span{white-space:normal;overflow-wrap:anywhere}
  .home-menu-btn small{font-size:12.5px}
}
html.mobile-device .app-shell{display:block!important;overflow:hidden}
html.mobile-device .sidebar,
html.mobile-device .sidebar-backdrop,
html.mobile-device #mobileMenuBtn{display:none!important}
html.mobile-device .main-content{
  width:100vw!important;
  max-width:100vw!important;
  height:100dvh!important;
  overflow-y:auto!important;
  padding:10px;
  padding-bottom:calc(28px + env(safe-area-inset-bottom));
}
html.mobile-device .home-menu{display:grid;grid-template-columns:1fr!important;gap:10px;margin-bottom:12px}
html.mobile-device .home-menu-btn{min-height:124px;padding:20px;border-radius:18px}
html.mobile-device .home-notice-area{grid-template-columns:1fr!important;gap:10px}
html.mobile-device .home-notice{min-height:92px;padding:16px 18px;border-radius:18px}
html.mobile-device .topbar{grid-template-columns:1fr!important}
html.mobile-device .top-actions{justify-self:stretch;width:100%}
html.mobile-device .express-layout{grid-template-columns:1fr!important;gap:10px}
html.mobile-device .express-actions{grid-template-columns:1fr!important}
html.mobile-device .express-exam-list,html.mobile-device .express-selected-list{max-height:none!important}

/* Ajustes v18: barra del navegador según tema y filtro de cotizaciones por clínica */
.admin-quote-toolbar{display:grid;grid-template-columns:minmax(210px,.8fr) minmax(260px,1.4fr) auto;gap:10px;align-items:end;margin:12px 0 14px}
.admin-clinic-filter{display:flex;flex-direction:column;gap:6px;font-weight:900;color:var(--muted);font-size:13px;text-transform:uppercase;letter-spacing:.03em}
.admin-clinic-filter select{width:100%;min-height:48px;border-radius:16px;border:1px solid var(--line);background:var(--soft);color:var(--text);font-weight:850;padding:0 12px;outline:none}
.admin-quote-item b{overflow-wrap:anywhere}
@media(max-width:920px){
  .admin-quote-toolbar{grid-template-columns:1fr}
  .admin-quote-toolbar .btn{width:100%}
}

/* v39: desplazamiento natural en PC y movil sin cambiar el diseno */
html,body{
  height:auto;
  min-height:100%;
  overflow-x:clip;
  overflow-y:auto;
}
.app-shell{
  min-height:100dvh;
  height:auto;
  overflow:visible;
}
.main-content{
  min-height:100dvh;
  height:auto;
  overflow:visible!important;
  scrollbar-gutter:auto;
}
@media(max-width:1020px){
  .main-content{
    width:100%;
    max-width:100%;
  }
}
@media(max-width:560px){
  html,body{
    min-height:100dvh;
    overflow-y:auto;
  }
  .app-shell{
    min-height:100dvh;
    height:auto;
  }
  .main-content{
    width:100%;
    max-width:100%;
    min-height:100dvh;
    height:auto;
    overflow-y:visible;
    padding-bottom:calc(28px + env(safe-area-inset-bottom));
  }
}
html.mobile-device,
html.mobile-device body{
  height:auto!important;
  min-height:100dvh!important;
  overflow-x:clip!important;
  overflow-y:auto!important;
}
html.mobile-device .app-shell{
  height:auto!important;
  min-height:100dvh!important;
  overflow:visible!important;
}
html.mobile-device .main-content{
  width:100%!important;
  max-width:100%!important;
  height:auto!important;
  min-height:100dvh!important;
  overflow:visible!important;
}

/* v49: perfiles rapidos como tarjetas de accion */
.quick-profiles-panel{
  background:var(--panel);
  border-style:solid;
  box-shadow:0 10px 26px rgba(17,73,47,.06);
}
.profile-quick-list{
  display:grid!important;
  grid-template-columns:repeat(auto-fit,minmax(230px,1fr));
  gap:10px;
  max-height:220px;
  padding:4px 4px 8px!important;
}
.profile-chip{
  width:100%;
  min-height:70px;
  margin:0;
  padding:12px;
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;
  gap:10px;
  text-align:left;
  border-radius:18px;
  border:1px solid var(--line);
  background:linear-gradient(180deg,#fff,var(--soft));
  color:var(--text);
  box-shadow:0 8px 20px rgba(17,73,47,.05);
}
.profile-chip:hover,
.profile-chip:focus-visible{
  border-color:var(--primary);
  box-shadow:0 10px 24px rgba(17,73,47,.10);
}
.profile-chip-icon{
  width:42px;
  height:42px;
  border-radius:15px;
  display:grid;
  place-items:center;
  background:#fff;
  color:var(--primary);
  border:1px solid var(--line);
}
.profile-chip-icon svg{
  width:21px;
  height:21px;
  min-width:21px;
}
.profile-chip-body{
  min-width:0;
  display:grid;
  gap:4px;
}
.profile-chip-name{
  display:block;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:14px;
  line-height:1.15;
  font-weight:950;
}
.profile-chip-body small{
  color:var(--muted);
  font-weight:850;
  font-size:12.5px;
  line-height:1.2;
  white-space:normal;
}
.profile-chip-action{
  align-self:center;
  border-radius:999px;
  padding:7px 10px;
  background:var(--primary);
  color:#fff;
  font-size:12px;
  font-weight:950;
  line-height:1;
  white-space:nowrap;
}
@media(max-width:560px){
  .profile-quick-list{
    grid-template-columns:1fr!important;
    max-height:210px;
  }
  .profile-chip{
    min-height:68px;
    grid-template-columns:auto minmax(0,1fr);
  }
  .profile-chip-action{
    grid-column:2;
    justify-self:start;
    margin-top:2px;
  }
  .profile-chip-name{
    white-space:normal;
    overflow-wrap:anywhere;
  }
}

/* v50: perfiles rapidos en ventana flotante */
.quick-profiles-panel{
  padding:14px 16px;
  margin:10px 0 18px;
}
.quick-profiles-head{
  align-items:center;
  margin-bottom:0;
}
.quick-profiles-head .btn{
  min-height:46px;
  flex:0 0 auto;
}
.profile-picker-card{
  width:min(720px,calc(100vw - 28px));
  max-height:min(82dvh,720px);
}
.profile-picker-card .modal-head{
  align-items:flex-start;
  padding:18px 18px 12px;
}
.profile-picker-card .modal-head p{
  margin:4px 0 0;
  color:var(--muted);
  font-weight:750;
}
.profile-picker-list{
  max-height:58dvh;
  overflow-y:auto;
  overflow-x:hidden;
  padding:8px 18px 18px!important;
}
@media(max-width:560px){
  .quick-profiles-head{
    display:grid;
    grid-template-columns:1fr;
  }
  .quick-profiles-head .btn{
    width:100%;
  }
  .profile-picker-card{
    width:calc(100vw - 14px);
    max-height:calc(100dvh - 14px);
  }
  .profile-picker-list{
    max-height:calc(100dvh - 140px);
  }
}

/* v55: logo principal mas visible y cierre de sesion abajo */
.brand-mark{
  background:#fff!important;
  color:transparent!important;
}
.brand-mark img,
.top-logo img{
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
}
.topbar{
  grid-template-columns:auto minmax(0,1fr) auto!important;
}
.top-logo{
  display:grid;
}
.bottom-session-actions{
  display:flex;
  justify-content:center;
  margin:18px 0 4px;
}
.bottom-session-actions .logout-top{
  min-width:min(280px,100%);
  min-height:50px;
  background:#fff;
  color:var(--danger);
  border-color:color-mix(in srgb,var(--danger) 22%,var(--line));
}
@media(max-width:1020px){
  .topbar{
    grid-template-columns:auto minmax(0,1fr)!important;
  }
  .top-actions{
    grid-column:1/-1;
  }
}
@media(max-width:560px){
  .brand-mark{
    width:78px;
    height:78px;
  }
  .top-logo{
    width:64px;
    height:64px;
    border-radius:16px;
  }
  .bottom-session-actions .logout-top{
    width:100%;
  }
}

/* v56: cierre de sesion como seccion y logo sin margen interno */
.top-logo img{
  padding:0!important;
  object-fit:cover!important;
}
.logout-menu-btn{
  border-color:color-mix(in srgb,var(--danger) 24%,var(--line));
}
.logout-menu-btn svg{
  color:var(--danger);
  background:#fff5f5;
}
.logout-menu-btn span{
  color:var(--danger)!important;
}
.logout-menu-btn small{
  color:#8f332d!important;
}
.logout-menu-btn:hover{
  border-color:var(--danger);
}

/* v57: scroll natural en moviles */
@media(max-width:760px), (hover:none) and (pointer:coarse){
  html,
  body{
    height:auto!important;
    min-height:100%!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior-y:auto;
    -webkit-overflow-scrolling:touch;
  }
  .app-shell{
    display:block!important;
    height:auto!important;
    min-height:100dvh!important;
    overflow:visible!important;
  }
  .main-content{
    width:100%!important;
    max-width:100%!important;
    height:auto!important;
    min-height:100dvh!important;
    overflow-x:hidden!important;
    overflow-y:visible!important;
    padding-bottom:calc(34px + env(safe-area-inset-bottom))!important;
  }
  .section,
  .start-section,
  .home-menu{
    overflow:visible!important;
  }
}

/* v58: menu principal movil en dos columnas */
@media(max-width:760px), (hover:none) and (pointer:coarse){
  .home-menu{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
    align-items:stretch;
  }
  .home-menu-btn{
    min-height:118px!important;
    padding:12px 10px!important;
    border-radius:16px!important;
    grid-template-columns:1fr!important;
    grid-template-rows:auto auto auto!important;
    justify-items:center!important;
    align-content:center!important;
    text-align:center!important;
    gap:6px!important;
  }
  .home-menu-btn svg{
    grid-row:auto!important;
    width:38px!important;
    height:38px!important;
    padding:8px!important;
    margin:0 auto!important;
  }
  .home-menu-btn span{
    font-size:15px!important;
    line-height:1.12!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
    word-break:normal!important;
    hyphens:none!important;
  }
  .home-menu-btn small{
    font-size:11.5px!important;
    line-height:1.18!important;
    max-width:100%;
    overflow-wrap:anywhere!important;
  }
  .topbar{
    grid-template-columns:auto minmax(0,1fr)!important;
    align-items:center!important;
  }
  .top-logo{
    width:58px!important;
    height:58px!important;
    border-radius:16px!important;
  }
  .top-actions{
    grid-column:1/-1!important;
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:8px!important;
    width:100%!important;
  }
  .clock-box{
    grid-column:1/-1!important;
  }
}

@media(max-width:360px){
  .home-menu-btn{
    min-height:112px!important;
    padding:10px 8px!important;
  }
  .home-menu-btn span{
    font-size:14px!important;
  }
  .home-menu-btn small{
    font-size:10.8px!important;
  }
}

/* v60: celulares reales con clase mobile-device */
@media(max-width:760px), (hover:none) and (pointer:coarse){
  html.mobile-device .topbar,
  .topbar{
    display:grid!important;
    grid-template-columns:auto minmax(0,1fr)!important;
    align-items:center!important;
    gap:10px!important;
    padding:12px!important;
    margin-bottom:12px!important;
    border-radius:20px!important;
  }
  html.mobile-device .top-logo,
  .top-logo{
    width:58px!important;
    height:58px!important;
    border-radius:16px!important;
  }
  html.mobile-device .top-title,
  .top-title{
    min-width:0!important;
    flex:initial!important;
  }
  html.mobile-device .topbar h2,
  .topbar h2{
    font-size:18px!important;
    line-height:1.12!important;
  }
  html.mobile-device .topbar p,
  .topbar p{
    font-size:13px!important;
    line-height:1.25!important;
  }
  html.mobile-device .top-actions,
  .top-actions{
    grid-column:1/-1!important;
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:8px!important;
    width:100%!important;
    margin-left:0!important;
    justify-self:stretch!important;
  }
  html.mobile-device .top-actions .btn,
  .top-actions .btn,
  html.mobile-device .clock-box,
  .clock-box{
    width:100%!important;
    min-height:46px!important;
    padding:10px 8px!important;
  }
  html.mobile-device .clock-box,
  .clock-box{
    grid-column:1/-1!important;
  }
  html.mobile-device .home-menu,
  .home-menu{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
    margin-bottom:12px!important;
  }
  html.mobile-device .home-menu-btn,
  .home-menu-btn{
    min-height:114px!important;
    padding:11px 8px!important;
    border-radius:16px!important;
    display:grid!important;
    grid-template-columns:1fr!important;
    grid-template-rows:auto auto auto!important;
    justify-items:center!important;
    align-content:center!important;
    text-align:center!important;
    gap:6px!important;
  }
  html.mobile-device .home-menu-btn svg,
  .home-menu-btn svg{
    grid-row:auto!important;
    width:36px!important;
    height:36px!important;
    padding:7px!important;
    margin:0 auto!important;
  }
  html.mobile-device .home-menu-btn span,
  .home-menu-btn span{
    font-size:14.5px!important;
    line-height:1.1!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
    word-break:normal!important;
  }
  html.mobile-device .home-menu-btn small,
  .home-menu-btn small{
    font-size:10.8px!important;
    line-height:1.16!important;
    overflow-wrap:anywhere!important;
  }
}

/* v61: ajuste fluido por ancho para cualquier dispositivo */
html,
body{
  width:100%!important;
  max-width:100%!important;
  overflow-x:hidden!important;
}
body{
  min-width:0!important;
}
.app-shell{
  width:100%!important;
  max-width:100vw!important;
}
.main-content{
  width:100%!important;
  max-width:1280px!important;
  margin-inline:auto!important;
  padding:clamp(10px,2vw,22px)!important;
  overflow-x:hidden!important;
}
.topbar{
  width:100%!important;
  max-width:100%!important;
  display:grid!important;
  grid-template-columns:auto minmax(0,1fr) auto!important;
  gap:clamp(10px,1.8vw,16px)!important;
}
.top-title,
.top-actions,
.card,
.section,
.home-menu,
.work-grid,
.express-layout,
.profile-grid,
.admin-module-menu,
.admin-form,
.admin-quote-toolbar{
  min-width:0!important;
  max-width:100%!important;
}
.top-actions{
  display:flex!important;
  flex-wrap:wrap!important;
  justify-content:flex-end!important;
}
.home-menu{
  display:grid!important;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr))!important;
  gap:clamp(10px,1.5vw,16px)!important;
}
.home-menu-btn{
  width:100%!important;
  min-width:0!important;
}
.work-grid,
.express-layout{
  display:grid!important;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,360px),1fr))!important;
}
.profile-grid{
  display:grid!important;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr))!important;
}
.stats-grid,
.actions-grid,
.admin-module-menu{
  grid-template-columns:repeat(auto-fit,minmax(min(100%,150px),1fr))!important;
}
.admin-form{
  grid-template-columns:repeat(auto-fit,minmax(min(100%,170px),1fr))!important;
}
.admin-quote-toolbar{
  grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr))!important;
}
.btn,
.clock-box,
input,
select{
  min-width:0!important;
  max-width:100%!important;
}

@media(max-width:760px), (hover:none) and (pointer:coarse){
  .main-content{
    max-width:100%!important;
    padding:10px!important;
    padding-bottom:calc(34px + env(safe-area-inset-bottom))!important;
  }
  .topbar{
    grid-template-columns:auto minmax(0,1fr)!important;
    padding:12px!important;
  }
  .top-actions{
    grid-column:1/-1!important;
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    justify-content:stretch!important;
    width:100%!important;
  }
  .top-actions .btn,
  .clock-box{
    width:100%!important;
  }
  .clock-box{
    grid-column:1/-1!important;
  }
  .home-menu{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
  }
  .home-menu-btn{
    min-height:112px!important;
    padding:10px 8px!important;
  }
  .work-grid,
  .express-layout,
  .profile-grid,
  .admin-quote-toolbar{
    grid-template-columns:1fr!important;
  }
}

@media(max-width:340px){
  .top-logo{
    width:50px!important;
    height:50px!important;
  }
  .topbar h2{
    font-size:16px!important;
  }
  .topbar p{
    font-size:12px!important;
  }
  .home-menu-btn{
    min-height:106px!important;
    padding:8px 6px!important;
  }
  .home-menu-btn svg{
    width:32px!important;
    height:32px!important;
    padding:6px!important;
  }
  .home-menu-btn span{
    font-size:13px!important;
  }
  .home-menu-btn small{
    font-size:10px!important;
  }
}

/* v62: boton de emergencia sin recortes */
.emergency-btn{
  min-width:max-content!important;
  overflow:visible!important;
  white-space:normal!important;
  line-height:1.15!important;
}
.emergency-btn span,
#emergencyBtnText{
  min-width:0!important;
  overflow:visible!important;
  text-overflow:clip!important;
  white-space:normal!important;
  overflow-wrap:normal!important;
  word-break:normal!important;
}
.top-actions{
  align-items:stretch!important;
}
.top-actions .btn,
.clock-box{
  min-height:48px!important;
}

@media(min-width:761px){
  .top-actions{
    grid-template-columns:none!important;
  }
  .emergency-btn{
    flex:0 0 auto!important;
  }
}

@media(max-width:760px), (hover:none) and (pointer:coarse){
  .top-actions{
    grid-template-columns:1fr!important;
  }
  #refreshBtn,
  #emergencyBtn,
  #clockBox{
    grid-column:1/-1!important;
    width:100%!important;
  }
  .emergency-btn{
    min-width:0!important;
    padding-left:12px!important;
    padding-right:12px!important;
  }
}

@media(min-width:520px) and (max-width:760px){
  .top-actions{
    grid-template-columns:1fr 1fr!important;
  }
  #refreshBtn{
    grid-column:auto!important;
  }
  #emergencyBtn{
    grid-column:auto!important;
  }
  #clockBox{
    grid-column:1/-1!important;
  }
}

/* v63: emergencia abajo solo cuando el ancho no alcanza */
@media(max-width:519px){
  .top-actions{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px!important;
    width:100%!important;
  }
  #refreshBtn,
  #emergencyBtn,
  #clockBox{
    grid-column:1/-1!important;
    width:100%!important;
  }
}

@media(min-width:520px) and (max-width:900px){
  .top-actions{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:8px!important;
    width:100%!important;
    justify-content:stretch!important;
  }
  #refreshBtn,
  #emergencyBtn{
    grid-column:auto!important;
    width:100%!important;
  }
  #clockBox{
    grid-column:1/-1!important;
    width:100%!important;
  }
}

@media(min-width:901px){
  .top-actions{
    display:flex!important;
    flex-wrap:wrap!important;
    justify-content:flex-end!important;
    width:auto!important;
  }
  #refreshBtn,
  #emergencyBtn,
  #clockBox{
    width:auto!important;
  }
}

/* v64: pulido visual profesional sin cambios de logica */
:root{
  --primary:#0f766e;
  --primary2:#115e59;
  --bg:#f6faf8;
  --panel:#ffffff;
  --text:#12231d;
  --muted:#60736a;
  --line:#d9e8e1;
  --soft:#f1f7f4;
  --danger:#b42318;
  --success:#1769aa;
  --shadow:0 18px 42px rgba(19,70,55,.08);
  --shadow-soft:0 8px 20px rgba(19,70,55,.06);
  --radius:20px;
}
.theme-blue{
  --primary:#1769aa;
  --primary2:#0d4776;
  --bg:#f6faf8;
  --soft:#f1f7f4;
  --line:#d9e8e1;
  --success:#1769aa;
  --shadow:0 18px 42px rgba(23,105,170,.08);
  --shadow-soft:0 8px 20px rgba(23,105,170,.06);
}
.theme-teal{
  --primary:#0f766e;
  --primary2:#115e59;
  --bg:#f6faf8;
  --soft:#f1f7f4;
  --line:#d9e8e1;
  --success:#1769aa;
  --shadow:0 18px 42px rgba(15,118,110,.08);
  --shadow-soft:0 8px 20px rgba(15,118,110,.06);
}
.theme-cyan{
  --primary:#087f9c;
  --primary2:#0e7490;
  --bg:#f6faf8;
  --soft:#f1f7f4;
  --line:#d9e8e1;
  --success:#1769aa;
  --shadow:0 18px 42px rgba(8,127,156,.08);
  --shadow-soft:0 8px 20px rgba(8,127,156,.06);
}

html,
body{
  background:var(--bg)!important;
  color:var(--text)!important;
}
body,
button,
input,
select{
  font-family:"Segoe UI", Inter, Arial, Helvetica, sans-serif!important;
  letter-spacing:0!important;
}
body{
  -webkit-font-smoothing:antialiased;
  text-rendering:geometricPrecision;
}

.login-view{
  background:var(--bg)!important;
}
.app-shell{
  background:var(--bg)!important;
}
.main-content{
  background:var(--bg)!important;
}

.login-card,
.topbar,
.card,
.stat-card,
.home-menu-btn,
.home-notice,
.modal-card,
.confirm-card,
.quote-actions-top,
.quick-profiles-panel,
.admin-import-panel,
.profile-picker-card{
  background:rgba(255,255,255,.98)!important;
  border:1px solid var(--line)!important;
  box-shadow:var(--shadow)!important;
}

.login-card,
.topbar,
.card,
.stat-card,
.home-menu-btn,
.home-notice,
.modal-card,
.confirm-card{
  border-radius:20px!important;
}

.card,
.stat-card{
  padding:20px!important;
}
.card-head{
  gap:14px!important;
  margin-bottom:16px!important;
}
.card h3,
.modal-head h3,
.confirm-card h3,
.login-card h1{
  color:var(--text)!important;
  font-weight:850!important;
}
.card p,
.login-card p,
.topbar p,
.modal-head p,
.profile-picker-card .modal-head p,
.help-card p{
  color:var(--muted)!important;
}

.brand-mark,
.top-logo{
  background:#fff!important;
  border:1px solid var(--line)!important;
  box-shadow:var(--shadow-soft)!important;
}
.brand-mark img,
.top-logo img{
  padding:0!important;
  object-fit:contain!important;
}
.top-logo{
  width:88px!important;
  height:88px!important;
  border-radius:18px!important;
}
.brand-mark{
  border-radius:18px!important;
}
.brand-mark.small{
  border-radius:14px!important;
}

.topbar{
  padding:18px 20px!important;
  align-items:center!important;
}
.topbar h2{
  color:var(--text)!important;
  font-weight:900!important;
  letter-spacing:0!important;
}
.top-actions{
  gap:10px!important;
}

.btn,
.icon-btn,
.admin-module-btn,
.theme-choice,
.profile-chip{
  border-radius:14px!important;
  border:1px solid var(--line)!important;
  background:var(--soft)!important;
  color:var(--text)!important;
  font-weight:850!important;
  min-height:46px!important;
  transition:background .16s ease,border-color .16s ease,box-shadow .16s ease,transform .16s ease,color .16s ease!important;
}
.btn:hover,
.icon-btn:hover,
.admin-module-btn:hover,
.theme-choice:hover,
.profile-chip:hover{
  border-color:color-mix(in srgb,var(--primary) 45%,var(--line))!important;
  box-shadow:0 10px 24px rgba(19,70,55,.09)!important;
  transform:translateY(-1px);
}
.btn:focus-visible,
.icon-btn:focus-visible,
input:focus,
select:focus,
.admin-module-btn:focus-visible,
.home-menu-btn:focus-visible,
.theme-choice:focus-visible{
  outline:0!important;
  border-color:var(--primary)!important;
  box-shadow:0 0 0 4px color-mix(in srgb,var(--primary) 16%,transparent)!important;
}
.btn.primary,
.admin-module-btn.active,
.theme-choice.active{
  background:var(--primary)!important;
  border-color:var(--primary)!important;
  color:#fff!important;
}
.btn.success{
  background:var(--success)!important;
  border-color:var(--success)!important;
  color:#fff!important;
}
.btn.danger{
  color:var(--danger)!important;
  background:#fff!important;
  border-color:#f1c7c2!important;
}
.btn.danger:hover{
  background:#fff5f5!important;
  border-color:#f0a8a1!important;
}
.btn.soft,
.btn.ghost{
  background:#fff!important;
  color:var(--text)!important;
}
.btn svg,
.icon-btn svg,
.admin-module-btn svg,
.home-menu-btn svg{
  stroke-width:2.2!important;
}

input,
select,
.admin-select,
.admin-clinic-filter select{
  background:#fff!important;
  border:1px solid var(--line)!important;
  border-radius:14px!important;
  color:var(--text)!important;
  min-height:46px!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.65)!important;
}
input::placeholder{
  color:#8da098!important;
}
label,
.compact-label,
.admin-clinic-filter{
  color:var(--text)!important;
  font-weight:800!important;
}

.search-box{
  background:#fff!important;
  border:1px solid var(--line)!important;
  border-radius:16px!important;
  min-height:48px!important;
  box-shadow:var(--shadow-soft)!important;
}
.search-box input{
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
}
.search-box svg{
  color:var(--primary)!important;
}

.section-toolbar{
  display:flex!important;
  flex-wrap:wrap!important;
  gap:10px!important;
  margin-bottom:16px!important;
}
.section-toolbar .btn{
  min-width:110px!important;
}

.home-notice-area{
  margin-bottom:14px!important;
}
.home-notice{
  display:grid!important;
  grid-template-columns:auto minmax(0,1fr)!important;
  align-items:center!important;
  gap:14px!important;
  min-height:74px!important;
  padding:16px 18px!important;
}
.home-notice svg{
  background:var(--soft)!important;
  border-radius:14px!important;
  color:var(--primary)!important;
}
.home-notice b{
  color:var(--text)!important;
}

.home-menu{
  gap:14px!important;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,170px),1fr))!important;
}
.home-menu-btn{
  min-height:136px!important;
  padding:18px 16px!important;
  align-items:center!important;
  justify-content:center!important;
  text-align:center!important;
  overflow:visible!important;
}
.home-menu-btn svg{
  width:48px!important;
  height:48px!important;
  min-width:48px!important;
  padding:10px!important;
  color:var(--primary)!important;
  background:var(--soft)!important;
  border-radius:16px!important;
}
.home-menu-btn span{
  color:var(--text)!important;
  font-size:18px!important;
  line-height:1.12!important;
  font-weight:900!important;
  white-space:normal!important;
  overflow:visible!important;
  text-overflow:clip!important;
}
.home-menu-btn small{
  color:var(--muted)!important;
  font-size:13px!important;
  line-height:1.25!important;
  font-weight:750!important;
  white-space:normal!important;
  overflow:visible!important;
  text-overflow:clip!important;
}
.home-menu-btn:hover,
.home-menu-btn.active{
  border-color:color-mix(in srgb,var(--primary) 38%,var(--line))!important;
  background:#fff!important;
}
.home-menu-btn.active svg{
  background:var(--primary)!important;
  color:#fff!important;
}
.logout-menu-btn span,
.logout-menu-btn small,
.logout-menu-btn svg{
  color:var(--danger)!important;
}
.logout-menu-btn svg{
  background:#fff5f5!important;
}

.stat-card{
  box-shadow:var(--shadow-soft)!important;
}
.stat-card span{
  color:var(--muted)!important;
  font-weight:850!important;
  letter-spacing:0!important;
}
.stat-card strong,
.price,
.grand,
.total-box strong{
  color:var(--primary)!important;
}

.exam-item,
.selected-item,
.history-item,
.admin-item,
.empty-state,
.profile-builder-col,
.help-card{
  background:#fff!important;
  border:1px solid var(--line)!important;
  border-radius:16px!important;
  box-shadow:var(--shadow-soft)!important;
}
.exam-item,
.selected-item,
.history-item,
.admin-item{
  padding:14px!important;
}
.exam-item b,
.selected-item b,
.history-item b,
.admin-item b,
.profile-chip-name{
  color:var(--text)!important;
  font-weight:850!important;
}
.exam-item small,
.selected-item small,
.history-item small,
.admin-item small,
.profile-chip-body small{
  color:var(--muted)!important;
}
.empty-state{
  color:var(--muted)!important;
  background:#fbfdfc!important;
  border-style:dashed!important;
}

.total-box{
  border-top:1px solid var(--line)!important;
}
.total-box div{
  align-items:center!important;
}
.grand{
  font-size:22px!important;
  font-weight:900!important;
}

.quick-profiles-panel,
.admin-import-panel{
  border-radius:18px!important;
  padding:16px!important;
}
.quick-profiles-head h4,
.admin-import-panel h4,
.profile-builder h4,
.help-card h4{
  color:var(--text)!important;
  font-weight:850!important;
}
.quick-profiles-head small,
.admin-import-panel p{
  color:var(--muted)!important;
}

.admin-module-menu{
  gap:12px!important;
  margin-bottom:18px!important;
}
.admin-module-btn{
  min-height:62px!important;
  padding:12px 14px!important;
}
.admin-module-btn span{
  white-space:normal!important;
  overflow:visible!important;
  text-overflow:clip!important;
}
.admin-module-btn.active svg{
  color:#fff!important;
}
.admin-form{
  gap:12px!important;
}
.checkline{
  background:#fff!important;
  border:1px solid var(--line)!important;
  border-radius:14px!important;
  padding:12px!important;
}
.checkline input{
  accent-color:var(--primary);
}

.profile-chip{
  background:#fff!important;
  box-shadow:var(--shadow-soft)!important;
}
.profile-chip-icon{
  background:var(--soft)!important;
  color:var(--primary)!important;
}
.profile-picker-list{
  gap:10px!important;
}

.help-grid{
  gap:14px!important;
}
.help-card{
  padding:16px!important;
}
.help-card>i,
.help-card svg{
  color:var(--primary)!important;
}

.modal{
  background:rgba(18,35,29,.42)!important;
  backdrop-filter:blur(6px);
}
.modal-card{
  overflow:hidden!important;
}
.modal-head{
  background:#fff!important;
  border-bottom:1px solid var(--line)!important;
}
.modal-scroll{
  background:#fbfdfc!important;
}
.sticky-modal-actions{
  background:#fff!important;
  border-bottom:1px solid var(--line)!important;
}
.confirm-icon{
  background:#fff7ed!important;
  color:#ea580c!important;
}
.confirm-actions .btn{
  min-height:46px!important;
}

.quote-paper{
  border:1px solid #dfe7e3!important;
  border-radius:16px!important;
  box-shadow:none!important;
}
.quote-table th{
  background:#f3f8f5!important;
  color:#274339!important;
  font-weight:850!important;
}
.quote-table th,
.quote-table td{
  border-bottom:1px solid #e4ece8!important;
}
.quote-total{
  border-top:1px solid #e4ece8!important;
  padding-top:10px!important;
}

.emergency-btn{
  background:#fff!important;
  border-color:#f3c48b!important;
  color:#9a3412!important;
}
.emergency-btn.active{
  background:linear-gradient(135deg,#f59e0b,#ea580c)!important;
  border-color:#ea580c!important;
  color:#fff!important;
}
.emergency-btn.scheduled:not(.active){
  background:#fff7ed!important;
  border-color:#fdba74!important;
  color:#9a3412!important;
}
.clock-box{
  background:#fff!important;
  border:1px solid var(--line)!important;
  color:var(--primary)!important;
  border-radius:14px!important;
  box-shadow:var(--shadow-soft)!important;
}
.clock-box.emergency{
  background:#fff7ed!important;
  border-color:#fdba74!important;
  color:#c2410c!important;
}
.emergency-status{
  background:#fbfdfc!important;
  border-color:var(--line)!important;
  color:var(--muted)!important;
}
.emergency-status.active{
  background:#fff7ed!important;
  border-color:#fdba74!important;
  color:#9a3412!important;
}

.toast{
  background:var(--text)!important;
  color:#fff!important;
  border-radius:16px!important;
  box-shadow:0 18px 40px rgba(18,35,29,.18)!important;
}
.app-footer{
  color:#61766c!important;
  font-weight:850!important;
  letter-spacing:0!important;
}

@media(max-width:900px){
  .topbar{
    padding:16px!important;
  }
  .top-logo{
    width:74px!important;
    height:74px!important;
  }
  .top-actions{
    gap:8px!important;
  }
  .card,
  .stat-card{
    padding:16px!important;
  }
  .admin-module-menu{
    grid-template-columns:repeat(auto-fit,minmax(min(100%,145px),1fr))!important;
  }
}

@media(max-width:760px), (hover:none) and (pointer:coarse){
  .main-content{
    padding:10px!important;
  }
  .topbar{
    border-radius:18px!important;
    gap:12px!important;
  }
  .top-title{
    align-self:center!important;
  }
  .topbar h2{
    font-size:20px!important;
  }
  .topbar p{
    font-size:14px!important;
  }
  .top-actions .btn,
  .clock-box{
    min-height:52px!important;
  }
  .home-menu{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:10px!important;
  }
  .home-menu-btn{
    min-height:132px!important;
    padding:12px 8px!important;
    border-radius:18px!important;
  }
  .home-menu-btn svg{
    width:44px!important;
    height:44px!important;
    min-width:44px!important;
    padding:9px!important;
  }
  .home-menu-btn span{
    font-size:15px!important;
    line-height:1.12!important;
  }
  .home-menu-btn small{
    font-size:11px!important;
    line-height:1.22!important;
  }
  .section-toolbar .btn{
    flex:1 1 120px!important;
  }
  .actions-grid{
    gap:8px!important;
  }
  .exam-item,
  .selected-item,
  .history-item,
  .admin-item{
    border-radius:15px!important;
  }
  .modal-card,
  .confirm-card{
    border-radius:18px!important;
  }
}

@media(max-width:519px){
  .top-actions{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px!important;
    width:100%!important;
  }
  #refreshBtn,
  #emergencyBtn,
  #clockBox{
    grid-column:1/-1!important;
    width:100%!important;
  }
}

@media(max-width:360px){
  .top-logo{
    width:60px!important;
    height:60px!important;
    border-radius:16px!important;
  }
  .topbar h2{
    font-size:17px!important;
  }
  .topbar p{
    font-size:12px!important;
  }
  .home-menu{
    gap:8px!important;
  }
  .home-menu-btn{
    min-height:124px!important;
    padding:10px 6px!important;
  }
  .home-menu-btn svg{
    width:38px!important;
    height:38px!important;
    min-width:38px!important;
    padding:8px!important;
  }
  .home-menu-btn span{
    font-size:13px!important;
  }
  .home-menu-btn small{
    font-size:10px!important;
  }
}

/* v66: scroll natural con rueda y botones menos apretados */
html,
body{
  height:auto!important;
  min-height:100%!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  overscroll-behavior-y:auto!important;
}
body{
  min-height:100dvh!important;
}
.app-shell{
  height:auto!important;
  min-height:100dvh!important;
  overflow:visible!important;
}
.main-content{
  height:auto!important;
  min-height:100dvh!important;
  overflow-x:hidden!important;
  overflow-y:visible!important;
  -webkit-overflow-scrolling:touch!important;
  scrollbar-gutter:auto!important;
}
.section,
.start-section,
.home-menu,
.work-grid,
.express-layout,
.profile-grid{
  overflow:visible!important;
}

.home-menu{
  grid-template-columns:repeat(auto-fit,minmax(min(100%,205px),1fr))!important;
  gap:16px!important;
}
.home-menu-btn{
  min-height:148px!important;
  padding:20px 18px!important;
  gap:10px!important;
}
.home-menu-btn span{
  font-size:18px!important;
  line-height:1.16!important;
}
.home-menu-btn small{
  font-size:13px!important;
  line-height:1.28!important;
}
.btn,
.icon-btn,
.admin-module-btn,
.theme-choice{
  padding-left:18px!important;
  padding-right:18px!important;
}
.actions-grid,
.quote-actions-top,
.admin-module-menu{
  gap:12px!important;
}

@media(max-width:900px){
  .home-menu{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:12px!important;
  }
}

@media(max-width:760px), (hover:none) and (pointer:coarse){
  html,
  body{
    height:auto!important;
    min-height:100dvh!important;
    overflow-y:auto!important;
  }
  .app-shell{
    display:block!important;
    height:auto!important;
    min-height:100dvh!important;
    overflow:visible!important;
  }
  .main-content{
    height:auto!important;
    min-height:100dvh!important;
    overflow-y:visible!important;
    padding-bottom:calc(34px + env(safe-area-inset-bottom))!important;
  }
  .home-menu{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:10px!important;
  }
  .home-menu-btn{
    min-height:140px!important;
    padding:14px 10px!important;
    gap:8px!important;
  }
  .home-menu-btn span{
    font-size:15px!important;
    line-height:1.15!important;
  }
  .home-menu-btn small{
    font-size:11px!important;
    line-height:1.24!important;
  }
  .btn{
    padding-left:14px!important;
    padding-right:14px!important;
  }
}

@media(max-width:360px){
  .home-menu{
    gap:8px!important;
  }
  .home-menu-btn{
    min-height:132px!important;
    padding:12px 8px!important;
  }
  .home-menu-btn span{
    font-size:13.5px!important;
  }
  .home-menu-btn small{
    font-size:10.5px!important;
  }
}

/* v68: acciones del visualizador */
.sticky-modal-actions{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:10px!important;
  align-items:stretch!important;
}
.sticky-modal-actions .btn{
  width:100%!important;
  min-width:0!important;
  min-height:46px!important;
  padding-left:10px!important;
  padding-right:10px!important;
  white-space:normal!important;
}
@media(max-width:620px){
  .sticky-modal-actions{
    grid-template-columns:1fr!important;
  }
  .sticky-modal-actions .btn{
    justify-content:center!important;
  }
}

/* v69: calculadora interna para exámenes de referencia */
.admin-reference-card .card-head{
  margin-bottom:16px!important;
}
.reference-form{
  grid-template-columns:repeat(auto-fit,minmax(min(100%,190px),1fr))!important;
}
.reference-summary{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,170px),1fr));
  gap:12px;
  margin:16px 0;
}
.reference-summary article{
  min-height:98px;
  display:grid;
  align-content:center;
  gap:7px;
  padding:16px;
  border:1px solid var(--line);
  border-radius:18px;
  background:#fff;
  box-shadow:var(--shadow-soft);
}
.reference-summary span{
  color:var(--muted);
  font-size:12px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.02em;
}
.reference-summary strong{
  color:var(--primary);
  font-size:clamp(20px,2.5vw,28px);
  line-height:1.1;
}
.reference-summary .reference-total{
  background:var(--primary);
  border-color:var(--primary);
}
.reference-summary .reference-total span,
.reference-summary .reference-total strong{
  color:#fff!important;
}
@media(max-width:620px){
  .reference-summary{
    grid-template-columns:1fr!important;
  }
}

/* v71: opciones del listado de precios y enlace QR */
.price-list-options{
  grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr))!important;
}
.checkbox-card{
  min-height:46px;
  display:flex!important;
  align-items:center!important;
  justify-content:flex-start!important;
  gap:10px!important;
  padding:12px 14px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
  cursor:pointer;
}
.checkbox-card input[type="checkbox"]{
  width:18px!important;
  min-width:18px!important;
  height:18px!important;
  min-height:18px!important;
  padding:0!important;
  margin:0!important;
  accent-color:var(--primary);
  box-shadow:none!important;
}
.checkbox-card span{
  font-weight:900;
  line-height:1.2;
}
#priceListLink:disabled{
  background:#f3f7f5!important;
  color:#7b8f86!important;
  cursor:not-allowed;
}
@media(max-width:760px){
  .price-list-options{grid-template-columns:1fr!important;}
}

/* v72: distribución final y desplazamiento natural */
html,
body{
  touch-action:pan-y;
}
.home-menu{
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
}
.home-menu.has-admin{
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
}
.admin-module-menu{
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
}
.express-actions,
.quote-actions-top{
  margin-top:0!important;
  margin-bottom:14px!important;
}
@media(max-width:1180px){
  .home-menu.has-admin,
  .admin-module-menu{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
  }
}
@media(max-width:900px){
  .home-menu,
  .home-menu.has-admin,
  .admin-module-menu{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}
@media(max-width:420px){
  .admin-module-btn{
    min-height:58px!important;
    padding:10px 8px!important;
    font-size:13px!important;
  }
}

/* v73: lista de exámenes seleccionados sin renglones montados */
#selectedList,
#expressSelectedList{
  display:flex!important;
  flex-direction:column!important;
  gap:10px!important;
  padding:4px 8px 4px 0!important;
}
#selectedList .selected-item,
#expressSelectedList .selected-item{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  align-items:center!important;
  gap:12px!important;
  min-height:66px!important;
  padding:12px 14px!important;
  overflow:visible!important;
}
#selectedList .selected-item>div:first-child,
#expressSelectedList .selected-item>div:first-child{
  min-width:0!important;
  overflow:visible!important;
}
#selectedList .selected-item b,
#expressSelectedList .selected-item b{
  white-space:normal!important;
  overflow:hidden!important;
  text-overflow:clip!important;
  line-height:1.18!important;
  overflow-wrap:anywhere!important;
  display:-webkit-box!important;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
}
#selectedList .selected-item small,
#expressSelectedList .selected-item small{
  white-space:normal!important;
  overflow:hidden!important;
  text-overflow:clip!important;
  line-height:1.2!important;
}
#selectedList .selected-item .mini-actions,
#expressSelectedList .selected-item .mini-actions{
  width:auto!important;
  max-width:none!important;
  min-width:128px!important;
  display:grid!important;
  grid-template-columns:auto 44px!important;
  align-items:center!important;
  justify-content:end!important;
  gap:8px!important;
  overflow:visible!important;
}
#selectedList .selected-item .price,
#expressSelectedList .selected-item .price{
  text-align:right!important;
  min-width:74px!important;
}
#selectedList .selected-item .mini,
#expressSelectedList .selected-item .mini{
  width:44px!important;
  min-width:44px!important;
  height:42px!important;
  padding:0!important;
  display:grid!important;
  place-items:center!important;
}
@media(max-width:560px){
  #selectedList .selected-item,
  #expressSelectedList .selected-item{
    grid-template-columns:1fr!important;
    align-items:start!important;
    min-height:auto!important;
  }
  #selectedList .selected-item .mini-actions,
  #expressSelectedList .selected-item .mini-actions{
    width:100%!important;
    min-width:0!important;
    grid-template-columns:minmax(0,1fr) 44px!important;
  }
  #selectedList .selected-item .price,
  #expressSelectedList .selected-item .price{
    min-width:0!important;
    text-align:left!important;
  }
}

/* v75: aviso en Express y selector de perfiles más claro */
#section-express .emergency-status{
  margin-bottom:12px!important;
}
.profile-picker-card{
  width:min(760px,calc(100vw - 28px))!important;
}
.profile-picker-card .modal-head{
  align-items:center!important;
}
.profile-picker-list{
  display:grid!important;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,230px),1fr))!important;
  gap:12px!important;
  max-height:min(62vh,520px)!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  padding:16px!important;
  background:#fbfdfc!important;
}
.profile-picker-list .profile-chip{
  width:100%!important;
  min-height:112px!important;
  display:grid!important;
  grid-template-columns:auto minmax(0,1fr)!important;
  grid-template-areas:"icon body" "action action"!important;
  align-items:center!important;
  gap:12px!important;
  padding:16px!important;
  border-radius:18px!important;
  border:1px solid var(--line)!important;
  background:#fff!important;
  box-shadow:0 12px 28px rgba(17,73,47,.08)!important;
  text-align:left!important;
}
.profile-picker-list .profile-chip:hover,
.profile-picker-list .profile-chip:focus-visible{
  border-color:color-mix(in srgb,var(--primary) 42%,var(--line))!important;
  transform:translateY(-2px)!important;
  box-shadow:0 16px 34px rgba(17,73,47,.12)!important;
}
.profile-picker-list .profile-chip-icon{
  grid-area:icon!important;
  width:48px!important;
  height:48px!important;
  border-radius:16px!important;
  display:grid!important;
  place-items:center!important;
  background:var(--soft)!important;
}
.profile-picker-list .profile-chip-icon svg{
  width:24px!important;
  height:24px!important;
  color:var(--primary)!important;
}
.profile-picker-list .profile-chip-body{
  grid-area:body!important;
  min-width:0!important;
  display:grid!important;
  gap:5px!important;
}
.profile-picker-list .profile-chip-name{
  max-width:100%!important;
  white-space:normal!important;
  overflow-wrap:anywhere!important;
  line-height:1.15!important;
  color:var(--text)!important;
  font-size:16px!important;
  font-weight:950!important;
}
.profile-picker-list .profile-chip-body small{
  color:var(--muted)!important;
  font-weight:850!important;
  white-space:normal!important;
}
.profile-picker-list .profile-chip-action{
  grid-area:action!important;
  width:100%!important;
  max-width:none!important;
  display:flex!important;
  justify-content:center!important;
  align-items:center!important;
  min-height:38px!important;
  border-radius:14px!important;
  background:var(--primary)!important;
  color:#fff!important;
  font-size:13px!important;
  font-weight:950!important;
}
@media(max-width:560px){
  .profile-picker-list{
    grid-template-columns:1fr!important;
    padding:12px!important;
  }
  .profile-picker-list .profile-chip{
    min-height:102px!important;
    padding:14px!important;
  }
}

/* v79: perfiles rápidos como selector compacto */
.quick-profiles-panel{
  padding:14px!important;
  border:1px solid var(--line)!important;
  border-left:5px solid var(--primary)!important;
  border-radius:18px!important;
  background:#fff!important;
  box-shadow:0 12px 26px rgba(17,73,47,.07)!important;
}
.quick-profiles-head{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  align-items:center!important;
  gap:14px!important;
  margin:0!important;
}
.quick-profiles-head h4{
  font-size:18px!important;
  font-weight:950!important;
  letter-spacing:0!important;
}
.quick-profiles-head small{
  color:#627970!important;
  font-size:13px!important;
  line-height:1.25!important;
}
.quick-profiles-head .btn{
  min-height:50px!important;
  min-width:216px!important;
  border-radius:15px!important;
  background:#fff!important;
  color:var(--primary)!important;
  border:1px solid color-mix(in srgb,var(--primary) 42%,var(--line))!important;
  box-shadow:0 10px 22px rgba(17,73,47,.08)!important;
}
.quick-profiles-head .btn svg{
  color:var(--primary)!important;
  stroke:var(--primary)!important;
}
.quick-profiles-head .btn:hover,
.quick-profiles-head .btn:focus-visible{
  background:var(--primary)!important;
  color:#fff!important;
  border-color:var(--primary)!important;
}
.quick-profiles-head .btn:hover svg,
.quick-profiles-head .btn:focus-visible svg{
  color:#fff!important;
  stroke:#fff!important;
}
.profile-picker-card{
  width:min(700px,calc(100vw - 28px))!important;
  border-radius:22px!important;
  overflow:hidden!important;
}
.profile-picker-card .modal-head{
  padding:18px 20px!important;
  border-bottom:1px solid var(--line)!important;
  background:#fff!important;
}
.profile-picker-card .modal-head h3{
  font-size:20px!important;
  line-height:1.1!important;
}
.profile-picker-card .modal-head p{
  margin-top:4px!important;
  font-size:13px!important;
}
.profile-picker-list{
  display:flex!important;
  flex-direction:column!important;
  gap:9px!important;
  max-height:min(60vh,500px)!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  padding:14px!important;
  background:#f7fbf9!important;
}
.profile-picker-list .profile-chip{
  width:100%!important;
  min-height:74px!important;
  display:grid!important;
  grid-template-columns:44px minmax(0,1fr) auto!important;
  grid-template-areas:"icon body action"!important;
  align-items:center!important;
  gap:12px!important;
  padding:12px 14px!important;
  border-radius:15px!important;
  border:1px solid #d9e8e1!important;
  background:#fff!important;
  box-shadow:none!important;
  text-align:left!important;
}
.profile-picker-list .profile-chip:hover,
.profile-picker-list .profile-chip:focus-visible{
  border-color:var(--primary)!important;
  transform:none!important;
  box-shadow:0 10px 24px rgba(17,73,47,.10)!important;
}
.profile-picker-list .profile-chip-icon{
  grid-area:icon!important;
  width:44px!important;
  height:44px!important;
  border-radius:14px!important;
  display:grid!important;
  place-items:center!important;
  background:#ecf6f1!important;
}
.profile-picker-list .profile-chip-icon svg{
  width:22px!important;
  height:22px!important;
  color:var(--primary)!important;
  stroke:var(--primary)!important;
}
.profile-picker-list .profile-chip-body{
  grid-area:body!important;
  min-width:0!important;
  display:grid!important;
  gap:3px!important;
}
.profile-picker-list .profile-chip-name{
  max-width:100%!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  line-height:1.15!important;
  color:var(--text)!important;
  font-size:15px!important;
  font-weight:950!important;
}
.profile-picker-list .profile-chip-body small{
  color:#627970!important;
  font-size:12px!important;
  font-weight:850!important;
  white-space:normal!important;
}
.profile-picker-list .profile-chip-action{
  grid-area:action!important;
  width:auto!important;
  min-width:88px!important;
  max-width:none!important;
  min-height:38px!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  padding:0 14px!important;
  border-radius:13px!important;
  background:#ecf6f1!important;
  color:var(--primary)!important;
  border:1px solid #cfe3da!important;
  font-size:13px!important;
  font-weight:950!important;
}
.profile-picker-list .profile-chip:hover .profile-chip-action,
.profile-picker-list .profile-chip:focus-visible .profile-chip-action{
  background:var(--primary)!important;
  color:#fff!important;
  border-color:var(--primary)!important;
}
@media(max-width:620px){
  .quick-profiles-head{
    grid-template-columns:1fr!important;
  }
  .quick-profiles-head .btn{
    width:100%!important;
    min-width:0!important;
  }
}
@media(max-width:430px){
  .profile-picker-list .profile-chip{
    grid-template-columns:42px minmax(0,1fr)!important;
    grid-template-areas:"icon body" "action action"!important;
    min-height:96px!important;
  }
  .profile-picker-list .profile-chip-name{
    white-space:normal!important;
    overflow-wrap:anywhere!important;
  }
  .profile-picker-list .profile-chip-action{
    width:100%!important;
  }
}

/* v81: cierre de sesión limpio en móvil */
#appView.hidden,
html.mobile-device #appView.hidden,
body #appView.hidden,
.app-shell.hidden{
  display:none!important;
  visibility:hidden!important;
  height:0!important;
  min-height:0!important;
  overflow:hidden!important;
}

/* v82: botones iguales en Express y Cotizador avanzado */
.express-actions,
.quote-actions-top{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:10px!important;
  padding:10px!important;
  border-radius:18px!important;
}
.express-actions .btn,
.quote-actions-top .btn{
  width:100%!important;
  min-width:0!important;
  min-height:50px!important;
  padding:10px 10px!important;
  font-size:15px!important;
  line-height:1.15!important;
  gap:7px!important;
  white-space:normal!important;
}
.express-actions .btn svg,
.quote-actions-top .btn svg{
  width:18px!important;
  height:18px!important;
  min-width:18px!important;
}
@media(max-width:520px){
  .express-actions,
  .quote-actions-top,
  html.mobile-device .express-actions,
  html.mobile-device .quote-actions-top{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:6px!important;
    padding:8px!important;
  }
  .express-actions .btn,
  .quote-actions-top .btn,
  html.mobile-device .express-actions .btn,
  html.mobile-device .quote-actions-top .btn{
    min-height:44px!important;
    padding:8px 5px!important;
    font-size:12.5px!important;
    gap:4px!important;
  }
  .express-actions .btn svg,
  .quote-actions-top .btn svg,
  html.mobile-device .express-actions .btn svg,
  html.mobile-device .quote-actions-top .btn svg{
    width:16px!important;
    height:16px!important;
    min-width:16px!important;
  }
}

/* v83: administracion oculta para usuarios normales en movil */
.admin-only.hidden,
#adminNav.hidden,
#adminNavLegacy.hidden,
html.mobile-device .admin-only.hidden,
html.mobile-device #adminNav.hidden,
html.mobile-device #adminNavLegacy.hidden,
.home-menu-btn.admin-only.hidden,
html.mobile-device .home-menu-btn.admin-only.hidden{
  display:none!important;
  visibility:hidden!important;
  pointer-events:none!important;
  width:0!important;
  height:0!important;
  min-width:0!important;
  min-height:0!important;
  padding:0!important;
  margin:0!important;
  border:0!important;
  overflow:hidden!important;
}

/* v84: paleta clinica configurable y resumen Express */
:root{
  --primary:#0b7f73;
  --primary2:#075f58;
  --bg:#f5fbf8;
  --panel:#ffffff;
  --text:#10231f;
  --muted:#60766f;
  --line:#d3ebe2;
  --soft:#eef8f4;
  --success:#1769aa;
  --shadow:0 18px 42px rgba(7,95,88,.085);
  --shadow-soft:0 8px 20px rgba(7,95,88,.055);
}
.theme-blue{
  --primary:#1769aa;
  --primary2:#0d4776;
  --bg:#f5fbf8;
  --soft:#eef8f4;
  --line:#d3ebe2;
  --success:#1769aa;
  --shadow:0 18px 42px rgba(23,105,170,.085);
  --shadow-soft:0 8px 20px rgba(23,105,170,.055);
}
.theme-teal{
  --primary:#0f766e;
  --primary2:#115e59;
  --bg:#f5fbf8;
  --soft:#eef8f4;
  --line:#d3ebe2;
  --success:#1769aa;
  --shadow:0 18px 42px rgba(15,118,110,.085);
  --shadow-soft:0 8px 20px rgba(15,118,110,.055);
}
.theme-cyan{
  --primary:#087f9c;
  --primary2:#0e7490;
  --bg:#f5fbf8;
  --soft:#eef8f4;
  --line:#d3ebe2;
  --success:#1769aa;
  --shadow:0 18px 42px rgba(8,127,156,.085);
  --shadow-soft:0 8px 20px rgba(8,127,156,.055);
}
.dot.green{background:#0b7f73!important}
.dot.blue{background:#1769aa!important}
.dot.teal{background:#0f766e!important}
.dot.cyan{background:#087f9c!important}
.express-stats{
  margin-top:0!important;
}
.stat-card{
  background:#fff!important;
  border-color:var(--line)!important;
}
.stat-card strong{
  color:var(--primary)!important;
}

/* v85: mismo espacio bajo el buscador en Express y Avanzado */
.catalog-card .search-box + #examList,
.express-card .search-box + #expressExamList,
html.mobile-device .catalog-card .search-box + #examList,
html.mobile-device .express-card .search-box + #expressExamList{
  margin-top:14px!important;
  padding-top:0!important;
}

/* v86: perfiles rapidos como boton unico y espacio uniforme bajo buscadores */
.quick-profiles-panel{
  padding:0!important;
  margin:10px 0 14px!important;
  border:0!important;
  background:transparent!important;
  box-shadow:none!important;
  border-radius:0!important;
}
.quick-profile-trigger,
.quick-profiles-panel > .btn{
  width:100%!important;
  min-width:0!important;
  min-height:54px!important;
  border-radius:16px!important;
}
.search-box + .exam-list,
.search-box + .admin-list,
.search-box + .history-list,
.search-box + .selected-list,
html.mobile-device .search-box + .exam-list,
html.mobile-device .search-box + .admin-list,
html.mobile-device .search-box + .history-list,
html.mobile-device .search-box + .selected-list{
  margin-top:14px!important;
  padding-top:0!important;
}
@media(max-width:520px){
  .search-box + .exam-list,
  .search-box + .admin-list,
  .search-box + .history-list,
  .search-box + .selected-list{
    margin-top:14px!important;
    padding-top:0!important;
  }
}
