:root {
    --app-ink: #12263a;
    --app-ink-soft: #5d6d7d;
    --app-bg: #edf1f5;
    --app-panel: #ffffff;
    --app-line: #d9e1e8;
    --app-brand: #164b63;
    --app-brand-deep: #0d2533;
    --app-accent: #c97735;
    --app-accent-soft: #eb9f63;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(201, 119, 53, 0.11), transparent 28%),
        radial-gradient(circle at left top, rgba(22, 75, 99, 0.08), transparent 22%),
        linear-gradient(180deg, #f8fafc 0%, var(--app-bg) 100%);
    color: var(--app-ink);
    font-family: "Aptos", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
}

.app-main {
    width: min(1760px, calc(100vw - 1rem));
    margin-inline: auto;
    padding-bottom: 2.5rem;
}

.login-page {
    min-height: 100vh;
    background: var(--app-panel);
}

.login-split {
    min-height: 100vh;
    display: flex;
}

/* ── Left pane: form, on plain white ───────────────────────────────────── */

.login-pane-form {
    width: min(440px, 100vw);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 2.5rem;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.login-brand-name {
    color: var(--app-ink);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.login-pane-form .login-form-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-pane-form a {
    color: var(--app-brand);
    font-weight: 600;
}

.login-pane-form a:hover,
.login-pane-form a:focus {
    color: var(--app-brand-deep);
}

.login-footer {
    color: var(--app-ink-soft);
    font-size: 0.8rem;
    margin-top: 2rem;
}

.login-footer a {
    color: var(--app-ink-soft);
    text-decoration: underline;
    font-weight: 400;
}

/* ── Right pane: branded, decorative ───────────────────────────────────── */

.login-pane-hero {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 85% 15%, rgba(201, 119, 53, 0.22), transparent 32%),
        radial-gradient(circle at 10% 90%, rgba(26, 92, 120, 0.4), transparent 38%),
        linear-gradient(160deg, #0d2533 0%, #164b63 45%, #1a5c78 100%);
}

.login-hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 48px 48px;
    -webkit-mask-image: radial-gradient(circle at center, black 40%, transparent 75%);
            mask-image: radial-gradient(circle at center, black 40%, transparent 75%);
}

.login-hero-hex {
    position: absolute;
    opacity: 0.55;
}

.login-hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
}

.login-hero-icon {
    width: 5rem;
    height: 5rem;
    margin-bottom: 1.5rem;
}

.login-hero-headline {
    color: #fff;
    font-size: 1.4rem;
    font-weight: 600;
    max-width: 360px;
    margin: 0 auto;
    letter-spacing: -0.01em;
}

.login-hero-subline {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    max-width: 340px;
    margin: 0.75rem auto 0;
}

@media (max-width: 900px) {
    .login-pane-hero {
        display: none;
    }

    .login-pane-form {
        width: 100%;
        margin: 0 auto;
        justify-content: center;
    }
}

/* ── Client invitation landing page ─────────────────────────────────────── */

.invitation-page {
    background:
        radial-gradient(circle at 10% 10%, rgba(22, 75, 99, 0.16), transparent 28rem),
        radial-gradient(circle at 92% 78%, rgba(201, 119, 53, 0.14), transparent 24rem),
        linear-gradient(145deg, #f7fafc 0%, #edf2f6 55%, #f8f4ef 100%);
}

.invitation-page .app-main {
    display: flex;
    align-items: center;
    min-height: calc(100vh - 5rem);
    padding-top: 3rem !important;
    padding-bottom: 3rem;
}

.invitation-shell {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
    border: 1px solid rgba(22, 75, 99, 0.12);
    border-radius: 1.5rem;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1.75rem 4rem rgba(13, 37, 51, 0.14);
}

.invitation-overview {
    position: relative;
    isolation: isolate;
    padding: clamp(2.25rem, 5vw, 4.5rem);
    color: #fff;
    background:
        radial-gradient(circle at 88% 12%, rgba(235, 159, 99, 0.32), transparent 13rem),
        radial-gradient(circle at 5% 95%, rgba(42, 118, 146, 0.5), transparent 18rem),
        linear-gradient(150deg, #0d2533 0%, #164b63 56%, #1d617b 100%);
}

.invitation-overview::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: 0.18;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 42px 42px;
    -webkit-mask-image: linear-gradient(135deg, black, transparent 72%);
            mask-image: linear-gradient(135deg, black, transparent 72%);
}

.invitation-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 1.75rem;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.invitation-kicker-mark,
.invitation-account-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 50%;
}

.invitation-kicker-mark {
    width: 1.65rem;
    height: 1.65rem;
    color: #17384a;
    background: #f3b47d;
    font-size: 0.82rem;
}

.invitation-title {
    max-width: 34rem;
    margin: 0;
    font-size: clamp(2.15rem, 4.3vw, 3.7rem);
    font-weight: 700;
    letter-spacing: -0.045em;
    line-height: 1.03;
}

.invitation-project-name {
    margin: 0.65rem 0 0;
    color: #f4bd8e;
    font-size: clamp(1.2rem, 2vw, 1.55rem);
    font-weight: 600;
}

.invitation-intro {
    max-width: 33rem;
    margin: 1.25rem 0 2rem;
    color: rgba(255, 255, 255, 0.72);
    font-size: 1rem;
}

.invitation-details {
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.08);
    -webkit-backdrop-filter: blur(8px);
            backdrop-filter: blur(8px);
}

.invitation-details-heading {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.invitation-detail-list {
    margin: 0;
    padding: 0.35rem 1rem;
}

.invitation-detail-row {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.invitation-detail-row:last-child {
    border-bottom: 0;
}

.invitation-detail-row dt {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.78rem;
    font-weight: 500;
}

.invitation-detail-row dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
}

.invitation-project-code {
    display: inline-block;
    margin-right: 0.35rem;
    padding: 0.12rem 0.42rem;
    border-radius: 0.35rem;
    color: #19384a;
    background: #f5c69e;
    font-size: 0.72rem;
    letter-spacing: 0.035em;
}

.invitation-trust-note {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    margin-top: 1.3rem;
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.77rem;
    line-height: 1.55;
}

.invitation-trust-icon {
    color: #f3b47d;
    font-size: 1.1rem;
}

.invitation-action-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(2rem, 4vw, 3.75rem);
    background: #fff;
}

.invitation-step-label {
    margin-bottom: 0.55rem;
    color: var(--app-accent);
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.invitation-action-title {
    margin: 0;
    color: var(--app-ink);
    font-size: clamp(1.65rem, 2.8vw, 2.15rem);
    font-weight: 700;
    letter-spacing: -0.035em;
}

.invitation-action-copy {
    margin: 0.8rem 0 1.6rem;
    color: var(--app-ink-soft);
    font-size: 0.92rem;
}

.invitation-form .form-label {
    margin-bottom: 0.4rem;
    color: #294052;
    font-size: 0.8rem;
    font-weight: 700;
}

.invitation-form .form-control {
    min-height: 2.85rem;
    border-color: #cfd9e2;
    border-radius: 0.65rem;
    background: #fbfcfd;
}

.invitation-form .form-control:focus {
    border-color: var(--app-brand);
    background: #fff;
    box-shadow: 0 0 0 0.2rem rgba(22, 75, 99, 0.12);
}

.invitation-form .form-text {
    color: #758493;
    font-size: 0.72rem;
}

.invitation-password-help ul {
    margin: 0.45rem 0 0;
    padding-left: 1rem;
}

.invitation-primary-action {
    width: 100%;
    min-height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0.7rem;
    background: linear-gradient(105deg, var(--app-brand-deep), var(--app-brand));
    font-size: 0.9rem;
    font-weight: 700;
    box-shadow: 0 0.7rem 1.25rem rgba(22, 75, 99, 0.18);
}

.invitation-primary-action:hover,
.invitation-primary-action:focus {
    background: linear-gradient(105deg, #081b26, #11617d);
}

.invitation-account-confirmation {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 1rem;
    border: 1px solid #c7e5d4;
    border-radius: 0.8rem;
    background: #f1faf5;
}

.invitation-account-confirmation-neutral {
    border-color: #d8e1e9;
    background: #f7f9fb;
}

.invitation-account-check {
    width: 1.75rem;
    height: 1.75rem;
    color: #fff;
    background: #258451;
    font-size: 0.8rem;
}

.invitation-account-confirmation-neutral .invitation-account-check {
    background: var(--app-brand);
}

.invitation-account-confirmation strong,
.invitation-account-confirmation span {
    display: block;
}

.invitation-account-confirmation strong {
    color: #203849;
    font-size: 0.82rem;
}

.invitation-account-confirmation span {
    margin-top: 0.15rem;
    color: #6c7c89;
    font-size: 0.74rem;
}

.invitation-next-steps {
    margin-top: 1.8rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--app-line);
}

.invitation-next-title {
    margin-bottom: 0.8rem;
    color: #32495a;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.invitation-next-list {
    display: grid;
    gap: 0.65rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.invitation-next-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
}

.invitation-next-list li > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 50%;
    color: var(--app-brand);
    background: #e8f0f4;
    font-size: 0.68rem;
    font-weight: 800;
}

.invitation-next-list strong,
.invitation-next-list small {
    display: block;
}

.invitation-next-list strong {
    color: #304656;
    font-size: 0.78rem;
}

.invitation-next-list small {
    margin-top: 0.08rem;
    color: #7a8894;
    font-size: 0.7rem;
}

.invitation-help {
    margin-top: 1.4rem;
    color: #88949e;
    font-size: 0.7rem;
    text-align: center;
}

@media (max-width: 880px) {
    .invitation-page .app-main {
        align-items: flex-start;
        padding-top: 1.5rem !important;
    }

    .invitation-shell {
        grid-template-columns: 1fr;
        max-width: 680px;
    }

    .invitation-overview,
    .invitation-action-card {
        padding: 2rem;
    }

    .invitation-title {
        font-size: clamp(2rem, 8vw, 3rem);
    }
}

@media (max-width: 575.98px) {
    .invitation-page .app-main {
        width: 100%;
        padding: 0 !important;
    }

    .invitation-shell {
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .invitation-overview,
    .invitation-action-card {
        padding: 1.5rem 1.15rem;
    }

    .invitation-kicker {
        margin-bottom: 1.25rem;
    }

    .invitation-intro {
        margin-bottom: 1.4rem;
    }

    .invitation-detail-row {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }
}

.app-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: linear-gradient(90deg, #0d2533 0%, var(--app-brand-deep) 45%, var(--app-brand) 100%);
    box-shadow: 0 0.75rem 2rem rgba(13, 37, 51, 0.18);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-nav-inner {
    gap: 1rem;
}

.itp-scroll-target {
    scroll-margin-top: 6rem;
}

.app-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.35);
}

.app-navbar .navbar-toggler-icon {
    filter: invert(1);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.03em;
    font-size: 1rem;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.9);
}

.brand-icon {
    width: 2.35rem;
    height: 2.35rem;
    object-fit: contain;
    display: block;
}

.brand-logo {
    max-height: 2rem;
    width: auto;
    object-fit: contain;
    display: block;
}

.login-brand .brand-logo {
    max-height: 3rem;
}

.login-brand .brand-icon {
    width: 3rem;
    height: 3rem;
}

.app-nav .nav-link {
    color: rgba(255, 255, 255, 0.82);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    transition: background 0.13s ease, color 0.13s ease;
}

.app-nav .nav-link:hover,
.app-nav .nav-link:focus {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.app-nav .nav-link.active {
    background: #fff;
    color: var(--app-brand-deep) !important;
    font-weight: 600;
}

.app-nav .nav-link.active:hover {
    background: rgba(255, 255, 255, 0.92);
}

/* Active state for dropdown items */
.dropdown-menu-dark .dropdown-item.active,
.dropdown-menu-dark .dropdown-item:active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 0.3rem;
}

.app-user {
    text-align: right;
    color: #fff;
    padding: 0.35rem 0.75rem;
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.app-account-bar {
    min-width: max-content;
}

.user-name {
    font-weight: 600;
    line-height: 1.1;
}

.user-caption {
    font-size: 0.78rem;
    opacity: 0.88;
}

.app-logout {
    border-color: rgba(255, 255, 255, 0.82);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 0.2rem 0.75rem rgba(0, 0, 0, 0.1);
}

.app-logout:hover,
.app-logout:focus {
    border-color: #fff;
    background: #fff;
    color: var(--app-brand-deep);
}

.app-alert-stack {
    display: grid;
    gap: 0.65rem;
}

.app-alert {
    border: 0;
    box-shadow: 0 0.4rem 1.1rem rgba(18, 38, 58, 0.08);
}

.hero-panel {
    padding: 1.65rem;
    border-radius: 1.25rem;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.1), transparent 30%),
        linear-gradient(135deg, rgba(15, 76, 92, 0.98), rgba(11, 49, 66, 0.98));
    color: #fff;
    box-shadow: 0 1rem 2.4rem rgba(15, 49, 66, 0.16);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    opacity: 0.72;
    margin-bottom: 0.5rem;
}

.hero-title {
    font-size: clamp(2rem, 3vw, 2.8rem);
    font-weight: 700;
    margin-bottom: 0.45rem;
}

.hero-copy {
    max-width: 44rem;
    opacity: 0.84;
}

.hero-chip {
    padding: 0.6rem 0.95rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
    font-weight: 600;
}

.stat-card {
    border: 0;
    box-shadow: 0 0.35rem 1rem rgba(15, 23, 42, 0.08);
    border-radius: 1rem;
    background: linear-gradient(180deg, #fff 0%, #fbfcfd 100%);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.stat-card-link:hover .stat-card,
.stat-card-link:focus .stat-card {
    transform: translateY(-2px);
    box-shadow: 0 0.7rem 1.4rem rgba(15, 23, 42, 0.12);
}

.stat-card-attention {
    border-left: 3px solid var(--bs-warning, #ffc107);
}

.letter-spacing-wide {
    letter-spacing: 0.06em;
}

.tab-content .tab-pane {
    padding-top: 1.25rem;
}

.stat-label {
    color: var(--app-ink-soft);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.stat-foot {
    margin-top: 0.35rem;
    color: var(--app-ink-soft);
    font-size: 0.85rem;
}

.app-card,
.card {
    border: 1px solid var(--app-line);
    border-radius: 1rem;
    box-shadow: 0 0.35rem 1.2rem rgba(18, 38, 58, 0.06);
    color: var(--app-ink);
}

.app-card-header,
.card-header {
    background: linear-gradient(180deg, #fbfcfd 0%, #f4f7f9 100%);
    border-bottom: 1px solid var(--app-line);
    font-weight: 650;
    color: var(--app-ink);
}

/* ── Unify all Bootstrap button variants to the brand palette ─────────────── */

/* btn-primary → brand amber (replaces Bootstrap blue everywhere) */
.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--app-accent);
    --bs-btn-border-color: var(--app-accent);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #bf7532;
    --bs-btn-hover-border-color: #bf7532;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #b36e2e;
    --bs-btn-active-border-color: #b36e2e;
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--app-accent);
    --bs-btn-disabled-border-color: var(--app-accent);
}

/* btn-outline-primary → amber outline (open/view/download: secondary positive) */
.btn-outline-primary {
    --bs-btn-color: var(--app-accent);
    --bs-btn-border-color: var(--app-accent);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--app-accent);
    --bs-btn-hover-border-color: var(--app-accent);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #bf7532;
    --bs-btn-active-border-color: #bf7532;
}

/* app-primary-btn remains as an alias */
.app-primary-btn {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: #fff;
}

.app-primary-btn:hover,
.app-primary-btn:focus {
    background: #bf7532;
    border-color: #bf7532;
    color: #fff;
}

.app-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #e5edf2;
    color: var(--app-brand-deep);
    font-size: 0.82rem;
    font-weight: 600;
}

.table-link {
    color: var(--app-brand);
    font-weight: 600;
    text-decoration: none;
}

.table-link:hover {
    text-decoration: underline;
}

.table thead th {
    color: var(--app-ink-soft);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom-color: var(--app-line);
}

.table > :not(caption) > * > * {
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
}

.table-hover > tbody > tr:hover > * {
    background-color: rgba(22, 75, 99, 0.035);
}

.checksum {
    word-break: break-all;
    font-family: monospace;
}

details > summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
}

details > summary::-webkit-details-marker {
    display: none;
}

details.border {
    background: rgba(255, 255, 255, 0.72);
    border-color: var(--app-line) !important;
    box-shadow: 0 0.35rem 1rem rgba(15, 23, 42, 0.05);
    color: var(--app-ink);
}

details > summary.bg-light {
    background: linear-gradient(180deg, #fbfcfd 0%, #f4f7f9 100%) !important;
    color: var(--app-ink);
}

.app-soft-panel {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--app-line);
    border-radius: 1rem;
    box-shadow: 0 0.35rem 1rem rgba(15, 23, 42, 0.05);
    color: var(--app-ink);
}

.bg-light,
.bg-light-subtle,
.list-group-item,
.table,
.form-control,
.form-select {
    color: var(--app-ink);
}

.bg-dark,
.app-navbar,
.hero-panel {
    color: #fff;
}

.table .text-muted,
.card .text-muted,
.app-soft-panel .text-muted,
details.border .text-muted {
    color: var(--app-ink-soft) !important;
}

.btn,
.form-control,
.form-select {
    border-radius: 0.8rem;
}

.form-label {
    font-weight: 600;
    color: var(--app-ink);
    margin-bottom: 0.35rem;
}

.form-text {
    color: var(--app-ink-soft);
}

.app-soft-panel .form-check {
    padding-left: 1.6rem;
}

.app-soft-panel .form-check-input {
    margin-top: 0.18rem;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(22, 75, 99, 0.5);
    box-shadow: 0 0 0 0.25rem rgba(22, 75, 99, 0.12);
}

.btn-primary,
.btn-outline-primary,
.app-primary-btn {
    box-shadow: 0 0.35rem 0.9rem rgba(201, 119, 53, 0.18);
}

.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-danger {
    border-width: 1.5px;
}

.app-soft-panel .form-control,
.app-soft-panel .form-select,
.card .form-control,
.card .form-select {
    background-color: #fff;
}

.review-page {
    display: grid;
    gap: 1rem;
}

.review-workspace {
    --review-preview-width: 58%;
    display: flex;
    min-height: 72vh;
    border: 1px solid var(--app-line);
    border-radius: 1rem;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 0.35rem 1rem rgba(15, 23, 42, 0.05);
}

.review-pane {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.review-pane-preview {
    width: var(--review-preview-width);
    min-width: 20rem;
    background: #eef3f7;
}

.review-pane-sidebar {
    flex: 1 1 auto;
    min-width: 22rem;
    background: #fff;
    overflow: auto;
}

.review-splitter {
    width: 0.8rem;
    cursor: col-resize;
    background: linear-gradient(180deg, #dce5ec 0%, #c6d2dc 100%);
    border-inline: 1px solid rgba(18, 38, 58, 0.08);
}

.review-splitter:hover {
    background: linear-gradient(180deg, #d1dde7 0%, #bcc9d4 100%);
}

.review-split-active {
    cursor: col-resize;
    user-select: none;
}

.review-pane-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid rgba(18, 38, 58, 0.08);
}

.review-pane-title {
    font-weight: 700;
}

.review-pane-subtitle {
    color: var(--app-ink-soft);
    font-size: 0.9rem;
}

.review-preview-frame {
    flex: 1 1 auto;
    min-height: 30rem;
    background: linear-gradient(180deg, #dde7ef 0%, #f6f9fb 100%);
}

.review-preview-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.review-preview-empty {
    display: grid;
    place-items: center;
    height: 100%;
    padding: 2rem;
    text-align: center;
}

.review-summary-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    padding: 1rem;
}

.review-summary-chip {
    padding: 0.85rem 1rem;
    border-radius: 0.9rem;
    background: #f4f7f9;
    border: 1px solid var(--app-line);
}

.review-summary-chip span {
    display: block;
    color: var(--app-ink-soft);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.review-summary-chip strong {
    display: block;
    margin-top: 0.25rem;
}

.review-comments-panel,
.review-existing-comments,
.review-foldout {
    margin-inline: 1rem;
}

.review-comments-panel {
    padding: 1rem;
    border: 1px solid var(--app-line);
    border-radius: 1rem;
    background: #fbfcfd;
}

.review-comments-header {
    margin-bottom: 1rem;
}

.review-entry-table {
    margin-bottom: 0;
}

.review-entry-table th {
    background: #f3f6f8;
    position: sticky;
    top: 0;
}

.review-entry-table textarea {
    min-height: 4.5rem;
    resize: vertical;
}

.review-comment-card {
    padding: 1rem;
    border: 1px solid var(--app-line);
    border-radius: 1rem;
    background: #fff;
}

.review-comment-meta,
.review-comment-tags {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.review-comment-tags {
    margin-top: 0.6rem;
}

.review-comment-body {
    margin-top: 0.75rem;
    white-space: pre-wrap;
}

.review-response-block {
    margin-top: 0.85rem;
    padding: 0.85rem 1rem;
    border-left: 3px solid var(--app-accent);
    background: #fbf7f2;
    border-radius: 0.75rem;
}

.review-foldout {
    border: 1px solid var(--app-line);
    border-radius: 1rem;
    background: #fbfcfd;
}

.review-foldout summary {
    padding: 0.9rem 1rem;
    font-weight: 650;
}

.review-foldout-body {
    padding: 0 1rem 1rem;
}

@media (max-width: 991.98px) {
    .review-workspace {
        display: grid;
        min-height: auto;
    }

    .review-pane-preview,
    .review-pane-sidebar {
        width: 100%;
        min-width: 0;
    }

    .review-splitter {
        display: none;
    }

    .review-preview-frame {
        min-height: 24rem;
    }
}

/* ── Settings page ── */
html { scrollbar-gutter: stable; }
.settings-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}
.settings-status .item {
    border: 1px solid #dbe3ef;
    border-radius: 0.75rem;
    background: #f8fbff;
    padding: 0.75rem 1rem;
}
.settings-shell {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1rem;
}
.settings-shell .tab-content { min-height: 72vh; }
.settings-side .list-group-item {
    border-radius: 0.625rem;
    margin-bottom: 0.35rem;
    border: 1px solid #dbe3ef;
}
.settings-side .list-group-item.active {
    background: #0d6efd;
    border-color: #0d6efd;
}
@media (max-width: 991px) {
    .settings-shell { grid-template-columns: 1fr; }
}

/* ── Engineer workspace ── */
.engineer-shell { max-width: 980px; margin: 0 auto; padding: 1rem; }
.engineer-top { display: flex; gap: .75rem; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.engineer-badge { border-radius: 999px; padding: .25rem .7rem; font-size: .85rem; font-weight: 600; }
.engineer-badge.online { background: #0f5132; color: #d1e7dd; }
.engineer-badge.offline { background: #664d03; color: #fff3cd; }
.engineer-card { background: #12263f; border: 1px solid #21446e; border-radius: 12px; padding: .9rem; margin-bottom: .7rem; color: #f7fbff; }
.engineer-card h3 { margin: 0 0 .4rem 0; font-size: 1rem; }
.engineer-meta { font-size: .85rem; opacity: .85; }
.engineer-empty { opacity: .75; font-size: .95rem; margin-top: 1rem; }
.engineer-btn {
    appearance: none;
    border: 1px solid #95b4da;
    background: transparent;
    color: #f7fbff;
    border-radius: 8px;
    padding: .35rem .65rem;
    font-size: .85rem;
    cursor: pointer;
}
.engineer-btn:hover { background: rgba(149, 180, 218, 0.15); }
.engineer-actions { margin-top: .75rem; display: flex; gap: .5rem; }

/* ── TQ editor (form) ── */
.tq-box {
    position: relative;
    min-height: 300px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}
.tq-box.drag-over { border-color: #4f6ef7; background: #f5f7ff; }
.tq-text {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    padding: 10px 12px;
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.7;
    color: #1e293b;
    min-height: 300px;
}
.tq-text:empty:before { content: attr(data-placeholder); color: #94a3b8; pointer-events: none; }
.tq-img-wrap {
    position: absolute;
    z-index: 2;
    cursor: move;
    user-select: none;
    touch-action: none;
}
.tq-img-wrap img {
    display: block;
    max-width: 500px;
    max-height: 400px;
    border-radius: 4px;
    border: 2px solid transparent;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.tq-img-wrap:hover img { border-color: #4f6ef7; }
.tq-img-del {
    display: none;
    position: absolute;
    top: -9px; right: -9px;
    width: 22px; height: 22px;
    background: #ef4444; color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    font-size: 14px; line-height: 1;
    cursor: pointer;
    align-items: center; justify-content: center;
    padding: 0; z-index: 3;
}
.tq-img-wrap:hover .tq-img-del { display: flex; }
.tq-img-resize {
    display: none;
    position: absolute;
    bottom: -1px; right: -1px;
    width: 14px; height: 14px;
    background: #4f6ef7;
    border-radius: 3px 0 3px 0;
    cursor: se-resize;
    z-index: 3;
}
.tq-img-wrap:hover .tq-img-resize { display: block; }

/* ── TQ detail view ── */
.snag-desc-view { line-height: 1.7; color: #1e293b; }
.snag-desc-view p { white-space: pre-wrap; word-break: break-word; margin-bottom: 0.5rem; }
.snag-desc-imgs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.snag-desc-imgs img { max-width: 100%; max-height: 400px; border-radius: 4px; border: 1px solid #e2e8f0; box-shadow: 0 2px 8px rgba(0,0,0,.1); object-fit: contain; }
.tq-description-legacy { white-space: pre-wrap; line-height: 1.7; }
.tq-description-legacy img { max-width: 100%; display: block; margin: 6px 0; border-radius: 4px; border: 1px solid #e2e8f0; }

/* Feedback floating button */
.feedback-float-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 1040;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #4f6ef7;
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(79,110,247,.45);
    cursor: pointer;
    transition: background 0.15s, transform 0.12s;
}
.feedback-float-btn:hover { background: #3a54d0; transform: scale(1.08); }
.feedback-float-btn:focus-visible { outline: 3px solid #a5b4fc; outline-offset: 2px; }

/* ── Equipment calibration stat cards ── */
.eq-card-overdue  { border-left: 4px solid #dc3545 !important; }
.eq-card-due-soon { border-left: 4px solid #fd7e14 !important; }
.eq-card-current  { border-left: 4px solid #198754 !important; }
.eq-card-uncert   { border-left: 4px solid #6c757d !important; }
.eq-stat-lbl { font-size: .7rem; letter-spacing: .06em; }
.eq-stat-val { font-size: 2rem; line-height: 1; }
.text-warning-orange { color: #fd7e14 !important; }

/* ── Table header accent ── */
.tbl-head-subtle { background: #f8fafc !important; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #64748b; }

/* ── Font-size utilities ── */
.fs-65  { font-size: .65rem !important; }
.fs-72  { font-size: .72rem !important; }
.fs-75  { font-size: .75rem !important; }
.fs-77  { font-size: .77rem !important; }
.fs-80  { font-size: .80rem !important; }
.fs-82  { font-size: .82rem !important; }
.fs-83  { font-size: .83rem !important; }
.fs-85  { font-size: .85rem !important; }
.fs-875 { font-size: .875rem !important; }
.fs-90  { font-size: .9rem !important; }
.fs-150 { font-size: 1.5rem !important; }
.fs-200 { font-size: 2rem !important; }
.fs-250 { font-size: 2.5rem !important; }

/* ── Max-width card wrappers ── */
.mw-220  { max-width: 220px; }
.mw-280  { max-width: 280px; }
.mw-420  { max-width: 420px; }
.mw-500  { max-width: 500px; }
.mw-520  { max-width: 520px; }
.mw-560  { max-width: 560px; }
.mw-600  { max-width: 600px; }
.mw-640  { max-width: 640px; }
.mw-720  { max-width: 720px; }
.mw-760  { max-width: 760px; }
.mw-900  { max-width: 900px; }
.mw-960  { max-width: 960px; }
.mw-980  { max-width: 980px; }
.mw-1200 { max-width: 1200px; }

/* ── Overflow / scroll utilities ── */
.mh-280-scroll  { max-height: 280px; overflow: auto; }
.mh-220-scroll  { max-height: 220px; overflow-y: auto; }
.mh-420-scroll  { max-height: 420px; overflow-y: auto; }
.mh-70vh-scroll { max-height: 70vh; overflow: auto; }
.mh-5em-clip    { max-height: 5em; overflow: hidden; }
.pre-wrap       { white-space: pre-wrap; }
.min-w-0        { min-width: 0 !important; }

/* ── Clickable row cursor ── */
[data-href] { cursor: pointer; }

/* ── Media attachment thumbnail ── */
.media-thumb { max-height: 200px; max-width: 300px; border-radius: 6px; border: 1px solid #e2e8f0; object-fit: cover; }

/* ── Gantt chart ── */
.gantt-dot { display: inline-block; width: 14px; height: 14px; }

/* ── Badge sizing ── */
.badge-lg { font-size: .9rem !important; padding: .5em 1em !important; }

/* ── Line-height tight ── */
.lh-1 { line-height: 1 !important; }

/* ── Filter bar ── */
.filter-select-sm { font-size: .82rem; padding: .35rem .65rem; }
.filter-input-sm  { min-width: 220px; }

/* ── Equipment check-list labels (shared across kit pages) ── */
.eq-cat-hdr    { font-size: .7rem; letter-spacing: .06em; }
.eq-item-label { cursor: pointer; }
.eq-badge-xs   { font-size: .62rem; }
.eq-meta-xs    { font-size: .72rem; }
.eq-sel-badge  { font-size: .72rem; }

/* ── Mobile optimisations ────────────────────────────────────────────────── */

/* Projects list: phones get a compact filter strip and card rows. Tablets and
   desktop keep the existing filter/table layout via Bootstrap's sm breakpoint. */
@media (max-width: 575.98px) {
    .project-filter-card {
        padding: .75rem !important;
        border-radius: .85rem;
    }

    .project-filter-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: end;
    }

    .project-filter-grid > [class*="col-"] {
        width: auto;
        max-width: none;
        padding-left: calc(var(--bs-gutter-x) * .5);
        padding-right: calc(var(--bs-gutter-x) * .5);
    }

    .project-filter-grid label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .project-filter-search { grid-column: 1; grid-row: 1; }
    .project-filter-submit { grid-column: 2; grid-row: 1; }
    .project-filter-field { grid-column: span 1; }
    .project-filter-sort { grid-column: 1 / -1; }

    .project-filter-search .form-control,
    .project-filter-field .form-select,
    .project-filter-submit .btn {
        min-height: 2.15rem;
    }

    .project-filter-submit .btn {
        width: auto !important;
        padding-left: .9rem;
        padding-right: .9rem;
    }

    .project-mobile-card {
        border-radius: .85rem;
    }

    .project-mobile-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .5rem;
    }

    .project-mobile-actions .btn {
        width: 100%;
    }

    .equipment-filter-card {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: .5rem;
        align-items: stretch;
    }

    .equipment-filter-search {
        grid-column: 1;
        min-width: 0;
    }

    .equipment-filter-search .filter-input-sm {
        width: 100%;
        min-width: 0;
    }

    .equipment-filter-submit {
        grid-column: 2;
        width: auto;
        padding-left: .9rem;
        padding-right: .9rem;
    }

    .equipment-filter-field,
    .equipment-filter-card > a.filter-btn {
        grid-column: span 1;
        min-width: 0;
        width: 100%;
    }

    .equipment-mobile-card {
        border-radius: .85rem;
    }
}

/* Project detail/settings: replace the long horizontal tab strip with one
   phone-only section picker, and make the header occupy much less vertical room. */
@keyframes projectMobileHeaderIn {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes projectMobilePickerIn {
    from { opacity: 0; transform: translateY(16px) scale(.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes projectPaneSoftIn {
    from { opacity: .45; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 575.98px) {
    .app-navbar {
        position: static;
    }

    .app-navbar .app-nav-inner {
        padding-top: .35rem !important;
        padding-bottom: .35rem !important;
    }

    .app-brand .brand-icon {
        height: 1.55rem;
        width: auto;
    }

    .app-main {
        padding-top: .75rem !important;
    }

    .project-detail-header {
        align-items: center !important;
        flex-wrap: nowrap !important;
        margin-bottom: .32rem !important;
        gap: .28rem !important;
        animation: projectMobileHeaderIn .34s cubic-bezier(.16, 1, .3, 1) both;
    }

    .project-detail-header > .min-w-0 {
        flex: 1 1 auto;
        min-width: 0;
    }

    .project-detail-header h1 {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: .96rem;
        line-height: 1;
        margin-bottom: 0 !important;
    }

    .project-detail-back-link {
        margin-bottom: .03rem !important;
        font-size: .68rem;
        line-height: 1;
    }

    .project-detail-title {
        display: none;
    }

    .project-detail-actions {
        flex: 0 0 auto;
        width: auto;
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: .25rem !important;
    }

    .project-detail-actions .btn {
        width: auto;
        padding: .18rem .38rem;
        border-radius: 999px;
        font-size: .68rem;
        line-height: 1.05;
        white-space: nowrap;
        transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
    }

    .project-detail-actions .btn:active {
        transform: scale(.94);
    }

    .project-mobile-section-nav {
        position: sticky;
        top: .45rem;
        z-index: 20;
        padding: .46rem;
        border: 1px solid rgba(31, 78, 121, .14);
        border-radius: 1rem;
        background: linear-gradient(135deg, rgba(255,255,255,.98), rgba(246,249,252,.94));
        box-shadow: 0 .65rem 1.65rem rgba(15, 23, 42, .14);
        animation: projectMobilePickerIn .38s cubic-bezier(.16, 1, .3, 1) .04s both;
        backdrop-filter: blur(12px);
    }

    .project-mobile-section-eyebrow {
        margin: 0 0 .22rem .18rem;
        color: var(--app-ink-soft);
        font-size: .66rem;
        font-weight: 700;
        letter-spacing: .08em;
        text-transform: uppercase;
    }

    .project-section-select-shell {
        position: relative;
        display: flex;
        align-items: center;
        min-height: 2.48rem;
        overflow: hidden;
        border: 1px solid rgba(31, 78, 121, .18);
        border-radius: .82rem;
        background: #fff;
        transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
    }

    .project-section-select-shell:focus-within {
        border-color: rgba(31, 78, 121, .55);
        box-shadow: 0 0 0 .2rem rgba(31, 78, 121, .12);
        transform: translateY(-1px);
    }

    .project-section-select-icon {
        position: absolute;
        left: .78rem;
        color: #1F4E79;
        font-size: 1rem;
        pointer-events: none;
        transition: transform .16s ease;
    }

    .project-section-select-shell:focus-within .project-section-select-icon {
        transform: rotate(6deg) scale(1.08);
    }

    .project-section-select {
        min-height: 2.45rem;
        padding-left: 2.15rem;
        border: 0;
        border-radius: .82rem;
        background-color: transparent;
        color: var(--app-ink, #212529);
        font-weight: 700;
        box-shadow: none !important;
    }

    .project-section-select:focus {
        box-shadow: none;
    }

    .tab-content.project-section-changing,
    [data-project-tab-pane].project-section-changing {
        animation: projectPaneSoftIn .32s cubic-bezier(.16, 1, .3, 1) both;
    }
}

@media (max-width: 575.98px) and (prefers-reduced-motion: reduce) {
    .project-detail-header,
    .project-mobile-section-nav,
    .tab-content.project-section-changing,
    [data-project-tab-pane].project-section-changing {
        animation: none !important;
    }

    .project-detail-actions .btn,
    .project-section-select-shell,
    .project-section-select-icon {
        transition: none !important;
    }
}

/* Nav tabs: scroll horizontally on narrow screens instead of wrapping */
@media (max-width: 767.98px) {
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 1px; /* prevent bottom border clip */
    }
    .nav-tabs::-webkit-scrollbar { display: none; }
    .nav-tabs .nav-item { flex-shrink: 0; }
    .nav-tabs .nav-link { white-space: nowrap; }
}

/* Account bar: min-width only needed when user name chip is visible */
@media (max-width: 767.98px) {
    .app-account-bar { min-width: 0; }
}

/* App main: ensure comfortable side padding on phones */
@media (max-width: 575.98px) {
    .app-main {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

/* Feedback float button: tuck in closer on small screens */
@media (max-width: 575.98px) {
    .feedback-float-btn {
        bottom: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
    }
}

/* Onboarding step num — tighten spacing on phone */
@media (max-width: 575.98px) {
    .onboarding-step-num { width: 24px; height: 24px; }
}

/* ── Site Photo Register ── */
.photo-thumb { height: 80px; width: 80px; object-fit: cover; }
.photo-card { display: inline-block; position: relative; margin-right: 8px; margin-bottom: 8px; vertical-align: top; }
.photo-card-caption { font-size: 0.7rem; max-width: 80px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #6c757d; }
.photo-delete-btn { position: absolute; top: 0; right: 0; width: 16px; height: 16px; min-width: unset; font-size: 0.65rem; line-height: 1; padding: 0; }
.photo-upload-label { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 80px; width: 80px; cursor: pointer; font-size: 0.7rem; text-align: center; border: 1px dashed #adb5bd; border-radius: 4px; color: #6c757d; }
.photo-cat-label { min-width: 110px; }

