:root {
    --brand: #1e3a5f;
    --brand-dark: #152a45;
}

body {
    background: #f4f6f9;
}

body.guest {
    background: linear-gradient(160deg, #1e3a5f 0%, #2d5a8a 100%);
    min-height: 100vh;
}

.app-nav {
    background: var(--brand);
}

.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-dark);
    --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-active-bg: var(--brand-dark);
    --bs-btn-active-border-color: var(--brand-dark);
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
}

.btn-outline-primary {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-dark);
    --bs-btn-active-border-color: var(--brand-dark);
}

.nav-tabs,
.nav-pills {
    --bs-nav-link-color: #245a93;
    --bs-nav-link-hover-color: var(--brand-dark);
    --bs-nav-pills-link-active-bg: var(--brand);
}

.form-check-input:checked {
    background-color: var(--brand);
    border-color: var(--brand);
}

a {
    color: #245a93;
}

.card {
    border: 0;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .08);
}

.card-header {
    background: #fff;
    font-weight: 600;
    border-bottom: 1px solid #edf0f3;
}

.table > :not(caption) > * > * {
    padding: .6rem .75rem;
}

.table thead th {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #6b7280;
    background: #fafbfc;
    white-space: nowrap;
}

.auth-card {
    max-width: 420px;
    margin: 8vh auto 0;
}

.stat {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7280;
}

.unit-photo {
    width: 100%;
    height: 190px;
    object-fit: cover;
    background: #e9edf2;
}

.unit-photo-empty {
    height: 190px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #a8b3c2;
    background: #e9edf2;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .75rem;
}

.photo-grid img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: .375rem;
}

.feature-chip {
    display: inline-block;
    background: #e8f0f9;
    color: var(--brand);
    border-radius: 999px;
    padding: .15rem .65rem;
    font-size: .8rem;
    margin: 0 .25rem .25rem 0;
}

.message {
    border-radius: .5rem;
    padding: .75rem 1rem;
    margin-bottom: .75rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message.staff {
    background: #eef4fb;
    border-color: #d5e3f3;
}

.message .who {
    font-size: .8rem;
    color: #6b7280;
    white-space: normal;
    margin-bottom: .25rem;
}

.address-box {
    background: #f8fafc;
    border: 1px dashed #c5cfdb;
    border-radius: .5rem;
    padding: .75rem 1rem;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 1rem 0;
    color: #98a2b3;
    font-size: .85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid #e4e7ec;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #dadce0;
    color: #3c4043;
    font-weight: 500;
}

.btn-google:hover {
    background: #f8f9fa;
    border-color: #c6c9ce;
    color: #202124;
}

.pick-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: .375rem;
}

.pick-row {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .45rem .75rem;
    border-bottom: 1px solid #f0f2f4;
    cursor: pointer;
}

.pick-row[hidden] {
    display: none;
}

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

.pick-row:hover {
    background: #f8fafc;
}

.pick-row .form-check-input {
    margin: 0;
    flex: 0 0 auto;
}

.contract-frame {
    width: 100%;
    height: 70vh;
    min-height: 420px;
    border: 1px solid #dee2e6;
    border-radius: .375rem;
    background: #f8fafc;
}

.signature-pad {
    display: block;
    width: 100%;
    height: 170px;
    background: #fff;
    border: 1px dashed #98a2b3;
    border-radius: .375rem;
    cursor: crosshair;
    touch-action: none;
}

.signature-pad:focus {
    outline: 2px solid #86b6ef;
    outline-offset: 1px;
}

.signature-pad.is-invalid {
    border-color: #d03b3b;
}

.signature-image {
    display: block;
    width: 100%;
    max-width: 320px;
    border: 1px solid #e4e7ec;
    border-radius: .375rem;
    background: #fff;
}

.signature-thumb {
    display: block;
    width: 130px;
    height: auto;
    border: 1px solid #e4e7ec;
    border-radius: .25rem;
    background: #fff;
}

/* ---- project budget charts ---- */

.viz-title {
    font-size: .95rem;
    font-weight: 600;
    margin-bottom: .75rem;
}

.viz-status-critical {
    color: #d03b3b;
}

.viz-meter {
    height: 14px;
    background: #cde2fb;
    border-radius: 7px;
    overflow: hidden;
}

.viz-meter-fill {
    height: 100%;
    background: #2a78d6;
    border-radius: 7px 4px 4px 7px;
}

.viz-meter.over {
    background: #f6d5d5;
}

.viz-meter.over .viz-meter-fill {
    background: #d03b3b;
}

.viz-stack {
    display: flex;
    gap: 2px;
    height: 22px;
}

.viz-seg {
    min-width: 4px;
    border-radius: 4px;
    cursor: default;
}

.viz-seg:hover,
.viz-seg:focus,
.viz-bar-row:hover .viz-bar,
.viz-bar-row:focus .viz-bar {
    filter: brightness(.9);
    outline: none;
}

.viz-legend {
    list-style: none;
    padding: 0;
    margin: .9rem 0 0;
}

.viz-legend li {
    display: flex;
    align-items: baseline;
    gap: .6rem;
    padding: .3rem 0;
    border-top: 1px solid #eef0f3;
    font-size: .92rem;
}

.viz-legend li:first-child {
    border-top: 0;
}

.viz-swatch {
    flex: 0 0 12px;
    height: 12px;
    border-radius: 3px;
    align-self: center;
}

.viz-legend-name {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.viz-legend-value,
.viz-legend-pct,
.viz-bar-value {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.viz-legend-pct {
    flex: 0 0 3rem;
    text-align: right;
    color: #6b7280;
}

.viz-bars {
    display: grid;
    gap: .55rem;
}

.viz-bar-row {
    display: grid;
    grid-template-columns: minmax(0, 34%) 1fr auto;
    align-items: center;
    gap: .6rem;
    font-size: .92rem;
    outline: none;
}

.viz-bar-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.viz-bar {
    height: 14px;
    min-width: 3px;
    background: #2a78d6;
    border-radius: 0 4px 4px 0;
}

.viz-line {
    display: block;
    width: 100%;
    min-width: 640px;
    max-width: 900px;
    height: auto;
    margin: 0 auto;
    overflow: visible;
}

.viz-scroll {
    overflow-x: auto;
}

.viz-line text {
    font-family: inherit;
}

.viz-grid {
    stroke: #e1e0d9;
    stroke-width: 1;
}

.viz-axis {
    stroke: #c3c2b7;
    stroke-width: 1;
}

.viz-tick {
    fill: #6b7280;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.viz-path {
    fill: none;
    stroke: #2a78d6;
    stroke-width: 2;
    stroke-linejoin: round;
}

.viz-dot {
    fill: #2a78d6;
    stroke: #fff;
    stroke-width: 2;
}

.viz-hit {
    fill: transparent;
}

.viz-line g {
    outline: none;
    cursor: default;
}

.viz-line g:hover .viz-dot,
.viz-line g:focus .viz-dot {
    r: 6;
}

.viz-end {
    fill: #111827;
    font-size: 13px;
    font-weight: 600;
}

.viz-tip {
    position: absolute;
    z-index: 1080;
    max-width: 280px;
    background: #111827;
    color: #fff;
    font-size: .8rem;
    line-height: 1.35;
    padding: .4rem .6rem;
    border-radius: .375rem;
    pointer-events: none;
}

@media (max-width: 575.98px) {
    main.container-xl {
        padding-top: 1rem !important;
    }

    h1.h3 {
        font-size: 1.35rem;
    }

    .stat {
        font-size: 1.3rem;
    }

    .card-body.p-4 {
        padding: 1rem !important;
    }

    .auth-card {
        margin-top: 4vh;
    }

    .unit-photo,
    .unit-photo-empty {
        height: 160px;
    }

    .nav-tabs,
    .nav-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .nav-tabs .nav-link {
        padding: .5rem .7rem;
    }

    .table-stack thead {
        display: none;
    }

    .table-stack,
    .table-stack tbody,
    .table-stack tfoot {
        display: block;
    }

    .table-stack tbody tr {
        display: block;
        padding: .7rem .9rem;
        border-bottom: 1px solid #e7eaee;
    }

    .table-stack tbody tr:last-child {
        border-bottom: 0;
    }

    .table-stack tbody td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 1rem;
        padding: .16rem 0;
        border: 0;
        background: none;
        box-shadow: none;
        text-align: right;
        white-space: normal !important;
    }

    .table-stack tbody td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-size: .72rem;
        text-transform: uppercase;
        letter-spacing: .03em;
        color: #6b7280;
        text-align: left;
    }

    .table-stack tbody td:first-child {
        font-weight: 600;
    }

    .table-stack tbody td.cell-empty {
        display: none;
    }

    .table-stack tbody td[data-label=""] {
        justify-content: flex-end;
        padding-top: .45rem;
    }

    .table-stack tbody td[data-label=""]::before {
        display: none;
    }

    .table-stack tfoot tr {
        display: flex;
        justify-content: space-between;
        padding: .7rem .9rem;
        border-top: 2px solid #e7eaee;
    }

    .table-stack tfoot th {
        display: block;
        padding: 0;
        border: 0;
        box-shadow: none;
    }

    .table-stack tfoot th:empty {
        display: none;
    }
}

@media print {
    body {
        background: #fff;
    }

    .viz-meter,
    .viz-meter-fill,
    .viz-seg,
    .viz-bar,
    .viz-swatch {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .card {
        box-shadow: none;
    }
}
