/* ═══════════════════════════════════════════════════════════════════════
   SHELL — lateral + barra superior com o botão ☰ (porte da Micarla, 02/10/2026).
   Na giliane só o Painel (/) usa. O body vira grid: coluna 1 = lateral (sticky),
   coluna 2 = barra + conteúdo da página como ele já é (nada é movido). Montado
   por /js/shell.js. Tokens: app.css (--surface/--border/--text/--red…) + os
   apelidos abaixo (dourado da Madame no Brás como acento).
   ═══════════════════════════════════════════════════════════════════════ */
:root {
  --mf-sb-w: 248px;
  --mf-top-h: var(--topbar-h, 60px);
  --gold: #c9a26a; --accent-ink: #2a0719; --gold-border: rgba(201,162,106,.42);
  --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
  --r-ctl: 10px; --r-card: 16px;
  --mf-card-shadow: 0 1px 0 rgba(0,0,0,.25), 0 14px 34px -20px rgba(0,0,0,.7);
  --mf-ring: 0 0 0 3px rgba(201,162,106,.24);
}
[data-theme="light"] {
  --gold: #9a6a2f; --accent-ink: #fff; --gold-border: rgba(154,106,47,.4);
  --mf-card-shadow: 0 1px 2px rgba(42,7,25,.05), 0 10px 28px -14px rgba(42,7,25,.2);
  --mf-ring: 0 0 0 3px rgba(154,106,47,.18);
}

body.mf-shell-on {
  display: grid !important;
  grid-template-columns: var(--mf-sb-w) minmax(0, 1fr);
  grid-auto-rows: max-content;
  align-content: start;
  min-height: 100dvh;
}
body.mf-shell-on > * { grid-column: 2; min-width: 0; }
body.mf-shell-on > .mf-sidebar { grid-column: 1; grid-row: 1 / span 9999; }
body.mf-shell-on > .mf-legacy-hidden, body.mf-shell-on > header.topbar { display: none !important; }
body.mf-shell-on .mf-legacy-hidden { display: none !important; }
body.mf-shell-on .page-content { max-width: none; }
body.mf-shell-on > footer.footer { align-self: end; }

/* ── Lateral ─────────────────────────────────────────────────────── */
.mf-sidebar {
  position: sticky; top: 0; height: 100dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 14px 12px; gap: 6px; z-index: 40;
  font-family: var(--font-ui);
}
.mf-brand { display: flex; align-items: center; gap: 12px; padding: 8px 8px 16px; border-bottom: 1px solid var(--border); margin-bottom: 8px; color: inherit; text-decoration: none; }
.mf-brand__logo { width: 42px; height: 42px; border-radius: var(--r-ctl, 10px); flex: none; display: grid; place-items: center; background: rgba(201,162,106,.16); border: 1px solid rgba(201,162,106,.45); color: #d8b87f; font-weight: 800; font-size: 15px; letter-spacing: .02em; }
[data-theme="light"] .mf-brand__logo { color: #9a6a2f; }
.mf-brand__name { font-family: var(--font-ui); font-weight: 800; letter-spacing: -.02em; font-size: 14.5px; line-height: 1.15; color: var(--text); }
.mf-brand__sys { font-size: 11px; color: var(--text-muted); margin-top: 3px; letter-spacing: .04em; }
.mf-nav { display: flex; flex-direction: column; gap: 2px; }
.mf-nav__item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-ctl, 10px); color: var(--text-muted); font-weight: 600; font-size: 13.5px; text-decoration: none; transition: background .15s, color .15s; position: relative; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; font-family: inherit; white-space: nowrap; }
.mf-nav__item:hover { background: var(--surface2); color: var(--text); }
.mf-nav__item.is-active { background: var(--gold); color: var(--accent-ink, #fff); box-shadow: 0 8px 18px -10px rgba(154,106,47,.7); }
.mf-nav__item svg { width: 19px; height: 19px; flex: none; }
.mf-nav__item .ti { font-size: 19px; flex: none; width: 19px; text-align: center; }
.mf-nav__item .mf-chev { margin-left: auto; opacity: .55; font-size: 15px; width: 15px; transition: transform .2s; }
.mf-nav__badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; display: none; align-items: center; justify-content: center; }
.mf-nav__badge.on { display: inline-flex; }
.mf-sidebar__spacer { flex: 1; }
.mf-me { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-top: 1px solid var(--border); margin-top: 8px; }
.mf-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--gold); color: var(--accent-ink, #fff); display: grid; place-items: center; font-weight: 800; font-size: 15px; flex: none; font-family: var(--font-ui); }
.mf-me__name { font-weight: 700; font-size: 13px; }
.mf-me__mail { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.mf-logout { color: var(--text-muted); }
.mf-logout:hover { background: var(--red-bg); color: var(--red); }

/* ── Barra superior ──────────────────────────────────────────────── */
.mf-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: var(--mf-top-h); padding: 0 22px; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); font-family: var(--font-ui); }
.mf-icon-btn { width: 40px; height: 40px; border-radius: var(--r-ctl, 10px); border: 1px solid var(--border); background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer; position: relative; transition: background .15s, transform .15s; flex: none; font-size: 18px; line-height: 1; }
.mf-icon-btn:hover { background: var(--surface2); }
.mf-icon-btn:active { transform: scale(.96); }
.mf-icon-btn svg { width: 19px; height: 19px; }
.mf-icon-btn .ti { font-size: 19px; }
.mf-icon-btn .mf-dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 800; display: none; align-items: center; justify-content: center; border: 2px solid var(--surface); }
.mf-icon-btn .mf-dot.on { display: inline-flex; }
.mf-top__actions { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: nowrap; }
.mf-top__actions > * { flex: none; }
.mf-top__spacer { flex: 1; }
.mf-top__who { text-align: right; line-height: 1.2; }
.mf-top__who b { font-size: 13.5px; display: block; }
.mf-top__who span { font-size: 11.5px; color: var(--text-muted); }
.mf-top__sep { width: 1px; height: 28px; background: var(--border); }
.mf-top__brand { display: none; align-items: center; gap: 8px; font-weight: 800; color: var(--text); font-size: 14px; text-decoration: none; white-space: nowrap; min-width: 0; }
.mf-top__brand-name { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 400px) { .mf-top__brand-name { display: none; } }
.mf-scrim { position: fixed; inset: 0; background: rgba(15, 23, 42,.5); z-index: 35; display: none; }
.mf-scrim.on { display: block; }

/* ── Responsivo: lateral vira gaveta aberta pelo ☰ ───────────────── */
@media (max-width: 1024px) {
  body.mf-shell-on { grid-template-columns: minmax(0, 1fr); }
  body.mf-shell-on > * { grid-column: 1; }
  body.mf-shell-on > .mf-sidebar { position: fixed; left: 0; top: 0; width: min(300px, 86vw); transform: translateX(-104%); transition: transform .25s cubic-bezier(.2,.7,.2,1); z-index: 50; box-shadow: 0 20px 60px rgba(0,0,0,.35); grid-row: auto; }
  body.mf-shell-on > .mf-sidebar.open { transform: none; }
  .mf-top__who, .mf-top__sep { display: none; }
  .mf-top__brand { display: inline-flex; }
}
@media (max-width: 640px) {
  .mf-top { padding: 0 12px; gap: 8px; }
  .mf-top__actions .btn, .mf-top__actions button { font-size: 12px; padding: 6px 10px; }
}
@media (max-width: 480px) { .mf-top__actions > span { display: none; } }

/* Lateral em GAVETA em qualquer largura (classe mf-side-drawer no body) */
body.mf-shell-on.mf-side-drawer { grid-template-columns: minmax(0, 1fr); }
body.mf-shell-on.mf-side-drawer > * { grid-column: 1; }
body.mf-shell-on.mf-side-drawer > .mf-sidebar {
  position: fixed; left: 0; top: 0; width: min(300px, 86vw);
  transform: translateX(-104%); transition: transform .25s cubic-bezier(.2,.7,.2,1);
  z-index: 120; box-shadow: 0 20px 60px rgba(0,0,0,.35); grid-row: auto;
}
body.mf-shell-on.mf-side-drawer > .mf-sidebar.open { transform: none; }
body.mf-shell-on.mf-side-drawer > .mf-scrim { z-index: 110; }

/* Com a lateral já fixa na tela, o ☰ não abre nada — some. Ele fica onde faz
   falta: na gaveta e no celular/tablet, onde a lateral fica escondida. */
@media (min-width: 1025px) {
  body.mf-shell-on:not(.mf-side-drawer) #btnMenu { display: none; }
}

@media print { .mf-sidebar, .mf-top, .mf-scrim { display: none !important; } body.mf-shell-on { display: block !important; } }
