/* ═══════════════════════════════════════════════════════════════════════════
   EnginEar — Design System
   Tokens aligned with MARKUP_DOCUMENT.md
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    /* Backgrounds */
    --bg-dark:       #0b0f19;
    --bg-darker:     #070a12;
    --glass-bg:      rgba(18, 24, 38, 0.75);
    --glass-border:  rgba(255, 255, 255, 0.08);

    /* Accent — Neon Cyan */
    --accent:        #00f2fe;
    --accent-alt:    #4facfe;
    --accent-glow:   rgba(0, 242, 254, 0.35);

    /* Semantic Colors */
    --critical:      #ff0055;
    --critical-glow: rgba(255, 0, 85, 0.35);
    --warning:       #ffb703;
    --warning-glow:  rgba(255, 183, 3, 0.35);
    --success:       #00f5d4;
    --success-glow:  rgba(0, 245, 212, 0.35);

    /* Typography */
    --text-main:     #f8fafc;
    --text-muted:    #94a3b8;
    --text-dim:      #4a5568;

    /* Spacing & Shape */
    --radius-card:   12px;
    --radius-pill:   24px;
    --radius-input:  8px;
    --shadow-card:   0 8px 32px rgba(0, 0, 0, 0.37);
}

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

body {
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: radial-gradient(ellipse at top right, #111827, var(--bg-darker));
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.mono {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ─── Screen-reader only (visually hidden but accessible) ────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ─── App Container ──────────────────────────────────────────────────────── */
.app-container {
    width: 100%;
    max-width: 500px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ─── Glass Utility ──────────────────────────────────────────────────────── */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
}

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════════════════ */
.glass-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.25rem;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
}

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

.logo-icon {
    font-size: 1.4rem;
}

/* Backend Status Pill */
.status-pill {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-dim);
    flex-shrink: 0;
}

.status-dot.checking {
    background: #f6ad55;
    animation: dotPulse 1s infinite;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 6px var(--success-glow);
    animation: dotPulse 2s infinite;
}

.status-dot.offline {
    background: #cbd5e0;
    box-shadow: none;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* EN | ES Language Toggle */
.lang-toggle {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 0.2rem 0.35rem;
    gap: 0.1rem;
}

.lang-btn {
    background: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.45rem;
    border-radius: 14px;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
}

.lang-btn.lang-active {
    background: var(--accent-glow);
    color: var(--accent);
}

.lang-btn:hover:not(.lang-active) {
    color: var(--text-main);
}

.lang-sep {
    color: var(--glass-border);
    font-size: 0.75rem;
    user-select: none;
    line-height: 1;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.25s ease;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.45rem 1rem;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-outline:hover {
    background: var(--accent-glow);
    box-shadow: 0 0 12px var(--accent-glow);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.btn-ghost:hover {
    border-color: var(--glass-border);
    color: var(--text-main);
}

/* ═══════════════════════════════════════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════════════════════════════════════ */
.hero {
    text-align: center;
    padding: 0.5rem 0;
}

.hero h1 {
    font-size: 2.6rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    line-height: 1.2;
    background: linear-gradient(90deg, var(--text-main), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   INTAKE MODULE — Tabs
   ═══════════════════════════════════════════════════════════════════════════ */
.intake-module {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.tabs {
    display: flex;
    gap: 1.25rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

/* ─── Guidance & Context Accordions ──────────────────────────────────────── */
.guidance-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.accordion-item {
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-input);
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.accordion-item[open] {
    border-color: rgba(0, 242, 254, 0.25);
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.accordion-header::-webkit-details-marker {
    display: none;
}

.accordion-header:hover {
    color: var(--accent);
}

.accordion-header .chevron {
    font-size: 0.75rem;
    transition: transform 0.25s ease;
}

.accordion-item[open] .chevron {
    transform: rotate(180deg);
}

.accordion-body {
    padding: 0.5rem 0.85rem 0.85rem 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* Protocol Tips List */
.protocol-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.protocol-list li strong {
    color: var(--text-main);
}

/* Vehicle Context Form */
.context-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.input-text {
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-input);
    padding: 0.55rem 0.75rem;
    color: var(--text-main);
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
}

.input-text:focus {
    border-color: var(--accent);
}

.input-text::placeholder {
    color: var(--text-dim);
}

.context-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.context-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.context-field label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.select-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-input);
    padding: 0.45rem 0.6rem;
    color: var(--text-main);
    font-size: 0.78rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
}

.select-input option {
    background: var(--bg-dark);
    color: var(--text-main);
}

.tab {
    background: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.4rem 0;
    position: relative;
}

.tab.active {
    color: var(--text-main);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-alt));
    box-shadow: 0 0 8px var(--accent-glow);
}

.tab-content {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.tab-content.active {
    display: flex;
}

/* ─── Record Controls ────────────────────────────────────────────────────── */
.record-controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.visualizer-placeholder {
    position: relative;
    width: 150px;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--accent-glow);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%   { transform: scale(0.85); opacity: 0.6; }
    100% { transform: scale(1.2);  opacity: 0; }
}

.btn-record {
    position: relative;
    z-index: 1;
    width: 114px;
    height: 114px;
    border-radius: 50%;
    background: linear-gradient(145deg, #1a2035, #0f1525);
    border: 2px solid var(--accent);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 0 24px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.05);
    letter-spacing: 0.02em;
}

.btn-record:hover {
    box-shadow: 0 0 36px var(--accent-glow);
}

.btn-record.recording {
    border-color: var(--critical);
    box-shadow: 0 0 24px var(--critical-glow);
}

.record-icon {
    width: 14px;
    height: 14px;
    background: var(--critical);
    border-radius: 50%;
    transition: border-radius 0.2s ease;
}

.timer-display {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    transition: color 0.3s ease;
}

.timer-display.is-recording {
    color: var(--accent);
}

/* Target duration reached — also announced in text via #statusMsg */
.timer-display.target-reached {
    color: var(--success);
}

.status-text {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ─── Upload Zone ────────────────────────────────────────────────────────── */
.upload-zone {
    width: 100%;
    padding: 2.5rem 1rem;
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius-card);
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent);
    background: rgba(0, 242, 254, 0.04);
    box-shadow: inset 0 0 20px rgba(0, 242, 254, 0.04);
}

.upload-icon {
    font-size: 2rem;
}

.upload-primary {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.upload-hint {
    font-size: 0.78rem;
    color: var(--text-dim);
    letter-spacing: 0.05em;
}

/* ─── Preset Select ──────────────────────────────────────────────────────── */
.preset-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.preset-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.preset-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-input);
    color: var(--text-main);
    padding: 0.65rem 0.9rem;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    padding-right: 2.5rem;
}

.preset-select:hover,
.preset-select:focus {
    border-color: var(--accent);
}

.preset-select option {
    background: #1a2035;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CANVAS VISUALIZER
   ═══════════════════════════════════════════════════════════════════════════ */
.visualizer-section {
    padding: 0;
    overflow: hidden;
    height: 110px;
    border-color: rgba(0, 242, 254, 0.12);
}

.visualizer-canvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: var(--radius-card);
}

/* ═══════════════════════════════════════════════════════════════════════════
   DIAGNOSTIC DASHBOARD
   ═══════════════════════════════════════════════════════════════════════════ */
.hidden {
    display: none !important;
}

.dashboard {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.dashboard.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Urgency Pill */
.urgency-pill {
    padding: 0.3rem 0.85rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 1px solid currentColor;
}

.urgency-critical {
    color: var(--critical);
    background: rgba(255, 0, 85, 0.12);
    box-shadow: 0 0 12px var(--critical-glow);
}

.urgency-moderate {
    color: var(--warning);
    background: rgba(255, 183, 3, 0.12);
    box-shadow: 0 0 12px var(--warning-glow);
}

.urgency-warning {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.14);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
}

.urgency-normal {
    color: var(--success);
    background: rgba(0, 245, 212, 0.12);
    box-shadow: 0 0 12px var(--success-glow);
}

/* Cause Block */
.cause-block {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.cause-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.cause-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.25;
}

.cause-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Confidence Bar */
.confidence-block {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.confidence-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conf-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.conf-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
}

.confidence-bar-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.confidence-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-alt));
    border-radius: 3px;
    box-shadow: 0 0 8px var(--accent-glow);
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Audio Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}

.metric-card {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-input);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.metric-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.metric-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Recommendations */
.recommendations h4 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.recommendations p {
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ACCURACY FEEDBACK MODULE
   ═══════════════════════════════════════════════════════════════════════════ */
.feedback-section {
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-input);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

.feedback-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.feedback-rating-group {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.btn-feedback {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    padding: 0.45rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
}

.btn-feedback:hover {
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

.btn-feedback.active {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(0, 242, 254, 0.1);
    box-shadow: 0 0 10px var(--accent-glow);
}

.feedback-followup {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    animation: fadeIn 0.3s ease-out;
}

.feedback-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.feedback-field label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
}

.textarea-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-input);
    padding: 0.55rem 0.75rem;
    color: var(--text-main);
    font-size: 0.8rem;
    font-family: inherit;
    outline: none;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.textarea-input:focus {
    border-color: var(--accent);
}

.textarea-input::placeholder {
    color: var(--text-dim);
}

.btn-submit-feedback {
    background: linear-gradient(90deg, var(--accent), var(--accent-alt));
    color: var(--bg-dark);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    align-self: flex-start;
}

.btn-submit-feedback:hover {
    box-shadow: 0 0 12px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-submit-feedback:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.feedback-success {
    padding: 0.65rem 0.85rem;
    background: rgba(0, 245, 212, 0.08);
    border: 1px solid rgba(0, 245, 212, 0.25);
    border-radius: var(--radius-input);
    color: var(--success);
    font-size: 0.78rem;
    line-height: 1.45;
    animation: fadeIn 0.3s ease-out;
}

/* Save Report Button */
.btn-save {
    width: 100%;
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 0.75rem;
    border-radius: var(--radius-input);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.25s ease;
}

.btn-save:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(0, 242, 254, 0.05);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════════════════ */
.app-footer {
    text-align: center;
    margin-top: 0.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--glass-border);
}

.app-footer a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    transition: color 0.2s ease;
}

.app-footer a:hover {
    color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL (Disclaimer)
   ═══════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    padding: 1.5rem;
}

.modal-overlay.modal-visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-card);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5), 0 0 20px var(--critical-glow);
    transform: translateY(20px);
    transition: transform 0.4s ease;
}

.modal-overlay.modal-visible .modal-content {
    transform: translateY(0);
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: pulse 2s infinite ease-in-out;
}

.modal-title {
    color: var(--critical);
    font-size: 1.4rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.modal-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-dark);
    padding: 0.75rem 2rem;
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 0.95rem;
    border: none;
    width: 100%;
    transition: all 0.25s ease;
}

.btn-primary:hover {
    box-shadow: 0 0 15px var(--accent-glow);
    transform: translateY(-2px);
}

/* Auth Modal Specifics */
.auth-modal-content {
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text-main);
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    background: #ffffff;
    color: #3c4043;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid transparent;
    transition: all 0.25s ease;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn-google:hover {
    background: #f8f9fa;
    box-shadow: 0 4px 12px rgba(255,255,255,0.1);
    transform: translateY(-1px);
}

.google-icon {
    width: 1.25rem;
    height: 1.25rem;
}


/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVENESS (Screens under 480px)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .app-container {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .glass-header {
        flex-direction: column;
        align-items: center;
        gap: 0.85rem;
        padding: 1rem;
    }

    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        gap: 0.4rem;
    }

    .logo {
        justify-content: center;
    }

    .btn-ghost, .btn-outline {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 0.85rem;
    }

    .tabs {
        gap: 0.25rem;
        justify-content: space-between;
    }

    .tab {
        font-size: 0.8rem;
    }

    .metrics-grid {
        gap: 0.4rem;
    }
    
    .context-grid {
        grid-template-columns: 1fr;
    }

    .feedback-rating-group {
        flex-direction: column;
    }
    
    .metric-value {
        font-size: 0.85rem;
    }

    .metric-label {
        font-size: 0.65rem;
    }

    .modal-content {
        padding: 1.5rem;
        margin: 1rem;
    }

    /* Full-width submit button on mobile */
    .btn-submit-feedback {
        align-self: stretch;
        text-align: center;
    }
}

/* ─── Very small screens (< 360px — iPhone SE 1st gen, Galaxy A series) ─── */
@media (max-width: 360px) {
    .status-pill    { font-size: 0.6rem; padding: 0.15rem 0.4rem; }
    .btn-ghost      { padding: 0.35rem 0.4rem; font-size: 0.7rem; }
    .btn-outline    { padding: 0.35rem 0.6rem; font-size: 0.7rem; }
    .hero h1        { font-size: 1.6rem; }
    .cause-value    { font-size: 1rem; }
    .btn-feedback   { font-size: 0.7rem; padding: 0.4rem 0.4rem; }
    .dashboard      { padding: 1rem; }
    .intake-module  { padding: 1rem; }
}

/* ─── Global overflow protection for long text ───────────────────────────── */
.cause-value,
.cause-description,
.recommendations p,
.snr-message {
    overflow-wrap: break-word;
    word-break:    break-word;
}

/* Prevent flex children from overflowing their container */
.logo {
    min-width: 0;
    flex-shrink: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SNR AMBIENT NOISE BANNER
   ═══════════════════════════════════════════════════════════════════════════ */
.snr-banner {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-input);
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    animation: fadeIn 0.25s ease-out;
}

.snr-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.snr-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--text-dim);
    flex-shrink: 0;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.snr-dot.checking {
    background: var(--text-dim);
    animation: dotPulse 0.8s infinite;
}

.snr-dot.quiet {
    background: var(--success);
    box-shadow: 0 0 6px var(--success-glow);
}

.snr-dot.moderate {
    background: var(--warning);
    box-shadow: 0 0 6px var(--warning-glow);
}

.snr-dot.loud {
    background: var(--critical);
    box-shadow: 0 0 8px var(--critical-glow);
    animation: dotPulse 0.5s infinite;
}

.snr-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

.snr-message {
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.45;
    padding-left: 1.25rem;
}

.snr-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-top: 0.25rem;
}

.btn-snr {
    flex: 1;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 600;
    min-width: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: inherit;
}

.btn-snr-retry {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
}

.btn-snr-retry:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-snr-proceed {
    background: transparent;
    border: 1px solid var(--critical);
    color: var(--critical);
}

.btn-snr-proceed:hover {
    background: rgba(255, 0, 85, 0.1);
    box-shadow: 0 0 8px var(--critical-glow);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
