:root {
    --bg-outer: #eef2f6;
    --bg-app: #f7f9fb;
    --bg-surface: #ffffff;
    --bg-subtle: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --primary: #732dbb;
    --primary-rgb: 115, 45, 187;
    --primary-dark: #5b2494;
    --primary-soft: #ead9f8;
    --primary-tint: #f8f3fc;
    --primary-border: #d6b4ec;
    --primary-border-strong: #c796e3;
    --primary-accent: #a855f7;
    --accent-blue: #0284c7;
    --accent-indigo: #4f46e5;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --control-height: 46px;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    font-family: var(--font-sans);
    background-color: var(--bg-outer);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Mobile-First Native App Shell */
.app-viewport {
    position: relative;
    width: 100%;
    max-width: 440px;
    height: 100dvh;
    margin: 0 auto;
    background-color: var(--bg-app);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(15, 23, 42, 0.12);
}

@media (min-width: 480px) {
    body {
        padding: 16px 0;
    }
    .app-viewport {
        height: calc(100dvh - 32px);
        border-radius: 28px;
        border: 1px solid var(--border-color);
    }
}

/* Top Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    z-index: 20;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease;
}

.icon-btn:hover {
    background: var(--bg-subtle);
}

.icon-btn svg {
    transition: transform 0.2s ease;
}

.icon-btn[aria-expanded="false"] svg {
    transform: rotate(-90deg);
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-title {
    display: block;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.brand-sub {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.device-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.device-pill.connected {
    background: var(--primary-tint);
    border-color: var(--primary-border);
    color: var(--primary-dark);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
}

.device-pill.connected .status-dot {
    background: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.2);
}

/* Workflow Stepper */
.stepper-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.step-item.active {
    color: var(--primary-dark);
}

.step-item.active .step-num {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.step-item.done {
    color: var(--success);
}

.step-item.done .step-num {
    background: #dcfce7;
    border-color: #86efac;
    color: var(--success);
}

.step-line {
    flex: 1;
    height: 1px;
    background: var(--border-color);
    margin: 0 6px;
}

/* Main Scrollable Body */
.app-main {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    scroll-behavior: smooth;
}

.view {
    display: none;
    animation: fadeSlideUp 0.22s ease;
}

.view.active {
    display: block;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cards & Typography */
.card, .hero-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
}

.hero-card {
    background: linear-gradient(180deg, #ffffff 0%, var(--primary-tint) 100%);
    border-color: var(--primary-soft);
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 10px;
}

.hero-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.hero-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 14px;
}

.card-header {
    margin-bottom: 14px;
}

.card-header.row-between {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.card-header h2, .card-header h3 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.text-muted {
    color: var(--text-muted);
    font-size: 12px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 16px 2px 10px;
}

.section-header h2 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Segmented Control */
.segmented-control {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--bg-subtle);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 14px;
}

.segment-btn {
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.segment-btn.active {
    background: var(--bg-surface);
    color: var(--primary-dark);
    box-shadow: var(--shadow-sm);
}

/* Uniform Buttons */
.btn {
    height: var(--control-height);
    padding: 0 18px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn:active {
    transform: scale(0.99);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    height: 36px;
    padding: 0 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

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

.btn-secondary {
    background: var(--primary-tint);
    border-color: var(--primary-border);
    color: var(--primary-dark);
}

.btn-outline {
    background: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Metrics Strip */
.metrics-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.metric-tile {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 8px;
    text-align: center;
}

.metric-value {
    display: block;
    font-size: 17px;
    font-weight: 700;
    color: var(--primary-dark);
}

.metric-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Feature List */
.feature-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.feature-card {
    display: flex;
    gap: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
}

.feature-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.feature-icon.teal { background: var(--primary-soft); color: var(--primary-dark); }
.feature-icon.blue { background: #e0f2fe; color: #0369a1; }
.feature-icon.indigo { background: #e0e7ff; color: #4338ca; }

.feature-body h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 2px;
}

.feature-body p {
    font-size: 12px;
    color: var(--text-secondary);
}

.install-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--primary-tint);
    border: 1px solid var(--primary-soft);
    border-radius: var(--radius-md);
    margin-bottom: 14px;
}

.install-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.install-copy {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.install-copy strong {
    font-size: 13px;
}

.install-copy span {
    font-size: 11px;
    color: var(--text-secondary);
}

.info-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 12px;
}

.info-banner svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--primary-dark);
}

/* Uniform Form Controls */
.form-group {
    margin-bottom: 14px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.req {
    color: var(--danger);
}

.form-control {
    width: 100%;
    height: var(--control-height);
    padding: 0 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control.textarea {
    height: auto;
    padding: 12px 14px;
    resize: vertical;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.14);
}

.field-error {
    display: block;
    font-size: 11px;
    color: var(--danger);
    margin-top: 4px;
    min-height: 14px;
}

/* Fitzpatrick Phototype Grid */
.phototype-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.photo-chip {
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.photo-chip .swatch {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--swatch);
    border: 1px solid rgba(0, 0, 0, 0.15);
}

.photo-chip.active {
    border-color: var(--primary);
    background: var(--primary-tint);
    color: var(--primary-dark);
}

/* Concern Tags */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-pill {
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-subtle);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
}

.tag-pill.active {
    background: var(--primary-soft);
    border-color: var(--primary-border-strong);
    color: var(--primary-dark);
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    margin: 10px 0 4px;
    cursor: pointer;
}

.checkbox-row input {
    margin-top: 3px;
    accent-color: var(--primary);
}

.form-actions {
    margin-top: 14px;
}

.form-actions.stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Step 2: Device Pairing Stage */
.hardware-stage {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px 16px;
    text-align: center;
    margin-bottom: 16px;
}

.hardware-ring {
    width: 144px;
    height: 144px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px dashed #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.hardware-ring.pairing {
    border-style: solid;
    border-color: var(--primary);
    animation: pulseRing 1.2s infinite;
}

.hardware-ring.paired {
    border-style: solid;
    border-color: var(--success);
    background: #f0fdf4;
}

@keyframes pulseRing {
    0% { box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0.35); }
    70% { box-shadow: 0 0 0 14px rgba(var(--primary-rgb), 0); }
    100% { box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0); }
}

.hardware-unit {
    width: 104px;
    height: 104px;
    border-radius: 24px;
    background: linear-gradient(145deg, #1e293b, #0f172a);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: var(--shadow-md);
}

.lens-outer {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #64748b;
}

.lens-inner {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #38bdf8, #0f172a 75%);
    position: relative;
}

.lens-glint {
    position: absolute;
    top: 4px;
    left: 5px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
}

.sensor-leds {
    display: flex;
    gap: 6px;
}

.led {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #475569;
}

.led.active {
    background: var(--primary-accent);
}

.unit-model {
    font-size: 9px;
    letter-spacing: 0.06em;
    color: #94a3b8;
    font-weight: 700;
}

.connection-state {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.telemetry-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.telemetry-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
}

.tel-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bg-subtle);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tel-info {
    flex: 1;
}

.tel-info strong {
    display: block;
    font-size: 13px;
}

.tel-info span {
    font-size: 11px;
    color: var(--text-muted);
}

.tel-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
}

.tel-badge.pending {
    background: var(--bg-subtle);
    color: var(--text-muted);
}

.tel-badge.ready {
    background: #dcfce7;
    color: var(--success);
}

/* Step 3: Optical Capture Viewfinder */
.capture-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.spectrum-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    background: var(--bg-surface);
    padding: 6px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.spec-chip {
    height: 34px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
}

.spec-chip.active {
    background: var(--primary);
    color: #ffffff;
}

.viewfinder-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 360 / 430;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #0f172a;
    border: 2px solid var(--border-color);
}

#opticalCanvas, #liveWebcam {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.face-guide-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    pointer-events: none;
    color: rgba(255, 255, 255, 0.85);
}

.reticle-svg {
    width: 82%;
    height: auto;
    margin-top: 10px;
}

.alignment-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(6px);
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
}

.alignment-pill .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary-accent);
}

.capture-flash {
    position: absolute;
    inset: 0;
    background: #ffffff;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.capture-flash.active {
    opacity: 0.9;
}

.capture-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px;
}

.shutter-btn {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    border: 4px solid var(--primary);
    background: #ffffff;
    padding: 4px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.shutter-inner {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--primary);
    transition: transform 0.12s ease;
}

.shutter-btn:active .shutter-inner {
    transform: scale(0.9);
}

.capture-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* Step 4: Diagnostic Report */
.report-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 14px;
}

.score-ring-wrap {
    position: relative;
    width: 84px;
    height: 84px;
    flex-shrink: 0;
}

.score-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: var(--bg-subtle);
    stroke-width: 9;
}

.ring-fg {
    fill: none;
    stroke: var(--primary);
    stroke-width: 9;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s ease;
}

.score-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.score-num {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.score-max {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
}

.report-meta {
    flex: 1;
    min-width: 0;
}

.meta-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 4px;
}

.clinical-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 6px;
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.scan-time {
    font-size: 11px;
    color: var(--text-muted);
}

.report-meta h2 {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-subline {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.benchmark-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-blue);
    background: #e0f2fe;
    padding: 4px 8px;
    border-radius: 6px;
}

/* Heatmap Layer Controls */
.layer-toggles {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 10px;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 20px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 20px), transparent 100%);
}

.layer-toggles::-webkit-scrollbar {
    display: none;
}

.layer-btn {
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-subtle);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
}

.layer-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.heatmap-stage {
    position: relative;
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #0f172a;
    margin-bottom: 12px;
}

#reportHeatmapCanvas {
    width: 100%;
    height: auto;
    display: block;
}

.hotspot-layer {
    position: absolute;
    inset: 0;
}

.map-pin {
    position: absolute;
    width: 26px;
    height: 26px;
    margin: -13px 0 0 -13px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    background: rgba(217, 119, 6, 0.92);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    transition: transform 0.15s ease;
}

.map-pin.active {
    transform: scale(1.22);
    background: var(--primary);
}

.hotspot-detail-box {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
}

.hotspot-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.severity-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.severity-dot.low { background: var(--success); }
.severity-dot.moderate { background: var(--warning); }
.severity-dot.high { background: var(--danger); }

.hotspot-header strong {
    font-size: 13px;
    flex: 1;
}

.zone-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.hotspot-detail-box p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Measurable Parameters */
.parameters-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.param-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.param-top {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.param-name {
    font-weight: 600;
}

.param-val {
    font-weight: 700;
    color: var(--text-primary);
}

.param-track {
    height: 8px;
    border-radius: 999px;
    background: var(--bg-subtle);
    overflow: hidden;
}

.param-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.6s ease;
}

.param-note {
    font-size: 11px;
    color: var(--text-muted);
}

/* Diagnostic Insights */
.insights-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.insight-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 13px;
    background: var(--bg-surface);
}

.insight-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.insight-title {
    font-weight: 700;
    font-size: 14px;
}

.conf-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--primary-tint);
    color: var(--primary-dark);
}

.insight-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.insight-rec {
    font-size: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Progress & History */
.trend-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background: var(--bg-subtle);
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
}

.trend-stat {
    text-align: center;
}

.trend-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

.trend-val {
    font-size: 15px;
    font-weight: 700;
}

.trend-val.positive {
    color: var(--success);
}

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

.history-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.history-card:hover {
    border-color: var(--primary);
}

.history-score {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary-tint);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Bottom Navigation */
.bottom-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 6px 8px 10px;
    flex-shrink: 0;
}

.nav-tab {
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 0;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}

.nav-tab.active {
    color: var(--primary-dark);
}

/* AJAX Loader Overlay */
.ajax-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 50;
}

.loader-card {
    width: 100%;
    max-width: 320px;
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.spinner {
    width: 42px;
    height: 42px;
    margin: 0 auto 14px;
    border: 4px solid var(--primary-soft);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader-card h3 {
    font-size: 16px;
    margin-bottom: 6px;
}

.loader-card p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.loader-progress-track {
    height: 6px;
    background: var(--bg-subtle);
    border-radius: 999px;
    overflow: hidden;
}

.loader-progress-fill {
    height: 100%;
    width: 10%;
    background: var(--primary);
    transition: width 0.3s ease;
}

/* Bottom Sheet Modal */
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: flex-end;
    z-index: 60;
}

.modal-sheet {
    width: 100%;
    background: #ffffff;
    border-radius: 24px 24px 0 0;
    padding: 12px 18px 24px;
    animation: slideUpSheet 0.22s ease;
}

@keyframes slideUpSheet {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-handle {
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: #cbd5e1;
    margin: 0 auto 12px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.share-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.share-option-btn {
    width: 100%;
    text-align: left;
    padding: 13px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-subtle);
    font-family: inherit;
    cursor: pointer;
}

.share-option-btn strong {
    display: block;
    font-size: 13px;
    color: var(--text-primary);
}

.share-option-btn span {
    font-size: 11px;
    color: var(--text-muted);
}

/* Toast Notifications */
.toast-container {
    position: absolute;
    top: 66px;
    left: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    z-index: 70;
}

.toast {
    padding: 11px 14px;
    border-radius: var(--radius-md);
    background: #0f172a;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    animation: fadeSlideUp 0.2s ease;
}

.toast.success {
    background: #065f46;
}

.toast.error {
    background: #991b1b;
}

.hidden {
    display: none !important;
}

@media print {
    body { background: #ffffff; padding: 0; }
    .app-viewport { max-width: 100%; height: auto; box-shadow: none; border: none; }
    .bottom-nav, .stepper-bar, .app-header, #clinicianNotesCard { display: none !important; }
    .app-main { overflow: visible; }
}