/* ============================================================
   Ambup — Shell (aside + topbar + main)
   Fiel ao design "Painel Ambup" (Claude Design).
   Breakpoints do design:  mob = <900px  ·  médio = <1150px
   ============================================================ */

/* ---------- Reset local (não vaza para o tema legado) ---------- */
.amb-ui,
.amb-ui *,
.amb-ui *::before,
.amb-ui *::after { box-sizing: border-box; }

.amb-ui {
    font-family: var(--mc-font-sans);
    color: var(--mc-text);
    -webkit-font-smoothing: antialiased;
}
/* Equivale ao _ds/tokens/base.css do design (que o Bootstrap sobrescreveria) */
.amb-ui { line-height: var(--mc-lh-body); }
.amb-ui h1, .amb-ui h2, .amb-ui h3,
.amb-ui h4, .amb-ui h5, .amb-ui h6 {
    margin: 0;
    color: var(--mc-text-strong);
    font-weight: var(--mc-fw-extrabold);
    line-height: var(--mc-lh-snug);
    font-size: inherit;
}
.amb-ui ::selection { background: var(--mc-blue-100); color: var(--mc-blue-900); }
.amb-ui p  { margin: 0; }
.amb-ui ul { margin: 0; padding: 0; list-style: none; }
.amb-ui a  { color: var(--mc-blue); text-decoration: none; }
.amb-ui a:hover { color: var(--mc-blue-light); }
.amb-ui input,
.amb-ui select,
.amb-ui textarea,
.amb-ui button { font-family: inherit; }
.amb-ui button { margin: 0; }

/* Barra de rolagem do design */
.amb-ui ::-webkit-scrollbar { width: 10px; height: 10px; }
.amb-ui ::-webkit-scrollbar-thumb {
    background: var(--mc-gray-300);
    border-radius: 8px;
    border: 3px solid var(--mc-gray-50);
}

/* ---------- Animações ---------- */
@keyframes ambIn    { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes ambPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.amb-in { animation: ambIn .4s cubic-bezier(.16, 1, .3, 1); }

/* ============================================================
   Shell
   ============================================================ */
.amb-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--mc-gray-50);
}

/* ---------- Aside ---------- */
.amb-aside {
    width: var(--amb-aside-w);
    flex: 0 0 var(--amb-aside-w);
    background: var(--mc-white);
    border-right: 1px solid var(--mc-border);
    display: flex;
    flex-direction: column;
    z-index: 60;
    transition: transform .3s cubic-bezier(.16, 1, .3, 1);
    position: relative;
    inset: auto;
    transform: none;
    box-shadow: none;
}

.amb-aside-brand {
    height: var(--amb-topbar-h);
    flex: 0 0 var(--amb-topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    border-bottom: 1px solid var(--mc-border-soft);
}
.amb-brand      { display: flex; align-items: center; gap: 9px; }
.amb-brand-mark {
    width: 30px; height: 30px;
    border-radius: 9px;
    background: var(--mc-grad-primary);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 17px;
}
.amb-brand-nome {
    font-size: 20px; font-weight: 800;
    letter-spacing: -.8px;
    color: var(--mc-ink);
}
.amb-drawer-fechar {
    display: none;
    background: none; border: 0;
    color: var(--mc-gray-500);
    font-size: 20px; cursor: pointer; padding: 4px;
}

/* ---------- Navegação ---------- */
.amb-nav { flex: 1; overflow-y: auto; padding: 14px 12px 20px; }

.amb-nav-group { margin-bottom: 18px; }
.amb-nav-group-titulo {
    font-size: 11px; font-weight: 700;
    letter-spacing: 1.2px; text-transform: uppercase;
    color: var(--mc-gray-400);
    padding: 0 10px;
    margin-bottom: 8px;
}
.amb-nav-itens { display: flex; flex-direction: column; gap: 2px; }

.amb-nav-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    text-align: left;
    border: 0;
    padding: 9px 10px;
    border-radius: 10px;
    font-size: 13.5px;
    cursor: pointer;
    transition: background .18s;
    background: transparent;
    color: var(--mc-gray-600);
    font-weight: 500;
}
.amb-nav-item:hover        { background: var(--mc-gray-50); color: var(--mc-gray-700); }
.amb-nav-item.is-ativo     { background: var(--mc-blue-50); color: var(--mc-blue); font-weight: 600; }
.amb-nav-item > i          { font-size: 17px; width: 18px; }
.amb-nav-item > span       { flex: 1; }
.amb-nav-badge {
    min-width: 20px; height: 19px;
    padding: 0 6px;
    border-radius: 50px;
    background: var(--mc-orange);
    color: #fff;
    font-size: 11px; font-weight: 700;
    line-height: 19px; text-align: center;
}

/* ---------- Rodapé do aside ---------- */
.amb-aside-rodape { padding: 14px; border-top: 1px solid var(--mc-border-soft); }


.amb-usuario {
    display: flex; align-items: center; gap: 10px;
    padding: 8px;
    border-radius: 12px;
    background: var(--mc-gray-50);
}
.amb-usuario-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--mc-blue-100);
    color: var(--mc-blue);
    display: flex; align-items: center; justify-content: center;
    font-size: 12.5px; font-weight: 700;
    flex: 0 0 34px;
}
.amb-usuario-info  { flex: 1; min-width: 0; }
.amb-usuario-nome  {
    font-size: 13px; font-weight: 600; color: var(--mc-ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.amb-usuario-org   {
    font-size: 11.5px; color: var(--mc-text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.amb-usuario-menu  { color: var(--mc-gray-400); background: none; border: 0; cursor: pointer; padding: 0; font-size: 16px; }

/* ---------- Backdrop do drawer ---------- */
.amb-drawer-bg {
    position: fixed;
    inset: 0;
    background: rgba(11, 31, 58, .45);
    z-index: 50;
}

/* ---------- Coluna principal ---------- */
.amb-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
}

/* ---------- Topbar ---------- */
.amb-topbar {
    height: var(--amb-topbar-h);
    flex: 0 0 var(--amb-topbar-h);
    background: var(--mc-white);
    border-bottom: 1px solid var(--mc-border);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 24px;
}
.amb-hamburger {
    display: none;
    background: none; border: 0;
    font-size: 22px; color: var(--mc-ink);
    cursor: pointer; padding: 2px 0;
}
.amb-crumbs {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 10px;
}
.amb-crumb-perfil { font-size: 13px; color: var(--mc-text-muted); }
.amb-crumb-sep    { color: var(--mc-gray-300); }
.amb-crumb-tela   {
    font-size: 13.5px; font-weight: 600; color: var(--mc-ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.amb-search {
    display: flex; align-items: center; gap: 8px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--mc-border);
    border-radius: 10px;
    background: var(--mc-gray-50);
    flex: 0 1 240px;
    min-width: 0;
}
.amb-search:focus-within { border-color: var(--mc-blue); }
.amb-search > i          { color: var(--mc-gray-400); font-size: 16px; }
.amb-search input {
    border: 0; background: none; outline: none;
    font-size: 13px; width: 100%;
    color: var(--mc-text);
}

.amb-topbar-acoes { display: flex; align-items: center; gap: 4px; }
.amb-icon-btn {
    width: 38px; height: 38px;
    border-radius: 10px;
    border: 1px solid var(--mc-border);
    background: var(--mc-white);
    color: var(--mc-gray-600);
    font-size: 18px;
    cursor: pointer;
    position: relative;
    display: inline-flex; align-items: center; justify-content: center;
}
.amb-icon-btn:hover { border-color: var(--mc-blue); color: var(--mc-blue); }

/* Sair fica vermelho no hover para não ser clicado por engano no lugar da ajuda */
.amb-icon-btn-sair:hover { border-color: var(--mc-red); color: var(--mc-red); }
.amb-icon-btn-dot {
    position: absolute; top: 6px; right: 7px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--mc-orange);
}


/* ---------- Main ---------- */
.amb-main {
    flex: 1;
    overflow-y: auto;
    padding: 26px 28px 48px;
}

/* ============================================================
   Responsivo — médio (<1150px): sem breadcrumb e sem busca no topo
   ============================================================ */
@media (max-width: 1149px) {
    .amb-crumb-perfil,
    .amb-crumb-sep { display: none; }
    .amb-search    { display: none; }
}

/* ============================================================
   Responsivo — mobile (<900px): aside vira drawer
   ============================================================ */
@media (max-width: 899px) {
    .amb-aside {
        position: fixed;
        inset: 0 auto 0 0;
        transform: translateX(-100%);
        box-shadow: var(--mc-shadow-lg);
    }
    .amb-shell.is-drawer-aberto .amb-aside { transform: translateX(0); }

    .amb-drawer-fechar { display: block; }
    .amb-hamburger     { display: block; }

    .amb-topbar { padding: 0 16px; }
    .amb-main   { padding: 18px 16px 40px; }
}

/* O backdrop só existe quando o drawer está aberto (renderizado condicionalmente),
   mas garantimos que nunca apareça no desktop. */
@media (min-width: 900px) {
    .amb-drawer-bg { display: none; }
}

/* Link discreto para a interface legada (?ui=legado) */
.amb-legado-link {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 8px;
    margin-bottom: 8px;
    border-radius: 9px;
    font-size: 12px;
    color: var(--mc-text-faint);
    transition: background .18s, color .18s;
}
.amb-legado-link:hover { background: var(--mc-gray-50); color: var(--mc-text-muted); }
