/* App shell top bar (AppTopBar.razor) — global; the component renders in its own interactive root. */
.tp-topbar-slot {
    position: sticky;
    top: 0;
    z-index: 150;
    min-height: 4.25rem;
    background: #fff;
    border-bottom: 1px solid #e6edf5;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.tp-topbar {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-height: 4.25rem;
    padding: 0.6rem 2.25rem 0.6rem 2.75rem;
    color: #0f172a;
}

.tp-topbar__title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.tp-topbar__spacer {
    flex: 1 1 auto;
}

.tp-topbar__actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-left: auto;
}

.tp-topbar__icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    border: 1px solid #e6edf5;
    border-radius: 12px;
    background: #fff;
    color: #334155;
    font-size: 1.1rem;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tp-topbar__icon-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.tp-topbar__menu {
    font-size: 1.35rem;
}

.tp-topbar__add {
    border-color: #2979ff;
    background: #2979ff;
    color: #fff;
    box-shadow: 0 6px 14px rgba(41, 121, 255, 0.28);
}

.tp-topbar__add:hover {
    border-color: #1c64e0;
    background: #1c64e0;
    color: #fff;
}

.tp-topbar__chat {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #15803d;
}

.tp-topbar__chat:hover {
    background: #dcfce7;
    color: #166534;
}

.tp-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    border: 2px solid #fff;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tp-badge--green {
    background: #16a34a;
}

/* Search */
.tp-search {
    position: relative;
    flex: 1 1 26rem;
    max-width: 34rem;
    margin-left: 1rem;
}

.tp-search__icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    pointer-events: none;
    z-index: 2;
}

.tp-search__input {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 2.6rem;
    padding: 0 5.5rem 0 2.5rem;
    border: 1px solid #e6edf5;
    border-radius: 12px;
    background: #f8fafc;
    color: #0f172a;
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.tp-search__input::placeholder {
    color: #94a3b8;
}

.tp-search__input:focus {
    background: #fff;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.tp-search__input::-webkit-search-cancel-button {
    cursor: pointer;
}

.tp-search__kbd {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    padding: 0.15rem 0.45rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    color: #64748b;
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    pointer-events: none;
}

.tp-search.is-open .tp-search__input {
    z-index: 160;
}

.tp-search.is-open .tp-search__icon,
.tp-search.is-open .tp-search__kbd {
    z-index: 161;
}

.tp-search__results {
    left: 0;
    right: 0;
    max-height: 26rem;
    overflow-y: auto;
}

/* Popovers */
.tp-menu {
    position: relative;
}

.tp-backdrop {
    position: fixed;
    inset: 0;
    z-index: 155;
    background: transparent;
}

.tp-pop {
    position: absolute;
    top: calc(100% + 8px);
    z-index: 170;
    min-width: 16rem;
    padding: 0.4rem;
    background: #fff;
    border: 1px solid #e6edf5;
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
}

.tp-pop--right {
    right: 0;
}

.tp-pop--narrow {
    min-width: 13rem;
}

.tp-pop__group {
    margin: 0.35rem 0.55rem 0.25rem;
    color: #94a3b8;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.tp-pop__empty {
    margin: 0;
    padding: 0.85rem;
    color: #64748b;
    font-size: 0.88rem;
}

.tp-pop__item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.5rem 0.55rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #0f172a;
    text-align: left;
    cursor: pointer;
}

.tp-pop__item:hover,
.tp-pop__item:focus-visible {
    background: #f1f5f9;
    outline: none;
}

.tp-pop__item-icon {
    flex: 0 0 auto;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef2ff;
    color: #4f46e5;
    font-size: 0.95rem;
}

.tp-pop__item-icon.is-lead {
    background: #dbeafe;
    color: #1d4ed8;
}

.tp-pop__item-icon.is-payment {
    background: #fef3c7;
    color: #b45309;
}

.tp-pop__item-icon.is-whatsapp {
    background: #dcfce7;
    color: #15803d;
}

.tp-pop__item-icon.is-quote {
    background: #ede9fe;
    color: #6d28d9;
}

.tp-pop__item-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

.tp-pop__item-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tp-pop__item-sub {
    font-size: 0.78rem;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Notifications */
.tp-notif {
    width: 24rem;
    padding: 0;
    overflow: hidden;
}

.tp-notif__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem 0.5rem;
    font-size: 0.95rem;
}

.tp-link-btn {
    border: none;
    background: none;
    padding: 0;
    color: #2563eb;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.tp-link-btn:hover {
    text-decoration: underline;
}

.tp-notif__filters {
    display: flex;
    gap: 0.35rem;
    padding: 0 1rem 0.65rem;
    border-bottom: 1px solid #f1f5f9;
}

.tp-chip {
    padding: 0.25rem 0.65rem;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #fff;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.tp-chip:hover {
    background: #f8fafc;
}

.tp-chip.is-active {
    border-color: #1e3a5f;
    background: #1e3a5f;
    color: #fff;
}

.tp-notif__list {
    max-height: 26rem;
    overflow-y: auto;
    padding: 0.35rem;
}

.tp-notif__item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.6rem 0.65rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.tp-notif__item:hover {
    background: #f8fafc;
}

.tp-notif__item.is-unread {
    background: #eff6ff;
}

.tp-notif__item.is-unread::before {
    content: "";
    position: absolute;
    left: 0.2rem;
    top: 50%;
    width: 6px;
    height: 6px;
    margin-top: -3px;
    border-radius: 50%;
    background: #2563eb;
}

.tp-notif__time {
    flex: 0 0 auto;
    align-self: flex-start;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.tp-notif__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 2rem 1rem;
    color: #94a3b8;
}

.tp-notif__empty i {
    font-size: 1.6rem;
}

.tp-notif__empty p {
    margin: 0;
    font-size: 0.88rem;
}

/* User */
.tp-user {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    height: 2.6rem;
    padding: 0 0.6rem 0 0.25rem;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
}

.tp-user:hover {
    background: #f1f5f9;
}

.tp-user__avatar {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2979ff, #1c64e0);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 800;
}

.tp-user__text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
}

.tp-user__name {
    font-size: 0.86rem;
    font-weight: 800;
    color: #0f172a;
}

.tp-user__role {
    font-size: 0.72rem;
    color: #64748b;
}

.tp-user-card {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.55rem 0.6rem 0.65rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.85rem;
}

.tp-user-card span {
    color: #64748b;
    font-size: 0.78rem;
    word-break: break-all;
}

.tp-logout {
    margin: 0;
}

/* Toasts */
.tp-toasts {
    position: fixed;
    top: 4.75rem;
    right: 1.25rem;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: min(22rem, calc(100vw - 2rem));
}

.tp-toast {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 0.6rem 0.7rem 0.75rem;
    background: #fff;
    border: 1px solid #e6edf5;
    border-left: 4px solid #2563eb;
    border-radius: 12px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.16);
    animation: tp-toast-in 0.25s ease-out;
}

.tp-toast__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
}

.tp-toast__close {
    flex: 0 0 auto;
    width: 1.6rem;
    height: 1.6rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    font-size: 0.75rem;
    cursor: pointer;
}

.tp-toast__close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

@keyframes tp-toast-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* The top bar owns the menu toggle on desktop. */
@media (min-width: 641px) {
    .tm-nav__rail-btn {
        display: none !important;
    }
}

@media (max-width: 1100px) {
    .tp-user__text,
    .tp-search__kbd {
        display: none;
    }

    .tp-search__input {
        padding-right: 0.9rem;
    }
}

@media (max-width: 640.98px) {
    .tp-topbar {
        flex-wrap: wrap;
        padding: 0.6rem 1rem;
    }

    .tp-topbar__menu {
        display: none;
    }

    .tp-search {
        order: 3;
        flex: 1 1 100%;
        max-width: none;
        margin-left: 0;
    }

    .tp-notif {
        width: calc(100vw - 2rem);
        right: -6rem;
    }
}
