/* ============================================================
   Nauta design system — Field PWA (mobile-first)
   Same brand tokens as the web portal (src/Nauta.Web/wwwroot/app.css)
   ============================================================ */

:root {
    --nauta-navy-900: #0f1433;
    --nauta-navy-800: #10163a;
    --nauta-navy-700: #1b2240;
    --nauta-violet-900: #2a0a3d;
    --nauta-violet-700: #3d0d54;
    --nauta-violet-500: #5b2a7d;
    --nauta-accent: #8b6fd0;
    --nauta-primary: #35427c;
    --nauta-primary-hover: #2c3568;
    --nauta-primary-active: #232a52;
    --nauta-surface: #f4f6fa;
    --nauta-card: #ffffff;
    --nauta-border: #e6e9f2;
    --nauta-text: #232838;
    --nauta-text-muted: #6b7280;
}

html, body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background-color: var(--nauta-surface);
    color: var(--nauta-text);
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: var(--nauta-primary);
}

.text-muted {
    color: var(--nauta-text-muted) !important;
}

h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--nauta-navy-800);
    letter-spacing: -0.01em;
}

/* ---- Cards ---- */
.card {
    border: 0;
    border-radius: 10px;
    background: var(--nauta-card);
    box-shadow: 0 1px 3px rgba(16, 22, 58, .08), 0 4px 18px rgba(16, 22, 58, .05);
}

/* ---- Alerts ---- */
.alert {
    border: 0;
    border-radius: 8px;
    border-left: 4px solid transparent;
}

.alert-danger {
    background: #fdecec;
    color: #8f1d1d;
    border-left-color: #d64545;
}

.alert-success {
    background: #e8f6ee;
    color: #14532d;
    border-left-color: #2f9e5f;
}

/* ---- Buttons ---- */
.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--nauta-primary) 0%, var(--nauta-violet-500) 100%);
    border: 0;
}

.btn-primary:hover, .btn-primary:active {
    filter: brightness(1.1);
    background: linear-gradient(135deg, var(--nauta-primary) 0%, var(--nauta-violet-500) 100%);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(139, 111, 208, .3);
}

.form-control {
    border-color: var(--nauta-border);
    border-radius: 8px;
}

.form-control:focus {
    border-color: var(--nauta-accent);
}

/* The authentication library's own reason for a failed handshake. Quieter than the
   sentence above it: the surveyor cannot act on it, but whoever they call can. */
.auth-reason {
    color: var(--nauta-text-muted);
    font-size: .85rem;
    margin-bottom: 1rem;
}

/* This app has no sign-in screen of its own since #11 — credentials are only ever
   typed into the authorization server's page, which carries its own styling and the
   vendor credit with it. The .login-* rules that used to live here went with it. */

/* ---- Mission list ---- */
.mission-card {
    display: block;
    text-decoration: none;
    color: var(--nauta-text);
    transition: transform .08s ease, box-shadow .08s ease;
}

.mission-card:active {
    transform: scale(.99);
}

.mission-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    margin-bottom: .15rem;
}

.mission-number {
    color: var(--nauta-navy-800);
    font-weight: 700;
}

.mission-vessel {
    font-weight: 600;
    color: var(--nauta-navy-700);
}

.mission-meta {
    color: var(--nauta-text-muted);
    font-size: .88rem;
}

/* ---- Status badges ---- */
.status-badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .02em;
    border-radius: 6px;
    padding: .3em .6em;
    background: #eceef5;
    color: var(--nauta-navy-700);
    white-space: nowrap;
}

.status-badge.status-inprogress {
    background: #ecebf7;
    color: var(--nauta-violet-500);
}

.status-badge.status-awaitingdocuments, .status-badge.status-awaitingquote {
    background: #fdf5e2;
    color: #7a5410;
}

.status-badge.status-quoterefused, .status-badge.status-notcovered {
    background: #fdecec;
    color: #8f1d1d;
}

.status-badge.status-completed {
    background: #e8f6ee;
    color: #14532d;
}

/* Closed reads as finished-and-filed, a step further than Completed's "field work
   done, report pending" — keep the two distinguishable. Mirrors the portal. */
.status-badge.status-closed {
    background: #e2e5ee;
    color: var(--nauta-navy-800);
}

/* ---- Vendor credit ----
   Below the content rather than pinned: screen height is scarce in the field and a
   fixed bar would eat a checklist row on every page. */
.app-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: 1.75rem 0 1.25rem;
    color: var(--nauta-text-muted);
    font-size: .7rem;
}

/* Sized by the asset, not by the text: the lockup is 3.25:1 and its wordmark is a
   quarter of that height, so anything under ~2rem renders "TreeCatch" illegibly. */
.app-footer img {
    height: 2rem;
    opacity: .75;
}

.status-badge.status-closed {
    background: #e2e5ee;
    color: var(--nauta-navy-800);
}

/* ---- Checklist (mission detail) ---- */
/* ---- Checklist navigation (#46) ----
   86 items across 7 sections is a thumb-hunt as one column; the filter and the
   collapsed sections are what make it findable. */
.checklist-tools {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin: .75rem 0 .25rem;
}

.checklist-tools .form-control {
    flex: 1 1 auto;
}

.checklist-toggle {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex: 0 0 auto;
    margin: 0;
    font-size: .8rem;
    color: var(--nauta-text-muted);
    white-space: nowrap;
}

.checklist-section-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    margin: .75rem 0 .4rem;
    padding: .6rem .75rem;
    border: 1px solid #dfe3ee;
    border-radius: 10px;
    background: #f6f7fb;
    font-size: .95rem;
    font-weight: 650;
    color: var(--nauta-navy-700);
    text-align: left;
}

    .checklist-section-header.open {
        background: #eceef7;
    }

    .checklist-section-header .chevron {
        flex: 0 0 auto;
        color: var(--nauta-text-muted);
        font-size: .8rem;
    }

    .checklist-section-header .section-name {
        flex: 1 1 auto;
    }

/* The count is the "is there work left here" signal, so it stays legible when the
   section is shut — muted once nothing is outstanding. */
.section-count {
    flex: 0 0 auto;
    font-size: .78rem;
    font-weight: 600;
    color: #7a5410;
    background: #fdf5e2;
    border-radius: 6px;
    padding: .15em .5em;
}

    .section-count.complete {
        color: #14532d;
        background: #e8f6ee;
    }

.checklist-section {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 1.3rem 0 .6rem;
    font-size: .95rem;
    font-weight: 650;
    color: var(--nauta-navy-700);
}

.checklist-section::before {
    content: "";
    width: 4px;
    height: 1.05rem;
    border-radius: 2px;
    background: var(--nauta-accent);
}

.checklist-item.answered {
    border-left: 3px solid #2f9e5f;
}

.checklist-item .btn-group .btn {
    padding-top: .55rem;
    padding-bottom: .55rem;
}

.saved-at {
    color: var(--nauta-text-muted);
    font-size: .78rem;
}

/* Photo checklist items */
.photo-strip {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .6rem;
}

.photo-thumb {
    position: relative;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 8px;
    overflow: hidden;
    background: #eceef5;
    border: 1px solid var(--nauta-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .photo-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.photo-thumb-name {
    font-size: .6rem;
    color: var(--nauta-text-muted);
    padding: .2rem;
    overflow: hidden;
    text-align: center;
    word-break: break-all;
}

.photo-gps {
    position: absolute;
    right: 2px;
    bottom: 2px;
    font-size: .7rem;
    filter: drop-shadow(0 0 2px #fff);
}

.btn-outline-primary {
    color: var(--nauta-primary);
    border-color: var(--nauta-primary);
}

    .btn-outline-primary:hover, .btn-outline-primary:active {
        background: var(--nauta-primary);
        border-color: var(--nauta-primary);
        color: #fff;
    }

/* Sticky submit bar */
.submit-bar {
    position: sticky;
    bottom: 0;
    padding: .75rem 0 max(.75rem, env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(244, 246, 250, 0) 0%, var(--nauta-surface) 30%);
}

/* ---- Blazor plumbing ---- */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
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TI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: var(--nauta-border);
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: var(--nauta-violet-500);
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
    color: var(--nauta-navy-800);
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}
