/* ═══════════════════════════════════════════
   TEACHei PREMIUM NAVBAR — v3 Refinement
   Inspired by Linear, Stripe, Vercel, Apple
   ═══════════════════════════════════════════ */

/* ─── Variables ─── */
:root {
    --tn-blue: var(--color-primary, #007AFF);
    --tn-blue-soft: var(--color-primary-container, #E5F1FF);
    --tn-blue-hover: rgba(var(--color-primary-rgb, 0, 122, 255), 0.14);
    --tn-blue-medium: rgba(var(--color-primary-rgb, 0, 122, 255), 0.18);
    --tn-red-soft: #fef2f2;
    --tn-red: #ef4444;
    --tn-orange-soft: #fff7ed;
    --tn-orange: #f59e0b;
    --tn-gray-50: #f9fafb;
    --tn-gray-100: #f3f4f6;
    --tn-gray-200: #e5e7eb;
    --tn-gray-300: #d1d5db;
    --tn-gray-400: #9ca3af;
    --tn-gray-500: #6b7280;
    --tn-gray-600: #4b5563;
    --tn-gray-700: #374151;
    --tn-gray-800: #1f2937;
    --tn-gray-900: #111827;
    --tn-nav-h: 116px;
    --tn-radius-pill: 999px;
    --tn-radius-lg: 14px;
    --tn-shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --tn-shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --tn-shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
    --tn-transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
    --tn-transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Header Shell (Glassmorphism + Sticky Shadow) ─── */
.tn-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--tn-nav-h);
    z-index: 1000;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(0,0,0,0.04);
    box-shadow: none;
    transition: box-shadow 0.25s ease, background 0.25s ease;
}

/* A tela de Anúncios começa diretamente abaixo da navegação, sem divisor visual. */
.layout-root:has(.anuncios-page) .tn-nav {
    border-bottom: 0 !important;
    box-shadow: none !important;
}

/* O feed ocupa todo o espaço restante; não deixar a área inferior global
   criar uma faixa separada depois do último anúncio visível. */
.layout-root:has(.anuncios-page) > main {
    padding-bottom: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    overflow: hidden !important;
}

.layout-root:has(.anuncios-page) {
    background: transparent !important;
    background-color: transparent !important;
}

@media (max-width: 900px) {
    .layout-root:has(main.home-layout-content) .tn-nav { --tn-nav-h: 66px; height: 66px; }
    .layout-root:has(main.home-layout-content) .tn-home-search { top: 5px; width: calc(100vw - 112px); }
}

/* Final mobile override: keep the brand and search in separate horizontal zones. */
@media (max-width: 767.98px) {
    .layout-root:has(main.home-layout-content) .tn-nav__inner { grid-template-columns: 96px minmax(0, 1fr); grid-template-rows: 66px; column-gap: 8px; padding-inline: 12px; }
    .layout-root:has(main.home-layout-content) .tn-nav__brand { grid-column: 1; grid-row: 1; width: 96px; min-width: 0; }
    .layout-root:has(main.home-layout-content) .tn-nav .tn-nav__logo-img { display: block; width: 96px; max-width: 96px; height: auto; }
    .layout-root:has(main.home-layout-content) .tn-home-search { position: fixed !important; top: 5px !important; left: 116px !important; right: 12px !important; width: auto !important; min-width: 0; transform: none !important; }
    .layout-root:has(main.home-layout-content) .tn-home-location { display: none; }
}
@media (max-width: 360px) {
    .layout-root:has(main.home-layout-content) .tn-nav__inner { grid-template-columns: 82px minmax(0, 1fr); column-gap: 6px; padding-inline: 8px; }
    .layout-root:has(main.home-layout-content) .tn-nav__brand,
    .layout-root:has(main.home-layout-content) .tn-nav .tn-nav__logo-img { width: 82px; max-width: 82px; }
    .layout-root:has(main.home-layout-content) .tn-home-search { left: 96px !important; right: 8px !important; }
}

/* Home mobile: reserve a real column for the brand so the search never overlaps it. */
@media (max-width: 767.98px) {
    .layout-root:has(main.home-layout-content) .tn-nav__inner {
        grid-template-columns: 96px minmax(0, 1fr);
        grid-template-rows: 66px;
        column-gap: 8px;
        padding-inline: 12px;
    }
    .layout-root:has(main.home-layout-content) .tn-nav__brand {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
        width: 96px;
    }
    .layout-root:has(main.home-layout-content) .tn-nav .tn-nav__logo-img {
        display: block;
        width: 96px;
        max-width: 96px;
        height: auto;
    }
    .layout-root:has(main.home-layout-content) .tn-home-search {
        position: absolute !important;
        top: 5px !important;
        left: 116px !important;
        right: 12px !important;
        grid-column: 2;
        grid-row: 1;
        width: auto !important;
        min-width: 0;
        transform: none !important;
    }
    .layout-root:has(main.home-layout-content) .tn-home-location { display: none; }
}

@media (max-width: 360px) {
    .layout-root:has(main.home-layout-content) .tn-nav__inner {
        grid-template-columns: 82px minmax(0, 1fr);
        column-gap: 6px;
        padding-inline: 8px;
    }
    .layout-root:has(main.home-layout-content) .tn-nav__brand,
    .layout-root:has(main.home-layout-content) .tn-nav .tn-nav__logo-img {
        width: 82px;
        max-width: 82px;
    }
    .layout-root:has(main.home-layout-content) .tn-home-search {
        left: 96px !important;
        right: 8px !important;
    }
}

/* Altura única para Home e Catálogo: impede o cabeçalho de crescer pelas regras legadas. */
@media (min-width: 901px) {
    .layout-root:has(main.home-layout-content) .tn-nav,
    .layout-root:has(.cat-page) .tn-nav,
    .layout-root:has(.anuncios-page) .tn-nav {
        --tn-nav-h: 104px;
        height: 104px !important;
        min-height: 104px !important;
        max-height: 104px !important;
        box-sizing: border-box;
        overflow: visible;
    }
    .layout-root:has(main.home-layout-content) .tn-nav__inner,
    .layout-root:has(.cat-page) .tn-nav__inner,
    .layout-root:has(.anuncios-page) .tn-nav__inner {
        height: 104px;
        min-height: 104px;
        max-height: 104px;
        box-sizing: border-box;
    }
}

/* Planos: mesmo cabeçalho translúcido e compacto da Home/Catálogo. */
@supports selector(.layout-root:has(.plans-page)) {
    .layout-root:has(.plans-page) .tn-nav {
        --tn-nav-h: 104px;
        height: 104px;
        background: transparent;
        border-bottom: 0;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .layout-root:has(.plans-page) .tn-nav__inner {
        grid-template-columns: auto minmax(320px, 680px) auto;
        grid-template-rows: 52px 34px;
        column-gap: 16px;
        row-gap: 1px;
        padding-top: 5px;
        padding-bottom: 5px;
    }
    .layout-root:has(.plans-page) .tn-nav__inner::before { display: none; }
    .layout-root:has(.plans-page) .tn-nav__brand { grid-column: 1; grid-row: 1; }
    .layout-root:has(.plans-page) .tn-nav__logo-img { height: 48px; width: auto; }
    .layout-root:has(.plans-page) .tn-home-search { grid-column: 2; grid-row: 1; justify-self: center; width: 100%; max-width: 680px; }
    .layout-root:has(.plans-page) .tn-nav__actions { grid-column: 3; grid-row: 1; }
    .layout-root:has(.plans-page) .tn-nav__links { grid-column: 1 / -1; grid-row: 2; justify-content: center; gap: 2px; }
    .layout-root:has(.plans-page) .tn-pill { height: 34px; padding-inline: 9px; border: 1px solid transparent; color: #667386; font-size: .78rem; }
    .layout-root:has(.plans-page) .tn-pill:hover { border-color: rgba(8,120,238,.14); background: rgba(255,255,255,.62); color: #0878ee; }
    .layout-root:has(.plans-page) .tn-pill.active,
    .layout-root:has(.plans-page) .tn-pill.active:hover { border-color: rgba(8,120,238,.16); background: rgba(8,120,238,.1); color: #0878ee; box-shadow: 0 5px 16px rgba(8,120,238,.08); }
    .layout-root:has(.plans-page) .tn-pill.active::after { bottom: -2px; background: #0878ee; }
    .layout-root:has(.plans-page) .tn-action-btn { width: 34px; height: 34px; }
    .layout-root:has(.plans-page) .tn-btn-login,
    .layout-root:has(.plans-page) .tn-btn-register { height: 34px; }
    .layout-root:has(.plans-page) .tn-home-search .anuncios-search__bar { min-height: 42px; border: 1px solid rgba(148,163,184,.25); border-radius: 18px; background: rgba(255,255,255,.64); box-shadow: 0 10px 26px rgba(32,63,105,.08); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
    .layout-root:has(.plans-page) .tn-home-search .anuncios-search__go { min-height: 36px; padding: 0 1rem; border-radius: 11px; color: #fff; background: #0878ee; font-size: .75rem; }
}

/* Ajuste final da localização: o nome da cidade não pode ser truncado pelo select. */
@media (min-width: 901px) {
    .layout-root:has(main.home-layout-content) .tn-home-location {
        width: 198px !important;
    }
    .layout-root:has(main.home-layout-content) .tn-home-location select,
    .layout-root:has(main.home-layout-content) .tn-home-location select:first-of-type {
        flex: 1 1 auto !important;
        width: auto !important;
        max-width: none !important;
        font-size: .72rem;
    }
}

@media (min-width: 901px) {
    .layout-root:has(main.home-layout-content) .tn-home-location { width: 190px; }
    .layout-root:has(main.home-layout-content) .tn-home-location select { flex: 1 1 auto; width: auto; max-width: 145px; }
    .layout-root:has(main.home-layout-content) .tn-home-location__state { color: #536174; font: 800 .68rem var(--font-body); }
    .layout-root:has(main.home-layout-content) .tn-home-location__chevron { flex: 0 0 auto; color: #536174; font-size: .62rem; }
}

@media (min-width: 901px) {
    .layout-root:has(main.home-layout-content) .tn-nav__inner { grid-template-columns: auto auto minmax(320px, 1fr) auto; }
    .layout-root:has(main.home-layout-content) .tn-home-location { grid-column: 2; grid-row: 1; width: 250px; }
    .layout-root:has(main.home-layout-content) .tn-home-search { position: relative; top: auto; left: auto; grid-column: 3; grid-row: 1; justify-self: center; width: min(100%, 680px); transform: none; }
    .layout-root:has(main.home-layout-content) .tn-nav__actions { grid-column: 4; grid-row: 1; }
    .layout-root:has(main.home-layout-content) .tn-home-location { width: 214px; }
    .layout-root:has(main.home-layout-content) .tn-home-location select:first-of-type { flex: 0 0 128px; width: 128px; }
    .layout-root:has(main.home-layout-content) .tn-home-location select:last-of-type { flex: 0 0 42px; width: 42px; }
}

@media (min-width: 901px) {
    .layout-root:has(main.home-layout-content) .tn-nav__inner {
        grid-template-columns: auto auto minmax(320px, 1fr) auto;
    }
    .layout-root:has(main.home-layout-content) .tn-home-location {
        grid-column: 2;
        grid-row: 1;
        width: 214px;
    }
    .layout-root:has(main.home-layout-content) .tn-home-location select:first-of-type { flex: 0 0 128px; width: 128px; }
    .layout-root:has(main.home-layout-content) .tn-home-location select:last-of-type { flex: 0 0 42px; width: 42px; }
    .layout-root:has(main.home-layout-content) .tn-home-search {
        position: relative;
        top: auto;
        left: auto;
        grid-column: 3;
        grid-row: 1;
        justify-self: center;
        width: min(100%, 680px);
        transform: none;
    }
    .layout-root:has(main.home-layout-content) .tn-nav__actions {
        grid-column: 4;
        grid-row: 1;
    }
}

/* O estado ativo do Catálogo deve ter exatamente a mesma escala visual da Home. */
@media (min-width: 901px) {
    .layout-root:has(.cat-page) .tn-nav__links {
        gap: 2px;
    }
    .layout-root:has(.anuncios-page) .tn-nav__links {
        gap: 2px;
    }
    .layout-root:has(.cat-page) .tn-pill {
        height: 34px;
        padding-inline: 9px;
        border: 1px solid transparent;
        color: #667386;
        font-size: .78rem;
    }
    .layout-root:has(.cat-page) .tn-pill:hover {
        border-color: rgba(8,120,238,.14);
        background: rgba(255,255,255,.62);
        color: #0878ee;
        box-shadow: 0 5px 14px rgba(28,48,74,.05);
    }
    .layout-root:has(.cat-page) .tn-pill.active,
    .layout-root:has(.cat-page) .tn-pill.active:hover {
        border-color: rgba(8,120,238,.16);
        background: rgba(8,120,238,.1);
        color: #0878ee;
        box-shadow: 0 5px 16px rgba(8,120,238,.08);
    }
    .layout-root:has(.cat-page) .tn-pill.active::after {
        bottom: -2px;
        background: #0878ee;
    }
    .layout-root:has(.anuncios-page) .tn-pill {
        height: 34px;
        padding-inline: 9px;
        border: 1px solid transparent;
        color: #667386;
        font-size: .78rem;
    }
    .layout-root:has(.anuncios-page) .tn-pill:hover {
        border-color: rgba(8,120,238,.14);
        background: rgba(255,255,255,.62);
        color: #0878ee;
        box-shadow: 0 5px 14px rgba(28,48,74,.05);
    }
    .layout-root:has(.anuncios-page) .tn-pill.active,
    .layout-root:has(.anuncios-page) .tn-pill.active:hover {
        border-color: rgba(8,120,238,.16);
        background: rgba(8,120,238,.1);
        color: #0878ee;
        box-shadow: 0 5px 16px rgba(8,120,238,.08);
    }
    .layout-root:has(.anuncios-page) .tn-pill.active::after {
        bottom: -2px;
        background: #0878ee;
    }
    .layout-root:has(.cat-page) .tn-action-btn {
        width: 34px;
        height: 34px;
    }
    .layout-root:has(.cat-page) .tn-btn-login,
    .layout-root:has(.cat-page) .tn-btn-register {
        height: 34px;
    }
}
.tn-nav.scrolled {
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.tn-nav__inner {
    display: grid;
    grid-template-columns: auto minmax(280px, 1fr) auto;
    grid-template-rows: 56px 40px;
    align-items: center;
    column-gap: clamp(16px, 2vw, 32px);
    row-gap: 4px;
    width: 100%;
    max-width: 1480px;
    height: 100%;
    margin: 0 auto;
    padding: 6px clamp(16px, 2.2vw, 32px);
    min-width: 0;
}
.tn-nav__brand { grid-column: 1; grid-row: 1; margin-right: 0; }
.tn-home-search {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0;
}
.tn-nav .tn-home-search .anuncios-search { width: 100%; min-width: 0; }
.tn-nav .tn-home-search .anuncios-search__bar { min-height: 46px; border-radius: 12px; background: #f8fafc; }
.tn-nav .tn-home-search .anuncios-search__go { min-height: 36px; padding-inline: .9rem; border-radius: 10px; font-size: .78rem; }
.tn-nav .tn-home-search .anuncios-search__icon-btn { display: none; }
.tn-nav .tn-home-search .anuncios-search__suggestions { z-index: 1200; }
/* ─── Brand / Logo (+10% size) ─── */
.tn-nav__brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    grid-column: 1;
    grid-row: 1;
    flex-shrink: 0;
    margin-right: 0;
    transition: opacity var(--tn-transition);
}
.tn-nav__brand:hover { opacity: 0.8; }
.tn-nav__logo-img {
    height: 44px;
    object-fit: contain;
    transition: transform var(--tn-transition);
}
.tn-nav__brand:hover .tn-nav__logo-img {
    transform: scale(1.03);
}

/* ─── Nav Links Container (Wider Gap) ─── */
.tn-nav__links {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(4px, .6vw, 10px);
    min-width: 0;
    overflow: visible;
}

/* ─── Pill Button (42px height, wider padding) ─── */
.tn-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 18px;
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--tn-gray-500);
    text-decoration: none;
    border-radius: var(--tn-radius-pill);
    border: none;
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--tn-transition);
    position: relative;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}
.tn-pill:focus-visible {
    box-shadow: 0 0 0 2px var(--tn-blue-soft), 0 0 0 4px var(--tn-blue);
}
.tn-pill i {
    font-size: 0.93rem;
    flex-shrink: 0;
    transition: color var(--tn-transition), transform var(--tn-transition);
}
.tn-pill:hover {
    background: var(--tn-gray-100);
    color: var(--tn-gray-700);
}
.tn-pill:hover i { color: inherit; }
.tn-pill:active {
    transform: scale(0.97);
}

/* ─── Active State (Refined) ─── */
.tn-pill.active,
.tn-pill.active:hover {
    background: var(--tn-blue-soft);
    color: var(--tn-blue);
    font-weight: 700;
}
.tn-pill.active i {
    color: var(--tn-blue);
    transform: scale(1.06);
}
.tn-pill.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 3px;
    border-radius: 2px;
    background: var(--tn-blue);
    opacity: 0.45;
}

/* ─── Pill Variants ─── */
.tn-pill--sos:hover {
    background: var(--tn-red-soft);
    color: var(--tn-red);
}
.tn-pill--sos.active {
    background: var(--tn-red-soft);
    color: var(--tn-red);
}
.tn-pill--sos.active i { color: var(--tn-red); }
.tn-pill--sos.active::after { background: var(--tn-red); }

.tn-pill--plan:hover {
    background: var(--tn-blue-soft);
    color: var(--tn-blue);
}
.tn-pill--plan.active {
    background: var(--tn-blue-soft);
    color: var(--tn-blue);
}

.tn-pill--admin {
    font-size: 0.81rem;
}
.tn-pill__chevron {
    font-size: 0.62rem !important;
    margin-left: -2px;
    opacity: 0.45;
    transition: transform var(--tn-transition);
}
.tn-pill--admin[aria-expanded="true"] .tn-pill__chevron,
.tn-pill--admin.active .tn-pill__chevron { transform: rotate(180deg); }

.tn-pill-sep {
    width: 1px;
    height: 24px;
    background: var(--tn-gray-200);
    margin: 0 6px;
    flex-shrink: 0;
}

/* ─── Actions Group (Uniform Spacing) ─── */
.tn-nav__actions {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 0;
}
.tn-actions-group {
    display: flex;
    align-items: center;
    gap: 2px;
}
.tn-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--tn-radius-pill);
    border: none;
    background: transparent;
    color: var(--tn-gray-400);
    cursor: pointer;
    transition: all var(--tn-transition);
    flex-shrink: 0;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}
.tn-action-btn i { font-size: 1.05rem; }
.tn-action-btn:hover {
    background: var(--tn-gray-100);
    color: var(--tn-gray-600);
}
.tn-action-btn:focus-visible {
    box-shadow: 0 0 0 2px var(--tn-blue-soft), 0 0 0 4px var(--tn-blue);
}
.tn-action-btn:active { transform: scale(0.92); }

.tn-notification-btn {
    position: relative;
}

.tn-notification-badge {
    position: absolute;
    top: 4px;
    right: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--tn-blue);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.96), 0 8px 18px rgba(0,122,255,0.25);
}

.tn-action-btn--danger {
    color: var(--tn-red, #ef4444);
}
.tn-action-btn--danger:hover {
    background: var(--tn-red-soft);
    color: var(--tn-red);
}

.tn-divider {
    width: 1px;
    height: 26px;
    background: var(--tn-gray-200);
    flex-shrink: 0;
    margin: 0 6px;
}

/* ─── Avatar Button (Premium) ─── */
.tn-avatar-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 14px 5px 5px;
    border-radius: var(--tn-radius-pill);
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    transition: all var(--tn-transition);
    max-width: 200px;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}
.tn-avatar-btn:hover {
    background: var(--tn-gray-100);
    border-color: var(--tn-gray-200);
}
.tn-avatar-btn:focus-visible {
    box-shadow: 0 0 0 2px var(--tn-blue-soft), 0 0 0 4px var(--tn-blue);
}
.tn-avatar {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tn-blue), #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.9), 0 2px 4px rgba(0,0,0,0.08);
    transition: box-shadow var(--tn-transition);
}
.tn-avatar-btn:hover .tn-avatar {
    box-shadow: 0 0 0 2px rgba(255,255,255,0.9), 0 2px 8px rgba(0,0,0,0.12);
}
.tn-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.tn-avatar span {
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}
.tn-avatar__online {
    position: absolute;
    bottom: 0; right: 0;
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 4px rgba(16,185,129,0.4);
}
.tn-avatar--md {
    width: 40px; height: 40px;
}
.tn-avatar-info {
    display: flex;
    flex-direction: column;
    text-align: left;
    min-width: 0;
}
.tn-avatar-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--tn-gray-800);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
}
.tn-avatar-plan {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--tn-gray-400);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.3;
}
.tn-avatar-arrow {
    font-size: 0.58rem !important;
    color: var(--tn-gray-300);
    flex-shrink: 0;
    transition: transform var(--tn-transition);
    opacity: 0.6;
}
.tn-avatar-btn:hover .tn-avatar-arrow { transform: rotate(180deg); opacity: 1; }

/* ─── Login / Register Buttons (Reduced Weight) ─── */
.tn-btn-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 18px;
    border-radius: var(--tn-radius-pill);
    background: transparent;
    color: var(--tn-gray-500);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--tn-gray-200);
    transition: all var(--tn-transition);
    white-space: nowrap;
    outline: none;
}
.tn-btn-login:hover {
    background: var(--tn-gray-100);
    border-color: var(--tn-gray-300);
    color: var(--tn-gray-700);
}
.tn-btn-login:focus-visible {
    box-shadow: 0 0 0 2px var(--tn-blue-soft), 0 0 0 4px var(--tn-blue);
}
.tn-btn-register {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 20px;
    border-radius: var(--tn-radius-pill);
    background: var(--tn-blue);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    transition: all var(--tn-transition);
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(59,130,246,0.2);
    outline: none;
}
.tn-btn-register:hover {
    color: #fff;
    box-shadow: 0 2px 8px rgba(59,130,246,0.3);
    transform: translateY(-1px);
}
.tn-btn-register:active { transform: translateY(0) scale(0.97); }
.tn-btn-register:focus-visible {
    box-shadow: 0 0 0 2px var(--tn-blue-soft), 0 0 0 4px var(--tn-blue);
}
.tn-btn-register i { font-size: 0.82rem; }

.tn-menu-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--tn-radius-pill);
    border: 1px solid var(--tn-gray-200);
    background: rgba(255,255,255,0.72);
    color: var(--tn-gray-600);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--tn-transition);
}
.tn-menu-btn:hover {
    background: var(--tn-blue-soft);
    border-color: transparent;
    color: var(--tn-blue);
}

/* ─── Dropdown ─── */
.tn-dropdown-overlay {
    position: fixed;
    inset: 0;
    z-index: 1090;
}
.tn-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 200px;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--tn-gray-200);
    border-radius: var(--tn-radius-lg);
    padding: 6px;
    z-index: 1100;
    box-shadow: var(--tn-shadow-lg);
    animation: tn-drop-in 0.15s ease;
}
.tn-dropdown--right { left: auto; right: 0; }
.tn-dropdown__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--tn-gray-600);
    text-decoration: none;
    border-radius: 10px;
    transition: all var(--tn-transition-fast);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.tn-dropdown__item i { font-size: 0.95rem; flex-shrink: 0; }
.tn-dropdown__item:hover {
    background: var(--tn-gray-100);
    color: var(--tn-gray-800);
}
.tn-dropdown__sep {
    height: 1px;
    background: var(--tn-gray-200);
    margin: 4px 8px;
}

.tn-notifications-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(360px, calc(100vw - 24px));
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 22px;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(255,255,255,0.55) inset;
    z-index: 1110;
    animation: tn-drop-in 0.15s ease;
}

.tn-notifications-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 14px 10px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.72);
}

.tn-notifications-header strong {
    display: block;
    color: var(--tn-gray-900);
    font-size: 0.98rem;
    font-weight: 900;
}

.tn-notifications-header span {
    display: block;
    margin-top: 2px;
    color: var(--tn-gray-400);
    font-size: 0.75rem;
    font-weight: 700;
}

.tn-notifications-link,
.tn-notifications-view-all {
    border: 0;
    background: transparent;
    color: var(--tn-blue);
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.tn-notifications-link:disabled,
.tn-notifications-view-all:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.tn-notifications-link.danger {
    color: var(--tn-red, #ef4444);
}

.tn-notifications-list {
    max-height: 336px;
    overflow-y: auto;
    padding: 8px;
}

.tn-notification-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 10px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background var(--tn-transition-fast), transform var(--tn-transition-fast);
}

.tn-notification-item:hover {
    background: var(--tn-gray-100);
}

.tn-notification-item.unread {
    background: rgba(0, 122, 255, 0.07);
}

.tn-notification-item.unread:hover {
    background: rgba(0, 122, 255, 0.11);
}

.tn-notification-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: rgba(0, 122, 255, 0.1);
    color: var(--tn-blue);
    flex-shrink: 0;
}

.tn-notification-icon.sos {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.tn-notification-icon.agenda {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.tn-notification-icon.plan {
    background: rgba(249, 115, 22, 0.12);
    color: #f97316;
}

.tn-notification-icon.like {
    background: rgba(255, 45, 85, 0.12);
    color: #ff2d55;
}

.tn-notification-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}

.tn-notification-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.tn-notification-body strong {
    color: var(--tn-gray-800);
    font-size: 0.82rem;
    font-weight: 900;
}

.tn-notification-body span {
    display: -webkit-box;
    color: var(--tn-gray-500);
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.35;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tn-notification-body small {
    color: var(--tn-gray-400);
    font-size: 0.68rem;
    font-weight: 800;
}

.tn-notifications-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 28px 18px;
    text-align: center;
}

.tn-notifications-empty i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: rgba(0, 122, 255, 0.1);
    color: var(--tn-blue);
    font-size: 1.1rem;
}

.tn-notifications-empty strong {
    color: var(--tn-gray-800);
    font-size: 0.92rem;
    font-weight: 900;
}

.tn-notifications-empty span {
    max-width: 240px;
    color: var(--tn-gray-400);
    font-size: 0.76rem;
    font-weight: 600;
}

.tn-notifications-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 10px 14px;
    border-top: 1px solid rgba(226, 232, 240, 0.72);
}

@keyframes tn-drop-in {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ═══════════════════════════════════════════
   MOBILE MENU (Drawer)
   ═══════════════════════════════════════════ */
.tn-mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(4px);
    z-index: 1190;
    animation: tn-fade-in 0.2s ease;
}
.tn-mobile-panel {
    position: fixed;
    top: 0; left: 0; right: 0;
    bottom: 0;
    z-index: 1200;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 20px calc(20px + env(safe-area-inset-bottom, 0px));
    animation: tn-slide-down 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.tn-mobile-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0 12px;
}
.tn-mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.tn-mobile-nav__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--tn-gray-600);
    text-decoration: none;
    border-radius: var(--tn-radius-lg);
    transition: all var(--tn-transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}
.tn-mobile-nav__item i { font-size: 1.15rem; flex-shrink: 0; }
.tn-mobile-nav__item:hover {
    background: var(--tn-gray-100);
    color: var(--tn-gray-800);
}
.tn-mobile-nav__sep {
    height: 1px;
    background: var(--tn-gray-200);
    margin: 8px 0;
}
.tn-mobile-nav__label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--tn-gray-400);
    padding: 4px 16px 8px;
}
.tn-mobile-profile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--tn-radius-lg);
    border: 1px solid var(--tn-gray-200);
    background: transparent;
    cursor: pointer;
    transition: all var(--tn-transition);
    width: 100%;
    text-align: left;
}
.tn-mobile-profile:hover { background: var(--tn-gray-50); }
.tn-mobile-profile__info { display: flex; flex-direction: column; min-width: 0; }
.tn-mobile-profile__name {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--tn-gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tn-mobile-profile__plan {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--tn-gray-400);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tn-btn-login--full,
.tn-btn-register--full {
    width: 100%;
    height: 48px;
    justify-content: center;
}

@media (max-width: 991.98px) {
    .tn-nav__inner {
        grid-template-columns: auto minmax(180px, 1fr) auto;
        grid-template-rows: 56px 40px;
        column-gap: 16px;
        padding-inline: 18px;
    }

    .tn-nav__brand { margin-right: 0; }
    .tn-nav__links { gap: 2px; }
    .tn-pill { gap: 5px; padding-inline: 10px; font-size: .75rem; }
    .tn-nav__actions { gap: 4px; }
    .tn-btn-login { padding-inline: 12px; }
    .tn-btn-register { padding-inline: 13px; }
    .tn-avatar-name { max-width: 88px; }
}

@media (max-width: 767.98px) {
    .tn-nav { --tn-nav-h: 66px; }
    .tn-nav__inner {
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-rows: 1fr;
        gap: 9px;
        padding: 4px 12px;
    }

    /* A localização fica disponível nos filtros da Home; no cabeçalho móvel
       ela não pode ocupar uma quarta coluna e comprimir a busca. */
    .tn-nav .tn-home-location { display: none; }
    .tn-nav .tn-nav__brand { min-width: 0; }
    .tn-nav .tn-nav__logo-img { max-width: 104px; }
    .tn-nav .tn-home-search { grid-column: 2; min-width: 0; width: 100%; }

    .tn-nav__logo-img { height: 36px; }
    .tn-nav__links, .tn-nav__actions { display: none; }
    main.flex-grow-1:not(.auth-layout-content) { margin-top: var(--tn-nav-h, 66px) !important; }
    .tn-nav .tn-home-search .anuncios-search__bar { min-height: 42px; gap: .35rem; padding-left: .65rem; }
    .tn-nav .tn-home-search .anuncios-search__go { min-height: 32px; padding-inline: .55rem; font-size: .68rem; }
}

/* Mobile: Catálogo, Anúncios e perfil público usam a mesma composição da Home.
   Sem uma coluna reservada, o logo era comprimido quando a busca ocupava a linha. */
@media (max-width: 767.98px) {
    .layout-root:has(.cat-page) .tn-nav__inner,
    .layout-root:has(.anuncios-page) .tn-nav__inner,
    .layout-root:has(.pp-container) .tn-nav__inner {
        grid-template-columns: 96px minmax(0, 1fr);
        grid-template-rows: 66px;
        column-gap: 8px;
        row-gap: 0;
        padding-inline: 12px;
    }

    .layout-root:has(.cat-page) .tn-nav__brand,
    .layout-root:has(.anuncios-page) .tn-nav__brand,
    .layout-root:has(.pp-container) .tn-nav__brand {
        grid-column: 1;
        grid-row: 1;
        width: 96px;
        min-width: 0;
    }

    .layout-root:has(.cat-page) .tn-nav .tn-nav__logo-img,
    .layout-root:has(.anuncios-page) .tn-nav .tn-nav__logo-img,
    .layout-root:has(.pp-container) .tn-nav .tn-nav__logo-img {
        display: block;
        width: 96px;
        max-width: 96px;
        height: auto;
    }

    .layout-root:has(.cat-page) .tn-home-search,
    .layout-root:has(.anuncios-page) .tn-home-search,
    .layout-root:has(.pp-container) .tn-home-search {
        grid-column: 2;
        grid-row: 1;
        position: absolute !important;
        top: 5px !important;
        left: 116px !important;
        right: 12px !important;
        width: auto !important;
        min-width: 0;
        transform: none !important;
    }
}

@media (max-width: 360px) {
    .layout-root:has(.cat-page) .tn-nav__inner,
    .layout-root:has(.anuncios-page) .tn-nav__inner,
    .layout-root:has(.pp-container) .tn-nav__inner {
        grid-template-columns: 82px minmax(0, 1fr);
        column-gap: 6px;
        padding-inline: 8px;
    }

    .layout-root:has(.cat-page) .tn-nav__brand,
    .layout-root:has(.anuncios-page) .tn-nav__brand,
    .layout-root:has(.pp-container) .tn-nav__brand,
    .layout-root:has(.cat-page) .tn-nav .tn-nav__logo-img,
    .layout-root:has(.anuncios-page) .tn-nav .tn-nav__logo-img,
    .layout-root:has(.pp-container) .tn-nav .tn-nav__logo-img {
        width: 82px;
        max-width: 82px;
    }

    .layout-root:has(.cat-page) .tn-home-search,
    .layout-root:has(.anuncios-page) .tn-home-search,
    .layout-root:has(.pp-container) .tn-home-search {
        left: 96px !important;
        right: 8px !important;
    }
}

@keyframes tn-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes tn-slide-down {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════════ */
[data-theme="dark"] .tn-nav {
    background: rgba(18,18,18,0.88);
    border-bottom-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .tn-nav.scrolled {
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
[data-theme="dark"] .tn-nav__logo-img { filter: brightness(1.1); }
[data-theme="dark"] .tn-pill { color: var(--tn-gray-400); }
[data-theme="dark"] .tn-pill:hover { background: rgba(255,255,255,0.08); color: var(--tn-gray-200); }
[data-theme="dark"] .tn-pill.active { background: rgba(59,130,246,0.15); color: #60a5fa; }
[data-theme="dark"] .tn-pill.active i { color: #60a5fa; }
[data-theme="dark"] .tn-pill.active::after { background: #60a5fa; }
[data-theme="dark"] .tn-pill--sos:hover { background: rgba(239,68,68,0.12); color: #f87171; }
[data-theme="dark"] .tn-pill--sos.active { background: rgba(239,68,68,0.12); color: #f87171; }
[data-theme="dark"] .tn-pill--sos.active::after { background: #f87171; }
[data-theme="dark"] .tn-pill--plan:hover { background: rgba(59,130,246,0.12); color: #60a5fa; }
[data-theme="dark"] .tn-pill--plan.active { background: rgba(59,130,246,0.12); color: #60a5fa; }
[data-theme="dark"] .tn-pill-sep { background: rgba(255,255,255,0.08); }
[data-theme="dark"] .tn-action-btn { color: var(--tn-gray-500); }
[data-theme="dark"] .tn-action-btn:hover { background: rgba(255,255,255,0.08); color: var(--tn-gray-300); }
[data-theme="dark"] .tn-notification-badge { box-shadow: 0 0 0 2px rgba(18,18,18,0.96), 0 8px 18px rgba(0,122,255,0.28); }
[data-theme="dark"] .tn-action-btn--danger { color: #f87171; }
[data-theme="dark"] .tn-action-btn--danger:hover { background: rgba(239,68,68,0.12); color: #f87171; }
[data-theme="dark"] .tn-divider { background: rgba(255,255,255,0.08); }
[data-theme="dark"] .tn-avatar-btn { border-color: transparent; }
[data-theme="dark"] .tn-avatar-btn:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .tn-avatar-name { color: var(--tn-gray-200); }
[data-theme="dark"] .tn-avatar-plan { color: var(--tn-gray-500); }
[data-theme="dark"] .tn-avatar-arrow { color: var(--tn-gray-600); }
[data-theme="dark"] .tn-btn-login { color: var(--tn-gray-400); border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .tn-btn-login:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.15); color: var(--tn-gray-200); }
[data-theme="dark"] .tn-btn-register { background: var(--tn-blue); box-shadow: 0 1px 4px rgba(59,130,246,0.2); }
[data-theme="dark"] .tn-menu-btn { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); color: var(--tn-gray-400); }
[data-theme="dark"] .tn-menu-btn:hover { background: rgba(var(--color-primary-rgb, 0, 122, 255), 0.14); color: #60a5fa; }
[data-theme="dark"] .tn-dropdown { background: rgba(18,18,18,0.95); border-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .tn-dropdown__item { color: var(--tn-gray-400); }
[data-theme="dark"] .tn-dropdown__item:hover { background: rgba(255,255,255,0.06); color: var(--tn-gray-200); }
[data-theme="dark"] .tn-dropdown__sep { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .tn-notifications-panel { background: rgba(18,18,18,0.96); border-color: rgba(255,255,255,0.08); box-shadow: 0 24px 70px rgba(0,0,0,0.38); }
[data-theme="dark"] .tn-notifications-header { border-bottom-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .tn-notifications-header strong,
[data-theme="dark"] .tn-notification-body strong,
[data-theme="dark"] .tn-notifications-empty strong { color: var(--tn-gray-200); }
[data-theme="dark"] .tn-notifications-header span,
[data-theme="dark"] .tn-notification-body span,
[data-theme="dark"] .tn-notification-body small,
[data-theme="dark"] .tn-notifications-empty span { color: var(--tn-gray-500); }
[data-theme="dark"] .tn-notification-item:hover { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .tn-notification-item.unread { background: rgba(59,130,246,0.12); }
[data-theme="dark"] .tn-notification-item.unread:hover { background: rgba(59,130,246,0.16); }
[data-theme="dark"] .tn-notifications-footer { border-top-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .tn-mobile-overlay { background: rgba(0,0,0,0.55); }
[data-theme="dark"] .tn-mobile-panel { background: rgba(18,18,18,0.96); }
[data-theme="dark"] .tn-mobile-nav__item { color: var(--tn-gray-400); }
[data-theme="dark"] .tn-mobile-nav__item:hover { background: rgba(255,255,255,0.06); color: var(--tn-gray-200); }
[data-theme="dark"] .tn-mobile-nav__sep { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .tn-mobile-nav__label { color: var(--tn-gray-600); }
[data-theme="dark"] .tn-mobile-profile { border-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .tn-mobile-profile:hover { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .tn-mobile-profile__name { color: var(--tn-gray-200); }
[data-theme="dark"] .tn-mobile-profile__plan { color: var(--tn-gray-500); }

/* Home pública: cabeçalho mais compacto, sem o excesso de respiro entre as linhas. */
@supports selector(.layout-root:has(main.home-layout-content)) {
    .layout-root:has(main.home-layout-content) .tn-nav {
        --tn-nav-h: 104px;
        height: var(--tn-nav-h);
        background: transparent;
        border-bottom: 0;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .layout-root:has(main.home-layout-content) .tn-nav__inner {
        position: relative;
        grid-template-columns: auto minmax(260px, 1fr) auto;
        grid-template-rows: 52px 34px;
        column-gap: 12px;
        row-gap: 1px;
        padding-top: 5px;
        padding-bottom: 5px;
    }
    .layout-root:has(main.home-layout-content) .tn-nav__inner::before {
        display: none;
    }
    .layout-root:has(main.home-layout-content) .tn-nav__inner > * {
        position: relative;
        z-index: 1;
    }
    .layout-root:has(main.home-layout-content) .tn-nav__brand { grid-column: 1; grid-row: 1; }
    .layout-root:has(main.home-layout-content) .tn-nav__logo-img { height: 48px; width: auto; }
    .layout-root:has(main.home-layout-content) .tn-home-location {
        grid-column: 2;
        grid-row: 1;
        justify-self: start;
        display: inline-flex;
        align-items: center;
        gap: .32rem;
        height: 34px;
        max-width: 270px;
        padding: 0 .65rem;
        border: 1px solid rgba(148,163,184,.2);
        border-radius: 12px;
        color: #0878ee;
        background: rgba(255,255,255,.38);
        box-shadow: inset 0 1px 0 rgba(255,255,255,.72);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
    .layout-root:has(main.home-layout-content) .tn-home-location > i { flex: 0 0 auto; font-size: .78rem; }
    .layout-root:has(main.home-layout-content) .tn-home-location select {
        min-width: 0;
        max-width: 100px;
        padding: 0;
        border: 0;
        outline: 0;
        color: #536174;
        background: transparent;
        font: 700 .68rem var(--font-body);
        cursor: pointer;
    }
    .layout-root:has(main.home-layout-content) .tn-home-location select:first-of-type { max-width: 130px; }
    .layout-root:has(main.home-layout-content) .tn-home-location__divider { width: 1px; height: 17px; background: rgba(148,163,184,.28); }
    .layout-root:has(main.home-layout-content) .tn-home-search { grid-column: 2; grid-row: 1; }
    .layout-root:has(main.home-layout-content) .tn-nav .tn-home-search .anuncios-search__bar { min-height: 42px; }
    .layout-root:has(main.home-layout-content) .tn-nav .tn-home-search .anuncios-search__bar {
        border: 1px solid rgba(148,163,184,.22);
        background: rgba(255,255,255,.72);
        box-shadow: 0 7px 20px rgba(28,48,74,.06), inset 0 1px 0 rgba(255,255,255,.8);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
    .layout-root:has(main.home-layout-content) .tn-home-search .anuncios-search__go {
        background: #0878ee;
        box-shadow: 0 7px 16px rgba(8,120,238,.2);
    }
    .layout-root:has(main.home-layout-content) .tn-home-search .anuncios-search__go:hover { background: #006ce0; }
    .layout-root:has(main.home-layout-content) .tn-nav__links {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: center;
        gap: 2px;
    }
    .layout-root:has(main.home-layout-content) .tn-pill {
        height: 34px;
        padding-inline: 9px;
        border: 1px solid transparent;
        color: #667386;
        font-size: .78rem;
    }
    .layout-root:has(main.home-layout-content) .tn-pill:hover {
        border-color: rgba(8,120,238,.14);
        background: rgba(255,255,255,.62);
        color: #0878ee;
        box-shadow: 0 5px 14px rgba(28,48,74,.05);
    }
    .layout-root:has(main.home-layout-content) .tn-pill.active,
    .layout-root:has(main.home-layout-content) .tn-pill.active:hover {
        border-color: rgba(8,120,238,.16);
        background: rgba(8,120,238,.1);
        color: #0878ee;
        box-shadow: 0 5px 16px rgba(8,120,238,.08);
    }
    .layout-root:has(main.home-layout-content) .tn-pill.active::after { bottom: -2px; background: #0878ee; }
    .layout-root:has(main.home-layout-content) .tn-nav__actions { grid-column: 3; grid-row: 1; gap: 4px; }
    .layout-root:has(main.home-layout-content) .tn-btn-login,
    .layout-root:has(main.home-layout-content) .tn-btn-register { height: 34px; }

    /* Busca da Home: campo de vidro atual, integrado ao fundo e sem o estilo legado. */
    .layout-root:has(main.home-layout-content) .tn-home-search {
        position: fixed;
        top: 5px;
        left: 50vw;
        z-index: 2;
        width: min(680px, calc(100vw - 420px));
        transform: translateX(-50%);
    }
    .layout-root:has(main.home-layout-content) .tn-home-search .anuncios-search__bar {
        min-height: 46px;
        padding: .3rem .35rem .3rem .95rem;
        gap: .65rem;
        border: 1px solid rgba(148,163,184,.28);
        border-radius: 15px;
        background: rgba(255,255,255,.42);
        box-shadow: inset 0 1px 0 rgba(255,255,255,.78), 0 8px 20px rgba(28,48,74,.06);
        backdrop-filter: blur(16px) saturate(1.1);
        -webkit-backdrop-filter: blur(16px) saturate(1.1);
    }
    .layout-root:has(main.home-layout-content) .tn-home-search .anuncios-search__bar:focus-within {
        border-color: rgba(8,120,238,.5);
        background: rgba(255,255,255,.68);
        box-shadow: 0 0 0 3px rgba(8,120,238,.1), inset 0 1px 0 rgba(255,255,255,.9), 0 10px 24px rgba(28,48,74,.08);
    }
    .layout-root:has(main.home-layout-content) .tn-home-search .anuncios-search__icon {
        color: #536174;
        font-size: 1.05rem;
    }
    .layout-root:has(main.home-layout-content) .tn-home-search .anuncios-search__input {
        color: #172033;
        font-size: .84rem;
    }
    .layout-root:has(main.home-layout-content) .tn-home-search .anuncios-search__input::placeholder { color: #687689; opacity: 1; }
    .layout-root:has(main.home-layout-content) .tn-home-search .anuncios-search__go {
        min-height: 36px;
        padding: 0 1rem;
        border-radius: 11px;
        color: #fff;
        background: #0878ee;
        font-size: .75rem;
        box-shadow: 0 7px 16px rgba(8,120,238,.2);
    }
    .layout-root:has(main.home-layout-content) .tn-home-search .anuncios-search__go:hover { background: #006ce0; transform: translateY(-1px); }
    .layout-root:has(main.home-layout-content) .tn-home-search .anuncios-search__go:disabled { background: #8ebaf3; opacity: 1; box-shadow: none; }
}

/* Catálogo: mantém o menu leve sobre o fundo, em duas linhas e sem faixa opaca. */
@supports selector(.layout-root:has(.cat-page)) {
    .layout-root:has(.cat-page) .tn-nav {
        --tn-nav-h: 104px;
        height: var(--tn-nav-h);
        background: transparent;
        border-bottom: 0;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .layout-root:has(.cat-page) .tn-nav__inner {
        grid-template-columns: auto minmax(320px, 680px) auto;
        grid-template-rows: 52px 34px;
        column-gap: 16px;
        row-gap: 1px;
        padding-top: 5px;
        padding-bottom: 5px;
    }
    .layout-root:has(.cat-page) .tn-nav__inner::before { display: none; }
    .layout-root:has(.cat-page) .tn-nav__inner > * { position: relative; z-index: 1; }
    .layout-root:has(.cat-page) .tn-nav__brand { grid-column: 1; grid-row: 1; }
    .layout-root:has(.cat-page) .tn-nav__logo-img { height: 48px; width: auto; }
    .layout-root:has(.cat-page) .tn-home-search {
        grid-column: 2;
        grid-row: 1;
        justify-self: center;
        width: 100%;
        max-width: 680px;
    }
    .layout-root:has(.cat-page) .tn-nav__actions { grid-column: 3; grid-row: 1; }
    .layout-root:has(.cat-page) .tn-nav__links {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: center;
    }
    .layout-root:has(.cat-page) .tn-nav .tn-home-search .anuncios-search__bar {
        min-height: 42px;
        border: 1px solid rgba(148,163,184,.25);
        border-radius: 18px;
        background: rgba(255,255,255,.64);
        box-shadow: 0 10px 26px rgba(32,63,105,.08);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
    }
    .layout-root:has(.cat-page) .tn-pill:hover { background: rgba(8,120,238,.08); }
}

/* Anúncios: utiliza o mesmo cabeçalho transparente e compacto do Catálogo. */
@supports selector(.layout-root:has(.anuncios-page)) {
    .layout-root:has(.anuncios-page) .tn-nav {
        --tn-nav-h: 104px;
        height: var(--tn-nav-h);
        background: transparent;
        border-bottom: 0;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .layout-root:has(.anuncios-page) .tn-nav__inner {
        grid-template-columns: auto minmax(320px, 680px) auto;
        grid-template-rows: 52px 34px;
        column-gap: 16px;
        row-gap: 1px;
        padding-top: 5px;
        padding-bottom: 5px;
    }
    .layout-root:has(.anuncios-page) .tn-nav__inner::before { display: none; }
    .layout-root:has(.anuncios-page) .tn-nav__inner > * { position: relative; z-index: 1; }
    .layout-root:has(.anuncios-page) .tn-nav__brand { grid-column: 1; grid-row: 1; }
    .layout-root:has(.anuncios-page) .tn-nav__logo-img { height: 48px; width: auto; }
    .layout-root:has(.anuncios-page) .tn-home-search {
        grid-column: 2;
        grid-row: 1;
        justify-self: center;
        width: 100%;
        max-width: 680px;
    }
    .layout-root:has(.anuncios-page) .tn-nav__actions { grid-column: 3; grid-row: 1; }
    .layout-root:has(.anuncios-page) .tn-nav__links {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: center;
    }
    .layout-root:has(.anuncios-page) .tn-nav .tn-home-search .anuncios-search__bar {
        min-height: 46px !important;
        padding: .3rem .35rem .3rem .95rem !important;
        gap: .65rem !important;
        border: 1px solid rgba(148,163,184,.25);
        border-radius: 15px !important;
        background: rgba(255,255,255,.64);
        box-shadow: 0 10px 26px rgba(32,63,105,.08);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
    }
    .layout-root:has(.anuncios-page) .tn-pill:hover { background: rgba(8,120,238,.08); }
}

/* A busca de Anúncios deve ser a mesma busca canônica da Home. */
@media (min-width: 901px) {
    .layout-root:has(.anuncios-page) .tn-home-search {
        position: fixed !important;
        top: 5px !important;
        left: 50vw !important;
        width: min(560px, calc(100vw - 520px)) !important;
        transform: translateX(-50%) !important;
        z-index: 2 !important;
    }
    .layout-root:has(.anuncios-page) .tn-home-search .anuncios-search__bar {
        min-height: 46px !important;
        padding: .3rem .35rem .3rem .95rem !important;
        gap: .65rem !important;
        border: 1px solid rgba(148,163,184,.28) !important;
        border-radius: 15px !important;
        background: rgba(255,255,255,.86) !important;
        box-shadow: inset 0 1px 0 rgba(255,255,255,.78), 0 8px 20px rgba(28,48,74,.06) !important;
        backdrop-filter: blur(16px) saturate(1.1) !important;
        -webkit-backdrop-filter: blur(16px) saturate(1.1) !important;
    }
    .layout-root:has(.anuncios-page) .tn-home-search .anuncios-search__icon {
        color: #536174 !important;
        font-size: 1.05rem !important;
    }
    .layout-root:has(.anuncios-page) .tn-home-search .anuncios-search__input {
        color: #172033 !important;
        font-size: .84rem !important;
        font-family: var(--font-body) !important;
    }
    .layout-root:has(.anuncios-page) .tn-home-search .anuncios-search__input::placeholder {
        color: #687689 !important;
        opacity: 1 !important;
    }
    .layout-root:has(.anuncios-page) .tn-home-search .anuncios-search__go {
        min-height: 36px !important;
        padding: 0 1rem !important;
        border-radius: 11px !important;
        color: #fff !important;
        background: #0878ee !important;
        font-size: .75rem !important;
        box-shadow: 0 7px 16px rgba(8,120,238,.2) !important;
    }
}

@media (min-width: 901px) {
    .layout-root:has(.cat-page) .tn-home-search {
        position: fixed !important;
        top: 5px !important;
        left: 50vw !important;
        width: min(560px, calc(100vw - 520px)) !important;
        transform: translateX(-50%) !important;
        z-index: 2 !important;
    }
    .layout-root:has(main.home-layout-content) .tn-home-search .anuncios-search__input::placeholder,
    .layout-root:has(.cat-page) .tn-home-search .anuncios-search__input::placeholder,
    .layout-root:has(.anuncios-page) .tn-home-search .anuncios-search__input::placeholder {
        font-family: var(--font-body) !important;
        font-size: .84rem !important;
        font-weight: 400 !important;
        line-height: 1.2 !important;
        letter-spacing: normal !important;
    }
    .layout-root:has(main.home-layout-content) .tn-home-search .anuncios-search__input,
    .layout-root:has(.cat-page) .tn-home-search .anuncios-search__input,
    .layout-root:has(.anuncios-page) .tn-home-search .anuncios-search__input {
        font-family: var(--font-body) !important;
        font-size: .84rem !important;
        font-weight: 400 !important;
        line-height: 1.2 !important;
        letter-spacing: normal !important;
    }
    .layout-root:has(main.home-layout-content) .tn-home-location { width: 238px !important; }
    .layout-root:has(main.home-layout-content) .tn-home-location select,
    .layout-root:has(main.home-layout-content) .tn-home-location select:first-of-type {
        flex: 1 1 auto !important;
        width: auto !important;
        max-width: none !important;
        font-size: .72rem;
    }
}

@media (min-width: 901px) {
    .layout-root:has(main.home-layout-content) .tn-nav__inner { grid-template-columns: auto auto minmax(320px, 1fr) auto; }
    .layout-root:has(main.home-layout-content) .tn-home-location { grid-column: 2; grid-row: 1; width: 250px; }
    .layout-root:has(main.home-layout-content) .tn-home-search { position: relative; top: auto; left: auto; grid-column: 3; grid-row: 1; justify-self: center; width: min(100%, 680px); transform: none; }
    .layout-root:has(main.home-layout-content) .tn-nav__actions { grid-column: 4; grid-row: 1; }
    .layout-root:has(main.home-layout-content) .tn-home-location select { appearance: none; -webkit-appearance: none; }
    .layout-root:has(main.home-layout-content) .tn-home-search {
        position: fixed;
        top: 5px;
        left: 50vw;
        width: min(560px, calc(100vw - 520px));
        transform: translateX(-50%);
    }
    .layout-root:has(main.home-layout-content) .tn-home-location {
        width: 210px !important;
        gap: .2rem;
        padding-inline: .48rem;
    }
    .layout-root:has(main.home-layout-content) .tn-home-location select,
    .layout-root:has(main.home-layout-content) .tn-home-location__state {
        font-size: .62rem;
    }
    .layout-root:has(main.home-layout-content) .tn-home-location select {
        flex: 0 0 124px !important;
        width: 124px !important;
        max-width: 124px !important;
    }
    .layout-root:has(main.home-layout-content) .tn-home-location {
        position: relative;
        width: 210px !important;
        justify-content: flex-start;
        gap: .42rem;
    }
    .layout-root:has(main.home-layout-content) .tn-home-location__label {
        min-width: 0;
        overflow: hidden;
        color: #536174;
        font: 800 .68rem var(--font-body);
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .layout-root:has(main.home-layout-content) .tn-home-location__chevron { margin-left: auto; }
    .layout-root:has(main.home-layout-content) .tn-home-location__select {
        position: absolute;
        inset: 0;
        z-index: 3;
        width: 100% !important;
        max-width: none !important;
        height: 100%;
        opacity: 0;
        cursor: pointer;
    }
    .layout-root:has(main.home-layout-content) .tn-home-location__label { max-width: 132px; }
    .layout-root:has(main.home-layout-content) .tn-home-location__divider {
        width: 1px;
        height: 17px;
        flex: 0 0 1px;
        background: rgba(148,163,184,.3);
    }
    .layout-root:has(main.home-layout-content) .tn-home-location__state {
        flex: 0 0 auto;
        color: #536174;
        font: 800 .68rem var(--font-body);
    }
    .layout-root:has(main.home-layout-content) .tn-home-location__select--city {
        right: 45px;
        width: calc(100% - 45px) !important;
    }
    .layout-root:has(main.home-layout-content) .tn-home-location__select--state {
        right: 0;
        left: auto;
        width: 58px !important;
    }
    .layout-root:has(main.home-layout-content) .tn-home-location {
        width: 238px !important;
        height: 36px;
        padding: 0;
        gap: 8px;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .layout-root:has(main.home-layout-content) .tn-home-location__field {
        position: relative;
        display: inline-flex;
        align-items: center;
        gap: .38rem;
        height: 36px;
        padding: 0 .62rem;
        border: 1px solid rgba(148,163,184,.24);
        border-radius: 12px;
        background: rgba(255,255,255,.46);
        box-shadow: inset 0 1px 0 rgba(255,255,255,.78), 0 6px 16px rgba(28,48,74,.04);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
    .layout-root:has(main.home-layout-content) .tn-home-location__field--city { width: 145px; }
    .layout-root:has(main.home-layout-content) .tn-home-location__field--state { width: 45px; justify-content: center; }
    .layout-root:has(main.home-layout-content) .tn-home-location__field .tn-home-location__select { inset: 0; width: 100% !important; max-width: none !important; }
    .layout-root:has(main.home-layout-content) .tn-home-location__field--city .tn-home-location__label { max-width: 98px; }
    .layout-root:has(main.home-layout-content) .tn-home-location__field--state .tn-home-location__chevron { margin-left: 0; }
}

@media (max-width: 900px) {
    .layout-root:has(main.home-layout-content) .tn-nav { --tn-nav-h: 66px; height: 66px; }
    .layout-root:has(main.home-layout-content) .tn-home-search { top: 5px; width: calc(100vw - 112px); }
}

@media (max-width: 767.98px) {
    .layout-root:has(main.home-layout-content) .tn-nav__inner { grid-template-columns: 96px minmax(0, 1fr); grid-template-rows: 66px; column-gap: 8px; padding-inline: 12px; }
    .layout-root:has(main.home-layout-content) .tn-nav__brand { grid-column: 1; grid-row: 1; width: 96px; min-width: 0; }
    .layout-root:has(main.home-layout-content) .tn-nav .tn-nav__logo-img { display: block; width: 96px; max-width: 96px; height: auto; }
    .layout-root:has(main.home-layout-content) .tn-home-search { position: absolute !important; top: 5px !important; left: 116px !important; right: 12px !important; width: auto !important; min-width: 0; transform: none !important; }
    .layout-root:has(main.home-layout-content) .tn-home-location { display: none; }
}
@media (max-width: 360px) {
    .layout-root:has(main.home-layout-content) .tn-nav__inner { grid-template-columns: 82px minmax(0, 1fr); column-gap: 6px; padding-inline: 8px; }
    .layout-root:has(main.home-layout-content) .tn-nav__brand,
    .layout-root:has(main.home-layout-content) .tn-nav .tn-nav__logo-img { width: 82px; max-width: 82px; }
    .layout-root:has(main.home-layout-content) .tn-home-search { left: 96px !important; right: 8px !important; }
}
