/* ── Visita PWA — Clinical Futurism Design System ─────────────────────────── */
/* Dark surgical HUD with luminous accents                                    */

/* ── Fonts ───────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Syne:wght@600;700;800&display=swap');

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

:root {
    /* ── Core palette ── */
    --bg-deep:        #060a14;
    --bg-base:        #0a0e1a;
    --bg-surface:     #111827;
    --bg-elevated:    #1a2236;
    --bg-glass:       rgba(17, 24, 39, 0.72);

    /* ── Accent: clinical cyan ── */
    --accent:         #00e5ff;
    --accent-dim:     rgba(0, 229, 255, 0.15);
    --accent-glow:    rgba(0, 229, 255, 0.35);
    --accent-border:  rgba(0, 229, 255, 0.25);

    /* ── Semantic ── */
    --recording:      #ff1744;
    --recording-glow: rgba(255, 23, 68, 0.3);
    --success:        #00e676;
    --success-dim:    rgba(0, 230, 118, 0.12);
    --warning:        #ffab40;
    --warning-dim:    rgba(255, 171, 64, 0.12);
    --error:          #ff5252;
    --error-dim:      rgba(255, 82, 82, 0.12);

    /* ── Text ── */
    --text-primary:   #e8ecf4;
    --text-secondary: #7b8794;
    --text-muted:     #4a5568;

    /* ── Structure ── */
    --border:         rgba(255, 255, 255, 0.06);
    --border-accent:  rgba(0, 229, 255, 0.12);
    --divider:        rgba(255, 255, 255, 0.04);

    /* ── Elevation ── */
    --shadow-sm:      0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md:      0 4px 12px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
    --shadow-lg:      0 12px 40px rgba(0,0,0,0.6), 0 4px 12px rgba(0,0,0,0.4);
    --shadow-glow:    0 0 20px rgba(0, 229, 255, 0.15), 0 0 60px rgba(0, 229, 255, 0.05);

    /* ── Radius ── */
    --radius-sm:      6px;
    --radius-md:      10px;
    --radius-lg:      16px;
    --radius-xl:      20px;

    /* ── Motion ── */
    --ease-out:       cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring:    cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition:     0.2s var(--ease-out);
    --transition-slow: 0.4s var(--ease-out);

    /* ── Safe areas ── */
    --safe-top:       env(safe-area-inset-top, 0px);
    --safe-bottom:    env(safe-area-inset-bottom, 0px);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    padding-bottom: calc(80px + var(--safe-bottom));
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Subtle scan-line texture overlay ────────────────────────────────────── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10000;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 229, 255, 0.008) 2px,
        rgba(0, 229, 255, 0.008) 4px
    );
}

/* ── Offline banner (D-21) ────────────────────────────────────────────────── */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 36px;
    background: linear-gradient(90deg, var(--warning-dim), rgba(255, 171, 64, 0.2));
    border-bottom: 1px solid rgba(255, 171, 64, 0.3);
    color: var(--warning);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 0 16px;
    text-align: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

body:has(.offline-banner:not([hidden])) .header {
    top: 36px;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    padding-top: var(--safe-top);
    z-index: 100;
}

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

.header-date {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.3px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-doctor {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pending-count {
    font-size: 11px;
    color: var(--warning);
    background: var(--warning-dim);
    border: 1px solid rgba(255, 171, 64, 0.25);
    border-radius: 20px;
    padding: 2px 10px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

/* ── Auth section ─────────────────────────────────────────────────────────── */
.auth-section {
    min-height: calc(100vh - 56px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 229, 255, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(0, 229, 255, 0.04), transparent);
}

.auth-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-glow);
    padding: 48px 36px;
    text-align: center;
    max-width: 380px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* Subtle top-line accent */
.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    border-radius: 1px;
}

.auth-logo {
    margin-bottom: 20px;
}

.auth-logo img {
    border-radius: 16px;
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.15);
}

.auth-title {
    font-family: 'Syne', sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 36px;
    line-height: 1.5;
}

.btn-google {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 28px;
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--transition);
    cursor: pointer;
}

.btn-google:hover, .btn-google:focus {
    border-color: var(--accent-border);
    box-shadow: var(--shadow-glow);
    background: rgba(0, 229, 255, 0.05);
    outline: none;
}

.btn-google:active {
    transform: scale(0.98);
}

.google-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ── Main area ────────────────────────────────────────────────────────────── */
.main-area {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 0 16px 0;
}

/* ── Toolbar ──────────────────────────────────────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 14px 16px 8px;
    gap: 8px;
}

.btn-gerar-todos {
    padding: 10px 22px;
    background: linear-gradient(135deg, var(--accent), #00b8d4);
    color: var(--bg-deep);
    border: none;
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all var(--transition);
    text-transform: uppercase;
}

.btn-gerar-todos:disabled {
    background: var(--bg-elevated);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-gerar-todos:not(:disabled):hover {
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
    transform: translateY(-1px);
}

/* ── Patient list ─────────────────────────────────────────────────────────── */
.patient-list {
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 64px 24px;
}

.empty-text {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-hint {
    font-size: 14px;
    color: var(--text-muted);
}

/* ── Patient card ─────────────────────────────────────────────────────────── */
.patient-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
    position: relative;
}

.patient-card:hover {
    border-color: var(--accent-border);
    box-shadow: 0 0 24px rgba(0, 229, 255, 0.06);
}

/* Accent top stripe on each card */
.patient-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 10%, var(--accent-border) 50%, transparent 90%);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background var(--transition);
}

.card-header:hover {
    background: rgba(0, 229, 255, 0.02);
}

.card-header:focus {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.card-position {
    font-family: 'Syne', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: var(--accent);
    min-width: 32px;
    text-align: center;
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    letter-spacing: 0.2px;
}

.card-chevron {
    font-size: 11px;
    color: var(--text-muted);
    transition: transform var(--transition);
}

.card-body {
    padding: 0 18px 18px;
    border-top: 1px solid var(--divider);
}

.card-body.collapsed {
    display: none;
}

/* ── Card sections ────────────────────────────────────────────────────────── */
.section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    margin: 14px 0 6px;
}

.recordings-section, .photos-section {
    margin-bottom: 8px;
}

.recordings-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.recordings-list li {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 0;
}

.recordings-empty {
    font-style: italic;
    opacity: 0.5;
}

.recording-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary) !important;
}

.recording-duration {
    font-size: 12px;
    font-family: 'DM Sans', monospace;
    color: var(--accent);
    margin-left: auto;
    opacity: 0.8;
}

.photos-count {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 0;
}

/* ── Thumbnail strip ──────────────────────────────────────────────────────── */
.thumbnail-strip {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.thumbnail-strip img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
    opacity: 0.9;
}

.thumbnail-strip img:hover {
    transform: scale(1.08);
    border-color: var(--accent-border);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.15);
    opacity: 1;
}

.thumb-more {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0 4px;
}

/* ── Card action buttons ──────────────────────────────────────────────────── */
.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.btn-gravar, .btn-foto, .btn-gerar-evolucao {
    flex: 1;
    min-width: 80px;
    padding: 10px 14px;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.btn-gravar {
    background: var(--recording);
    color: white;
    box-shadow: 0 0 12px var(--recording-glow);
}

.btn-gravar:hover {
    box-shadow: 0 0 24px rgba(255, 23, 68, 0.4);
    transform: translateY(-1px);
}

.btn-gravar:active {
    transform: scale(0.97);
}

.btn-foto {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent-border);
}

.btn-foto:hover:not(:disabled) {
    background: var(--accent-dim);
    border-color: rgba(0, 229, 255, 0.4);
}

.btn-gerar-evolucao {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-gerar-evolucao:hover:not(:disabled) {
    border-color: var(--accent-border);
    color: var(--accent);
}

.btn-foto:disabled, .btn-gerar-evolucao:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ── Recording indicator ──────────────────────────────────────────────────── */
.recording-indicator-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: pulse-recording 1s ease-in-out infinite;
    flex-shrink: 0;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

@keyframes pulse-recording {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.3; transform: scale(0.6); }
}

/* ── Recording state on card ──────────────────────────────────────────────── */
/* When card has active recording, add glow border effect */
.patient-card:has(.recording-indicator-dot:not([hidden])) {
    border-color: rgba(255, 23, 68, 0.4);
    box-shadow: 0 0 30px var(--recording-glow), inset 0 0 30px rgba(255, 23, 68, 0.03);
    animation: card-recording-pulse 2s ease-in-out infinite;
}

@keyframes card-recording-pulse {
    0%, 100% { box-shadow: 0 0 20px var(--recording-glow), inset 0 0 20px rgba(255, 23, 68, 0.02); }
    50%       { box-shadow: 0 0 40px rgba(255, 23, 68, 0.35), inset 0 0 40px rgba(255, 23, 68, 0.04); }
}

/* ── Status badges ────────────────────────────────────────────────────────── */
.card-badge {
    font-family: 'DM Sans', sans-serif;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.status-gravando {
    background: var(--recording-glow);
    color: var(--recording);
    animation: pulse-status 1.5s ease-in-out infinite;
    box-shadow: 0 0 12px var(--recording-glow);
}

.status-salvo {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.status-fila {
    background: var(--warning-dim);
    color: var(--warning);
    border: 1px solid rgba(255, 171, 64, 0.2);
}

.status-enviando {
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid var(--accent-border);
}

.status-enviado {
    background: var(--success-dim);
    color: var(--success);
    border: 1px solid rgba(0, 230, 118, 0.2);
}

.status-erro {
    background: var(--error-dim);
    color: var(--error);
    border: 1px solid rgba(255, 82, 82, 0.2);
}

@keyframes pulse-status {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

/* ── FAB ──────────────────────────────────────────────────────────────────── */
.fab {
    position: fixed;
    bottom: calc(24px + var(--safe-bottom));
    right: 24px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #00b8d4);
    color: var(--bg-deep);
    border: none;
    box-shadow: 0 4px 16px rgba(0, 229, 255, 0.35), 0 0 40px rgba(0, 229, 255, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    line-height: 1;
    transition: all var(--transition);
    z-index: 200;
    -webkit-tap-highlight-color: transparent;
}

.fab:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 24px rgba(0, 229, 255, 0.45), 0 0 60px rgba(0, 229, 255, 0.2);
}

.fab:active {
    transform: scale(0.93);
}

.fab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 30px;
    font-weight: 300;
    margin-top: -1px;
}

/* ── Install banner Android ───────────────────────────────────────────────── */
.install-banner {
    position: fixed;
    bottom: calc(90px + var(--safe-bottom));
    left: 16px;
    right: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-accent);
    color: var(--text-primary);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 300;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.install-text {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
}

.btn-install {
    background: var(--accent);
    color: var(--bg-deep);
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.btn-install-dismiss {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    flex-shrink: 0;
    transition: color var(--transition);
}

.btn-install-dismiss:hover {
    color: var(--text-secondary);
}

/* ── Install modal iOS ────────────────────────────────────────────────────── */
.install-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 500;
    padding: 16px;
    padding-bottom: calc(16px + var(--safe-bottom));
}

.install-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-xl);
    padding: 28px;
    max-width: 380px;
    width: 100%;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.modal-icon {
    border-radius: 14px;
    flex-shrink: 0;
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.15);
}

.modal-title {
    font-family: 'Syne', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 18px;
}

.install-steps {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
    padding-left: 0;
}

.install-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}

.step-icon {
    font-size: 16px;
    width: 30px;
    height: 30px;
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid var(--accent-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 700;
}

.step-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-modal-close {
    background: var(--accent);
    color: var(--bg-deep);
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 24px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: all var(--transition);
}

.btn-modal-close:hover {
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.3);
}

.modal-no-show {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.modal-no-show input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
}

/* ── Photo preview ────────────────────────────────────────────────────────── */
.photo-preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 600;
    flex-direction: column;
    gap: 12px;
}

.photo-preview-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
    user-select: none;
    -webkit-user-drag: none;
}

.photo-preview-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 24px;
    line-height: 1;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.photo-preview-close:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

.photo-preview-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4px 16px;
    border-radius: 20px;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

/* ── Tablet/Desktop (min 768px) ───────────────────────────────────────────── */
@media (min-width: 768px) {
    .main-area {
        padding-top: 8px;
    }

    .patient-list {
        padding: 0;
        gap: 12px;
    }

    .patient-card {
        border-radius: var(--radius-xl);
    }

    .card-header {
        padding: 18px 24px;
    }

    .card-body {
        padding: 0 24px 24px;
    }

    .card-actions {
        gap: 12px;
    }

    .btn-gravar, .btn-foto, .btn-gerar-evolucao {
        flex: none;
        min-width: 130px;
    }

    .toolbar {
        padding: 16px 0 8px;
    }

    .fab {
        right: 32px;
        bottom: 32px;
        width: 62px;
        height: 62px;
    }
}

/* ── Enviar agora ─────────────────────────────────────────────────────────── */
.btn-enviar-agora {
    padding: 8px 18px;
    background: var(--warning);
    color: var(--bg-deep);
    border: none;
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    margin-right: 8px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.btn-enviar-agora:hover:not(:disabled) {
    box-shadow: 0 0 16px rgba(255, 171, 64, 0.3);
}

.btn-enviar-agora:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Recording timer ──────────────────────────────────────────────────────── */
.recording-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--recording);
    font-family: 'DM Sans', monospace;
    letter-spacing: 1px;
    text-shadow: 0 0 12px var(--recording-glow);
}

/* ── Utilities ────────────────────────────────────────────────────────────── */
[hidden] {
    display: none !important;
}

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

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}

/* ── Doctor identity header ───────────────────────────────────────────────── */
.doctor-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.doctor-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--accent-border);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.1);
}

.doctor-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.doctor-name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.sync-timestamp {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.btn-settings {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-muted);
    padding: 4px;
    line-height: 1;
    flex-shrink: 0;
    transition: color var(--transition);
}

.btn-settings:hover {
    color: var(--accent);
}

/* ── Settings & Encerrar dialogs ──────────────────────────────────────────── */
.settings-dialog {
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 400px;
    width: 90%;
    background: var(--bg-surface);
    color: var(--text-primary);
}

.settings-dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.settings-dialog h2 {
    font-family: 'Syne', sans-serif;
    margin: 0 0 14px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.settings-dialog p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    line-height: 1.5;
}

.settings-dialog label {
    display: block;
    margin: 14px 0 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.settings-dialog input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', monospace;
    font-size: 14px;
    color: var(--text-primary);
    box-sizing: border-box;
    transition: border-color var(--transition);
}

.settings-dialog input[type="password"]:focus {
    outline: none;
    border-color: var(--accent-border);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.1);
}

.settings-actions {
    margin-top: 20px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ── Shared button variants ───────────────────────────────────────────────── */
.btn-primary {
    background: var(--accent);
    color: var(--bg-deep);
    border: none;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
    transition: all var(--transition);
}

.btn-primary:hover {
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
}

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

.btn-danger {
    background: var(--recording);
    color: white;
    border: none;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 700;
    transition: all var(--transition);
}

.btn-danger:hover {
    box-shadow: 0 0 16px var(--recording-glow);
}

.btn-danger-outline {
    background: none;
    color: var(--recording);
    border: 1px solid rgba(255, 23, 68, 0.3);
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    transition: all var(--transition);
}

.btn-danger-outline:hover {
    background: rgba(255, 23, 68, 0.08);
    border-color: rgba(255, 23, 68, 0.5);
}

/* ── Session toolbar ──────────────────────────────────────────────────────── */
.session-toolbar {
    display: flex;
    gap: 8px;
    margin: 0 16px 12px;
    flex-wrap: wrap;
}

/* ── Desktop overrides ────────────────────────────────────────────────────── */
@media (min-width: 768px) {
    .btn-settings {
        font-size: 22px;
    }

    .doctor-photo {
        width: 42px;
        height: 42px;
    }

    .doctor-header {
        padding: 12px 24px;
    }

    .main-area {
        max-width: 800px;
    }

    /* Force cards expanded on desktop */
    .card-body {
        display: block !important;
    }

    .card-chevron {
        display: none;
    }

    .evolution-text {
        max-height: none;
        font-size: 14px;
        line-height: 1.7;
    }
}

/* ── Evolution editing state ──────────────────────────────────────────────── */
.evolution-text[contenteditable="true"] {
    border: 2px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 10px;
    outline: none;
    background: var(--bg-elevated);
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.08);
}

.evolution-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.evolution-version-badge {
    font-size: 10px;
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-left: 8px;
    text-transform: uppercase;
}

/* ── Page load entrance animation ─────────────────────────────────────────── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-card {
    animation: fadeInUp 0.6s var(--ease-out) both;
}

.patient-card {
    animation: fadeInUp 0.4s var(--ease-out) both;
}

/* Stagger patient cards */
.patient-card:nth-child(1) { animation-delay: 0ms; }
.patient-card:nth-child(2) { animation-delay: 60ms; }
.patient-card:nth-child(3) { animation-delay: 120ms; }
.patient-card:nth-child(4) { animation-delay: 180ms; }
.patient-card:nth-child(5) { animation-delay: 240ms; }
.patient-card:nth-child(6) { animation-delay: 300ms; }
