/* Medical-record template sheet: A4 paper-like official layout. */
@page { size: A4 portrait; margin: 12mm; }
.mrt-sheet { box-sizing: border-box; background: #fff; color: #171717; font: 13px/1.4 "SimSun", "Songti SC", serif; padding: 12mm 14mm; }
.mrt-sheet, .mrt-sheet * { box-sizing: border-box; }
.mrt-hospital { text-align: center; font-size: 15px; letter-spacing: 3px; margin-bottom: 2px; }
.mrt-title { text-align: center; font-size: 24px; letter-spacing: 8px; margin: 6px 0 10px; font-weight: 700; }
.mrt-subtitle { text-align: center; font-size: 13px; margin: -6px 0 8px; }
.mrt-header-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 12px; margin-bottom: 4px; }
.mrt-header-left { display: inline-flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.mrt-header-right { font-weight: 700; }
.mrt-header-label { margin-left: 6px; color: #444; }
.mrt-serial { text-align: right; margin: 0 0 6px; font-size: 13px; }
.mrt-section { margin-top: 8px; }
.mrt-section-title { font-size: 14px; margin: 0; padding: 4px 8px; border: 1px solid #333; border-bottom: 0; background: #e9eeee; letter-spacing: 1px; }
.mrt-table { width: 100%; border-collapse: collapse; table-layout: fixed; margin: 0; }
.mrt-table th, .mrt-table td { border: 1px solid #333; padding: 4px 6px; min-height: 28px; vertical-align: middle; word-break: break-all; }
.mrt-table th { font-weight: 600; text-align: center; background: #f4f4f4; white-space: nowrap; width: 10%; }
.mrt-table td { padding-left: 6px; }
.mrt-blocks { border: 1px solid #333; border-top: 0; padding: 6px 8px 8px; }
.mrt-block { margin-bottom: 6px; }
.mrt-block:last-child { margin-bottom: 0; }
.mrt-block-label { font-weight: 700; margin-bottom: 3px; }
.mrt-block-body { min-height: 22px; white-space: pre-wrap; }

/* Edit controls */
.mrt-control { width: 100%; border: 1px solid transparent; border-bottom: 1px solid #9aa7ad; background: transparent; font: inherit; color: inherit; padding: 1px 2px; outline: none; }
.mrt-control:focus { border-color: #1f6f8b; background: #f4fbfd; }
.mrt-control:disabled { color: #555; background: #f3f3f3; }
textarea.mrt-control { resize: vertical; min-height: 44px; }
.mrt-select { border: 1px solid #9aa7ad; background: #fff; cursor: pointer; }
.mrt-date { position: relative; display: flex; align-items: center; gap: 2px; }
.mrt-date .mrt-date-input { padding-right: 2px; }
.mrt-date-icon { position: absolute; right: 2px; border: 0; background: transparent; color: #1f6f8b; cursor: pointer; padding: 2px; line-height: 0; }
.mrt-date-icon:hover { color: #0d4f61; }
.mrt-date-icon:disabled { color: #bbb; cursor: default; }
.mrt-boolean, .mrt-multi { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.mrt-radio, .mrt-check { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.mrt-partial-date { display: inline-flex; gap: 4px; align-items: center; }
.mrt-partial-date .mrt-partial-calendar { width: 24px; opacity: 0.6; }

/* Required marker and issue hints */
.mrt-required-mark { color: #c0392b; margin-right: 2px; font-weight: 700; }
.mrt-required { background: #fffaf0; }
.mrt-issue { color: #c0392b; font-size: 11px; margin-top: 2px; }
.mrt-unbound { background: repeating-linear-gradient(45deg, #fff, #fff 6px, #fbeaea 6px, #fbeaea 12px); }

/* Repeat tables */
.mrt-row-actions { width: 56px; text-align: center; white-space: nowrap; }
.mrt-remove { border: 1px solid #c0392b; background: #fff; color: #c0392b; border-radius: 3px; cursor: pointer; font-size: 12px; padding: 1px 6px; }
.mrt-remove:hover { background: #fbeaea; }
.mrt-add-row { margin-top: 5px; border: 1px dashed #1f6f8b; background: #f4fbfd; color: #1f6f8b; cursor: pointer; font-size: 12px; padding: 3px 10px; border-radius: 3px; }
.mrt-add-row:hover { background: #e3f4fa; }
.mrt-row-hint { color: #999; font-size: 11px; }

/* Signature footer */
.mrt-signature { border: 1px solid #333; padding: 8px 10px; margin-top: 8px; }
.mrt-signature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 18px; }
.mrt-signature-cell { display: flex; align-items: baseline; gap: 4px; }
.mrt-signature-label { font-weight: 600; white-space: nowrap; }
.mrt-signature-value { border-bottom: 1px solid #999; min-width: 60px; flex: 1; min-height: 16px; }
.mrt-empty-row .mrt-control { border-bottom-style: dashed; }

/* Host (app) integration container */
.medical-record-content { background: #fff; }
@media (max-width: 900px) {
  .mrt-sheet { padding: 18px 12px; overflow-x: auto; }
  .mrt-table th, .mrt-table td { font-size: 11px; padding: 4px 3px; }
}

/* Print */
@media print {
  .mrt-sheet { font-size: 12px; }
  .mrt-table th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .mrt-add-row, .mrt-remove, .mrt-row-actions, .mrt-issue, .mrt-date-icon { display: none !important; }
  .mrt-control { border-bottom-color: transparent; }
}
