/* === Cover / Splash Screen === */
#cover-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #0a1628;
    overflow: hidden;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#cover-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Hide the app while cover is visible — toggled via body class for browser compat */
body.cover-active #app {
    visibility: hidden;
}

#cover-screen .cover-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    pointer-events: none;
}

#cover-enter-btn {
    position: absolute;
    bottom: max(4vh, 24px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    width: min(30%, 140px);
    transition: transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#cover-enter-btn:active {
    transform: translateX(-50%) scale(0.93);
}

#cover-enter-btn img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
}

/* === EULA Screen === */
#eula-screen {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: var(--bg, #f5f5f5);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

#eula-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.eula-container {
    width: 100%;
    max-width: 600px;
    padding: 2rem 1.25rem 3rem;
}

.eula-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #004B87;
    text-align: center;
    margin-bottom: 0.15rem;
}

.eula-subtitle {
    text-align: center;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.eula-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.eula-card h2 {
    font-size: 1.1rem;
    color: #004B87;
    margin-bottom: 0.75rem;
}

.eula-text {
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 0.5rem;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #1a1a1a;
    margin-bottom: 1.25rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
}

.eula-text h3 {
    font-size: 0.9rem;
    margin: 1rem 0 0.35rem;
    color: #1a1a1a;
}

.eula-text h3:first-child {
    margin-top: 0;
}

.eula-text p {
    margin-bottom: 0.5rem;
}

.eula-accept-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.eula-accept-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* === Paywall Modal === */
.paywall-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.paywall-content {
    background: #fff;
    border-radius: 16px;
    padding: 2rem 1.5rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.paywall-content h2 {
    font-size: 1.3rem;
    color: #004B87;
    margin-bottom: 0.75rem;
}

.paywall-msg {
    font-size: 0.9rem;
    color: #444;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.paywall-price {
    font-size: 2rem;
    font-weight: 800;
    color: #004B87;
    margin-bottom: 0.25rem;
}

.paywall-price span {
    font-size: 0.85rem;
    font-weight: 400;
    color: #666;
}

.paywall-value {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.btn-text {
    background: none;
    border: none;
    color: #666;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0.5rem;
}

/* === Audit Counter Badge === */
.audit-counter {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
    padding: 0.5rem 0.75rem;
    background: #e8f0fe;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.audit-counter.licensed {
    background: #e6f4ea;
    color: #006B3F;
}

.audit-counter.exhausted {
    background: #fde8e8;
    color: #CC0000;
}

/* === EULA in Settings (highlight on first launch) === */
.eula-highlight {
    border: 2px solid #004B87;
    animation: eula-pulse 1.5s ease-in-out 3;
}

@keyframes eula-pulse {
    0%, 100% { border-color: #004B87; }
    50% { border-color: #FDB813; }
}

/* === Payment Success Toast === */
.payment-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    background: #006B3F;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    transition: transform 0.4s ease;
    white-space: nowrap;
}

.payment-toast.visible {
    transform: translateX(-50%) translateY(0);
}

/* === Pricing View === */
.pricing-header {
    text-align: center;
    margin-bottom: 1rem;
}

.pricing-header h2 {
    font-size: 1.4rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.pricing-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.pricing-balance-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    text-align: center;
}

.pricing-balance-card h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.pricing-balance-pills {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.balance-pill {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.balance-pill.sonnet-pill {
    background: #EBF5FB;
    color: #2471A3;
}

.balance-pill.opus-pill {
    background: #FEF9E7;
    color: #B7950B;
}

/* Site Condition Guide */
.site-guide {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.site-guide-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 0.85rem;
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.site-guide-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.site-guide-card strong {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.15rem;
}

.site-guide-card p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    line-height: 1.3;
}

.site-guide-rec {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.sonnet-rec {
    background: #EBF5FB;
    color: #2471A3;
}

.opus-rec {
    background: #FEF9E7;
    color: #B7950B;
}

/* Pricing Columns */
.pricing-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.pricing-column {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-top: 4px solid;
}

.sonnet-column {
    border-top-color: #2980B9;
}

.opus-column {
    border-top-color: #F39C12;
}

.pricing-column h3 {
    font-size: 1.15rem;
    margin-bottom: 0.1rem;
}

.sonnet-column h3 { color: #2471A3; }
.opus-column h3 { color: #B7950B; }

.pricing-column-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* Batch Options */
.batch-option {
    display: block;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.batch-option input[type="radio"] {
    display: none;
}

.batch-option-content {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.2s, background 0.2s;
}

.batch-option input[type="radio"]:checked + .batch-option-content {
    border-color: var(--primary);
    background: #f0f6fc;
}

.sonnet-column .batch-option input[type="radio"]:checked + .batch-option-content {
    border-color: #2980B9;
    background: #EBF5FB;
}

.opus-column .batch-option input[type="radio"]:checked + .batch-option-content {
    border-color: #F39C12;
    background: #FEF9E7;
}

.batch-size {
    font-weight: 600;
    font-size: 0.9rem;
    flex: 1;
}

.batch-price {
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary);
}

.per-sign-cost {
    font-size: 0.72rem;
    color: var(--text-muted);
    width: 100%;
}

.batch-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.batch-badge.popular {
    background: #2980B9;
    color: #fff;
}

.batch-badge.value {
    background: #27AE60;
    color: #fff;
}

.pricing-buy-btn {
    margin-top: 0.5rem;
}

.pricing-free-note {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

@media (max-width: 600px) {
    .pricing-columns {
        grid-template-columns: 1fr;
    }
    .site-guide {
        grid-template-columns: 1fr;
    }
}

/* === BYOK Guide === */
.byok-guide {
    background: var(--bg);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #444;
}

.byok-guide h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    margin: 1rem 0 0.3rem;
}

.byok-guide h3:first-child {
    margin-top: 0;
}

.byok-guide p {
    margin-bottom: 0.5rem;
}

.byok-guide ol {
    padding-left: 1.25rem;
    margin-bottom: 0.75rem;
}

.byok-guide ol li {
    margin-bottom: 0.35rem;
}

.byok-guide code {
    background: #e8e8e8;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.byok-guide a {
    color: var(--primary);
    font-weight: 600;
}

.byok-cost-table {
    margin: 0.5rem 0 0.75rem;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.byok-cost-row {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: #fff;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.byok-cost-row:last-child {
    border-bottom: none;
}

.byok-cost-row.byok-recommended {
    background: #E8F8F5;
}

.byok-model {
    font-weight: 700;
    width: 60px;
    flex-shrink: 0;
}

.byok-cost {
    font-weight: 600;
    color: var(--primary);
    width: 90px;
    flex-shrink: 0;
}

.byok-note {
    color: #888;
    font-size: 0.8rem;
}

.byok-example {
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
}

/* === Auth Form (Apple-style) === */
#license-auth-section .form-group {
    margin-bottom: 0.75rem;
}

#license-auth-section label {
    font-size: 0.8rem;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 0.35rem;
}

#license-auth-section input[type="email"],
#license-auth-section input[type="password"] {
    width: 100%;
    padding: 0.9rem 1rem;
    font-size: 1.05rem;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    background: #fafafc;
    color: #1d1d1f;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
}

#license-auth-section input[type="email"]:focus,
#license-auth-section input[type="password"]:focus {
    border-color: #0071e3;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
    background: #fff;
    outline: none;
}

#license-auth-section input::placeholder {
    color: #aeaeb2;
}

#license-auth-section .btn-primary {
    padding: 0.85rem 1.25rem;
    font-size: 1.05rem;
    border-radius: 12px;
}

#license-auth-section .btn-secondary {
    padding: 0.85rem 1.25rem;
    font-size: 1.05rem;
    border-radius: 12px;
}

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* AS 1319 Safety Colours (Table 3.2) */
    --safety-red: #CC0000;       /* R13 Signal Red */
    --safety-yellow: #FDB813;    /* Y15 Sunflower */
    --safety-green: #006B3F;     /* G21 Jade */
    --safety-blue: #004B87;      /* B23 Bright Blue */

    /* App UI Colours */
    --bg: #f5f5f5;
    --card-bg: #ffffff;
    --text: #1a1a1a;
    --text-muted: #666;
    --border: #ddd;
    --primary: #004B87;
    --primary-hover: #003966;
    --success: #006B3F;
    --danger: #CC0000;
    --warning: #FDB813;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* === App Container === */
#app {
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
}

/* === Header & Navigation === */
#app-header {
    background: var(--primary);
    color: white;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

#app-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

#app-header .subtitle {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-bottom: 0.75rem;
}

#main-nav {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

#main-nav::-webkit-scrollbar {
    display: none;
}

.nav-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s;
}

.nav-btn.active {
    background: rgba(255,255,255,0.3);
    font-weight: 600;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.25);
}

/* === Views === */
.view {
    display: none;
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.view.active {
    display: block;
}

/* === Cards === */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card h2 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
    color: var(--primary);
}


.card h3 {
    font-size: 1rem;
    margin: 1.25rem 0 0.5rem;
    color: var(--text);
}

.card h4 {
    font-size: 0.9rem;
    margin: 0.75rem 0 0.25rem;
    color: var(--text-muted);
}

/* === Forms === */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text);
}

input[type="text"],
input[type="date"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: white;
    color: var(--text);
    transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,75,135,0.1);
}

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    text-align: center;
}

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

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
    background: #ccc;
}

.btn-small {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.stat-item {
    background: var(--bg);
    padding: 0.75rem;
    border-radius: 8px;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* === Camera === */
.camera-section {
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

#camera-preview {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    display: block;
}

#captured-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    display: block;
}

.camera-controls {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #111;
    justify-content: center;
}

.camera-controls .btn {
    flex: 0 1 auto;
}

/* === GPS === */
.gps-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

#gps-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* === Compliance Checklist === */
.compliance-checklist {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.compliance-checklist legend {
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0 0.5rem;
    color: var(--primary);
}

.check-group {
    margin-bottom: 0.75rem;
}

.check-group h3 {
    font-size: 0.85rem;
    margin: 0.5rem 0 0.25rem;
    color: var(--text);
}

.check-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.35rem 0;
    font-size: 0.85rem;
    cursor: pointer;
}

.check-item input[type="checkbox"] {
    margin-top: 0.15rem;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* === Audit List === */
.audit-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* === Swipe-to-Delete === */
.audit-swipe-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.audit-delete-btn {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 64px;
    background: var(--danger);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.audit-list-item {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    will-change: transform;
}

.audit-list-item:hover {
    background: #e8e8e8;
}

.audit-list-item .audit-info {
    flex: 1;
}

.audit-list-item .audit-info strong {
    display: block;
    font-size: 0.95rem;
}

.audit-list-item .audit-info span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.audit-list-item .audit-count {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    background: var(--primary);
    color: white;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 1rem;
    font-size: 0.9rem;
}

.audit-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: var(--bg);
    border-radius: 6px;
}

/* === Reference Tables === */
.reference-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

.reference-table th,
.reference-table td {
    border: 1px solid var(--border);
    padding: 0.5rem;
    text-align: left;
}

.reference-table th {
    background: var(--bg);
    font-weight: 600;
}

.reference-table tr:nth-child(even) {
    background: #fafafa;
}

/* === Colour Swatches === */
.colour-swatches {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin: 0.5rem 0 1rem;
}

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

.swatch-colour {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.1);
}

.swatch span {
    font-size: 0.72rem;
    line-height: 1.3;
    color: var(--text-muted);
}

/* === Sign Index === */
.sign-index ul {
    list-style: none;
    font-size: 0.8rem;
    padding-left: 0;
}

.sign-index li {
    padding: 0.2rem 0;
}

/* === Report Output === */
#report-content {
    font-size: 0.9rem;
}

#report-content h3 {
    margin-top: 1.5rem;
}

#report-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0 1rem;
    font-size: 0.8rem;
}

#report-content th,
#report-content td {
    border: 1px solid var(--border);
    padding: 0.4rem 0.5rem;
    text-align: left;
}

#report-content th {
    background: var(--bg);
}

.report-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
    margin: 1rem 0;
}

.report-summary-item {
    text-align: center;
    padding: 0.75rem;
    border-radius: 8px;
    background: var(--bg);
}

.report-summary-item .value {
    font-size: 1.5rem;
    font-weight: 700;
}

.report-summary-item .label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.compliance-tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.compliance-tag.compliant {
    background: #e6f4ea;
    color: var(--success);
}

.compliance-tag.minor-nc {
    background: #fff8e1;
    color: #8B6914;
}

.compliance-tag.major-nc {
    background: #fde8e8;
    color: var(--danger);
}

.compliance-tag.missing {
    background: #fde8e8;
    color: var(--danger);
}

.compliance-tag.redundant {
    background: #e8e8e8;
    color: var(--text-muted);
}

/* === Camera Phase Label === */
.camera-phase-label {
    padding: 0.5rem 0.75rem;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: center;
}

/* === Context Photo Thumbnail === */
.context-thumb-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #e8f5e9;
    border-bottom: 1px solid var(--border);
}
.context-thumb {
    width: 64px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid var(--success);
    cursor: pointer;
}
.context-thumb-label {
    font-size: 0.75rem;
    color: var(--success);
    font-weight: 600;
}
.btn-tiny {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: var(--border);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

/* === Report Photo Pair === */
.report-photo-pair {
    display: flex;
    gap: 4px;
    align-items: flex-start;
}
.report-thumbnail-ctx {
    width: 48px;
    height: 48px;
    opacity: 0.85;
    border: 1px solid var(--success);
}

/* === Report Thumbnails === */
.report-thumbnail {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--border);
}

/* === Report Actions === */
#report-output .btn {
    margin-right: 0.5rem;
    margin-top: 1rem;
    width: auto;
}

/* === Detection Status Bar === */
.detection-status {
    padding: 0.5rem 0.75rem;
    background: #111;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.detection-progress {
    flex: 1;
    height: 4px;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
}

.detection-progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

.detection-progress-bar.error {
    background: var(--danger);
}

.detection-status-text {
    font-size: 0.75rem;
    color: #aaa;
    white-space: nowrap;
}

/* === Detection Results Panel === */
.detection-results-panel {
    border: 2px solid var(--primary);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    background: #f0f6fc;
}

.detection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.detection-timing {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.detection-details {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.detection-details p {
    margin: 0.15rem 0;
}

.detection-manual-msg {
    color: var(--danger);
    font-weight: 600;
    font-size: 0.85rem;
}

.detection-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-accept {
    background: var(--success);
    color: white;
}

.btn-reject {
    background: var(--danger);
    color: white;
}

/* === Confidence Badges === */
.confidence-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
}

.confidence-badge.high {
    background: #e6f4ea;
    color: var(--success);
}

.confidence-badge.medium {
    background: #fff8e1;
    color: #8B6914;
}

.confidence-badge.low {
    background: #fde8e8;
    color: var(--danger);
}

/* === AI-Suggested Field Styling === */
.ai-suggested.ai-high {
    border-color: var(--success) !important;
    box-shadow: 0 0 0 2px rgba(0, 107, 63, 0.15) !important;
}

.ai-suggested.ai-medium {
    border-color: #d4a017 !important;
    box-shadow: 0 0 0 2px rgba(253, 184, 19, 0.15) !important;
}

.ai-suggested.ai-low {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.1) !important;
}

/* Check items with AI styling */
.check-item.ai-suggested.ai-high {
    background: #e6f4ea;
    border-radius: 4px;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
    border: none !important;
    box-shadow: none !important;
}

.check-item.ai-suggested.ai-medium {
    background: #fff8e1;
    border-radius: 4px;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
    border: none !important;
    box-shadow: none !important;
}

/* === Vision AI Settings === */
.settings-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.vision-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.vision-indicator {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
}

.vision-indicator.active {
    background: #e6f4ea;
    color: var(--success);
}

.vision-indicator.inactive {
    background: #f0f0f0;
    color: var(--text-muted);
}

.vision-indicator.legacy {
    background: #fff8e1;
    color: #e65100;
}

.field-help {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Location level inputs */
.location-levels .field-help {
    margin-bottom: 0.5rem;
}
.location-level-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}
.location-level-label {
    flex-shrink: 0;
    width: 1.8rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
}
.location-level-row input {
    flex: 1;
}

.vision-status-msg {
    display: inline-block;
    margin-left: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.vision-status-msg.success {
    color: var(--success);
}

.vision-status-msg.error {
    color: var(--danger);
}

/* === Detection Source Badge === */
.detection-source {
    font-size: 0.7rem;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

.detection-source.vision-source {
    background: #e8d5f5;
    color: #6b21a8;
}

.detection-source.cv-source {
    background: #e0e7ff;
    color: #3730a3;
}

.detection-reasoning {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.25rem;
}

.detection-condition {
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* === Storage Bar & Backup === */
.storage-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0 0.25rem;
}

.storage-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease, background 0.3s ease;
}

.storage-bar-fill.storage-low {
    background: var(--success);
}

.storage-bar-fill.storage-medium {
    background: var(--warning);
}

.storage-bar-fill.storage-high {
    background: var(--danger);
}

.backup-status-msg {
    display: block;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.backup-status-msg.success {
    color: var(--success);
}

.backup-status-msg.error {
    color: var(--danger);
}

/* === Print Styles === */
@media print {
    #app-header { display: none; }
    .view { display: none !important; }
    #view-reports { display: block !important; }
    #report-output { box-shadow: none; }
    .btn { display: none; }
    .report-thumbnail {
        width: 48px;
        height: 48px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .report-thumbnail-ctx {
        width: 36px;
        height: 36px;
    }
}

/* === Responsive === */
@media (max-width: 600px) {
    #app-header {
        padding: 0.75rem 1rem;
    }

    #app-header h1 {
        font-size: 1.1rem;
    }

    .nav-btn {
        padding: 0.5rem 0.6rem;
        font-size: 0.75rem;
        min-height: 44px;
    }

    .view {
        padding: 0.75rem;
    }

    .card {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .colour-swatches {
        grid-template-columns: 1fr;
    }

    .report-summary-grid {
        grid-template-columns: 1fr 1fr;
    }
}
