:root{--azul:#0b4dbb;--azul2:#102d69;--bg:#f4f7fb;--b:#dbe4f0;--txt:#14213d;--muted:#61708a;--green:#20a35b;--red:#e5484d;--orange:#f59e0b;--purple:#3157e8}*{box-sizing:border-box}body{margin:0;font-family:Segoe UI,Arial,sans-serif;background:var(--bg);color:var(--txt)}a{cursor:pointer}.app,.layout{display:grid;grid-template-columns:270px 1fr;min-height:100vh}.side{background:linear-gradient(180deg,#061a46,#0a2c6c);color:white;padding:18px 14px;position:sticky;top:0;height:100vh}.brand{display:flex;gap:12px;align-items:center;margin-bottom:24px}.brand-mark,.logo{width:42px;height:42px;border-radius:14px;background:#3867ff;display:grid;place-items:center;font-size:18px;color:white;font-weight:900;overflow:hidden}.logo img{width:100%;height:100%;object-fit:cover}.logo-preview{max-width:180px;max-height:90px;border:1px solid var(--b);border-radius:10px;padding:8px;background:white}.logo-empty{border:1px dashed var(--b);border-radius:10px;padding:22px;color:var(--muted);background:#f8fafc;text-align:center}.brand b{font-size:20px}.brand span{font-size:12px;opacity:.8}.clinic{border:1px solid rgba(255,255,255,.2);border-radius:10px;padding:12px;margin-bottom:20px}.side h2{display:none}.side p{border:1px solid rgba(255,255,255,.2);border-radius:10px;padding:12px;margin-bottom:20px}.side a{display:block;color:white;text-decoration:none;padding:12px 14px;border-radius:9px;margin:3px 0}.side a.active,.side a:hover{background:#3157e8}.main{display:flex;flex-direction:column;min-width:0}.main>.top{height:64px;background:white;border-bottom:1px solid var(--b);display:flex;align-items:center;gap:20px;padding:0 22px;margin:0;border-radius:0;box-shadow:none}.top h1{font-size:18px;margin:0}.top-search{background:#f7f9fc;border:1px solid var(--b);border-radius:8px;padding:11px 14px;min-width:360px;color:var(--muted)}.spacer{flex:1}.content{padding:18px 22px}.main>div:not(.top){padding:18px 22px}.btn{border:1px solid var(--b);background:white;border-radius:8px;padding:10px 14px;font-weight:600;cursor:pointer;color:var(--txt);text-decoration:none;display:inline-block}.btn.primary,.btn.green{background:#2754e8;color:white;border-color:#2754e8}.btn.secondary{background:#eef4ff}.btn.red{background:var(--red);color:white}.breadcrumb{color:#3157e8;font-size:13px;margin-bottom:12px}.card,.panel,.stat{background:white;border:1px solid var(--b);border-radius:10px;box-shadow:0 2px 8px #102d6910}.panel{padding:18px;margin-bottom:16px}.grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:16px}.stat{padding:18px}.stat b{font-size:26px;color:var(--txt)}.table{width:100%;border-collapse:collapse;background:white}.table th,.table td{padding:10px;border-bottom:1px solid var(--b);text-align:left;font-size:13px}.table th{background:#f8fafc}.badge,.status{padding:5px 9px;border-radius:999px;background:#eaf2ff;color:#0b4dbb;font-size:12px}.status.ok{background:#def7e9;color:#137a42}.row{display:grid;grid-template-columns:1fr 1fr;gap:12px}.row3,.formline{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.field{margin-bottom:12px}.field label,label{display:block;font-weight:600;font-size:13px;margin-bottom:6px}input,select,textarea,.input,.area{width:100%;border:1px solid var(--b);border-radius:7px;background:white;padding:10px;margin-bottom:12px}textarea,.area{min-height:96px;resize:vertical}.searchbox{display:grid;grid-template-columns:1fr auto;gap:10px}.tabs{display:flex;border-bottom:1px solid var(--b);gap:4px;padding:0 14px;margin:0}.tab{padding:14px 13px;border-bottom:3px solid transparent;cursor:pointer;font-weight:600;font-size:14px;background:white;border-radius:0}.tab.active{color:#1f4eea;border-bottom-color:#1f4eea}.tabcontent{display:none}.tabcontent.active{display:block}.patient-grid{display:grid;grid-template-columns:230px 1fr 390px;gap:16px}.patient-card{padding:18px;text-align:center}.avatar{width:86px;height:86px;border-radius:50%;background:linear-gradient(135deg,#ffd2c0,#6ea8ff);margin:auto}.tag{display:inline-block;padding:5px 9px;border-radius:6px;background:#eaf2ff;color:#0b4dbb;font-size:12px;margin:4px}.tag.green{background:#ddf7e8;color:#137a42}.info{text-align:left;font-size:13px;line-height:1.5;margin-top:14px}.section{padding:16px}.soap{border:1px solid var(--b);border-radius:8px;margin-bottom:12px;overflow:hidden}.soap h3{margin:0;padding:10px 12px;background:#f8fafc;font-size:15px}.soap .letter{display:inline-grid;place-items:center;width:24px;height:24px;border-radius:5px;color:white;margin-right:8px}.s{background:#d94372}.o{background:#1684d9}.a{background:#c77913}.p{background:#1aa052}.tools{border-bottom:1px solid var(--b);padding:7px 10px;color:#23365f}.chars{text-align:right;color:var(--muted);font-size:12px;margin-top:4px}.sidecard{padding:14px;margin-bottom:14px}.vitals{display:grid;grid-template-columns:repeat(4,1fr);gap:0;text-align:center}.vitals div{border-right:1px solid var(--b);border-bottom:1px solid var(--b);padding:8px}.vitals div:nth-child(4n){border-right:0}.vitals b{display:block;font-size:18px}.list .item{display:flex;justify-content:space-between;gap:10px;border-top:1px solid var(--b);padding:10px 0;font-size:13px}.subtle,.muted{color:var(--muted);font-size:12px}.modal{display:none;position:fixed;inset:0;background:#07112680;align-items:center;justify-content:center;padding:25px;z-index:30}.modal.show{display:flex}.modal .card,.box{width:min(950px,95vw);max-height:90vh;overflow:auto;background:white;border-radius:12px;border:1px solid var(--b)}.box header{display:flex;justify-content:space-between;align-items:center;padding:18px 22px;border-bottom:1px solid var(--b)}.box main{padding:18px 22px}.alert-error{background:#fff0f0;color:#b83232;padding:10px 12px;border-radius:12px;border:1px solid #ffd6d6}.login{min-height:100vh;display:flex;align-items:center;justify-content:center;background:radial-gradient(circle at top left,#d5e6ff 0,#f4f7fb 35%,#eaf0fb 100%)}.login-card,.select-card{width:min(430px,94vw);padding:26px}.select-card{width:min(620px,94vw)}.empresa-options{display:grid;gap:12px;margin:18px 0}.empresa-option{display:flex;gap:12px;align-items:center;border:1px solid var(--b);border-radius:12px;padding:14px;background:#f8fafc;cursor:pointer}.empresa-option input{width:auto;margin:0}.print-area{background:white;padding:30px}.hidden{display:none}@media(max-width:1100px){.layout,.app{grid-template-columns:1fr}.side{display:none}.patient-grid{grid-template-columns:1fr}.top-search{min-width:0;width:100%}.grid{grid-template-columns:1fr 1fr}.row,.row3,.formline{grid-template-columns:1fr}}@media print{.side,.top,.no-print,.tabs,.btn{display:none!important}.layout,.app{display:block}.main{margin:0;padding:0}.panel,.card{box-shadow:none;border:0}.print-area{padding:0}body{background:white}}
.inline-action{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:start}.inline-action input{margin-bottom:0}.inline-action .btn{white-space:nowrap;height:42px}.btn.secondary{background:#eef4ff;color:#173b91;border-color:#cfe0ff}@media(max-width:700px){.inline-action{grid-template-columns:1fr}.inline-action .btn{width:100%}}

/* Ajuste visual da marca na lateral - V10 */
.brand-center{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  text-align:center;
  padding:10px 8px 16px;
  margin:0 0 16px;
  border-bottom:1px solid rgba(255,255,255,.13);
}
.logo-brand{
  width:142px;
  height:76px;
  border-radius:22px;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.16);
  box-shadow:0 10px 28px rgba(0,0,0,.20);
  padding:8px;
}
.logo-brand img{
  width:100%;
  height:100%;
  object-fit:contain;
  border-radius:16px;
}
.logo-heart{font-size:34px;line-height:1}
.brand-title{
  width:100%;
  color:#fff;
  font-weight:900;
  font-size:20px;
  line-height:1.25;
  text-transform:uppercase;
  letter-spacing:.3px;
  overflow-wrap:anywhere;
}
.brand-subtitle{
  color:#d9e6ff;
  font-size:13px;
  line-height:1.3;
}
.brand-divider{
  display:flex;
  align-items:center;
  gap:8px;
  width:100%;
  color:#6fa8ff;
  opacity:.9;
  justify-content:center;
}
.brand-divider:before,.brand-divider:after{
  content:"";
  height:1px;
  background:rgba(111,168,255,.35);
  flex:1;
  max-width:76px;
}
.brand-divider span{font-size:20px;line-height:1}
.side .clinic{margin-top:14px}
@media(max-height:760px){.logo-brand{width:112px;height:58px}.brand-title{font-size:16px}.brand-subtitle{font-size:12px}.brand-center{padding-bottom:10px;margin-bottom:10px}.side a{padding:9px 12px}}

/* V11 - Correção definitiva da logo na lateral: sem corte e centralizada */
.side{
  overflow-y:auto;
  overflow-x:hidden;
}
.side .brand-center{
  width:100%;
  min-height:auto;
  padding:14px 8px 18px;
  margin:0 0 16px;
  border:1px solid rgba(255,255,255,.12);
  border-radius:14px;
  background:rgba(255,255,255,.035);
}
.side .logo-brand,
.side .brand-center .logo,
.side .brand-center .brand-mark{
  width:190px !important;
  max-width:100% !important;
  height:105px !important;
  min-height:105px !important;
  padding:10px !important;
  margin:0 auto 8px !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  overflow:visible !important;
  border-radius:20px !important;
  background:rgba(0,0,0,.16) !important;
}
.side .logo-brand img,
.side .brand-center .logo img{
  display:block !important;
  width:100% !important;
  height:100% !important;
  max-width:100% !important;
  max-height:100% !important;
  object-fit:contain !important;
  object-position:center center !important;
  border-radius:12px !important;
}
.side .brand-title{
  display:block;
  width:100%;
  max-width:215px;
  margin:0 auto;
  text-align:center;
  font-size:18px;
  line-height:1.22;
  white-space:normal;
  word-break:normal;
  overflow-wrap:break-word;
}
.side .brand-subtitle{
  text-align:center;
  max-width:215px;
  margin:2px auto 0;
}
@media(max-height:760px){
  .side .logo-brand,
  .side .brand-center .logo,
  .side .brand-center .brand-mark{
    width:170px !important;
    height:90px !important;
    min-height:90px !important;
  }
  .side .brand-title{font-size:16px;}
}


/* V12 - Organização definitiva da barra lateral após ajuste da logo */
.layout,.app{grid-template-columns:280px 1fr;}
.side{
  display:flex !important;
  flex-direction:column !important;
  gap:12px !important;
  padding:14px 14px !important;
  height:100vh !important;
  overflow-y:auto !important;
  overflow-x:hidden !important;
}
.side .brand-center{
  flex:0 0 auto !important;
  margin:0 !important;
  padding:12px 10px !important;
  border-radius:16px !important;
  background:rgba(255,255,255,.045) !important;
}
.side .logo-brand,
.side .brand-center .logo,
.side .brand-center .brand-mark{
  width:168px !important;
  height:86px !important;
  min-height:86px !important;
  max-height:86px !important;
  padding:8px !important;
  margin:0 auto 6px !important;
  overflow:hidden !important;
}
.side .logo-brand img,
.side .brand-center .logo img{
  object-fit:contain !important;
  object-position:center center !important;
  width:100% !important;
  height:100% !important;
}
.side .brand-title{
  max-width:230px !important;
  font-size:16px !important;
  line-height:1.18 !important;
  margin-top:2px !important;
}
.side .brand-subtitle{
  max-width:230px !important;
  font-size:12px !important;
  line-height:1.2 !important;
}
.side .brand-divider{display:none !important;}
.side .clinic{
  flex:0 0 auto !important;
  margin:0 !important;
  padding:10px 12px !important;
  line-height:1.35 !important;
}
.side nav{
  flex:1 1 auto !important;
  display:flex !important;
  flex-direction:column !important;
  gap:4px !important;
  min-height:0 !important;
}
.side nav a,
.side a{
  margin:0 !important;
  padding:10px 12px !important;
  min-height:40px !important;
  display:flex !important;
  align-items:center !important;
  border-radius:10px !important;
  line-height:1.15 !important;
}
.side-user{
  flex:0 0 auto !important;
  position:static !important;
  margin-top:auto !important;
  padding:12px 10px 2px !important;
  border-top:1px solid rgba(255,255,255,.16) !important;
  color:#fff !important;
  line-height:1.35 !important;
}
@media(max-height:760px){
  .side{gap:8px !important;padding:10px 12px !important;}
  .side .logo-brand,
  .side .brand-center .logo,
  .side .brand-center .brand-mark{width:140px !important;height:68px !important;min-height:68px !important;}
  .side .brand-title{font-size:14px !important;}
  .side .brand-subtitle{font-size:11px !important;}
  .side nav a,.side a{padding:8px 10px !important;min-height:34px !important;font-size:13px !important;}
  .side .clinic{font-size:13px !important;padding:8px 10px !important;}
}


/* V13 - Sidebar recolhivel profissional */
:root{--sidebar-open:280px;--sidebar-closed:82px;--topbar-h:66px;--accent:#f59e0b;}
.layout,.app{grid-template-columns:var(--sidebar-open) 1fr;transition:grid-template-columns .25s ease;}
body.sidebar-collapsed .layout,body.sidebar-collapsed .app{grid-template-columns:var(--sidebar-closed) 1fr;}
.side{transition:width .25s ease,padding .25s ease;}
.side nav a{position:relative;gap:10px;white-space:nowrap;overflow:hidden;}
.menu-icon{width:24px;min-width:24px;display:inline-flex;align-items:center;justify-content:center;font-size:18px;line-height:1;}
.menu-text{transition:opacity .15s ease,transform .15s ease;}
.sidebar-toggle{width:40px;height:40px;border:1px solid var(--b);background:#fff;border-radius:12px;font-size:20px;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 2px 8px #102d6910;}
.sidebar-toggle:hover{background:#f5f8ff;border-color:#bfd3ff;}
.top .user-pill{display:flex;align-items:center;gap:8px;border:1px solid var(--b);border-radius:999px;padding:8px 12px;background:#fff;}
.top .company-pill{display:flex;align-items:center;gap:8px;border:1px solid #d7e3ff;border-radius:999px;padding:8px 12px;background:#f5f8ff;color:#173b91;font-weight:700;max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.quick-action{background:linear-gradient(135deg,#2754e8,#163b9b)!important;color:#fff!important;border-color:#2754e8!important;}
body.sidebar-collapsed .side{padding:12px 10px!important;align-items:center;}
body.sidebar-collapsed .side .brand-center{width:58px!important;padding:8px!important;border-radius:16px!important;}
body.sidebar-collapsed .side .logo-brand,body.sidebar-collapsed .side .brand-center .logo,body.sidebar-collapsed .side .brand-center .brand-mark{width:46px!important;height:46px!important;min-height:46px!important;max-height:46px!important;padding:5px!important;margin:0 auto!important;border-radius:14px!important;}
body.sidebar-collapsed .brand-title,body.sidebar-collapsed .brand-subtitle,body.sidebar-collapsed .clinic,body.sidebar-collapsed .side-user,body.sidebar-collapsed .menu-text{display:none!important;}
body.sidebar-collapsed .side nav{width:100%!important;align-items:center!important;gap:8px!important;}
body.sidebar-collapsed .side nav a{width:54px!important;height:48px!important;min-height:48px!important;padding:0!important;display:flex!important;justify-content:center!important;align-items:center!important;border-radius:16px!important;overflow:visible!important;}
body.sidebar-collapsed .side nav a:hover::after{content:attr(data-title);position:absolute;left:66px;top:50%;transform:translateY(-50%);background:#061a46;color:#fff;padding:8px 10px;border-radius:8px;box-shadow:0 8px 20px rgba(0,0,0,.2);font-size:13px;white-space:nowrap;z-index:99;}
body.sidebar-collapsed .side nav a:hover::before{content:"";position:absolute;left:58px;top:50%;transform:translateY(-50%);border:7px solid transparent;border-right-color:#061a46;z-index:100;}
.dashboard-hero{background:linear-gradient(135deg,#0a2c6c,#2754e8);color:#fff;border:0;border-radius:18px;padding:22px;margin-bottom:16px;display:grid;grid-template-columns:1.3fr .7fr;gap:18px;box-shadow:0 14px 32px rgba(11,77,187,.22);}
.dashboard-hero h2{margin:0 0 6px;font-size:24px}.dashboard-hero p{margin:0;color:#dce8ff}.hero-actions{display:flex;gap:10px;align-items:center;justify-content:flex-end;flex-wrap:wrap}.hero-actions .btn{border-color:rgba(255,255,255,.35)}
.stat{border-radius:16px;position:relative;overflow:hidden}.stat span{color:var(--muted);font-weight:700}.stat:after{content:"";position:absolute;right:-18px;top:-18px;width:64px;height:64px;border-radius:50%;background:#eef4ff;}
.stat-icon{width:42px;height:42px;border-radius:14px;display:flex;align-items:center;justify-content:center;background:#eef4ff;margin-bottom:10px;font-size:20px;}
.panel{border-radius:16px}.table tr:hover td{background:#fbfdff}.searchbox input{height:44px}.searchbox .btn{height:44px;}
@media(max-width:900px){.dashboard-hero{grid-template-columns:1fr}.hero-actions{justify-content:flex-start}.top .company-pill,.top .user-pill{display:none}.layout,.app,body.sidebar-collapsed .layout,body.sidebar-collapsed .app{grid-template-columns:1fr}.side{display:none!important}}


/* V14 - Agenda completa */
.calendar-toolbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:14px}.calendar-toolbar .btn.active{background:#2754e8;color:#fff;border-color:#2754e8}.calendar-layout{display:grid;grid-template-columns:1fr 330px;gap:16px}.calendar-card{background:#fff;border:1px solid var(--b);border-radius:14px;overflow:hidden;box-shadow:0 2px 8px #102d6910}.calendar-head{display:grid;grid-template-columns:repeat(7,1fr);background:#f8fafc;border-bottom:1px solid var(--b)}.calendar-head div{padding:12px;font-weight:700;text-align:center;color:#33415f;font-size:13px}.calendar-month{display:grid;grid-template-columns:repeat(7,1fr);min-height:620px}.calendar-day{border-right:1px solid var(--b);border-bottom:1px solid var(--b);padding:9px;min-height:108px;background:#fff}.calendar-day:nth-child(7n){border-right:0}.calendar-day.muted{background:#f8fafc;color:#97a3b8}.calendar-day.today{box-shadow:inset 0 0 0 2px #2754e8}.day-number{font-weight:800;margin-bottom:8px}.event-chip{display:block;text-decoration:none;border-radius:9px;padding:6px 7px;margin:4px 0;background:#eaf2ff;color:#0b4dbb;font-size:12px;line-height:1.25;border-left:4px solid #2754e8}.event-chip.google{background:#e9f8ef;color:#137a42;border-left-color:#20a35b}.agenda-list{display:grid;gap:10px}.agenda-item{border:1px solid var(--b);border-radius:12px;padding:12px;background:#fff}.agenda-time{font-weight:800;color:#0b4dbb}.calendar-filters{display:grid;grid-template-columns:repeat(5,1fr);gap:10px;margin-bottom:12px}.year-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}.year-card{background:#fff;border:1px solid var(--b);border-radius:14px;padding:14px}.week-grid,.day-grid{display:grid;gap:10px}.week-item,.day-hour{display:grid;grid-template-columns:130px 1fr;gap:12px;border-bottom:1px solid var(--b);padding:12px 0}.google-box{border:1px dashed #9bb7ee;background:#f8fbff;border-radius:14px;padding:14px}.google-status{display:inline-block;padding:5px 9px;border-radius:999px;background:#fff7e6;color:#9a6200;font-size:12px}.google-status.ok{background:#def7e9;color:#137a42}.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}
@media(max-width:1100px){.calendar-layout{grid-template-columns:1fr}.calendar-filters{grid-template-columns:1fr 1fr}.calendar-month{min-height:auto}.calendar-day{min-height:90px}.year-grid{grid-template-columns:1fr 1fr}}
@media(max-width:720px){.calendar-head,.calendar-month{grid-template-columns:1fr}.calendar-head{display:none}.calendar-day{border-right:0}.calendar-filters{grid-template-columns:1fr}.week-item,.day-hour{grid-template-columns:1fr}}

/* V15 - Correção e melhoria das sub-abas do prontuário */
.tabs.no-print{
  position:sticky;
  top:0;
  z-index:5;
  background:#fff;
  overflow-x:auto;
  scrollbar-width:thin;
}
.tabs.no-print .tab{
  user-select:none;
  white-space:nowrap;
  transition:color .15s ease, border-color .15s ease, background .15s ease;
}
.tabs.no-print .tab:hover{
  background:#f5f8ff;
  color:#1f4eea;
}
.tabcontent{
  display:none !important;
}
.tabcontent.active{
  display:block !important;
}
.risk-help{background:#f8fbff;border:1px solid var(--b);border-radius:10px;padding:12px 14px;margin-bottom:14px;line-height:1.65;color:#24324b}
.risk{font-weight:800}.risk.red{color:#dc2626}.risk.orange{color:#ea580c}.risk.yellow{color:#ca8a04}.risk.green{color:#16a34a}.risk.blue{color:#2563eb}
#classificacao_risco{font-weight:700}

/* V18 - Identidade Marte Doctor e Dashboard 2.0 */
:root{--mw-navy:#061a40;--mw-navy2:#031733;--mw-blue:#0967d8;--mw-cyan:#02b8c5;--mw-teal:#06b6c6;--mw-bg:#f4f8fc;--mw-card:#ffffff;--mw-border:#dbe7f3;--mw-text:#071b43;--mw-muted:#60708c;--mw-green:#13b97a;--mw-orange:#ff8a3d;--mw-purple:#7c5ce7;--mw-red:#ef476f;}
body{background:var(--mw-bg);color:var(--mw-text);font-family:Inter,Segoe UI,Arial,sans-serif}.layout,.app{grid-template-columns:288px 1fr}.medwise-side{background:linear-gradient(180deg,#05285b 0%,#031832 100%)!important;padding:18px 16px!important;overflow:auto;box-shadow:8px 0 26px rgba(7,27,67,.10)}.medwise-brand{display:block!important;text-align:left!important;margin:0 0 18px!important;padding:4px 0 14px!important;border-bottom:1px solid rgba(255,255,255,.12)}.logo-box{width:220px;height:116px;margin:0 auto;display:flex;align-items:center;justify-content:center;border-radius:18px;overflow:hidden;background:rgba(255,255,255,.96);padding:10px}.logo-box img{width:100%;height:100%;object-fit:contain}.side-nav{display:grid;gap:6px}.side a{display:flex!important;align-items:center;gap:14px;color:#fff!important;padding:12px 14px!important;border-radius:12px!important;font-weight:700}.side a.active,.side a:hover{background:linear-gradient(135deg,var(--mw-blue),var(--mw-cyan))!important}.menu-icon{width:24px;text-align:center;font-size:18px}.medwise-user{position:static!important;margin-top:24px;border:1px solid rgba(255,255,255,.14);border-radius:16px;padding:14px!important;display:flex;align-items:center;gap:12px;background:rgba(255,255,255,.06)}.mini-avatar{width:48px;height:48px;border-radius:50%;display:grid;place-items:center;background:#eaf4ff;color:#0b4dbb}.online-dot{color:#1fe38b}.collapse-link,.logout-link{margin-top:10px!important;background:transparent!important}.medwise-top{height:78px!important;background:rgba(255,255,255,.95)!important;backdrop-filter:blur(12px);box-shadow:0 2px 14px rgba(7,27,67,.07)}.medwise-search{max-width:560px;min-width:420px;border-radius:14px!important;background:#fff!important;padding:14px 18px!important}.company-pill,.user-pill{border:1px solid var(--mw-border);background:#fff;border-radius:14px;padding:12px 16px;font-weight:700}.top-icon{width:44px;height:44px;display:grid;place-items:center;border:1px solid var(--mw-border);border-radius:50%;background:#fff}.quick-action,.btn.primary,.btn.green{background:linear-gradient(135deg,var(--mw-blue),var(--mw-cyan))!important;border:0!important;color:white!important;box-shadow:0 8px 18px rgba(6,103,216,.20)}.content{padding:28px 32px!important}.card,.panel,.stat,.mw-card{border:1px solid var(--mw-border)!important;border-radius:18px!important;box-shadow:0 10px 28px rgba(7,27,67,.06)!important}.app-footer{padding:14px 32px;color:var(--mw-muted);font-size:13px}.app-footer span{float:right}.mw-dashboard-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin-bottom:22px}.mw-dashboard-head h1{margin:0 0 8px;font-size:30px}.mw-dashboard-head h1 span{color:var(--mw-cyan)}.date-card{background:white;border:1px solid var(--mw-border);border-radius:18px;padding:14px 18px;min-width:240px;box-shadow:0 8px 20px rgba(7,27,67,.05)}.mw-metrics{display:grid;grid-template-columns:repeat(5,1fr);gap:16px;margin-bottom:18px}.mw-metric{background:white;border:1px solid var(--mw-border);border-radius:18px;padding:20px;display:flex;gap:16px;align-items:flex-start}.mw-metric-icon{width:58px;height:58px;border-radius:14px;display:grid;place-items:center;font-size:25px;color:#fff}.bg-blue{background:linear-gradient(135deg,#0967d8,#0b8bff)}.bg-cyan{background:linear-gradient(135deg,#02b8c5,#00d1d1)}.bg-purple{background:linear-gradient(135deg,#7c5ce7,#9d7cff)}.bg-orange{background:linear-gradient(135deg,#ff8a3d,#ffb15c)}.bg-green{background:linear-gradient(135deg,#13b97a,#15d494)}.mw-metric small{display:block;color:var(--mw-muted);font-weight:600}.mw-metric b{font-size:31px}.mw-grid-main{display:grid;grid-template-columns:1.25fr 1fr .95fr;gap:18px;margin-bottom:18px}.mw-grid-bottom{display:grid;grid-template-columns:1.2fr 1fr;gap:18px}.mw-card{background:white;padding:20px}.mw-card h3{margin:0 0 16px}.line-chart{height:210px;width:100%}.chart-area{fill:url(#gradLine);opacity:.55}.chart-line{fill:none;stroke:#0967d8;stroke-width:4;stroke-linecap:round;stroke-linejoin:round}.chart-grid{stroke:#e7eef7;stroke-width:1}.donut-wrap{display:flex;align-items:center;justify-content:center;gap:28px}.donut{width:190px;height:190px;border-radius:50%;background:conic-gradient(var(--mw-blue) 0 43%,var(--mw-cyan) 43% 65%,var(--mw-purple) 65% 82%,var(--mw-orange) 82% 91%,var(--mw-green) 91% 100%);position:relative}.donut:after{content:'23\A Total';white-space:pre;position:absolute;inset:47px;background:white;border-radius:50%;display:grid;place-items:center;text-align:center;font-weight:800;font-size:22px}.legend{display:grid;gap:11px;font-size:13px}.legend span:before{content:'';display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:8px;background:var(--mw-blue)}.legend span:nth-child(2):before{background:var(--mw-cyan)}.legend span:nth-child(3):before{background:var(--mw-purple)}.legend span:nth-child(4):before{background:var(--mw-orange)}.legend span:nth-child(5):before{background:var(--mw-green)}.agenda-list{display:grid;gap:14px}.agenda-item{display:grid;grid-template-columns:64px 1fr auto;gap:14px;align-items:center;border-bottom:1px solid var(--mw-border);padding-bottom:12px}.agenda-time{font-weight:900;color:var(--mw-blue)}.status-pill{padding:6px 10px;border-radius:10px;background:#eaf2ff;color:#0b4dbb;font-size:12px;font-weight:800}.status-pill.ok{background:#dff8eb;color:#0b7f45}.status-pill.warn{background:#fff2e5;color:#d35400}.alert-row{display:flex;align-items:center;gap:14px;border:1px solid var(--mw-border);border-radius:14px;padding:14px;margin-bottom:12px}.alert-ico{width:34px;height:34px;border-radius:10px;display:grid;place-items:center;background:#eaf4ff}.table th{background:#f8fbff!important}.badge{background:#e9f2ff;color:#0967d8}.badge.finalizado{background:#dff8eb;color:#0b7f45}.badge.atrasado{background:#fff0e7;color:#d35400}.badge.aberto,.badge.em_triagem,.badge.em_atendimento{background:#eaf2ff;color:#0967d8}.badge.risco-vermelho{background:#fee2e2;color:#991b1b}.badge.risco-laranja{background:#ffedd5;color:#9a3412}.badge.risco-amarelo{background:#fef9c3;color:#854d0e}.badge.risco-verde{background:#dcfce7;color:#166534}.badge.risco-azul{background:#dbeafe;color:#1e40af}body.sidebar-collapsed .layout{grid-template-columns:86px 1fr}body.sidebar-collapsed .medwise-side{padding:14px 10px!important}body.sidebar-collapsed .logo-box{width:54px;height:54px;border-radius:16px;padding:4px}body.sidebar-collapsed .logo-box img{content:url('logo/drwisen_icon.svg')}body.sidebar-collapsed .menu-text,body.sidebar-collapsed .medwise-user div:not(.mini-avatar),body.sidebar-collapsed .collapse-link .menu-text,body.sidebar-collapsed .logout-link .menu-text{display:none!important}body.sidebar-collapsed .side a{justify-content:center;padding:13px!important}body.sidebar-collapsed .medwise-user{justify-content:center;padding:10px!important}body.sidebar-collapsed .collapse-link span:first-child{transform:rotate(180deg)}
@media(max-width:1300px){.mw-metrics{grid-template-columns:repeat(2,1fr)}.mw-grid-main,.mw-grid-bottom{grid-template-columns:1fr}.medwise-search{min-width:0}}@media(max-width:860px){.layout{grid-template-columns:1fr}.medwise-side{display:none}.mw-metrics{grid-template-columns:1fr}.mw-dashboard-head{display:block}.content{padding:18px!important}}
.medwise-login{background:radial-gradient(circle at 20% 0%,#0d6eea 0,#061a40 35%,#031733 100%)!important}.login-shell{width:min(760px,94vw);overflow:hidden;border:1px solid rgba(255,255,255,.24);border-radius:28px;background:#fff;box-shadow:0 30px 80px rgba(0,0,0,.35)}.login-hero{background:linear-gradient(180deg,#061a40,#031733);text-align:center;color:#fff;padding:38px}.login-hero img{width:320px;max-width:90%;height:120px;object-fit:contain;background:#fff;border-radius:22px;padding:10px}.login-hero h1{font-size:38px;margin:18px 0 6px}.login-form{padding:34px}.login-form input{padding:14px;border-radius:12px}.login-foot{background:#031733;color:#d9e8ff;text-align:center;padding:16px}


/* V19 - ajuste da sidebar e triagem */
:root{--sidebar-open:270px;--sidebar-closed:78px;}
.layout,.app{grid-template-columns:var(--sidebar-open) 1fr!important;}
body.sidebar-collapsed .layout,body.sidebar-collapsed .app{grid-template-columns:var(--sidebar-closed) 1fr!important;}
.medwise-side{
  display:flex!important;
  flex-direction:column!important;
  gap:10px!important;
  padding:14px 12px!important;
  height:100vh!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
}
.medwise-brand{flex:0 0 auto!important;margin:0 0 8px!important;padding:0 0 10px!important;}
.logo-box{width:190px!important;height:86px!important;border-radius:16px!important;padding:8px!important;}
.side-nav{flex:1 1 auto!important;min-height:0!important;display:flex!important;flex-direction:column!important;gap:4px!important;}
.side-nav a{min-height:42px!important;padding:10px 12px!important;line-height:1.15!important;font-size:14px!important;}
.medwise-user{flex:0 0 auto!important;margin-top:8px!important;padding:10px!important;}
.medwise-user .mini-avatar{width:40px!important;height:40px!important;min-width:40px!important;}
.collapse-link,.logout-link{flex:0 0 auto!important;min-height:38px!important;margin-top:2px!important;padding:9px 12px!important;}
body.sidebar-collapsed .medwise-side{align-items:center!important;padding:12px 9px!important;}
body.sidebar-collapsed .medwise-brand{width:58px!important;margin-bottom:8px!important;border-bottom:0!important;padding-bottom:0!important;}
body.sidebar-collapsed .logo-box{width:50px!important;height:50px!important;border-radius:14px!important;padding:4px!important;}
body.sidebar-collapsed .side-nav{width:100%!important;align-items:center!important;gap:7px!important;}
body.sidebar-collapsed .side-nav a{width:52px!important;height:46px!important;min-height:46px!important;padding:0!important;justify-content:center!important;}
body.sidebar-collapsed .medwise-user{width:52px!important;height:52px!important;padding:6px!important;justify-content:center!important;}
body.sidebar-collapsed .collapse-link,body.sidebar-collapsed .logout-link{width:52px!important;height:44px!important;justify-content:center!important;padding:0!important;}
.triagem-classificacao{margin-top:16px;padding-top:16px;border-top:1px solid var(--mw-border, #dbe7f3);}
.compact-risk{font-size:13px;line-height:1.7;margin-top:4px;margin-bottom:14px;background:#f8fbff;}
#classificacao_risco option{font-weight:700;}
@media(max-height:760px){
  .logo-box{width:150px!important;height:64px!important;}
  .side-nav a{min-height:36px!important;padding:8px 10px!important;font-size:13px!important;}
  .medwise-user{display:none!important;}
}

/* V20 - graficos do dashboard com dados reais */
.donut .donut-total{position:absolute;inset:47px;background:#fff;border-radius:50%;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;font-weight:900;font-size:26px;color:var(--mw-text)}
.donut .donut-total small{display:block;font-size:12px;color:var(--mw-muted);font-weight:700;margin-top:4px}
.donut:after{display:none!important;content:none!important}
.dynamic-legend span:before{background:var(--legend-color)!important}
.line-chart text{font-family:Inter,Segoe UI,Arial,sans-serif}
.alert-info{background:#eef7ff;border:1px solid #cfe7ff;color:#0b3b72;border-radius:12px;padding:12px 14px;margin:12px 0;font-weight:600}.tabcontent fieldset:disabled input,.tabcontent fieldset:disabled textarea,.tabcontent fieldset:disabled select{background:#f3f6fb;color:#64748b;cursor:not-allowed}.patient-card .tag{margin:3px 3px 3px 0}.badge{display:inline-block;padding:6px 10px;border-radius:999px;font-weight:700;font-size:12px}.tabcontent.active{display:block}.tabcontent{display:none}

/* V30 - bloqueio de empresas e filtros de atendimentos */
.badge-red{background:#ffe3e3!important;color:#b42318!important;}
.filter-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:10px;align-items:end;margin:14px 0 18px;padding:14px;border:1px solid var(--b);border-radius:14px;background:#f8fafc;}
.filter-grid input{margin-bottom:0;}
.filter-actions{display:flex;gap:8px;align-items:end;flex-wrap:wrap;}
.empty-state{border:1px dashed var(--b);border-radius:14px;background:#fbfdff;color:var(--muted);padding:22px;text-align:center;margin-top:12px;}
@media(max-width:1100px){.filter-grid{grid-template-columns:1fr 1fr}.filter-actions{grid-column:1/-1}}
@media(max-width:650px){.filter-grid{grid-template-columns:1fr}}

/* V31 - painel de filtros recolhivel na tela de atendimentos */
.filter-toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:14px 0 8px;}
.filter-panel{display:none;margin:8px 0 18px;padding:14px;border:1px solid var(--b);border-radius:14px;background:#f8fafc;}
.filter-panel.show{display:block;}
.filter-chip{display:inline-flex;align-items:center;padding:7px 10px;border-radius:999px;background:#e5f7f4;color:#0f766e;font-weight:700;font-size:12px;}
.filter-grid.compact{margin:0 0 8px;padding:0;border:0;background:transparent;}

/* V32 - Prescrição médica avançada */
.prescricao-avancada{border:1px solid var(--mw-border,#dbe7f3);border-radius:18px;overflow:hidden;background:#f8fbff;margin:12px 0 18px}
.presc-form{display:block;margin:0!important}
.presc-left{background:#fff;padding:20px;max-height:760px;overflow:auto;border-right:0}
.presc-right{background:#f4f7fb;padding:20px;max-height:760px;overflow:auto}
.presc-right h4{margin:0 0 14px;color:var(--mw-text,#071b43)}
.presc-item{background:#fff;border:1px solid var(--mw-border,#dbe7f3);border-radius:12px;padding:14px;margin-bottom:12px;box-shadow:0 4px 14px rgba(7,27,67,.05)}
.presc-item span{display:block;margin-top:5px;color:var(--mw-muted,#60708c);font-size:13px;line-height:1.45}
.checkline{display:flex;align-items:center;gap:10px;margin-bottom:18px;font-weight:600;color:#303847}.checkline input{width:20px;height:20px;margin:0!important}
.presc-grid{display:grid;gap:14px;margin-bottom:14px}.presc-grid.two{grid-template-columns:1fr 1fr}.presc-grid.three{grid-template-columns:repeat(3,1fr)}.presc-grid.four{grid-template-columns:1.1fr .7fr .8fr .8fr}
.presc-grid label,.presc-left>label,.periodicidade-wrap>label{display:block;font-weight:800;font-size:13px;margin-bottom:6px;color:var(--mw-text,#071b43)}
.presc-grid input,.presc-grid select,.presc-left input,.presc-left select,.presc-left textarea{width:100%;border:1px solid #cfd9e8;border-radius:10px;padding:12px;background:#fff;color:#071b43;font-size:14px}
.presc-left textarea{min-height:86px;resize:vertical;margin-bottom:14px}.weight-box{background:#eef2f8;border:1px solid #d8e2ef;border-radius:10px;padding:13px 14px;color:#24324b}
.dose-options{display:flex;flex-wrap:wrap;gap:18px;margin:8px 0 18px}.dose-options label{display:flex;align-items:center;gap:8px;font-weight:700;color:#303847}.dose-options input[type=radio],.dose-options input[type=checkbox]{width:22px;height:22px;margin:0!important}
.periodicidade-wrap{border:1px solid #d7e1ef;border-radius:14px;background:#fbfdff;padding:14px;margin:10px 0 18px}.presc-tabs{display:flex;gap:4px;border-bottom:1px solid #d7e1ef;margin-bottom:14px}.presc-tabs button{border:1px solid #cfd9e8;border-bottom:0;background:#f3f6fb;padding:10px 14px;border-radius:10px 10px 0 0;font-weight:800;color:#718095;cursor:pointer}.presc-tabs button.active{background:#fff;color:#0967d8;border-top:3px solid #0967d8}
.period-panel{display:none}.period-panel.active{display:block}.hour-buttons{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.hour-buttons button{border:1px solid #cfd9e8;background:#fff;border-radius:8px;padding:10px 12px;font-weight:800;color:#667085;cursor:pointer}.hour-buttons button:hover{background:#eaf4ff;color:#0967d8}.hour-buttons input{width:90px!important}.turnos{display:flex;gap:18px;margin-bottom:14px}.turnos label{display:flex;align-items:center;gap:8px;font-weight:700}.turnos input{width:20px!important;height:20px!important}
.posologia-box{border:1px solid #73b7e5;background:#eaf4ff;border-radius:10px;padding:12px 14px;margin:12px 0 16px}.posologia-box b{display:block;margin-bottom:6px}.posologia-box div{line-height:1.45;color:#17345f}.conclusao{min-height:42px;border:1px dashed #cfd9e8;border-radius:10px;padding:12px;background:#fff;font-weight:800;color:#071b43}.presc-actions{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap;margin-top:14px}
@media(max-width:1100px){.presc-form{grid-template-columns:1fr}.presc-left{border-right:0;border-bottom:1px solid var(--mw-border,#dbe7f3)}.presc-grid.two,.presc-grid.three,.presc-grid.four{grid-template-columns:1fr}.presc-left,.presc-right{max-height:none}}

/* V33 - Prescrição: painéis de periodicidade separados */
.period-title{font-weight:900;color:#08285f;margin-bottom:4px;font-size:15px}
.period-help{color:#667085;font-size:13px;margin:0 0 12px;line-height:1.35}
.period-panel{background:#fff;border:1px solid #dbe7f3;border-radius:12px;padding:14px;margin-top:10px}
.period-panel:not(.active){display:none!important}
.period-panel.active{display:block!important}
.tratamento-card{border:1px solid #dbe7f3;border-radius:14px;background:#fff;padding:14px;margin:14px 0}
.tratamento-card h4{margin:0 0 4px;color:#08285f}


/* V34 - Receita em paisagem com duas vias */
.receita-paisagem{display:none}
@media print{.receita-paisagem{display:block}.receita-paisagem .receita-folha{width:100%;display:grid;grid-template-columns:1fr 1fr}.receita-paisagem .receita-via{border-right:1px dashed #333;padding:8mm}.receita-paisagem .via-dir{border-right:0}}

/* V35 - seleção de medicamentos para impressão da receita */
.receita-selector-card{padding:16px;margin:14px 0;background:#f8fbff;border:1px solid var(--b)}
.receita-selector-head{display:flex;align-items:center;justify-content:space-between;gap:16px}
.receita-selector-head h3{margin:0 0 4px;color:var(--txt)}
.receita-selector-head p{margin:0;color:var(--muted);font-size:13px}
.receita-select-box{max-width:820px}
.receita-select-body{padding:20px}
.receita-select-actions{display:flex;gap:8px;margin:12px 0}
.receita-check-list{display:grid;gap:10px;max-height:45vh;overflow:auto;padding-right:6px}
.receita-check-item{display:flex;align-items:flex-start;gap:12px;border:1px solid var(--b);border-radius:12px;background:#fff;padding:12px;cursor:pointer}
.receita-check-item input{margin-top:4px;width:18px;height:18px}
.receita-check-item b{display:block;color:var(--txt);margin-bottom:4px}
.receita-check-item small{display:block;color:var(--muted);line-height:1.35}
.receita-select-footer{display:flex;justify-content:flex-end;gap:10px;margin-top:18px;padding-top:14px;border-top:1px solid var(--b)}

/* V37 - Papel timbrado */
.row4{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}
.check-line{display:flex;align-items:center;gap:8px;margin-top:10px;font-weight:600}
.timbrado-checks{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin:12px 0 18px}
.timbrado-checks label{border:1px solid var(--b);border-radius:12px;padding:12px;background:#fbfdff;font-weight:700;display:flex;gap:8px;align-items:center}
.timbrado-preview{width:210mm;min-height:297mm;max-width:100%;background-size:100% 100%;background-position:center;background-repeat:no-repeat;border:1px solid var(--b);box-shadow:0 8px 30px rgba(0,0,0,.12);background-color:#fff;overflow:hidden}
.timbrado-preview-box{border:2px dashed #18aab8;background:rgba(255,255,255,.78);padding:18px;border-radius:12px;color:#09204a;min-height:120mm}
.timbrado-pdf-preview{width:100%;height:720px;border:1px solid var(--b);border-radius:12px;background:#fff}
.timbrado-page{width:210mm;min-height:297mm;background-size:100% 100%;background-repeat:no-repeat;background-position:center;background-color:#fff;position:relative;overflow:hidden}
.timbrado-content{position:relative;z-index:2;font-size:14px;line-height:1.45}
.timbrado-content h1{text-align:left;margin:0 0 18px;font-size:22px}.timbrado-content h2{font-size:18px;margin:0 0 12px}
@media(max-width:1100px){.row4,.timbrado-checks{grid-template-columns:1fr 1fr}.timbrado-preview{width:100%;min-height:760px}}

.presc-footer-tools{padding:14px 20px 18px;background:#fff;border-top:1px solid var(--mw-border,#dbe7f3);display:flex;justify-content:flex-end}
.presc-footer-tools .btn{min-width:230px}

/* V44 - edicao/exclusao logica de medicamentos no prontuario */
.presc-table tr.presc-excluida td{background:#fff7f7;color:#8a3a3a;text-decoration:line-through;text-decoration-thickness:2px;text-decoration-color:#c0392b}
.presc-table tr.presc-excluida td:last-child{text-decoration:none;color:#8a3a3a}
.badge.ok{background:#dcfce7;color:#166534}
.badge.danger{background:#fee2e2;color:#991b1b}
.btn.small{padding:6px 9px;font-size:12px;border-radius:8px;width:auto!important;margin:0 4px 0 0!important}
.btn.danger{background:#fee2e2;color:#991b1b;border-color:#fecaca}
.edit-presc-form label{display:block;font-weight:700;margin:8px 0 5px}
.edit-presc-form input,.edit-presc-form select,.edit-presc-form textarea{width:100%;border:1px solid var(--b);border-radius:10px;padding:10px;background:#fff}
.edit-presc-form textarea{min-height:85px}
/* V45 - edição de prescrição e modais com rolagem */
.modal-historico-box.receita-select-box{max-height:92vh;display:flex;flex-direction:column;overflow:hidden}
.modal-historico-box .receita-select-body{overflow-y:auto;max-height:calc(92vh - 72px);padding-right:12px}
.edit-presc-form .edit-period,.edit-presc-form .edit-comum,.edit-presc-form .edit-fracionada{display:none}
.edit-presc-form .edit-period.active,.edit-presc-form .edit-comum.active,.edit-presc-form .edit-fracionada.active{display:block}
.edit-presc-form .periodicidade-wrap{margin:12px 0;padding:14px;border:1px solid #dbe7f3;border-radius:12px;background:#fff}
.edit-presc-form .edit-period{margin-top:10px;padding:12px;border:1px solid #dbe7f3;border-radius:10px;background:#f8fbff}
.edit-presc-form .hour-buttons button{border:1px solid #cfd9e8;background:#fff;border-radius:8px;padding:9px 11px;font-weight:800;cursor:pointer}

/* V46 - consolidacao prontuario / prescricao */
.progress-wrap{padding:14px 18px;border-bottom:1px solid var(--b);background:#f8fbff}
.progress-head{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-bottom:10px}
.progress-percent{min-width:92px;text-align:right;color:#0b4dbb}.progress-percent b{display:block;font-size:22px}.progress-percent span{font-size:11px;color:#65738b}
.progress-bar-line{height:8px;border-radius:99px;background:#e5edf7;overflow:hidden;margin-bottom:12px}.progress-bar-line span{display:block;height:100%;background:linear-gradient(90deg,#0b76d1,#11b6a2);border-radius:99px;transition:width .25s ease}
.progress-prontuario{display:flex;gap:8px;align-items:center;overflow:auto;padding-bottom:2px}
.progress-step{position:relative;min-width:120px;padding:9px 12px;border:1px solid var(--b);border-radius:999px;background:#fff;color:#65738b;font-weight:700;text-align:center;font-size:12px;cursor:pointer;transition:.18s ease;white-space:nowrap}
.progress-step.pending{background:#fff;color:#65738b;border-color:#dbe4f0}
.progress-step.active{background:#ff9f1c;color:#fff;border-color:#ff9f1c;box-shadow:0 6px 18px rgba(255,159,28,.22)}
.progress-step.done{background:linear-gradient(135deg,#0b76d1,#11b6a2);color:#fff;border-color:transparent;box-shadow:0 6px 18px rgba(11,118,209,.15)}
.progress-step.current-done{background:linear-gradient(135deg,#0b76d1,#11b6a2);color:#fff;border-color:#ff9f1c;box-shadow:0 0 0 3px rgba(255,159,28,.28),0 6px 18px rgba(11,118,209,.16)}
.progress-step.done:before,.progress-step.current-done:before{content:'✓ ';font-weight:900}
.medwise-med-tools{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:12px 0;padding:12px;border:1px solid var(--b);border-radius:12px;background:#f8fbff}
.chip{display:inline-flex;align-items:center;margin:4px 4px 0 0;padding:7px 10px;border-radius:999px;border:1px solid #cfe1f3;background:#fff;color:#14345d;cursor:pointer;font-size:12px;font-weight:600}
.chip:hover{background:#eaf6ff}
.favoritos-list{margin-top:6px}
.med-actions{display:flex;gap:6px;flex-wrap:wrap;margin-top:6px}
.btn.danger,.btn.small.danger{background:#fff1f1;border-color:#ffc9c9;color:#b42318}
.presc-excluida td{text-decoration:line-through;color:#7a8797;background:#fff8f8}
@media(max-width:900px){.medwise-med-tools{grid-template-columns:1fr}.progress-step{min-width:105px}}
/* V48 - Histórico, impressão, auditoria e agenda avançada */
.patient-history-head{display:grid;grid-template-columns:2fr 1fr;gap:16px}.history-tabs{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0}.history-tabs .btn.active,.calendar-toolbar .btn.active{background:var(--primary,#0f766e);color:#fff}.timeline{position:relative;padding-left:20px}.timeline-item{display:grid;grid-template-columns:22px 1fr;gap:8px;margin:14px 0}.time-dot{width:14px;height:14px;border-radius:50%;background:#0f766e;margin-top:4px;box-shadow:0 0 0 4px #dff7f3}.print-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}.filter-box.always-open{display:block!important}.event-chip{cursor:grab}.event-chip:active{cursor:grabbing}.calendar-day{transition:.15s}.calendar-day:hover{background:#f2fbff}.calendar-day.drag-over{outline:2px dashed #0f766e}.hidden{display:none!important}@media(max-width:1000px){.patient-history-head,.print-grid{grid-template-columns:1fr}}


/* V49 - forma farmaceutica e correção de rolagem/desproporção */
html,body{
  max-width:100%;
  overflow-x:hidden;
}
.layout,.app,.main,.content,.panel,.card,.section,.tabcontent,.prescricao-avancada,.presc-form,.presc-left,.presc-right{
  min-width:0;
  max-width:100%;
}
.content,.main>div:not(.top){
  overflow-x:hidden;
}
.patient-grid{
  grid-template-columns:minmax(205px,230px) minmax(0,1fr) minmax(280px,340px) !important;
  max-width:100%;
  align-items:start;
}
.patient-grid > *{
  min-width:0;
  max-width:100%;
}
.tabs,.progress-prontuario{
  max-width:100%;
  overflow-x:auto;
  overflow-y:hidden;
}
.table{
  max-width:100%;
}
.table th,.table td{
  word-break:normal;
  overflow-wrap:anywhere;
}
.presc-grid.two{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
.presc-grid.three{grid-template-columns:repeat(3,minmax(0,1fr))}
.presc-grid.four{grid-template-columns:minmax(0,1.1fr) minmax(0,.7fr) minmax(0,.8fr) minmax(0,.8fr)}
.sidecard,.patient-card{
  overflow:hidden;
}
.list .item{
  flex-wrap:wrap;
}
.modal .card,.box{
  max-width:95vw;
  overflow-x:hidden;
}
@media(max-width:1350px){
  .patient-grid{grid-template-columns:minmax(190px,220px) minmax(0,1fr) minmax(260px,310px) !important;gap:12px}
  .vitals{grid-template-columns:repeat(2,1fr)}
  .vitals div:nth-child(2n){border-right:0}
}
@media(max-width:1100px){
  .patient-grid{grid-template-columns:1fr !important}
  .presc-grid.two,.presc-grid.three,.presc-grid.four{grid-template-columns:1fr !important}
}

/* V50 - correção da prescrição médica e rolagem */
.prescricao-avancada{
  display:block !important;
  width:100% !important;
  overflow:visible !important;
  background:#fff !important;
}
.presc-form{
  display:block !important;
  width:100% !important;
  max-width:100% !important;
}
.presc-left{
  width:100% !important;
  max-height:none !important;
  overflow:visible !important;
  border-right:0 !important;
}
.presc-grid{width:100%;min-width:0;gap:12px;align-items:start}
.presc-grid.two{display:grid;grid-template-columns:repeat(2,minmax(0,1fr)) !important}
.presc-grid.three{display:grid;grid-template-columns:repeat(3,minmax(0,1fr)) !important}
.presc-grid.four{display:grid;grid-template-columns:1.1fr .7fr .8fr .8fr !important}
.presc-grid input,.presc-grid select,.presc-grid textarea,.presc-left input,.presc-left select,.presc-left textarea{
  min-width:0 !important;
  max-width:100% !important;
  box-sizing:border-box !important;
}
.periodicidade-wrap,.tratamento-card,.posologia-box,.medwise-med-tools{
  width:100%;max-width:100%;overflow:visible;box-sizing:border-box;
}
.period-panel{display:none !important;}
.period-panel.active{display:block !important;}
.presc-tabs{display:flex;gap:8px;flex-wrap:wrap;max-width:100%;overflow:visible !important;}
.presc-tabs button{white-space:nowrap;}
.hour-buttons{display:flex;gap:8px;flex-wrap:wrap;align-items:center;}
.hour-buttons input{width:120px !important;flex:0 0 120px;}
.presc-actions{display:flex;gap:10px;flex-wrap:wrap;align-items:center;position:sticky;bottom:0;background:#fff;padding:12px 0;border-top:1px solid #edf2f7;margin-top:10px;}
.tabcontent.active{overflow:visible !important;}
.patient-grid{grid-template-columns:minmax(210px,230px) minmax(0,1fr) minmax(285px,330px) !important;overflow:visible !important;}
.patient-grid > .card,.patient-grid > div{min-width:0 !important;}
@media(max-width:1280px){
  .patient-grid{grid-template-columns:220px minmax(0,1fr) !important;}
  .patient-grid > div:last-child{grid-column:1 / -1;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;}
  .patient-grid > div:last-child .sidecard{margin-bottom:0;}
}
@media(max-width:900px){
  .presc-grid.two,.presc-grid.three,.presc-grid.four{grid-template-columns:1fr !important;}
  .patient-grid{grid-template-columns:1fr !important;}
  .patient-grid > div:last-child{display:block;}
  .presc-actions{position:static;}
}

/* V52 */
.catalog-suggestions{display:none;position:absolute;z-index:60;background:#fff;border:1px solid #dbe4f0;border-radius:10px;box-shadow:0 10px 30px #102d6925;max-height:260px;overflow:auto;width:min(640px,90%)}.catalog-item{display:block;width:100%;text-align:left;border:0;border-bottom:1px solid #eef2f7;background:#fff;padding:10px 12px;cursor:pointer}.catalog-item:hover{background:#eef6ff}.catalog-item small{display:block;color:#61708a;margin-top:3px}.catalog-error{padding:12px;color:#8a5a00}.manual-check{display:block;font-size:12px;color:#61708a;margin-top:4px}.exam-subtabs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}.exam-panel{display:none}.exam-panel.active{display:block}.exam-form{position:relative;max-width:900px}.exam-form label{display:block;font-weight:600;margin:10px 0 5px}.exam-form input,.exam-form textarea{width:100%}.form-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}


/* V53 - Identidade Marte Doctor e temas claro/escuro */
:root{color-scheme:light;--surface:#ffffff;--surface-2:#f7f9fc;--shadow:rgba(7,27,67,.08)}
html[data-theme="dark"]{color-scheme:dark;--bg:#0b1220;--txt:#e8eef8;--muted:#9fb0c8;--b:#26364d;--surface:#121c2c;--surface-2:#172338;--mw-bg:#0b1220;--mw-text:#e8eef8;--mw-muted:#9fb0c8;--mw-border:#26364d}
html[data-theme="dark"] body{background:var(--bg);color:var(--txt)}
html[data-theme="dark"] .main>.top,html[data-theme="dark"] .medwise-top,html[data-theme="dark"] .card,html[data-theme="dark"] .panel,html[data-theme="dark"] .stat,html[data-theme="dark"] .mw-card,html[data-theme="dark"] .date-card,html[data-theme="dark"] .mw-metric,html[data-theme="dark"] .modal .card,html[data-theme="dark"] .box,html[data-theme="dark"] .table,html[data-theme="dark"] .login-shell{background:var(--surface)!important;color:var(--txt)!important;border-color:var(--b)!important}
html[data-theme="dark"] input,html[data-theme="dark"] select,html[data-theme="dark"] textarea,html[data-theme="dark"] .input,html[data-theme="dark"] .area,html[data-theme="dark"] .top-search,html[data-theme="dark"] .company-pill,html[data-theme="dark"] .user-pill,html[data-theme="dark"] .top-icon,html[data-theme="dark"] .btn,html[data-theme="dark"] .table th,html[data-theme="dark"] .soap h3,html[data-theme="dark"] .empresa-option{background:var(--surface-2)!important;color:var(--txt)!important;border-color:var(--b)!important}
html[data-theme="dark"] .muted,html[data-theme="dark"] .subtle,html[data-theme="dark"] small{color:var(--muted)!important}
html[data-theme="dark"] .medwise-login,html[data-theme="dark"] .login{background:radial-gradient(circle at 20% 0%,#173c71 0,#091426 48%,#050a12 100%)!important}
html[data-theme="dark"] .login-form{background:var(--surface)!important}
html[data-theme="dark"] .login-foot{background:#07101f!important}
html[data-theme="dark"] .donut:after{background:var(--surface)!important;color:var(--txt)!important}
html[data-theme="dark"] .chart-grid{stroke:#26364d!important}
.theme-toggle{cursor:pointer;font-size:18px;color:var(--txt)}
.login-theme-toggle{position:fixed;right:18px;top:18px;z-index:100;border:1px solid rgba(255,255,255,.35);background:rgba(3,23,51,.78);color:white;border-radius:999px;padding:10px 14px;font-weight:700;cursor:pointer;backdrop-filter:blur(10px)}
.logo-box img,.login-hero img{object-fit:contain!important;object-position:center!important}
.logo-box{overflow:hidden!important;background:#fff!important}
@media(max-width:700px){.login-theme-toggle{right:10px;top:10px;padding:8px 11px}.theme-toggle{display:grid!important}}


/* V54 - Marte Doctor: identidade final, favicon e tema claro/escuro funcional */
:root{
  --drw-page:#f4f8fc;--drw-surface:#ffffff;--drw-surface-2:#f7f9fc;
  --drw-text:#071b43;--drw-muted:#60708c;--drw-border:#dbe7f3;
}
html[data-theme="dark"]{
  --drw-page:#080e18;--drw-surface:#111a28;--drw-surface-2:#182436;
  --drw-text:#eef4ff;--drw-muted:#aebbd0;--drw-border:#2b3b52;
  --bg:var(--drw-page);--txt:var(--drw-text);--muted:var(--drw-muted);--b:var(--drw-border);
  --mw-bg:var(--drw-page);--mw-card:var(--drw-surface);--mw-text:var(--drw-text);--mw-muted:var(--drw-muted);--mw-border:var(--drw-border);
}
html[data-theme="dark"],html[data-theme="dark"] body{background:var(--drw-page)!important;color:var(--drw-text)!important}
html[data-theme="dark"] .main,html[data-theme="dark"] .content,html[data-theme="dark"] .main>div:not(.top){background:var(--drw-page)!important;color:var(--drw-text)!important}
html[data-theme="dark"] .card,html[data-theme="dark"] .panel,html[data-theme="dark"] .stat,html[data-theme="dark"] .mw-card,
html[data-theme="dark"] .mw-metric,html[data-theme="dark"] .date-card,html[data-theme="dark"] .patient-card,
html[data-theme="dark"] .sidecard,html[data-theme="dark"] .soap,html[data-theme="dark"] .modal .card,
html[data-theme="dark"] .box,html[data-theme="dark"] .login-shell,html[data-theme="dark"] .prescricao-avancada,
html[data-theme="dark"] .tratamento-card,html[data-theme="dark"] .posologia-box,html[data-theme="dark"] .periodicidade-wrap{
  background:var(--drw-surface)!important;color:var(--drw-text)!important;border-color:var(--drw-border)!important;box-shadow:0 10px 28px rgba(0,0,0,.24)!important
}
html[data-theme="dark"] .main>.top,html[data-theme="dark"] .medwise-top{background:rgba(17,26,40,.96)!important;color:var(--drw-text)!important;border-color:var(--drw-border)!important}
html[data-theme="dark"] input,html[data-theme="dark"] select,html[data-theme="dark"] textarea,
html[data-theme="dark"] .input,html[data-theme="dark"] .area,html[data-theme="dark"] .top-search,
html[data-theme="dark"] .company-pill,html[data-theme="dark"] .user-pill,html[data-theme="dark"] .top-icon,
html[data-theme="dark"] .btn:not(.primary):not(.green):not(.quick-action):not(.red),html[data-theme="dark"] .table th,
html[data-theme="dark"] .soap h3,html[data-theme="dark"] .tools,html[data-theme="dark"] .empresa-option,
html[data-theme="dark"] .catalog-item,html[data-theme="dark"] .catalog-suggestions,html[data-theme="dark"] .tab{
  background:var(--drw-surface-2)!important;color:var(--drw-text)!important;border-color:var(--drw-border)!important
}
html[data-theme="dark"] .table,html[data-theme="dark"] .table td{background:var(--drw-surface)!important;color:var(--drw-text)!important;border-color:var(--drw-border)!important}
html[data-theme="dark"] .muted,html[data-theme="dark"] .subtle,html[data-theme="dark"] small,html[data-theme="dark"] label{color:var(--drw-muted)!important}
html[data-theme="dark"] .presc-actions{background:var(--drw-surface)!important;border-color:var(--drw-border)!important}
html[data-theme="dark"] .login-form{background:var(--drw-surface)!important;color:var(--drw-text)!important}
html[data-theme="dark"] .login-foot{background:#050b14!important}
html[data-theme="dark"] .logo-box,html[data-theme="dark"] .login-hero img{background:#fff!important}
.theme-toggle,.login-theme-toggle{transition:transform .18s ease,background .18s ease,color .18s ease}
.theme-toggle:hover,.login-theme-toggle:hover{transform:translateY(-1px)}


/* V55 - Tema escuro definitivo Marte Doctor */
html,body,.layout,.main,.content{transition:background-color .22s ease,color .22s ease,border-color .22s ease}
html[data-theme="dark"],html.dark-theme{color-scheme:dark!important;background:#070c14!important}
html[data-theme="dark"] body,body.dark-theme{background:#070c14!important;color:#eef4ff!important}
html[data-theme="dark"] .layout,html[data-theme="dark"] .main,html[data-theme="dark"] .content,
body.dark-theme .layout,body.dark-theme .main,body.dark-theme .content{background:#0a111c!important;color:#eef4ff!important}
html[data-theme="dark"] .top,html[data-theme="dark"] .medwise-top,
body.dark-theme .top,body.dark-theme .medwise-top{background:#111b2a!important;color:#eef4ff!important;border-color:#2b3b52!important}
html[data-theme="dark"] .card,html[data-theme="dark"] .panel,html[data-theme="dark"] .stat,html[data-theme="dark"] .mw-card,
html[data-theme="dark"] .sidecard,html[data-theme="dark"] .patient,html[data-theme="dark"] .patient-card,html[data-theme="dark"] .box,
html[data-theme="dark"] .login-shell,html[data-theme="dark"] .login-form,html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .soap,html[data-theme="dark"] .prescricao-avancada,html[data-theme="dark"] .tratamento-card,
body.dark-theme .card,body.dark-theme .panel,body.dark-theme .stat,body.dark-theme .mw-card,body.dark-theme .sidecard,
body.dark-theme .patient,body.dark-theme .patient-card,body.dark-theme .box,body.dark-theme .login-shell,body.dark-theme .login-form,
body.dark-theme .modal-content,body.dark-theme .soap,body.dark-theme .prescricao-avancada,body.dark-theme .tratamento-card{
  background:#111b2a!important;color:#eef4ff!important;border-color:#2b3b52!important;box-shadow:0 10px 28px rgba(0,0,0,.28)!important
}
html[data-theme="dark"] input,html[data-theme="dark"] select,html[data-theme="dark"] textarea,html[data-theme="dark"] button:not(.primary):not(.green):not(.red):not(.quick-action),
html[data-theme="dark"] .input,html[data-theme="dark"] .area,html[data-theme="dark"] .btn:not(.primary):not(.green):not(.red):not(.quick-action),
html[data-theme="dark"] .top-search,html[data-theme="dark"] .company-pill,html[data-theme="dark"] .user-pill,html[data-theme="dark"] .top-icon,
html[data-theme="dark"] .table th,html[data-theme="dark"] .tools,html[data-theme="dark"] .tab,html[data-theme="dark"] .catalog-item,html[data-theme="dark"] .catalog-suggestions,
body.dark-theme input,body.dark-theme select,body.dark-theme textarea,body.dark-theme button:not(.primary):not(.green):not(.red):not(.quick-action),
body.dark-theme .input,body.dark-theme .area,body.dark-theme .btn:not(.primary):not(.green):not(.red):not(.quick-action),body.dark-theme .top-search,
body.dark-theme .company-pill,body.dark-theme .user-pill,body.dark-theme .top-icon,body.dark-theme .table th,body.dark-theme .tools,body.dark-theme .tab,
body.dark-theme .catalog-item,body.dark-theme .catalog-suggestions{background:#182538!important;color:#eef4ff!important;border-color:#34465f!important}
html[data-theme="dark"] table,html[data-theme="dark"] tbody,html[data-theme="dark"] tr,html[data-theme="dark"] td,
body.dark-theme table,body.dark-theme tbody,body.dark-theme tr,body.dark-theme td{background:#111b2a!important;color:#eef4ff!important;border-color:#2b3b52!important}
html[data-theme="dark"] h1,html[data-theme="dark"] h2,html[data-theme="dark"] h3,html[data-theme="dark"] h4,html[data-theme="dark"] p,html[data-theme="dark"] span,html[data-theme="dark"] label,
body.dark-theme h1,body.dark-theme h2,body.dark-theme h3,body.dark-theme h4,body.dark-theme p,body.dark-theme span,body.dark-theme label{color:inherit}
html[data-theme="dark"] .muted,html[data-theme="dark"] .subtle,html[data-theme="dark"] small,
body.dark-theme .muted,body.dark-theme .subtle,body.dark-theme small{color:#aebbd0!important}
html[data-theme="dark"] .modal,body.dark-theme .modal{background:rgba(0,0,0,.72)!important}
html[data-theme="dark"] .login,html[data-theme="dark"] .medwise-login,body.dark-theme.login,body.dark-theme.medwise-login{background:radial-gradient(circle at 20% 0%,#173c71 0,#091426 48%,#050a12 100%)!important}
html[data-theme="dark"] a:not(.btn),body.dark-theme a:not(.btn){color:#79b8ff}
html[data-theme="dark"] .logo-box,html[data-theme="dark"] .login-hero img,body.dark-theme .logo-box,body.dark-theme .login-hero img{background:#fff!important}
.theme-toggle,.login-theme-toggle{user-select:none;cursor:pointer!important}
/* V58 - Google Agenda */
.google-sync-status{display:flex;gap:12px;align-items:flex-start;padding:14px;border:1px solid var(--border,#dbe4f0);border-radius:12px;margin:12px 0;background:var(--card,#fff)}
.google-sync-status .status-dot{width:12px;height:12px;border-radius:50%;margin-top:4px;flex:0 0 auto;background:#dc3545;box-shadow:0 0 0 4px rgba(220,53,69,.12)}
.google-sync-status.connected .status-dot{background:#16a34a;box-shadow:0 0 0 4px rgba(22,163,74,.12)}
.google-actions{display:flex;gap:10px;flex-wrap:wrap;margin:12px 0}.google-actions form{margin:0}
.btn.danger{background:#c62828;color:#fff;border-color:#c62828}
.google-alert{padding:10px 12px;border-radius:8px;margin:10px 0;font-weight:600}.google-alert.ok{background:#dcfce7;color:#166534}.google-alert.warn{background:#fef3c7;color:#92400e}.google-alert.error{background:#fee2e2;color:#991b1b}
.google-config-form{margin-top:12px}.google-box details{margin-top:12px}.google-box summary{cursor:pointer;padding:8px 0}


/* Marte Doctor - identidade visual */
:root{
  --azul:#078dff;--azul2:#061a40;--bg:#f2f6fb;--b:#cdd9e8;--txt:#071529;--muted:#607089;
  --mw-navy:#020917;--mw-navy2:#00040d;--mw-blue:#078dff;--mw-cyan:#20c8ff;--mw-teal:#20c8ff;
  --mw-bg:#f2f6fb;--mw-card:#ffffff;--mw-border:#cdd9e8;--mw-text:#071529;--mw-muted:#607089;
  --drw-page:#f2f6fb;--drw-surface:#ffffff;--drw-surface-2:#f7f9fc;
  --drw-text:#071529;--drw-muted:#607089;--drw-border:#cdd9e8;
}
.medwise-side,.side{background:linear-gradient(180deg,#061a40 0%,#020917 55%,#00040d 100%)!important}
.side a.active,.side a:hover,.quick-action,.btn.primary,.btn.green{background:linear-gradient(135deg,#0574e8,#20c8ff)!important;color:#fff!important;box-shadow:0 10px 24px rgba(7,141,255,.24)!important}
.medwise-login,.login{background:radial-gradient(circle at 18% 0%,#0b4c91 0%,#061a40 36%,#00040d 100%)!important}
.login-shell{border-color:rgba(180,207,235,.28)!important;box-shadow:0 34px 90px rgba(0,4,13,.58)!important}
.login-hero{background:linear-gradient(160deg,#061a40 0%,#020917 58%,#00040d 100%)!important}
.login-hero img{width:540px!important;max-width:96%!important;height:190px!important;background:#020714!important;border:1px solid rgba(132,188,242,.22)!important;border-radius:20px!important;padding:0!important;object-fit:contain!important}
.login-hero h1{color:#f4f7fb!important;letter-spacing:.03em}
.login-foot{background:#00040d!important;color:#b8c8dc!important}
.logo-box{background:#020714!important;border:1px solid rgba(132,188,242,.22)!important;padding:3px!important}
.logo-box img{border-radius:11px!important}
body.sidebar-collapsed .logo-box img{content:url('logo/marte_doctor_icon.png')!important}
.master-brand{display:grid;gap:8px;margin-bottom:8px;padding:10px;border:1px solid rgba(255,255,255,.12);border-radius:16px;background:rgba(255,255,255,.04);text-align:center}
.master-brand img{display:block;width:100%;height:82px;object-fit:contain;border-radius:10px;background:#020714}
.master-brand strong{font-size:17px;color:#fff}.master-brand small{color:#9edcff!important}
.select-brand-logo{display:block;width:min(360px,90%);height:128px;object-fit:contain;margin:0 auto 18px;border-radius:16px;background:#020714}
html[data-theme="dark"]{--drw-page:#00040d;--drw-surface:#071221;--drw-surface-2:#0b1a2d;--drw-text:#eef6ff;--drw-muted:#a6bad2;--drw-border:#243b57;--bg:#00040d;--txt:#eef6ff;--muted:#a6bad2;--b:#243b57;--mw-bg:#00040d;--mw-card:#071221;--mw-text:#eef6ff;--mw-muted:#a6bad2;--mw-border:#243b57}
html[data-theme="dark"] .login-hero img,body.dark-theme .login-hero img,html[data-theme="dark"] .logo-box,body.dark-theme .logo-box{background:#020714!important}
html[data-theme="dark"] .medwise-login,html[data-theme="dark"] .login,body.dark-theme.login,body.dark-theme.medwise-login{background:radial-gradient(circle at 18% 0%,#0b4c91 0%,#061a40 36%,#00040d 100%)!important}
@media(max-width:700px){.login-hero img{height:132px!important}.login-hero{padding:28px 18px!important}}

/* Busca global de pacientes */
.global-patient-search{position:relative!important;display:flex!important;align-items:center!important;gap:10px!important;padding:0 14px!important;overflow:visible!important}.global-search-icon{flex:0 0 auto}.global-patient-search input{border:0!important;background:transparent!important;box-shadow:none!important;margin:0!important;padding:13px 0!important;min-width:0!important;color:var(--mw-text)!important}.global-patient-search input:focus{outline:0}.global-patient-search:focus-within{border-color:var(--mw-blue)!important;box-shadow:0 0 0 3px rgba(7,141,255,.14)!important}.global-search-results{position:absolute;z-index:500;left:0;right:0;top:calc(100% + 8px);max-height:380px;overflow:auto;background:var(--mw-card);border:1px solid var(--mw-border);border-radius:14px;box-shadow:0 18px 48px rgba(0,4,13,.24);padding:7px}.global-search-option{display:flex;width:100%;flex-direction:column;align-items:flex-start;gap:3px;border:0;background:transparent;color:var(--mw-text);padding:11px 12px;border-radius:10px;cursor:pointer;text-align:left}.global-search-option:hover,.global-search-option.active{background:rgba(7,141,255,.12)}.global-search-option small{color:var(--mw-muted)}.global-search-empty{padding:14px;color:var(--mw-muted);font-size:13px}.global-search-all{display:block;padding:10px 12px;border-top:1px solid var(--mw-border);color:var(--mw-blue);font-weight:700;text-decoration:none}.patient-list-actions{display:flex;align-items:center;justify-content:space-between;gap:14px}.patient-page-search{display:flex;align-items:flex-start;gap:8px;flex:1;max-width:720px}.patient-page-search input{margin:0}html[data-theme="dark"] .global-search-results,body.dark-theme .global-search-results{background:var(--drw-surface)!important;border-color:var(--drw-border)!important}html[data-theme="dark"] .global-search-option,body.dark-theme .global-search-option{color:var(--drw-text)!important}@media(max-width:860px){.patient-list-actions,.patient-page-search{display:grid;grid-template-columns:1fr}.patient-list-actions>a{width:100%;text-align:center}}

/* Fluxo de exames e históricos */
.exam-request-form{max-width:100%}.exam-entry-row{display:grid;grid-template-columns:minmax(260px,520px) auto 42px;align-items:start;gap:8px;margin-bottom:10px}.exam-search-wrap{position:relative}.exam-search-wrap input{margin:0}.exam-entry-row .catalog-suggestions{width:100%;top:calc(100% + 4px)}.exam-entry-row .btn{min-height:44px;white-space:nowrap}.exam-entry-row .remove-exam-row{padding:8px 12px;font-size:20px}.catalog-item.active{background:#e6f3ff}.exam-hint{margin:-2px 0 12px}.exam-list{margin:0;padding-left:18px}.exam-list li+li{margin-top:4px}.exam-history-table td{vertical-align:top}.exam-status-form{margin:0}.exam-status-form select{min-width:145px;margin:0;padding:8px 10px}.exam-result-modal .modal-historico-box{max-width:860px}.exam-result-content{padding:4px 4px 18px}.exam-result-content h2{margin:8px 0 16px}.exam-result-meta{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-bottom:20px}.exam-result-meta>div{display:flex;flex-direction:column;gap:5px;padding:12px;border:1px solid var(--mw-border);border-radius:10px;background:var(--drw-surface-2,#f7f9fc)}.exam-result-content section{margin-top:18px}.exam-result-content section h4{margin:0 0 7px}.result-text{white-space:pre-wrap;padding:13px;border:1px solid var(--mw-border);border-radius:10px;background:var(--drw-surface-2,#f7f9fc);line-height:1.5}.exam-file-link{display:inline-flex;align-items:center;gap:6px;color:var(--mw-blue);font-weight:700}.exam-result-actions{display:flex;justify-content:flex-end;gap:8px;padding-top:14px;border-top:1px solid var(--mw-border)}
html[data-theme="dark"] .catalog-item.active,body.dark-theme .catalog-item.active{background:#123a63!important}
@media(max-width:760px){.exam-entry-row{grid-template-columns:1fr auto}.exam-entry-row .exam-search-wrap{grid-column:1/-1}.exam-result-meta{grid-template-columns:1fr}.exam-subtabs .btn{width:100%}}

/* V61 - editor visual de papel timbrado */
.timbrado-field-grid{display:grid;grid-template-columns:repeat(5,minmax(110px,1fr));gap:12px}.timbrado-field-grid input{margin-bottom:4px}.timbrado-editor-pages{display:flex;justify-content:center;overflow:auto;padding:16px;background:#e8edf4;border:1px solid var(--b);border-radius:14px}.timbrado-preview-loading{padding:30px;color:var(--muted)}.timbrado-editor-sheet{position:relative;flex:0 0 auto;background:#fff 50% 50%/100% 100% no-repeat;box-shadow:0 12px 35px rgba(0,0,0,.18);overflow:hidden;display:flex}.timbrado-editor-sheet.portrait{width:min(560px,82vw);aspect-ratio:210/297}.timbrado-editor-sheet.landscape{width:min(820px,86vw);aspect-ratio:297/210}.timbrado-editor-via{position:relative;width:100%;height:100%;border-right:1px dashed rgba(20,33,61,.55)}.timbrado-editor-sheet.two-up .timbrado-editor-via{width:50%}.timbrado-editor-via:last-child{border-right:0}.timbrado-editor-field{position:absolute;z-index:3;overflow:hidden;padding:5px 7px;line-height:1.25;cursor:move;touch-action:none;user-select:none}.timbrado-editor-field.name-field{border:2px dashed #087df1;background:rgba(216,237,255,.76);color:#06356b}.timbrado-editor-field.content-field{border:2px dashed #f08a24;background:rgba(255,239,214,.76);color:#6a3508}.timbrado-page{--tim-name-top:29.63%;--tim-name-left:8.57%;--tim-name-width:82.86%;--tim-name-font:14px;--tim-body-top:36.36%;--tim-body-left:33.33%;--tim-body-width:58.1%;--tim-body-height:42.09%;--tim-body-font:14px}.timbrado-name-field{position:absolute;z-index:3;top:var(--tim-name-top);left:var(--tim-name-left);width:var(--tim-name-width);font-size:var(--tim-name-font);line-height:1.25}.timbrado-content{position:absolute!important;z-index:3;top:var(--tim-body-top);left:var(--tim-body-left);width:var(--tim-body-width);height:var(--tim-body-height);padding:0!important;overflow:hidden;font-size:var(--tim-body-font)!important;line-height:1.4}.receita-folha.has-timbrado-two-up,.receita-via.has-timbrado{background-color:#fff;background-size:100% 100%;background-position:center;background-repeat:no-repeat}.receita-via.has-timbrado{padding:0!important}.receita-via .timbrado-name-field,.receita-via .timbrado-content{font-size:9px}.timbrado-receita-content h4{margin:0 0 5px!important;padding:0!important;border:0!important}.timbrado-receita-content .receita-meds{height:auto!important;max-height:none!important}.timbrado-receita-content .receita-assinatura,.timbrado-receita-content .receita-rodape{position:static!important;margin-top:8px}.global-new-patient-modal{position:fixed;inset:0;z-index:12000;display:flex;align-items:center;justify-content:center;padding:20px}.global-new-patient-modal[hidden]{display:none}.global-new-patient-overlay{position:absolute;inset:0;background:rgba(2,9,23,.64)}.global-new-patient-box{position:relative;width:min(520px,94vw);background:var(--mw-card,#fff);color:var(--mw-text,#071529);border:1px solid var(--mw-border,#cdd9e8);border-radius:16px;box-shadow:0 24px 80px rgba(0,0,0,.32);overflow:hidden}.global-new-patient-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 20px;border-bottom:1px solid var(--mw-border,#cdd9e8)}.global-new-patient-head h3{margin:0}.global-new-patient-body{padding:22px}.global-new-patient-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}
@media(max-width:900px){.timbrado-field-grid{grid-template-columns:1fr 1fr}.timbrado-editor-pages{justify-content:flex-start}.timbrado-editor-field{font-size:10px!important}}
.receita-via .timbrado-name-field{font-size:calc(var(--tim-name-font) * .68)}.receita-via .timbrado-content{font-size:calc(var(--tim-body-font) * .68)!important}

/* V64 - modelos de atestado e declaração de comparecimento */
.atestado-modelo-preview{margin:4px 0 16px;padding:16px 18px;border:1px solid var(--b);border-left:4px solid #1684d9;border-radius:10px;background:#f7faff;line-height:1.65}
html[data-theme="dark"] .atestado-modelo-preview,body.dark-theme .atestado-modelo-preview{background:#111b2a;color:#eef4ff;border-color:#2c405c;border-left-color:#35a7ff}

/* V62 - CID e assinatura independentes no papel timbrado */
.timbrado-editor-field.nome-field{border:2px dashed #087df1;background:rgba(216,237,255,.76);color:#06356b}.timbrado-editor-field.conteudo-field{border:2px dashed #f08a24;background:rgba(255,239,214,.76);color:#6a3508}.timbrado-editor-field.cid-field{border:2px dashed #1d9b62;background:rgba(217,250,232,.82);color:#075c38}.timbrado-editor-field.assinatura-field{border:2px dashed #7e57c2;background:rgba(238,229,255,.82);color:#43267a;text-align:center}.preview-signature-line,.timbrado-signature-line{display:block;width:86%;margin:2px auto 5px;border-top:1px solid currentColor}.timbrado-cid-field,.timbrado-signature-field{position:absolute;z-index:3;overflow:hidden;line-height:1.3}.timbrado-cid-field{top:var(--tim-cid-top);left:var(--tim-cid-left);width:var(--tim-cid-width);height:var(--tim-cid-height);font-size:var(--tim-cid-font)}.timbrado-signature-field{top:var(--tim-sign-top);left:var(--tim-sign-left);width:var(--tim-sign-width);height:var(--tim-sign-height);font-size:var(--tim-sign-font);text-align:center}.receita-via .timbrado-cid-field{font-size:calc(var(--tim-cid-font) * .68)}.receita-via .timbrado-signature-field{font-size:calc(var(--tim-sign-font) * .68)}

/* V63 - impressão, configurações, usuários e contraste */
.timbrado-background-image{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;z-index:0;pointer-events:none;display:block}.timbrado-page,.receita-folha.has-timbrado-two-up,.receita-via.has-timbrado{font-family:var(--tim-font-family,Arial,sans-serif)}
.side-nav-group{margin:2px 0}.side-nav-group summary{display:flex;align-items:center;gap:14px;color:#fff;padding:12px 14px;border-radius:12px;font-weight:800;cursor:pointer;list-style:none;min-height:42px}.side-nav-group summary::-webkit-details-marker{display:none}.side-nav-group summary:hover,.side-nav-group summary.active{background:rgba(7,141,255,.18)}.side-nav-group .group-arrow{margin-left:auto;transition:transform .18s}.side-nav-group[open] .group-arrow{transform:rotate(180deg)}.side-nav-submenu{display:grid;gap:3px;margin:4px 0 5px 22px;padding-left:9px;border-left:1px solid rgba(255,255,255,.18)}.side-nav-submenu a{font-size:13px!important;min-height:37px!important;padding:8px 10px!important}body.sidebar-collapsed .side-nav-group summary{width:52px;height:46px;padding:0;justify-content:center}body.sidebar-collapsed .side-nav-group .group-arrow,body.sidebar-collapsed .side-nav-submenu{display:none!important}
.settings-modules{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-bottom:16px}.settings-module{display:flex;align-items:center;gap:13px;padding:15px;border:1px solid var(--mw-border);border-radius:14px;background:var(--mw-card);color:var(--mw-text)!important;text-decoration:none;box-shadow:0 6px 18px rgba(7,27,67,.05)}.settings-module>span{font-size:26px}.settings-module div{display:grid;gap:3px}.settings-module small{color:var(--mw-muted)}.settings-module:hover,.settings-module.active{border-color:var(--mw-blue);box-shadow:0 0 0 2px rgba(7,141,255,.12)}.row4{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}.panel-title-row{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}.professional-preview{display:grid;gap:5px;width:min(520px,100%);margin:4px 0 22px;padding:18px 20px;border-left:4px solid var(--mw-blue);border-radius:10px;background:#f4f8fc}.professional-preview strong{font-family:Georgia,serif;font-size:21px}.professional-preview span{letter-spacing:.08em}.notice-success{border-color:#8ad5ac!important;background:#effdf5!important;color:#116638}.table-responsive{overflow:auto}.catalog-field{position:relative}.catalog-field .catalog-suggestions{width:100%;top:73px}.user-form h3{margin-top:22px;padding-bottom:7px;border-bottom:1px solid var(--mw-border)}
@media(max-width:900px){.settings-modules,.row4{grid-template-columns:1fr 1fr}}@media(max-width:620px){.settings-modules,.row4{grid-template-columns:1fr}.panel-title-row{display:block}}
html[data-theme="dark"] .settings-module,body.dark-theme .settings-module,html[data-theme="dark"] .professional-preview,body.dark-theme .professional-preview,html[data-theme="dark"] .presc-left,html[data-theme="dark"] .presc-right,html[data-theme="dark"] .presc-footer-tools,html[data-theme="dark"] .receita-selector-card,html[data-theme="dark"] .receita-select-body,html[data-theme="dark"] .weight-box,body.dark-theme .presc-left,body.dark-theme .presc-right,body.dark-theme .presc-footer-tools,body.dark-theme .receita-selector-card,body.dark-theme .receita-select-body,body.dark-theme .weight-box{background:#111b2a!important;color:#eef4ff!important;border-color:#2b3b52!important}
html[data-theme="dark"] input::placeholder,html[data-theme="dark"] textarea::placeholder,body.dark-theme input::placeholder,body.dark-theme textarea::placeholder{color:#8fa4bf!important;opacity:1}
html[data-theme="dark"] input:disabled,html[data-theme="dark"] select:disabled,html[data-theme="dark"] textarea:disabled,body.dark-theme input:disabled,body.dark-theme select:disabled,body.dark-theme textarea:disabled{background:#0c1522!important;color:#9fb2ca!important;opacity:1}
html[data-theme="dark"] .badge,body.dark-theme .badge{background:#183653!important;color:#9fd0ff!important}html[data-theme="dark"] .badge.ok,html[data-theme="dark"] .status.ok,html[data-theme="dark"] .status-pill.ok,body.dark-theme .badge.ok,body.dark-theme .status.ok,body.dark-theme .status-pill.ok{background:#123d2c!important;color:#8af0b3!important}html[data-theme="dark"] .badge.danger,html[data-theme="dark"] .badge-red,body.dark-theme .badge.danger,body.dark-theme .badge-red{background:#4a2028!important;color:#ffb0bb!important}html[data-theme="dark"] .badge.risco-amarelo,body.dark-theme .badge.risco-amarelo{background:#4b4118!important;color:#ffe889!important}html[data-theme="dark"] .badge.risco-verde,body.dark-theme .badge.risco-verde{background:#123d2c!important;color:#8af0b3!important}html[data-theme="dark"] .badge.risco-azul,body.dark-theme .badge.risco-azul{background:#173a62!important;color:#9dceff!important}

/* V65 - usuários e perfis de acesso */
.user-module-head{display:flex;align-items:center;justify-content:space-between;gap:18px}.user-module-head h1{margin:0 0 6px}.user-module-tabs{display:flex;gap:8px;flex-wrap:wrap}.access-profile-grid{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(320px,.8fr);gap:16px}.profile-active-check{display:flex;align-items:center;gap:9px;margin:2px 0 18px}.profile-active-check input,.permission-card input{width:auto;margin:0;flex:0 0 auto}.permission-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:10px 0 20px}.permission-card{display:flex;align-items:flex-start;gap:11px;min-height:86px;margin:0;padding:13px;border:1px solid var(--mw-border);border-radius:12px;background:var(--drw-surface-2,#f7f9fc);cursor:pointer}.permission-card:has(input:checked){border-color:var(--mw-blue);background:rgba(7,141,255,.09);box-shadow:0 0 0 2px rgba(7,141,255,.08)}.permission-card input{margin-top:4px}.permission-icon{font-size:23px;line-height:1}.permission-card>span:last-child{display:grid;gap:4px}.permission-card small{color:var(--mw-muted);font-weight:400;line-height:1.35}.system-profile-card,.custom-profile-card{padding:15px;margin-top:12px;border:1px solid var(--mw-border);border-radius:13px;background:var(--drw-surface-2,#f7f9fc)}.system-profile-card{border-color:#86c7ff;background:linear-gradient(135deg,rgba(7,141,255,.11),rgba(32,200,255,.05))}.profile-card-title{display:flex;align-items:center;gap:10px}.profile-card-title>span:first-child{font-size:24px}.profile-card-title>div{display:grid;gap:2px;min-width:0;flex:1}.profile-card-title small{color:var(--mw-muted)}.profile-permission-tags{display:flex;gap:5px;flex-wrap:wrap;margin:12px 0}.profile-permission-tags span{padding:5px 8px;border-radius:999px;background:rgba(7,141,255,.12);color:#0867bd;font-size:11px;font-weight:700}.profile-card-actions{display:flex;align-items:center;justify-content:flex-end;gap:7px}.profile-card-actions>small{margin-right:auto}.profile-card-actions form{margin:0}.admin-profile-badge{background:#173a62!important;color:#b8dcff!important}.btn:disabled{opacity:.48;cursor:not-allowed}.access-denied-panel{display:flex;align-items:center;gap:22px;max-width:780px;margin:30px auto;padding:28px}.access-denied-icon{display:grid;place-items:center;flex:0 0 auto;width:76px;height:76px;border-radius:20px;background:rgba(7,141,255,.12);font-size:36px}
html[data-theme="dark"] .permission-card,body.dark-theme .permission-card,html[data-theme="dark"] .system-profile-card,body.dark-theme .system-profile-card,html[data-theme="dark"] .custom-profile-card,body.dark-theme .custom-profile-card{background:#111b2a!important;color:#eef4ff!important;border-color:#2b3b52!important}html[data-theme="dark"] .permission-card:has(input:checked),body.dark-theme .permission-card:has(input:checked){background:#12304f!important;border-color:#35a7ff!important}html[data-theme="dark"] .profile-permission-tags span,body.dark-theme .profile-permission-tags span{background:#173a62;color:#b8dcff}
@media(max-width:1000px){.access-profile-grid{grid-template-columns:1fr}.permission-grid{grid-template-columns:1fr 1fr}}@media(max-width:700px){.user-module-head,.access-denied-panel{align-items:flex-start;flex-direction:column}.permission-grid{grid-template-columns:1fr}.user-module-tabs,.user-module-tabs .btn{width:100%}}
