/* ==========================================================
   Layouts / shells
   ========================================================== */

/* ---------- Desktop shell: sidebar + topbar ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; background: #fff; display: flex; flex-direction: column;
  padding: 26px 16px 24px; border-right: 1px solid #F0F0F2; overflow-y: auto; scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar .logo { align-self: flex-start; margin: 0 0 26px 22px; }
.nav { display: flex; flex-direction: column; gap: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: var(--r-md);
  color: var(--muted); font-size: var(--fs-base); font-weight: 400; transition: background .15s, color .15s; position: relative;
}
.nav-item .ic { width: 19px; height: 19px; color: #6E6E77; }
.nav-item:hover { background: #F7F8FA; color: var(--ink); }
.nav-item.active { background: var(--nav-active); color: var(--ink); font-weight: 500; }
.nav-item.active .ic { color: var(--red); }
.nav-item .count { margin-left: auto; }
.nav-group-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); padding: 16px 12px 6px; }
.sidebar-spacer { flex: 1; min-height: 24px; }
.sidebar-promo {
  position: relative; border-radius: var(--r-md); overflow: hidden; color: #fff; padding: 16px 14px 18px; min-height: 220px;
  background: #2a1512 center / cover no-repeat; display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px;
}
.sidebar-promo::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,8,8,.15) 0%, rgba(20,8,8,.55) 55%, rgba(14,6,6,.85) 100%); }
.sidebar-promo > * { position: relative; }
.sidebar-promo .eyebrow { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; opacity: .85; }
.sidebar-promo .title { font-size: 19px; font-weight: 400; line-height: 1.2; }
.sidebar-promo .txt { font-size: 12px; line-height: 1.45; opacity: .95; }
.sidebar-promo .btn { align-self: flex-start; background: #F1F5F9; color: var(--ink); height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 7px; margin-top: 4px; }
.sidebar-promo .btn:hover { background: #fff; }
.sidebar-help { display: flex; align-items: center; gap: 12px; color: var(--muted); padding: 8px 12px; border-radius: var(--r-md); }
.sidebar-help:hover { color: var(--ink); background: #F7F8FA; }

.app-main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 22px var(--page-pad) 0; }
.topbar .search { width: min(460px, 100%); }
.topbar-search { position: relative; flex: 0 1 460px; }
.topbar-search .input { height: 44px; border-color: transparent; background: #fff; border-radius: var(--r-md); box-shadow: 0 0 0 1px #EFEFF2; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.loc-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: var(--r-md); background: #fff; font-size: var(--fs-md); font-weight: 500; border: 1px solid #EFEFF2; }
.loc-btn .ic:first-child { color: var(--red); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: var(--r-md); }
.user-chip:hover { background: rgba(255,255,255,.7); }
.user-chip .uc-text { text-align: left; }
.user-chip .name, .user-chip .role { display: block; }
.user-chip .name { font-size: var(--fs-md); font-weight: 500; line-height: 1.2; color: var(--ink); }
.user-chip .role { font-size: 11px; color: var(--muted); }
.user-chip .avatar { width: 36px; height: 36px; border-radius: var(--r-sm); }
.content { padding: 24px var(--page-pad) 48px; flex: 1; min-width: 0; }
.content.narrow { max-width: 1120px; }

/* ---------- Mobile shell ---------- */
.m-shell { min-height: 100vh; background: var(--bg); display: flex; flex-direction: column; }
.m-header { position: sticky; top: 0; z-index: 30; background: rgba(245,245,245,.92); backdrop-filter: blur(12px); display: flex; align-items: center; gap: 12px; padding: 14px 20px; min-height: 60px; }
.m-header.white { background: rgba(255,255,255,.94); }
.m-header .m-title { font-size: var(--fs-lg); font-weight: 500; flex: 1; text-align: center; }
.m-header .icon-btn { border-color: transparent; background: #fff; }
.m-content { flex: 1; padding: 8px 20px calc(96px + env(safe-area-inset-bottom)); }
.m-content.no-tab { padding-bottom: 32px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fff; display: flex; justify-content: space-around;
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 24px rgba(14,13,18,.06); border-radius: 22px 22px 0 0;
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: #8A8A93; min-width: 56px; padding: 4px; position: relative; }
.tabbar a .ic { width: 24px; height: 24px; }
.tabbar a.active { color: var(--red); }
.tabbar a .count { position: absolute; top: -2px; left: calc(50% + 6px); right: auto; min-width: 18px; height: 18px; font-size: 10px; border: 2px solid #fff; box-sizing: content-box; }
.m-bottom-cta { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fff; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 24px rgba(14,13,18,.06); }

/* Frame de celular — telas exclusivamente mobile vistas no desktop */
.phone-stage { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: radial-gradient(1200px 600px at 50% -10%, #fff 0%, #EDEDF0 60%); }
.phone-stage .stage-note { position: fixed; top: 16px; left: 16px; display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.phone {
  width: 390px; height: min(844px, calc(100vh - 64px)); border-radius: 48px; background: #fff; position: relative; overflow: hidden;
  box-shadow: 0 0 0 10px #121116, 0 0 0 11px #2b2a31, 0 40px 80px rgba(14,13,18,.28);
}
.phone .phone-scroll { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.phone .phone-scroll::-webkit-scrollbar { display: none; }
.phone .m-shell { min-height: 100%; }
.phone .tabbar, .phone .m-bottom-cta { position: sticky; }
.phone .m-shell.has-tab { display: flex; flex-direction: column; }
.phone .m-content { padding-bottom: 24px; }
.statusbar { height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px 0 34px; font-size: 15px; font-weight: 600; position: relative; z-index: 31; }
.statusbar.on-dark { color: #fff; }
.statusbar .sb-icons { display: flex; gap: 6px; align-items: center; }
@media (max-width: 767px) {
  .phone-stage { padding: 0; display: block; background: var(--bg); }
  .phone-stage .stage-note { display: none; }
  .phone { width: 100%; height: auto; min-height: 100vh; border-radius: 0; box-shadow: none; overflow: visible; }
  .phone .phone-scroll { position: static; overflow: visible; }
  .phone .m-shell { min-height: 100vh; min-height: 100dvh; }
  .phone .tabbar, .phone .m-bottom-cta { position: fixed; }
  .phone .m-content { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .statusbar { display: none; }
}

/* ---------- Auth (split: foto + formulário) ---------- */
.auth { display: grid; grid-template-columns: 1.4fr 1fr; min-height: 100vh; background: #F3F3F4; }
.auth-hero { position: relative; color: #fff; padding: 56px 66px 40px; display: flex; flex-direction: column; background: #111 center / cover no-repeat; overflow: hidden; }
.auth-hero::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10,10,14,.82) 0%, rgba(10,10,14,.55) 55%, rgba(10,10,14,.35) 100%); }
.auth-hero > * { position: relative; }
.auth-hero > .logo { align-self: flex-start; }
.auth-hero .eyebrow { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; opacity: .85; margin-bottom: 18px; }
.auth-hero h1 { color: #fff; font-size: 44px; line-height: 1.12; font-weight: 500; letter-spacing: -.02em; }
.auth-hero h1 .r { color: var(--red); }
.auth-hero .lead { margin-top: 20px; font-size: 15px; opacity: .9; }
.auth-feats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 36px; max-width: 560px; }
.auth-feats .fi { width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,.12); display: grid; place-items: center; margin-bottom: 12px; backdrop-filter: blur(6px); }
.auth-feats b { display: block; font-weight: 500; font-size: 14px; }
.auth-feats span { font-size: 12.5px; opacity: .75; }
.auth-foot { margin-top: auto; display: flex; gap: 24px; font-size: 12.5px; opacity: .75; }
.auth-foot a:hover { opacity: 1; text-decoration: underline; }
.auth-panel { display: grid; place-items: center; padding: 40px; }
.auth-card { width: min(488px, 100%); background: #fff; border: 1px solid var(--line); border-radius: var(--r-2xl); padding: 40px; }
.auth-card .eyebrow { color: var(--red); font-size: 12px; letter-spacing: .14em; font-weight: 500; text-transform: uppercase; }
.auth-card h2 { font-size: 28px; font-weight: 500; letter-spacing: -.02em; margin-top: 8px; }
@media (max-width: 1023px) { .auth { grid-template-columns: 1fr; } .auth-hero { display: none; } .auth-panel { padding: 24px 16px; } .auth-card { border: 0; padding: 28px 20px; } }

/* ---------- Responsivo do desktop shell ---------- */
.mobile-only { display: none !important; }
@media (max-width: 1023px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 90; transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--sh-lg); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(14,13,18,.4); z-index: 80; }
  .topbar { padding: 14px 16px 0; gap: 10px; }
  .topbar .menu-toggle { display: inline-grid !important; }
  .topbar-search { flex: 1; }
  .user-chip .name, .user-chip .role, .user-chip > .ic, .loc-btn span, .loc-btn .ic:last-child { display: none; }
  .content { padding: 18px 16px 110px; }
  .page-title { font-size: 24px; }
  .page-sub { font-size: var(--fs-base); }
  .desktop-only { display: none !important; }
  .mobile-only { display: revert !important; }
  .card { padding: 18px; border-radius: var(--r-lg); }
}
.menu-toggle { display: none !important; }
@media (max-width: 767px) {
  .topbar .topbar-search { display: none; }
  .shell.has-tabbar .content { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
}
