:root {
  --primary: #e85a4f;
  --blue: #3498db;
  --blue-dark: #2980b9;
  --green: #27ae60;
  --teal: #16a085;
  --gray-nav: #5d6d7e;
  --border: #dce4ec;
  --bg: #f4f6f8;
  --text: #2c3e50;
  --tooltip-bg: #2c3e50;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft JhengHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

.page {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: #fff;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.06);
}

.header {
  position: relative;
  text-align: center;
  padding: 14px 16px 8px;
  border-bottom: 1px solid var(--border);
}

.header h1 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--primary);
  font-weight: 700;
}

.header .logo {
  font-size: 0.75rem;
  color: #95a5a6;
}

.header--with-lang {
  padding-right: 108px;
}

.header-lang {
  position: absolute;
  top: 10px;
  right: 10px;
  margin: 0;
}

.header-lang .lang-select-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.header-lang select,
.header-lang .lang-select {
  max-width: 96px;
  padding: 3px 6px;
  font-size: 0.78rem;
}

.section-title {
  text-align: center;
  font-size: 1.1rem;
  margin: 16px 0 12px;
  font-weight: 600;
}

.nav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 14px 16px;
}

.nav-grid--n-0 {
  display: none;
  padding: 0;
}

.nav-grid--n-1 {
  grid-template-columns: 1fr;
}

.nav-grid--n-2 {
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.nav-grid--n-2 .nav-btn {
  min-height: 108px;
  gap: 8px;
  padding: 20px 10px;
  font-size: 1rem;
}

.nav-grid--n-2 .nav-btn i {
  font-size: 1.5rem;
}

.nav-grid--n-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.nav-grid--n-3 .nav-btn {
  gap: 4px;
  padding: 14px 6px;
  font-size: 0.86rem;
}

.nav-grid--n-3 .nav-btn i {
  font-size: 1.15rem;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px 8px;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.nav-btn i {
  font-size: 1.4rem;
}

.nav-btn.treatment { background: var(--gray-nav); }
.nav-btn.freeze { background: var(--blue); }
.nav-btn.image { background: var(--green); }
.nav-btn.lab { background: var(--teal); }
.nav-btn.is-active {
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.45);
}
.nav-btn.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.search-box {
  padding: 0 14px 8px;
}

.search-row {
  display: flex;
  gap: 8px;
}

.search-row input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
}

.search-row button {
  padding: 0 18px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  white-space: nowrap;
}

.search-hint {
  text-align: center;
  font-size: 0.8rem;
  color: #7f8c8d;
  margin: 8px 0 14px;
}

.data-table {
  width: calc(100% - 28px);
  margin: 0 14px 24px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  border: 1px solid var(--border);
  padding: 10px 8px;
  text-align: center;
}

.data-table th {
  background: #5d6d7e;
  color: #fff;
  font-weight: 600;
}

.data-table .btn-detail-outline {
  background: #fff;
  color: var(--blue);
  border: 1px solid var(--blue);
}

.table-wrap {
  margin: 0 14px 24px;
  overflow-x: auto;
}

.btn-detail {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
}

.empty-msg,
.error-msg {
  text-align: center;
  padding: 24px 16px;
  color: #7f8c8d;
}

.error-msg { color: #c0392b; }

.loading {
  text-align: center;
  padding: 20px;
  color: #95a5a6;
}

.select-course-hint {
  text-align: center;
  font-size: 0.9rem;
  color: #5d6d7e;
  margin: -6px 14px 12px;
}

/* 用藥日曆頁：固定框架，僅中間表格可捲動 */
html.schedule-layout {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100svh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  background: var(--bg);
}

body.schedule-page {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100svh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  background: var(--bg);
}

.schedule-shell {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100svh;
  max-width: 100vw;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  background: #fff;
  contain: layout size style;
}

.schedule-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  touch-action: manipulation;
}

.schedule-header .header {
  padding: 10px 14px 4px;
  border: none;
}

.schedule-page .top-bar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 4px 14px 8px;
  border: none;
}

.back-link {
  font-size: 0.88rem;
  color: var(--blue);
  text-decoration: none;
}

.schedule-page .course-id {
  font-size: 0.95rem;
  font-weight: 600;
}

.schedule-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 14px 10px;
  font-size: 0.78rem;
  color: #7f8c8d;
  flex-wrap: wrap;
}

.lang-select-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 0.85rem;
}

.lang-select-wrap select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.85rem;
}

.schedule-overlay-msg {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(255, 255, 255, 0.92);
  text-align: center;
}

.schedule-overlay-msg[hidden] {
  display: none !important;
}

/* 中間表格區：上下由 JS 量測 header/footer 高度後定位 */
.schedule-table-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--schedule-header-h, 132px);
  bottom: var(--schedule-footer-h, 100px);
  overflow: hidden;
  touch-action: none;
  background: #fff;
  z-index: 10;
}

.schedule-scroll {
  width: 100%;
  height: 100%;
  overflow: scroll;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: none;
  touch-action: pan-x pan-y;
  contain: strict;
}

.schedule-scroll[hidden] {
  display: none !important;
}

.schedule-scroll.scrolled-x .schedule-table .corner-th,
.schedule-scroll.scrolled-x .schedule-table td.label {
  box-shadow: 4px 0 6px rgba(0, 0, 0, 0.1);
}

.schedule-scroll.scrolled-y .schedule-table thead th {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
}

.schedule-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 0 0 env(safe-area-inset-bottom, 0);
  box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.05);
  max-height: min(32vh, 240px);
  overflow-y: auto;
  overscroll-behavior: none;
  touch-action: pan-y;
}

/* 手機 RWD */
@media (max-width: 430px) {
  .schedule-header .header {
    padding: 8px 12px 2px;
  }

  .schedule-header .header h1 {
    font-size: 1.15rem;
  }

  .schedule-page .top-bar {
    padding: 2px 12px 6px;
  }

  .schedule-toolbar {
    padding: 4px 12px 8px;
    font-size: 0.72rem;
    gap: 6px;
  }

  .schedule-table {
    --label-w: 108px;
    --date-w: 66px;
    font-size: 0.76rem;
  }

  .schedule-table th,
  .schedule-table td {
    padding: 6px 6px;
  }

  .schedule-footer {
    max-height: min(28vh, 200px);
  }

  .prepare-note {
    margin: 8px 10px;
    padding: 10px 12px;
    font-size: 0.82rem;
  }
}

@media (max-width: 360px) {
  .schedule-table {
    --label-w: 92px;
    --date-w: 58px;
    font-size: 0.72rem;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .schedule-header .header h1 {
    font-size: 1rem;
  }

  .schedule-toolbar {
    display: none;
  }

  .schedule-footer {
    max-height: min(36vh, 160px);
  }
}

@media (orientation: landscape) {
  .schedule-scroll {
    touch-action: pan-x pan-y;
  }
  .schedule-table {
    font-size: 0.78rem;
  }
  .schedule-table th,
  .schedule-table td {
    padding: 6px 8px;
  }
  .schedule-footer {
    max-height: min(28vh, 200px);
  }
}

@media (min-width: 768px) {
  .schedule-shell {
    left: 0;
    right: 0;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
  }

  .schedule-table {
    --label-w: 148px;
    --date-w: 80px;
    font-size: 0.88rem;
  }

  .page {
    max-width: 720px;
  }
}

.prepare-note {
  margin: 10px 14px 8px;
  padding: 12px 14px;
  background: #fff8e6;
  border: 1px solid #f0d78c;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.55;
}

.note-fallback {
  font-size: 0.8rem;
  color: #7f8c8d;
  margin: 0 0 8px;
}

.note-empty {
  color: #95a5a6;
  margin: 0;
}

.prepare-note h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: #b7950b;
}

.prepare-note .note-body {
  white-space: pre-wrap;
  word-break: break-word;
}

/* 資料庫 HTML 注意事項：保留顏色、標題、列表（標題已在 prepare_note 內） */
.prepare-note .note-body--html {
  white-space: normal;
}

.prepare-note .note-body--html h1,
.prepare-note .note-body--html h2,
.prepare-note .note-body--html h3,
.prepare-note .note-body--html h4,
.prepare-note .note-body--html h5,
.prepare-note .note-body--html h6 {
  margin: 0.45em 0 0.25em;
  font-weight: 700;
  color: inherit;
  line-height: 1.45;
}

.prepare-note .note-body--html h6 {
  font-size: 1em;
}

.prepare-note .note-body--html p {
  margin: 0.35em 0;
}

.prepare-note .note-body--html ol,
.prepare-note .note-body--html ul {
  margin: 0.35em 0 0.35em 1.2em;
  padding: 0;
}

.prepare-note .note-body--html li {
  margin: 0.2em 0;
}

.prepare-note .note-body--html b,
.prepare-note .note-body--html strong {
  font-weight: 700;
}

.schedule-table {
  --grid-color: #c8d0d8;
  --grid-line: 1px;
  --grid-line-strong: 1px;
  --label-w: 132px;
  --date-w: 76px;
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  font-size: 0.82rem;
  table-layout: fixed;
}

.schedule-table .col-label {
  width: var(--label-w);
}

.schedule-table .col-date {
  width: var(--date-w);
}

.schedule-table th,
.schedule-table td {
  border: var(--grid-line) solid var(--grid-color);
  padding: 7px 9px;
  text-align: center;
  white-space: nowrap;
  box-sizing: border-box;
  height: 36px;
  vertical-align: middle;
}

.schedule-table td.label {
  position: -webkit-sticky;
  position: sticky;
  left: 0;
  z-index: 2;
  height: auto;
  min-height: 36px;
  text-align: left;
  background: #fafbfc;
  background-clip: padding-box;
  font-weight: 500;
  width: var(--label-w);
  box-sizing: border-box;
  word-break: break-word;
  white-space: normal;
  line-height: 1.35;
  vertical-align: top;
  border-right: var(--grid-line-strong) solid #a8b4c0;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.schedule-table tbody tr:nth-child(even) td.label {
  background: #f0f2f4;
}

/* 每種藥品列底部分隔（細線） */
.schedule-table tbody tr {
  border-bottom: var(--grid-line) solid #b0bcc8;
}

.schedule-table thead th {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  background: #ecf0f1;
  background-clip: padding-box;
  font-weight: 600;
  z-index: 3;
  border-bottom: var(--grid-line-strong) solid #a8b4c0;
  height: 36px;
  box-sizing: border-box;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.schedule-table .corner-th {
  position: -webkit-sticky;
  position: sticky;
  left: 0;
  top: 0;
  z-index: 5;
  background: #dce3e8;
  background-clip: padding-box;
  text-align: center;
  border-right: var(--grid-line-strong) solid #a8b4c0;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.schedule-table tbody tr:nth-child(even) td:not(.label) {
  background: #f8f9fa;
}

.cell-has-data {
  cursor: help;
  position: relative;
}

.cell-has-data:active {
  background: #e8f4fc;
}

.tooltip {
  position: fixed;
  z-index: 1000;
  background: var(--tooltip-bg);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s;
  max-width: 240px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.schedule-page .footer-close {
  display: block;
  margin: 8px 14px 12px auto;
  padding: 10px 20px;
  background: #5d6d7e;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
}

.ready-msg {
  margin: 12px 14px;
  padding: 12px 14px;
  background: #e8f8f0;
  color: #0a7a4a;
  border-radius: 8px;
  font-size: 0.92rem;
  text-align: center;
}

.module-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 14px 12px;
  padding: 12px 14px;
  background: #5d6d7e;
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
}

.page-footer {
  padding: 8px 14px 24px;
}

.btn-home {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border-radius: 8px;
  background: #5d6d7e;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
}

.list-hint {
  margin: 0 14px 10px;
  font-size: 0.88rem;
  color: #7f8c8d;
  text-align: center;
}

.page-treatment .cycle-item summary {
  font-size: 1rem;
  padding: 16px;
}

.cycle-list {
  padding: 0 14px 16px;
}

.cycle-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
  background: #fff;
}

.cycle-item summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 600;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cycle-item summary::-webkit-details-marker { display: none; }

.cycle-item summary::after {
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  color: #7f8c8d;
  transition: transform 0.2s;
}

.cycle-item[open] summary::after { transform: rotate(180deg); }

.cycle-body {
  padding: 12px 16px 16px;
}

.cycle-field {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed #ecf0f1;
  font-size: 0.92rem;
}

.cycle-label {
  min-width: 6.5em;
  color: var(--primary);
  font-weight: 600;
}

.cycle-value { flex: 1; }

.btn-detail.block {
  display: inline-flex;
  margin-top: 12px;
}

.module-results {
  padding: 0 14px 20px;
}

.result-count {
  font-size: 0.9rem;
  color: #7f8c8d;
  margin: 0 0 12px;
}

.info-card,
.image-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fff;
}

.info-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.field-list div {
  display: flex;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.92rem;
}

.field-list dt {
  min-width: 5em;
  color: #7f8c8d;
}

.field-list dd { margin: 0; flex: 1; }

.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ecf0f1;
  font-size: 0.8rem;
  font-weight: 600;
}

.card-image {
  display: block;
  max-width: 100%;
  margin-top: 10px;
  border-radius: 8px;
}

.card-image.wide { width: 100%; }

.image-section { margin-bottom: 18px; }

.image-section-title {
  margin: 0 0 10px;
  padding: 8px 12px;
  background: linear-gradient(90deg, #8e44ad, #9b59b6);
  color: #fff;
  border-radius: 8px;
  font-size: 0.95rem;
}

.image-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 600;
}

.image-type-badge {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
}

/* 影像資料分類頁 */
.page-images .images-toolbar {
  display: flex;
  align-items: center;
  margin: 0 14px 14px;
  padding-bottom: 4px;
}

.page-images .images-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.image-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 14px 10px;
}

.image-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 88px;
  padding: 14px 8px;
  border: none;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow 0.15s, opacity 0.15s;
}

.image-type-btn i {
  font-size: 1.35rem;
}

.image-type-btn.is-active {
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.55);
}

.image-type-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-show-all-images {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 28px);
  margin: 0 14px 16px;
  padding: 14px;
  border: 2px solid var(--blue);
  border-radius: 8px;
  background: #fff;
  color: var(--blue);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-show-all-images.is-active {
  background: #ebf5fb;
  box-shadow: inset 0 0 0 1px var(--blue);
}

.page-images .page-footer {
  margin-top: 8px;
}

/* 檢驗報告分類頁 */
.module-bar-reports {
  background: var(--teal);
  margin-top: 0;
}

.report-type-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 14px 10px;
}

.report-type-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow 0.15s, opacity 0.15s;
}

.report-type-btn.report-semen { background: var(--gray-nav); }
.report-type-btn.report-pgta { background: var(--blue); }
.report-type-btn.report-blood { background: var(--teal); }
.report-type-btn.report-default { background: #7f8c8d; }

.report-type-btn.is-active {
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.55);
}

.btn-show-all-reports {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 28px);
  margin: 0 14px 16px;
  padding: 14px;
  border: 2px solid var(--teal);
  border-radius: 8px;
  background: #fff;
  color: var(--teal);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-show-all-reports.is-active {
  background: #e8f8f5;
  box-shadow: inset 0 0 0 1px var(--teal);
}

.report-date-group {
  margin-bottom: 16px;
}

.report-date-head {
  margin: 0 0 8px;
  padding: 10px 14px;
  background: linear-gradient(90deg, #8e44ad, #9b59b6);
  color: #fff;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-detail {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fff;
  overflow: hidden;
}

.report-detail summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8f9fa;
}

.report-detail summary::-webkit-details-marker { display: none; }

.report-detail summary::after {
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  margin-left: auto;
  color: #7f8c8d;
  transition: transform 0.2s;
}

.report-detail[open] summary::after { transform: rotate(180deg); }

.report-detail-body {
  padding: 12px 16px 16px;
}

.report-frame.inline {
  width: 100%;
  min-height: 50vh;
  border: none;
  border-radius: 8px;
}

.report-content-text {
  padding: 12px 14px;
  border-radius: 8px;
  background: #f4f6f8;
  border-left: 3px solid var(--teal);
  font-size: 0.95rem;
  line-height: 1.7;
  word-break: break-word;
}

.page-reports .page-footer {
  margin-top: 8px;
}

/* 冷凍資訊頁 */
.module-bar-freeze {
  background: var(--blue);
  margin-top: 0;
}

.btn-freeze-load {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 28px);
  margin: 0 14px 16px;
  padding: 14px;
  border: none;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.freeze-results-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 10px;
}

.freeze-results-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.result-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: #1abc9c;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
}

.freeze-results {
  padding: 0 14px 20px;
}

.freeze-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--green);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.freeze-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.freeze-card-head h3 {
  margin: 0;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.freeze-count-badge {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: #ecf0f1;
  color: #5d6d7e;
  font-size: 0.82rem;
  font-weight: 600;
}

.freeze-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f4f6f8;
  border-left: 3px solid var(--blue);
}

.freeze-field-label {
  color: #7f8c8d;
  font-size: 0.9rem;
  font-weight: 600;
}

.freeze-field-value {
  font-size: 0.95rem;
  font-weight: 600;
  text-align: right;
}

.freeze-quality {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  background: #d6eaf8;
  color: var(--blue-dark);
}

.freeze-card-image {
  margin-top: 12px;
}

.page-freeze .page-footer {
  margin-top: 8px;
}

.report-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 14px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.report-title { font-weight: 600; }

.report-date { color: #7f8c8d; font-size: 0.9rem; }

.empty-msg.inline {
  padding: 8px 0;
  margin: 0;
  background: none;
}

.modal[hidden] { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.modal-panel {
  position: relative;
  width: min(100%, 520px);
  max-height: 90vh;
  background: #fff;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { margin: 0; font-size: 1rem; }

.modal-header button {
  border: none;
  background: none;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 12px 16px;
  overflow: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  text-align: right;
}

.btn-modal-close {
  padding: 10px 24px;
  border: none;
  border-radius: 6px;
  background: #5d6d7e;
  color: #fff;
  cursor: pointer;
}

.btn-modal-confirm {
  padding: 10px 24px;
  border: none;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
}

#phoneModalInput {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
}

.report-frame {
  width: 100%;
  min-height: 60vh;
  border: none;
}
