:root {
    --cor-primaria: #3d4452;
    --cor-primaria-2: #4a5260;
    --cor-destaque: #6ecf94;
    --cor-botao: #34a853;
    --cor-botao-active: #2c8f46;              /* tom escurecido p/ :active e :hover de botões verdes */
    --cor-botao-soft: #f1f8f4;                /* fundo claro p/ highlights e itens selecionados */
    --cor-botao-ring: rgba(52,168,83,0.15);   /* ring fino p/ :focus e seleção */
    --cor-botao-shadow: rgba(52,168,83,0.35); /* box-shadow dos "dots" animados */
    --cor-topbar-texto: #ffffff;
    --cor-topbar-texto-muted: rgba(255,255,255,0.72);
    --cor-badge-carrinho: #34a853;
    --bg-login-page: #f5f6f8;
    --bg-login-card: #ffffff;
    --bg-home-page: #f8f9fa;
}

/* === Lucide icons (sprite SVG em /static/icons.svg) === */
.icon {
    display: inline-block; vertical-align: middle; flex-shrink: 0;
    stroke: currentColor; fill: none; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}
input, textarea, [contenteditable="true"], [contenteditable=""] {
    -webkit-user-select: text;
    -moz-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}
img {
    -webkit-user-drag: none;
    user-select: none;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8f9fa; color: #202124;
    /* Desktop: topbar rola com a página (sem padding-top).
       Mobile: topbar fica fixa no topo — padding-top vem da media query abaixo. */
}

/* === Top Bar — duas linhas estilo Mercado Livre ===
   Desktop: position static (default), rola com a página.
   Mobile: position fixed (regra no @media abaixo). */
.topbar {
    background: var(--cor-primaria);
    display: flex; flex-direction: column;
}
.topbar-main {
    height: 72px;
    display: flex; align-items: center; padding: 0 20px; gap: 16px;
}
.topbar-logo {
    font-size: 20px; font-weight: 700; color: var(--cor-topbar-texto);
    text-decoration: none; white-space: nowrap; flex-shrink: 0;
    display: flex; align-items: center; gap: 8px;
}
.topbar-logo span { color: var(--cor-destaque); }
.topbar-simbolo { height: 40px; width: auto; display: block; }
.topbar-search { flex: 1; position: relative; }
.topbar-search input {
    width: 100%; padding: 10px 44px 10px 16px; font-size: 14px;
    border: none; border-radius: 22px; outline: none;
    background: white;
    font-family: inherit;
}
.topbar-search input:focus { box-shadow: 0 0 0 2px var(--cor-destaque); }
.topbar-search .search-icon {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    color: #5f6368; cursor: pointer;
    background: none; border: 0; padding: 4px;
    display: flex; align-items: center; justify-content: center;
}
.topbar-search .search-icon:hover { color: var(--cor-primaria); }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: auto; }

/* Botão circular do carrinho (estilo ML) */
.topbar-cart {
    position: relative;
    width: 42px; height: 42px; border-radius: 50%;
    background: rgba(255,255,255,0.08); color: var(--cor-topbar-texto);
    display: flex; align-items: center; justify-content: center;
    text-decoration: none; flex-shrink: 0;
    transition: background 0.15s;
}
.topbar-cart:hover { background: rgba(255,255,255,0.16); }
.topbar-cart .badge {
    position: absolute; top: -2px; right: -2px;
    background: var(--cor-badge-carrinho); color: white;
    border-radius: 10px; min-width: 18px; height: 18px;
    padding: 0 5px; font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--cor-primaria);
    box-sizing: content-box;
}

/* Botão "Painel admin" — estilo legado mantido para o ADMIN_HOST */
.topbar-btn {
    color: var(--cor-topbar-texto); text-decoration: none; font-size: 13px;
    padding: 8px 14px; border-radius: 6px;
    display: flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.08); border: none; cursor: pointer; white-space: nowrap;
    transition: background 0.15s; font-family: inherit;
}
.topbar-btn:hover { background: rgba(255,255,255,0.16); }

/* Linha 2 — contexto/breadcrumb */
.topbar-context {
    height: 30px;
    background: var(--cor-primaria);
    display: flex; align-items: center; gap: 8px;
    padding: 0 24px;
    font-size: 13px; color: var(--cor-topbar-texto-muted);
    overflow: hidden; white-space: nowrap;
}
.topbar-context a { color: var(--cor-topbar-texto-muted); text-decoration: none; transition: color 0.15s; }
.topbar-context a:hover { color: var(--cor-topbar-texto); }
.topbar-context span.current { color: var(--cor-topbar-texto); }
.topbar-context .sep { opacity: 0.5; }

/* === Breadcrumbs === */
.breadcrumbs {
    padding: 10px 20px; font-size: 13px; color: #5f6368;
    background: white; border-bottom: 1px solid #e8eaed;
}
.breadcrumbs a { color: #1a73e8; text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .sep { margin: 0 6px; color: #ccc; }

/* === Mobile bottom bar === */
.mobile-bar {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: white; border-top: 1px solid #e8eaed;
    height: 76px; justify-content: space-around; align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.mobile-bar a,
.mobile-bar .mob-search-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    text-decoration: none; color: #5f6368; font-size: 12px; position: relative;
    padding: 4px 8px;
    background: none; border: 0; cursor: pointer; font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}
.mobile-bar a.active { color: #1a73e8; }
.mobile-bar a .mob-icon,
.mobile-bar .mob-search-btn .mob-icon {
    display: inline-flex; align-items: center; justify-content: center;
    height: 26px; line-height: 1;
}
.mobile-bar .mob-badge {
    position: absolute; top: 0; right: -4px;
    background: var(--cor-badge-carrinho); color: white; border-radius: 10px;
    padding: 1px 6px; font-size: 11px; font-weight: 700;
}

/* Loading state para botões de navegação da mobilebar (exceto Buscar) */
@keyframes pbcMobSpin { to { transform: rotate(360deg); } }
.mobile-bar .mob-nav.loading { pointer-events: none; color: #1a73e8; }
.mobile-bar .mob-nav.loading .mob-icon,
.mobile-bar .mob-nav.loading .mob-menu-icon { visibility: hidden; }
.mobile-bar .mob-nav.loading::before {
    content: ""; position: absolute; top: 4px; left: 50%;
    width: 22px; height: 22px; margin-left: -11px;
    border: 2.5px solid #dadce0; border-top-color: #1a73e8;
    border-radius: 50%;
    animation: pbcMobSpin 0.7s linear infinite;
}
.mob-menu-drop .mob-menu-item.mob-nav.loading::before {
    top: 50%; left: 14px; margin-left: 0; margin-top: -11px;
    width: 18px; height: 18px;
}

/* === Dropdown do menu do usuário na barra mobile === */
.mob-menu { position: relative; display: flex; flex-direction: column; align-items: center; }
.mob-menu-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    background: none; border: 0; color: #5f6368; font-size: 12px;
    padding: 4px 8px; cursor: pointer; font-family: inherit; line-height: 1;
    -webkit-tap-highlight-color: transparent;
}
.mob-menu-btn .mob-icon { height: 26px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.mob-menu.open .mob-menu-btn { color: #1a73e8; }
.mob-menu-drop {
    position: absolute; bottom: calc(100% + 10px); right: 4px;
    background: white; border: 1px solid #e8eaed; border-radius: 10px;
    box-shadow: 0 8px 24px rgba(32,33,36,0.18);
    min-width: 300px; display: none; overflow: hidden; z-index: 901;
}
.mob-menu.open .mob-menu-drop { display: flex; }
.mob-menu-drop > .mob-menu-item,
.mob-menu-drop > .mob-menu-form { flex: 1; min-width: 0; }
.mob-menu-form { margin: 0; display: flex; border-left: 1px solid #e8eaed; }
.mob-menu-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    padding: 14px 12px; font-size: 13px; color: #3d4452;
    text-decoration: none; width: 100%; box-sizing: border-box;
    background: none; border: 0; text-align: center;
    cursor: pointer; font-family: inherit;
}
.mob-menu-item:hover, .mob-menu-item:active { background: #f1f3f4; }
.mob-menu-icon { line-height: 1; display: inline-flex; align-items: center; justify-content: center; color: #5f6368; }

/* === Pulse de busca (chama atenção até o usuário clicar no campo) === */
@keyframes pbc-search-wave {
    0%   { box-shadow: 0 0 0 0 rgba(255, 107, 28, 0.65); }
    70%  { box-shadow: 0 0 0 18px rgba(255, 107, 28, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 107, 28, 0); }
}
.pbc-search-pulse {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.6em; height: 1.6em; border-radius: 50%;
    animation: pbc-search-wave 1.6s ease-out infinite;
}
.pbc-search-pulse.no-pulse { animation: none !important; box-shadow: none !important; }

@media (max-width: 768px) {
    body { padding-top: 56px; padding-bottom: 76px; }
    /* Mobile: topbar volta a ser fixa no topo (compensada pelo padding-top do body). */
    .topbar {
        position: fixed; top: 0; left: 0; right: 0; z-index: 100;
        background: var(--cor-primaria);
    }
    .topbar-main { height: 56px; padding: 0 10px; gap: 8px; }
    .topbar-simbolo { height: 32px; }
    .topbar-logo { font-size: 16px; }
    .topbar-actions { display: none; }
    .topbar-context { display: none; }
    .mobile-bar { display: flex; }
    .breadcrumbs { padding: 8px 16px; font-size: 12px; }
}

/* === Painel de busca unificada (sugestões abaixo do header) ===
 * O painel é absolutely positioned dentro de .topbar-wrap, ancorado logo
 * abaixo do <header>. O cabeçalho permanece visível (com logo + ações)
 * enquanto o usuário digita. Esc / clique fora fecham. */
.topbar-wrap { position: relative; z-index: 100; }

.topbar-search-panel {
    /* fixed (não absolute) pra garantir que sempre cubra o que está abaixo
     * do header até o rodapé, mesmo com poucos resultados. --pbc-topbar-h é
     * sincronizada por JS (syncTopbarHeight) com a altura real do <header>. */
    position: fixed; top: var(--pbc-topbar-h, 72px); left: 0; right: 0; bottom: 0;
    z-index: 900;
    background: #fff; color: #202124;
    border-top: 1px solid #e8eaed;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    opacity: 0; pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}
.topbar-search-panel.visible {
    opacity: 1; pointer-events: auto;
    transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
    .topbar-search-panel { transition: opacity 0.08s linear; transform: none; }
    .topbar-search-panel.visible { transform: none; }
}

/* Mic inline no input do topbar (busca por voz) */
.topbar-search-mic {
    position: absolute; right: 44px; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px; border-radius: 50%;
    border: none; background: transparent; cursor: pointer;
    color: #5f6368; display: flex; align-items: center; justify-content: center;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s, background 0.15s;
}
.topbar-search-mic svg { width: 18px; height: 18px; }
.topbar-search-mic:hover { background: #f1f3f4; color: #202124; }
.topbar-search-mic.listening {
    color: #d93025; background: rgba(217, 48, 37, 0.08);
    animation: mic-pulse 1.4s ease-out infinite;
}
@keyframes mic-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(217, 48, 37, 0.45); }
    70%  { box-shadow: 0 0 0 12px rgba(217, 48, 37, 0); }
    100% { box-shadow: 0 0 0 0 rgba(217, 48, 37, 0); }
}

/* Quando o mic existe, abre espaço no input pra ele não cobrir o texto */
.topbar-search input { padding-right: 80px; }
/* Esconde o "x" nativo do type="search" (Chrome/Safari/Edge) */
.topbar-search input::-webkit-search-decoration,
.topbar-search input::-webkit-search-cancel-button,
.topbar-search input::-webkit-search-results-button,
.topbar-search input::-webkit-search-results-decoration { -webkit-appearance: none; appearance: none; display: none; }
.topbar-search input::-ms-clear { display: none; width: 0; height: 0; }

.search-overlay-results {
    padding: 16px;
    max-width: 1200px; width: 100%; margin: 0 auto;
    box-sizing: border-box;
}
.search-overlay-empty {
    padding: 40px 16px; text-align: center; color: #5f6368; font-size: 14px;
    word-break: break-word;
}
/* === Seletor de escopo na barra de busca (estilo marketplace) ============ */
/* Reserva espaço à direita do input pro seletor + ícones não cobrirem o texto.
 * O seletor vai de right:84px e tem no máx. 150px de largura → reserva ~240px. */
.topbar-search.has-scope input { padding-right: 240px; }
.topbar-scope {
    position: absolute; right: 84px; top: 50%; transform: translateY(-50%);
    display: flex; align-items: center; max-width: 150px;
}
.topbar-scope::before {
    content: ''; width: 1px; height: 22px; background: #e0e0e0;
    margin-right: 6px; flex-shrink: 0;
}
.topbar-scope-btn {
    display: inline-flex; align-items: center; gap: 2px;
    background: none; border: none; cursor: pointer;
    color: #5f6368; font-size: 13px; padding: 4px 6px; border-radius: 6px;
    max-width: 100%; font-family: inherit;
}
.topbar-scope-btn:hover { background: rgba(0,0,0,0.05); color: #202124; }
.topbar-scope-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-scope-chevron { display: inline-flex; flex-shrink: 0; transition: transform 0.15s; }
.topbar-scope.open .topbar-scope-chevron { transform: rotate(180deg); }

.topbar-scope-menu {
    position: absolute; top: calc(100% + 8px); right: 0;
    min-width: 300px; max-width: 92vw;
    background: #fff; border-radius: 10px; padding: 6px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.20); border: 1px solid #eceef1;
    z-index: 1200;
}
.topbar-scope-menu[hidden] { display: none; }
.topbar-scope-opt {
    display: flex; align-items: center; gap: 12px; width: 100%;
    background: none; border: none; cursor: pointer; text-align: left;
    padding: 10px 12px; border-radius: 8px; font-size: 14px; color: #1a1a2e;
    font-family: inherit;
}
.topbar-scope-opt:hover { background: #f5f6f8; }
.topbar-scope-radio {
    width: 18px; height: 18px; border-radius: 50%; border: 2px solid #bdc1c6;
    flex-shrink: 0; position: relative; box-sizing: border-box;
}
.topbar-scope-opt[aria-checked="true"] .topbar-scope-radio { border-color: var(--cor-primaria, #e94560); }
.topbar-scope-opt[aria-checked="true"] .topbar-scope-radio::after {
    content: ''; position: absolute; inset: 3px; border-radius: 50%;
    background: var(--cor-primaria, #e94560);
}
.topbar-scope-opt-icon {
    width: 36px; height: 36px; border-radius: 8px; background: #f1f3f4;
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.topbar-scope-opt-icon svg { width: 22px; height: 22px; color: #5f6368; }
.topbar-scope-opt-icon img { width: 24px; height: 24px; object-fit: contain; }
.topbar-scope-opt-label { overflow: hidden; line-height: 1.3; }

@media (max-width: 600px) {
    /* Compacto: só ícone + chevron, sem rótulo, para não comer o campo */
    .topbar-search.has-scope input { padding-right: 130px; }
    .topbar-scope { right: 80px; max-width: none; }
    .topbar-scope-label { display: none; }
    .topbar-scope-menu { min-width: 0; left: 8px; right: 8px; }
}
.search-overlay-section { margin-bottom: 28px; }
.search-overlay-section-title {
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: #5f6368;
    margin: 0 0 10px; padding: 0 4px;
    display: flex; align-items: center; gap: 8px;
}
.search-overlay-section-count {
    background: #f1f3f4; color: #5f6368; font-weight: 600;
    padding: 1px 8px; border-radius: 999px; font-size: 11px;
    letter-spacing: 0;
}

.search-overlay-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: stretch;
}
@media (min-width: 600px) {
    .search-overlay-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
}
@media (min-width: 960px) {
    .search-overlay-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
}

.search-card {
    display: flex; flex-direction: column; gap: 6px;
    height: 100%;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    text-decoration: none; color: inherit;
    transition: box-shadow 0.15s, transform 0.1s, border-color 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.search-card:hover {
    border-color: #dadce0;
    box-shadow: 0 4px 12px rgba(32,33,36,0.10);
    transform: translateY(-1px);
}
.search-card:active { transform: translateY(0); }
.search-card-head {
    display: flex; align-items: flex-start; gap: 10px;
}
.search-card-icon {
    width: 34px; height: 34px; border-radius: 8px;
    background: var(--cor-botao-soft); color: var(--cor-botao);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.search-card-icon svg { width: 20px; height: 20px; }
.search-card-title {
    font-size: 14px; font-weight: 600; color: #202124;
    line-height: 1.3;
    word-break: break-word; overflow-wrap: anywhere; white-space: normal;
    flex: 1; min-width: 0;
}
.search-card-subtitle {
    font-size: 13px; font-weight: 500; color: #3d4452;
    line-height: 1.35;
    word-break: break-word; overflow-wrap: anywhere; white-space: normal;
}
.search-card-subtitle-small {
    font-size: 12px; font-weight: 500; color: #5f6368;
    line-height: 1.3;
    word-break: break-word; overflow-wrap: anywhere; white-space: normal;
}
.search-card-muted {
    font-size: 12px; color: #9aa0a6;
    line-height: 1.3; margin-top: auto;
    word-break: break-word; overflow-wrap: anywhere; white-space: normal;
}

/* Variantes com foto (equipamento / subconjunto). No equipamento a foto
   vai ao fim do card (cards da mesma linha terminam alinhados). No
   subconjunto a foto fica logo abaixo do título, e o equipamento+meta
   ficam depois. */
.search-card--equipment,
.search-card--subsystem {
    gap: 4px;
}
.search-card--equipment .search-card-title,
.search-card--subsystem .search-card-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.search-card--equipment .search-card-muted {
    margin-top: 2px;
    margin-bottom: 6px;
}
.search-card--equipment .search-card-photo,
.search-card--equipment .search-card-photo-missing {
    margin-top: auto;
}
.search-card--subsystem .search-card-subtitle,
.search-card--subsystem .search-card-muted {
    margin-top: 6px;
}
.search-card-photo {
    display: block;
    width: 100%;
    object-fit: cover;
    background: #ffffff;
    border-radius: 8px;
    margin-top: 6px;
    max-height: 180px;
}
.search-card-photo-missing {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: #ffffff;
    border-radius: 8px;
    margin-top: 6px;
    aspect-ratio: 4 / 3;
}
.search-card-photo-missing svg {
    width: 40%;
    max-width: 56px;
    height: auto;
    color: #b0b6bf;
}

/* === Avatar (foto de perfil ou fallback silhueta) === */
.pbc-avatar {
    display: inline-block; border-radius: 50%; overflow: hidden;
    object-fit: cover; flex-shrink: 0; vertical-align: middle;
    background: #d9dbe0; line-height: 0;
}
.pbc-avatar.pbc-avatar-empty { display: inline-flex; align-items: center; justify-content: center; }
.pbc-avatar.pbc-avatar-empty svg { display: block; }

/* === Menu Conta (dropdown desktop) === */
.topbar-menu { position: relative; }
.topbar-menu-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 10px 4px 4px; border-radius: 22px;
    background: rgba(255,255,255,0.08); color: var(--cor-topbar-texto);
    border: 0; cursor: pointer; font-family: inherit; font-size: 14px;
    transition: background 0.15s;
    line-height: 1;
}
.topbar-menu-btn:hover { background: rgba(255,255,255,0.16); }
.topbar-menu-btn .menu-username {
    max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-weight: 500;
}
.topbar-menu-btn .menu-chevron { opacity: 0.7; transition: transform 0.15s; }
.topbar-menu.open .topbar-menu-btn .menu-chevron { transform: rotate(180deg); }
.topbar-menu-drop {
    position: absolute; top: calc(100% + 8px); right: 0;
    background: white; border: 1px solid #e8eaed; border-radius: 12px;
    box-shadow: 0 8px 24px rgba(32,33,36,0.18);
    min-width: 260px; display: none; overflow: hidden; z-index: 901;
    padding: 4px 0;
}
.topbar-menu.open .topbar-menu-drop { display: block; }
.topbar-menu-drop .menu-header {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; border-bottom: 1px solid #e8eaed;
}
.topbar-menu-drop .menu-header .menu-user-info {
    display: flex; flex-direction: column; min-width: 0; flex: 1;
}
.topbar-menu-drop .menu-header .menu-user-name {
    font-size: 14px; font-weight: 600; color: #202124;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-menu-drop .menu-header .menu-user-email {
    font-size: 12px; color: #5f6368;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-menu-drop a,
.topbar-menu-drop button {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; width: 100%; box-sizing: border-box;
    color: #3d4452; text-decoration: none; font-size: 13px;
    background: none; border: 0; cursor: pointer; font-family: inherit;
    text-align: left;
}
.topbar-menu-drop a:hover,
.topbar-menu-drop button:hover { background: #f1f3f4; }
.topbar-menu-drop form { margin: 0; }
.topbar-menu-drop .menu-sep { border-top: 1px solid #e8eaed; margin: 4px 0; }
.topbar-menu-drop .menu-icon { display: flex; align-items: center; justify-content: center; color: #5f6368; flex-shrink: 0; }

/* === Carrinho na topbar (desktop): modo link puro vs. botão+dropdown === */
.topbar-cart-menu { position: relative; }
/* Botão composto: ícone + nome do ativo + chevron. Reaproveita visual do
   botão Conta (pill com fundo translúcido), mesma paleta da topbar. */
.topbar-cart-btn {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 14px 4px 12px;
    min-height: 40px; box-sizing: border-box;
    border-radius: 22px;
    background: rgba(255,255,255,0.08); color: var(--cor-topbar-texto);
    border: 0; cursor: pointer; font-family: inherit; font-size: 14px;
    transition: background 0.15s;
    line-height: 1;
}
.topbar-cart-btn:hover { background: rgba(255,255,255,0.16); }
.topbar-cart-btn .cart-btn-icon {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
}
.topbar-cart-btn .cart-btn-icon .badge {
    position: absolute; top: -6px; right: -8px;
    background: var(--cor-badge-carrinho); color: white;
    border-radius: 10px;
    min-width: 14px;
    height: 14px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--cor-primaria);
    box-sizing: content-box;
}
.topbar-cart-btn .cart-btn-name {
    max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-weight: 500;
}
.topbar-cart-btn .cart-btn-chevron { opacity: 0.7; transition: transform 0.15s; display: inline-flex; }
.topbar-cart-menu.open .topbar-cart-btn .cart-btn-chevron { transform: rotate(180deg); }

/* Itens da lista de carrinhos dentro do dropdown. */
.cart-menu-list { list-style: none; margin: 0; padding: 4px 0; max-height: 320px; overflow-y: auto; }
.cart-menu-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 14px; cursor: pointer;
    color: #3d4452; font-size: 13px;
    transition: background 0.1s;
}
.cart-menu-item:hover { background: #f1f3f4; }
.cart-menu-item.active { background: #eef7f1; color: #1f6f45; font-weight: 600; }
.cart-menu-item.active:hover { background: #e4f1ea; }
.cart-menu-item .cart-menu-name {
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cart-menu-item .cart-menu-count {
    font-size: 11px; color: #70757a; font-weight: 500; flex-shrink: 0;
}
.cart-menu-item.active .cart-menu-count { color: #3a8a5d; }
.cart-menu-item .cart-menu-check {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; color: #3a8a5d; flex-shrink: 0;
}
.cart-menu-sep { border-top: 1px solid #e8eaed; margin: 4px 0; }
.cart-menu-action {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; width: 100%; box-sizing: border-box;
    color: #3d4452; text-decoration: none; font-size: 13px;
    background: none; border: 0; cursor: pointer; font-family: inherit;
    text-align: left;
}
.cart-menu-action:hover { background: #f1f3f4; }
.cart-menu-action .menu-icon { display: flex; align-items: center; justify-content: center; color: #5f6368; flex-shrink: 0; }

/* === Modal de corte de foto de perfil === */
.avatar-modal-backdrop {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(32,33,36,0.55);
    display: none; align-items: center; justify-content: center;
    padding: 16px;
}
.avatar-modal-backdrop.open { display: flex; }
.avatar-modal {
    background: white; border-radius: 12px; width: 100%; max-width: 380px;
    box-shadow: 0 20px 48px rgba(0,0,0,0.3);
    display: flex; flex-direction: column; overflow: hidden;
}
.avatar-modal-header {
    padding: 14px 18px; border-bottom: 1px solid #e8eaed;
    display: flex; justify-content: space-between; align-items: center;
}
.avatar-modal-title { font-size: 15px; font-weight: 600; color: #3d4452; }
.avatar-modal-close {
    background: none; border: 0; cursor: pointer; font-size: 22px;
    color: #5f6368; line-height: 1; padding: 0; width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center; border-radius: 50%;
}
.avatar-modal-close:hover { background: #f1f3f4; }
.avatar-modal-body { padding: 16px; }
.avatar-stage {
    position: relative; width: 100%; aspect-ratio: 1/1;
    background: #202124; border-radius: 8px; overflow: hidden;
    touch-action: none; user-select: none;
    display: flex; align-items: center; justify-content: center;
    color: #9aa0a6; font-size: 13px;
}
.avatar-stage canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
.avatar-stage-mask {
    position: absolute; inset: 0; pointer-events: none;
    /* `closest-side` ancora o 100% do gradiente na borda mais próxima do
       centro (= metade do lado do stage), casando com o raio do ring
       (border-radius:50% num quadrado = metade do lado). */
    background:
        radial-gradient(circle closest-side at center,
            transparent 99.5%,
            rgba(0,0,0,0.55) 100%);
}
.avatar-stage-ring {
    position: absolute; top: 50%; left: 50%;
    width: 100%; height: 100%; transform: translate(-50%,-50%);
    border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255,255,255,0.9);
    pointer-events: none;
}
.avatar-stage.empty .avatar-stage-mask,
.avatar-stage.empty .avatar-stage-ring { display: none; }
.avatar-modal-footer {
    padding: 12px 16px; border-top: 1px solid #e8eaed;
    display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end;
}
.avatar-btn {
    padding: 9px 16px; font-size: 13px; font-weight: 600;
    border-radius: 6px; border: 1px solid #dadce0;
    background: white; color: #3d4452; cursor: pointer; font-family: inherit;
}
.avatar-btn:hover { background: #f1f3f4; }
.avatar-btn-primary { background: var(--cor-botao); color: white; border-color: var(--cor-botao); }
.avatar-btn-primary:hover { background: var(--cor-botao-active); }
.avatar-btn-danger { background: white; color: #c5221f; border-color: #f5c2be; }
.avatar-btn-danger:hover { background: #fce8e6; }
.avatar-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.avatar-modal-error {
    background: #fce8e6; color: #c5221f; border: 1px solid #f5c2be;
    padding: 8px 12px; border-radius: 6px; font-size: 12px; margin-top: 10px;
    display: none;
}
.avatar-modal-error.visible { display: block; }

/* === Câmera no modal de avatar === */
.avatar-stage video {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    display: none; z-index: 1;
}
.avatar-stage.camera video { display: block; }
.avatar-stage.front video { transform: scaleX(-1); }
/* Oculta mask e ring durante o modo câmera */
.avatar-stage.camera .avatar-stage-mask,
.avatar-stage.camera .avatar-stage-ring { display: none; }

.avatar-camera-controls {
    position: absolute; bottom: 16px; left: 0; right: 0;
    display: none;
    justify-content: center; align-items: center; gap: 28px;
    z-index: 10;
}
.avatar-stage.camera .avatar-camera-controls { display: flex; }

.avatar-cam-btn {
    background: rgba(255,255,255,0.15); color: white;
    border: none; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    transition: background 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}
.avatar-cam-btn:hover { background: rgba(255,255,255,0.28); }
.avatar-cam-btn:active { transform: scale(0.92); }

.avatar-cam-back,
.avatar-cam-switch {
    width: 44px; height: 44px;
}
.avatar-cam-shutter {
    width: 64px; height: 64px;
    background: rgba(255,255,255,0.2);
    border: 3px solid rgba(255,255,255,0.85);
    position: relative;
}
.avatar-cam-shutter .shutter-ring {
    display: block; width: 48px; height: 48px;
    border-radius: 50%;
    background: white;
    transition: transform 0.12s, opacity 0.12s;
}
.avatar-cam-shutter:hover .shutter-ring { transform: scale(0.92); }
.avatar-cam-shutter:active .shutter-ring { transform: scale(0.82); opacity: 0.7; }

/* ============================================================================
   Home — dashboard estilo Mercado Livre (hero compacto + atalhos + carrosséis
   + grid de equipamentos). Usa CSS scroll-snap para carrosséis; sem JS.
   ============================================================================ */
.home-body { background: var(--bg-home-page); }
.home-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 16px 96px;
    box-sizing: border-box;
}

/* Faixa hero: saudação + atalhos compartilham o mesmo background (slides rotativos),
   com overlay em gradiente pra legibilidade do texto. */
.home-hero-band {
    position: relative;
    background-color: #1a1f2c;
    overflow: hidden;
    padding: 28px 24px 24px;
    margin-bottom: 28px;
    isolation: isolate;
    min-height: 250px;
}
.home-hero-slides {
    position: absolute;
    inset: 0;
    z-index: -2;
}
.home-hero-slide {
    position: absolute;
    inset: 0;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}
.home-hero-slide.is-active { opacity: 1; }
.home-hero-band::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(15, 20, 35, 0.72) 0%,
        rgba(15, 20, 35, 0.50) 55%,
        rgba(15, 20, 35, 0.30) 100%);
    z-index: -1;
}

.home-greeting { margin: 8px 4px 20px; }
.home-greeting h1 {
    font-size: 22px; font-weight: 700; color: var(--cor-primaria);
    margin: 0 0 4px;
}
.home-greeting p {
    font-size: 14px; color: #5f6368; margin: 0;
}
.home-hero-band .home-greeting { margin: 0 0 20px; }
.home-hero-band .home-greeting h1 {
    color: #fff;
    font-size: 26px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.home-hero-band .home-greeting p {
    color: rgba(255,255,255,0.92);
    font-size: 15px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Atalhos rápidos */
.home-shortcuts {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 28px;
}
.home-hero-band .home-shortcuts { margin-bottom: 0; }
.home-hero-band .shortcut-card {
    background: rgba(255,255,255,0.94);
    border-color: rgba(255,255,255,0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 2px 8px rgba(15, 20, 35, 0.12);
}
.home-hero-band .shortcut-card:hover {
    background: #fff;
    box-shadow: 0 6px 16px rgba(15, 20, 35, 0.18);
}
.shortcut-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #e3e6ea;
    border-radius: 12px;
    padding: 16px 8px;
    color: var(--cor-primaria);
    text-decoration: none;
    font-family: inherit;
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.15s, border-color 0.15s;
    -webkit-tap-highlight-color: transparent;
    max-width: 300px;
}
.shortcut-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 20, 35, 0.08);
    border-color: #d4d7dc;
}
.shortcut-icon {
    width: 44px; height: 44px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--cor-botao-soft, #f1f8f4);
    color: var(--cor-botao, #34a853);
}
.shortcut-label { text-align: center; line-height: 1.15; }

/* Seção (título + carrossel/grid) */
.home-section { margin-bottom: 28px; }
.home-section-head {
    display: flex; align-items: center; justify-content: flex-start;
    gap: 12px; margin: 0 2px 12px;
}
.home-section-head h2 {
    font-size: 16px; font-weight: 700; color: var(--cor-primaria);
    margin: 0;
}
.home-section-link {
    font-size: 13px; font-weight: 600;
    color: var(--cor-botao, #34a853);
    text-decoration: none;
}
.home-section-link:hover { text-decoration: underline; }
.home-section-count {
    background: #eef0f3; color: #5f6368;
    padding: 2px 10px; border-radius: 12px;
    font-size: 12px; font-weight: 600;
}

/* Carrossel horizontal (scroll-snap puro) */
.h-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 4px 2px 8px;
    scrollbar-width: thin;
}
.h-scroll::-webkit-scrollbar { height: 8px; }
.h-scroll::-webkit-scrollbar-thumb { background: #dfe3e8; border-radius: 4px; }
.h-scroll::-webkit-scrollbar-track { background: transparent; }
.h-scroll > * {
    scroll-snap-align: start;
    flex: 0 0 auto;
}

/* Card de fabricante (compacto, sem foto — usa inicial) */
.card-manufacturer {
    width: 140px;
    display: flex; flex-direction: column; align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #e3e6ea;
    border-radius: 12px;
    padding: 16px 10px;
    text-decoration: none;
    color: var(--cor-primaria);
    text-align: center;
    transition: transform 0.12s, box-shadow 0.15s, border-color 0.15s;
}
.card-manufacturer:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 20, 35, 0.08);
    border-color: #d4d7dc;
}
.card-manufacturer-initial {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--cor-primaria);
    color: #fff;
    font-size: 22px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.card-manufacturer-name {
    font-size: 13px; font-weight: 600;
    line-height: 1.2;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

/* Card de equipamento (com foto) — usado no carrossel e no grid */
.card-equipment {
    width: 220px;
    display: flex; flex-direction: column;
    background: #fff;
    border: 1px solid #e3e6ea;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.12s, box-shadow 0.15s, border-color 0.15s;
}
.card-equipment:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 20, 35, 0.08);
    border-color: #d4d7dc;
}
.card-equipment-photo {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid #eef0f3;
}
.card-equipment-photo img {
    width: 100%; height: 100%; object-fit: contain;
    display: block;
}
.card-equipment-photo-missing {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: #b0b6bf;
}
.card-equipment-photo-missing svg {
    width: 40%; max-width: 64px; height: auto;
}
.card-equipment-body {
    padding: 10px 12px 12px;
    display: flex; flex-direction: column;
    gap: 2px;
}
.card-equipment-body h3 {
    font-size: 14px; font-weight: 600; color: var(--cor-primaria);
    margin: 0;
    line-height: 1.25;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.card-equipment-meta {
    font-size: 12px; color: #5f6368; margin: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-equipment-mfg {
    font-size: 12px; color: #7b8794;
    font-weight: 600;
    margin: 2px 0 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Grid completo de equipamentos (seção "Equipamentos") */
.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.card-equipment--grid { width: auto; }

/* Empty state da home (company sem permits) */
.home-empty {
    background: #fff;
    border: 1px solid #e3e6ea;
    border-radius: 12px;
    padding: 40px 24px;
    text-align: center;
    color: #5f6368;
}
.home-empty h2 {
    font-size: 18px; font-weight: 600; color: var(--cor-primaria);
    margin: 0 0 8px;
}
.home-empty p {
    font-size: 14px; margin: 0;
}

/* Layout 2-colunas: catálogo (fabricantes + equipamentos) à esquerda,
   favoritos à direita. As colunas têm a mesma altura — a lateral é fixada
   à altura da esquerda via position:absolute do card interno (não contribui
   para o tamanho da row), e o card rola internamente quando o conteúdo passa.
   Empilha em telas estreitas. */
.home-cols {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 24px;
}
.home-col-main { min-width: 0; }
.home-col-side {
    min-width: 0;
    position: relative;
}
/* Wrapper interno que ocupa a altura da coluna esquerda via inset:0
   (a aside fica com 0 de conteúdo intrínseco, então a row da grid não
   é puxada pelo conteúdo dos favoritos). Dentro, flex-column: título
   no topo + card preenchendo o resto e rolando internamente. */
.home-col-side-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
}
.home-fav-title { flex: 0 0 auto; margin: 0 2px 12px; }

/* Card-container "Favoritos" na coluna lateral (3 categorias) */
.home-fav-card {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e3e6ea;
    border-radius: 12px;
    padding: 14px 16px 16px;
}
.home-fav-card::-webkit-scrollbar { width: 8px; }
.home-fav-card::-webkit-scrollbar-thumb { background: #dfe3e8; border-radius: 4px; }
.home-fav-card::-webkit-scrollbar-track { background: transparent; }
.home-fav-card .home-fav-section { margin-bottom: 18px; }
.home-fav-card .home-fav-section:last-child { margin-bottom: 0; }
.home-fav-card .home-section-head {
    margin: 0 0 10px;
    flex-direction: row-reverse;
    justify-content: flex-start;
}
.home-fav-card .home-section-head h3 {
    font-size: 12px;
    font-weight: 700;
    color: #5f6368;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* Cards de favoritos compactos dentro do card-container */
.home-fav-card .favs-grid-eq,
.home-fav-card .favs-grid-sub {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.home-fav-card .favs-card-eq .photo,
.home-fav-card .favs-card-sub .photo {
    height: 100px;
}
/* Row de peça sem o índice (única coluna de info, estrela continua absolute) */
.home-fav-card .favs-row-part {
    grid-template-columns: 1fr;
}

/* Cards de favoritos (compartilhado entre /favoritos e home) */
.favs-grid-eq {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.favs-card-eq {
    position: relative;
    background: white; border: 1px solid #e8eaed; border-radius: 12px;
    overflow: hidden; text-decoration: none; color: inherit;
    display: flex; flex-direction: column;
    transition: box-shadow 0.15s, transform 0.1s, border-color 0.15s;
}
.favs-card-eq:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.08); transform: translateY(-2px); border-color: #d4d7dc; }
.favs-card-eq .photo {
    height: 140px; background: #fff; display: flex; align-items: center; justify-content: center;
    border-bottom: 1px solid #f1f3f4;
}
.favs-card-eq .photo img { width: 100%; height: 100%; object-fit: contain; }
.favs-card-eq .body { padding: 10px 12px 12px; }
.favs-card-eq h3 {
    font-size: 14px; font-weight: 600; color: #3d4452;
    margin: 0 0 4px; line-height: 1.3;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.favs-card-eq .meta { font-size: 12px; color: #70757a; }
.favs-card-eq .mfg {
    font-size: 11px; color: #9aa0a6; margin-top: 2px;
    text-transform: uppercase; letter-spacing: 0.3px;
}

.favs-grid-sub {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.favs-card-sub {
    position: relative;
    background: white; border: 1px solid #e8eaed; border-radius: 12px;
    overflow: hidden; text-decoration: none; color: inherit;
    display: flex; flex-direction: column;
    transition: box-shadow 0.15s, transform 0.1s, border-color 0.15s;
}
.favs-card-sub:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.08); transform: translateY(-2px); border-color: #d4d7dc; }
.favs-card-sub .photo {
    height: 130px; background: #fff;
    display: flex; align-items: center; justify-content: center;
    border-bottom: 1px solid #f1f3f4;
}
.favs-card-sub .photo img { width: 100%; height: 100%; object-fit: contain; }
.favs-card-sub .body { padding: 10px 12px 12px; }
.favs-card-sub h3 {
    font-size: 14px; font-weight: 600; color: #3d4452;
    margin: 0 0 4px; line-height: 1.3;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.favs-card-sub .ctx {
    font-size: 11px; color: #9aa0a6;
    text-transform: uppercase; letter-spacing: 0.3px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.favs-list-parts {
    display: flex; flex-direction: column; gap: 8px;
}
.favs-row-part {
    position: relative;
    background: white; border: 1px solid #e8eaed; border-radius: 10px;
    padding: 12px 14px; padding-right: 48px;
    text-decoration: none; color: inherit;
    display: grid; grid-template-columns: auto 1fr auto; gap: 12px;
    align-items: center;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.favs-row-part:hover { border-color: #d4d7dc; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.favs-row-part .pos {
    background: #f1f3f4; color: #3d4452;
    border-radius: 6px; padding: 4px 10px; font-weight: 700; font-size: 13px;
    min-width: 36px; text-align: center;
}
.favs-row-part .info { min-width: 0; }
.favs-row-part .info .nome {
    font-size: 14px; font-weight: 600; color: #3d4452;
    line-height: 1.3; word-break: break-word;
}
.favs-row-part .info .cod { font-size: 12px; color: #70757a; margin-top: 2px; }
.favs-row-part .info .ctx {
    font-size: 11px; color: #9aa0a6; margin-top: 4px;
    text-transform: uppercase; letter-spacing: 0.3px;
}

.favs-card-eq .btn-fav,
.favs-card-sub .btn-fav,
.favs-row-part .btn-fav {
    position: absolute; top: 8px; right: 8px;
    z-index: 2;
}

@media (max-width: 900px) {
    .home-cols { grid-template-columns: 1fr; gap: 16px; }
    .home-col-side { position: static; }
    .home-col-side-inner { position: static; display: block; }
    .home-fav-card { flex: none; min-height: 0; overflow: visible; }
}
@media (max-width: 768px) {
    .home-main { padding: 14px 12px 96px; }
    .home-greeting h1 { font-size: 20px; }
    .home-hero-band { padding: 20px 14px 16px; border-radius: 12px; }
    .home-hero-band .home-greeting h1 { font-size: 22px; }
    .home-hero-band .home-greeting p { font-size: 14px; }
    .home-shortcuts {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    .shortcut-card { padding: 12px 4px; font-size: 12px; }
    .shortcut-icon { width: 40px; height: 40px; }
    .shortcut-icon .icon { width: 22px; height: 22px; }
    .card-manufacturer { width: 120px; }
    .card-equipment { width: 180px; }
    .home-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
}
@media (max-width: 600px) {
    .favs-grid-eq, .favs-grid-sub {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
    }
    .favs-card-eq .photo, .favs-card-sub .photo { height: 110px; }
}
@media (max-width: 420px) {
    .home-shortcuts { grid-template-columns: repeat(2, 1fr); }
}

/* =============================================================
 * Botão estrela de favoritar (melhoriasPBC#9)
 * Aparece em cards de equipment, subsystem e part em todas as
 * rotas. is-fav = amarelo cheio; sem is-fav = cinza vazado, mas
 * com hover destacado. Sempre clicável (toggle).
 * ============================================================= */
.btn-fav {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    background: rgba(255, 255, 255, 0.85);
    color: #c0c4cb;
    border: 1px solid rgba(192, 196, 203, 0.45);
    border-radius: 50%;
    cursor: pointer; padding: 0;
    transition: color 0.12s, background 0.12s, transform 0.08s, box-shadow 0.12s;
    -webkit-tap-highlight-color: transparent;
}
.btn-fav:hover {
    color: #f5b800;
    background: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.btn-fav:active { transform: scale(0.92); }
.btn-fav.is-fav {
    color: #f5b800;
    background: white;
    border-color: rgba(245, 184, 0, 0.5);
}
.btn-fav.is-fav:hover { color: #e0a500; }
.btn-fav svg { display: block; }

/* Card-fav-corner: posiciona a estrela no canto superior direito, sobre
 * a foto. Os cards que recebem isso têm `.card-with-fav` e position:relative
 * ou a regra abaixo o impõe. */
.card-with-fav { position: relative; }
.btn-fav.card-fav-corner {
    position: absolute; top: 8px; right: 8px;
    z-index: 3;
    width: 30px; height: 30px;
}
.btn-fav.card-fav-corner svg { width: 16px; height: 16px; }

/* Estrela na topbar (entre conta e carrinho). Reaproveita aparência do
 * link-puro do carrinho na topbar. */
.topbar-fav-link {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px;
    color: #f5b800;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.12s;
}
.topbar-fav-link:hover { background: rgba(245, 184, 0, 0.12); color: #e0a500; }
.topbar-fav-link svg { display: block; }
@media (max-width: 600px) {
    .topbar-fav-link { width: 36px; height: 36px; }
}

/* No painel lateral do desenho a estrela do header herda fundo claro */
.side-header .btn-fav {
    width: 26px; height: 26px;
    background: transparent; border-color: transparent;
}
.side-header .btn-fav:hover { background: rgba(245, 184, 0, 0.1); }
.side-header .btn-fav svg { width: 14px; height: 14px; }
.peca-item .btn-fav {
    width: 26px; height: 26px;
    background: transparent; border-color: transparent;
}
.peca-item .btn-fav svg { width: 14px; height: 14px; }

/* === Hotspot clusters (desktop) — agrupa hotspots sobrepostos =====================
   Padrão visual inspirado em Google MarkerClusterer: badge azul com contagem,
   halo semi-transparente reforça que é cluster. Borda escura (não branca) pra
   manter contraste contra fundo branco do desenho técnico.
   Usado em /equipamento/... (desenho.eta) e na modal de preview do carrinho. */
/* Idle limpo (sem borda dura) + sombra forte espelhando o app mobile:
   o badge "flutua" sobre o desenho com fundo azul claro translúcido e
   sombra suave. Os estados is-open / partial-selected / all-selected
   ligam suas próprias bordas quando precisam destacar. */
.hs-cluster {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
    background: rgba(66, 133, 244, 0.2);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
    /* Número da contagem fica sempre invisível — visualização limpa. */
    color: transparent;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    z-index: 5;
    -webkit-tap-highlight-color: transparent;
}
/* Hover: scale 1→1.1 com leve overshoot (easeOutBack). A transição
   declarada no :hover só vale no sentido de entrada — saindo, volta com
   ease linear da base (sem rebote desconfortável).
   Fundo passa pro verde claro (--cor-destaque: #6ecf94) a 40% — mesmo verde
   usado no hover do hotspot comum. */
.hs-cluster:hover {
    transform: scale(1.1);
    background: rgba(110, 207, 148, 0.25);
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
                background 0.15s ease,
                border-color 0.15s ease;
}
/* Aberto: borda passa pro verde --cor-botao (#34a853) opaco — mesma cor
   do .hotspot.selected. Fundo continua igual ao hover. */
.hs-cluster.is-open {
    transform: scale(1.04);
    background: rgba(110, 207, 148, 0.25);
    border-color: #34a853;
}
/* Seleção parcial: borda verde clara (--cor-destaque) — sinaliza
   "alguns dentro" sem o peso visual da borda preta. */
.hs-cluster.partial-selected {
    border-color: #6ecf94;
}
/* Todos os filhos selecionados: fundo igual ao hover (verde claro
   --cor-destaque a 25%) mas borda verde sólida --cor-botao (#34a853),
   indicando que o cluster está totalmente selecionado. */
.hs-cluster.all-selected {
    background: rgba(110, 207, 148, 0.25);
    border-color: #34a853;
}
/* No preview do /carrinho (3 abas) deixamos um pouco mais opaco (0.4) pra
   o cluster ficar mais legível na thumb pequena, mas ainda traslúcido o
   suficiente pra ver as linhas do desenho. Especificidade maior (0,3,0)
   sobrepõe a regra base (.hs-cluster.all-selected = 0,2,0). */
.preview-drawing .hs-cluster.all-selected {
    background: rgba(110, 207, 148, 0.4);
}
.hs-spider-line {
    position: absolute;
    height: 2px;
    background: rgba(20, 20, 20, 0.45);
    transform-origin: 0 50%;
    pointer-events: none;
    z-index: 4;
}
/* Filhos do leque ganham borda verde clara em destaque (espelha o app
   mobile) — reforça que esses círculos pertencem ao cluster ativo, e não
   são hotspots soltos. A regra de spotlight no template do desenho técnico
   já esconde tudo o que não for .hs-fanned quando o cluster está aberto. */
.hotspot.hs-fanned, .preview-hotspot.hs-fanned {
    z-index: 6;
    border: 2px solid #6ecf94;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
/* Animação de abertura: easeOutBack (overshoot suave) em 0.3s — mais
   "snappy" que o cubic-bezier conservador original. Espelha a sensação do
   app mobile (300ms easeOutBack). Só ativa em renders disparados pelo
   CLIQUE de abrir — re-renders durante zoom/pan não recebem .hs-anim. */
.hs-spider-line.hs-anim {
    transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.hotspot.hs-fanned.hs-anim, .preview-hotspot.hs-fanned.hs-anim {
    transition: left 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                top 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@media (prefers-reduced-motion: reduce) {
    .hs-spider-line.hs-anim,
    .hotspot.hs-fanned.hs-anim,
    .preview-hotspot.hs-fanned.hs-anim { transition: none; }
}
