/* =========================================================
   Layout da área interna: sidebar + topbar + conteúdo
   ========================================================= */
.shell { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 100;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: var(--navy); color: #fff;
  padding-top: var(--safe-top);
}
.sidebar__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar__brand { display: block; }
.sidebar__close { display: none; color: #fff; }
.sidebar__close:hover { background: rgba(255,255,255,.1); }

.nav { flex: 1; overflow-y: auto; padding: 10px 10px 20px; }
.nav__section { margin-top: 12px; }
.nav__label { padding: 6px 12px; font-size: .7rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.4); }
.nav__item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin: 2px 0;
  border-radius: 10px; color: rgba(255,255,255,.78); text-decoration: none; font-weight: 600; font-size: .93rem;
  transition: background .15s, color .15s;
}
.nav__item .icon { color: rgba(255,255,255,.5); }
.nav__item span { flex: 1; }
.nav__item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav__item.is-active { background: var(--gold); color: var(--navy); }
.nav__item.is-active .icon { color: var(--navy); }
.nav__phase { font-style: normal; font-size: .68rem; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: rgba(255,255,255,.08); color: rgba(255,255,255,.45); }
.nav__item.is-active .nav__phase { background: rgba(2,26,100,.15); color: var(--navy); }
.sidebar__foot { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px calc(14px + var(--safe-bottom)); font-size: .78rem; color: rgba(255,255,255,.4); border-top: 1px solid rgba(255,255,255,.08); }

.sidebar-backdrop { display: none; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  min-height: calc(var(--topbar-h) + var(--safe-top)); padding: var(--safe-top) 24px 0;
  background: rgba(255,255,255,.92); backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__menu { display: none; color: var(--navy); }
.topbar__title { font-size: 1.15rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__search { margin-left: auto; position: relative; display: flex; align-items: center; width: min(360px, 34vw); }
.topbar__search .icon { position: absolute; left: 12px; color: var(--muted); width: 18px; height: 18px; pointer-events: none; }
.topbar__search input { width: 100%; height: 40px; padding: 0 12px 0 38px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font: inherit; font-size: 15px; }
.topbar__search input:focus { outline: none; border-color: var(--navy); background: #fff; }

.usermenu { position: relative; }
.usermenu__btn { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border: 0; background: none; border-radius: 12px; cursor: pointer; font: inherit; text-align: left; }
.usermenu__btn:hover { background: var(--surface-2); }
.usermenu__who { display: flex; flex-direction: column; line-height: 1.15; }
.usermenu__who strong { font-size: .9rem; color: var(--navy); }
.usermenu__who small { font-size: .75rem; color: var(--muted); }
.usermenu__drop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; }
.usermenu__info { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; display: flex; flex-direction: column; }
.usermenu__info small { color: var(--muted); word-break: break-all; }
.usermenu__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; background: none; border-radius: 8px; font: inherit; color: var(--text); text-decoration: none; cursor: pointer; }
.usermenu__item:hover { background: var(--surface-2); }
.usermenu__item .icon { color: var(--muted); width: 18px; height: 18px; }

.demo-banner { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 6px 12px; background: var(--warn-bg); color: #6B4B00; font-size: .82rem; font-weight: 600; border-bottom: 1px solid #F1DC9F; }
.demo-banner .icon { width: 16px; height: 16px; }

.content { flex: 1; padding: 24px; padding-bottom: calc(24px + var(--safe-bottom)); }

.page { max-width: 1200px; margin: 0 auto; }
.page--narrow { max-width: 720px; }
.page__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page__head h2 { font-size: 1.35rem; margin-bottom: 2px; }
.page__head p { margin: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 { margin-bottom: 18px; }

/* ---------- Responsivo ---------- */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); width: min(300px, 86vw); }
  body.sidebar-open .sidebar { transform: none; }
  .sidebar__close { display: inline-flex; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(0,8,32,.5); opacity: 0; pointer-events: none; transition: opacity .2s; display: block; }
  body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  body.sidebar-open { overflow: hidden; }
  .main { margin-left: 0; }
  .topbar__menu { display: inline-flex; }
  .topbar { padding-left: 12px; padding-right: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar__search { display: none; }
  .usermenu__who { display: none; }
  .usermenu { margin-left: auto; }
  .content { padding: 16px; }
}

/* Logo oficial (escudo vertical) — tamanhos por contexto */
.sidebar__brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.sidebar__brand .logo { width: 46px; }
.sidebar__brand-text { display: flex; flex-direction: column; line-height: 1.15; color: #fff; font-weight: 800; letter-spacing: .02em; }
.sidebar__brand-text small { color: var(--gold); font-weight: 600; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; }
.about__bar .logo, .portal__bar .logo { width: 40px; }
