:root {
    --bt-orange: #f25e18;
    --bt-black: #101010;
    --bt-gray: #6e6e73;
    --bt-border: #e8e8ed;
    --bt-white: #ffffff;
    --bt-shadow-soft: 0 12px 36px rgba(0, 0, 0, 0.06);
}

.bt-topbar,
.bt-topbar * {
    box-sizing: border-box;
}

.bt-topbar {
    position: sticky;
    top: 12px;
    z-index: 100;
    width: min(1180px, calc(100% - 24px));
    margin: 18px auto;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(232, 232, 237, 0.9);
    border-radius: 999px;
    padding: 10px 12px 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.bt-topbar.has-back {
    padding-left: 10px;
}

.bt-header-back {
    width: 46px;
    height: 46px;
    border-radius: 999px;
    background: var(--bt-black);
    color: #fff;
    display: grid;
    place-items: center;
    text-decoration: none;
    flex: 0 0 auto;
}

.bt-header-back-symbol {
    display: block;
    color: #fff;
    font-size: 38px;
    line-height: 1;
    font-weight: 500;
    transform: translateY(-1px);
}

.bt-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    min-width: 0;
    margin-right: auto;
}

.bt-brand-logo {
    display: block;
    height: 30px;
    width: auto;
    max-width: 190px;
    object-fit: contain;
}

.bt-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Safe styling for the existing language partial, no matter the exact class names. */
.bt-top-actions .bt-lang-switch,
.bt-top-actions .language-switcher,
.bt-top-actions .lang-switcher,
.bt-top-actions [data-language-switcher] {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border-radius: 999px;
    background: #f5f5f7;
}

.bt-top-actions .bt-lang-switch a,
.bt-top-actions .language-switcher a,
.bt-top-actions .lang-switcher a,
.bt-top-actions [data-language-switcher] a {
    min-width: 39px;
    height: 39px;
    border-radius: 999px;
    color: #555;
    display: inline-grid;
    place-items: center;
    text-decoration: none;
    font-weight: 400;
    font-size: 13px;
}

.bt-top-actions .bt-lang-switch a.is-active,
.bt-top-actions .bt-lang-switch a.active,
.bt-top-actions .language-switcher a.is-active,
.bt-top-actions .language-switcher a.active,
.bt-top-actions .lang-switcher a.is-active,
.bt-top-actions .lang-switcher a.active,
.bt-top-actions [data-language-switcher] a.is-active,
.bt-top-actions [data-language-switcher] a.active {
    background: var(--bt-black);
    color: #fff;
}

.bt-signin {
    text-decoration: none;
    background: var(--bt-black);
    color: #fff;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 900;
    white-space: nowrap;
}

.bt-user-menu {
    position: relative;
}

.bt-user-button {
    border: 0;
    background: var(--bt-black);
    color: #fff;
    border-radius: 999px;
    padding: 6px 12px 6px 6px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    cursor: pointer;
    font-weight: 760;
    letter-spacing: -0.15px;
}

.bt-user-avatar {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--bt-orange);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 15px;
    font-weight: 850;
}

.bt-user-avatar.has-unread {
    box-shadow: 0 0 0 3px rgba(255, 45, 45, 0.10);
}

.bt-user-alert-dot {
    position: absolute;
    right: -2px;
    top: -2px;
    width: 11px;
    height: 11px;
    border-radius: 999px;
    background: #ff2d2d;
    border: 2px solid #fff;
    box-shadow: 0 0 0 0 rgba(255, 45, 45, 0.55);
    animation: btPulseAlert 1.45s ease infinite;
}

.bt-user-button-text {
    white-space: nowrap;
    font-size: 15px;
    font-weight: 760;
}

.bt-user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 310px;
    background: #fff;
    border: 1px solid var(--bt-border);
    border-radius: 28px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.14);
    padding: 14px;
    display: none;
    z-index: 120;
}

.bt-user-menu.is-open .bt-user-dropdown {
    display: block;
}

.bt-user-dropdown-head {
    padding: 12px 12px 16px;
    border-bottom: 1px solid var(--bt-border);
    margin-bottom: 8px;
}

.bt-user-dropdown-head strong {
    display: block;
    font-size: 17px;
    line-height: 1.2;
    font-weight: 760;
    letter-spacing: -0.2px;
}

.bt-user-dropdown-head span {
    display: block;
    color: var(--bt-gray);
    font-size: 14px;
    margin-top: 6px;
    word-break: break-word;
}

.bt-user-dropdown-item {
    min-height: 52px;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px;
    border-radius: 18px;
    text-decoration: none;
    color: #111;
    font-size: 16px;
    font-weight: 720;
    letter-spacing: -0.12px;
}

.bt-user-dropdown-item:hover {
    background: #f5f5f7;
}

.bt-user-dropdown-item span {
    width: 26px;
    display: inline-grid;
    place-items: center;
    font-size: 18px;
    text-align: center;
}

.bt-user-dropdown-item i {
    font-size: 17px;
    color: #333;
}

.bt-user-dropdown-item:hover i {
    color: var(--bt-orange);
}

.bt-user-dropdown-item em {
    margin-left: auto;
    font-style: normal;
    font-size: 11px;
    padding: 5px 8px;
    border-radius: 999px;
    background: #f5f5f7;
    color: #6e6e73;
    font-weight: 760;
}

.bt-menu-badge {
    margin-left: auto;
    min-width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #ff2d2d;
    color: #fff;
    display: inline-grid;
    place-items: center;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    font-style: normal;
    padding: 0 7px;
}

.bt-user-logout-form {
    margin: 6px 0 0;
    padding-top: 6px;
    border-top: 1px solid var(--bt-border);
}

.bt-user-logout-button {
    width: 100%;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.bt-user-logout-button:hover {
    background: #fff1f0;
    color: #b42318;
}

.bt-user-logout-button:hover i {
    color: #b42318;
}

@keyframes btPulseAlert {
    0% { box-shadow: 0 0 0 0 rgba(255, 45, 45, 0.55); }
    70% { box-shadow: 0 0 0 8px rgba(255, 45, 45, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 45, 45, 0); }
}

@media (max-width: 860px) {
    .bt-topbar {
        width: calc(100% - 2px);
        top: 8px;
        margin: 8px auto 18px;
        border-radius: 24px;
        padding: 9px 10px 9px 14px;
    }

    .bt-topbar.has-back {
        padding-left: 8px;
    }

    .bt-header-back {
        width: 42px;
        height: 42px;
    }

    .bt-brand-logo {
        height: 24px;
        max-width: 142px;
    }

    .bt-top-actions {
        gap: 6px;
    }

    .bt-user-button {
        padding: 6px;
    }

    .bt-user-button-text {
        display: none;
    }

    .bt-user-dropdown {
        right: -4px;
        width: min(315px, calc(100vw - 28px));
    }
}

@media (max-width: 390px) {
    .bt-top-actions .bt-lang-switch a,
    .bt-top-actions .language-switcher a,
    .bt-top-actions .lang-switcher a,
    .bt-top-actions [data-language-switcher] a {
        min-width: 34px;
        height: 34px;
        font-size: 12px;
    }

    .bt-brand-logo {
        max-width: 124px;
    }
}

/* v16: keep the avatar dropdown above search/filter panels */
.bt-topbar {
    z-index: 7000;
}

.bt-user-dropdown {
    z-index: 8000;
}

.bt-user-menu.is-open .bt-user-dropdown {
    display: block !important;
}


/* ByTowns custom file upload control */
.bt-file-native-input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
.bt-file-upload {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    background: #fff;
    padding: 8px;
    min-height: 56px;
}
.bt-file-upload-button {
    border: 0;
    border-radius: 14px;
    background: #11131d;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px;
    font: inherit;
    font-weight: 950;
    cursor: pointer;
    white-space: nowrap;
}
.bt-file-upload-button[data-has-file="1"] { background: #f25e18; }
.bt-file-upload-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #5f6675;
    font-weight: 820;
    font-size: 14px;
}
@media (max-width: 520px) {
    .bt-file-upload { display: grid; gap: 8px; }
    .bt-file-upload-button { justify-content: center; width: 100%; }
    .bt-file-upload-name { text-align: center; }
}


/* v21: universal public auth bottom sheet
   Kept in app-header.css because the app header includes the login sheet on
   every public/owner screen. Without these base rules, the sheet can render
   inline on pages that do not load public-home.css. */
.bt-sheet-open {
    overflow: hidden;
}

.bt-auth-sheet {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
}

.bt-auth-sheet.is-open {
    display: block;
}

.bt-auth-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.bt-auth-panel,
.bt-profile-panel {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    width: min(480px, calc(100% - 24px));
    background: #fff;
    border-radius: 30px;
    padding: 26px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(232, 232, 237, 0.95);
    animation: btAuthUp 0.24s ease both;
}

.bt-profile-panel {
    width: min(520px, calc(100% - 24px));
}

.bt-auth-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 999px;
    background: #f5f5f7;
    color: #111;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.bt-auth-logo {
    width: 58px;
    height: 58px;
    border-radius: 20px;
    background: #fff3ed;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
}

.bt-auth-logo img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.bt-auth-panel h2,
.bt-profile-panel h2 {
    margin: 0;
    font-size: 28px;
    line-height: 1.05;
    letter-spacing: -1px;
    color: #11131d;
}

.bt-auth-panel p,
.bt-profile-panel p {
    color: var(--bt-gray);
    line-height: 1.45;
    margin: 10px 0 18px;
}

.bt-auth-panel form,
.bt-profile-panel form {
    margin: 0;
}

.bt-auth-panel input[type="email"],
.bt-profile-panel input[type="text"] {
    width: 100%;
    height: 54px;
    border-radius: 18px;
    border: 1px solid var(--bt-border);
    padding: 0 16px;
    font-size: 16px;
    outline: none;
    margin-bottom: 10px;
    background: #fff;
    color: #11131d;
    box-sizing: border-box;
}

.bt-auth-panel input[type="email"]:focus,
.bt-profile-panel input[type="text"]:focus {
    border-color: rgba(242, 94, 24, 0.62);
    box-shadow: 0 0 0 4px rgba(242, 94, 24, 0.12);
}

.bt-auth-panel button[type="submit"],
.bt-profile-panel button[type="submit"] {
    width: 100%;
    height: 54px;
    border: 0;
    border-radius: 18px;
    background: var(--bt-black);
    color: #fff;
    font-weight: 950;
    font-size: 15px;
    cursor: pointer;
}

.bt-auth-sent-view {
    display: none;
}

.bt-auth-sheet.is-sent .bt-auth-form-view {
    display: none;
}

.bt-auth-sheet.is-sent .bt-auth-sent-view {
    display: block;
}

.bt-auth-benefits,
.bt-profile-note {
    margin-top: 18px;
    background: #f5f5f7;
    border: 1px solid var(--bt-border);
    border-radius: 18px;
    padding: 14px;
}

.bt-auth-benefits strong,
.bt-profile-note strong {
    display: block;
    margin-bottom: 8px;
}

.bt-auth-benefits ul {
    margin: 0;
    padding-left: 18px;
    color: var(--bt-gray);
    line-height: 1.5;
}

.bt-auth-guest-button,
.bt-profile-skip-button {
    width: 100%;
    min-height: 50px;
    border: 1px solid var(--bt-border);
    border-radius: 18px;
    background: #fff;
    color: #111;
    font-weight: 900;
    font-size: 15px;
    cursor: pointer;
    margin-top: 12px;
}

.bt-profile-sheet {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
}

.bt-profile-sheet.is-open {
    display: block;
}

@keyframes btAuthUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(22px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@media (max-width: 860px) {
    .bt-auth-panel,
    .bt-profile-panel {
        bottom: 10px;
        border-radius: 28px;
        padding: 24px;
    }
}


/* Patch 36: stronger app-style upload buttons across desktop/mobile */
.bt-file-native-input[data-bt-file-enhanced="1"] {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
}

.bt-file-upload {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(15, 23, 42, .10);
    border-radius: 18px;
    background: #fff;
    padding: 8px;
    min-height: 58px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, .04);
}

.bt-file-upload-button {
    border: 0;
    border-radius: 14px;
    background: #11131d;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 16px;
    font: inherit;
    font-weight: 950;
    cursor: pointer;
    white-space: nowrap;
    appearance: none;
    -webkit-appearance: none;
}

.bt-file-upload-button[data-has-file="1"] {
    background: #ff681f;
}

.bt-file-upload-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #667085;
    font-weight: 820;
    font-size: 14px;
}

@media (max-width: 640px) {
    .bt-file-upload {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 10px;
    }

    .bt-file-upload-button {
        width: 100%;
        min-height: 48px;
        border-radius: 16px;
    }

    .bt-file-upload-name {
        width: 100%;
        text-align: center;
        font-size: 13px;
        padding: 0 6px 2px;
    }
}

