:root{--navy:#36383a;--navy2:#484a4c;--bg:#f0f2f4;--card:#fff;--text:#222426;--muted:#66798b;--border:#dee0e2;--accent:#5c5e60;--danger:#a53f3f}*{box-sizing:border-box}body{margin:0;font-family:Inter,Segoe UI,Arial,sans-serif;background:var(--bg);color:var(--text)}.shell{min-height:100vh}.brand{background:linear-gradient(110deg,var(--navy),var(--navy2));color:#fff;padding:34px max(24px,calc((100% - 1180px)/2));display:flex;gap:18px;align-items:center}.brand-mark{width:58px;height:58px;border:1px solid #ffffff55;border-radius:16px;display:grid;place-items:center;font-size:30px;font-weight:800;background:#ffffff12}.eyebrow{font-size:11px;font-weight:800;letter-spacing:.14em;opacity:.8}.brand h1{margin:5px 0 4px;font-size:30px}.brand p{margin:0;opacity:.82;font-size:14px}main{max-width:1180px;margin:34px auto;padding:0 20px}.auth-card{max-width:520px;margin:10px auto;background:var(--card);border:1px solid var(--border);border-radius:18px;padding:28px;box-shadow:0 18px 55px #25415c14}.pill{font-size:10px;font-weight:800;letter-spacing:.12em;color:var(--accent);background:#eff1f3;border:1px solid #dddfe1;border-radius:999px;padding:7px 10px;display:inline-block}.auth-copy h2,.portal-head h2{margin:14px 0 6px}.auth-copy p,.portal-head p,.note{color:var(--muted)}.form{display:grid;gap:14px;margin-top:22px}.form label{display:grid;gap:7px;font-size:12px;font-weight:800;color:#525456}.form input{width:100%;border:1px solid var(--border);border-radius:10px;padding:13px 14px;font-size:15px;outline:none}.form input:focus{border-color:#9a9c9e;box-shadow:0 0 0 3px #2f84ba18}.primary{border:0;background:var(--accent);color:#fff;border-radius:10px;padding:13px 16px;font-weight:800;cursor:pointer}.linkbtn{border:0;background:transparent;color:var(--accent);font-weight:700;cursor:pointer}.msg{min-height:20px;font-size:13px;color:var(--danger)}.hidden{display:none!important}.portal-head{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-bottom:22px}.userbox{display:flex;align-items:center;gap:12px;background:#fff;border:1px solid var(--border);padding:10px 12px;border-radius:12px}.userbox strong{font-size:12px}.userbox button{border:1px solid var(--border);background:#fff;border-radius:8px;padding:8px 11px;cursor:pointer;font-weight:700}.systems-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}.system-card{background:#fff;border:1px solid var(--border);border-radius:16px;padding:22px;min-height:245px;display:flex;flex-direction:column;transition:.2s}.system-card:hover{transform:translateY(-2px);box-shadow:0 14px 34px #1b456516;border-color:#ced0d2}.system-icon{width:52px;height:52px;border-radius:14px;background:#f1f3f5;border:1px solid #dee0e2;display:grid;place-items:center;color:var(--navy);font-weight:900;font-size:18px}.system-card h3{margin:18px 0 8px;font-size:19px}.system-card p{color:var(--muted);font-size:13px;line-height:1.55;margin:0 0 18px}.system-card .enter{margin-top:auto;display:block;text-align:center;text-decoration:none;background:var(--navy);color:#fff;padding:12px;border-radius:10px;font-weight:800}.system-card small{display:block;color:#8394a3;margin-top:10px;text-align:center}.note{margin-top:20px;background:#fff;border:1px dashed #d1d3d5;border-radius:12px;padding:14px;font-size:12px}@media(max-width:850px){.systems-grid{grid-template-columns:1fr}.portal-head{align-items:flex-start;flex-direction:column}.userbox{width:100%;justify-content:space-between}.brand{padding:26px 20px}.brand h1{font-size:25px}}

.loading-systems,.systems-error{grid-column:1/-1;padding:24px;border:1px solid #d6d8da;border-radius:14px;background:#fff;color:#545658}.systems-error button{margin-top:12px;padding:9px 14px;border:0;border-radius:9px;background:#5d5f61;color:#fff;font-weight:700;cursor:pointer}

.form select{width:100%;border:1px solid var(--border);border-radius:10px;padding:13px 14px;font-size:15px;background:#fff}.form-row{display:grid;grid-template-columns:1fr 1fr;gap:12px}@media(max-width:520px){.form-row{grid-template-columns:1fr}}

.admin-view{display:grid;gap:18px}.admin-head{display:flex;justify-content:space-between;gap:20px;align-items:center}.admin-head h2{margin:12px 0 5px}.admin-head p{margin:0;color:var(--muted)}.secondary-btn{border:1px solid var(--border);background:#fff;border-radius:9px;padding:10px 14px;font-weight:800;cursor:pointer}.admin-cards{display:grid;grid-template-columns:repeat(5,1fr);gap:12px}.kpi,.panel{background:#fff;border:1px solid var(--border);border-radius:14px;padding:18px}.kpi{display:grid;gap:3px}.kpi b{font-size:28px;color:var(--navy)}.kpi span{font-size:11px;font-weight:800;color:var(--muted);text-transform:uppercase}.admin-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}.panel h3{margin:0 0 14px}.metric-row{display:flex;justify-content:space-between;gap:12px;border-bottom:1px solid #eef0f2;padding:9px 2px;font-size:13px}.mini-form{display:grid;grid-template-columns:1fr 1fr;gap:10px}.mini-form input,.mini-form select,.inline-form input{border:1px solid var(--border);border-radius:9px;padding:10px}.mini-form button{grid-column:1/-1}.inline-form{display:flex;gap:10px}.inline-form input{flex:1}.scroll-list{max-height:360px;overflow:auto}.perm-user{padding:10px 0;border-bottom:1px solid #eef0f2}.perm-user small{display:block;color:var(--muted);margin:3px 0 7px}.perm-checks{display:flex;gap:12px;flex-wrap:wrap;font-size:12px}.scroll-list table{width:100%;border-collapse:collapse;font-size:12px}.scroll-list th,.scroll-list td{text-align:left;padding:9px;border-bottom:1px solid #eef0f2}.empty-mini{color:var(--muted);font-size:12px}@media(max-width:900px){.admin-cards{grid-template-columns:repeat(2,1fr)}.admin-grid{grid-template-columns:1fr}}@media(max-width:520px){.admin-cards{grid-template-columns:1fr}.mini-form{grid-template-columns:1fr}}

.security-note{margin-top:14px;padding:11px 12px;border-radius:10px;background:#f7f9fb;border:1px solid var(--border);color:var(--muted);font-size:12px;line-height:1.45}.security-note:empty{display:none}


/* HMEB VISUAL STANDARD V9 */
:root{
  --navy:#393b3d;
  --navy2:#56585a;
  --bg:#f0f2f4;
  --bg2:#f8fafc;
  --card:#ffffff;
  --text:#222426;
  --muted:#66798b;
  --border:#dfe1e3;
  --accent:#5d5f61;
  --accent-2:#4c4e50;
  --danger:#a53f3f;
  --shadow-soft:0 18px 42px rgba(16,49,78,.08);
  --shadow-hover:0 24px 60px rgba(16,49,78,.14);
  --radius-xl:24px;
  --radius-lg:20px;
  --radius-md:14px;
}
body{background:linear-gradient(180deg,var(--bg) 0%,var(--bg2) 100%);color:var(--text)}
.brand{padding:38px max(24px,calc((100% - 1200px)/2));box-shadow:0 10px 30px rgba(12,34,55,.14);position:relative;overflow:hidden}
.brand::after{content:'';position:absolute;inset:auto -120px -120px auto;width:320px;height:320px;border-radius:50%;background:radial-gradient(circle,#ffffff26 0,#ffffff08 38%,transparent 72%)}
.brand-mark{width:62px;height:62px;border-radius:18px;background:#ffffff18;border-color:#ffffff44;box-shadow:inset 0 1px 0 #ffffff40}
.brand h1{font-size:34px;letter-spacing:-.02em}
.brand p{max-width:760px;font-size:15px}
main{max-width:1200px;margin:0 auto;padding:26px 20px 46px;position:relative;top:-8px}
.auth-card,.system-card,.panel,.kpi,.note,.userbox{box-shadow:var(--shadow-soft)}
.auth-card{border-radius:var(--radius-xl);padding:30px 30px 28px;border-color:var(--border);background:linear-gradient(180deg,#ffffff 0%,#fbfdff 100%)}
.auth-card .auth-copy{margin-bottom:8px}
.pill{padding:8px 12px;font-size:10px;letter-spacing:.16em}
.auth-copy h2,.portal-head h2,.admin-head h2{font-size:18px;letter-spacing:-.02em}
.auth-copy p,.portal-head p,.note{font-size:14px;line-height:1.6}
.form{gap:15px}
.form label{gap:8px;font-size:12px;color:#525456}
.form input,.form select,.mini-form input,.mini-form select,.inline-form input{min-height:46px;border-radius:12px;border:1px solid var(--border);background:#fff;box-shadow:inset 0 1px 0 rgba(255,255,255,.7)}
.form input:focus,.form select:focus,.mini-form input:focus,.mini-form select:focus,.inline-form input:focus{border-color:#909294;box-shadow:0 0 0 4px rgba(23,105,167,.12)}
.primary,.secondary-btn,.system-card .enter,.userbox button,.mini-form button,.inline-form button{min-height:46px;border-radius:12px;font-weight:800;transition:transform .15s ease,box-shadow .15s ease,background .15s ease}
.primary,.system-card .enter,.mini-form button,.inline-form button{background:linear-gradient(135deg,var(--accent) 0%,var(--accent-2) 100%);box-shadow:0 10px 20px rgba(23,105,167,.22)}
.primary:hover,.secondary-btn:hover,.system-card .enter:hover,.userbox button:hover,.mini-form button:hover,.inline-form button:hover{transform:translateY(-1px)}
.secondary-btn,.userbox button{background:#fff}
.linkbtn{padding:4px 2px;justify-self:center}
.msg{min-height:22px;font-weight:700}
.portal-head{margin-bottom:24px;align-items:flex-end}
.userbox{padding:10px 12px 10px 14px;border-radius:16px;gap:10px}
.userbox strong{font-size:12px;max-width:340px}
.systems-grid{gap:22px}
.system-card{padding:24px;border-radius:22px;min-height:265px;background:linear-gradient(180deg,#ffffff 0%,#fbfdff 100%)}
.system-card:hover{box-shadow:var(--shadow-hover);transform:translateY(-4px);border-color:#d0d2d4}
.system-icon{width:56px;height:56px;border-radius:16px;background:linear-gradient(180deg,#f2f4f6 0%,#eceef0 100%);border-color:#dcdee0}
.system-card h3{font-size:21px;letter-spacing:-.02em}
.system-card p{font-size:13px;line-height:1.65}
.system-card small{font-size:12px}
.note{margin-top:22px;border-radius:16px;padding:16px 18px;background:rgba(255,255,255,.88);backdrop-filter:blur(8px)}
.admin-view{gap:20px}
.admin-head{align-items:flex-end}
.admin-cards{gap:14px}
.kpi,.panel{border-radius:20px;padding:20px;background:linear-gradient(180deg,#ffffff 0%,#fbfdff 100%)}
.kpi b{font-size:32px;letter-spacing:-.03em}
.panel h3{font-size:17px;letter-spacing:-.02em}
.metric-row,.perm-user,.scroll-list th,.scroll-list td{font-size:12px}
.scroll-list table th{background:#f6f8fa;position:sticky;top:0}
.security-note{border-radius:12px;padding:12px 14px;background:#f7f9fb}
@media(max-width:900px){main{top:0;padding-top:22px}.brand{padding:28px 20px}.brand h1{font-size:28px}.portal-head,.admin-head{align-items:flex-start}}


/* HMEB MASTER LAYOUT V10 - PORTAL */
:root{--hmb-side:246px;--hmb-line:#e1e3e5;--hmb-blue:#484a4c;--hmb-blue2:#393b3d}
.hmb-sidebar{position:fixed;inset:0 auto 0 0;width:var(--hmb-side);z-index:30;background:linear-gradient(180deg,#46484a 0%,#3a3c3e 62%,#444648 100%);color:#fff;display:flex;flex-direction:column;box-shadow:8px 0 28px rgba(11,56,93,.12)}.hmb-sidebar-brand{padding:21px 22px 26px;border-bottom:1px solid rgba(255,255,255,.09)}.hmb-sidebar-hospital{font-size:9px;font-weight:900;letter-spacing:.1em;opacity:.78;margin-bottom:8px}.hmb-sidebar-brand strong{display:block;font-size:22px;line-height:1.15}.hmb-sidebar-brand span{display:block;margin-top:8px;font-size:12px;line-height:1.55;color:#dadcde}.hmb-sidebar-nav{padding:12px 7px;display:flex;flex-direction:column;gap:3px}.hmb-nav-item{width:100%;min-height:52px;padding:0 18px;border:0;border-radius:7px;background:transparent;color:#f1f3f5;display:flex;align-items:center;gap:14px;text-align:left;font-size:13px;font-weight:700;cursor:pointer}.hmb-nav-item:hover{background:rgba(255,255,255,.08)}.hmb-nav-item.active{background:linear-gradient(90deg,#6d6f71,#606264);box-shadow:inset 4px 0 0 #eaecee}.hmb-nav-icon{width:28px;height:28px;display:grid;place-items:center;border-radius:7px;background:rgba(255,255,255,.08);font-size:17px}.hmb-sidebar-footer{margin-top:auto;padding:24px 25px 28px;color:#b2b4b6;font-size:12px;line-height:1.55}.hmb-hospital-mark{font-size:38px;color:#9c9ea0;margin-bottom:12px;opacity:.72}
body.portal-layout .brand{margin-left:var(--hmb-side);padding:16px 34px;min-height:80px;background:linear-gradient(100deg,#444648,#585a5c);box-shadow:none}.portal-layout .brand-mark{display:none}.portal-layout .brand h1{font-size:26px;margin:2px 0}.portal-layout .brand p{display:none}.portal-layout main{margin-left:var(--hmb-side);max-width:none;padding:22px 32px 44px;top:0}.portal-layout .portal-head{align-items:center}.portal-layout .systems-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.portal-layout .system-card{border-radius:16px;min-height:220px;box-shadow:0 8px 24px rgba(22,67,101,.055)}.portal-layout .system-icon{border-radius:10px}.portal-layout .panel,.portal-layout .kpi{border-radius:16px;box-shadow:0 8px 24px rgba(22,67,101,.055)}
@media(max-width:780px){.portal-side{display:none!important}body.portal-layout .brand{margin-left:0}.portal-layout main{margin-left:0;padding:14px 12px}.portal-layout .systems-grid{grid-template-columns:1fr}}

/* HMEB V13 — CORREÇÃO DE OCUPAÇÃO TOTAL DA TELA */
html,body,.shell{width:100%;min-width:0;min-height:100%;overflow-x:hidden}
body.portal-layout .brand{width:calc(100% - var(--hmb-side));max-width:none;box-sizing:border-box}
.portal-layout main{width:calc(100% - var(--hmb-side));max-width:none!important;margin:0 0 0 var(--hmb-side)!important;box-sizing:border-box}
.portal-layout .portal,.portal-layout .admin-view,.portal-layout .systems-grid,.portal-layout .note{width:100%;max-width:none;min-width:0;box-sizing:border-box}
.portal-layout .system-card{min-width:0}
@media(max-width:780px){body.portal-layout .brand{width:100%;margin-left:0}.portal-layout main{width:100%;margin:0!important}}
\n\n/* HMEB V14 - servidor oculto no Windows + endereco no rodape */\n.hmb-sidebar-footer{padding-bottom:18px!important}\n.hmb-server-meta{margin-top:15px;padding-top:12px;border-top:1px solid rgba(255,255,255,.12);display:grid;gap:4px;font-size:9px;line-height:1.35;color:#cfd1d3;word-break:break-all}\n.hmb-server-meta b{font-size:9px;text-transform:uppercase;letter-spacing:.08em;color:#f0f2f4}\n.hmb-server-meta span{display:block}\n\n.hmeb-connection-strip{position:fixed;left:18px;bottom:14px;z-index:80;display:flex;gap:10px;align-items:center;padding:8px 12px;border:1px solid var(--border);border-radius:10px;background:rgba(255,255,255,.94);box-shadow:0 8px 24px rgba(16,49,78,.08);font-size:10px;color:var(--muted)}\n.hmeb-connection-strip b{color:var(--navy)}\nbody:has(#portalSidebar:not(.hidden)) .hmeb-connection-strip{display:none}\n@media(max-width:700px){.hmeb-connection-strip{left:8px;right:8px;bottom:8px;flex-wrap:wrap}}\n
/* HMEB V25 — TEMAS GLOBAIS CLARO / CINZA / ESCURO */
:root{--theme-bg:#f1f3f5;--theme-panel:#fff;--theme-panel2:#f6f8fa;--theme-text:#222426;--theme-muted:#65798c;--theme-border:#dee0e2;--theme-input:#fff;--theme-head:#515355;--theme-head2:#404244;--theme-sidebar:#46484a;--theme-sidebar2:#3a3c3e;--theme-shadow:0 10px 26px rgba(17,59,91,.08)}
body.gray{--theme-bg:#e8ecef;--theme-panel:#f8f9fa;--theme-panel2:#eef1f3;--theme-text:#252b31;--theme-muted:#626b73;--theme-border:#cbd2d8;--theme-input:#fdfdfd;--theme-head:#59636c;--theme-head2:#444d55;--theme-sidebar:#4b565f;--theme-sidebar2:#39434b;--theme-shadow:0 10px 26px rgba(35,42,48,.10)}
body.dark{--theme-bg:#16181a;--theme-panel:#222426;--theme-panel2:#282a2c;--theme-text:#f1f3f5;--theme-muted:#b4b6b8;--theme-border:#444648;--theme-input:#26282a;--theme-head:#37393b;--theme-head2:#252729;--theme-sidebar:#2b2d2f;--theme-sidebar2:#202224;--theme-shadow:0 12px 30px rgba(0,0,0,.25)}
body,body.gray,body.dark{background:var(--theme-bg);color:var(--theme-text)}
body.gray .brand,body.dark .brand,body.portal-layout .brand{background:linear-gradient(105deg,var(--theme-head2),var(--theme-head))}
.hmb-sidebar{background:linear-gradient(180deg,var(--theme-sidebar),var(--theme-sidebar2))}
.auth-card,.system-card,.panel,.kpi,.note,.userbox,.loading-systems,.systems-error{background:var(--theme-panel);color:var(--theme-text);border-color:var(--theme-border);box-shadow:var(--theme-shadow)}
.form input,.form select,.mini-form input,.mini-form select,.inline-form input,.userbox button,.secondary-btn{background:var(--theme-input);color:var(--theme-text);border-color:var(--theme-border)}
.auth-copy p,.portal-head p,.admin-head p,.note,.system-card p,.system-card small,.empty-mini{color:var(--theme-muted)}
.form label,.metric-row,.perm-user,.scroll-list th,.scroll-list td{color:var(--theme-text);border-color:var(--theme-border)}
.scroll-list table th{background:var(--theme-panel2)}.security-note{background:var(--theme-panel2);color:var(--theme-muted);border-color:var(--theme-border)}
.pill,.system-icon{background:var(--theme-panel2);border-color:var(--theme-border)}
.hmeb-connection-strip{background:var(--theme-panel);color:var(--theme-muted);border-color:var(--theme-border)}
body.dark .pill,body.dark .system-icon{color:#acaeb0}body.dark .linkbtn{color:#acaeb0}


/* HMEB V26 - consistencia global */
.hmb-nav-item.active{background:linear-gradient(90deg,#6d6f71 0%,#606264 100%);box-shadow:inset 4px 0 0 #eaecee;color:#fff}
.hmb-nav-item.active .hmb-nav-icon{background:rgba(255,255,255,.16);color:#fff}
body.dark input,body.dark select,body.dark textarea{color:var(--theme-text,#f1f3f5);background:var(--theme-input,#282a2c);border-color:var(--theme-border,#444648)}
body.dark input::placeholder,body.dark textarea::placeholder{color:#b0b2b4;opacity:1}

/* HMEB COLOR TUNING V28 */
body.gray,body.portal-layout.gray{
  --theme-bg:#eaecee!important;
  --theme-panel:#f9fbfd!important;
  --theme-panel2:#f0f2f4!important;
  --theme-text:#27292b!important;
  --theme-muted:#607180!important;
  --theme-border:#d1d3d5;
  --theme-input:#ffffff!important;
  --theme-head:#46484a!important;
  --theme-head2:#37393b!important;
  --theme-sidebar:#3f4a53!important;
  --theme-sidebar2:#323b43!important;
  --theme-shadow:0 14px 34px rgba(29,42,53,.08)!important;
}
body.dark,body.portal-layout.dark{
  --theme-bg:#181a1c!important;
  --theme-panel:#212325!important;
  --theme-panel2:#2d2f31!important;
  --theme-text:#f2f4f6!important;
  --theme-muted:#acaeb0!important;
  --theme-border:#4b4d4f;
  --theme-input:#27292b!important;
  --theme-head:#484a4c!important;
  --theme-head2:#313335!important;
  --theme-sidebar:#2e3032!important;
  --theme-sidebar2:#212325!important;
  --theme-shadow:0 18px 42px rgba(0,0,0,.28)!important;
}
body.gray .primary,body.gray .system-card .enter,body.gray .mini-form button,body.gray .inline-form button,
body.gray .secondary-btn.active,body.gray .userbox button.active{
  background:linear-gradient(135deg,#606264 0%,#484a4c 100%);color:#fff;border-color:#484a4c;
}
body.gray .secondary-btn,body.gray .userbox button{background:#f6f8fa;color:#2f3133;border-color:#d1d3d5}
body.gray .pill{background:#eef0f2;color:#545658;border-color:#d8dadc}
body.gray .note,body.gray .panel,body.gray .kpi,body.gray .auth-card,body.gray .system-card,body.gray .userbox{box-shadow:var(--theme-shadow)}
body.gray .system-icon{background:#f2f4f6;color:#505254;border-color:#dcdee0}
body.dark .primary,body.dark .system-card .enter,body.dark .mini-form button,body.dark .inline-form button,
body.dark .secondary-btn.active,body.dark .userbox button.active{
  background:linear-gradient(135deg,#7a7c7e 0%,#5f6163 100%);color:#fff;border-color:#5f6163;
}
body.dark .secondary-btn,body.dark .userbox button{background:#313335;color:#f2f4f6;border-color:#4b4d4f}
body.dark .pill{background:#2d2f31;color:#b4b6b8;border-color:#4b4d4f}
body.dark .note,body.dark .panel,body.dark .kpi,body.dark .auth-card,body.dark .system-card,body.dark .userbox{box-shadow:var(--theme-shadow)}
body.dark .system-icon{background:#2f3133;color:#b4b6b8;border-color:#505254}
body.gray input,body.gray select,body.gray textarea{background:#fff;color:#27292b;border-color:#d1d3d5}
body.dark input,body.dark select,body.dark textarea{background:#27292b;color:#f2f4f6;border-color:#4b4d4f}
body.dark input::placeholder,body.dark textarea::placeholder{color:#acaeb0;opacity:1!important}
body.gray .scroll-list table th,body.gray .history-table-wrap th,body.gray .age-table-wrap th,body.gray .professional-table-wrap th,body.gray .admin-table-wrap th{background:#eef0f2;color:#3d3f41}
body.dark .scroll-list table th,body.dark .history-table-wrap th,body.dark .age-table-wrap th,body.dark .professional-table-wrap th,body.dark .admin-table-wrap th{background:#2d2f31;color:#e4e6e8}
body.gray .metric-row,body.gray .perm-user{background:#f6f8fa;border-color:#dbdddf}
body.dark .metric-row,body.dark .perm-user{background:#2d2f31;border-color:#4b4d4f}
body.gray .brand,body.dark .brand{box-shadow:0 12px 28px rgba(10,35,58,.16)}

/* HMEB DARK THEME ALIGNMENT V31 */
body.dark,body.portal-layout.dark{
  --theme-bg:#131517!important;
  --theme-panel:#202224!important;
  --theme-panel2:#2e3032!important;
  --theme-text:#f4f6f8!important;
  --theme-muted:#b2b4b6!important;
  --theme-border:#404244;
  --theme-input:#26282a!important;
  --theme-head:#56585a!important;
  --theme-head2:#3a3c3e!important;
  --theme-sidebar:#323436!important;
  --theme-sidebar2:#242628!important;
  --theme-shadow:0 18px 42px rgba(2,10,18,.34)!important;
}
body.dark{background:linear-gradient(180deg,#131517 0%,#181a1c 100%);color:var(--theme-text)}
body.dark .brand{background:linear-gradient(100deg,#36383a 0%,#545658 100%)}
body.dark .auth-card,body.dark .system-card,body.dark .panel,body.dark .kpi,body.dark .note,body.dark .userbox{background:linear-gradient(180deg,#202224 0%,#1c1e20 100%);border-color:var(--theme-border);box-shadow:var(--theme-shadow)}
body.dark .portal-head h2,body.dark .portal-head p,body.dark .auth-copy h2,body.dark .auth-copy p,body.dark .system-card h3,body.dark .system-card p,body.dark .system-card small,body.dark .note,body.dark .userbox strong{color:var(--theme-text)}
body.dark .primary,body.dark .system-card .enter,body.dark .mini-form button,body.dark .inline-form button,body.dark .secondary-btn.active,body.dark .userbox button.active{background:linear-gradient(135deg,#828486 0%,#66686a 100%);color:#fff;border-color:#66686a;box-shadow:0 12px 24px rgba(40,148,223,.24)}
body.dark .secondary-btn,body.dark .userbox button{background:#2e3032;color:var(--theme-text);border-color:var(--theme-border)}
body.dark .pill{background:#313335;color:#c5c7c9;border-color:#595b5d}
body.dark .system-icon{background:#313335;color:#c5c7c9;border-color:#56585a}
body.dark input,body.dark select,body.dark textarea{background:#26282a;color:var(--theme-text);border-color:var(--theme-border)}
body.dark input::placeholder,body.dark textarea::placeholder{color:#a3a5a7;opacity:1!important}
body.dark .scroll-list table th,body.dark .history-table-wrap th,body.dark .age-table-wrap th,body.dark .professional-table-wrap th,body.dark .admin-table-wrap th{background:#2e3032;color:#edeff1}
body.dark .metric-row,body.dark .perm-user{background:#26282a;border-color:var(--theme-border)}


/* HMEB V32 - seletor unico de tema */
.brand{justify-content:space-between;align-items:center}
.brand-main{display:flex;gap:18px;align-items:center;min-width:0}
.hmb-theme-selector-wrap{display:flex;align-items:center;gap:8px;margin-left:auto;flex:0 0 auto}
.hmb-theme-selector-wrap label{font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:rgba(255,255,255,.82);margin:0}
.hmb-theme-selector-wrap select{width:auto;min-width:112px;height:38px;padding:0 34px 0 12px;border-radius:10px;border:1px solid rgba(255,255,255,.24);background:#ffffff14;color:#fff;font-weight:800;box-shadow:none;cursor:pointer}
.hmb-theme-selector-wrap select option{background:#f7f9fb;color:#27292b}
body.dark .hmb-theme-selector-wrap select option{background:#202224;color:#f4f6f8}
body:not(.dark) .hmb-theme-selector-wrap select{background:#ffffff18;color:#fff}
@media(max-width:760px){.brand{align-items:flex-start}.brand-main{align-items:flex-start}.hmb-theme-selector-wrap{margin-top:2px}.hmb-theme-selector-wrap label{display:none}.hmb-theme-selector-wrap select{min-width:100px}}

/* HMEB V32 - controle global fixo de tema */
.hmb-theme-selector-wrap{position:fixed!important;top:16px!important;right:18px!important;z-index:3000!important;margin:0!important;padding:7px 9px!important;border:1px solid rgba(255,255,255,.18);border-radius:12px!important;background:rgba(10,35,58,.76);box-shadow:0 10px 26px rgba(0,0,0,.18);backdrop-filter:blur(10px)!important}
.hmb-theme-selector-wrap label{color:#f2f4f6;display:block!important}
.hmb-theme-selector-wrap select{background:#36383a;color:#fff;border-color:#5c5e60}
body.gray .hmb-theme-selector-wrap{background:rgba(55,65,74,.84);border-color:rgba(255,255,255,.16)}
body.gray .hmb-theme-selector-wrap select{background:#4a5660;color:#fff;border-color:#6d7b86}
body.dark .hmb-theme-selector-wrap{background:rgba(9,31,50,.86);border-color:#454749}
body.dark .hmb-theme-selector-wrap select{background:#36383a;color:#fff;border-color:#5c5e60}
@media(max-width:700px){.hmb-theme-selector-wrap{top:10px!important;right:10px!important;padding:5px 7px!important}.hmb-theme-selector-wrap label{display:none!important}.hmb-theme-selector-wrap select{min-width:92px!important;height:34px!important}}

/* HMEB V35 - CAMPOS DE DATA DD/MM/AAAA + CALENDARIO */
.hmeb-date-field{display:grid!important;grid-template-columns:minmax(0,1fr) 42px;gap:6px;align-items:center;width:100%;position:relative}
.hmeb-date-field .hmeb-date-display{width:100%!important;min-width:0!important}
.hmeb-date-native{position:absolute!important;width:1px!important;height:1px!important;opacity:0!important;pointer-events:none!important;inset:auto 0 0 auto!important;padding:0!important;border:0}
.hmeb-date-calendar-btn{height:41px!important;min-height:41px!important;width:42px!important;padding:0!important;display:grid!important;place-items:center!important;border-radius:10px!important;background:var(--theme-panel2,var(--panel2,#f0f2f4));color:var(--theme-text,var(--text,#27292b));border:1px solid var(--theme-border,var(--border,#d1d3d5));box-shadow:none;cursor:pointer!important;font-size:17px!important;line-height:1!important}
.hmeb-date-calendar-btn:hover{border-color:#8e9092;background:color-mix(in srgb,var(--theme-panel2,var(--panel2,#f0f2f4)) 82%,#e6e8ea)}
body.dark .hmeb-date-calendar-btn{background:#2e3032;color:#c5c7c9;border-color:#595b5d}
body.dark .hmeb-date-calendar-btn:hover{background:#3b3d3f;border-color:#989a9c}
.datetime-pickers{grid-template-columns:minmax(170px,1.45fr) minmax(92px,.8fr)!important;align-items:center}
.datetime-pickers>.hmeb-date-field{min-width:0}
@media(max-width:520px){.hmeb-date-field{grid-template-columns:minmax(0,1fr) 40px}.hmeb-date-calendar-btn{width:40px!important}}



/* HMEB V36 - SELETOR DE TEMA POR CONTEXTO */
.hmb-theme-selector-wrap{display:none!important}
.hmb-theme-context{display:flex;align-items:center;gap:7px;flex:0 0 auto}
.hmb-theme-context label{margin:0!important;font-size:10px!important;font-weight:800!important;letter-spacing:.08em!important;text-transform:uppercase!important;color:inherit;opacity:.8}
.hmb-theme-context select{width:auto!important;min-width:96px!important;height:36px!important;padding:0 30px 0 10px!important;border-radius:10px!important;font-weight:800!important;cursor:pointer!important;box-shadow:none}
.topbar .hmb-theme-system,header .hmb-theme-system,.brand .hmb-theme-system{margin-left:8px}
.topbar .hmb-theme-system label,header .hmb-theme-system label,.brand .hmb-theme-system label{color:#f2f4f6}
.topbar .hmb-theme-system select,header .hmb-theme-system select,.brand .hmb-theme-system select{background:rgba(255,255,255,.12);color:#fff;border:1px solid rgba(255,255,255,.25)}
body.gray .topbar .hmb-theme-system select,body.gray header .hmb-theme-system select,body.gray .brand .hmb-theme-system select{background:#4a5660;border-color:#6d7b86}
body.dark .topbar .hmb-theme-system select,body.dark header .hmb-theme-system select,body.dark .brand .hmb-theme-system select{background:#36383a;border-color:#5c5e60}
.hmb-theme-system select option,.hmb-theme-modal select option{background:#f7f9fb;color:#27292b}
body.dark .hmb-theme-system select option,body.dark .hmb-theme-modal select option{background:#202224;color:#f4f6f8}
.modal-head .hmb-theme-modal,.dialog-head .hmb-theme-modal{margin-left:auto}
.modal-head .hmb-theme-modal select,.dialog-head .hmb-theme-modal select,.security-brand .hmb-theme-modal select,.login-brand .hmb-theme-modal select{background:var(--theme-input,var(--input,#fff));color:var(--theme-text,var(--text,#27292b));border:1px solid var(--theme-border,var(--border,#d1d3d5))}
.security-brand,.login-brand{position:relative}
.security-brand .hmb-theme-modal,.login-brand .hmb-theme-modal{position:absolute;top:0;right:0}
@media(max-width:720px){.hmb-theme-context label{display:none!important}.hmb-theme-context select{min-width:86px!important}.security-brand .hmb-theme-modal,.login-brand .hmb-theme-modal{position:static;margin:10px 0 0 auto;justify-content:flex-end}}


/* HMEB V37 - endereco do sistema concentrado no canto inferior esquerdo */
.hmb-sidebar-footer .hmb-server-meta{display:none!important}
.hmeb-connection-strip{position:fixed;left:14px;bottom:10px;z-index:120;display:flex!important;align-items:center;padding:6px 10px;border:1px solid var(--theme-border, var(--border));border-radius:10px;background:rgba(255,255,255,.92);box-shadow:0 8px 18px rgba(16,49,78,.10);font-size:10px;line-height:1.3;color:var(--theme-muted, var(--muted));max-width:calc(100vw - 28px);word-break:break-all}
.hmeb-connection-strip .server-local{display:block}
body.dark .hmeb-connection-strip{background:rgba(16,34,52,.95);color:var(--theme-muted);border-color:var(--theme-border)}
@media (max-width:700px){.hmeb-connection-strip{left:8px;right:8px;bottom:8px}}

body:has(#portalSidebar:not(.hidden)) .hmeb-connection-strip{display:flex!important}

/* V49 - cadastro profissional único e acesso integral */
.registration-note{display:flex;flex-direction:column;gap:4px;padding:12px 14px;border:1px solid var(--border,#d1d3d5);border-radius:12px;background:var(--panel-soft,#f4f6f8);margin-bottom:4px}.registration-note strong{font-size:13px}.registration-note span{font-size:12px;line-height:1.45;opacity:.8}.registration-divider{font-size:10px;font-weight:800;letter-spacing:.12em;opacity:.58;margin:5px 0 -1px}.access-policy{padding:14px;border:1px solid var(--border,#d1d3d5);border-radius:12px;background:var(--panel-soft,#f4f6f8)}.access-policy p{margin:5px 0 0;line-height:1.45;opacity:.8}


/* HMEB v51 - PADRAO VISUAL UNIFICADO (CINZA / ESCURO) */
:root{
  --h51-radius-card:16px;
  --h51-radius-control:10px;
  --h51-radius-small:8px;
}
body.gray{
  --theme-bg:#eaecee!important;
  --theme-panel:#f9fbfd!important;
  --theme-panel2:#f0f2f4!important;
  --theme-text:#27292b!important;
  --theme-muted:#607180!important;
  --theme-border:#d1d3d5;
  --theme-input:#ffffff!important;
  --theme-header:#46484a!important;
  --theme-header2:#37393b!important;
  --theme-sidebar:#3f4a53!important;
  --theme-sidebar2:#323b43!important;
  --theme-primary:#5c5e60!important;
  --theme-primary2:#484a4c!important;
  --theme-success:#2f7d5a!important;
  --theme-danger:#a14d4d!important;
  --theme-danger-bg:#f8eded!important;
  --theme-shadow:0 10px 28px rgba(31,50,66,.10)!important;
}
body.dark{
  --theme-bg:#131517!important;
  --theme-panel:#202224!important;
  --theme-panel2:#2e3032!important;
  --theme-text:#f4f6f8!important;
  --theme-muted:#b2b4b6!important;
  --theme-border:#404244;
  --theme-input:#26282a!important;
  --theme-header:#56585a!important;
  --theme-header2:#3a3c3e!important;
  --theme-sidebar:#323436!important;
  --theme-sidebar2:#242628!important;
  --theme-primary:#828486!important;
  --theme-primary2:#66686a!important;
  --theme-success:#1f9c70!important;
  --theme-danger:#ff9da0!important;
  --theme-danger-bg:#3a252a!important;
  --theme-shadow:0 16px 38px rgba(2,10,18,.32)!important;
}
body.gray,body.dark{background:var(--theme-bg);color:var(--theme-text)}
body.gray .app,body.dark .app,body.gray main,body.dark main,body.gray .workspace,body.dark .workspace,body.gray .inline-view-host,body.dark .inline-view-host{background:var(--theme-bg);color:var(--theme-text)}
body.gray .hmb-sidebar,body.dark .hmb-sidebar{background:linear-gradient(180deg,var(--theme-sidebar) 0%,var(--theme-sidebar2) 100%)}
body.gray .topbar,body.dark .topbar,body.gray .brand,body.dark .brand,body.gray .admin-topbar,body.dark .admin-topbar{background:linear-gradient(105deg,var(--theme-header2) 0%,var(--theme-header) 100%);color:#fff}
body.gray .panel,body.dark .panel,body.gray .card,body.dark .card,body.gray .auth-card,body.dark .auth-card,body.gray .system-card,body.dark .system-card,body.gray .kpi,body.dark .kpi,body.gray .userbox,body.dark .userbox,body.gray .note,body.dark .note,body.gray .patient-panel,body.dark .patient-panel,body.gray .protocols-panel,body.dark .protocols-panel,body.gray .editor-panel,body.dark .editor-panel,body.gray .modal-card,body.dark .modal-card,body.gray .app-dialog,body.dark .app-dialog,body.gray .admin-card,body.dark .admin-card,body.gray .security-card,body.dark .security-card,body.gray .history-detail,body.dark .history-detail,body.gray .preview-sheet,body.dark .preview-sheet,body.gray .dashboard-card,body.dark .dashboard-card,body.gray .map-card,body.dark .map-card,body.gray .bed-card,body.dark .bed-card,body.gray .kpi-card,body.dark .kpi-card,body.gray .assistance-kpi,body.dark .assistance-kpi{
  background:var(--theme-panel);color:var(--theme-text);border-color:var(--theme-border);box-shadow:var(--theme-shadow)
}
body.gray .section-head,body.dark .section-head,body.gray .section-title,body.dark .section-title,body.gray .toolbar,body.dark .toolbar,body.gray .modal-head,body.dark .modal-head,body.gray .dialog-head,body.dark .dialog-head,body.gray .modal-actions,body.dark .modal-actions,body.gray .dialog-footer,body.dark .dialog-footer,body.gray .actionbar,body.dark .actionbar,body.gray .meta,body.dark .meta,body.gray .history-toolbar,body.dark .history-toolbar,body.gray .protocol-manager-toolbar,body.dark .protocol-manager-toolbar{
  background:var(--theme-panel2);color:var(--theme-text);border-color:var(--theme-border)
}
body.gray input,body.dark input,body.gray select,body.dark select,body.gray textarea,body.dark textarea{
  background:var(--theme-input);color:var(--theme-text);border-color:var(--theme-border);border-radius:var(--h51-radius-control)!important
}
body.gray input::placeholder,body.gray textarea::placeholder{color:#788894;opacity:1!important}
body.dark input::placeholder,body.dark textarea::placeholder{color:#a3a5a7;opacity:1!important}
body.gray input:focus,body.gray select:focus,body.gray textarea:focus,body.dark input:focus,body.dark select:focus,body.dark textarea:focus{border-color:var(--theme-primary);box-shadow:0 0 0 4px color-mix(in srgb,var(--theme-primary) 16%,transparent)}
body.gray .primary,body.dark .primary,body.gray .btn.primary,body.dark .btn.primary,body.gray .system-card .enter,body.dark .system-card .enter,body.gray button:not(.secondary):not(.danger):not(.success):not(.icon-btn),body.dark button:not(.secondary):not(.danger):not(.success):not(.icon-btn),body.gray .hmb-nav-item.active,body.dark .hmb-nav-item.active,body.gray .hmb-menu-btn.active,body.dark .hmb-menu-btn.active,body.gray .side-item.active,body.dark .side-item.active,body.gray .nav-item.active,body.dark .nav-item.active,body.gray .menu-btn.active,body.dark .menu-btn.active{
  background:linear-gradient(135deg,var(--theme-primary) 0%,var(--theme-primary2) 100%);color:#fff;border-color:var(--theme-primary2)
}
body.gray .secondary-btn,body.dark .secondary-btn,body.gray .btn.secondary,body.dark .btn.secondary,body.gray button.secondary,body.dark button.secondary,body.gray .icon-btn,body.dark .icon-btn,body.gray .userbox button,body.dark .userbox button{background:var(--theme-panel2);color:var(--theme-text);border-color:var(--theme-border)}
body.gray .btn.success,body.dark .btn.success,body.gray button.success,body.dark button.success{background:var(--theme-success);color:#fff}
body.gray .btn.danger,body.dark .btn.danger,body.gray button.danger,body.dark button.danger{background:var(--theme-danger-bg);color:var(--theme-danger);border-color:color-mix(in srgb,var(--theme-danger) 42%,var(--theme-border))}
body.gray table,body.dark table,body.gray .history-table-wrap,body.dark .history-table-wrap,body.gray .admin-table-wrap,body.dark .admin-table-wrap,body.gray .age-table-wrap,body.dark .age-table-wrap,body.gray .professional-table-wrap,body.dark .professional-table-wrap{background:var(--theme-panel);color:var(--theme-text);border-color:var(--theme-border)}
body.gray th,body.dark th{background:var(--theme-panel2);color:var(--theme-text);border-color:var(--theme-border)}
body.gray td,body.dark td,body.gray tr,body.dark tr{border-color:var(--theme-border);color:var(--theme-text)}
body.gray tbody tr:hover,body.dark tbody tr:hover{background:color-mix(in srgb,var(--theme-primary) 8%,var(--theme-panel))}
body.gray .pill,body.dark .pill,body.gray .status,body.dark .status,body.gray .step,body.dark .step,body.gray .professional-badge,body.dark .professional-badge,body.gray .session-professional,body.dark .session-professional,body.gray .user-badge,body.dark .user-badge{background:color-mix(in srgb,var(--theme-primary) 10%,var(--theme-panel));color:var(--theme-primary);border-color:color-mix(in srgb,var(--theme-primary) 25%,var(--theme-border))}
body.gray .system-icon,body.dark .system-icon{background:color-mix(in srgb,var(--theme-primary) 10%,var(--theme-panel));color:var(--theme-primary);border-color:color-mix(in srgb,var(--theme-primary) 22%,var(--theme-border))}
body.gray .muted,body.dark .muted,body.gray small,body.dark small,body.gray .note,body.dark .note,body.gray .section-subtitle,body.dark .section-subtitle,body.gray .optional,body.dark .optional,body.gray .filter-help,body.dark .filter-help,body.gray .field-audit,body.dark .field-audit,body.gray .bed-meta,body.dark .bed-meta{color:var(--theme-muted)}
body.gray .hmb-theme-context,body.dark .hmb-theme-context{background:color-mix(in srgb,var(--theme-panel) 16%,transparent);border-color:rgba(255,255,255,.18)}
body.gray .hmb-theme-context select{background:#4a5660;color:#fff;border-color:#6d7b86}
body.dark .hmb-theme-context select{background:#36383a;color:#fff;border-color:#5c5e60}
body.dark select option{background:#202224;color:#f4f6f8}
body.gray .hmb-sidebar-brand span,body.dark .hmb-sidebar-brand span,body.gray .hmb-sidebar-footer,body.dark .hmb-sidebar-footer{color:#dadcde}

/* v67 - configuração administrativa do ciclo de prescrição */
.cycle-config-panel{margin:18px 0;padding:20px}.cycle-config-panel>p{color:var(--muted);max-width:920px}.cycle-config-form{align-items:end;gap:12px;flex-wrap:wrap}.cycle-config-form label{display:flex;flex-direction:column;gap:6px;font-weight:700}.cycle-config-form input[type=time]{min-width:180px}

/* ============================================================
   HMEB DESIGN SYSTEM FINAL — CINZA / ESCURO
   Paleta institucional unificada. Sem alteração de lógica.
   ============================================================ */
:root{
  --hmb-bg:#151719;--hmb-bg-2:#1a1d20;--hmb-surface:#202327;--hmb-surface-2:#272b30;
  --hmb-surface-3:#2d3136;--hmb-border:#383d43;--hmb-border-soft:#30343a;
  --hmb-text:#f1f3f5;--hmb-text-2:#c5cad0;--hmb-muted:#9299a1;
  --hmb-accent:#d7dade;--hmb-accent-hover:#f0f1f2;--hmb-accent-text:#17191b;
  --hmb-success:#5c9b77;--hmb-warning:#b69a64;--hmb-danger:#b86767;--hmb-info:#7f929f;
  --hmb-radius-sm:7px;--hmb-radius:10px;--hmb-radius-lg:14px;
  --hmb-shadow:0 10px 28px rgba(0,0,0,.22);
  --theme-bg:var(--hmb-bg);--theme-panel:var(--hmb-surface);--theme-panel2:var(--hmb-surface-2);
  --theme-text:var(--hmb-text);--theme-muted:var(--hmb-muted);--theme-border:var(--hmb-border);
  --theme-input:#24272b;--theme-head:#202326;--theme-head2:#181a1d;
  --theme-sidebar:#191b1e;--theme-sidebar2:#131517;--theme-shadow:var(--hmb-shadow);
  --bg:var(--hmb-bg);--card:var(--hmb-surface);--panel:var(--hmb-surface);--text:var(--hmb-text);
  --muted:var(--hmb-muted);--border:var(--hmb-border);--accent:#bfc4c9;--navy:#292d31;--navy2:#1c1f22;
}
body.gray{
  --theme-bg:#181a1c;--theme-panel:#222529;--theme-panel2:#292d31;--theme-text:#f1f3f5;
  --theme-muted:#9da3aa;--theme-border:#3a3f45;--theme-input:#282b2f;
  --theme-head:#25282c;--theme-head2:#1d2023;--theme-sidebar:#1d2023;--theme-sidebar2:#17191b;
}
body.dark{
  --theme-bg:#101214;--theme-panel:#181b1e;--theme-panel2:#202428;--theme-text:#f3f4f5;
  --theme-muted:#8f969e;--theme-border:#30353a;--theme-input:#202327;
  --theme-head:#1c1f22;--theme-head2:#131517;--theme-sidebar:#151719;--theme-sidebar2:#0f1113;
}
html,body{background:var(--theme-bg);color:var(--theme-text);}
body{font-family:Inter,"Segoe UI",system-ui,-apple-system,sans-serif;}
.brand,.topbar,.header,.page-header,.app-header{background:linear-gradient(110deg,var(--theme-head2),var(--theme-head));color:var(--theme-text);border-color:var(--theme-border);}
.hmb-sidebar,.sidebar,.side-nav{background:linear-gradient(180deg,var(--theme-sidebar),var(--theme-sidebar2));border-color:var(--theme-border);}
.auth-card,.system-card,.panel,.card,.kpi,.note,.userbox,.toolbar,.section,.modal-card,.dialog-card,.bed-card,.prescription-card{
  background:var(--theme-panel);color:var(--theme-text);border-color:var(--theme-border);box-shadow:var(--theme-shadow);
}
input,select,textarea,.input,.select,.search-input{
  background:var(--theme-input);color:var(--theme-text);border-color:var(--theme-border);caret-color:var(--theme-text);
}
input::placeholder,textarea::placeholder{color:var(--theme-muted);opacity:1;}
input:focus,select:focus,textarea:focus{border-color:#70767d;outline:2px solid rgba(196,201,206,.18);outline-offset:1px;}
button,.btn,.primary,.secondary-btn,.action-btn{border-radius:var(--hmb-radius);}
.primary,.btn-primary,.system-card .enter{background:var(--hmb-accent);color:var(--hmb-accent-text);border-color:var(--hmb-accent);}
.primary:hover,.btn-primary:hover,.system-card .enter:hover{background:var(--hmb-accent-hover);}
.secondary-btn,.btn-secondary,.userbox button{background:var(--theme-panel2);color:var(--theme-text);border-color:var(--theme-border);}
.linkbtn,a.action-link{color:#c7ccd1;}
table,th,td{border-color:var(--theme-border-soft);}
th{background:var(--theme-panel2);color:var(--hmb-text-2);}
tbody tr:hover{background:#292d31;}
.modal,.modal-card,dialog,[role="dialog"]{color:var(--theme-text);}
dialog::backdrop,.modal-backdrop{background:rgba(0,0,0,.68);}
.hmb-nav-item.active,.nav-item.active,.menu-item.active{background:#2c3034;color:#fff;box-shadow:inset 3px 0 0 #bfc4c9;}
.hmb-nav-item:hover,.nav-item:hover,.menu-item:hover{background:#25292d;}
.pill,.badge,.tag,.status{border-color:var(--theme-border);}
::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background:#151719}::-webkit-scrollbar-thumb{background:#3b4045;border:2px solid #151719;border-radius:10px}::-webkit-scrollbar-thumb:hover{background:#50565d}
:focus-visible{outline:2px solid #aeb4ba;outline-offset:2px;}
button:disabled,.btn:disabled,input:disabled,select:disabled,textarea:disabled{opacity:.48;cursor:not-allowed;}
@media(max-width:1366px){main,.content,.page-content{max-width:100%;}.systems-grid{gap:14px}.system-card{min-width:0}.toolbar,.head-actions{flex-wrap:wrap}}
@media(max-width:900px){.systems-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.table-wrap,.scroll-list{overflow-x:auto}.modal-card,dialog{max-width:calc(100vw - 24px)}}
@media(max-width:640px){.systems-grid{grid-template-columns:1fr}.toolbar,.head-actions,.form-row{flex-direction:column;align-items:stretch}.brand{padding-left:16px;padding-right:16px}}



/* =========================================================
   HMEB — CORREÇÃO DE ENQUADRAMENTO / GRID / TOPO — 2026-09-10
   Mantém a lógica intacta e normaliza somente layout visual.
   ========================================================= */
:root{
  --hmb-layout-gap:14px;
  --hmb-layout-pad:clamp(12px,1.25vw,20px);
  --hmb-layout-radius:14px;
}
html,body{max-width:100%;overflow-x:hidden}
.app,.hmb-app-shell,main,.workspace,.content,.page-content,.admin-content{min-width:0}
.topbar,.brand,.header,.page-header,.app-header{box-sizing:border-box;min-width:0}
.panel,.card,.system-card,.kpi,.note,.userbox,.section,.toolbar,.bed-card,.prescription-card,.dashboard-card,.map-card,.kpi-card,.assistance-kpi{
  box-sizing:border-box;min-width:0;max-width:100%;
}
.section-head,.section-title,.card-head,.panel-head,.toolbar,.head-actions{
  min-width:0;box-sizing:border-box;
}
.section-head>*,.section-title>*,.card-head>*,.panel-head>*{min-width:0}
.grid,.form-grid,.systems-grid,.content-grid,.dashboard-grid,.cards-grid,.kpi-grid,.bed-grid,.map-grid{
  min-width:0;max-width:100%;
}
.grid>*,.form-grid>*,.systems-grid>*,.content-grid>*,.dashboard-grid>*,.cards-grid>*,.kpi-grid>*,.bed-grid>*,.map-grid>*{min-width:0}
input,select,textarea,button{max-width:100%}
.table-wrap,.history-table-wrap,.scroll-list{max-width:100%;overflow-x:auto}
@media(max-width:1366px){
  .topbar,.brand,.header,.page-header,.app-header{gap:12px}
  .panel,.card,.system-card,.section,.toolbar{min-width:0}
}
@media(max-width:900px){
  .topbar,.brand,.header,.page-header,.app-header{flex-wrap:wrap}
}

/* =========================================================
   HMEB — CORREÇÃO DEFINITIVA DA TELA DE ACESSO — 2026-09-10
   Corrige altura total, fundo, centralização e enquadramento.
   Não altera lógica, IDs, rotas ou autenticação.
   ========================================================= */
body:not(.portal-layout) .shell{
  min-height:100dvh;
  display:grid;
  grid-template-rows:auto minmax(0,1fr);
  background:var(--theme-bg);
}
body:not(.portal-layout) .shell > .brand{
  width:100%;
  margin:0;
  position:relative;
  z-index:2;
}
body:not(.portal-layout) .shell > main{
  width:100%;
  max-width:none!important;
  min-height:calc(100dvh - 80px);
  margin:0!important;
  padding:clamp(28px,4vh,48px) 20px 48px!important;
  top:0!important;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
  box-sizing:border-box;
}
body.gray:not(.portal-layout) .shell > main{
  background:#e9edf0;
}
body.dark:not(.portal-layout) .shell > main{
  background:var(--theme-bg);
}
body:not(.portal-layout) .shell > main > .auth-card{
  width:min(100%,520px);
  max-width:520px!important;
  margin:0 auto!important;
  flex:0 0 auto;
  box-sizing:border-box;
}
body.gray:not(.portal-layout) .shell > main > .auth-card{
  background:#f8fafb;
  color:#25292d;
  border-color:#9da3a9;
  box-shadow:0 18px 42px rgba(36,42,48,.14);
}
body.gray:not(.portal-layout) .auth-copy h2,
body.gray:not(.portal-layout) .form label{
  color:#25292d;
}
body.gray:not(.portal-layout) .auth-copy p{
  color:#6d737a;
}
body.gray:not(.portal-layout) .form input,
body.gray:not(.portal-layout) .form select{
  background:#fff;
  color:#25292d;
  border-color:#aeb4ba;
}
body.gray:not(.portal-layout) .form input:focus,
body.gray:not(.portal-layout) .form select:focus{
  border-color:#676d73;
  box-shadow:0 0 0 3px rgba(70,74,78,.12);
  outline:0;
}
body.gray:not(.portal-layout) .primary{
  background:#55595d;
  color:#fff;
  border-color:#55595d;
  box-shadow:0 8px 18px rgba(43,47,51,.18);
}
body.gray:not(.portal-layout) .primary:hover{
  background:#45494d;
}
body.gray:not(.portal-layout) .linkbtn{
  color:#55595d;
}
body:not(.portal-layout) .hmeb-connection-strip{
  z-index:50;
}
@media(max-width:900px){
  body:not(.portal-layout) .shell > main{
    min-height:calc(100dvh - 72px);
    padding:24px 16px 40px!important;
  }
}
@media(max-width:560px){
  body:not(.portal-layout) .shell > main{
    padding:18px 12px 32px!important;
  }
  body:not(.portal-layout) .shell > main > .auth-card{
    width:100%;
    border-radius:14px!important;
    padding:22px 18px!important;
  }
}


/* =========================================================
   HMEB — SELETOR DE TEMA NA TELA DE LOGIN — 2026-09-10
   O mesmo tema é persistido no localStorage e usado nos módulos.
   ========================================================= */
body:not(.portal-layout) #authView{position:relative;}
body:not(.portal-layout) #authView .auth-card-tools{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  min-height:36px;
  margin:-8px -6px 4px 0;
}
body:not(.portal-layout) #authView .hmb-theme-login{
  display:flex;
  align-items:center;
  gap:8px;
}
body:not(.portal-layout) #authView .hmb-theme-login label{
  margin:0!important;
  font-size:10px!important;
  font-weight:800!important;
  letter-spacing:.08em!important;
  text-transform:uppercase!important;
  color:var(--theme-muted)!important;
}
body:not(.portal-layout) #authView .hmb-theme-login select{
  width:auto!important;
  min-width:102px!important;
  height:36px!important;
  padding:0 30px 0 11px!important;
  border-radius:10px!important;
  background:var(--theme-input)!important;
  color:var(--theme-text)!important;
  border:1px solid var(--theme-border)!important;
  font-size:12px!important;
  font-weight:800!important;
  cursor:pointer!important;
  box-shadow:none!important;
}
body:not(.portal-layout) #authView .hmb-theme-login select:focus-visible{
  outline:2px solid #aeb4ba!important;
  outline-offset:2px!important;
}
body.gray:not(.portal-layout) #authView .hmb-theme-login select option{
  background:#f8fafb;
  color:#25292d;
}
body.dark:not(.portal-layout) #authView .hmb-theme-login select option{
  background:#202327;
  color:#f3f4f5;
}
body.dark:not(.portal-layout) .shell > main{
  background:#101214;
}
body.dark:not(.portal-layout) .shell > main > .auth-card{
  background:#181b1e;
  color:#f3f4f5;
  border-color:#30353a;
  box-shadow:0 18px 46px rgba(0,0,0,.34);
}
body.dark:not(.portal-layout) .auth-copy h2,
body.dark:not(.portal-layout) .form label{color:#f3f4f5;}
body.dark:not(.portal-layout) .auth-copy p{color:#9da3aa;}
body.dark:not(.portal-layout) .form input,
body.dark:not(.portal-layout) .form select{
  background:#202327;
  color:#f3f4f5;
  border-color:#3a3f45;
}
body.dark:not(.portal-layout) .primary{
  background:#d9dde1;
  color:#17191b;
  border-color:#d9dde1;
}
body.dark:not(.portal-layout) .primary:hover{background:#f1f3f5;}
body.dark:not(.portal-layout) .linkbtn{color:#c7ccd1;}
@media(max-width:560px){
  body:not(.portal-layout) #authView .auth-card-tools{margin:-4px 0 8px;}
}

/* Keep professional category text vertically centered in native selects. */
#regCategory,
#profileCategory{
  height:46px!important;
  min-height:46px!important;
  padding:0 14px!important;
  line-height:normal!important;
  overflow:visible!important;
}

/* Authentication workspace inspired by the institutional split-panel layout. */
body:not(.portal-layout) .shell{
  display:grid;
  grid-template-columns:minmax(320px,40%) minmax(0,60%);
  grid-template-rows:minmax(100dvh,1fr);
  min-height:100dvh;
  padding:14px;
  gap:0;
  background:#e9eef4;
}
body:not(.portal-layout) .shell>.brand{display:none}
body:not(.portal-layout) .auth-visual{
  grid-column:1;
  grid-row:1;
  position:relative;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  min-width:0;
  padding:56px clamp(30px,4vw,58px) 42px;
  border-radius:24px 0 0 24px;
  color:#f8faff;
  background:
    radial-gradient(circle at 72% 38%,rgba(77,82,190,.48),transparent 24%),
    radial-gradient(circle at 38% 90%,rgba(57,31,117,.48),transparent 30%),
    linear-gradient(145deg,#1d214f 0%,#101529 48%,#070d17 100%);
}
body:not(.portal-layout) .auth-visual:before,
body:not(.portal-layout) .auth-visual:after{
  content:"";
  position:absolute;
  left:-18%;
  width:145%;
  height:210px;
  border:1px solid rgba(125,157,230,.25);
  border-left:0;
  border-right:0;
  border-radius:50%;
  transform:rotate(12deg);
  pointer-events:none;
}
body:not(.portal-layout) .auth-visual:before{top:27%;}
body:not(.portal-layout) .auth-visual:after{top:52%;transform:rotate(-8deg);border-color:rgba(148,112,239,.2)}
.auth-visual>*{position:relative;z-index:1}
.auth-visual-logo{display:flex;align-items:center;gap:12px;font-size:24px;letter-spacing:-.04em}
.auth-visual-logo span{display:grid;place-items:center;width:42px;height:42px;border-radius:12px;background:#fff;color:#20265b;font-size:25px;font-weight:900;transform:skew(-8deg)}
.auth-visual-logo strong{font-weight:800}
.auth-visual-copy{max-width:470px;margin-top:auto;margin-bottom:auto;padding:70px 0 34px}
.auth-visual-kicker{display:block;margin-bottom:27px;font-size:10px;letter-spacing:.17em;font-weight:800;color:#cbd5f4;white-space:nowrap}
.auth-visual-kicker:before{content:"";display:inline-block;width:34px;margin:0 12px 3px 0;border-top:1px solid #8ea9df}
.auth-visual-copy h1{margin:0;font-size:clamp(42px,4.2vw,68px);line-height:.98;letter-spacing:-.065em;font-weight:800}
.auth-visual-copy h1 em{font-style:normal;color:#66c9f2}
.auth-visual-copy p{max-width:400px;margin:28px 0 0;color:#c1c9dd;font-size:14px;line-height:1.7}
.auth-visual-tags{display:flex;flex-wrap:wrap;gap:10px}
.auth-visual-tags span{padding:9px 14px;border:1px solid rgba(255,255,255,.18);border-radius:999px;background:rgba(255,255,255,.08);font-size:11px;color:#d6def4}
.auth-theme-toggle{position:absolute!important;top:24px;right:24px;z-index:2;border:1px solid rgba(255,255,255,.25);background:rgba(255,255,255,.1);color:#fff;border-radius:50%;width:38px;height:38px;min-height:38px;padding:0}
body:not(.portal-layout) .shell>main{
  grid-column:2;
  grid-row:1;
  align-items:center;
  justify-content:center;
  min-width:0;
  min-height:0;
  height:calc(100dvh - 28px);
  overflow:auto;
  padding:42px 28px 48px!important;
  border-radius:0 24px 24px 0;
  background:#fff;
}
body:not(.portal-layout) .shell>main>.auth-card{width:min(100%,468px);max-width:468px}
body:not(.portal-layout) #authView .auth-copy .pill,
body:not(.portal-layout) #profileView .auth-copy .pill,
body:not(.portal-layout) #securityView .auth-copy .pill{background:transparent;border:0;color:#3768f2;padding:0;font-size:10px;letter-spacing:.18em}
body:not(.portal-layout) #authView .auth-copy h2,
body:not(.portal-layout) #profileView .auth-copy h2,
body:not(.portal-layout) #securityView .auth-copy h2{font-size:38px;line-height:1.08;color:#141b33;margin-top:18px}
body:not(.portal-layout) #authView .auth-copy p,
body:not(.portal-layout) #profileView .auth-copy p,
body:not(.portal-layout) #securityView .auth-copy p{font-size:14px;color:#60708e}
body:not(.portal-layout) #authView .form,
body:not(.portal-layout) #profileView .form,
body:not(.portal-layout) #securityView .form{margin-top:32px;gap:16px}
body:not(.portal-layout) #authView .form label,
body:not(.portal-layout) #profileView .form label,
body:not(.portal-layout) #securityView .form label{font-size:12px;color:#18213b}
body:not(.portal-layout) #authView .form input,
body:not(.portal-layout) #authView .form select,
body:not(.portal-layout) #profileView .form input,
body:not(.portal-layout) #profileView .form select,
body:not(.portal-layout) #securityView .form input{height:54px;border-radius:11px;background:#fff;border-color:#d7e0ed;padding:0 16px;box-shadow:none}
body:not(.portal-layout) #authView .form input:focus,
body:not(.portal-layout) #authView .form select:focus,
body:not(.portal-layout) #profileView .form input:focus,
body:not(.portal-layout) #profileView .form select:focus,
body:not(.portal-layout) #securityView .form input:focus{border-color:#3568f5;box-shadow:0 0 0 3px rgba(53,104,245,.14)}
body:not(.portal-layout) #authView .primary,
body:not(.portal-layout) #profileView .primary,
body:not(.portal-layout) #securityView .primary{height:52px;border-radius:999px;background:linear-gradient(90deg,#2860df,#3271f1);box-shadow:0 12px 25px rgba(48,101,231,.22)}
.auth-security-note{margin-top:auto;padding-top:30px;color:#61718d;font-size:11px;text-align:center}
.system-card-disabled{opacity:.72;filter:saturate(.35)}
.system-card-disabled .system-disabled{cursor:not-allowed;background:#7b8791!important;box-shadow:none!important}
.system-card-disabled .system-disabled:hover{transform:none!important;filter:none}
body.portal-layout .auth-security-note{display:none}
body.portal-layout .auth-visual{display:none!important}
@media(max-width:760px){
  body:not(.portal-layout) .shell{display:block;padding:0;background:#fff}
  body:not(.portal-layout) .auth-visual{display:none}
  body:not(.portal-layout) .shell>main{height:100dvh;min-height:100dvh;border-radius:0;padding:38px 22px 42px!important}
  body:not(.portal-layout) #authView .auth-copy h2,
  body:not(.portal-layout) #profileView .auth-copy h2,
  body:not(.portal-layout) #securityView .auth-copy h2{font-size:32px}
}

/* Login standalone: only the access card remains visible. */
body:not(.portal-layout):has(#loginForm:not(.hidden)) .shell{
  display:block;
  min-height:100dvh;
  padding:0;
  background:#edf2f6;
}
body:not(.portal-layout):has(#loginForm:not(.hidden)) .auth-visual,
body:not(.portal-layout):has(#loginForm:not(.hidden)) .shell>.brand{display:none!important}
body:not(.portal-layout):has(#loginForm:not(.hidden)) .shell>main{
  display:flex;
  align-items:flex-start;
  justify-content:center;
  width:100%;
  height:auto;
  min-height:100dvh;
  padding:20px 20px 32px!important;
  border-radius:0;
  background:#edf2f6;
}
body:not(.portal-layout):has(#loginForm:not(.hidden)) #authView{
  width:min(100%,468px);
  max-width:468px;
  margin:0 auto;
  padding:30px;
  border:1px solid #cad8e2;
  border-radius:16px;
  background:#fff;
  box-shadow:0 15px 35px rgba(26,67,99,.1);
}
body:not(.portal-layout):has(#loginForm:not(.hidden)) #authView .auth-copy h2{
  margin:18px 0 0;
  font-size:38px;
  line-height:1.08;
}
body:not(.portal-layout):has(#loginForm:not(.hidden)) #authView .form{margin-top:32px}
body:not(.portal-layout):has(#loginForm:not(.hidden)) #authView .form input{
  height:54px;
  background:#e8f1fd;
  border-color:#c5d6e8;
}
body:not(.portal-layout):has(#loginForm:not(.hidden)) #authView .primary{
  height:52px;
  background:linear-gradient(135deg,#176da6,#12527e);
}
body:not(.portal-layout):has(#loginForm:not(.hidden)) #authView .linkbtn{
  justify-self:center;
  width:max-content;
  padding:10px 12px;
  border-radius:10px;
  background:#176da6;
  color:#fff;
}
body:not(.portal-layout):has(#loginForm:not(.hidden)) .auth-security-note{margin-top:66px}

/* Registration standalone: keep the complete form without the landing panel. */
body:not(.portal-layout):has(#registerForm:not(.hidden)) .shell{
  display:block;
  min-height:100dvh;
  padding:0;
  background:#edf2f6;
}
body:not(.portal-layout):has(#registerForm:not(.hidden)) .auth-visual,
body:not(.portal-layout):has(#registerForm:not(.hidden)) .shell>.brand{display:none!important}
body:not(.portal-layout):has(#registerForm:not(.hidden)) .shell>main{
  display:flex;
  align-items:flex-start;
  justify-content:center;
  width:100%;
  min-height:100dvh;
  height:auto;
  overflow:auto;
  padding:20px!important;
  border-radius:0;
  background:#edf2f6;
}
body:not(.portal-layout):has(#registerForm:not(.hidden)) #authView{
  width:min(100%,468px);
  max-width:468px;
  margin:0 auto;
  padding:30px;
  border:1px solid #cad8e2;
  border-radius:16px;
  background:#fff;
  box-shadow:0 15px 35px rgba(26,67,99,.1);
}
body:not(.portal-layout):has(#registerForm:not(.hidden)) #authView .auth-copy h2{
  margin:18px 0 0;
  font-size:38px;
  line-height:1.08;
}
body:not(.portal-layout):has(#registerForm:not(.hidden)) #authView .form{margin-top:24px;gap:14px}
body:not(.portal-layout):has(#registerForm:not(.hidden)) #authView .form input,
body:not(.portal-layout):has(#registerForm:not(.hidden)) #authView .form select{
  height:46px;
  background:#e8f1fd;
  border-color:#c5d6e8;
}
body:not(.portal-layout):has(#registerForm:not(.hidden)) #authView .primary{
  height:52px;
  background:linear-gradient(135deg,#176da6,#12527e);
}
body:not(.portal-layout):has(#registerForm:not(.hidden)) #authView .linkbtn{
  justify-self:center;
  width:max-content;
  padding:10px 12px;
  border-radius:10px;
  background:#176da6;
  color:#fff;
}
body:not(.portal-layout):has(#registerForm:not(.hidden)) .auth-security-note{margin-top:40px}

/* =========================================================
   HMEB — PORTAL PRINCIPAL: ENQUADRAMENTO + TEMA — 2026-09-10
   Corrige ocupação vertical, cards, cabeçalho e alternância Cinza/Escuro.
   ========================================================= */
body.portal-layout{
  min-height:100dvh;
  overflow-x:hidden;
}
body.portal-layout .shell{
  min-height:100dvh;
  background:var(--theme-bg);
}
body.portal-layout .brand{
  position:relative;
  z-index:20;
  min-height:74px;
  padding:14px 28px;
  align-items:center;
}
body.portal-layout .brand-main{min-width:0;}
body.portal-layout .brand .eyebrow{font-size:9px;}
body.portal-layout .brand h1{font-size:24px;line-height:1.15;margin:2px 0 0;}
body.portal-layout .brand .hmb-theme-system{display:flex!important;}
body.portal-layout main{
  min-height:calc(100dvh - 74px);
  background:var(--theme-bg);
  padding:20px clamp(18px,2vw,32px) 34px!important;
}
body.portal-layout #portalView{
  min-height:calc(100dvh - 128px);
  display:flex;
  flex-direction:column;
}
body.portal-layout #portalView.hidden{display:none!important;}
body.portal-layout .portal-head{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:18px;
  margin:0 0 18px;
}
body.portal-layout .portal-head>div:first-child{min-width:0;}
body.portal-layout .portal-head .pill{margin-bottom:8px;}
body.portal-layout .portal-head h2{margin:0 0 4px;font-size:20px;}
body.portal-layout .portal-head p{margin:0;font-size:12px;}
body.portal-layout .userbox{
  display:flex;
  align-items:center;
  gap:14px;
  min-height:52px;
  padding:7px 9px 7px 14px;
  border-radius:14px;
  white-space:nowrap;
}
body.portal-layout .userbox>strong{font-size:12px;max-width:220px;overflow:hidden;text-overflow:ellipsis;}
body.portal-layout .userbox-actions{display:flex;align-items:center;gap:8px;}
body.portal-layout .hmb-theme-inline{display:flex!important;align-items:center;gap:6px;}
body.portal-layout .hmb-theme-inline label{font-size:9px!important;letter-spacing:.08em;font-weight:800;color:var(--theme-muted)!important;}
body.portal-layout .hmb-theme-inline select{
  min-width:88px!important;
  height:36px!important;
  padding:0 28px 0 10px!important;
  border-radius:9px!important;
  background:var(--theme-input)!important;
  color:var(--theme-text)!important;
  border:1px solid var(--theme-border)!important;
  font-size:11px!important;
  font-weight:800!important;
  box-shadow:none!important;
}
body.portal-layout .userbox button{min-height:36px;padding:0 12px;border-radius:9px;}
body.portal-layout .systems-grid{
  width:100%;
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  align-items:stretch;
}
body.portal-layout .system-card{
  min-height:224px;
  height:100%;
  padding:18px;
  border-radius:16px;
  display:flex;
  flex-direction:column;
}
body.portal-layout .system-icon{width:44px;height:44px;border-radius:11px;font-size:15px;}
body.portal-layout .system-card h3{margin:14px 0 7px;font-size:17px;line-height:1.25;}
body.portal-layout .system-card p{margin:0 0 14px;font-size:12px;line-height:1.5;min-height:36px;}
body.portal-layout .system-card .enter{margin-top:auto;min-height:40px;padding:10px 12px;border-radius:9px;}
body.portal-layout .system-card small{margin-top:8px;font-size:10px;}
body.portal-layout .note{
  margin-top:16px;
  padding:12px 14px;
  border-radius:12px;
  font-size:11px;
}
body.portal-layout.gray,
body.portal-layout.gray .shell,
body.portal-layout.gray main{background:#e9edef!important;}
body.portal-layout.gray .auth-card,
body.portal-layout.gray .system-card,
body.portal-layout.gray .panel,
body.portal-layout.gray .kpi,
body.portal-layout.gray .note,
body.portal-layout.gray .userbox{background:#f8fafb!important;color:#25292d!important;border-color:#d0d5da!important;}
body.portal-layout.gray .system-card p,
body.portal-layout.gray .system-card small,
body.portal-layout.gray .portal-head p{color:#69727a!important;}
body.portal-layout.dark,
body.portal-layout.dark .shell,
body.portal-layout.dark main{background:#101214!important;}
body.portal-layout.dark .auth-card,
body.portal-layout.dark .system-card,
body.portal-layout.dark .panel,
body.portal-layout.dark .kpi,
body.portal-layout.dark .note,
body.portal-layout.dark .userbox{background:#181b1e!important;color:#f3f4f5!important;border-color:#30353a!important;}
body.portal-layout.dark .system-card p,
body.portal-layout.dark .system-card small,
body.portal-layout.dark .portal-head p{color:#9da3aa!important;}
body.portal-layout.dark .system-icon{background:#23272b!important;color:#d5d9dd!important;border-color:#3a3f45!important;}
body.portal-layout.dark .system-card .enter{background:#d9dde1!important;color:#17191b!important;}
body.portal-layout.dark .system-card .enter:hover{background:#f1f3f5!important;}
body.portal-layout.dark .secondary-btn,
body.portal-layout.dark .userbox button{background:#25292d!important;color:#f3f4f5!important;border-color:#3a3f45!important;}
body.portal-layout.dark .hmb-theme-inline select{background:#202327!important;color:#f3f4f5!important;border-color:#3a3f45!important;}
body.portal-layout.dark .hmb-theme-inline select option{background:#202327;color:#f3f4f5;}
body.portal-layout.gray .hmb-theme-inline select option{background:#f8fafb;color:#25292d;}
@media(max-width:1500px){body.portal-layout .systems-grid{grid-template-columns:repeat(2,minmax(0,1fr));}}
@media(max-width:980px){
  body.portal-layout .portal-head{grid-template-columns:1fr;align-items:stretch;}
  body.portal-layout .userbox{justify-content:space-between;white-space:normal;}
}
@media(max-width:780px){
  body.portal-layout main{min-height:calc(100dvh - 74px);padding:14px 12px 28px!important;}
  body.portal-layout #portalView{min-height:calc(100dvh - 108px);}
  body.portal-layout .systems-grid{grid-template-columns:1fr;}
  body.portal-layout .userbox{align-items:flex-start;flex-direction:column;}
  body.portal-layout .userbox-actions{width:100%;flex-wrap:wrap;}
}


/* =========================================================
   HMEB — TEMA ESCURO AZUL-MARINHO — 2026-09-10
   Substitui o escuro preto por azul hospitalar profundo.
   ========================================================= */
body.dark,
body.portal-layout.dark{
  --theme-bg:#0f1b26!important;
  --theme-panel:#152433!important;
  --theme-panel2:#1b2d3f!important;
  --theme-text:#f2f6f9!important;
  --theme-muted:#a8b7c4!important;
  --theme-border:#30465a!important;
  --theme-input:#182a3a!important;
  --theme-head:#1b3144!important;
  --theme-head2:#122536!important;
  --theme-sidebar:#14293a!important;
  --theme-sidebar2:#0f2130!important;
  --theme-shadow:0 14px 34px rgba(4,17,29,.32)!important;
  --bg:#0f1b26!important;
  --bg2:#12202d!important;
  --panel:#152433!important;
  --panel2:#1b2d3f!important;
  --card:#152433!important;
  --text:#f2f6f9!important;
  --muted:#a8b7c4!important;
  --border:#30465a!important;
  --input:#182a3a!important;
  --header:#1b3144!important;
  --header2:#122536!important;
  --sidebar:#14293a!important;
  --sidebar2:#0f2130!important;
  --primary:#4f86ad!important;
  --primary2:#3b6e93!important;
  --accent:#83a9c4!important;
  --navy:#173047!important;
  --navy2:#102638!important;
}
body.dark{background:linear-gradient(180deg,#0f1b26 0%,#122130 100%)!important;color:#f2f6f9!important}
body.dark .brand,
body.dark .topbar,
body.dark .header,
body.dark .page-header,
body.dark .app-header{background:linear-gradient(105deg,#102638 0%,#1d3850 100%)!important;color:#f2f6f9!important;border-color:#30465a!important}
body.dark .hmb-sidebar,
body.dark .sidebar,
body.dark .side-nav{background:linear-gradient(180deg,#173047 0%,#0f2130 100%)!important;border-color:#30465a!important}
body.dark .auth-card,
body.dark .system-card,
body.dark .panel,
body.dark .card,
body.dark .kpi,
body.dark .note,
body.dark .userbox,
body.dark .toolbar,
body.dark .section,
body.dark .modal-card,
body.dark .dialog-card,
body.dark .app-dialog,
body.dark .bed-card,
body.dark .prescription-card,
body.dark .patient-panel,
body.dark .protocols-panel,
body.dark .editor-panel,
body.dark .dashboard-card,
body.dark .map-card,
body.dark .kpi-card,
body.dark .assistance-kpi,
body.dark .security-card,
body.dark .history-detail,
body.dark .preview-sheet{background:#152433!important;color:#f2f6f9!important;border-color:#30465a!important;box-shadow:0 14px 34px rgba(4,17,29,.28)!important}
body.dark input,
body.dark select,
body.dark textarea,
body.dark .input,
body.dark .select,
body.dark .search-input{background:#182a3a!important;color:#f2f6f9!important;border-color:#36516a!important}
body.dark input::placeholder,
body.dark textarea::placeholder{color:#8fa5b8!important;opacity:1!important}
body.dark input:focus,
body.dark select:focus,
body.dark textarea:focus{border-color:#6f9dbd!important;box-shadow:0 0 0 3px rgba(111,157,189,.16)!important;outline:none!important}
body.dark .secondary-btn,
body.dark .btn-secondary,
body.dark .userbox button{background:#1b2d3f!important;color:#f2f6f9!important;border-color:#36516a!important}
body.dark .primary,
body.dark .btn-primary,
body.dark .system-card .enter,
body.dark .action-primary{background:linear-gradient(135deg,#4f86ad 0%,#3c6f94 100%)!important;color:#fff!important;border-color:#568bb0!important;box-shadow:0 8px 18px rgba(17,61,91,.32)!important}
body.dark .primary:hover,
body.dark .btn-primary:hover,
body.dark .system-card .enter:hover{background:linear-gradient(135deg,#6096ba 0%,#487da3 100%)!important}
body.dark .pill,
body.dark .badge,
body.dark .tag,
body.dark .status,
body.dark .system-icon{background:#1c3144!important;color:#c7d8e4!important;border-color:#36516a!important}
body.dark th,
body.dark .scroll-list table th,
body.dark .history-table-wrap th,
body.dark .age-table-wrap th,
body.dark .professional-table-wrap th,
body.dark .admin-table-wrap th{background:#1b2d3f!important;color:#dce8f0!important;border-color:#30465a!important}
body.dark td,
body.dark .metric-row,
body.dark .perm-user{border-color:#2b4256!important}
body.dark tbody tr:hover{background:#1a2c3d!important}
body.dark .hmb-nav-item:hover,
body.dark .nav-item:hover,
body.dark .menu-item:hover{background:#20394e!important}
body.dark .hmb-nav-item.active,
body.dark .nav-item.active,
body.dark .menu-item.active{background:#284b67!important;color:#fff!important;box-shadow:inset 3px 0 0 #8cb2cb!important}
body.dark .hmb-theme-system select,
body.dark .hmb-theme-inline select,
body.dark .hmb-theme-modal select{background:#1b3144!important;color:#fff!important;border-color:#4a6780!important}
body.dark .hmb-theme-system select option,
body.dark .hmb-theme-inline select option,
body.dark .hmb-theme-modal select option{background:#152433!important;color:#f2f6f9!important}
body.dark .hmeb-connection-strip{background:rgba(19,38,54,.96)!important;color:#a8b7c4!important;border-color:#30465a!important}
body.dark dialog::backdrop,
body.dark .modal-backdrop{background:rgba(5,14,23,.72)!important}
body.dark ::-webkit-scrollbar-track{background:#0f1b26!important}
body.dark ::-webkit-scrollbar-thumb{background:#35536b!important;border-color:#0f1b26!important}
body.dark ::-webkit-scrollbar-thumb:hover{background:#466985!important}


/* HMEB V53 - controle único de tema sol/lua */
.hmb-theme-context,.auth-card-tools .hmb-theme-context,.hmb-theme-inline{display:none!important}
.hmb-theme-toggle{
  width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;
  padding:0!important;border-radius:12px!important;border:1px solid rgba(255,255,255,.22)!important;
  display:grid!important;place-items:center!important;cursor:pointer!important;
  background:rgba(255,255,255,.10)!important;color:#fff!important;box-shadow:none!important;
  transition:background .18s ease,transform .18s ease,border-color .18s ease!important;
}
.hmb-theme-toggle:hover{background:rgba(255,255,255,.18)!important;transform:translateY(-1px)}
.hmb-theme-toggle .theme-icon{font-size:21px;line-height:1;font-family:"Segoe UI Symbol","Arial Unicode MS",sans-serif}
body.dark .hmb-theme-toggle{background:#17324d!important;border-color:#365773!important;color:#f5d76e!important}
body.gray .hmb-theme-toggle{background:#68727a!important;border-color:#828b92!important;color:#fff4a8!important}
.userbox-actions{display:flex;align-items:center;gap:10px}
.portal-head .userbox{min-height:54px}
@media(max-width:700px){.hmb-theme-toggle{width:40px!important;height:40px!important;min-width:40px!important;min-height:40px!important}}


/* HMEB V54 — BOTÃO GLOBAL DE TEMA SOL/LUA */
.hmb-theme-select,.hmb-theme-selector-wrap{display:none!important}
.hmb-theme-toggle{
  width:42px!important;height:42px!important;min-width:42px!important;min-height:42px!important;
  padding:0!important;border-radius:12px!important;display:inline-grid!important;place-items:center!important;
  flex:0 0 42px!important;border:1px solid rgba(255,255,255,.22)!important;
  background:rgba(255,255,255,.10)!important;color:#fff!important;box-shadow:none!important;
  cursor:pointer!important;transition:background .18s ease,border-color .18s ease,transform .18s ease!important;
}
.hmb-theme-toggle:hover{background:rgba(255,255,255,.18)!important;border-color:rgba(255,255,255,.38)!important;transform:translateY(-1px)}
.hmb-theme-toggle:active{transform:translateY(0)}
.hmb-theme-toggle .theme-icon{font-size:21px!important;line-height:1!important;display:block!important;font-family:"Segoe UI Symbol","Noto Sans Symbols",sans-serif!important}
body.gray .hmb-theme-toggle{background:#5b6269!important;border-color:#747c84!important;color:#fff!important}
body.dark .hmb-theme-toggle{background:#17324d!important;border-color:#315b80!important;color:#f5d66f!important}
.modal-head .hmb-theme-toggle,.dialog-head .hmb-theme-toggle,.security-brand .hmb-theme-toggle,.login-brand .hmb-theme-toggle{margin-left:auto!important}
@media(max-width:700px){.hmb-theme-toggle{width:38px!important;height:38px!important;min-width:38px!important;min-height:38px!important;flex-basis:38px!important}.hmb-theme-toggle .theme-icon{font-size:19px!important}}


/* =========================================================
   HMEB V60 — PADRÃO GLOBAL CONSOLIDADO DE LAYOUT E TEMAS
   Aplicado ao Portal e a todos os módulos — 2026-09-10
   ========================================================= */
:root{
  --hmb-radius:12px;
  --hmb-gap:10px;
  --hmb-page-x:clamp(10px,1.15vw,20px);
  --hmb-page-y:12px;
  --hmb-card-border:#cdd5db;
}
body.gray{
  --theme-bg:#e9edf0!important;
  --theme-panel:#f8fafb!important;
  --theme-panel2:#eef2f4!important;
  --theme-text:#252d34!important;
  --theme-muted:#66727d!important;
  --theme-border:#cdd5db!important;
  --theme-input:#ffffff!important;
  --theme-header:#606b75!important;
  --theme-header2:#4b5660!important;
  --theme-sidebar:#46525c!important;
  --theme-sidebar2:#34404a!important;
}
body.dark{
  --theme-bg:#0f1b26!important;
  --theme-panel:#152433!important;
  --theme-panel2:#1b2d3f!important;
  --theme-text:#f2f6f9!important;
  --theme-muted:#a8b7c4!important;
  --theme-border:#30465a!important;
  --theme-input:#182a3a!important;
  --theme-header:#1d3850!important;
  --theme-header2:#102638!important;
  --theme-sidebar:#173047!important;
  --theme-sidebar2:#0f2130!important;
}
/* Portal HMEB — topo e área útil */
body.portal-layout .brand{margin-left:var(--hmb-side)!important;width:calc(100% - var(--hmb-side))!important;max-width:none!important;box-sizing:border-box!important}
body.portal-layout main{margin-left:var(--hmb-side)!important;width:calc(100% - var(--hmb-side))!important;max-width:none!important;box-sizing:border-box!important}
body:not(.portal-layout) .brand{width:100%!important;margin-left:0!important}
body:not(.portal-layout) main{width:100%!important;margin-left:auto!important;margin-right:auto!important}
body.portal-layout .systems-grid{grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:12px!important}
body.portal-layout .system-card{height:100%;min-height:220px!important}
@media(max-width:1400px){body.portal-layout .systems-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important}}
@media(max-width:1050px){body.portal-layout .systems-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}}
@media(max-width:780px){body.portal-layout .brand,body.portal-layout main{margin-left:0!important;width:100%!important}body.portal-layout .systems-grid{grid-template-columns:1fr!important}}


/* HMEB V62 — AGRUPAMENTO VISUAL DOS CARDS */
.portal-layout .systems-grid{gap:10px!important}
.portal-layout .system-card{box-shadow:0 3px 12px rgba(28,42,54,.06)!important}
.portal-layout .portal-head{margin-bottom:12px!important}
.portal-layout .note{margin-top:10px!important}

/* HMEB v70 - edição administrativa de cadastros */
.form-actions{display:flex;gap:10px;grid-column:1/-1}.form-actions>button{flex:1}.panel-help{margin:-4px 0 12px;color:#667788;font-size:12px}.table-edit-btn{border:0;border-radius:7px;background:#166fa3;color:#fff;font-weight:700;padding:7px 13px;cursor:pointer}.table-edit-btn:hover{filter:brightness(.94)}#patientsTable table,#professionalsTable table{width:100%}#patientsTable td,#patientsTable th,#professionalsTable td,#professionalsTable th{white-space:nowrap}.mini-form input[type=hidden]{display:none!important}

/* HMEB V71 - Administração em coluna única, usando toda a largura da tela */
#adminView.admin-view{
  width:100%;
  max-width:none;
}
#adminView .admin-grid{
  display:grid;
  grid-template-columns:minmax(0,1fr)!important;
  gap:18px;
  width:100%;
}
#adminView .admin-grid > .panel,
#adminView > .panel{
  width:100%;
  min-width:0;
  box-sizing:border-box;
}
/* Com os cards empilhados, os campos internos aproveitam a largura disponível. */
#adminView .mini-form{
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  align-items:end;
}
#adminView .mini-form .form-actions{
  grid-column:1/-1;
}
#adminView .inline-form{
  width:100%;
}
#adminView .inline-form input{
  min-width:0;
}
#adminView .scroll-list,
#adminView .scroll-list table{
  width:100%;
}
/* HMEB v50 - matriz de acesso de módulos por perfil */
#profilePermMatrix table{
  min-width:820px;
}
#profilePermMatrix th,
#profilePermMatrix td{
  text-align:center;
  white-space:nowrap;
}
#profilePermMatrix th:first-child,
#profilePermMatrix td:first-child{
  text-align:left;
  position:sticky;
  left:0;
  z-index:1;
  background:#fff;
}
#profilePermMatrix input[type="checkbox"]{
  width:16px;
  height:16px;
  cursor:pointer;
  accent-color:var(--navy,#1f4e79);
}
body.gray #profilePermMatrix th:first-child,
body.gray #profilePermMatrix td:first-child{
  background:#fff;
}
body.dark #profilePermMatrix th:first-child,
body.dark #profilePermMatrix td:first-child{
  background:var(--theme-panel2);
}
@media(max-width:760px){
  #adminView .mini-form{grid-template-columns:1fr}
  #adminView .inline-form{flex-direction:column}
  #adminView .inline-form button{width:100%}
}
.module-toggle{display:flex;align-items:center;gap:12px;padding:12px 14px;border:1px solid var(--theme-border);border-radius:12px;margin-bottom:8px;background:var(--theme-panel);color:var(--theme-text);cursor:pointer}
.module-toggle input{width:18px;height:18px;accent-color:var(--accent);cursor:pointer}
.module-toggle-name{font-weight:700;flex:1;color:var(--theme-text)}
.module-toggle small{color:var(--theme-muted);font-size:12px;text-align:right}
.module-toggle:has(input:not(:checked)){opacity:.75}
.perm-select{width:100%;max-width:440px;padding:10px 12px;border:1px solid var(--theme-border);border-radius:10px;background:var(--theme-input);color:var(--theme-text);font-weight:700;margin-bottom:14px;cursor:pointer}
.perm-level{max-width:280px;margin-bottom:0}
/* Profissionais e produção - status, ações e modal de edição */
.prof-status{padding:3px 10px;border-radius:999px;font-size:11px;font-weight:800;letter-spacing:.4px;white-space:nowrap;display:inline-block}
.prof-status.active{background:#dff2e3;color:#1e7c3f}
.prof-status.inactive{background:#fbe4e4;color:#a53f3f}
.prof-row-inactive td{opacity:.6}
.prof-actions{white-space:nowrap;text-align:right}
.prof-actions button{margin-left:6px;padding:3px 9px;font-size:12px;font-weight:600;border-radius:8px;border:1px solid var(--theme-border,#cfd4d8);background:transparent;color:inherit;cursor:pointer}
.prof-actions button:hover{border-color:var(--theme-text,#333)}
.prof-actions button.danger:hover{color:#a53f3f;border-color:#a53f3f}
.prof-modal{width:min(560px,calc(100vw - 32px));max-height:calc(100vh - 32px);overflow:auto;border:1px solid var(--theme-border,#cfd4d8);border-radius:14px;background:var(--theme-panel,#fff);color:var(--theme-text,#222426);padding:0}
.prof-modal::backdrop{background:rgba(0,0,0,.6)}
.prof-modal .modal-head{display:flex;align-items:center;gap:10px;padding:14px 16px}
.prof-modal .modal-head h3{margin:0;font-size:15px;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.prof-modal form{padding:0 16px 16px}
/* Mesclar profissionais parecidos */
.prof-toolbar{display:flex;align-items:center;gap:10px;margin:0 0 10px}
.prof-toolbar .secondary-btn{white-space:nowrap}
#professionalMergeDialog{width:min(720px,calc(100vw - 32px))}
.merge-group{border:1px solid var(--theme-border,#cfd4d8);border-radius:12px;padding:10px;margin-bottom:12px;background:var(--theme-panel,#fff)}
.merge-group-motivo{font-weight:700;margin:0 0 8px}
.merge-row{display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:8px 10px;border-radius:10px;margin-bottom:4px;cursor:pointer}
.merge-row:hover{background:#eef3f8}
.merge-row input{width:18px;height:18px;accent-color:var(--accent,#1f6fb2);cursor:pointer}
.merge-row-main{font-weight:700}
.merge-row-main small{font-weight:600;color:var(--theme-muted,#5b6b7f)}
.merge-row-sub{color:var(--theme-muted,#5b6b7f);font-size:12px;width:100%;padding-left:28px}
.merge-group-foot{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-top:8px;padding-left:2px}
.merge-group-btn{white-space:nowrap;padding:7px 14px;font-size:13px;font-weight:700;border-radius:10px;border:1px solid var(--accent,#1f6fb2);background:var(--accent,#1f6fb2);color:#fff;cursor:pointer}
.merge-group-btn:hover:not(:disabled){opacity:.88}
.merge-group-btn:disabled{opacity:.6;cursor:default}
.merge-status{font-size:13px;font-weight:600;color:var(--theme-muted,#5b6b7f)}
.merge-group.done{border-color:#4d9a63;background:#eef7ef}
.merge-group.done .merge-group-btn{background:#4d9a63;border-color:#4d9a63}
.merge-group.done .merge-status{color:#2c7a45}
