:root {
  --navy: #10283B;
  --cream: #E9E6DF;
  --mist: #9BAAB4;
  --surface: #f8f7f4;
  --line: #d1d4d2;
  --secondary: #516673;
  --rail: 84px;
  --drawer: 260px;
}
body { color: var(--navy); background: var(--cream); }
body.has-sidebar { min-width: 0; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--mist); outline-offset: 3px; }
.card { min-width: 0; background: var(--surface); border: 1px solid rgba(16,40,59,.07); box-shadow: 0 3px 18px rgba(16,40,59,.035); }
.btn { min-height: 40px; transition: background-color .15s, border-color .15s, color .15s; }
.btn-primario { background: var(--navy); color: var(--cream); }
.btn-primario:hover { background: #284355; }
.btn-secundario { background: var(--surface); border-color: #b8c1c4; color: var(--navy); }
.btn-secundario:hover { background: var(--cream); border-color: var(--mist); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea { background-color: var(--surface); color: var(--navy); border-color: #b8c1c4; }
input[type=radio], input[type=checkbox] { accent-color: var(--navy); }
input::placeholder, textarea::placeholder { color: #657c8b; }
.app-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--rail); height: 100vh; height: 100dvh;
  z-index: 60; display: flex; flex-direction: column; padding: 0 12px;
  color: var(--cream); background: var(--navy); border-right: 1px solid rgba(155,170,180,.15);
  transition: width .22s ease, transform .22s ease, box-shadow .22s ease;
}
.sidebar-brand-row { position: relative; height: 88px; flex-shrink: 0; display: flex; align-items: center; }
.sidebar-brand { position: relative; display: block; height: 52px; width: 100%; overflow: hidden; border-radius: 12px; }
.brand-compact { position: absolute; inset: 4px auto 4px 6px; width: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--cream); transition: opacity .15s; }
.brand-compact img { height: 36px; width: 36px; object-fit: contain; }
.brand-full { position: absolute; inset: 0 auto 0 0; width: 214px; display: flex; align-items: center; justify-content: center; background: var(--cream); border-radius: 12px; opacity: 0; transition: opacity .15s; }
.brand-full img { width: 148px; height: auto; max-height: 46px; object-fit: contain; }
.sidebar-scroll { min-height: 0; flex: 1; overflow-x: hidden; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #4c6271 transparent; }
.sidebar-nav { display: flex; flex-direction: column; gap: 5px; padding: 0 0 12px; }
.side-link { position: relative; display: flex; align-items: center; gap: 15px; min-height: 46px; width: 100%; padding: 11px 17px; border-radius: 12px; white-space: nowrap; color: var(--mist); font-size: 14px; font-weight: 500; text-align: left; }
.side-link svg { flex-shrink: 0; height: 22px; width: 22px; }
.side-link:hover { color: var(--cream); background: rgba(155,170,180,.12); }
.side-link[aria-current=page] { color: var(--navy); background: var(--cream); }
.nav-label { display: block; overflow: hidden; opacity: 0; max-width: 0; transition: opacity .15s; }
.sidebar-section { height: 25px; display: flex; align-items: center; overflow: hidden; padding: 0 17px; color: var(--mist); font-size: 10px; letter-spacing: .13em; text-transform: uppercase; }
.sidebar-section span, .sidebar-note span { white-space: nowrap; opacity: 0; transition: opacity .15s; }
.sidebar-account-section { margin-top: 20px; border-top: 1px solid rgba(155,170,180,.18); padding-top: 20px; height: 42px; }
.sidebar-badge { position: absolute; right: 4px; top: 2px; min-width: 16px; padding: 0 3px; border-radius: 12px; background: var(--mist); color: var(--navy); font-size: 10px; line-height: 16px; text-align: center; }
.sidebar-footer { border-top: 1px solid rgba(155,170,180,.18); padding: 12px 0 max(12px, env(safe-area-inset-bottom)); flex-shrink: 0; }
.sidebar-note { padding: 8px 16px 0; overflow: hidden; color: var(--mist); font-size: 10px; }
.sidebar-close { display: none; }
.app-topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 80px; margin-left: var(--rail); padding: 14px clamp(20px, 3vw, 48px); border-bottom: 1px solid var(--line); background: rgba(248,247,244,.95); backdrop-filter: blur(14px); }
.topbar-leading { display: flex; align-items: center; gap: 18px; min-width: 0; }
.menu-toggle { height: 40px; width: 40px; flex-shrink: 0; display: grid; place-items: center; color: var(--navy); border: 1px solid var(--line); border-radius: 11px; background: transparent; }
.menu-toggle:hover { background: var(--cream); }
.topbar-intro { min-width: 0; }
.topbar-intro > span { display: block; font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--secondary); }
.topbar-intro > p { margin-top: 3px; font-weight: 600; font-size: 14px; max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-brand { display: none; }
.app-content { margin-left: var(--rail); min-width: 0; padding: 32px clamp(20px, 3vw, 48px) 48px; }
.content-inner { max-width: 1320px; margin: 0 auto; min-width: 0; }
.odonto #grafico { min-width: 0; max-width: 100%; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; scrollbar-color: var(--mist) var(--cream); }
.app-topbar [data-menu-conta] summary { max-width: 210px; }
.sidebar-backdrop { display: none; }
@media (min-width: 900px) {
  .app-sidebar:is(:hover, :focus-within, .is-pinned) { width: var(--drawer); box-shadow: 16px 0 42px rgba(16,40,59,.14); }
  .app-sidebar:is(:hover, :focus-within, .is-pinned) .nav-label { opacity: 1; max-width: 185px; }
  .app-sidebar:is(:hover, :focus-within, .is-pinned) :is(.sidebar-section, .sidebar-note) span { opacity: 1; }
  .app-sidebar:is(:hover, :focus-within, .is-pinned) .brand-compact { opacity: 0; }
  .app-sidebar:is(:hover, :focus-within, .is-pinned) .brand-full { opacity: 1; }
  .app-sidebar:is(:hover, :focus-within, .is-pinned) .sidebar-badge { position: static; margin-left: auto; padding: 1px 6px; }
}
@media (max-width: 899px) {
  .app-sidebar { width: min(var(--drawer), 86vw); transform: translateX(-100%); padding-top: env(safe-area-inset-top); }
  body[data-menu-aberto] { overflow: hidden; }
  body[data-menu-aberto] .app-sidebar { transform: translateX(0); box-shadow: 12px 0 45px rgba(16,40,59,.25); }
  .sidebar-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; background: rgba(16,40,59,.45); z-index: 50; backdrop-filter: blur(3px); }
  .app-sidebar .nav-label { opacity: 1; max-width: 185px; }
  .app-sidebar :is(.sidebar-section, .sidebar-note) span { opacity: 1; }
  .brand-compact { opacity: 0; }
  .brand-full { width: 184px; opacity: 1; }
  .sidebar-close { position: absolute; right: 0; top: 25px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--cream); font-size: 25px; background: rgba(155,170,180,.13); }
  .sidebar-badge { position: static; margin-left: auto; padding: 1px 6px; }
  .app-topbar { margin-left: 0; min-height: 70px; padding: 10px 20px; }
  .app-content { margin-left: 0; padding: 24px 20px 40px; }
}
@media (max-width: 639px) {
  .app-topbar { min-height: 66px; padding: 10px 12px; gap: 8px; }
  .topbar-leading { gap: 10px; }
  .topbar-intro { display: none; }
  .mobile-brand { display: block; width: 94px; }
  .mobile-brand img { width: 94px; height: auto; }
  .app-topbar [data-menu-conta] summary { max-width: 128px; padding-left: 4px; padding-right: 4px; font-size: 12px; }
  .app-topbar > .flex { gap: 5px; }
  .app-content { padding: 20px 12px 32px; }
  .card { border-radius: 16px; }
  h1 { overflow-wrap: anywhere; }
}
@media (max-width: 359px) {
  .mobile-brand, .mobile-brand img { width: 76px; }
  .app-topbar [data-menu-conta] summary { max-width: 100px; }
  .topbar-leading { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .app-sidebar, .nav-label, .brand-compact, .brand-full, .sidebar-section span, .sidebar-note span { transition: none; }
}
