:root {
    --deep-navy: #1B2A4A;
    --meridian-teal: #0D9488;
    --teal-hover: #0F766E;
    --slate-grey: #475569;
    --light-grey: #F1F5F9;
    --border-grey: #E2E8F0;
    --white: #FFFFFF;
    --danger: #DC2626;
    --danger-hover: #B91C1C;
    --warning: #D97706;
    --success: #16A34A;
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", monospace;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 64px;
    --topbar-height: 56px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: var(--font-sans); color: var(--slate-grey); background: var(--light-grey); }
.meridian-app { display: flex; height: 100vh; }
.sidebar {
    width: var(--sidebar-width); background: var(--deep-navy); color: var(--white);
    display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 100; transition: width 0.2s ease;
}
.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-width); }
.sidebar-collapsed .nav-label, .sidebar-collapsed .nav-group-label,
.sidebar-collapsed .sidebar-logo .logo-text, .sidebar-collapsed .sidebar-logo .logo-dot,
.sidebar-collapsed .sidebar-footer { display: none; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-logo { display: flex; align-items: baseline; }
.logo-text { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.5px; }
.logo-dot { color: var(--meridian-teal); font-size: 1.6rem; font-weight: 700; }
.sidebar-toggle { background: none; border: none; color: rgba(255,255,255,0.6); font-size: 1.2rem; cursor: pointer; padding: 4px; }
.sidebar-toggle:hover { color: var(--white); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.nav-group { margin-bottom: 4px; }
.nav-group-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.4); padding: 8px 20px 4px; font-weight: 600; }
.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 20px;
    color: rgba(255,255,255,0.7); text-decoration: none; font-size: 0.875rem;
    font-weight: 500; border-left: 3px solid transparent; transition: all 0.15s;
}
.nav-item:hover { color: var(--white); background: rgba(255,255,255,0.05); }
.nav-item.active { color: var(--meridian-teal); border-left-color: var(--meridian-teal); background: rgba(13,148,136,0.1); }
.nav-icon { font-size: 1.1rem; width: 24px; text-align: center; flex-shrink: 0; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.user-info { display: flex; flex-direction: column; gap: 4px; }
.user-name { font-size: 0.85rem; font-weight: 600; }
.user-role-badge {
    display: inline-block; font-size: 0.7rem; padding: 2px 8px; border-radius: 999px;
    background: rgba(13,148,136,0.2); color: var(--meridian-teal); font-weight: 500; width: fit-content;
}
.main-content { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; transition: margin-left 0.2s ease; }
.sidebar-collapsed .main-content { margin-left: var(--sidebar-collapsed-width); }
.top-bar {
    height: var(--topbar-height); background: var(--white); border-bottom: 1px solid var(--border-grey);
    display: flex; align-items: center; padding: 0 24px; flex-shrink: 0;
}
.page-title { font-size: 1.1rem; font-weight: 600; color: var(--deep-navy); }
.content-area { flex: 1; padding: 24px; overflow-y: auto; }
.card { background: var(--white); border-radius: 8px; border: 1px solid var(--border-grey); padding: 20px; margin-bottom: 16px; }
.card-header { font-size: 1rem; font-weight: 600; color: var(--deep-navy); margin-bottom: 12px; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: 8px; border: 1px solid var(--border-grey); padding: 20px; }
.stat-card .stat-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--slate-grey); font-weight: 500; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--deep-navy); margin-top: 4px; }
.stat-card .stat-accent { color: var(--meridian-teal); }
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; line-height: 1.6; }
.badge-received { background: #DBEAFE; color: #1D4ED8; }
.badge-in-progress { background: #FEF3C7; color: #92400E; }
.badge-testing { background: #E0E7FF; color: #4338CA; }
.badge-complete { background: #D1FAE5; color: #065F46; }
.badge-dispatched { background: #F3E8FF; color: #7C3AED; }
.badge-on-hold { background: #FEE2E2; color: #991B1B; }
.btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
    border-radius: 6px; font-size: 0.875rem; font-weight: 500; font-family: var(--font-sans);
    cursor: pointer; border: 1px solid transparent; transition: all 0.15s;
}
.btn-primary { background: var(--meridian-teal); color: var(--white); }
.btn-primary:hover { background: var(--teal-hover); }
.btn-secondary { background: transparent; color: var(--deep-navy); border-color: var(--deep-navy); }
.btn-secondary:hover { background: var(--deep-navy); color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: var(--danger-hover); }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th { text-align: left; padding: 10px 12px; background: var(--light-grey); color: var(--deep-navy); font-weight: 600; border-bottom: 2px solid var(--border-grey); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border-grey); }
.table tbody tr:nth-child(even) { background: #F8FAFC; }
.table tbody tr:hover { background: #EFF6FF; }
.form-control {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border-grey); border-radius: 6px;
    font-size: 0.875rem; font-family: var(--font-sans); transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus { outline: none; border-color: var(--meridian-teal); box-shadow: 0 0 0 3px rgba(13,148,136,0.15); }
.form-label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--deep-navy); margin-bottom: 4px; }
@media (max-width: 768px) {
    .sidebar { width: var(--sidebar-collapsed-width); }
    .nav-label, .nav-group-label, .sidebar-logo .logo-text, .sidebar-logo .logo-dot, .sidebar-footer { display: none; }
    .main-content { margin-left: var(--sidebar-collapsed-width); }
    .stat-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .stat-cards { grid-template-columns: 1fr; }
    .content-area { padding: 16px; }
}
#blazor-error-ui { background: var(--danger); color: white; padding: 8px 16px; position: fixed; bottom: 0; width: 100%; z-index: 9999; display: none; }
#blazor-error-ui .reload, #blazor-error-ui .dismiss { color: white; margin-left: 12px; }


/* Mobile responsive enhancements - Phase 3 */
.mobile-hamburger {
    display: none; background: none; border: none; font-size: 1.4rem;
    cursor: pointer; color: var(--deep-navy); padding: 4px 8px; margin-right: 12px;
}
.sidebar-overlay { display: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 12px; }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 768px) {
    .mobile-hamburger { display: block; }
    .sidebar {
        transform: translateX(-100%); transition: transform 0.3s ease;
        width: var(--sidebar-width) !important; z-index: 200;
    }
    .sidebar.mobile-open { transform: translateX(0); }
    .sidebar-overlay.active {
        display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 150;
    }
    .nav-label, .nav-group-label, .sidebar-logo .logo-text, .sidebar-logo .logo-dot, .sidebar-footer {
        display: block !important;
    }
    .main-content { margin-left: 0 !important; }
    .form-grid { grid-template-columns: 1fr; }
    .stat-cards { grid-template-columns: 1fr 1fr; }
    .content-area { padding: 16px; }
    .table-responsive { margin: 0 -16px; padding: 0 16px; }
}

@media (max-width: 480px) {
    .stat-cards { grid-template-columns: 1fr; }
    .top-bar { padding: 0 12px; }
    .content-area { padding: 12px; }
    .btn { padding: 10px 16px; font-size: 0.9rem; }
    .card { padding: 16px; }
}

/* Camera capture for mobile photo upload */
input[type="file"][accept*="camera"] { width: 100%; }

/* ===== Page Header ===== */
.page-header { margin-bottom: 24px; }
.page-header h2 { color: var(--deep-navy); font-weight: 700; margin: 0; }
.page-header .page-subtitle { font-size: 0.875rem; color: var(--slate-grey); margin-top: 4px; }
.page-header-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.page-header-row h2 { color: var(--deep-navy); font-weight: 700; margin: 0; }

/* ===== Filter Bar ===== */
.filter-bar {
    background: var(--white); border-radius: 8px; border: 1px solid var(--border-grey);
    padding: 16px 20px; margin-bottom: 16px;
    display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
}
.filter-bar .form-control { width: auto; min-width: 140px; }
.filter-bar label { font-size: 0.8rem; font-weight: 500; color: var(--deep-navy); white-space: nowrap; }

/* ===== Empty State ===== */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 48px 24px; text-align: center; color: var(--slate-grey);
}
.empty-state .empty-icon { margin-bottom: 16px; }
.empty-state .empty-icon svg { width: 48px; height: 48px; stroke: var(--border-grey); }
.empty-state p { font-size: 0.95rem; margin: 0; }
.empty-state .empty-hint { font-size: 0.85rem; color: var(--slate-grey); margin-top: 4px; }

/* ===== Loading Spinner ===== */
.loading-spinner {
    display: flex; align-items: center; justify-content: center;
    padding: 48px 24px; color: var(--slate-grey); font-size: 0.875rem; gap: 12px;
}
.loading-spinner::before {
    content: ''; width: 24px; height: 24px; border: 3px solid var(--border-grey);
    border-top-color: var(--meridian-teal); border-radius: 50%;
    animation: meridian-spin 0.7s linear infinite;
}
@keyframes meridian-spin { to { transform: rotate(360deg); } }

/* ===== Status Badges (Workflow) ===== */
.status-badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}
.status-received { background: #DBEAFE; color: #2563EB; }
.status-awaitingassignment { background: #FEF3C7; color: #D97706; }
.status-assigned { background: #CCFBF1; color: #0D9488; }
.status-inspectionrequired { background: #EDE9FE; color: #7C3AED; }
.status-cleaningrequired { background: #FFF7ED; color: #EA580C; }
.status-cleaninginprogress { background: #FFEDD5; color: #EA580C; }
.status-readyforinstallation { background: #D1FAE5; color: #16A34A; }
.status-installed { background: #DCFCE7; color: #15803D; }
.status-undertest { background: #EEF2FF; color: #4F46E5; }
.status-testcomplete { background: #CFFAFE; color: #0891B2; }
.status-packing { background: #F1F5F9; color: #475569; }
.status-readyfordispatch { background: #E0E7FF; color: #1B2A4A; }
.status-dispatched { background: #D1FAE5; color: #16A34A; }
.status-draft { background: #F1F5F9; color: #475569; }
.status-submitted { background: #FEF3C7; color: #D97706; }
.status-inprogress { background: #DBEAFE; color: #2563EB; }

/* ===== Badge Variants ===== */
.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-info { background: #DBEAFE; color: #1D4ED8; }
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-secondary { background: #F1F5F9; color: #475569; }
.badge-primary { background: #CCFBF1; color: #0D9488; }

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px; border-radius: 8px; font-size: 0.875rem;
    display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
}
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-danger { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.alert-info { background: #DBEAFE; color: #1D4ED8; border: 1px solid #BFDBFE; }

/* ===== Toolbar (Reports / Page Actions) ===== */
.toolbar {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 12px; margin-bottom: 16px;
}
.toolbar .form-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .form-inline label { font-size: 0.8rem; font-weight: 500; color: var(--deep-navy); white-space: nowrap; }

/* ===== Quick Actions Row ===== */
.quick-actions { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }

/* ===== Dashboard Stat Cards with accent borders ===== */
.stat-card-blue { border-left: 4px solid #2563EB; }
.stat-card-blue .stat-value { color: #2563EB; }
.stat-card-amber { border-left: 4px solid #D97706; }
.stat-card-amber .stat-value { color: #D97706; }
.stat-card-teal { border-left: 4px solid var(--meridian-teal); }
.stat-card-teal .stat-value { color: var(--meridian-teal); }
.stat-card-navy { border-left: 4px solid var(--deep-navy); }
.stat-card-navy .stat-value { color: var(--deep-navy); }
.stat-card-danger { border-left: 4px solid var(--danger); }
.stat-card-danger .stat-value { color: var(--danger); }
.stat-card-purple { border-left: 4px solid #7C3AED; }
.stat-card-purple .stat-value { color: #7C3AED; }
.stat-card-cyan { border-left: 4px solid #0891B2; }
.stat-card-cyan .stat-value { color: #0891B2; }

/* ===== Two Column Layout ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 768px) { .grid-2 { grid-template-columns: 1fr; } }

/* ===== Detail Labels (Workflow/Tracking) ===== */
.detail-label { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--slate-grey); font-weight: 500; margin-bottom: 2px; }
.detail-value { font-weight: 600; color: var(--deep-navy); font-size: 0.875rem; }

/* ===== Info Grid (for record details) ===== */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.info-item { display: flex; flex-direction: column; gap: 2px; }
.info-item label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--slate-grey); font-weight: 500; }
.info-item span { font-weight: 600; color: var(--deep-navy); font-size: 0.875rem; }
.info-item.highlight { background: var(--light-grey); padding: 12px; border-radius: 6px; }

/* ===== Kanban Board ===== */
.kanban-board { display: flex; gap: 12px; min-width: fit-content; overflow-x: auto; padding-bottom: 16px; }
.kanban-column { min-width: 240px; max-width: 280px; flex: 1; background: #F8FAFC; border-radius: 8px; display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.kanban-column-header { padding: 12px; display: flex; justify-content: space-between; align-items: center; }
.kanban-column-header .col-title { font-weight: 600; font-size: 0.8rem; color: var(--deep-navy); }
.kanban-column-header .col-count { color: var(--white); border-radius: 12px; padding: 2px 8px; font-size: 0.75rem; font-weight: 600; }
.kanban-cards { padding: 8px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.kanban-card {
    background: var(--white); border-radius: 6px; padding: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08); cursor: pointer; transition: box-shadow 0.2s;
}
.kanban-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.kanban-card .card-tracking { font-family: var(--font-mono); font-weight: 600; font-size: 0.8rem; color: var(--deep-navy); }
.kanban-card .card-serial { font-size: 0.75rem; color: var(--slate-grey); margin-top: 2px; }
.kanban-card .card-project { font-size: 0.7rem; color: var(--slate-grey); margin-top: 2px; }
.kanban-card .card-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.kanban-card .card-days { font-size: 0.7rem; color: var(--slate-grey); }
.kanban-card .card-flags { display: flex; gap: 4px; }
.kanban-card .card-flags svg { width: 14px; height: 14px; }
.kanban-card .card-coordinator { font-size: 0.7rem; color: var(--meridian-teal); margin-top: 4px; }

/* ===== Checkbox Toggle ===== */
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; padding: 2px 0; }
.checkbox-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--meridian-teal); }

/* ===== Section Heading inside cards ===== */
.section-title { font-size: 1rem; font-weight: 600; color: var(--deep-navy); margin-bottom: 12px; }

/* ===== Back Link ===== */
.back-link { color: var(--meridian-teal); text-decoration: none; font-size: 0.875rem; font-weight: 500; }
.back-link:hover { text-decoration: underline; }

/* ===== Mono text ===== */
.mono { font-family: var(--font-mono); }

/* ===== Nav icon SVG styling ===== */
.nav-icon { display: flex; align-items: center; justify-content: center; width: 24px; flex-shrink: 0; }
.nav-icon svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; }

/* ===== Toast Error (inline feedback) ===== */
.toast-error {
    position: fixed; bottom: 20px; right: 20px; background: #FEE2E2; color: #991B1B;
    padding: 12px 20px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000; display: flex; align-items: center; gap: 12px; font-size: 0.875rem;
}
.toast-error button { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: #991B1B; }

/* ===== Refreshing indicator ===== */
.refresh-hint { font-size: 0.8rem; color: var(--slate-grey); margin-left: 12px; }

/* ===== Report group ===== */
.report-group { margin-bottom: 24px; }
.report-group .group-header { font-size: 1rem; font-weight: 600; color: var(--deep-navy); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }

/* ===== Data Table (alias for .table in reports context) ===== */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th { text-align: left; padding: 10px 12px; background: var(--light-grey); color: var(--deep-navy); font-weight: 600; border-bottom: 2px solid var(--border-grey); }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-grey); }
.data-table tbody tr:nth-child(even) { background: #F8FAFC; }
.data-table tbody tr:hover { background: #EFF6FF; }
.data-table a { color: var(--meridian-teal); text-decoration: none; font-weight: 500; }
.data-table a:hover { text-decoration: underline; }

/* ===== Row highlighting ===== */
.row-danger { background: #FEF2F2 !important; }
.row-warning { background: #FFFBEB !important; }

/* ===== Stats Row (for report summaries) ===== */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }

/* ===== Modal ===== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
}
.modal-content {
    background: var(--white); border-radius: 8px; padding: 24px; max-width: 480px; width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-content h3 { color: var(--deep-navy); margin-bottom: 16px; }
.modal-actions { display: flex; gap: 12px; margin-top: 16px; }

/* ===== Content Card (used in some pages as alias) ===== */
.content-card { background: var(--white); border-radius: 8px; border: 1px solid var(--border-grey); padding: 20px; margin-bottom: 16px; }

/* ===== Table Card (no padding, overflow hidden) ===== */
.table-card { padding: 0; overflow: hidden; }

/* ===== Action Bar ===== */
.action-bar { display: flex; gap: 12px; align-items: center; margin-top: 16px; flex-wrap: wrap; }

/* ===== Page Header with ref badge ===== */
.page-header .dispatch-ref { background: var(--meridian-teal); color: var(--white); padding: 4px 12px; border-radius: 4px; font-weight: 600; font-size: 0.875rem; }

/* ===== Text utilities ===== */
.text-muted { color: var(--slate-grey); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.fw-bold { font-weight: 700; }

/* ===== Code preview ===== */
.code-preview { background: var(--light-grey); border: 1px solid var(--border-grey); border-radius: 6px; padding: 12px; font-family: var(--font-mono); font-size: 0.8rem; overflow: auto; white-space: pre-wrap; }

/* ===== Sortable table header ===== */
.sortable { cursor: pointer; user-select: none; }
.sortable:hover { background: rgba(13,148,136,0.08); }

/* ===== btn-success / btn-accent ===== */
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #15803D; }
.btn-accent { background: var(--meridian-teal); color: var(--white); }
.btn-accent:hover { background: var(--teal-hover); }
.btn-outline { background: transparent; color: var(--deep-navy); border: 1px solid var(--border-grey); }
.btn-outline:hover { background: var(--light-grey); }
.btn-lg { padding: 12px 28px; font-size: 1rem; }

/* ===== Card Body ===== */
.card-body { padding: 16px; }

/* ===== Workflow Form ===== */
.wf-form { display: grid; gap: 16px; max-width: 500px; }
.wf-timeline-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.wf-badge-sm { font-size: 11px; }
.wf-arrow { margin: 0 8px; }
.wf-meta { font-size: 13px; }
.wf-note { margin: 8px 0 0; color: var(--slate-grey); font-size: 13px; }
.wf-divider { border: none; border-top: 1px solid var(--border-grey); margin: 16px 0; }
.wf-resolved { color: var(--success); font-weight: 600; margin-top: 12px; }
.wf-link-input { flex: 1; }

/* ===== Condition Assessment ===== */
.ca-container { max-width: 800px; margin: 0 auto; }
.ca-success-header { background: var(--success); color: var(--white); padding: 12px 20px; border-radius: 8px 8px 0 0; margin: -20px -20px 16px -20px; }
.ca-summary { margin: 16px 0; }
.ca-submit { width: 100%; }

/* ===== Photo Gallery ===== */
.photo-gallery-body { padding: 16px; }
.photo-upload-zone { border: 2px dashed var(--border-grey); border-radius: 8px; padding: 20px; text-align: center; margin-bottom: 16px; transition: border-color 0.2s; }
.photo-upload-hint { color: var(--slate-grey); margin: 8px 0 0; font-size: 14px; }
.photo-upload-error { background: #FEE2E2; color: #991B1B; padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; font-size: 14px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.photo-card { border: 1px solid #E2E8F0; border-radius: 8px; overflow: hidden; position: relative; }
.photo-thumb { cursor: pointer; height: 140px; display: flex; align-items: center; justify-content: center; background: #F8FAFC; }
.photo-thumb img { max-width: 100%; max-height: 140px; object-fit: cover; }
.photo-info { padding: 8px; }
.photo-stage-badge { font-size: 11px; background: #E2E8F0; border-radius: 4px; padding: 2px 6px; }
.photo-caption { font-size: 12px; margin: 4px 0 0; color: var(--slate-grey); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-delete-btn { position: absolute; top: 4px; right: 4px; background: rgba(239,68,68,0.9); color: white; border: none; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; font-size: 14px; }
.photo-empty { text-align: center; color: var(--slate-grey); }
.lightbox-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 1000; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.lightbox-container { max-width: 90vw; max-height: 90vh; position: relative; }
.lightbox-container img { max-width: 90vw; max-height: 85vh; object-fit: contain; border-radius: 8px; }
.lightbox-caption { color: white; text-align: center; margin-top: 8px; }
.lightbox-close { position: absolute; top: -12px; right: -12px; background: white; color: #333; border: none; border-radius: 50%; width: 32px; height: 32px; font-size: 18px; cursor: pointer; }
.photo-confirm-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1001; display: flex; align-items: center; justify-content: center; }
.photo-confirm-dialog { width: 400px; padding: 24px; text-align: center; }
.photo-confirm-dialog h3 { margin: 0 0 12px; }
.photo-confirm-actions { display: flex; gap: 12px; justify-content: center; }

/* ===== Mobile Setup ===== */
.setup-section { margin-top: 16px; }
.setup-section-lg { margin-top: 24px; }
.checkbox-list { display: flex; flex-direction: column; gap: 8px; }
.checkbox-list-lg { display: flex; flex-direction: column; gap: 10px; }
.setup-test-row { margin-top: 24px; display: flex; align-items: center; gap: 16px; }
.setup-test-status { font-size: 0.85rem; }
.setup-guide-box { margin-top: 24px; padding: 16px; background: var(--light-grey); border-radius: 8px; }
.setup-guide-list { margin: 0; padding-left: 20px; font-size: 0.875rem; line-height: 1.8; }
.setup-guide-link { margin-top: 12px; }
.setup-guide-link a { color: var(--meridian-teal); font-weight: 500; text-decoration: none; }

/* ===== Audit Trail ===== */
.audit-card { margin-bottom: 8px; }
.audit-entry { padding: 8px 12px; }
.audit-entry-row { display: flex; justify-content: space-between; align-items: flex-start; }
.audit-field { margin-left: 8px; font-family: var(--font-mono); font-size: 0.85em; }
.audit-meta { text-align: right; font-size: 0.85rem; }
.audit-filter-actions { display: flex; gap: 8px; align-items: flex-end; }

/* ===== Notification Preferences ===== */
.pref-section { margin-top: 16px; }
.pref-description { margin-bottom: 16px; }
.pref-divider { border: none; border-top: 1px solid var(--border-grey); margin: 8px 0; }
.pref-save-row { margin-top: 24px; }
.pref-saved { margin-left: 12px; color: var(--success); font-size: 0.85rem; }

/* ===== Scan Page ===== */
.scan-container { max-width: 700px; margin: 0 auto; }
.scan-link-row { text-align: center; margin-top: 16px; }
.scan-recent-card { margin-top: 24px; }
.scan-item { padding: 8px 12px; border-bottom: 1px solid var(--border-grey); cursor: pointer; }

/* ===== Condition Assessment Photos ===== */
.ca-upload-zone { border: 2px dashed var(--border-grey); border-radius: 8px; padding: 24px; text-align: center; margin-bottom: 12px; }
.ca-upload-zone input { margin: 0 auto; }
.ca-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.ca-photo-item { position: relative; border: 1px solid #E2E8F0; border-radius: 8px; padding: 4px; text-align: center; }
.ca-photo-name { font-size: 12px; }
.ca-photo-remove { position: absolute; top: -6px; right: -6px; background: var(--danger); color: var(--white); border: none; border-radius: 50%; width: 20px; height: 20px; font-size: 12px; cursor: pointer; }

/* ===== General Goods Inline Overrides ===== */
.gg-issues-box { margin: 12px 0; padding: 12px; background: #fffbeb; border: 1px solid #f59e0b; border-radius: 8px; }
.gg-issue-item { margin-top: 4px; }

/* ===== Workflow Board ===== */
.kanban-scroll { overflow-x: auto; padding-bottom: 16px; }

/* ===== Badge margin helper ===== */
.badge-ml { margin-left: 8px; }
.badge-mr { margin-right: 8px; }
