/* App da administração (versão celular / PWA). Usado pelo AppAdminLayout e pelas telas completas abertas no modo app. */
/* ── Tokens ─────────────────────────────────────────────────────────── */
    /* Fundos, bordas e textos: mesma paleta da versão de computador (tema MudBlazor em App.razor).
       Cor de destaque (--aa-brand): a da unidade, definida pelo layout; Root sem unidade usa a cor do AgendaGo. */
    .aa-root {
        --aa-bg: var(--mud-palette-background); --aa-surface: var(--mud-palette-surface); --aa-subtle: var(--mud-palette-background-gray);
        --aa-border: var(--mud-palette-lines-default); --aa-border-forte: var(--mud-palette-lines-inputs);
        --aa-text: var(--mud-palette-text-primary); --aa-muted: var(--mud-palette-text-secondary); --aa-radius: 16px; --aa-radius-sm: 12px;
        --aa-ease: cubic-bezier(.23,1,.32,1);
        --aa-brand-soft: color-mix(in srgb, var(--aa-brand) 14%, transparent);
        --aa-brand-ink: var(--aa-brand-ink-claro);
        --aa-tabbar-h: 64px;
        min-height: 100vh; min-height: 100dvh; background: var(--aa-bg); color: var(--aa-text);
        font-family: Inter, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent;
    }
    .aa-root.aa-dark {
        --aa-brand-ink: var(--aa-brand-ink-escuro);
        --aa-brand-soft: color-mix(in srgb, var(--aa-brand) 20%, transparent);
        color-scheme: dark;
    }
    .aa-root *, .aa-root *::before, .aa-root *::after { box-sizing: border-box; }
    .aa-root a { color: inherit; }
    .aa-num { font-variant-numeric: tabular-nums; }

    .aa-page { max-width: 600px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 16px calc(var(--aa-tabbar-h) + 36px + env(safe-area-inset-bottom)); }

    /* ── Splash ─────────────────────────────────────────────────────────── */
    .aa-splash { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; }
    .aa-splash-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--aa-brand); animation: aa-pulso 1s var(--aa-ease) infinite alternate; }
    @keyframes aa-pulso { from { transform: scale(.7); opacity: .5; } to { transform: scale(1.1); opacity: 1; } }

    /* ── Barra inferior ─────────────────────────────────────────────────── */
    .aa-tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1200; background: var(--aa-surface);
        border-top: 1px solid var(--aa-border); padding-bottom: env(safe-area-inset-bottom); }
    .aa-tabbar-in { max-width: 600px; margin: 0 auto; height: var(--aa-tabbar-h); display: grid; grid-template-columns: repeat(5, 1fr); align-items: stretch; }
    .aa-tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        min-height: 44px; text-decoration: none; color: var(--aa-muted); font-size: .68rem; font-weight: 600; letter-spacing: .01em;
        transition: color .2s var(--aa-ease); }
    .aa-tab .mud-icon-root { font-size: 1.45rem; transition: transform .2s var(--aa-ease); }
    .aa-tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
    .aa-tab::before { content: ""; position: absolute; top: -1px; left: 50%; width: 28px; height: 3px; border-radius: 0 0 3px 3px;
        background: var(--aa-brand); transform: translateX(-50%) scaleX(0); transition: transform .25s var(--aa-ease); }
    .aa-tab.on { color: var(--aa-brand-ink); }
    .aa-tab.on::before { transform: translateX(-50%) scaleX(1); }
    .aa-tab:active .mud-icon-root { transform: scale(.9); }
    .aa-tab-fab-slot { position: relative; display: flex; justify-content: center; }
    .aa-fab { position: absolute; top: -22px; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center;
        background: var(--aa-brand); color: var(--aa-on-brand); text-decoration: none;
        box-shadow: 0 0 0 5px var(--aa-bg), 0 8px 20px color-mix(in srgb, var(--aa-brand) 40%, transparent);
        transition: transform .18s var(--aa-ease), box-shadow .2s var(--aa-ease); }
    .aa-fab .mud-icon-root { font-size: 2rem; }
    .aa-fab:active { transform: scale(.94); }
    @media (hover: hover) { .aa-fab:hover { transform: translateY(-2px); } .aa-tab:hover { color: var(--aa-text); } }

    /* ── Menu lateral ───────────────────────────────────────────────────── */
    .aa-drawer-fundo { position: fixed; inset: 0; z-index: 1300; background: rgba(15,14,12,.42); opacity: 0; pointer-events: none;
        transition: opacity .25s var(--aa-ease); }
    .aa-drawer-fundo.on { opacity: 1; pointer-events: auto; }
    .aa-drawer { position: fixed; top: 0; bottom: 0; left: 0; z-index: 1301; width: min(86vw, 360px); background: var(--aa-bg);
        display: flex; flex-direction: column; transform: translateX(-102%); transition: transform .32s var(--aa-ease);
        box-shadow: 8px 0 30px rgba(0,0,0,.12); padding-top: env(safe-area-inset-top); }
    .aa-drawer.on { transform: none; }
    .aa-drawer-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 12px 12px 16px; }
    .aa-drawer-corpo { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px calc(20px + env(safe-area-inset-bottom)); }

    /* ── Marca (logo + nome) ────────────────────────────────────────────── */
    .aa-marca { display: flex; align-items: center; gap: 10px; min-width: 0; }
    .aa-marca-logo { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; flex: none; background: var(--aa-surface); border: 1px solid var(--aa-border); }
    .aa-marca-ini { display: grid; place-items: center; background: var(--aa-brand); color: var(--aa-on-brand); font-weight: 700; font-size: .9rem; border: 0; }
    .aa-marca-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
    .aa-marca-txt b { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .aa-marca-txt small { font-size: .74rem; color: var(--aa-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    /* ── Cabeçalho das telas ────────────────────────────────────────────── */
    .aa-topbar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; min-height: 48px; }
    .aa-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 4px 0 16px; }
    .aa-header-tit { display: flex; gap: 10px; min-width: 0; }
    .aa-header-tit::before { content: ""; width: 4px; border-radius: 4px; background: var(--aa-brand); flex: none; margin: 3px 0; }
    .aa-header h1 { font-size: 1.35rem; font-weight: 700; margin: 0; line-height: 1.2; letter-spacing: -.01em; }
    .aa-header p { margin: 2px 0 0; font-size: .84rem; color: var(--aa-muted); }
    .aa-sec { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 10px; }
    .aa-sec h2 { font-size: 1rem; font-weight: 700; margin: 0; }
    .aa-sec a, .aa-link { font-size: .84rem; font-weight: 600; color: var(--aa-brand-ink); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }

    /* ── Cartões ────────────────────────────────────────────────────────── */
    .aa-card { background: var(--aa-surface); border: 1px solid var(--aa-border); border-radius: var(--aa-radius); padding: 16px; }
    .aa-card + .aa-card { margin-top: 12px; }
    .aa-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .aa-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
    /* Cards da grade nunca passam da largura da coluna (texto longo corta com reticências) */
    .aa-grid2 > *, .aa-grid3 > * { min-width: 0; }
    .aa-card-tap { display: block; text-decoration: none; cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%;
        transition: transform .16s var(--aa-ease), border-color .2s var(--aa-ease); }
    .aa-card-tap:active { transform: scale(.97); }
    @media (hover: hover) { .aa-card-tap:hover { border-color: var(--aa-border-forte); } }

    /* ── Botões ─────────────────────────────────────────────────────────── */
    .aa-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
        border-radius: 14px; border: 1px solid var(--aa-border); background: var(--aa-surface); color: var(--aa-text);
        font: 600 .92rem Inter, -apple-system, "Segoe UI", Roboto, sans-serif; text-decoration: none; cursor: pointer; user-select: none;
        transition: transform .16s var(--aa-ease), filter .2s var(--aa-ease), background-color .2s var(--aa-ease); }
    .aa-btn:active:not(:disabled) { transform: scale(.97); }
    .aa-btn:disabled { opacity: .5; cursor: default; }
    .aa-btn .mud-icon-root { font-size: 1.2rem; }
    .aa-btn-primario { background: var(--aa-brand); border-color: var(--aa-brand); color: var(--aa-on-brand); }
    .aa-btn-suave { background: var(--aa-brand-soft); border-color: transparent; color: var(--aa-brand-ink); }
    .aa-btn-bloco { width: 100%; }
    .aa-btn-sm { min-height: 40px; padding: 0 12px; font-size: .82rem; border-radius: 12px; }
    @media (hover: hover) { .aa-btn:hover:not(:disabled) { filter: brightness(.97); } }
    .aa-icon-btn { width: 44px; height: 44px; border-radius: 14px; display: inline-grid; place-items: center; flex: none;
        border: 1px solid var(--aa-border); background: var(--aa-surface); color: var(--aa-text); cursor: pointer; text-decoration: none;
        transition: transform .16s var(--aa-ease), background-color .2s var(--aa-ease); }
    .aa-icon-btn:active:not(:disabled) { transform: scale(.94); }
    .aa-icon-btn:disabled { opacity: .4; cursor: default; }
    .aa-icon-btn.sem-borda { border-color: transparent; background: transparent; }
    @media (hover: hover) { .aa-icon-btn:hover:not(:disabled) { background: var(--aa-subtle); } }

    /* ── Filtros em pílula ──────────────────────────────────────────────── */
    .aa-seg { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--aa-surface); border: 1px solid var(--aa-border);
        overflow-x: auto; scrollbar-width: none; }
    .aa-seg::-webkit-scrollbar { display: none; }
    .aa-seg button { flex: 1 0 auto; min-height: 38px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--aa-muted);
        font: 600 .84rem Inter, -apple-system, "Segoe UI", Roboto, sans-serif; cursor: pointer; white-space: nowrap;
        transition: background-color .22s var(--aa-ease), color .22s var(--aa-ease), transform .16s var(--aa-ease); }
    .aa-seg button:active { transform: scale(.96); }
    .aa-seg button.on { background: var(--aa-brand); color: var(--aa-on-brand); }
    @media (hover: hover) { .aa-seg button:not(.on):hover { color: var(--aa-text); } }

    /* ── Campos ─────────────────────────────────────────────────────────── */
    .aa-campo { display: flex; flex-direction: column; gap: 6px; }
    .aa-campo label, .aa-rotulo { font-size: .78rem; font-weight: 600; color: var(--aa-muted); }
    .aa-input { width: 100%; min-height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--aa-border); background: var(--aa-surface);
        color: var(--aa-text); font: 500 1rem Inter, -apple-system, "Segoe UI", Roboto, sans-serif; outline: none;
        transition: border-color .2s var(--aa-ease), box-shadow .2s var(--aa-ease); }
    .aa-input:focus { border-color: var(--aa-brand); box-shadow: 0 0 0 3px var(--aa-brand-soft); }
    .aa-input.erro { border-color: #DC2626; }
    textarea.aa-input { padding: 12px 14px; min-height: 84px; resize: vertical; }
    .aa-busca { position: relative; }
    .aa-busca .mud-icon-root { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--aa-muted); font-size: 1.2rem; pointer-events: none; }
    .aa-busca .aa-input { padding-left: 42px; }
    .aa-erro-txt { font-size: .78rem; color: #DC2626; }

    /* ── Estados ────────────────────────────────────────────────────────── */
    .aa-vazio { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 28px 16px; color: var(--aa-muted); }
    .aa-vazio b { color: var(--aa-text); font-size: 1rem; }
    .aa-vazio p { margin: 0 0 8px; font-size: .88rem; max-width: 320px; }
    .aa-vazio-cheio { min-height: 70vh; justify-content: center; }
    .aa-vazio-ico { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--aa-brand-soft); color: var(--aa-brand-ink); margin-bottom: 6px; }
    .aa-skel { border-radius: var(--aa-radius); background: linear-gradient(90deg, var(--aa-surface) 0%, var(--aa-subtle) 50%, var(--aa-surface) 100%);
        background-size: 200% 100%; animation: aa-skel 1.3s ease-in-out infinite; border: 1px solid var(--aa-border); }
    @keyframes aa-skel { from { background-position: 100% 0; } to { background-position: -100% 0; } }
    .aa-chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
    .aa-chip .mud-icon-root { font-size: .9rem; }
    .aa-placa { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 6px; border: 1.5px solid var(--aa-text);
        font: 700 .74rem ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; background: var(--aa-surface); }
    .aa-entra { animation: aa-entra .34s var(--aa-ease) both; }
    @keyframes aa-entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

    @media (prefers-reduced-motion: reduce) {
        .aa-root *, .aa-root *::before, .aa-root *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    }

/* ── Telas completas abertas dentro do app (MainLayout no celular) ─────── */
.aa-root.aa-completa { background: var(--aa-bg); }
.aa-page.aa-page-completa { max-width: 1100px; }
.aa-page-completa .aa-topbar { position: sticky; top: 0; z-index: 1100; background: var(--aa-bg); margin: 0 -16px 12px; padding: 6px 16px; }
.aa-page-completa .ag-page-header { margin-top: 0; }

/* Botão "versão app" na barra da versão completa: só em telas pequenas */
.ag-so-celular { display: none !important; }
@media (max-width: 820px) { .ag-so-celular { display: inline-flex !important; } }

/* Botão do menu (hambúrguer) no cabeçalho das telas: substitui a barrinha de destaque */
.aa-header-tit:has(.aa-header-menu)::before { display: none; }
.aa-header-menu { flex: none; margin-top: -4px; }
.aa-header-linha { display: flex; align-items: center; gap: 4px; }
.aa-header-acao { width: 34px; height: 34px; flex: none; }

/* Grade de 2 colunas com quantidade ímpar: o último ocupa a linha toda */
.aa-grid2 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
