/* ============================================================
   CSS custom properties — auto dark/light mode
   Uses prefers-color-scheme so it follows the device setting.
   All colours in the app should use these variables so they
   flip automatically. No JavaScript needed.
   ============================================================ */

:root {
    /* Brand (stays the same in both modes) */
    --sp-brand:          #2563eb;
    --sp-brand-dark:     #1d4ed8;
    --sp-brand-light:    #3b82f6;

    /* Surfaces */
    --sp-bg:             #f0f4f8;
    --sp-surface:        #ffffff;
    --sp-surface-2:      #f8fafc;
    --sp-border:         #e2e8f0;

    /* Text */
    --sp-text:           #1a202c;
    --sp-text-2:         #4a5568;
    --sp-text-muted:     #94a3b8;

    /* Status */
    --sp-success-bg:     #f0fdf4;
    --sp-success-text:   #16a34a;
    --sp-success-border: #bbf7d0;
    --sp-error-bg:       #fef2f2;
    --sp-error-text:     #dc2626;
    --sp-error-border:   #fecaca;

    /* App shell */
    --sp-tab-bg:         #ffffff;
    --sp-tab-border:     #e2e8f0;
    --sp-tab-active:     #2563eb;
    --sp-tab-inactive:   #94a3b8;

    /* Photo area */
    --sp-photo-bg:       #f1f5f9;
    --sp-photo-border:   #cbd5e1;
}

@media (prefers-color-scheme: dark) {
    :root {
        --sp-bg:             #0f172a;
        --sp-surface:        #1e293b;
        --sp-surface-2:      #263348;
        --sp-border:         #334155;

        --sp-text:           #f1f5f9;
        --sp-text-2:         #94a3b8;
        --sp-text-muted:     #64748b;

        --sp-success-bg:     #052e16;
        --sp-success-text:   #4ade80;
        --sp-success-border: #166534;
        --sp-error-bg:       #2d0a0a;
        --sp-error-text:     #f87171;
        --sp-error-border:   #7f1d1d;

        --sp-tab-bg:         #1e293b;
        --sp-tab-border:     #334155;
        --sp-tab-active:     #60a5fa;
        --sp-tab-inactive:   #64748b;

        --sp-photo-bg:       #0f172a;
        --sp-photo-border:   #334155;
    }
}

body {
    background: var(--sp-bg);
    color: var(--sp-text);
}

.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;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) 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: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

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

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            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;
}

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

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}/* ============================================================
   Safety Parrot � Auth styles
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f0f4f8;
    color: #1a202c;
    min-height: 100vh;
}

/* ---- Auth screen shell ---- */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(160deg, #1e40af 0%, #2563eb 60%, #3b82f6 100%);
}

.auth-card {
    background: #fff;
    border-radius: 1.25rem;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}

.auth-card--center {
    text-align: center;
}

/* ---- Branding ---- */
.auth-logo {
    text-align: center;
    margin-bottom: 1rem;
}
.auth-logo img {
    width: 100px;
    height: 100px;
    border-radius: 22px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.auth-title {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: #1e40af;
    margin: 0 0 0.4rem;
}

.auth-subtitle {
    text-align: center;
    color: #64748b;
    font-size: 0.95rem;
    margin: 0 0 2rem;
}

/* ---- Form ---- */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.field-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.field-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid #d1d5db;
    border-radius: 0.625rem;
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}
.field-group input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.field-group input:disabled {
    background: #f9fafb;
    color: #9ca3af;
}

.field-hint {
    font-size: 0.78rem;
    color: #9ca3af;
}

.badge-applied {
    background: #dcfce7;
    color: #15803d;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ---- Buttons ---- */
.btn-primary {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 0.625rem;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.15s, opacity 0.15s;
}
.btn-primary:hover:not(:disabled) { background: #1d4ed8; }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-full { width: 100%; }

.link-btn {
    background: none;
    border: none;
    color: #2563eb;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.link-btn:hover { color: #1d4ed8; }

/* ---- OTP boxes ---- */
.otp-boxes {
    display: flex;
    gap: 0.35rem;
    justify-content: center;
}

.otp-box {
    width: 38px;
    height: 52px;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    border: 2px solid #d1d5db;
    border-radius: 0.625rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    caret-color: transparent;
}
.otp-box:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.otp-box--error {
    border-color: #ef4444 \!important;
    box-shadow: 0 0 0 3px rgba(239,68,68,0.12) \!important;
}

/* ---- Feedback ---- */
.auth-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

.auth-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    text-align: center;
}

.auth-resend {
    text-align: center;
    font-size: 0.875rem;
}
.resend-timer { color: #9ca3af; }

.auth-back {
    text-align: center;
}

.auth-legal {
    font-size: 0.75rem;
    color: #9ca3af;
    text-align: center;
    line-height: 1.5;
    margin: 0;
}
.auth-legal a { color: #6b7280; }

/* ---- Spinner ---- */
.spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
.spinner--large {
    width: 44px;
    height: 44px;
    border: 4px solid #e2e8f0;
    border-top-color: #2563eb;
    margin: 1.5rem auto;
    display: block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.spinner--xl {
    width: 56px;
    height: 56px;
    border: 4px solid rgba(37, 99, 235, 0.2);
    border-top-color: var(--sp-brand);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: block;
}

/* ============================================================
   PROCESSING OVERLAY — shown during AI submission (~20-40s)
   ============================================================ */

.processing-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: overlay-fade-in 0.2s ease;
}

@keyframes overlay-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.processing-card {
    background: var(--sp-surface);
    border-radius: 20px;
    padding: 2.25rem 2.5rem;
    text-align: center;
    max-width: 280px;
    width: 85%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
    animation: card-pop-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes card-pop-in {
    from { transform: scale(0.88); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.processing-status {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--sp-text);
    margin: 0;
    min-height: 1.4em; /* prevents layout shift as text changes */
}

.processing-hint {
    font-size: 0.78rem;
    color: var(--sp-text-muted);
    margin: 0;
    line-height: 1.5;
}

/* ---- Credit badge ---- */
.credit-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #1e40af, #2563eb);
    border-radius: 1rem;
    padding: 1rem 2rem;
    margin: 1.25rem 0 0;
    color: #fff;
    box-shadow: 0 4px 14px rgba(37,99,235,0.3);
}
.credit-count {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
}
.credit-label {
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 0.2rem;
}


/* ============================================================
   App shell - tab bar layout
   ============================================================ */

html, body {
    height: 100%;
    overflow: hidden;
}

.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    background: var(--sp-bg);
    color: var(--sp-text);
}

.app-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Tab bar */
.tab-bar {
    display: flex;
    align-items: stretch;
    background: var(--sp-tab-bg);
    border-top: 1px solid var(--sp-tab-border);
    height: 60px;
    flex-shrink: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--sp-tab-inactive);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: color 0.15s;
    padding: 6px 0;
    border: none;
    background: none;
    cursor: pointer;
}

.tab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-icon svg { width: 22px; height: 22px; }
.tab-label { line-height: 1; }

a.tab-item.active { color: var(--sp-tab-active); }

/* ============================================================
   Assess page
   ============================================================ */

.assess-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
}

.assess-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--sp-surface);
    border-bottom: 1px solid var(--sp-border);
    flex-shrink: 0;
}

.assess-topbar__left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.assess-topbar__logo {
    width: 32px;
    height: 32px;
    border-radius: 7px;
}

.assess-topbar__title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--sp-text);
}

.credit-pill {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--sp-surface-2);
    border: 1px solid var(--sp-border);
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--sp-brand);
}

.credit-pill svg { width: 14px; height: 14px; }

.trial-banner {
    background: var(--sp-success-bg);
    color: var(--sp-success-text);
    border-bottom: 1px solid var(--sp-success-border);
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
}

.status-strip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    background: var(--sp-surface-2);
    border-bottom: 1px solid var(--sp-border);
    font-size: 0.8rem;
    color: var(--sp-text-2);
    min-height: 2rem;
    flex-shrink: 0;
}

.status-strip--error {
    background: var(--sp-error-bg);
    color: var(--sp-error-text);
    border-color: var(--sp-error-border);
}

.status-strip--busy { color: var(--sp-brand); }

.photo-area {
    flex: 1;
    background: var(--sp-photo-bg);
    border-bottom: 1px solid var(--sp-photo-border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 200px;
}

.photo-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    image-orientation: from-image; /* respect EXIF rotation on mobile photos */
}

.photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: var(--sp-text-muted);
    padding: 2rem;
    text-align: center;
}

.photo-placeholder svg { width: 60px; height: 60px; opacity: 0.4; }
.photo-placeholder p { margin: 0; font-size: 0.9rem; }

.photo-btn-row {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--sp-surface);
    border-bottom: 1px solid var(--sp-border);
    flex-shrink: 0;
}

.btn-secondary {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: var(--sp-surface-2);
    color: var(--sp-text);
    border: 1.5px solid var(--sp-border);
    border-radius: 0.625rem;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-secondary:hover:not(:disabled) { background: var(--sp-border); }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-photo svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn-submit {
    margin: 0.75rem 1rem;
    width: calc(100% - 2rem);
    padding: 0.9rem;
    font-size: 1rem;
    border-radius: 0.75rem;
    flex-shrink: 0;
}

.network-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 1rem 0.5rem;
    font-size: 0.75rem;
    color: var(--sp-text-muted);
    flex-shrink: 0;
}

.network-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.network-dot--online  { background: #22c55e; }
.network-dot--offline { background: #ef4444; }

.spinner--small {
    width: 12px;
    height: 12px;
    border-width: 2px;
    border-color: rgba(37,99,235,0.3);
    border-top-color: var(--sp-brand);
}

/* ============================================================
   Inner pages (Response, History, More)
   ============================================================ */

.inner-page {
    padding: 1rem;
    min-height: 100%;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    color: var(--sp-text-muted);
    gap: 0.75rem;
}

.empty-state svg { width: 56px; height: 56px; opacity: 0.4; }

.empty-state h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--sp-text-2);
}

.empty-state p {
    margin: 0;
    font-size: 0.9rem;
    max-width: 280px;
    line-height: 1.5;
}

/* ============================================================
   Response / Report page
   ============================================================ */

.report-header {
    padding: 0 0 1rem;
    border-bottom: 1px solid var(--sp-border);
    margin-bottom: 1rem;
}

.report-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--sp-text);
    margin: 0 0 0.3rem;
    line-height: 1.3;
}

.report-summary {
    font-size: 0.9rem;
    color: var(--sp-brand);
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.report-credits { font-size: 0.75rem; color: var(--sp-text-muted); margin: 0; }

.report-photo-wrap {
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 1rem;
    max-height: 240px;
}

.report-photo { width: 100%; height: 100%; object-fit: cover; display: block; }

.markdown-body {
    color: var(--sp-text);
    line-height: 1.65;
    font-size: 0.95rem;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    color: var(--sp-text);
    font-weight: 700;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.markdown-body h1 { font-size: 1.3rem; }
.markdown-body h2 { font-size: 1.1rem; }
.markdown-body h3 { font-size: 1rem; }
.markdown-body p  { margin: 0.5rem 0; }

.markdown-body ul, .markdown-body ol {
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}

.markdown-body li { margin-bottom: 0.3rem; }
.markdown-body strong { color: var(--sp-text); }

.markdown-body code {
    background: var(--sp-surface-2);
    border: 1px solid var(--sp-border);
    border-radius: 4px;
    padding: 0.15em 0.4em;
    font-size: 0.85em;
}

.markdown-body blockquote {
    border-left: 3px solid var(--sp-brand);
    margin: 0.75rem 0;
    padding: 0.5rem 1rem;
    background: var(--sp-surface-2);
    border-radius: 0 0.5rem 0.5rem 0;
    color: var(--sp-text-2);
}

/* ============================================================
   More page
   ============================================================ */

.more-section { margin-bottom: 1.5rem; }

.more-section__title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sp-text-muted);
    margin: 0 0 0.5rem;
    padding: 0 0.25rem;
}

.more-user {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 0.875rem;
    padding: 1rem;
}

.more-user__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--sp-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sp-text-muted);
    flex-shrink: 0;
}

.more-user__avatar svg { width: 24px; height: 24px; }
.more-user__email { margin: 0; font-weight: 600; font-size: 0.9rem; color: var(--sp-text); }
.more-user__credits { margin: 0.15rem 0 0; font-size: 0.78rem; color: var(--sp-brand); font-weight: 500; }

.more-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--sp-text);
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
}

.more-row:hover { background: var(--sp-surface-2); }

.more-row__icon {
    color: var(--sp-brand);
    display: flex;
    align-items: center;
}

.more-row__icon svg { width: 20px; height: 20px; }
.more-row__label { flex: 1; }
.more-row__chevron { color: var(--sp-text-muted); font-size: 1.2rem; line-height: 1; }

/* ---- Report meta line ---- */
.report-meta {
    font-size: 0.75rem;
    color: var(--sp-text-muted);
    margin: 0;
}

/* ---- Report action buttons ---- */
.report-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--sp-surface-2);
    color: var(--sp-text);
    border: 1px solid var(--sp-border);
    border-radius: 0.5rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s;
}

.btn-action:hover { background: var(--sp-border); }

.btn-action svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ---- Map link ---- */
.report-map-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.report-map-link svg { width: 16px; height: 16px; color: var(--sp-brand); flex-shrink: 0; }

.report-map-link a {
    color: var(--sp-brand);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ---- Static map ---- */
.report-map-section { margin-bottom: 1rem; }

.report-map-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem;
    color: var(--sp-text-muted);
    font-size: 0.85rem;
}

.report-map-wrap {
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.report-map {
    width: 100%;
    display: block;
    border-radius: 0.75rem;
}

.report-map-error {
    font-size: 0.8rem;
    color: var(--sp-text-muted);
    margin: 0 0 1rem;
}

/* ---- Site photo section ---- */
.report-photo-section { margin-bottom: 1rem; }

.report-section-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--sp-text-2);
    margin: 0 0 0.5rem;
}

/* ---- Divider ---- */
.report-divider {
    border: none;
    border-top: 1px solid var(--sp-border);
    margin: 1rem 0;
}

/* ============================================================
   HISTORY PAGE
   ============================================================ */

.history-page {
    padding: 0;
}

.history-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 1.25rem 1rem 0.75rem;
}

.history-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--sp-text);
    margin: 0;
}

.history-count {
    font-size: 0.8rem;
    color: var(--sp-text-muted);
}

.history-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem 1rem;
    gap: 0.75rem;
    color: var(--sp-text-2);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* History card — tappable button styled as a list item */
.history-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--sp-surface);
    border: none;
    border-bottom: 1px solid var(--sp-border);
    cursor: pointer;
    text-align: left;
    position: relative;
    transition: background 0.15s;
}

.history-card:first-child {
    border-top: 1px solid var(--sp-border);
}

.history-card:active,
.history-card:hover {
    background: var(--sp-surface-2);
}

.history-card-main {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.history-card-body {
    flex: 1;
    min-width: 0;
}

.history-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--sp-text);
    margin: 0 0 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-card-summary {
    font-size: 0.82rem;
    color: var(--sp-text-2);
    margin: 0 0 0.3rem;
    line-height: 1.4;
    /* allow 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-card-date {
    font-size: 0.75rem;
    color: var(--sp-text-muted);
    margin: 0;
}

.history-card-thumb {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--sp-photo-bg);
}

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

.history-card-badges {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge svg {
    width: 11px;
    height: 11px;
}

.badge--map {
    background: #eff6ff;
    color: #2563eb;
}

.badge--photo {
    background: #f0fdf4;
    color: #16a34a;
}

@media (prefers-color-scheme: dark) {
    .badge--map  { background: rgba(37, 99, 235, 0.2); color: #93c5fd; }
    .badge--photo { background: rgba(22, 163, 74, 0.2); color: #86efac; }
}

.history-card-arrow {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--sp-text-muted);
}

.history-card-arrow svg {
    width: 16px;
    height: 16px;
}

/* ============================================================
   SETTINGS PAGE
   ============================================================ */

.settings-page {
    padding: 0;
}

.settings-back-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem 0.5rem;
    border-bottom: 1px solid var(--sp-border);
}

.settings-back {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: none;
    color: var(--sp-brand);
    font-size: 0.95rem;
    cursor: pointer;
    padding: 0.25rem 0;
}

.settings-back svg {
    width: 18px;
    height: 18px;
}

.settings-page-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--sp-text);
    margin: 0;
    flex: 1;
    text-align: center;
    padding-right: 2.5rem; /* offset for back button width */
}

.settings-section {
    padding: 1rem 1rem 0.25rem;
    border-bottom: 1px solid var(--sp-border);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section__title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--sp-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 0.5rem;
}

.settings-section__desc {
    font-size: 0.83rem;
    color: var(--sp-text-2);
    margin: 0 0 0.75rem;
    line-height: 1.5;
}

/* Country select row */
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.settings-row__label {
    font-size: 0.9rem;
    color: var(--sp-text);
    font-weight: 500;
}

.settings-select {
    background: var(--sp-surface-2);
    border: 1px solid var(--sp-border);
    border-radius: 8px;
    padding: 0.45rem 0.75rem;
    font-size: 0.9rem;
    color: var(--sp-text);
    min-width: 55%;
    max-width: 60%;
    cursor: pointer;
}

/* Location toggle row */
.settings-row--toggle {
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.settings-row__text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.settings-row__sub {
    font-size: 0.78rem;
    color: var(--sp-text-muted);
    line-height: 1.4;
}

/* iOS-style toggle */
.settings-toggle {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    width: 44px;
    height: 26px;
    margin-top: 2px;
}

.settings-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.settings-toggle__track {
    position: absolute;
    inset: 0;
    background: var(--sp-border);
    border-radius: 999px;
    transition: background 0.2s;
    cursor: pointer;
}

.settings-toggle__track::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.settings-toggle input:checked + .settings-toggle__track {
    background: var(--sp-brand);
}

.settings-toggle input:checked + .settings-toggle__track::after {
    transform: translateX(18px);
}

/* Action rows (danger / normal) */
.settings-action-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 0;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    color: var(--sp-text);
}

.settings-action-row--danger {
    color: var(--sp-error-text);
}

.settings-action-row__icon {
    display: flex;
    align-items: center;
    color: inherit;
}

.settings-action-row__icon svg {
    width: 20px;
    height: 20px;
}

.settings-action-row__label {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
}

.settings-action-row__chevron {
    font-size: 1.1rem;
    color: var(--sp-text-muted);
}

/* Confirm block */
.settings-confirm-row {
    padding: 0.75rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.settings-confirm-text {
    font-size: 0.85rem;
    color: var(--sp-text-2);
    margin: 0;
    line-height: 1.5;
}

.settings-confirm-btns {
    display: flex;
    gap: 0.5rem;
}

.btn-danger-sm {
    padding: 0.5rem 1rem;
    background: var(--sp-error-text);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn-danger-sm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary-sm {
    padding: 0.5rem 1rem;
    background: var(--sp-surface-2);
    color: var(--sp-text);
    border: 1px solid var(--sp-border);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
}

.settings-success {
    font-size: 0.82rem;
    color: var(--sp-success-text);
    margin: 0 0 0.75rem;
}

.settings-error {
    font-size: 0.82rem;
    color: var(--sp-error-text);
    margin: 0 0 0.75rem;
}
