/* ============================================================================
   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); }
/* min-height:0 is required for a flex child to shrink below its content size and
   actually scroll; overflow-y makes the long link list scrollable (logout stays pinned). */
.th-drawer__links {
    display: flex; flex-direction: column; gap: 4px;
    padding-top: 14px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.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;
    flex: 0 0 auto;
}
.th-drawer__link:hover { background: var(--th-surface-hover); }
.th-drawer__link.active { background: var(--th-red-soft); color: var(--th-red); }

/* Collapsible Admin group */
.th-drawer__group {
    display: flex; align-items: center; gap: 12px;
    width: 100%; flex: 0 0 auto;
    padding: 12px 12px;
    border: none; background: transparent;
    border-radius: 10px;
    color: var(--th-text);
    font-family: inherit; font-size: 15px; font-weight: 500;
    text-align: left; cursor: pointer;
}
.th-drawer__group:hover { background: var(--th-surface-hover); }
.th-drawer__group-label { flex: 1 1 auto; }
.th-drawer__chev { color: var(--th-text-dim); transition: transform .18s ease; }
.th-drawer__group.is-open .th-drawer__chev { transform: rotate(180deg); }
.th-drawer__sub {
    display: flex; flex-direction: column; gap: 4px;
    margin: 2px 0 2px 15px;
    padding-left: 11px;
    border-left: 1px solid var(--th-border);
}
.th-drawer__link--sub { font-size: 14.5px; padding: 11px 12px; }
.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-job {
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
    overflow: hidden;
}
.th-job__head {
    display: flex; align-items: center; gap: 13px;
    width: 100%; padding: 14px 16px;
    background: none; border: none; text-align: left; color: inherit;
}
.th-job__head:hover { background: var(--th-surface-2); }
.th-job__head--static { cursor: default; }
.th-job__head--static:hover { background: none; }
.th-job__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-job__body { flex: 1 1 auto; min-width: 0; }
.th-job__name { font-weight: 700; font-size: 15px; }
.th-job__meta { font-size: 12.5px; color: var(--th-text-dim); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-job__count { flex: 0 0 auto; font-size: 12px; color: var(--th-text-faint); font-weight: 600; }
.th-job__chev { color: var(--th-text-faint); transition: transform .18s ease; flex: 0 0 auto; }
.th-job__chev--open { transform: rotate(180deg); }

.th-job__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; }

/* ---- Offline / sync status bar -------------------------------------------- */
.th-syncbar {
    position: sticky;
    top: 0;
    z-index: 25;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 9px 16px;
    font-size: 13px; font-weight: 600;
    text-align: center;
}
.th-syncbar--offline { background: rgba(255, 179, 0, 0.14); color: #ffb300; border-bottom: 1px solid rgba(255, 179, 0, 0.3); }
.th-syncbar--pending { background: rgba(0, 164, 239, 0.12); color: #4fb9f0; border-bottom: 1px solid rgba(0, 164, 239, 0.3); }
.th-syncbar--warn { background: var(--th-red-soft); color: #ff8a90; border-bottom: 1px solid rgba(238, 27, 36, 0.35); }
.th-syncbar--warn a { color: inherit; text-decoration: underline; font-weight: 700; }
.th-syncbar--update { background: rgba(31, 138, 76, 0.14); color: #5fce93; border-bottom: 1px solid rgba(31, 138, 76, 0.35); }
.th-syncbar__dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: currentColor; flex: 0 0 auto;
    animation: th-pulse 1.6s infinite ease-in-out;
}
@keyframes th-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.th-syncbar__btn {
    border: 1px solid currentColor; background: transparent; color: inherit;
    border-radius: 999px; padding: 3px 12px;
    font-size: 12px; font-weight: 700;
}

/* Queued (offline) photo tile */
.th-photothumb--queued {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    color: #ffb300;
    border-style: dashed; border-color: rgba(255, 179, 0, 0.5);
    background: rgba(255, 179, 0, 0.08);
    font-size: 10.5px; font-weight: 700;
}

/* ---- 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);
}

/* ---- JSA (Job Safety Analysis) -------------------------------------------- */
.th-jsa-sectionhead {
    font-family: var(--th-font-head);
    font-weight: 800;
    font-size: 15px;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--th-red);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--th-red);
    margin-bottom: 6px;
}

/* Yes/No pill toggle (mirrors the paper form: green Yes / gray No) */
.th-jsa-yn {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 13px 14px;
    background: var(--th-surface-2);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius-sm);
}
.th-jsa-yn__label { font-weight: 600; font-size: 14.5px; }
.th-yn { display: flex; flex: 0 0 auto; }
.th-yn__btn {
    min-width: 58px;
    padding: 9px 14px;
    border: 1px solid var(--th-border-strong);
    background: var(--th-surface);
    color: var(--th-text-dim);
    font-size: 14px; font-weight: 700;
    transition: background .12s ease, color .12s ease;
}
.th-yn__btn--yes { border-radius: 999px 0 0 999px; border-right-width: 0; }
.th-yn__btn--no { border-radius: 0 999px 999px 0; }
.th-yn__btn--yes.is-on { background: #1f8a4c; border-color: #1f8a4c; color: #fff; }
.th-yn__btn--no.is-on { background: #6b7280; border-color: #6b7280; color: #fff; }

/* Statement callout (Stop Work Authority) */
.th-jsa-statement {
    background: rgba(255, 200, 60, 0.10);
    border: 1px solid rgba(255, 200, 60, 0.4);
    border-radius: var(--th-radius);
    padding: 16px;
    font-size: 14px; line-height: 1.55;
    color: var(--th-text);
    margin: 14px 0;
}
.th-jsa-statement--inline { margin: 4px 0; border-radius: var(--th-radius-sm); }

/* Task checklist entries */
.th-jsa-task {
    border: 1px solid var(--th-border);
    background: var(--th-surface-2);
    border-radius: var(--th-radius-sm);
    overflow: hidden;
}
.th-jsa-task.is-checked { border-color: rgba(238, 27, 36, 0.45); }
.th-jsa-task__head {
    display: flex; align-items: center; gap: 12px;
    width: 100%; padding: 14px;
    background: none; border: none; text-align: left; color: inherit;
}
.th-jsa-task__head--static { cursor: default; }
.th-jsa-task__box {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; flex: 0 0 auto;
    border-radius: 8px;
    border: 2px solid var(--th-border-strong);
    background: var(--th-surface);
    color: #fff;
}
.th-jsa-task.is-checked .th-jsa-task__box { background: var(--th-red); border-color: var(--th-red); }
.th-jsa-task__label { flex: 1 1 auto; font-weight: 600; font-size: 15px; }
.th-jsa-task__body { padding: 0 14px 14px; }
.th-jsa-task__body .th-textarea { margin-top: 6px; min-height: 96px; }

/* Signature blocks */
.th-jsa-signer {
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius-sm);
    padding: 14px;
    background: var(--th-surface-2);
    margin-bottom: 4px;
}
.th-jsa-signer__row { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 10px; }
.th-field--grow { flex: 1 1 auto; }
.th-jsa-signer__remove {
    flex: 0 0 auto;
    background: none; border: none;
    color: var(--th-red); font-size: 14px; font-weight: 600;
    padding: 12px 4px;
}
.th-jsa-signer__name { font-weight: 700; font-size: 15px; margin-bottom: 8px; }

.th-sigpad {
    background: #ffffff;
    border: 2px dashed #b7bcc5;
    border-radius: 10px;
    height: 170px;
    overflow: hidden;
    touch-action: none; /* critical: let the canvas own touch gestures */
}
.th-sigpad canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.th-sigpad--locked {
    display: flex; align-items: center; justify-content: center;
    border-style: solid;
    height: auto; min-height: 90px;
}
.th-sigpad--locked svg { max-width: 100%; height: auto; }
.th-sigpad__empty { color: #9aa0aa; font-size: 13px; }
.th-sigpad__bar { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.th-sigpad__hint { color: var(--th-text-faint); font-size: 13px; }

/* Geo row + misc */
.th-georow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.th-georow__status { color: var(--th-text-dim); font-size: 13px; }
.th-textarea--sm { min-height: 64px; }
.th-jsa-view-text { color: var(--th-text-dim); font-size: 14px; text-align: right; }
.th-closeout--disabled { opacity: .55; }

/* Designer */
.th-jsa-designer-sectionrow { display: flex; align-items: center; gap: 10px; }
.th-jsa-designer-title { font-weight: 700; }

/* Admin JSA review tree: project folders -> date subfolders -> per-user JSAs */
.th-tree { display: flex; flex-direction: column; gap: 6px; }
.th-tree__folder {
    display: flex; align-items: center; gap: 11px;
    width: 100%;
    padding: 14px;
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
    color: var(--th-text);
    font-family: inherit; font-size: 15px; font-weight: 600;
    text-align: left; cursor: pointer;
}
.th-tree__folder:hover { background: var(--th-surface-hover); }
.th-tree__folder--sub {
    padding: 12px 14px;
    font-size: 14.5px;
    background: var(--th-surface-2);
    border-radius: var(--th-radius-sm);
}
.th-tree__label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-tree__count { flex: 0 0 auto; color: var(--th-text-dim); font-size: 12.5px; font-weight: 500; }
.th-tree__chev { flex: 0 0 auto; color: var(--th-text-dim); transition: transform .18s ease; }
.th-tree__folder.is-open .th-tree__chev { transform: rotate(180deg); }
.th-tree__children {
    display: flex; flex-direction: column; gap: 6px;
    margin-left: 13px;
    padding-left: 12px;
    border-left: 1px solid var(--th-border);
}
.th-tree__leaf {
    display: flex; align-items: center; gap: 11px;
    padding: 12px 14px;
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius-sm);
    color: var(--th-text);
    font-size: 14px; font-weight: 500;
}
.th-tree__leaf:hover { background: var(--th-surface-hover); }
.th-tree__go { color: var(--th-text-dim); }

/* ---- Time tracking --------------------------------------------------------- */
.th-timer {
    display: flex; align-items: center; gap: 14px;
    padding: 16px;
    background: var(--th-surface);
    border: 1px solid rgba(238, 27, 36, 0.45);
    border-radius: var(--th-radius);
    margin-bottom: 6px;
}
.th-timer__pulse {
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--th-red); flex: 0 0 auto;
    animation: th-pulse 1.4s infinite ease-in-out;
}
.th-timer__body { flex: 1 1 auto; min-width: 0; }
.th-timer__project { font-weight: 700; font-size: 15px; }
.th-timer__elapsed {
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 26px; font-weight: 700; letter-spacing: 1px;
    margin: 2px 0;
}
.th-timer__meta { color: var(--th-text-dim); font-size: 12.5px; }

.th-timeentry {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 16px;
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
}
.th-timeentry__main { flex: 1 1 auto; min-width: 0; }
.th-timeentry__title { font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.th-timeentry__meta { color: var(--th-text-dim); font-size: 12.5px; margin-top: 2px; }
.th-timeentry__notes { color: var(--th-text-dim); font-size: 12.5px; margin-top: 5px; font-style: italic; }
.th-timeentry__dur { flex: 0 0 auto; font-family: var(--th-font-head); font-weight: 800; font-size: 15px; }

/* ---- Receipts --------------------------------------------------------------- */
.th-receipt {
    display: flex; align-items: center; gap: 13px;
    padding: 12px;
    background: var(--th-surface);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
}
.th-receipt__thumb {
    width: 64px; height: 64px; flex: 0 0 auto;
    border-radius: 10px; overflow: hidden;
    border: 1px solid var(--th-border-strong);
    background: var(--th-surface-2);
    padding: 0; cursor: pointer;
}
.th-receipt__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.th-receipt__body { flex: 1 1 auto; min-width: 0; }
.th-receipt__title { font-weight: 600; font-size: 14.5px; }
.th-receipt__meta { color: var(--th-text-dim); font-size: 12.5px; margin-top: 2px; }
.th-receipt__meta--faint { color: var(--th-text-faint); }
.th-filebtn.is-disabled { opacity: .5; pointer-events: none; }

/* Full-screen in-app image viewer (PWAs have no browser back button) */
.th-lightbox {
    position: fixed; inset: 0; z-index: 90;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 14px;
    padding: calc(16px + var(--th-safe-top)) 16px calc(16px + var(--th-safe-bottom));
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(3px);
}
.th-lightbox__img {
    max-width: 100%;
    max-height: calc(100% - 80px);
    object-fit: contain;
    border-radius: 10px;
}
.th-lightbox__close {
    position: absolute;
    top: calc(14px + var(--th-safe-top)); right: 14px;
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(30, 30, 30, 0.85);
    color: #fff; cursor: pointer;
}
.th-lightbox__caption { color: #d3d6db; font-size: 13.5px; text-align: center; }

/* ---- 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; }

/* ============================================================================
   TowerHub v2 additions: role chips, workflow chips, tabs, dashboard stats,
   announcements, quote editor, checkout forms.
   ============================================================================ */

/* Five-role chips (profile). */
.th-rolechip--tech     { background: rgba(0, 164, 239, 0.16); color: #4fb9f0; }
.th-rolechip--foreman  { background: rgba(255, 179, 0, 0.16); color: #ffb300; }
.th-rolechip--officepm { background: rgba(155, 110, 255, 0.16); color: #b394ff; }
.th-rolechip--owner    { background: rgba(45, 200, 120, 0.16); color: #3ddc84; }

/* Workflow status chips. */
.th-statuschip--submitted { background: rgba(155, 110, 255, 0.16); color: #b394ff; }
.th-statuschip--returned  { background: var(--th-red-soft); color: var(--th-red); }

/* Warning notice (returned closeouts). */
.th-notice--warn { border-color: rgba(255, 179, 0, 0.5); background: rgba(255, 179, 0, 0.08); }

/* Simple tab strip. */
.th-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.th-tab {
    padding: 8px 14px; border: 1px solid var(--th-border); border-radius: 999px;
    background: var(--th-surface); color: var(--th-text-dim);
    font-size: 13px; font-weight: 600; cursor: pointer;
}
.th-tab--active { background: var(--th-red-soft); border-color: var(--th-red); color: var(--th-red); }

/* Dashboard stat grid. */
.th-statgrid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px; margin-bottom: 20px;
}
.th-stat {
    background: var(--th-surface); border: 1px solid var(--th-border);
    border-radius: var(--th-radius); padding: 14px;
}
.th-stat--attn { border-color: var(--th-red); }
.th-stat__value { font-size: 24px; font-weight: 800; color: var(--th-text); }
.th-stat--attn .th-stat__value { color: var(--th-red); }
.th-stat__label { margin-top: 2px; font-size: 12px; color: var(--th-text-dim); }

/* Announcements. */
.th-announcement {
    background: var(--th-surface); border: 1px solid var(--th-border);
    border-radius: var(--th-radius); padding: 14px 16px; margin-bottom: 12px;
}
.th-announcement--pending { border-left: 3px solid var(--th-red); }
.th-announcement__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.th-announcement__head h3 { margin: 0; font-size: 15px; }
.th-announcement__date { font-size: 12px; color: var(--th-text-faint); white-space: nowrap; }
.th-announcement__body { margin: 8px 0; font-size: 14px; color: var(--th-text-dim); white-space: pre-line; }
.th-announcement__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.th-announcement__by { font-size: 12px; color: var(--th-text-faint); }
.th-chip--ok { background: rgba(45, 200, 120, 0.16); color: #3ddc84; }
.th-btn--sm { padding: 7px 14px; font-size: 13px; }
.th-empty { text-align: center; color: var(--th-text-faint); padding: 30px 0; }

/* Quote line editor — every field carries a visible micro-label so the numeric
   columns (qty / unit cost / markup) are never ambiguous, even when rows wrap. */
.th-quoteline {
    display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap;
    padding: 10px 0; border-bottom: 1px dashed var(--th-border);
}
.th-qfield { display: flex; flex-direction: column; gap: 3px; flex: 0 1 auto; }
.th-qfield--desc { flex: 2 1 200px; min-width: 150px; }
.th-qfield--num { flex: 0 1 116px; min-width: 100px; }
.th-qfield--total { flex: 0 0 auto; min-width: 84px; align-items: flex-end; }

/* The base .th-input reserves 42px on the left for the login icon — kill that here,
   fill the wrapper, and right-align digits so amounts read like amounts. */
.th-qfield .th-input, .th-qfield .th-select { width: 100%; padding: 11px 12px; }
.th-qfield--num .th-input { text-align: right; font-variant-numeric: tabular-nums; }
.th-qfield__label {
    font-size: 10.5px; font-weight: 700; letter-spacing: .6px;
    text-transform: uppercase; color: var(--th-text-faint); white-space: nowrap;
}
.th-quoteline .th-iconbtn { margin-bottom: 4px; }
.th-quoteline__total { min-width: 80px; text-align: right; font-weight: 700; font-size: 14px; padding-bottom: 8px; }
.th-quotegroup {
    margin: 10px 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .4px;
    text-transform: uppercase; color: var(--th-text-dim);
}
.th-quotegroup--total { color: var(--th-text); font-size: 14px; border-top: 1px solid var(--th-border-strong); padding-top: 8px; }

/* Checkbox rows (announcement audience, item flags). */
.th-checkrow { display: flex; gap: 14px; flex-wrap: wrap; }
.th-checkline {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 14px; color: var(--th-text-dim); cursor: pointer; margin: 4px 0;
}

/* Small metadata inside list bars. */
.th-cobar__meta { margin-left: 8px; font-size: 12px; font-weight: 400; color: var(--th-text-faint); }
.th-subhead__count { font-weight: 400; color: var(--th-text-faint); }

/* ============================================================================
   Responsive width: phones (<768px) are untouched — the shell stays the
   original 520px column. Tablets and desktops widen the shell and use the
   extra room: more tile columns, two-column lists, centered bottom nav.
   ============================================================================ */
@media (min-width: 768px) {
    :root { --th-maxw: 780px; }

    /* Home tiles: three across. */
    .th-grid { grid-template-columns: repeat(3, 1fr); }

    /* Keep the bottom-nav icons together instead of spreading edge to edge. */
    .th-bottomnav { justify-content: center; gap: 64px; }
}

@media (min-width: 1100px) {
    :root { --th-maxw: 1060px; }

    .th-grid { grid-template-columns: repeat(4, 1fr); }

    /* Card lists flow into two columns; an expanded card only grows itself. */
    .th-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        align-items: start;
    }
    .th-list > * { margin: 0; }

    /* Forms and reading cards stay at a comfortable line length. */
    .th-form--card, .th-announcement { max-width: 760px; }
}

/* App-icon preview (Admin Settings) — shown at home-screen size. */
.th-logopreview--icon img { max-height: 96px; width: 96px; height: 96px; object-fit: contain; border-radius: 20px; }


/* Deactivated users (admin list). */
.th-usercard--inactive { opacity: 0.62; }
.th-usercard--inactive .th-userrow__name { text-decoration: none; }
.th-userrow__name .th-statuschip { margin-left: 8px; vertical-align: middle; }
.th-access-toggle--danger { color: var(--th-red); }

/* Upside-down chevron (move-up buttons). */
.th-flip { transform: rotate(180deg); }


/* Lists that should stay a single scannable column at every width (inventory stock). */
@media (min-width: 1100px) {
    .th-list--rows { display: flex; flex-direction: column; align-items: stretch; }
}


/* ---- QR scanner + checkout cart -------------------------------------------- */
.th-scanmodal {
    position: fixed; inset: 0; z-index: 60;
    display: flex; align-items: center; justify-content: center;
    padding: calc(16px + var(--th-safe-top)) 16px calc(16px + var(--th-safe-bottom));
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(3px);
}
.th-scanmodal__card {
    width: 100%; max-width: 420px;
    display: flex; flex-direction: column; gap: 12px; align-items: center;
    background: var(--th-surface); border: 1px solid var(--th-border-strong);
    border-radius: var(--th-radius);
    padding: 16px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
}
.th-scanmodal__cancel { width: 100%; }
/* overflow:hidden clips the reticle's darkening mask to the camera view */
.th-scan__frame { position: relative; width: 100%; overflow: hidden; border-radius: 12px; }
.th-scan__video {
    width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
    border-radius: 12px; background: #000;
}
.th-scan__reticle {
    position: absolute; inset: 14%;
    border: 2px solid rgba(238, 27, 36, 0.85); border-radius: 14px;
    box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}
.th-scan__status { font-size: 14px; color: var(--th-text-dim); text-align: center; min-height: 20px; }

.th-picklist { max-height: 320px; overflow-y: auto; }
.th-cobar--pick { width: 100%; text-align: left; cursor: pointer; border: 1px solid var(--th-border); }
.th-cobar--pick:hover { border-color: var(--th-red); }

.th-pendingitem { border-left: 3px solid var(--th-red); }
.th-stepper--wide { width: 100%; max-width: 240px; }
.th-stepper__input {
    width: 90px; text-align: center; padding: 9px 6px;
    font-variant-numeric: tabular-nums;
}

.th-cartline .th-stepper { margin-left: auto; }
.th-cartline--error { border-color: var(--th-red); }
.th-cartline__error { display: block; font-size: 12px; color: var(--th-red); margin-top: 2px; }
.th-cart__total { margin: 10px 0 14px; text-align: right; font-size: 14px; color: var(--th-text-dim); }

/* Small helper line under a form field group. */
.th-fieldhint {
  margin: 2px 0 10px;
  font-size: 12.5px;
  color: var(--th-text-dim);
}

/* Notifications-on-by-default strip */
.th-syncbar--push { background: rgba(0, 164, 239, 0.12); color: #4fb9f0; border-bottom: 1px solid rgba(0, 164, 239, 0.3); flex-wrap: wrap; }
.th-syncbar--push a { color: inherit; text-decoration: underline; font-weight: 700; }
.th-syncbar__dismiss {
  border: none; background: transparent; color: inherit;
  font-size: 14px; font-weight: 700; line-height: 1;
  padding: 3px 6px; opacity: .7;
}
.th-syncbar__dismiss:hover { opacity: 1; }

/* Fixed checkout bar on the cart page: pinned above the bottom nav. */
.th-cartbar {
  position: fixed;
  bottom: calc(var(--th-nav-h) + var(--th-safe-bottom));
  left: 0; right: 0;
  margin: 0 auto;
  max-width: var(--th-maxw);
  z-index: 35;
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 20px 12px;
  background: var(--th-surface);
  border-top: 1px solid var(--th-border-strong);
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.35);
}
.th-cartbar__total { font-size: 13.5px; color: var(--th-text-dim); text-align: center; }
.th-cartbar__total b { color: var(--th-text); }
.th-cartbar__btn { width: 100%; }
/* Keeps the last cart rows scrollable above the fixed bar. */
.th-cartbar-spacer { height: 108px; }

/* iOS Safari renders date/time inputs as special controls with an intrinsic width
   that ignores width:100%, so they poke out of their card. Strip the native look
   and size them like every other input. Scoped to iOS (-webkit-touch-callout is
   iOS-only) so desktop browsers keep their native calendar picker icon. */
@supports (-webkit-touch-callout: none) {
  .th-input[type="date"],
  .th-input[type="time"] {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 45px; /* matches text inputs; appearance:none collapses iOS height */
    text-align: left;
  }
  .th-input[type="date"]::-webkit-date-and-time-value,
  .th-input[type="time"]::-webkit-date-and-time-value {
    text-align: left; /* iOS centers the value by default */
    min-height: 1.2em;
    margin: 0;
  }
}
/* All browsers: never let a date/time control exceed its card. */
.th-input[type="date"],
.th-input[type="time"] {
  min-width: 0;
  max-width: 100%;
}

/* ---- Inventory history: filters bar + report modal ------------------------ */
.th-histbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 2px 0 12px; }
.th-histbar__filters { display: inline-flex; align-items: center; gap: 6px; }
.th-histbar__chev { transition: transform .18s ease; }
.th-histbar__filters.is-open .th-histbar__chev { transform: rotate(180deg); }
.th-histfilters { margin-bottom: 14px; }
.th-histfilters__summary { margin: -4px 0 12px; }
.th-inlinelink--btn { background: none; border: none; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.th-field__soft { font-weight: 500; color: var(--th-text-faint); }

.th-reportmodal { align-items: stretch; gap: 14px; max-height: calc(100dvh - 40px); overflow-y: auto; text-align: left; }
.th-reportmodal .th-field { width: 100%; }
.th-reportmodal .th-form__actions { flex-wrap: wrap; }
.th-checklist {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 170px; overflow-y: auto;
  border: 1px solid var(--th-border-strong); border-radius: var(--th-radius-sm);
  padding: 6px; background: var(--th-surface-2);
}
.th-check { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.th-check:hover { background: var(--th-surface); }
.th-check input { width: 18px; height: 18px; accent-color: var(--th-red); flex: 0 0 auto; margin: 0; }

/* Green action: returns to stock (the mirror of the red check-out). */
.th-btn--green { background: #1F8A4C; color: #fff; }
.th-btn--green:hover:not(:disabled) { filter: brightness(1.08); }
.th-cartbar--return { border-top-color: rgba(31, 138, 76, 0.65); }

/* ---- Job map dashboard ---------------------------------------------------- */
.th-maplegend { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.th-maplegend__chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--th-border-strong); background: var(--th-surface); color: var(--th-text);
  font-size: 13px; font-weight: 600; transition: opacity .15s ease;
}
.th-maplegend__chip.is-dim { opacity: .38; }
.th-maplegend__chip b { font-weight: 800; }
.th-maplegend__dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.th-maplegend__chip--ontrack .th-maplegend__dot { background: #1F8A4C; }
.th-maplegend__chip--offtrack .th-maplegend__dot { background: var(--th-red); }
.th-maplegend__chip--hold .th-maplegend__dot { background: #FFB300; }

.th-maplayout { display: flex; flex-direction: column; gap: 14px; }
.th-mapwrap { position: relative; }
.th-map {
  height: 52vh; min-height: 300px;
  border-radius: var(--th-radius); border: 1px solid var(--th-border-strong);
  overflow: hidden; background: #1a1b1f; z-index: 0;
}
.th-map__empty {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 5;
  background: rgba(17, 18, 20, 0.88); color: var(--th-text-dim);
  padding: 10px 12px; border-radius: 10px; font-size: 13px; text-align: center;
}
.leaflet-container { font-family: inherit; }
.leaflet-tooltip { font-weight: 600; font-size: 12.5px; }

.th-jobpanel {
  background: var(--th-surface); border: 1px solid var(--th-border-strong);
  border-radius: var(--th-radius); padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.th-jobpanel__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.th-jobpanel__num { font-family: var(--th-font-head); font-weight: 800; font-size: 18px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.th-jobpanel__name { color: var(--th-text-dim); font-size: 14px; margin-top: 2px; }
.th-jobpanel__h { margin: 8px 0 0; font-size: 11.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--th-text-faint); }
.th-jobpanel__rows { margin: 0; }
.th-jobpanel__row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 6px 0; border-bottom: 1px solid var(--th-border); }
.th-jobpanel__row dt { color: var(--th-text-dim); margin: 0; flex: 0 0 auto; }
.th-jobpanel__row dd { margin: 0; text-align: right; font-weight: 500; }

.th-track { font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; }
.th-track--ontrack { background: rgba(31, 138, 76, 0.18); color: #5fce93; }
.th-track--offtrack { background: var(--th-red-soft); color: #ff8a90; }
.th-track--hold { background: rgba(255, 179, 0, 0.16); color: #ffb300; }

.th-crewrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--th-border); font-size: 14px; }
.th-crewrow__meta { color: var(--th-text-dim); font-size: 12.5px; }
.th-crewrow a { display: inline-flex; align-items: center; gap: 5px; color: var(--th-red); font-weight: 600; font-size: 13px; white-space: nowrap; }

.th-mattable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.th-mattable th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--th-text-faint); padding: 4px 0; font-weight: 700; }
.th-mattable td { padding: 6px 0; border-top: 1px solid var(--th-border); vertical-align: top; }
.th-mattable .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.th-mattable__total td { border-top: 2px solid var(--th-border-strong); }

.th-noteadd { display: flex; flex-direction: column; gap: 8px; }
.th-noteadd textarea { min-height: 72px; resize: vertical; font-family: inherit; }
.th-noteadd .th-btn { align-self: flex-end; }
.th-note { padding: 10px 12px; background: var(--th-surface-2); border-radius: 10px; font-size: 14px; }
.th-note__body { white-space: pre-wrap; word-break: break-word; }
.th-note__meta { display: flex; justify-content: space-between; gap: 8px; color: var(--th-text-faint); font-size: 12px; margin-top: 6px; }
.th-note__del { background: none; border: none; color: #ff8a90; font-size: 12px; font-weight: 600; padding: 0; }

@media (min-width: 900px) {
  .th-maplayout.has-panel { display: grid; grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
  .th-map { height: 64vh; }
  .th-maplayout.has-panel .th-jobpanel { max-height: 64vh; overflow-y: auto; }
}

/* Address -> maps app */
.th-addrlink { display: inline-flex; align-items: center; gap: 5px; color: var(--th-red); font-weight: 600; text-decoration: underline; text-decoration-color: rgba(238, 27, 36, 0.4); text-underline-offset: 3px; }
.th-addrlink:hover { text-decoration-color: var(--th-red); }
.th-mapchips { display: flex; gap: 6px; justify-content: flex-end; margin-top: 5px; }
.th-mapchip { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--th-border-strong); color: var(--th-text-dim); white-space: nowrap; }
.th-mapchip:hover { color: var(--th-text); border-color: var(--th-text-faint); }

/* ---- Closeout picker tree (job master) ---------------------------------- */
.th-copick { max-width: 480px; }
.th-cotree { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; padding-right: 2px; }
.th-cotree__cat {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  background: var(--th-surface-2); border: 1px solid var(--th-border-strong);
  font-weight: 700; cursor: pointer;
}
.th-cotree__cat input, .th-cotree__item input { width: 18px; height: 18px; accent-color: var(--th-red); flex: 0 0 auto; margin: 0; }
.th-cotree__catname { flex: 1 1 auto; }
.th-cotree__count { font-size: 12px; font-weight: 600; color: var(--th-text-faint); }
.th-cotree__chev { color: var(--th-text-faint); transition: transform .18s ease; }
.th-cotree__cat.is-open .th-cotree__chev { transform: rotate(180deg); }
.th-cotree__children { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px 14px; padding-left: 12px; border-left: 2px solid var(--th-border-strong); }
.th-cotree__item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.th-cotree__item:hover { background: var(--th-surface-2); }
.th-cotree__item.is-locked { cursor: default; color: var(--th-text-dim); }
.th-cotree__name { flex: 1 1 auto; display: flex; flex-direction: column; }
.th-cotree__name small { color: var(--th-text-faint); font-size: 12px; }
.th-cotree__lock { color: var(--th-text-faint); flex: 0 0 auto; }

/* Field closeouts: category tier inside a job */
.th-cocat { width: 100%; text-align: left; margin-top: 6px; }
.th-cocat__children { margin: 6px 0 4px 10px; padding-left: 10px; gap: 8px; }

/* Confirmation modal (remove photo) */
.th-confirm { max-width: 360px; align-items: stretch; text-align: left; gap: 12px; }
.th-confirm__img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 12px; border: 1px solid var(--th-border-strong); background: #000; }
.th-confirm__text { margin: 0; color: var(--th-text-dim); font-size: 14px; }
.th-confirm .th-form__actions { justify-content: flex-end; }
.th-confirm__yes { background: var(--th-red); color: #fff; border-color: var(--th-red); }

/* Failed-upload strip */
.th-syncbar--failed { background: var(--th-red-soft); color: #ff8a90; border-bottom: 1px solid rgba(238, 27, 36, 0.35); flex-wrap: wrap; }
.th-syncbar__msg { flex: 1 1 auto; text-align: center; }
.th-syncbar__actions { display: inline-flex; gap: 8px; flex: 0 0 auto; }
.th-syncbar__btn--ghost { opacity: .8; }

/* Save-to-Photos affordances */
.th-photothumb__save {
  position: absolute; bottom: 4px; left: 4px;
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(17, 18, 20, 0.78); color: #fff; border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 0;
}
.th-syncbar__flash { flex: 1 1 100%; text-align: center; font-size: 12px; opacity: .85; }

/* PDF button hint */
.th-pdfhint { flex: 1 1 100%; font-size: 12.5px; color: var(--th-text-dim); }

/* Photo requirement not yet met */
.th-photometa--short { color: #ffb300; }

/* Not-applicable toggle on a closeout question */
.th-question__body { flex: 1 1 auto; }
.th-na {
  flex: 0 0 auto; align-self: flex-start;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--th-border-strong); background: transparent; color: var(--th-text-dim);
  font-size: 11.5px; font-weight: 800; letter-spacing: .5px; cursor: pointer;
}
.th-na:hover:not(:disabled) { color: var(--th-text); border-color: var(--th-text-faint); }
.th-na.is-on { background: rgba(45, 200, 120, 0.16); border-color: rgba(45, 200, 120, 0.4); color: #3ddc84; }
.th-na:disabled { cursor: default; }
.th-na__note { margin-top: 6px; font-size: 13px; color: var(--th-text-dim); font-style: italic; }

/* Started-by-mistake strip on an empty closeout */
.th-mistake {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin: 8px 0 14px; padding: 10px 12px;
  border: 1px dashed var(--th-border-strong); border-radius: 10px;
  font-size: 13px; color: var(--th-text-dim);
}

/* Present/absent equipment on closeout setup */
.th-equiprow__check { flex: 0 0 auto; margin: 0; }
.th-equiprow__check input { width: 20px; height: 20px; accent-color: var(--th-red); margin: 0; }
