/* ===== VARIÁVEIS E RESETS ===== */
:root {
    --light-red: #ffcccc;
    --light-blue: #cce5ff;
    --light-green: #d4edda;
    --light-yellow: #fff3cd;
    --light-orange: #ffe5cc;
    --pastel-bg: #f8f9fa;
    --primary: #2c3e50;
    --secondary: #4a6580;
    --accent: #3498db;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--pastel-bg);
    color: #333;
    line-height: 1.6;
}

/* ===== LAYOUT PRINCIPAL ===== */

#logomarca {
    display: block;
    max-width: 400px;
    height: auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 15px 0;
    text-align: center;
    border-radius: 8px 8px 0 0;
    margin-bottom: 20px;
}

.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    padding: 20px;
}

/* ===== FORMULÁRIOS ===== */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

input, select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.form-help {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
    line-height: 1.4;
}

.form-help strong {
    color: var(--primary);
}

/* ===== BOTÕES ===== */
button {
    background-color: var(--secondary);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
    margin: 5px;
}

button:hover {
    background-color: var(--primary);
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9, #1c6ea4);
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #7f8c8d, #6c757d);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    background: #3498db;
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-small:hover {
    background: #2980b9;
}

.btn-small.btn-edit {
    background: #f39c12;
}

.btn-small.btn-edit:hover {
    background: #d68910;
}

.btn-save {
    background: linear-gradient(135deg, #27ae60, #219653);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-save:hover {
    background: linear-gradient(135deg, #219653, #1e8749);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
}

/* ===== ABAS ===== */
.tab-container {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
}

.tab.active {
    border-bottom: 3px solid var(--secondary);
    font-weight: bold;
}

.tab-content {
    display: none;
}

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

/* ===== LAYOUTS ===== */
.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.hidden {
    display: none;
}

/* ===== AUDIOGRAMA ===== */
/* Garante que o canvas ocupe toda a área do container */
.audiogram-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}


.audiograms-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin: 20px 0;
}

.audiogram-box {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.audiogram-box h4 {
    text-align: center;
    margin-bottom: 18px;
    color: var(--primary);
    font-size: 16px;
    font-weight: 600;
}

.audiogram-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 14px;
    min-width: 600px;
}

.audiogram-table th {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #dee2e6;
}

.audiogram-table th.ear-header {
    background: linear-gradient(135deg, #34495e, #546e7a);
    font-size: 15px;
}

.audiogram-table td {
    padding: 10px 8px;
    border: 1px solid #e9ecef;
    text-align: center;
}

.audiogram-table td.frequency-cell {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--primary);
}

.audiogram-input {
    width: 80px;
    padding: 8px;
    border: 2px solid #e9ecef;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    transition: all 0.3s ease;
    background: white;
}

.audiogram-input:focus {
    border-color: var(--accent);
    background: #f8fdff;
    outline: none;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.audiogram-input:not([value=""]) {
    border-color: #27ae60;
    background-color: #f8fff8;
}

.audiogram-input::placeholder {
    color: #adb5bd;
    font-size: 12px;
}

.audiogram-table tr:nth-child(even) {
    background: #f8f9fa;
}

.audiogram-table tr:hover {
    background: #e3f2fd;
}

.audiogram-symbol {
    font-size: 18px;
    font-weight: bold;
}

.symbol-air-right {
    color: #e74c3c;
}

.symbol-bone-right {
    color: #e74c3c;
    font-weight: bold;
}

.symbol-air-left {
    color: #3498db;
}

.symbol-bone-left {
    color: #3498db;
    font-weight: bold;
}

/* ===== LEGENDAS ===== */
.audiogram-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.legend-color {
    width: 20px;
    height: 3px;
    border-radius: 2px;
}

.legend-symbol {
    font-size: 16px;
    font-weight: bold;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-air-right { background-color: #e74c3c; }
.color-bone-right { color: #e74c3c; }
.color-air-left { background-color: #3498db; }
.color-bone-left { color: #3498db; }

/* ===== IMPEDANCIOMETRIA ===== */
.impedance-charts-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin: 20px 0;
}

.impedance-chart-box {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    height: 350px;
    display: flex;
    flex-direction: column;
    animation: fadeInUp 0.5s ease;
}

.impedance-chart-box h4 {
    text-align: center;
    margin-bottom: 15px;
    color: var(--primary);
    font-size: 16px;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f3f4;
    flex-shrink: 0;
}

.impedance-chart-container {
    position: relative;
    height: 280px;
    width: 100%;
    flex-grow: 1;
    min-height: 250px;
}

#timpanogram-results-right, 
#timpanogram-results-left {
    width: 100%;
    height: 100%;
    display: block;
}

.chart-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    height: 380px;
    display: flex;
    flex-direction: column;
}

.chart-container h3 {
    text-align: center;
    margin-bottom: 15px;
    color: var(--primary);
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 10px;
    font-size: 16px;
    flex-shrink: 0;
}

#timpanogram-right, 
#timpanogram-left {
    width: 100%;
    height: 300px;
    flex-grow: 1;
}

#impedance-results-section {
    display: block !important;
}

.impedance-ear-section {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

#ouvido-direito {
    color: red;
}

#ouvido-esq {
    color: blue;
}

/* Estados da Impedanciometria */
.impedance-normal {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border-left: 5px solid #28a745;
    color: #155724;
}

.impedance-alterado-leve {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border-left: 5px solid #ffc107;
    color: #856404;
}

.impedance-alterado-moderado {
    background: linear-gradient(135deg, #ffe5cc, #ffd8a8);
    border-left: 5px solid #fd7e14;
    color: #8a2c0d;
}

.impedance-alterado-grave {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    border-left: 5px solid #dc3545;
    color: #721c24;
}

.impedance-indefinido {
    background: linear-gradient(135deg, #e2e3e5, #d6d8db);
    border-left: 5px solid #6c757d;
    color: #383d41;
}

.normal { 
    border-left: 4px solid #28a745;
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
}

.alterado-leve { 
    border-left: 4px solid #ffc107;
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
}

.alterado-moderado { 
    border-left: 4px solid #fd7e14;
    background: linear-gradient(135deg, #ffe5cc, #ffd8a8);
}

.alterado-grave { 
    border-left: 4px solid #dc3545;
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
}

.indefinido {
    border-left: 4px solid #6c757d;
    background: linear-gradient(135deg, #e2e3e5, #d6d8db);
}

/* ===== LOGOAUDIOMETRIA ===== */
.logoaudiometry-container {
    margin: 20px 0;
}

.logoaudiometry-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    

}

.logoaudiometry-box {
    min-width: 200px;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

.logoaudiometry-title-direito {
    color: red;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid red;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.logoaudiometry-title-esquerdo {
    color: blue;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid blue;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.logoaudiometry-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.logoaudiometry-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 15px;
}

.logoaudiometry-label {
    min-width: 80px;
    font-weight: 600;
    color: var(--primary);
    font-size: 14px;
    text-align: right;
}

.logoaudiometry-input-container {
    flex: 1;
    display: flex;
    max-width: 200px;
}

.logoaudiometry-input {
    flex: 1;
    min-width: 80px;
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    text-align: center;
    transition: border-color 0.3s;
}

.logoaudiometry-input:focus {
    border-color: var(--accent);
    outline: none;
}

.logoaudiometry-unit {
    background: #f8f9fa;
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-left: none;
    border-radius: 0 4px 4px 0;
    color: #6c757d;
    font-size: 14px;
    min-width: 40px;
    text-align: center;
}

/* Resultados Logoaudiometria */
.logoaudiometry-results {
    margin: 20px 0;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.logoaudiometry-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.logoaudiometry-result-card {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid var(--accent);
}

.logoaudiometry-result-item {
    margin: 10px 0;
    padding: 8px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.logoaudiometry-result-label {
    font-weight: 600;
    color: var(--primary);
    display: inline-block;
    min-width: 100px;
}

.logoaudiometry-result-value {
    color: var(--accent);
    font-weight: bold;
}

.weber-result-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.weber-result-item {
    text-align: center;
    padding: 10px;
    background: #e3f2fd;
    border-radius: 6px;
    border: 1px solid #bbdefb;
}

.weber-frequency {
    font-weight: 600;
    color: #1976d2;
    margin-bottom: 5px;
}

.weber-value {
    font-size: 16px;
    font-weight: bold;
    color: #0d47a1;
}

/* ===== SEÇÕES DE RESULTADOS ===== */
.results-section {
    margin-bottom: 40px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 5px solid var(--accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.results-section h3 {
    color: var(--primary);
    margin-bottom: 25px;
    padding-bottom: 12px;
    border-bottom: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
}

.results-container {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    background-color: #f8f9fa;
}

.unified-report {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.result-item {
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    border-left: 4px solid;
}

.result-value {
    font-weight: bold;
    font-size: 16px;
    display: block;
    margin-top: 5px;
}

.analysis-note {
    font-style: italic;
    color: #6c757d;
    font-size: 12px;
    margin-top: 10px;
    text-align: center;
}


.reflex-table-section h4 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

.table-container {
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
}

.reflex-table-complete {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 13px;
    min-width: 1200px;
}

/* Headers principais e secundários */
.reflex-table-complete thead tr:first-child th {
    padding: 14px 10px;
    text-align: center;
    font-weight: 700;
    border: 1px solid #e0e0e0;
    background-color: #f5f5f5;
    color: var(--primary);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

/* Células de dados - cores de fundo por ouvido */
.reflex-table-complete td {
    padding: 12px 10px;
    border: 1px solid #ecf0f1;
    text-align: center;
    height: auto;
    vertical-align: middle;
}


.reflex-input {
    width: 100%;
    padding: 8px;
    border: 2px solid #e9ecef;
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
    transition: all 0.3s ease;
    background: white;
}

.reflex-input:focus {
    border-color: var(--accent);
    background: #f8fdff;
    outline: none;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.reflex-input.diff {
    background: #f8f9fa;
    color: #6c757d;
    font-style: italic;
    cursor: not-allowed;
}

.reflex-input::placeholder {
    color: #adb5bd;
    font-size: 12px;
}

.reflex-table-complete tr:nth-child(even) {
    background: #f8f9fa;
}

.reflex-table-complete tr:hover {
    background: #e3f2fd;
}

/* ===== EXAME ===== */
.exam-section {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--accent);
}

.exam-section h3 {
    color: var(--primary);
    margin-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
}

.section-description {
    color: #6c757d;
    font-style: italic;
    margin-bottom: 15px;
    font-size: 14px;
}

/* ===== RECOMENDAÇÕES ===== */
.recommendations-section {
    margin-top: 20px;
    padding: 15px;
    background: #fff3cd;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
}

.recommendations-section h4 {
    color: var(--primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
}

.recommendations-section h6 {
    color: var(--primary);
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 600;
}

.recommendations-section ul {
    padding-left: 20px;
    margin: 10px 0;
}

.recommendations-section li {
    margin: 8px 0;
    padding: 5px 0;
    color: #495057;
}

.recommendations-section p {
    margin: 5px 0;
    padding: 5px 0;
    font-size: 13px;
    color: #495057;
}

/* ===== IMPEDÂNCIA AVANÇADA ===== */
.impedance-results-section {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid var(--accent);
}

.impedance-results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.impedance-ear-result {
    padding: 20px;
    border-radius: 10px;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.impedance-ear-result:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.impedance-summary {
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.impedance-summary strong {
    font-size: 18px;
    display: block;
    margin-bottom: 5px;
    color: var(--primary);
}

.impedance-summary small {
    color: #6c757d;
    font-style: italic;
    font-size: 14px;
}

.impedance-details {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.impedance-details div {
    margin: 8px 0;
    padding: 8px;
    border-left: 3px solid #e9ecef;
    padding-left: 12px;
    background: #f8f9fa;
    border-radius: 4px;
}

.impedance-details strong {
    color: var(--primary);
    font-weight: 600;
}

.impedance-conclusion {
    padding: 25px;
    border-radius: 10px;
    margin-top: 25px;
    border-left: 5px solid;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
}

.impedance-conclusion h5 {
    margin-bottom: 15px;
    color: inherit;
    font-size: 18px;
    font-weight: 600;
}

/* ===== MASCARAMENTO ===== */
.mask-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    transform: scale(1.2);
}

.mask-checkbox:checked {
    accent-color: #9b59b6;
}

.mask-checkbox:checked + .audiogram-symbol {
    background-color: #f3e5f5;
    border-radius: 3px;
    padding: 2px;
}

tr:has(.mask-checkbox:checked) {
    background: #fff3e0 !important;
}

/* ===== AUTO-FILL ===== */
.auto-fill-section {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border: 2px solid #2196f3;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.auto-fill-section .btn-primary {
    background: linear-gradient(135deg, #2196f3, #1976d2);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    margin-bottom: 10px;
    transition: transform 0.2s ease;
}

.auto-fill-section .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3);
}

.auto-fill-section small {
    color: #1976d2;
    font-style: italic;
}

/* ===== AÇÕES ===== */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.action-buttons-impedance {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.action-buttons-small {
    display: flex;
    gap: 5px;
}

/* ===== DASHBOARD PARCEIRO ===== */
.referred-list-section {
    margin: 30px 0;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.follow-up-section {
    margin: 30px 0;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.follow-up-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.follow-up-card {
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    transition: transform 0.3s;
}

.follow-up-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.follow-up-card h4 {
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--primary);
}

.follow-up-card span {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent);
}

/* Status Badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-in-progress {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.status-waiting {
    background: #fff3e0;
    color: #f57c00;
    border: 1px solid #ffe0b2;
}

.status-needs-action {
    background: #ffebee;
    color: #d32f2f;
    border: 1px solid #ffcdd2;
}

.status-completed {
    background: #e8f5e9;
    color: #388e3c;
    border: 1px solid #c8e6c9;
}

.status-waiting-payment {
    background: #fff3e0;
    color: #f57c00;
    border: 1px solid #ffe0b2;
}

.exam-status.completed {
    color: #28a745;
}

.exam-status.pending {
    color: #ffc107;
}

/* Result Classes */
.result-normal {
    color: #28a745;
}

.result-mild {
    color: #ffc107;
}

.result-moderate {
    color: #fd7e14;
}

.result-severe {
    color: #dc3545;
}

.result-undefined {
    color: #6c757d;
}

/* ===== TOASTS ===== */
.save-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 15px;
    max-width: 350px;
    z-index: 1000;
    border-left: 4px solid #27ae60;
    animation: slideInRight 0.3s ease;
}

.save-toast.success {
    border-left-color: #27ae60;
    background: linear-gradient(135deg, #f0fff4, #e6f7eb);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
}

.toast-message strong {
    display: block;
    color: #155724;
    margin-bottom: 4px;
}

.toast-message small {
    color: #6c757d;
    font-size: 12px;
    line-height: 1.4;
}

.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

/* ===== MENSAGENS ===== */
.error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
    text-align: center;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.upcoming-item {
    padding: 15px;
    border-radius: 8px;
    background: #f8f9fa;
    margin-bottom: 10px;
    border-left: 4px solid var(--accent);
}

.upcoming-date {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 5px;
}

.upcoming-info {
    margin-bottom: 10px;
    color: #495057;
    font-size: 14px;
}

.upcoming-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ===== HEARING LOSS COLORS ===== */
.hearing-loss-normal {
    background-color: var(--light-green);
    padding: 5px;
    border-radius: 4px;
}

.hearing-loss-mild {
    background-color: var(--light-yellow);
    padding: 5px;
    border-radius: 4px;
}

.hearing-loss-moderate {
    background-color: var(--light-orange);
    padding: 5px;
    border-radius: 4px;
}

.hearing-loss-severe {
    background-color: var(--light-red);
    padding: 5px;
    border-radius: 4px;
}

/* ===== ANIMAÇÕES ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 1200px) {
    .audiograms-container,
    .impedance-charts-results {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .audiogram-container {
        height: 320px;
    }
    
    .impedance-chart-box {
        height: 320px;
    }
    
    .impedance-chart-container {
        height: 250px;
    }
}

@media (max-width: 968px) {
    .impedance-results-grid {
        grid-template-columns: 1fr;
    }
    
    .audiogram-container {
        height: 300px;
    }
}

@media (max-width: 768px) {
    .two-columns {
        grid-template-columns: 1fr;
    }
    
    .tab-container {
        flex-wrap: wrap;
    }
    
    .tab {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .results-section {
        padding: 20px 15px;
    }
    
    .audiogram-container {
        height: 280px;
    }
    
    .impedance-chart-box {
        height: 280px;
        padding: 15px;
    }
    
    .impedance-chart-container {
        height: 220px;
    }
    
    .chart-container {
        height: 320px;
        padding: 15px;
    }
    
    #timpanogram-right, 
    #timpanogram-left {
        height: 250px;
    }
    
    .action-buttons,
    .action-buttons-impedance {
        flex-direction: column;
        align-items: center;
    }
    
    .action-buttons button,
    .action-buttons-impedance button {
        width: 100%;
        max-width: 300px;
    }
    
    .audiogram-legend {
        gap: 15px;
    }
    
    .legend-item {
        font-size: 12px;
    }
    
    .audiogram-table {
        font-size: 12px;
        min-width: 500px;
    }
    
    .audiogram-input {
        width: 60px;
        padding: 6px;
        font-size: 12px;
    }
    
    .logoaudiometry-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .logoaudiometry-box {
        min-width: 100%;
    }
    
    .weber-result-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .follow-up-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .referred-list-section {
        overflow-x: auto;
    }
    
    #referred-people-table {
        min-width: 800px;
    }
    
    .save-toast {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .weber-result-grid {
        grid-template-columns: 1fr;
    }
    
    .follow-up-stats {
        grid-template-columns: 1fr;
    }
    
    .logoaudiometry-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .logoaudiometry-input-container {
        width: 100%;
    }
}

/* ===== EXAME ===== */
.exam-section {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--accent);
}

.exam-section h3 {
    color: var(--primary);
    margin-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
}

.section-description {
    color: #6c757d;
    font-style: italic;
    margin-bottom: 15px;
    font-size: 14px;
}

/* ===== RECOMENDAÇÕES ===== */
.recommendations-section {
    margin-top: 20px;
    padding: 15px;
    background: #fff3cd;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
}

.recommendations-section h4 {
    color: var(--primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
}

.recommendations-section h6 {
    color: var(--primary);
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 600;
}

.recommendations-section ul {
    padding-left: 20px;
    margin: 10px 0;
}

.recommendations-section li {
    margin: 8px 0;
    padding: 5px 0;
    color: #495057;
}

.recommendations-section p {
    margin: 5px 0;
    padding: 5px 0;
    font-size: 13px;
    color: #495057;
}

/* ===== IMPEDÂNCIA AVANÇADA ===== */
.impedance-results-section {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid var(--accent);
}

.impedance-results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.impedance-ear-result {
    padding: 20px;
    border-radius: 10px;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.impedance-ear-result:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.impedance-summary {
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.impedance-summary strong {
    font-size: 18px;
    display: block;
    margin-bottom: 5px;
    color: var(--primary);
}

.impedance-summary small {
    color: #6c757d;
    font-style: italic;
    font-size: 14px;
}

.impedance-details {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.impedance-details div {
    margin: 8px 0;
    padding: 8px;
    border-left: 3px solid #e9ecef;
    padding-left: 12px;
    background: #f8f9fa;
    border-radius: 4px;
}

.impedance-details strong {
    color: var(--primary);
    font-weight: 600;
}

.impedance-conclusion {
    padding: 25px;
    border-radius: 10px;
    margin-top: 25px;
    border-left: 5px solid;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
}

.impedance-conclusion h5 {
    margin-bottom: 15px;
    color: inherit;
    font-size: 18px;
    font-weight: 600;
}

/* ===== MASCARAMENTO ===== */
.mask-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    transform: scale(1.2);
}

.mask-checkbox:checked {
    accent-color: #9b59b6;
}

.mask-checkbox:checked + .audiogram-symbol {
    background-color: #f3e5f5;
    border-radius: 3px;
    padding: 2px;
}

tr:has(.mask-checkbox:checked) {
    background: #fff3e0 !important;
}

/* ===== AUTO-FILL ===== */
.auto-fill-section {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border: 2px solid #2196f3;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.auto-fill-section .btn-primary {
    background: linear-gradient(135deg, #2196f3, #1976d2);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    margin-bottom: 10px;
    transition: transform 0.2s ease;
}

.auto-fill-section .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3);
}

.auto-fill-section small {
    color: #1976d2;
    font-style: italic;
}

/* ===== AÇÕES ===== */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.action-buttons-impedance {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.action-buttons-small {
    display: flex;
    gap: 5px;
}

/* ===== DASHBOARD PARCEIRO ===== */
.referred-list-section {
    margin: 30px 0;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.follow-up-section {
    margin: 30px 0;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.follow-up-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.follow-up-card {
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    transition: transform 0.3s;
}

.follow-up-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.follow-up-card h4 {
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--primary);
}

.follow-up-card span {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent);
}

/* Status Badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-in-progress {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.status-waiting {
    background: #fff3e0;
    color: #f57c00;
    border: 1px solid #ffe0b2;
}

.status-needs-action {
    background: #ffebee;
    color: #d32f2f;
    border: 1px solid #ffcdd2;
}

.status-completed {
    background: #e8f5e9;
    color: #388e3c;
    border: 1px solid #c8e6c9;
}

.status-waiting-payment {
    background: #fff3e0;
    color: #f57c00;
    border: 1px solid #ffe0b2;
}

.exam-status.completed {
    color: #28a745;
}

.exam-status.pending {
    color: #ffc107;
}

/* Result Classes */
.result-normal {
    color: #28a745;
}

.result-mild {
    color: #ffc107;
}

.result-moderate {
    color: #fd7e14;
}

.result-severe {
    color: #dc3545;
}

.result-undefined {
    color: #6c757d;
}

/* ===== TOASTS ===== */
.save-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 15px;
    max-width: 350px;
    z-index: 1000;
    border-left: 4px solid #27ae60;
    animation: slideInRight 0.3s ease;
}

.save-toast.success {
    border-left-color: #27ae60;
    background: linear-gradient(135deg, #f0fff4, #e6f7eb);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
}

.toast-message strong {
    display: block;
    color: #155724;
    margin-bottom: 4px;
}

.toast-message small {
    color: #6c757d;
    font-size: 12px;
    line-height: 1.4;
}

.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

/* ===== MENSAGENS ===== */
.error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
    text-align: center;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.upcoming-item {
    padding: 15px;
    border-radius: 8px;
    background: #f8f9fa;
    margin-bottom: 10px;
    border-left: 4px solid var(--accent);
}

.upcoming-date {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 5px;
}

.upcoming-info {
    margin-bottom: 10px;
    color: #495057;
    font-size: 14px;
}

.upcoming-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ===== HEARING LOSS COLORS ===== */
.hearing-loss-normal {
    background-color: var(--light-green);
    padding: 5px;
    border-radius: 4px;
}

.hearing-loss-mild {
    background-color: var(--light-yellow);
    padding: 5px;
    border-radius: 4px;
}

.hearing-loss-moderate {
    background-color: var(--light-orange);
    padding: 5px;
    border-radius: 4px;
}

.hearing-loss-severe {
    background-color: var(--light-red);
    padding: 5px;
    border-radius: 4px;
}

/* ===== ANIMAÇÕES ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 1200px) {
    .audiograms-container,
    .impedance-charts-results {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .audiogram-container {
        height: 320px;
    }
    
    .impedance-chart-box {
        height: 320px;
    }
    
    .impedance-chart-container {
        height: 250px;
    }
}

@media (max-width: 968px) {
    .impedance-results-grid {
        grid-template-columns: 1fr;
    }
    
    .audiogram-container {
        height: 300px;
    }
}

@media (max-width: 768px) {
    .two-columns {
        grid-template-columns: 1fr;
    }
    
    .tab-container {
        flex-wrap: wrap;
    }
    
    .tab {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .results-section {
        padding: 20px 15px;
    }
    
    .audiogram-container {
        height: 280px;
    }
    
    .impedance-chart-box {
        height: 280px;
        padding: 15px;
    }
    
    .impedance-chart-container {
        height: 220px;
    }
    
    .chart-container {
        height: 320px;
        padding: 15px;
    }
    
    #timpanogram-right, 
    #timpanogram-left {
        height: 250px;
    }
    
    .action-buttons,
    .action-buttons-impedance {
        flex-direction: column;
        align-items: center;
    }
    
    .action-buttons button,
    .action-buttons-impedance button {
        width: 100%;
        max-width: 300px;
    }
    
    .audiogram-legend {
        gap: 15px;
    }
    
    .legend-item {
        font-size: 12px;
    }
    
    .audiogram-table {
        font-size: 12px;
        min-width: 500px;
    }
    
    .audiogram-input {
        width: 60px;
        padding: 6px;
        font-size: 12px;
    }
    
    .logoaudiometry-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .logoaudiometry-box {
        min-width: 100%;
    }
    
    .weber-result-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .follow-up-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .referred-list-section {
        overflow-x: auto;
    }
    
    #referred-people-table {
        min-width: 800px;
    }
    
    .save-toast {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .weber-result-grid {
        grid-template-columns: 1fr;
    }
    
    .follow-up-stats {
        grid-template-columns: 1fr;
    }
    
    .logoaudiometry-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .logoaudiometry-input-container {
        width: 100%;
    }
}


/* ===== TABELA DE REFLEXOS - PADRÃO CLÍNICO ===== */
.reflex-table-complete {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    font-size: 13px;
    min-width: 1400px;
}

/* ===== HEADER PRINCIPAL ===== */
.reflex-table-complete thead tr:first-child th {
    padding: 14px 10px;
    text-align: center;
    font-weight: 700;
    border: 1px solid #dcdcdc;
    background: #f2f4f6;
    color: #2c3e50;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

/* ===== HEADER OD ===== */
.reflex-table-complete thead tr:first-child th.ear-header:first-of-type {
    background: #1f3a5f;
    color: #ffffff;
    border-right: 8px solid #ffffff;
}

/* ===== HEADER OE ===== */
.reflex-table-complete thead tr:first-child th.ear-header:last-of-type {
    background: #5dade2;
    color: #ffffff;
    border-left: 8px solid #ffffff;
}

/* ===== SUBHEADERS OD ===== */
.reflex-table-complete thead tr:last-child th:nth-child(2),
.reflex-table-complete thead tr:last-child th:nth-child(3),
.reflex-table-complete thead tr:last-child th:nth-child(4),
.reflex-table-complete thead tr:last-child th:nth-child(5) {
    background: #eaf2f8;
    color: #1f3a5f;
    font-weight: 600;
    border: 1px solid #d6eaf8;
}

/* ===== SUBHEADERS OE ===== */
.reflex-table-complete thead tr:last-child th:nth-child(6),
.reflex-table-complete thead tr:last-child th:nth-child(7),
.reflex-table-complete thead tr:last-child th:nth-child(8),
.reflex-table-complete thead tr:last-child th:nth-child(9) {
    background: #f4f9fd;
    color: #21618c;
    font-weight: 600;
    border: 1px solid #d6eaf8;
}

/* ===== SEPARAÇÃO VISUAL OD | OE ===== */
.reflex-table-complete th:nth-child(5),
.reflex-table-complete td:nth-child(5) {
    border-right: 6px solid #ffffff !important;
}

/* ===== FREQUÊNCIA ===== */
.frequency-cell {
    font-weight: 700;
    background: #f8f9fa;
    color: #2c3e50;
    text-align: center;
    border: 1px solid #e0e0e0;
}

/* ===== CÉLULAS ===== */
.reflex-table-complete td {
    padding: 6px;
    border: 1px solid #e5e7e9;
    text-align: center;
    background: #ffffff;
}

/* ===== INPUTS ===== */
.reflex-input {
    width: 100%;
    padding: 6px 4px;
    border-radius: 4px;
    border: 1px solid #ccd1d1;
    font-size: 12px;
    text-align: center;
    background: #ffffff;
    color: #2c3e50;
}

/* ===== INPUT DIFERENÇA (AUTO) ===== */
.reflex-input.diff {
    background: #f0f3f4;
    color: #566573;
    font-weight: 600;
    cursor: not-allowed;
}

/* ===== HOVER ===== */
.reflex-table-complete tbody tr:hover td {
    background: #f7fbff;
    transition: background 0.2s ease-in-out;
}



    /* Estilos para o histórico */
.history-stats {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.stat-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    border-left: 4px solid #3498db;
    flex: 1;
    min-width: 200px;
}

.stat-card h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
}

.patients-list {
    margin-top: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.exam-card, .partner-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.exam-date {
    background: #e8f4fc;
    color: #2980b9;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.exam-details {
    margin-top: 10px;
}

.exam-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    transition: background 0.3s;
}

.btn-small:hover {
    opacity: 0.9;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.empty-state, .error-state {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.empty-state h3, .error-state h3 {
    color: #6c757d;
    margin-bottom: 10px;
}

.hint {
    color: #6c757d;
    font-size: 14px;
    margin-top: 10px;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-box input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.search-box button {
    padding: 10px 15px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.search-box button:hover {
    background: #2980b9;
}


/* Adicione estas regras ao final do seu style.css */

/* Ajustes para os gráficos de timpanograma */
.impedance-chart-container {
    height: 350px !important; /* Aumenta a altura */
    min-height: 350px;
    position: relative;
}

/* Para os timpanogramas na aba de resultados */
.impedance-charts-results .impedance-chart-container {
    height: 320px !important;
    min-height: 320px;
}

/* Container dos gráficos */
.impedance-charts-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 25px;
    margin: 25px 0;
}

/* Caixa individual do gráfico */
.impedance-chart-box {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: 1px solid #e9ecef;
}

.impedance-chart-box h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 18px;
    text-align: center;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

/* Para a aba de exames (impedance-enhanced) */
#unified-impedance-section .impedance-chart-container {
    height: 300px !important;
    min-height: 300px;
}

/* Responsividade */
@media (max-width: 768px) {
    .impedance-chart-container {
        height: 300px !important;
    }
    
    .impedance-charts-results {
        grid-template-columns: 1fr;
    }
}


/* Estilos para o sistema de PDF */
#pdf-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    flex-direction: column;
    color: white;
    font-size: 18px;
}

#pdf-loading-overlay .spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Botão de PDF */
button#generate-pdf,
button#generate-pdf-results {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

button#generate-pdf:hover,
button#generate-pdf-results:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

button#generate-pdf:disabled,
button#generate-pdf-results:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

/* =========================================================
   REFLEXOS ACÚSTICOS - LAYOUT CLÍNICO (PATCH FINAL)
   Não altera IDs/classes do HTML
   Cole no FINAL do style.css para sobrescrever regras antigas
========================================================= */

/* Seção */
.reflex-table-section {
    margin-top: 18px;
}

.reflex-table-section h4 {
    color: var(--primary);
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Container com scroll horizontal mais “clean” */
.reflex-table-section .table-container {
    overflow-x: auto;
    margin: 14px 0 0;
    border: 1px solid #e6e9ee;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* Tabela */
.reflex-table-complete {
    width: 100%;
    border-collapse: separate; /* ajuda no sticky + bordas */
    border-spacing: 0;
    background: #ffffff;
    font-size: 13px;
    min-width: 1100px; /* evita esmagar demais */
}

/* Header sticky (melhora muito leitura) */
.reflex-table-complete thead th {
    position: sticky;
    top: 0;
    z-index: 3;
}

/* Linha 1 do header (OD/OE agrupado) */
.reflex-table-complete thead tr:first-child th {
    padding: 12px 10px;
    text-align: center;
    font-weight: 800;
    border-bottom: 1px solid #e6e9ee;
    background: #f4f6f9;
    color: var(--primary);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.4px;
}

/* Linha 2 do header (colunas) */
.reflex-table-complete thead tr:last-child th {
    padding: 10px 8px;
    text-align: center;
    font-weight: 700;
    border-bottom: 1px solid #e6e9ee;
    background: #fafbfc;
    color: #34495e;
    font-size: 12px;
}

/* Header OD/OE (primeira linha) */
.reflex-table-complete thead tr:first-child th.ear-header {
    color: #fff;
}

/* OD */
.reflex-table-complete thead tr:first-child th.ear-header:nth-child(2) {
    background: linear-gradient(135deg, #2c3e50, #34495e);
}

/* OE */
.reflex-table-complete thead tr:first-child th.ear-header:nth-child(3) {
    background: linear-gradient(135deg, #2e86c1, #3498db);
}

/* Separador visual OD | OE (coluna 5 do corpo = OD Ipsilateral) */
.reflex-table-complete th:nth-child(5),
.reflex-table-complete td:nth-child(5) {
    border-right: 10px solid #ffffff !important;
}

/* Primeira coluna (frequência) com sticky lateral */
.reflex-table-complete th:first-child,
.reflex-table-complete td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
}

/* Header da primeira coluna (sticky) */
.reflex-table-complete thead th:first-child {
    z-index: 4;
    background: #eef2f6;
}

/* Célula de frequência */
.reflex-table-complete td.frequency-cell,
.reflex-table-complete td:first-child {
    font-weight: 800;
    background: #f7f9fc;
    color: var(--primary);
    border-right: 1px solid #e6e9ee;
    text-align: center;
    white-space: nowrap;
}

/* Corpo */
.reflex-table-complete tbody td {
    padding: 8px;
    border-bottom: 1px solid #eef1f5;
    border-right: 1px solid #f0f2f6;
    text-align: center;
    background: #fff;
    vertical-align: middle;
}

/* Zebra */
.reflex-table-complete tbody tr:nth-child(even) td {
    background: #fbfcfe;
}

/* Hover mais sutil (não “azulão”) */
.reflex-table-complete tbody tr:hover td {
    background: #f3f8ff;
}

/* Inputs */
.reflex-input {
    width: 100%;
    min-width: 78px;
    height: 34px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #d7dde6;
    font-size: 13px;
    text-align: center;
    background: #ffffff;
    color: #2c3e50;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.reflex-input::placeholder {
    color: #a6b0bd;
    font-size: 12px;
}

/* Focus */
.reflex-input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.18);
    background: #f8fdff;
}

/* Campo de diferença (Auto) */
.reflex-input.diff {
    background: #f1f4f7;
    color: #566573;
    font-weight: 700;
    cursor: not-allowed;
    border: 1px solid #dfe5ec;
}

/* Melhorar percepção OD vs OE sem poluir:
   - OD (colunas 2..5 do corpo)
   - OE (colunas 6..9 do corpo)
*/
.reflex-table-complete tbody td:nth-child(2),
.reflex-table-complete tbody td:nth-child(3),
.reflex-table-complete tbody td:nth-child(4),
.reflex-table-complete tbody td:nth-child(5) {
    background-image: linear-gradient(0deg, rgba(231,76,60,0.035), rgba(231,76,60,0.035));
}

.reflex-table-complete tbody td:nth-child(6),
.reflex-table-complete tbody td:nth-child(7),
.reflex-table-complete tbody td:nth-child(8),
.reflex-table-complete tbody td:nth-child(9) {
    background-image: linear-gradient(0deg, rgba(52,152,219,0.03), rgba(52,152,219,0.03));
}

/* =========================================================
   ESTADOS VISUAIS (prontos para JS aplicar classes)
   Você pode aplicar essas classes no INPUT via JS:
   .reflex-present | .reflex-elevated | .reflex-absent
========================================================= */

.reflex-input.reflex-present {
    border-color: rgba(39, 174, 96, 0.6);
    background: #f7fff9;
}

.reflex-input.reflex-elevated {
    border-color: rgba(243, 156, 18, 0.75);
    background: #fffaf2;
}

.reflex-input.reflex-absent {
    border-color: rgba(231, 76, 60, 0.55);
    background: #fff6f6;
    color: #8e2a2a;
}

/* Se quiser “NR”/“Ausente” bem marcado quando o usuário digitar */
.reflex-input.reflex-absent::placeholder {
    color: rgba(231, 76, 60, 0.7);
}

/* =========================================================
   Responsividade: em telas menores, mantém scroll e melhora densidade
========================================================= */
@media (max-width: 768px) {
    .reflex-table-complete {
        min-width: 980px;
        font-size: 12px;
    }
    .reflex-input {
        min-width: 70px;
        height: 32px;
        font-size: 12px;
    }
}

/* ================================
   PATCH: Reflexos mais compactos
   Cole no FINAL do style.css
================================ */

/* Container: menos “gordo” */
.reflex-table-section .table-container{
  margin: 12px 0;
  border-radius: 10px;
}

/* Tabela: reduz min-width e melhora densidade */
.reflex-table-complete{
  font-size: 12px;
  min-width: 980px;      /* antes estava grande demais */
}

/* Cabeçalhos mais compactos */
.reflex-table-complete thead tr:first-child th{
  padding: 10px 8px;
  font-size: 11px;
}

.reflex-table-complete thead tr:last-child th{
  padding: 8px 6px;
  font-size: 11px;
  line-height: 1.2;
}

/* Células mais enxutas */
.reflex-table-complete td{
  padding: 6px;
}

/* Frequência: menor e firme */
.reflex-table-complete td.frequency-cell{
  font-size: 12px;
  padding: 6px 8px;
}

/* Inputs: menor altura e largura mínima melhor */
.reflex-input{
  height: 32px;
  padding: 6px 6px;
  font-size: 12px;
  min-width: 72px;
  border-radius: 6px;
}

/* Campo auto (diff) mais “readonly” de verdade */
.reflex-input.diff{
  height: 32px;
  font-weight: 700;
}

/* Separador OD | OE (continua evidente, mas mais fino) */
.reflex-table-complete th:nth-child(5),
.reflex-table-complete td:nth-child(5){
  border-right: 6px solid #ffffff !important;
}

/* Responsividade: diminui ainda mais em telas menores */
@media (max-width: 768px){
  .reflex-table-complete{
    min-width: 920px;
  }
  .reflex-input{
    min-width: 68px;
    height: 30px;
    font-size: 12px;
  }
}


/* ===== PTA (Média Tritonal) ao lado da Via Aérea ===== */
.air-pta-wrap {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.pta-panel {
  width: 190px;
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  flex-shrink: 0;
}

.pta-title {
  margin: 0 0 10px 0;
  font-size: 13px;
  font-weight: 700;
  color: #333;
}

.pta-box {
  display: grid;
  grid-template-columns: 44px 1fr 30px;
  align-items: center;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #f1f3f5;
  background: #fafafa;
  margin-bottom: 10px;
}

.pta-ear {
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
}

.pta-right .pta-ear { color: #e74c3c; }
.pta-left  .pta-ear { color: #3498db; }

.pta-value {
  font-weight: 800;
  font-size: 22px;
  text-align: center;
  color: #111;
}

.pta-unit {
  font-size: 12px;
  text-align: right;
  color: #666;
}

@media (max-width: 900px) {
  .air-pta-wrap {
    flex-direction: column;
  }
  .pta-panel {
    width: 100%;
  }
}
