@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
  --green:#00A859; --green-dark:#008a49; --green-light:#e6f7ef;
  --blue:#1a73e8; --blue-light:#e8f0fe;
  --dark:#2D3436; --dark-light:#636e72;
  --gray:#b2bec3; --gray-light:#dfe6e9; --gray-bg:#f5f6fa;
  --white:#ffffff;
  --red:#e74c3c; --red-light:#fdecea;
  --orange:#f39c12; --orange-light:#fef9e7;
  --shadow:0 2px 12px rgba(0,0,0,0.06);
  --radius:12px; --radius-sm:8px;
  --transition:all 0.2s ease;
}

body { font-family:'Inter',sans-serif; background:var(--gray-bg); color:var(--dark); min-height:100vh; line-height:1.6; }

/* === Header === */
.header { background:linear-gradient(135deg,var(--dark) 0%,#1e272e 100%); color:var(--white); padding:0 2rem; height:56px; display:flex; align-items:center; justify-content:space-between; position:sticky; top:0; z-index:100; }
.header-brand { font-size:1.1rem; font-weight:600; }
.header-brand .logo-accent { color:var(--green); }
.header-right { display:flex; align-items:center; gap:1rem; }
.header-user { font-size:0.8rem; color:var(--gray); }
.btn-logout { background:rgba(255,255,255,0.1); color:var(--white); border:1px solid rgba(255,255,255,0.2); padding:5px 14px; border-radius:var(--radius-sm); cursor:pointer; font-size:0.75rem; font-family:inherit; transition:var(--transition); }
.btn-logout:hover { background:rgba(255,255,255,0.2); }

/* === Header Nav === */
.header-nav { display:flex; align-items:center; gap:0.25rem; }
.header-nav-link { color:rgba(255,255,255,0.6); text-decoration:none; font-size:0.85rem; font-weight:500; padding:6px 14px; border-radius:var(--radius-sm); transition:var(--transition); }
.header-nav-link:hover { color:var(--white); background:rgba(255,255,255,0.1); }
.header-nav-link.active { color:var(--white); background:rgba(0,168,89,0.3); font-weight:600; }

/* === Login === */
.login-wrapper { display:flex; align-items:center; justify-content:center; min-height:100vh; background:linear-gradient(135deg,var(--dark) 0%,#1e272e 60%,var(--green-dark) 100%); }
.login-card { background:var(--white); border-radius:var(--radius); padding:3rem 2.5rem; width:100%; max-width:400px; box-shadow:0 20px 60px rgba(0,0,0,0.3); }
.login-card h1 { text-align:center; font-size:1.4rem; font-weight:700; margin-bottom:0.25rem; }
.login-card .subtitle { text-align:center; color:var(--dark-light); font-size:0.85rem; margin-bottom:2rem; }
.login-card .brand-line { width:50px; height:3px; background:var(--green); border-radius:2px; margin:0 auto 2rem; }
.form-group { margin-bottom:1.25rem; }
.form-group label { display:block; font-size:0.7rem; font-weight:600; color:var(--dark-light); margin-bottom:5px; text-transform:uppercase; letter-spacing:0.5px; }
.form-group input { width:100%; padding:11px 14px; border:2px solid var(--gray-light); border-radius:var(--radius-sm); font-size:0.9rem; font-family:inherit; color:var(--dark); transition:var(--transition); outline:none; }
.form-group input:focus { border-color:var(--green); box-shadow:0 0 0 3px rgba(0,168,89,0.1); }
.btn-primary { width:100%; padding:12px; background:var(--green); color:var(--white); border:none; border-radius:var(--radius-sm); font-size:0.95rem; font-weight:600; font-family:inherit; cursor:pointer; transition:var(--transition); margin-top:0.5rem; }
.btn-primary:hover { background:var(--green-dark); }
.btn-primary:disabled { background:var(--gray); cursor:not-allowed; }
.error-message { background:var(--red-light); color:var(--red); padding:10px 14px; border-radius:var(--radius-sm); font-size:0.8rem; margin-bottom:1rem; display:none; border-left:3px solid var(--red); }
.error-message.visible { display:block; }

/* === Layout === */
.main-content { max-width:960px; margin:1.5rem auto; padding:0 1rem; }
.main-content.wide { max-width:100%; padding:0 2rem; }

/* === Search === */
.search-section { background:var(--white); border-radius:var(--radius); padding:1.5rem; box-shadow:var(--shadow); margin-bottom:1.5rem; }
.search-section h2 { font-size:1rem; font-weight:600; margin-bottom:0.75rem; }
.search-row { display:flex; gap:10px; }
.search-row input { flex:1; padding:10px 14px; border:2px solid var(--gray-light); border-radius:var(--radius-sm); font-size:0.9rem; font-family:inherit; outline:none; transition:var(--transition); }
.search-row input:focus { border-color:var(--green); box-shadow:0 0 0 3px rgba(0,168,89,0.1); }
.btn-search { padding:10px 24px; background:var(--green); color:var(--white); border:none; border-radius:var(--radius-sm); font-size:0.9rem; font-weight:600; font-family:inherit; cursor:pointer; transition:var(--transition); white-space:nowrap; }
.btn-search:hover { background:var(--green-dark); }
.btn-search:disabled { background:var(--gray); cursor:not-allowed; }

/* === Loading / No results === */
.loading { display:none; text-align:center; padding:2.5rem 1rem; }
.loading.visible { display:block; }
.spinner { width:36px; height:36px; border:3px solid var(--gray-light); border-top-color:var(--green); border-radius:50%; animation:spin 0.7s linear infinite; margin:0 auto 0.75rem; }
@keyframes spin { to { transform:rotate(360deg); } }
.loading-text { color:var(--dark-light); font-size:0.85rem; }
.no-results { display:none; text-align:center; padding:2.5rem 1rem; color:var(--dark-light); }
.no-results.visible { display:block; }
.no-results-icon { font-size:2.5rem; margin-bottom:0.75rem; opacity:0.25; }

/* === Patient Summary Bar === */
.patient-summary { background:var(--white); border-radius:var(--radius); padding:1.25rem 1.5rem; box-shadow:var(--shadow); display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:0; border-bottom:2px solid var(--green); }
.patient-summary h3 { font-size:1.1rem; font-weight:700; margin-bottom:2px; }
.patient-summary-meta { display:flex; gap:1.25rem; flex-wrap:wrap; font-size:0.8rem; color:var(--dark-light); }
.patient-summary-meta strong { color:var(--dark); }
.patient-summary-right { display:flex; align-items:center; gap:10px; flex-shrink:0; }
.btn-cancel-sm { padding:6px 16px; background:var(--red); color:var(--white); border:none; border-radius:var(--radius-sm); font-size:0.75rem; font-weight:600; font-family:inherit; cursor:pointer; transition:var(--transition); }
.btn-cancel-sm:hover { background:#c0392b; }

/* === Badges === */
.badge { display:inline-block; padding:4px 12px; border-radius:20px; font-size:0.7rem; font-weight:700; text-transform:uppercase; letter-spacing:0.5px; }
.badge-ativo { background:var(--green); color:var(--white); }
.badge-cancelado { background:var(--red); color:var(--white); }
.badge-inativo { background:var(--gray); color:var(--white); }

/* === Tabs === */
.tabs { display:flex; background:var(--white); border-radius:0 0 var(--radius) var(--radius); box-shadow:var(--shadow); overflow:hidden; margin-bottom:1.5rem; }
.tab { flex:1; padding:12px; border:none; background:transparent; font-size:0.85rem; font-weight:500; font-family:inherit; color:var(--dark-light); cursor:pointer; transition:var(--transition); border-bottom:3px solid transparent; }
.tab:hover { background:var(--gray-bg); }
.tab.active { color:var(--green-dark); border-bottom-color:var(--green); font-weight:600; background:var(--green-light); }
.tab-content { display:none; animation:fadeIn 0.25s ease; }
.tab-content.active { display:block; }
@keyframes fadeIn { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }

/* === Card === */
.card { background:var(--white); border-radius:var(--radius); box-shadow:var(--shadow); overflow:hidden; }
.card-section { padding:1.5rem; }
.card-section + .card-section { border-top:1px solid var(--gray-light); }
.card-section-title { font-size:0.8rem; font-weight:700; text-transform:uppercase; letter-spacing:0.5px; color:var(--dark-light); margin-bottom:1rem; }
.card-section-title.accent-blue { color:var(--blue); }
.card-section-title small { font-size:0.65rem; font-weight:400; text-transform:none; letter-spacing:0; color:var(--dark-light); }
.enel-status-active { color:var(--green); font-weight:600; }
.enel-status-inactive { color:var(--red); font-weight:600; }
.enel-section-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:1rem; }
.enel-section-header .card-section-title { margin-bottom:0; }
.btn-cancel-enel { background:var(--blue); color:var(--white); border:none; padding:6px 16px; border-radius:var(--radius-sm); cursor:pointer; font-size:0.75rem; font-weight:600; font-family:inherit; transition:var(--transition); }
.btn-cancel-enel:hover { background:#1557b0; }
.btn-cancel-enel:disabled { opacity:0.6; cursor:not-allowed; }
.enel-alert { padding:0.75rem 1rem; border-radius:var(--radius-sm); font-size:0.8rem; margin-bottom:0.75rem; line-height:1.6; }
.enel-alert.warn { background:var(--orange-light); color:#8a6d3b; border:1px solid #f0d9a0; }
.enel-alert.ok { background:var(--green-light); color:#2d6a4f; border:1px solid #b7e4c7; }
.enel-alert.info { background:var(--blue-light); color:#1a56a8; border:1px solid #b6d4fe; }

/* === ENEL Verification Section === */
.enel-verif-section { margin-top:0.75rem; }
.enel-verif-section + .enel-verif-section { margin-top:1rem; padding-top:0.75rem; border-top:1px solid rgba(0,0,0,0.08); }
.enel-verif-title { font-size:0.7rem; font-weight:700; text-transform:uppercase; letter-spacing:0.5px; margin-bottom:0.5rem; display:flex; align-items:center; gap:6px; }
.enel-verif-title .verif-icon { display:inline-flex; align-items:center; justify-content:center; width:18px; height:18px; border-radius:50%; font-size:0.6rem; flex-shrink:0; }
.enel-verif-title .verif-icon.ok { background:var(--green); color:var(--white); }
.enel-verif-title .verif-icon.warn { background:var(--orange); color:var(--white); }
.enel-verif-title .verif-icon.err { background:var(--red); color:var(--white); }
.enel-verif-title .verif-icon.neutral { background:var(--gray); color:var(--white); }
.enel-verif-empty { font-size:0.78rem; color:var(--dark-light); font-style:italic; }
.enel-verif-table { width:100%; border-collapse:collapse; font-size:0.78rem; margin-top:4px; background:var(--white); border-radius:6px; overflow:hidden; border:1px solid rgba(0,0,0,0.06); }
.enel-verif-table th { text-align:left; padding:6px 10px; font-size:0.62rem; font-weight:700; text-transform:uppercase; letter-spacing:0.4px; color:var(--dark-light); background:var(--gray-bg); border-bottom:1px solid var(--gray-light); white-space:nowrap; }
.enel-verif-table td { padding:5px 10px; border-bottom:1px solid var(--gray-light); color:var(--dark); }
.enel-verif-table tr:last-child td { border-bottom:none; }
.enel-verif-table tr:hover { background:rgba(0,0,0,0.02); }
.enel-verif-table .cod-cell { font-weight:700; font-family:'Consolas','Monaco',monospace; font-size:0.78rem; }
.enel-verif-inline { display:flex; flex-wrap:wrap; gap:0.5rem; font-size:0.8rem; }
.enel-verif-chip { display:inline-flex; align-items:center; gap:4px; background:var(--white); padding:3px 10px; border-radius:20px; font-size:0.75rem; border:1px solid rgba(0,0,0,0.08); }
.enel-verif-chip .chip-label { color:var(--dark-light); font-weight:500; }
.enel-verif-chip .chip-value { color:var(--dark); font-weight:600; }
.enel-verif-params { margin-top:0.75rem; padding:0.5rem 0.75rem; background:rgba(0,0,0,0.03); border-radius:6px; font-size:0.7rem; color:var(--dark-light); font-family:'Consolas','Monaco',monospace; word-break:break-all; }
.enel-verif-conclusion { margin-top:0.75rem; padding:0.5rem 0.75rem; border-radius:6px; font-size:0.82rem; font-weight:600; }
.enel-verif-conclusion.confirmed { background:var(--green-light); color:#2d6a4f; border:1px solid #b7e4c7; }
.enel-verif-conclusion.pending { background:var(--orange-light); color:#8a6d3b; border:1px solid #f0d9a0; }
.info-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:0.75rem; }
.info-item { padding:0.6rem 0.75rem; background:var(--gray-bg); border-radius:var(--radius-sm); }
.info-item .label { font-size:0.65rem; font-weight:600; text-transform:uppercase; letter-spacing:0.5px; color:var(--dark-light); margin-bottom:2px; }
.info-item .value { font-size:0.9rem; font-weight:500; color:var(--dark); word-break:break-all; }
.info-item.full-width { grid-column:1 / -1; }

/* === Raw JSON Debug === */
.raw-json-toggle { margin-top:1rem; padding-top:0.75rem; border-top:1px solid var(--gray-light); }
.btn-raw-json { background:none; border:1px solid var(--gray-light); color:var(--dark-light); padding:5px 12px; border-radius:var(--radius-sm); font-size:0.7rem; font-family:inherit; cursor:pointer; transition:var(--transition); }
.btn-raw-json:hover { border-color:var(--blue); color:var(--blue); }
.btn-raw-json.open { border-color:var(--blue); color:var(--blue); }
.raw-json-content { margin-top:0.5rem; padding:0.75rem; background:var(--gray-bg); border:1px solid var(--gray-light); border-radius:6px; font-size:0.68rem; font-family:'Consolas','Monaco',monospace; line-height:1.5; max-height:300px; overflow:auto; white-space:pre-wrap; word-break:break-word; color:var(--dark); scrollbar-width:thin; }

/* === Status ENEL Tab === */
.status-enel-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:1.25rem; gap:1rem; }
.status-enel-info h4 { font-size:0.95rem; font-weight:700; color:var(--dark); margin-bottom:2px; }
.status-enel-info p { font-size:0.78rem; color:var(--dark-light); }
.btn-refresh { padding:8px 20px; background:var(--blue); color:var(--white); border:none; border-radius:var(--radius-sm); font-size:0.8rem; font-weight:600; font-family:inherit; cursor:pointer; transition:var(--transition); white-space:nowrap; flex-shrink:0; }
.btn-refresh:hover { background:#1557b0; }
.btn-refresh:disabled { background:var(--gray); cursor:not-allowed; }

.status-card { background:var(--white); border-radius:var(--radius); box-shadow:var(--shadow); margin-bottom:0.75rem; overflow:hidden; }
.status-card-header { display:flex; align-items:center; gap:10px; padding:0.85rem 1.25rem; border-bottom:1px solid var(--gray-light); }
.status-card-header h5 { font-size:0.85rem; font-weight:700; color:var(--dark); margin:0; }
.status-card-desc { font-size:0.72rem; color:var(--dark-light); margin-left:auto; }
.status-card-icon { display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; border-radius:50%; font-size:0.65rem; font-weight:700; flex-shrink:0; background:var(--gray-light); color:var(--dark-light); }
.status-card-icon.ok { background:var(--green); color:var(--white); }
.status-card-icon.warn { background:var(--orange); color:var(--white); }
.status-card-icon.err { background:var(--red); color:var(--white); }
.status-card-icon.neutral { background:var(--gray-light); color:var(--dark-light); }
.status-card-body { padding:1rem 1.25rem; }
.status-card-body .enel-verif-table { margin-top:0; }
.status-card-body .enel-verif-empty { padding:0.5rem 0; }
.status-card-body .enel-verif-inline { padding:0.25rem 0; }

/* === Financial Summary === */
.fin-summary { display:grid; grid-template-columns:repeat(5,1fr); gap:0.75rem; margin-bottom:1.25rem; }
.fin-summary-card { background:var(--white); border-radius:var(--radius); padding:1rem 1.25rem; box-shadow:var(--shadow); text-align:center; border-top:3px solid var(--gray); }
.fin-summary-card.green { border-top-color:var(--green); }
.fin-summary-card.orange { border-top-color:var(--orange); }
.fin-summary-card.red { border-top-color:var(--red); }
.fin-summary-card.blue { border-top-color:var(--blue); }
.fin-summary-value { font-size:1.3rem; font-weight:700; color:var(--dark); }
.fin-summary-label { font-size:0.7rem; font-weight:600; text-transform:uppercase; letter-spacing:0.5px; color:var(--dark-light); margin-top:2px; }

/* === Accordion === */
.accordion { background:var(--white); border-radius:var(--radius); box-shadow:var(--shadow); margin-bottom:0.75rem; overflow:hidden; }
.accordion-toggle { width:100%; padding:1rem 1.25rem; border:none; background:transparent; display:flex; align-items:center; justify-content:space-between; font-size:0.9rem; font-weight:600; font-family:inherit; color:var(--dark); cursor:pointer; transition:var(--transition); }
.accordion-toggle:hover { background:var(--gray-bg); }
.accordion-toggle::before { content:''; display:inline-block; width:6px; height:6px; border-right:2px solid var(--dark-light); border-bottom:2px solid var(--dark-light); transform:rotate(-45deg); margin-right:10px; transition:transform 0.2s ease; flex-shrink:0; }
.accordion-toggle.open::before { transform:rotate(45deg); }
.accordion-count { background:var(--gray-bg); color:var(--dark-light); padding:2px 10px; border-radius:12px; font-size:0.7rem; font-weight:700; }
.accordion-body { display:none; border-top:1px solid var(--gray-light); }
.accordion-body.open { display:block; }

/* === Tables === */
.table-wrap { overflow-x:auto; }
.data-table { width:100%; border-collapse:collapse; font-size:0.8rem; }
.data-table thead th { text-align:left; padding:10px 12px; font-size:0.65rem; font-weight:700; text-transform:uppercase; letter-spacing:0.5px; color:var(--dark-light); border-bottom:2px solid var(--gray-light); white-space:nowrap; background:var(--gray-bg); position:sticky; top:0; }
.data-table tbody td { padding:8px 12px; border-bottom:1px solid var(--gray-light); color:var(--dark); white-space:nowrap; }
.data-table tbody tr:last-child td { border-bottom:none; }
.data-table tbody tr:hover { background:rgba(0,168,89,0.03); }
.data-table tbody tr:nth-child(even) { background:rgba(0,0,0,0.015); }
.data-table tbody tr:nth-child(even):hover { background:rgba(0,168,89,0.03); }

/* Show more button */
.btn-show-more { display:block; width:100%; padding:10px; border:none; background:var(--gray-bg); color:var(--blue); font-size:0.8rem; font-weight:600; font-family:inherit; cursor:pointer; transition:var(--transition); border-top:1px solid var(--gray-light); }
.btn-show-more:hover { background:var(--blue-light); }

/* === Bill/Charge badges === */
.bill-badge { display:inline-block; padding:2px 8px; border-radius:10px; font-size:0.65rem; font-weight:700; text-transform:uppercase; }
.bill-badge.paga { background:var(--green-light); color:var(--green-dark); }
.bill-badge.pendente { background:var(--orange-light); color:var(--orange); }
.bill-badge.cancelada { background:var(--red-light); color:var(--red); }
.bill-badge.outro { background:var(--blue-light); color:var(--blue); }
.charge-status { display:inline-block; padding:2px 8px; border-radius:10px; font-size:0.65rem; font-weight:700; }
.charge-status.ativo { background:var(--green-light); color:var(--green-dark); }
.charge-status.cancelado { background:var(--red-light); color:var(--red); }
.charge-status.terminado { background:var(--blue-light); color:var(--blue); }
.val-negative { color:var(--red); font-weight:600; }
.val-positive { color:var(--green-dark); font-weight:600; }
.mov-badge { display:inline-block; padding:2px 8px; border-radius:10px; font-size:0.65rem; font-weight:700; }
.mov-badge.pagamento { background:var(--green-light); color:var(--green-dark); }
.mov-badge.cobranca { background:var(--orange-light); color:var(--orange); }
.empty-state { text-align:center; padding:1.5rem 1rem; color:var(--gray); font-size:0.85rem; }

/* === Report Filters === */
.report-filters { display:flex; gap:0.75rem; flex-wrap:wrap; align-items:flex-end; }
.filter-group { display:flex; flex-direction:column; gap:4px; }
.filter-group label { font-size:0.7rem; font-weight:600; color:var(--dark-light); text-transform:uppercase; letter-spacing:0.5px; }
.filter-group input, .filter-group select { padding:9px 12px; border:2px solid var(--gray-light); border-radius:var(--radius-sm); font-size:0.85rem; font-family:inherit; outline:none; transition:var(--transition); color:var(--dark); }
.filter-group input:focus, .filter-group select:focus { border-color:var(--green); box-shadow:0 0 0 3px rgba(0,168,89,0.1); }
.filter-action { justify-content:flex-end; }

/* === Report Summary === */
.report-summary { display:grid; grid-template-columns:repeat(3,1fr); gap:0.75rem; margin-bottom:1rem; }

/* === Report Actions === */
.report-actions { display:flex; justify-content:flex-end; margin-bottom:0.75rem; }
.btn-export { padding:8px 20px; background:var(--blue); color:var(--white); border:none; border-radius:var(--radius-sm); font-size:0.8rem; font-weight:600; font-family:inherit; cursor:pointer; transition:var(--transition); }
.btn-export:hover { background:#1557b0; }

/* === Patient Link in Report === */
.patient-link { color:var(--blue); text-decoration:none; font-weight:500; }
.patient-link:hover { text-decoration:underline; }

/* === Report Table compact columns === */
#reportTable { table-layout:fixed; width:100%; }
#reportTable th, #reportTable td { font-size:0.75rem; padding:6px 8px; overflow:hidden; text-overflow:ellipsis; }
#reportTable th:nth-child(1) { width:20%; }
#reportTable th:nth-child(2) { width:12%; }
#reportTable th:nth-child(3) { width:18%; }
#reportTable th:nth-child(4) { width:10%; }
#reportTable th:nth-child(5), #reportTable th:nth-child(6), #reportTable th:nth-child(7) { width:7%; text-align:center; }
#reportTable th:nth-child(8) { width:12%; }
#reportTable td:nth-child(3) { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#reportTable td:nth-child(5), #reportTable td:nth-child(6), #reportTable td:nth-child(7) { text-align:center; }

/* === Divergencias Table === */
#divTable { table-layout:fixed; width:100%; }
#divTable th, #divTable td { font-size:0.75rem; padding:6px 8px; overflow:hidden; text-overflow:ellipsis; }
#divTable th:nth-child(1) { width:22%; }
#divTable th:nth-child(2) { width:14%; }
#divTable th:nth-child(3) { width:20%; }
#divTable th:nth-child(4) { width:14%; }
#divTable th:nth-child(5) { width:14%; }
#divTable th:nth-child(6) { width:8%; }
#divTable td:nth-child(3) { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* === Pagination === */
.pagination { display:flex; align-items:center; justify-content:center; gap:1rem; margin-top:1rem; padding:0.75rem; }
.pag-btn { padding:8px 18px; background:var(--white); color:var(--dark); border:2px solid var(--gray-light); border-radius:var(--radius-sm); font-size:0.8rem; font-weight:600; font-family:inherit; cursor:pointer; transition:var(--transition); }
.pag-btn:hover:not(:disabled) { border-color:var(--green); color:var(--green-dark); }
.pag-btn:disabled { opacity:0.4; cursor:not-allowed; }
.pag-info { font-size:0.8rem; color:var(--dark-light); font-weight:500; }

/* === Feedback === */
.feedback { display:none; padding:0.75rem 1.25rem; border-radius:var(--radius-sm); margin-top:1rem; font-size:0.85rem; font-weight:500; }
.feedback.visible { display:block; animation:fadeIn 0.3s ease; }
.feedback.success { background:var(--green-light); color:var(--green-dark); border-left:3px solid var(--green); }
.feedback.error { background:var(--red-light); color:var(--red); border-left:3px solid var(--red); }

/* === Modal === */
.modal-overlay { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.5); z-index:200; align-items:center; justify-content:center; }
.modal-overlay.visible { display:flex; }
.modal { background:var(--white); border-radius:var(--radius); padding:2rem; max-width:600px; width:92%; box-shadow:0 20px 60px rgba(0,0,0,0.3); animation:fadeIn 0.2s ease; max-height:85vh; overflow-y:auto; scrollbar-width:thin; scrollbar-color:var(--gray-light) transparent; }
.modal::-webkit-scrollbar { width:6px; }
.modal::-webkit-scrollbar-track { background:transparent; }
.modal::-webkit-scrollbar-thumb { background:var(--gray-light); border-radius:3px; }
.modal::-webkit-scrollbar-thumb:hover { background:var(--gray); }
.modal h3 { font-size:1rem; font-weight:700; color:var(--red); margin-bottom:0.75rem; }
.modal p { color:var(--dark-light); font-size:0.85rem; margin-bottom:0.5rem; line-height:1.5; }
.modal .patient-confirm-name { font-weight:600; color:var(--dark); font-size:0.95rem; margin:1rem 0; padding:0.75rem; background:var(--red-light); border-radius:var(--radius-sm); border-left:3px solid var(--red); }
.modal-actions { display:flex; gap:10px; justify-content:flex-end; margin-top:1.25rem; }
.btn-modal-cancel { padding:8px 20px; background:var(--gray-light); color:var(--dark); border:none; border-radius:var(--radius-sm); font-size:0.85rem; font-weight:500; font-family:inherit; cursor:pointer; transition:var(--transition); }
.btn-modal-cancel:hover { background:var(--gray); }
.btn-modal-confirm { padding:8px 20px; background:var(--red); color:var(--white); border:none; border-radius:var(--radius-sm); font-size:0.85rem; font-weight:600; font-family:inherit; cursor:pointer; transition:var(--transition); }
.btn-modal-confirm:hover { background:#c0392b; }
.btn-modal-confirm:disabled { background:var(--gray); cursor:not-allowed; }
.result-title-success { color:var(--green-dark) !important; }
.result-title-error { color:var(--red) !important; }
.result-section { margin-bottom:1.25rem; }
.result-section:last-child { margin-bottom:0; }
.result-section-title { font-size:0.72rem; font-weight:700; color:var(--dark-light); text-transform:uppercase; letter-spacing:0.5px; margin-bottom:0.6rem; padding-bottom:6px; border-bottom:2px solid var(--gray-light); display:flex; align-items:center; gap:6px; }
.result-table { width:100%; border-collapse:collapse; font-size:0.8rem; background:var(--gray-bg); border-radius:6px; overflow:hidden; }
.result-table tr { border-bottom:1px solid var(--gray-light); }
.result-table tr:last-child { border-bottom:none; }
.result-table tr:hover { background:rgba(0,0,0,0.02); }
.result-key { font-weight:600; color:var(--dark-light); padding:6px 12px 6px 10px; white-space:nowrap; vertical-align:top; width:1%; font-size:0.75rem; }
.result-table td { padding:6px 10px; color:var(--dark); word-break:break-all; }
.result-error { background:var(--red-light); color:var(--red); padding:0.75rem 1rem; border-radius:var(--radius-sm); font-size:0.85rem; border-left:3px solid var(--red); line-height:1.7; }
.result-info { background:var(--orange-light); color:var(--orange); padding:0.75rem 1rem; border-radius:var(--radius-sm); font-size:0.85rem; border-left:3px solid var(--orange); }
.result-ok { color:var(--green-dark); font-weight:600; }
.result-info-text { color:var(--dark-light); }
.result-data { font-size:0.85rem; }
.result-timestamp { margin-top:1.25rem; padding-top:0.75rem; border-top:1px solid var(--gray-light); font-size:0.72rem; color:var(--gray); text-align:right; }
.result-payload { font-size:0.72rem; overflow:auto; background:var(--gray-bg); padding:0.75rem; border-radius:6px; border:1px solid var(--gray-light); font-family:'Consolas','Monaco',monospace; line-height:1.5; max-height:200px; color:var(--dark); white-space:pre-wrap; word-break:break-word; }

/* === Responsive === */
@media (max-width:768px) {
  .header { padding:0 1rem; }
  .main-content { padding:0 0.75rem; margin:1rem auto; }
  .search-row { flex-direction:column; }
  .patient-summary { flex-direction:column; align-items:flex-start; }
  .patient-summary-right { align-self:flex-end; }
  .info-grid { grid-template-columns:1fr 1fr; }
  .fin-summary { grid-template-columns:repeat(2,1fr); }
  .modal-actions { flex-direction:column-reverse; }
  .btn-modal-cancel,.btn-modal-confirm { width:100%; text-align:center; }
  .login-card { margin:1rem; padding:2rem 1.5rem; }
  .report-filters { flex-direction:column; }
  .report-summary { grid-template-columns:1fr; }
  .header-nav { gap:0; }
  .header-nav-link { font-size:0.75rem; padding:4px 10px; }
}
@media (max-width:480px) {
  .info-grid { grid-template-columns:1fr; }
}
