/* ============================================================================
   Tower Hub — dark, mobile-first theme (tailored for iPhone / Android;
   degrades gracefully to a centered column on desktop).
   ========================================================================= */

:root {
    --th-red: #ee1b24;
    --th-red-dim: #b91720;
    --th-red-soft: rgba(238, 27, 36, 0.14);

    --th-bg: #0a0a0b;
    --th-surface: #161618;
    --th-surface-2: #1e1e21;
    --th-surface-hover: #232327;

    --th-text: #f5f5f6;
    --th-text-dim: #8b8b93;
    --th-text-faint: #5f5f66;

    --th-border: rgba(255, 255, 255, 0.06);
    --th-border-strong: rgba(255, 255, 255, 0.10);

    --th-radius: 16px;
    --th-radius-sm: 10px;
    --th-maxw: 520px;

    --th-nav-h: 64px;
    --th-safe-top: env(safe-area-inset-top, 0px);
    --th-safe-bottom: env(safe-area-inset-bottom, 0px);

    --th-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --th-font-head: 'Montserrat', var(--th-font);
    --th-font-brand: 'Oswald', var(--th-font-head);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--th-bg);
    color: var(--th-text);
    font-family: var(--th-font);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body { min-height: 100dvh; }

a { color: inherit; text-decoration: none; }

h1, h2, h3 { margin: 0; font-family: var(--th-font-head); }

button { font-family: inherit; cursor: pointer; }

/* ---- App shell ----------------------------------------------------------- */
.th-app {
    position: relative;
    max-width: var(--th-maxw);
    margin: 0 auto;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--th-bg);
}

@media (min-width: 540px) {
    .th-app {
        border-inline: 1px solid var(--th-border);
        box-shadow: 0 0 80px rgba(0, 0, 0, 0.6);
    }
}

.th-main { flex: 1 1 auto; }

.th-container {
    padding: 8px 20px calc(var(--th-nav-h) + var(--th-safe-bottom) + 28px);
}

/* ---- Header -------------------------------------------------------------- */
.th-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: calc(12px + var(--th-safe-top)) 16px 12px;
    background: rgba(10, 10, 11, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--th-border);
}

.th-header__brand { display: flex; justify-content: center; flex: 1 1 auto; }

.th-iconbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--th-text);
    transition: background .15s ease;
    flex: 0 0 auto;
}
.th-iconbtn:hover, .th-iconbtn:active { background: rgba(255, 255, 255, 0.06); }

.th-bell { position: relative; }
.th-bell__dot {
    position: absolute;
    top: 9px;
    right: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--th-red);
    border: 2px solid var(--th-bg);
}

/* ---- Brand logo lockup --------------------------------------------------- */
.th-logo { display: flex; flex-direction: column; align-items: center; gap: 2px; user-select: none; }
.th-logo__mark { width: 40px; height: 38px; }
.th-logo__word {
    font-family: var(--th-font-brand);
    font-weight: 700;
    font-size: 22px;
    letter-spacing: 3px;
    line-height: 1;
    display: flex;
    gap: 7px;
}
.th-logo__tower { color: var(--th-text); }
.th-logo__hub { color: var(--th-red); }
.th-logo__sub {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--th-font-brand);
    font-size: 8px;
    letter-spacing: 4px;
    color: var(--th-text-dim);
}
.th-logo__dash { width: 16px; height: 1.5px; background: var(--th-red); display: inline-block; }

.th-logo--sm .th-logo__mark { width: 30px; height: 28px; }
.th-logo--sm .th-logo__word { font-size: 17px; letter-spacing: 2px; }
.th-logo--sm .th-logo__sub { font-size: 6.5px; letter-spacing: 3px; }
.th-logo--sm .th-logo__dash { width: 11px; }

/* ---- Hero / greeting ----------------------------------------------------- */
.th-hero { padding: 22px 2px 8px; }
.th-hero__row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.th-greeting {
    font-family: var(--th-font-head);
    font-weight: 800;
    font-size: clamp(26px, 8vw, 34px);
    line-height: 1.08;
    letter-spacing: -0.5px;
    color: var(--th-text);
}

.th-date { margin: 10px 0 0; color: var(--th-text-dim); font-size: 14px; }

/* Role pill */
.th-rolepill-wrap { position: relative; flex: 0 0 auto; }
.th-rolepill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: var(--th-radius-sm);
    background: var(--th-surface);
    border: 1px solid var(--th-border-strong);
    color: var(--th-red);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.th-rolepill:hover { background: var(--th-surface-2); }
.th-rolepill__chev { color: var(--th-text-dim); }

.th-rolemenu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 20;
    min-width: 190px;
    background: var(--th-surface-2);
    border: 1px solid var(--th-border-strong);
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}
.th-rolemenu__label { font-size: 11px; color: var(--th-text-faint); text-transform: uppercase; letter-spacing: 1px; }
.th-rolemenu__role { font-size: 15px; font-weight: 700; color: var(--th-text); margin: 2px 0 8px; }
.th-rolemenu__item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 9px 10px;
    border: none;
    background: transparent;
    color: var(--th-text);
    border-radius: 8px;
    font-size: 14px;
}
.th-rolemenu__item:hover { background: var(--th-surface-hover); }

/* ---- Section headings ---------------------------------------------------- */
.th-section-head { display: flex; align-items: center; gap: 11px; margin-top: 26px; }
.th-accent { width: 4px; height: 22px; border-radius: 4px; background: var(--th-red); flex: 0 0 auto; }
.th-section-head h2 { font-weight: 800; font-size: 21px; letter-spacing: -0.3px; }
.th-section-sub { margin: 7px 0 16px; color: var(--th-text-dim); font-size: 14px; }

/* ---- App tile grid ------------------------------------------------------- */
.th-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.th-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    min-height: 158px;
    padding: 22px 16px;
    border-radius: var(--th-radius);
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    overflow: hidden;
}

.th-card--active { cursor: pointer; transition: transform .12s ease, background .15s ease; }
.th-card--active:hover { background: var(--th-surface-2); transform: translateY(-2px); }
.th-card--active:active { transform: translateY(0); }
.th-card--active .th-card__icon { color: var(--th-red); }

.th-card--soon { color: var(--th-text-dim); }
.th-card--soon .th-card__icon { color: var(--th-text-faint); }
.th-card--soon .th-card__title { color: var(--th-text-dim); }

.th-card__icon { color: var(--th-text); margin-bottom: 2px; }
.th-card__title { font-family: var(--th-font-head); font-weight: 800; font-size: 18px; color: var(--th-text); }
.th-card__subtitle { font-size: 12.5px; color: var(--th-text-dim); line-height: 1.3; }

.th-card__go { position: absolute; right: 14px; bottom: 12px; color: var(--th-red); }

.th-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--th-text-dim);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--th-border);
    padding: 4px 8px;
    border-radius: 6px;
}

.th-card--skeleton {
    min-height: 158px;
    background: linear-gradient(100deg, var(--th-surface) 30%, var(--th-surface-2) 50%, var(--th-surface) 70%);
    background-size: 200% 100%;
    animation: th-shimmer 1.3s infinite linear;
}
@keyframes th-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---- Stay updated card --------------------------------------------------- */
.th-updates { margin-top: 20px; }
.th-updatecard {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border-radius: var(--th-radius);
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    transition: background .15s ease;
}
.th-updatecard:hover { background: var(--th-surface-2); }
.th-updatecard__icon {
    display: flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; flex: 0 0 auto;
    border-radius: 12px;
    background: var(--th-red-soft);
    color: var(--th-red);
}
.th-updatecard__text { flex: 1 1 auto; min-width: 0; }
.th-updatecard__title { font-weight: 700; font-size: 15px; }
.th-updatecard__sub { font-size: 13px; color: var(--th-text-dim); margin-top: 2px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.th-updatecard__go { color: var(--th-text-faint); flex: 0 0 auto; }

/* ---- Bottom navigation --------------------------------------------------- */
.th-bottomnav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    max-width: var(--th-maxw);
    z-index: 40;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    height: calc(var(--th-nav-h) + var(--th-safe-bottom));
    padding-bottom: var(--th-safe-bottom);
    background: rgba(12, 12, 13, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--th-border);
}
.th-bottomnav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1 1 0;
    color: var(--th-text-dim);
    font-size: 11px;
    font-weight: 600;
    transition: color .15s ease;
}
.th-bottomnav__item:hover { color: var(--th-text); }
.th-bottomnav__item.active { color: var(--th-red); }

/* ---- Drawer -------------------------------------------------------------- */
.th-drawer-backdrop {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
}
.th-drawer {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 51;
    width: 78%; max-width: 300px;
    background: var(--th-surface);
    border-right: 1px solid var(--th-border-strong);
    padding: calc(20px + var(--th-safe-top)) 16px calc(20px + var(--th-safe-bottom));
    display: flex;
    flex-direction: column;
    animation: th-slidein .18s ease;
}
@keyframes th-slidein { from { transform: translateX(-100%); } to { transform: translateX(0); } }
.th-drawer__brand { padding: 6px 6px 20px; border-bottom: 1px solid var(--th-border); }
.th-drawer__links { display: flex; flex-direction: column; gap: 4px; padding-top: 14px; flex: 1 1 auto; }
.th-drawer__link {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 12px;
    border-radius: 10px;
    color: var(--th-text);
    font-size: 15px;
    font-weight: 500;
}
.th-drawer__link:hover { background: var(--th-surface-hover); }
.th-drawer__link.active { background: var(--th-red-soft); color: var(--th-red); }
.th-drawer__logout {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 13px;
    border: 1px solid var(--th-border-strong);
    border-radius: 10px;
    background: transparent;
    color: var(--th-text);
    font-size: 15px; font-weight: 600;
}
.th-drawer__logout:hover { background: var(--th-surface-hover); }

/* ---- Generic page + lists ------------------------------------------------ */
.th-page { padding-top: 18px; }
.th-notice { color: var(--th-text-dim); padding: 20px 2px; font-size: 14px; }

.th-list { display: flex; flex-direction: column; gap: 12px; }
.th-listitem {
    display: flex; gap: 14px;
    padding: 16px;
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
}
.th-listitem__icon {
    display: flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; flex: 0 0 auto;
    border-radius: 11px;
    background: var(--th-red-soft);
    color: var(--th-red);
}
.th-listitem__title { font-weight: 700; font-size: 15px; }
.th-listitem__text { color: var(--th-text-dim); font-size: 13.5px; margin-top: 3px; line-height: 1.4; }
.th-listitem__meta { color: var(--th-text-faint); font-size: 12px; margin-top: 8px; }

/* Empty state (Closeouts) */
.th-emptystate {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    padding: 48px 24px;
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
    margin-top: 6px;
}
.th-emptystate__icon {
    display: flex; align-items: center; justify-content: center;
    width: 76px; height: 76px; border-radius: 50%;
    background: var(--th-red-soft); color: var(--th-red);
    margin-bottom: 16px;
}
.th-emptystate__title { font-family: var(--th-font-head); font-weight: 800; font-size: 18px; }
.th-emptystate__text { color: var(--th-text-dim); font-size: 14px; margin-top: 8px; max-width: 320px; line-height: 1.5; }

/* ---- Profile ------------------------------------------------------------- */
.th-profilecard {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    padding: 28px 20px;
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
    margin: 8px 0 18px;
}
.th-avatar {
    display: flex; align-items: center; justify-content: center;
    width: 78px; height: 78px; border-radius: 50%;
    background: var(--th-red-soft); color: var(--th-red);
    margin-bottom: 14px;
}
.th-profilecard__name { font-family: var(--th-font-head); font-weight: 800; font-size: 20px; }
.th-profilecard__title { color: var(--th-text-dim); font-size: 14px; margin-top: 3px; }

.th-rolechip {
    margin-top: 12px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px; font-weight: 700; letter-spacing: .5px;
    background: rgba(255, 255, 255, 0.06); color: var(--th-text-dim);
}
.th-rolechip--admin { background: var(--th-red-soft); color: var(--th-red); }
.th-rolechip--contributor { background: rgba(255, 179, 0, 0.16); color: #ffb300; }
.th-rolechip--user { background: rgba(0, 164, 239, 0.16); color: #4fb9f0; }

.th-detaillist {
    margin: 0 0 20px;
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
    overflow: hidden;
}
.th-detail { display: flex; justify-content: space-between; gap: 14px; padding: 15px 16px; border-bottom: 1px solid var(--th-border); }
.th-detail:last-child { border-bottom: none; }
.th-detail dt { color: var(--th-text-dim); font-size: 14px; margin: 0; }
.th-detail dd { margin: 0; font-size: 14px; font-weight: 500; text-align: right; word-break: break-word; }

/* ---- Admin --------------------------------------------------------------- */
.th-userrow {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
}
.th-userrow__main { flex: 1 1 auto; min-width: 0; }
.th-userrow__name { font-weight: 600; font-size: 15px; }
.th-userrow__email { color: var(--th-text-dim); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-select {
    background: var(--th-surface-2);
    color: var(--th-text);
    border: 1px solid var(--th-border-strong);
    border-radius: 9px;
    padding: 9px 10px;
    font-size: 14px;
    flex: 0 0 auto;
}

/* ---- Auth pages ---------------------------------------------------------- */
.th-app--auth { background: var(--th-bg); }
.th-authmain {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(28px + var(--th-safe-top)) 20px calc(28px + var(--th-safe-bottom));
}
.th-authcard { width: 100%; max-width: 380px; }
.th-auth__brand { display: flex; justify-content: center; margin-bottom: 26px; }
.th-auth__title { font-weight: 800; font-size: 26px; text-align: center; }
.th-auth__sub { text-align: center; color: var(--th-text-dim); font-size: 14px; margin: 8px 0 24px; }
.th-auth__foot { text-align: center; color: var(--th-text-dim); font-size: 14px; margin-top: 22px; }
.th-auth__foot a { color: var(--th-red); font-weight: 600; }

/* ---- Forms --------------------------------------------------------------- */
.th-form { display: flex; flex-direction: column; gap: 16px; }
.th-form__error {
    background: var(--th-red-soft);
    border: 1px solid rgba(238, 27, 36, 0.4);
    color: #ff8a90;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13.5px;
}
.th-field { display: flex; flex-direction: column; gap: 7px; }
.th-field__label { font-size: 13px; font-weight: 600; color: var(--th-text-dim); }
.th-field__control { position: relative; display: flex; align-items: center; }
.th-field__icon { position: absolute; left: 13px; color: var(--th-text-faint); pointer-events: none; }
.th-input {
    width: 100%;
    padding: 13px 14px 13px 42px;
    background: var(--th-surface);
    border: 1px solid var(--th-border-strong);
    border-radius: var(--th-radius-sm);
    color: var(--th-text);
    font-size: 15px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.th-input::placeholder { color: var(--th-text-faint); }
.th-input:focus { border-color: var(--th-red); box-shadow: 0 0 0 3px var(--th-red-soft); }
.th-field .validation-message { color: #ff8a90; font-size: 12.5px; }

.th-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%;
    padding: 14px 16px;
    border: none;
    border-radius: var(--th-radius-sm);
    font-size: 15px; font-weight: 700;
    transition: filter .15s ease, background .15s ease;
}
.th-btn:disabled { opacity: .65; cursor: default; }
.th-btn--primary { background: var(--th-red); color: #fff; }
.th-btn--primary:hover:not(:disabled) { filter: brightness(1.08); }
.th-btn--microsoft { background: #fff; color: #1b1b1f; }
.th-btn--microsoft:hover { background: #ededed; }
.th-btn--danger {
    background: transparent; color: #ff8a90;
    border: 1px solid rgba(238, 27, 36, 0.4);
}
.th-btn--danger:hover { background: var(--th-red-soft); }
.th-ms-logo { width: 18px; height: 18px; }

.th-divider { display: flex; align-items: center; gap: 12px; color: var(--th-text-faint); font-size: 12px; margin: 20px 0; }
.th-divider::before, .th-divider::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--th-border-strong); }

/* ---- Companies ----------------------------------------------------------- */
.th-companycard {
    padding: 16px;
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
}
.th-companycard__head { display: flex; align-items: center; gap: 12px; }
.th-companycard__icon {
    display: flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; flex: 0 0 auto;
    border-radius: 11px; background: var(--th-red-soft); color: var(--th-red);
}
.th-companycard__name { font-family: var(--th-font-head); font-weight: 800; font-size: 16px; }
.th-companycard__rows { display: flex; flex-direction: column; gap: 7px; margin-top: 13px; }
.th-companycard__row { display: flex; align-items: center; gap: 9px; color: var(--th-text-dim); font-size: 13.5px; }
.th-companycard__row .th-icon { color: var(--th-text-faint); flex: 0 0 auto; }

/* ---- Admin: user cards + access panel ------------------------------------ */
.th-usercard {
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
    padding: 6px 16px 10px;
}
.th-userrow--flush { background: none; border: none; border-radius: 0; padding: 12px 0; }
.th-list--tight { gap: 10px; }

.th-iconbtn--sm { width: 38px; height: 38px; border-radius: 10px; color: var(--th-text-dim); }
.th-iconbtn--sm:hover { color: var(--th-text); }
.th-iconbtn--danger:hover { background: var(--th-red-soft); color: var(--th-red); }

.th-access-toggle {
    display: flex; align-items: center; gap: 8px;
    width: 100%;
    padding: 10px 0 4px;
    background: none; border: none;
    color: var(--th-text-dim); font-size: 13px; font-weight: 600;
}
.th-access-toggle:hover { color: var(--th-text); }
.th-access-toggle__count { margin-left: auto; color: var(--th-text-faint); font-weight: 500; }

.th-access-panel {
    margin-top: 8px; padding-top: 12px;
    border-top: 1px solid var(--th-border);
    display: flex; flex-direction: column; gap: 4px;
}
.th-check {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 6px; border-radius: 9px; font-size: 14px; cursor: pointer;
}
.th-check:hover { background: var(--th-surface-hover); }
.th-check input { width: 18px; height: 18px; accent-color: var(--th-red); flex: 0 0 auto; }

/* ---- Buttons / forms (shared additions) ---------------------------------- */
.th-btn--inline { width: auto; align-self: flex-start; padding: 11px 16px; margin-bottom: 18px; }
.th-btn--ghost { background: transparent; border: 1px solid var(--th-border-strong); color: var(--th-text); }
.th-btn--ghost:hover { background: var(--th-surface-hover); }

.th-form--card {
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
    padding: 18px;
    margin-bottom: 18px;
}
.th-form__heading { font-family: var(--th-font-head); font-weight: 800; font-size: 16px; margin-bottom: 4px; }
.th-form__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.th-form__grid--3 { grid-template-columns: 2fr 1fr 1fr; }
.th-form__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.th-form__actions .th-btn { width: auto; padding: 11px 18px; }
.th-input--plain { padding-left: 14px; }

/* ---- Closeouts page ------------------------------------------------------ */
.th-subhead {
    font-family: var(--th-font-head);
    font-weight: 800;
    font-size: 17px;
    margin: 26px 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.th-emptystate--sm { padding: 28px 20px; }
.th-emptystate--sm .th-emptystate__icon { width: 60px; height: 60px; margin-bottom: 12px; }

.th-closeout {
    display: flex; align-items: center; gap: 13px;
    padding: 14px 16px;
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
}
.th-closeout__icon {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; flex: 0 0 auto;
    border-radius: 11px; background: var(--th-red-soft); color: var(--th-red);
}
.th-closeout__body { flex: 1 1 auto; min-width: 0; }
.th-closeout__title { font-weight: 700; font-size: 15px; }
.th-closeout__meta { font-size: 13px; color: var(--th-text-dim); margin-top: 2px; }
.th-closeout__meta--faint { color: var(--th-text-faint); font-size: 12px; }

/* Status chips */
.th-statuschip {
    flex: 0 0 auto;
    padding: 5px 10px; border-radius: 999px;
    font-size: 11.5px; font-weight: 700; letter-spacing: .3px; white-space: nowrap;
    background: rgba(255,255,255,0.06); color: var(--th-text-dim);
}
.th-statuschip--available { background: rgba(0,164,239,0.16); color: #4fb9f0; }
.th-statuschip--progress { background: rgba(255,179,0,0.16); color: #ffb300; }
.th-statuschip--done { background: rgba(45,200,120,0.16); color: #3ddc84; }

/* Expandable project rows */
.th-project {
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
    overflow: hidden;
}
.th-project__head {
    display: flex; align-items: center; gap: 13px;
    width: 100%; padding: 14px 16px;
    background: none; border: none; text-align: left; color: inherit;
}
.th-project__head:hover { background: var(--th-surface-2); }
.th-project__head--static { cursor: default; }
.th-project__head--static:hover { background: none; }
.th-project__icon {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; flex: 0 0 auto;
    border-radius: 11px; background: var(--th-red-soft); color: var(--th-red);
}
.th-project__body { flex: 1 1 auto; min-width: 0; }
.th-project__name { font-weight: 700; font-size: 15px; }
.th-project__meta { font-size: 12.5px; color: var(--th-text-dim); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-project__count { flex: 0 0 auto; font-size: 12px; color: var(--th-text-faint); font-weight: 600; }
.th-project__chev { color: var(--th-text-faint); transition: transform .18s ease; flex: 0 0 auto; }
.th-project__chev--open { transform: rotate(180deg); }

.th-project__closeouts {
    border-top: 1px solid var(--th-border);
    padding: 8px 16px 14px;
    display: flex; flex-direction: column; gap: 8px;
}
.th-cobar {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--th-border);
}
.th-cobar:last-of-type { border-bottom: none; }
.th-cobar__title { flex: 1 1 auto; display: flex; align-items: center; gap: 9px; font-size: 14px; min-width: 0; }
.th-cobar__title .th-icon { color: var(--th-text-faint); flex: 0 0 auto; }

.th-addrow { display: flex; gap: 10px; padding-top: 10px; }
.th-addrow .th-input { flex: 1 1 auto; }

.th-btn--xs { width: auto; padding: 8px 16px; font-size: 13px; flex: 0 0 auto; }
.th-select--full { width: 100%; }
.th-notice--inset { padding: 12px 2px; }

/* ---- Closeout detail (equipment setup + questions + photos) --------------- */
.th-backlink {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--th-text-dim); font-size: 13px; font-weight: 600;
    margin-bottom: 4px;
}
.th-backlink:hover { color: var(--th-text); }
.th-backlink__arrow { transform: rotate(180deg); }

.th-donebanner {
    display: flex; align-items: center; gap: 10px;
    background: rgba(45,200,120,0.12);
    border: 1px solid rgba(45,200,120,0.35);
    color: #3ddc84;
    padding: 12px 14px; border-radius: 10px;
    font-size: 14px; font-weight: 600;
    margin: 6px 0 14px;
}

.th-closeout--link { transition: background .15s ease; }
.th-closeout--link:hover { background: var(--th-surface-2); }
.th-closeout__go { color: var(--th-text-faint); flex: 0 0 auto; }

/* Equipment quantity steppers */
.th-equiprow {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
}
.th-equiprow--common { opacity: .85; }
.th-equiprow__main { flex: 1 1 auto; min-width: 0; }
.th-equiprow__name { font-weight: 700; font-size: 15px; }
.th-equiprow__meta { font-size: 12.5px; color: var(--th-text-dim); margin-top: 2px; }

.th-stepper { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.th-stepper__btn {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    border-radius: 11px;
    border: 1px solid var(--th-border-strong);
    background: var(--th-surface-2);
    color: var(--th-text);
}
.th-stepper__btn:disabled { opacity: .35; }
.th-stepper__btn:not(:disabled):active { background: var(--th-surface-hover); }
.th-stepper__val {
    min-width: 36px; text-align: center;
    font-family: var(--th-font-head); font-weight: 800; font-size: 17px;
}

/* Progress bar */
.th-progressbar { margin: 10px 0 16px; }
.th-progressbar__track {
    height: 8px; border-radius: 999px;
    background: var(--th-surface-2);
    border: 1px solid var(--th-border);
    overflow: hidden;
}
.th-progressbar__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--th-red-dim), var(--th-red));
    border-radius: 999px;
    transition: width .25s ease;
}
.th-progressbar__label { display: block; margin-top: 6px; font-size: 12.5px; color: var(--th-text-dim); }

/* Question cards */
.th-question {
    padding: 13px 0;
    border-bottom: 1px solid var(--th-border);
}
.th-question:last-child { border-bottom: none; }
.th-question__text { display: flex; gap: 10px; font-size: 14px; line-height: 1.45; }
.th-question__num {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 7px;
    background: var(--th-surface-2); border: 1px solid var(--th-border-strong);
    color: var(--th-text-dim); font-size: 11.5px; font-weight: 700;
}
.th-question--done .th-question__num { background: rgba(45,200,120,0.16); border-color: rgba(45,200,120,0.4); color: #3ddc84; }

.th-textarea { min-height: 74px; resize: vertical; padding: 12px 14px; margin-top: 10px; font-family: inherit; }

.th-photometa {
    display: flex; align-items: center; gap: 7px;
    margin-top: 10px;
    font-size: 12.5px; color: var(--th-text-dim); font-weight: 600;
}
.th-photogrid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.th-photothumb {
    position: relative;
    width: 84px; height: 84px;
    border-radius: 10px; overflow: hidden;
    border: 1px solid var(--th-border-strong);
    background: var(--th-surface-2);
}
.th-photothumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.th-photothumb__del {
    position: absolute; top: 4px; right: 4px;
    display: flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 50%;
    border: none; background: rgba(0,0,0,0.65); color: #fff;
}
.th-photothumb__del:active { background: var(--th-red); }
.th-photothumb--uploading {
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; color: var(--th-text-dim);
    animation: th-shimmer 1.3s infinite linear;
    background: linear-gradient(100deg, var(--th-surface) 30%, var(--th-surface-2) 50%, var(--th-surface) 70%);
    background-size: 200% 100%;
}

.th-photoactions { display: flex; gap: 10px; margin-top: 10px; }
.th-filebtn { position: relative; overflow: hidden; }
.th-filebtn input[type="file"] {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    opacity: 0; cursor: pointer;
}

.th-btn--stack { margin-top: 16px; }
.th-detailactions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }

/* ---- Admin: equipment & templates ---------------------------------------- */
.th-select--grow { flex: 1 1 auto; min-width: 0; }
.th-inlinelink { color: var(--th-red); font-weight: 600; text-decoration: underline; }

.th-cobar__title--wrap { flex-wrap: wrap; row-gap: 6px; }
.th-qtags { display: inline-flex; gap: 6px; margin-left: 8px; }
.th-qtags .th-statuschip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; font-size: 10.5px; }

.th-qform {
    background: var(--th-surface-2);
    border: 1px solid var(--th-border-strong);
    border-radius: 12px;
    padding: 14px;
    margin: 8px 0;
    display: flex; flex-direction: column; gap: 10px;
}
.th-qform .th-textarea { margin-top: 0; }
.th-qform__opts { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.th-qform__count { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--th-text-dim); }
.th-numinput { width: 78px; padding: 9px 10px; }

.th-check--boxed {
    border: 1px solid var(--th-border-strong);
    border-radius: var(--th-radius-sm);
    padding: 12px;
    align-self: end;
}
.th-check--disabled { opacity: .55; cursor: default; }
.th-check__meta { color: var(--th-text-faint); font-size: 12px; margin-left: 6px; }

/* Logo preview on the settings page (white bg so transparency reads like the report). */
.th-logopreview {
    display: flex; align-items: center; justify-content: center;
    padding: 20px; margin-bottom: 14px;
    background: #ffffff; border-radius: var(--th-radius-sm);
    border: 1px solid var(--th-border-strong);
}
.th-logopreview img { max-height: 96px; max-width: 100%; object-fit: contain; }
.th-hint { color: var(--th-text-dim); font-size: 12.5px; margin-top: 10px; line-height: 1.6; }
.th-code {
    display: inline-block; margin: 4px 0;
    padding: 4px 8px; border-radius: 6px;
    background: var(--th-surface-2); border: 1px solid var(--th-border-strong);
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 12px; color: var(--th-text); word-break: break-all;
}
.th-form__heading .th-statuschip { margin-left: 10px; vertical-align: middle; }

/* ---- Type-ahead picker (project access, reusable) ------------------------- */
.th-typeahead { position: relative; }
.th-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.th-chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 8px 7px 12px;
    background: var(--th-red-soft); color: var(--th-red);
    border-radius: 999px; font-size: 13px; font-weight: 600;
}
.th-chip__x {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border: none; border-radius: 50%;
    background: rgba(238, 27, 36, 0.18); color: inherit;
}
.th-chip__x:hover { background: rgba(238, 27, 36, 0.35); }

.th-typeahead__box { position: relative; display: flex; align-items: center; }
.th-typeahead__icon { position: absolute; left: 12px; color: var(--th-text-faint); pointer-events: none; }
.th-typeahead__input {
    width: 100%;
    padding: 12px 14px 12px 38px;
    background: var(--th-surface-2);
    border: 1px solid var(--th-border-strong);
    border-radius: var(--th-radius-sm);
    color: var(--th-text); font-size: 15px; outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.th-typeahead__input::placeholder { color: var(--th-text-faint); }
.th-typeahead__input:focus { border-color: var(--th-red); box-shadow: 0 0 0 3px var(--th-red-soft); }

.th-typeahead__menu {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30;
    background: var(--th-surface-2);
    border: 1px solid var(--th-border-strong);
    border-radius: 12px; padding: 6px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
    max-height: 288px; overflow-y: auto;
}
.th-typeahead__opt {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    width: 100%; text-align: left;
    padding: 10px 12px; border: none; background: transparent;
    color: var(--th-text); border-radius: 8px;
}
.th-typeahead__opt:hover, .th-typeahead__opt.is-active { background: var(--th-surface-hover); }
.th-typeahead__opt-name { font-size: 14px; font-weight: 500; }
.th-typeahead__opt-sub { font-size: 12px; color: var(--th-text-dim); }
.th-typeahead__empty {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30;
    background: var(--th-surface-2); border: 1px solid var(--th-border-strong);
    border-radius: 12px; padding: 12px 14px; color: var(--th-text-dim); font-size: 13px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}

/* ---- Splash / loading ---------------------------------------------------- */
.th-splash {
    min-height: 100dvh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 14px; color: var(--th-text-dim);
}
.loading-progress { width: 60px; height: 60px; }
.loading-progress circle { fill: none; stroke: var(--th-surface-2); stroke-width: 6%; }
.loading-progress circle:last-child {
    stroke: var(--th-red);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray .1s ease;
}
.loading-progress-text { font-size: 13px; }
.loading-progress-text::after { content: var(--blazor-load-percentage-text, "Loading"); }

/* ---- Blazor error UI ----------------------------------------------------- */
#blazor-error-ui {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    background: #b91720; color: #fff;
    padding: 12px 18px; font-size: 14px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5);
}
#blazor-error-ui .reload { color: #fff; text-decoration: underline; margin-left: 6px; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 14px; top: 10px; }
