.ecg-tabs[hidden], .topbar.app-header .ecg-write[hidden], .ecg-report [hidden] { display: none; }
.ecg-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.ecg-tabs .tool { flex: 1; }
.ecg-tabs .tool[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.ecg-filter { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.ecg-filter select, .ecg-dialog :is(input, select, textarea) {
  width: 100%; padding: 8px; border: 1px solid var(--line, #c5d2df); border-radius: 6px;
  background: var(--surface, white); color: var(--ink, #142a42); font: inherit;
}
#ecgInboxNotice:not(:empty) { font-size: 12px; margin-top: 8px; }
.ecg-inbox-items { display: grid; gap: 7px; margin: 10px 0; }
.ecg-inbox-row { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.ecg-inbox-row.active { border-color: var(--accent); box-shadow: inset 3px 0 var(--accent); }
.ecg-open-row {
  display: grid; gap: 5px; width: 100%; padding: 10px; border: 0; border-radius: 7px;
  background: transparent; color: var(--ink); text-align: start; cursor: pointer;
}
.ecg-open-row:hover, .ecg-open-row:focus-visible { background: var(--accent-soft); }
.ecg-open-row strong { font-size: 14px; overflow-wrap: anywhere; }
.ecg-open-row span, .ecg-open-row small { font-size: 11px; }
.ecg-open-row span { color: var(--muted); }
.ecg-row-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 10px 9px; font-size: 12px; }
.ecg-checkbox { display: inline-flex; align-items: center; gap: 4px; }
.ecg-unanswered { color: var(--muted); }
.ecg-row-error:not(:empty) { padding: 4px 10px 8px; font-size: 12px; }
.ecg-pager { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-size: 11px; }
.ecg-pager #ecgRefreshInbox { margin-inline-start: auto; }
.ecg-dialog {
  width: min(550px, calc(100vw - 32px)); max-height: 85vh; padding: 20px;
  border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface);
}
.ecg-dialog::backdrop { background: #0b193678; }
.ecg-dialog :is(header, footer, .ecg-share-row) { display: flex; align-items: center; gap: 10px; }
.ecg-dialog :is(header, .ecg-share-row) { justify-content: space-between; }
.ecg-dialog h2, .ecg-dialog h3 { margin: 0; }
.ecg-dialog label { display: grid; gap: 4px; margin: 12px 0; font-size: 13px; font-weight: 600; }
.ecg-dialog footer { justify-content: flex-end; flex-wrap: wrap; }
.ecg-dialog p { overflow-wrap: anywhere; }
.ecg-share-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
#ecgReplyPreview { padding: 13px; border-radius: 7px; border: 1px solid var(--line); }
#ecgReplyPreview h3 { margin-bottom: 10px; }
.ecg-patient-review { display: grid; justify-items: start; gap: 7px; padding: 4px 9px 9px; font-size: 12px; }
.ecg-patient-message { width: 100%; display: grid; justify-items: start; gap: 5px; border-top: 1px solid var(--line); padding: 8px 0 2px; }
.ecg-patient-message p { margin: 0; }
.ecg-patient-message a { display: inline-flex; align-items: center; min-height: 36px; padding: 3px 9px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); font-weight: 600; text-decoration: none; }
.ecg-patient-message a:hover { text-decoration: underline; }
@media (pointer: coarse) {
  .ecg-patient-message a { min-height: 42px; }
}
.ecg-patient-message .ecg-new { color: var(--accent); font-size: 11px; }
.ecg-conclusion, .ecg-facts dd { overflow-wrap: anywhere; }
.ecg-author { color: var(--muted, #475b6e); }
.ecg-facts { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); column-gap: 14px; row-gap: 5px; }
.ecg-facts dt { font-weight: 650; }
.ecg-facts dd { margin: 0; }

.ecg-report { margin: 0; min-height: 100dvh; font: 15px/1.55 system-ui, sans-serif; color: #293340; background: #f3f5f8; }
.ecg-report *, .ecg-report *::before, .ecg-report *::after { box-sizing: border-box; }
.ecg-report-sheet, .ecg-report-actions, .ecg-report-note { width: min(880px, calc(100% - 24px)); margin: 0 auto 12px; }
.ecg-report-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 10px; padding-top: 10px; }
.ecg-report-actions > a { display: inline-flex; align-items: center; min-height: 38px; padding: 4px 8px; border-radius: 5px; text-decoration: none; font-size: 13px; font-weight: 550; color: #245f9d; }
.ecg-report-actions > a:hover { background: #e7eef8; }
.ecg-report .tool { min-height: 38px; padding: 5px 10px; font: inherit; font-size: 13px; color: #245f9d; background: #fff; border: 1px solid #cfd9e8; border-radius: 6px; cursor: pointer; }
.ecg-report-actions > .tool { margin-inline-start: auto; }
.ecg-report :is(a,button):focus-visible { outline: 2px solid #245f9d; outline-offset: 2px; }
.ecg-report-sheet { background: #fff; padding: clamp(14px, 3vw, 28px); border: 1px solid #d9e1eb; border-radius: 8px; }
.ecg-report-sheet h1 { margin: 0 0 12px; font-size: clamp(22px, 4vw, 30px); letter-spacing: -.025em; }
.ecg-report-sheet header img { display: none; }
.ecg-report h2 { margin: 0 0 6px; font-size: 16px; }
.ecg-report-assessment { background: #f3f6fa; border: 1px solid #dbe4ef; border-radius: 7px; padding: 12px; }
.ecg-report-assessment .ecg-conclusion { font-size: 16px; white-space: pre-wrap; }
.ecg-report-measurement { margin-top: 16px; font-size: 13px; }
.ecg-report-measurement dl { margin: 0; }
.ecg-report-version { color: #475b6e; }
.ecg-report-note:empty { display: none; }
#ecgReplyHistory > :is(a, span) { display: block; margin-bottom: 5px; color: #245f9d; }
@media (max-width: 440px) { .ecg-report-actions > .tool { margin-inline-start: 0; } }

@page { size: A4 portrait; margin: 15mm; }
@media print {
  .ecg-report { padding: 0; background: #fff; color: #161f28; font-size: 11pt; }
  .ecg-report .ecg-report-sheet { margin: 0; width: 100%; max-width: none; padding: 0; border: 0; border-radius: 0; }
  .ecg-report .ecg-report-actions, .ecg-report .ecg-report-note { display: none; }
  .ecg-report .ecg-badge { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .ecg-report .ecg-report-assessment { break-inside: avoid; border: 0; background: transparent; padding: 0; }
  .ecg-report-sheet header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
  .ecg-report-sheet header img { display: block; object-fit: contain; }
  .ecg-report-sheet h1 { margin: 0; }
}
