.profile-page .role-bar {
  justify-content: space-between;
}

.profile-card {
  max-width: none;
  width: 100%;
  margin: 0 0 24px;
  border-radius: 24px;
  padding: 22px 24px;
  box-sizing: border-box;
}

.profile-required-banner {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #fff8e6;
  border: 1px solid #f0d78c;
  color: #6b5a20;
  font-size: 0.88rem;
  line-height: 1.5;
}

.profile-required-banner-hint {
  font-size: 0.82rem;
  color: #7a6528;
}

.profile-required-mark {
  color: #c0392b;
}

.profile-field.field-error input,
.profile-field.field-error select,
.profile-field.field-error textarea,
.profile-audiogram-block.field-error input {
  border-color: #c96060;
}

.field-error-hint {
  margin-top: 4px;
  font-size: 0.75rem;
  color: #c0392b;
  line-height: 1.4;
  font-weight: normal;
}

.profile-hearing-panel {
  margin-left: -12px;
  margin-right: -12px;
  padding: 16px 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--primary-surface);
  border: 1px solid rgba(var(--primary-rgb), 0.14);
  border-bottom: 1px solid rgba(var(--primary-rgb), 0.14);
}

.profile-hearing-panel .profile-section-head {
  margin-bottom: 14px;
}

.profile-hearing-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px 14px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(var(--primary-rgb), 0.12);
}

.profile-hearing-actions .profile-msg {
  flex: 1 1 180px;
  margin: 0;
  text-align: left;
}

.profile-section {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.profile-hearing-panel.profile-section {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(var(--primary-rgb), 0.14);
}

.profile-section:last-of-type {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.profile-section h2 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--text);
}

.profile-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.profile-section-head h2 {
  margin: 0;
}

.profile-pt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.profile-pt-input-wrap {
  display: flex;
  align-items: stretch;
  max-width: 220px;
  flex: 1;
  min-width: 160px;
}

.profile-pt-input-wrap input[type="number"] {
  flex: 1;
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: 0;
}

.profile-pt-unit {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: #f5f5f2;
  color: #6b6b65;
  font-size: 0.82rem;
  white-space: nowrap;
}

.profile-pt-degree {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
}

.profile-pt-degree.is-empty {
  background: #f0f0ec;
  color: #8a8a82;
  font-weight: 400;
}

.profile-pt-valid-hint {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: #f8f8f5;
  border: 1px dashed #d8d8d0;
  color: #6b6b65;
  font-size: 0.8rem;
  white-space: nowrap;
}

.profile-pt-valid-hint.is-invalid {
  background: #fff5f5;
  border-color: #e8b4b0;
  color: #c0392b;
}

.profile-pt-input-wrap input[type="number"].is-invalid {
  border-color: #e8b4b0;
}

.profile-fitting-date-inline .profile-field {
  flex: 1;
  min-width: 88px;
  margin-bottom: 0;
}

.profile-audiogram-block {
  margin-top: 4px;
}

.profile-audiogram-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 640px) {
  .profile-audiogram-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.profile-audiogram-cell label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.78rem;
  color: var(--sub-text);
  font-weight: 600;
}

.profile-audiogram-cell input[type="number"] {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  background: var(--panel);
}

.profile-audiogram-cell input[type="number"].is-invalid {
  border-color: #e8b4b0;
}

.profile-audiogram-cell-hint {
  display: block;
  margin-top: 3px;
  font-size: 0.72rem;
  color: #8a8a82;
}

.profile-pt-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #f8f8f5;
  border: 1px dashed #d8d8d0;
}

.profile-pt-summary-label {
  font-size: 0.84rem;
  color: var(--sub-text);
}

.profile-pt-summary-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.hearing-history-ear-toggle {
  display: flex;
  justify-content: center;
  width: 100%;
  gap: 6px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: 999px;
  background: #f0f0ec;
}

.hearing-history-ear-btn {
  border: 0;
  background: transparent;
  color: #6b6b65;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
}

.hearing-history-ear-btn.is-active {
  background: var(--panel);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.hearing-history-chart-panel {
  margin: 0 auto 20px;
  max-width: 100%;
}

.hearing-history-chart-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.hearing-history-chart-row .hearing-history-chart-frame {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.hearing-degree-rail {
  flex: 0 0 78px;
  width: 78px;
  display: flex;
  flex-direction: column;
  padding: 44px 0 72px;
  box-sizing: border-box;
}

.hearing-degree-rail--large {
  flex: 0 0 92px;
  width: 92px;
  padding: 52px 0 88px;
}

.hearing-degree-rail-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #6b6b65;
  text-align: center;
  margin-bottom: 6px;
  line-height: 1.2;
}

.hearing-degree-rail-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.hearing-degree-rail-item {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 0;
  overflow: hidden;
}

.hearing-degree-rail-swatch {
  flex: 0 0 5px;
  width: 5px;
  align-self: stretch;
  border-radius: 2px;
  opacity: 0.55;
}

.hearing-degree-rail-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.15;
  min-width: 0;
}

.hearing-degree-rail-text strong {
  font-size: 0.68rem;
  font-weight: 700;
}

.hearing-degree-rail-text span {
  font-size: 0.62rem;
  opacity: 0.9;
}

.hearing-degree-rail--large .hearing-degree-rail-text strong {
  font-size: 0.76rem;
}

.hearing-degree-rail--large .hearing-degree-rail-text span {
  font-size: 0.68rem;
}

.hearing-history-chart-row--lightbox {
  gap: 10px;
}

.hearing-history-chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.hearing-history-expand-btn {
  padding: 5px 14px;
  font-size: 0.82rem;
  min-height: 34px;
}

.hearing-history-chart-toolbar-hint {
  font-size: 0.78rem;
  color: #8a8a82;
}

/* 隐形框：仅保留内边距与点击区域，无底色与描边 */
.hearing-history-chart-frame {
  box-sizing: border-box;
  margin: 0 auto;
  padding: 8px 0 4px;
  border: none;
  background: transparent;
  box-shadow: none;
  cursor: zoom-in;
  outline: none;
}

.hearing-history-chart-frame:focus-visible {
  outline: 2px solid var(--primary-soft);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.hearing-history-chart-hint {
  margin: 0 0 14px;
  text-align: center;
  font-size: 0.8rem;
  color: #8a8a82;
}

.hearing-history-chart-lightbox {
  position: fixed;
  inset: 0;
  z-index: 13000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.hearing-history-chart-lightbox.is-open {
  display: flex;
}

.hearing-history-chart-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 18, 0.55);
}

.hearing-history-chart-lightbox-card {
  position: relative;
  z-index: 1;
  width: min(960px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.hearing-history-chart-lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.hearing-history-chart-lightbox-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.hearing-history-chart-lightbox-body {
  padding: 16px 18px 20px;
  overflow: auto;
}

.hearing-history-chart-frame--lightbox {
  cursor: default;
  max-width: none;
  padding: 12px 0 8px;
}

.hearing-history-chart-large {
  width: 100%;
  height: min(72vh, 640px);
  min-height: 420px;
}

.hearing-history-table-hint {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: #8a8a82;
}

.hearing-history-table-limit-hint {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: #c0392b;
}

.hearing-history-select-th {
  width: 40px;
  min-width: 40px;
}

.hearing-history-select-cell {
  width: 40px;
  min-width: 40px;
  text-align: center;
  vertical-align: middle;
}

.hearing-history-select-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 0;
  cursor: pointer;
}

.hearing-history-select-label.is-disabled {
  cursor: not-allowed;
}

.hearing-history-select-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.hearing-history-select-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 2px solid #b8b8b0;
  border-radius: 50%;
  background: var(--panel);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.hearing-history-select-input:checked + .hearing-history-select-circle {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 4px var(--primary);
}

.hearing-history-select-input:disabled + .hearing-history-select-circle {
  border-color: #d8d8d0;
  background: #f0f0ec;
  opacity: 0.55;
}

.hearing-history-select-label.is-disabled .hearing-history-select-circle {
  border-color: #d8d8d0;
  background: #f0f0ec;
  opacity: 0.55;
}

.hearing-history-table tbody tr.is-compare-selected td {
  background: var(--primary-soft);
}

.hearing-history-table tbody tr.is-compare-disabled td {
  color: #a8a8a0;
}

.hearing-history-modal {
  width: min(980px, calc(100vw - 24px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
}

.hearing-history-modal .modal-body {
  overflow: auto;
}

.hearing-history-chart {
  width: 100%;
  height: 340px;
  min-height: 300px;
  overflow: visible;
}

.hearing-history-empty {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #f5f5f2;
  color: #6b6b65;
  font-size: 0.88rem;
}

.hearing-history-table-wrap {
  overflow-x: auto;
}

.hearing-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.hearing-history-table th,
.hearing-history-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.hearing-history-table th {
  color: var(--sub-text);
  font-weight: 600;
  background: #fafaf8;
}

.hearing-history-table tbody tr:last-child td {
  border-bottom: 0;
}

.profile-field {
  margin-bottom: 12px;
}

.profile-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--sub-text);
}

.profile-field input[type="text"],
.profile-field input[type="tel"],
.profile-field input[type="number"],
.profile-field select,
.profile-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--panel);
}

.profile-field input:read-only {
  background: #f5f5f2;
  color: #6b6b65;
}

.profile-field .field-hint {
  margin-top: 4px;
  font-size: 0.75rem;
  color: #8a8a82;
  line-height: 1.4;
}

.profile-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.profile-inline .profile-field {
  flex: 1;
  min-width: 120px;
}

.profile-radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-radio-group label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
}

.profile-radio-group input {
  margin-top: 3px;
}

.profile-subpanel {
  margin-top: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px dashed var(--border);
}

.profile-bilateral-row {
  margin-bottom: 16px;
}

.profile-bilateral-row:last-child {
  margin-bottom: 0;
}

.profile-ear-tag {
  display: block;
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-strong);
}

.profile-theme-accent {
  color: var(--primary-strong);
  font-weight: 600;
}

.profile-time-inline {
  align-items: flex-end;
}

.profile-time-inline .profile-field {
  flex: 1 1 0;
  min-width: 0;
  margin-bottom: 0;
}

.profile-duration-hint {
  margin-top: 6px;
  margin-bottom: 0;
}

.profile-duration-hint .field-hint {
  margin-top: 0;
}

.profile-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.profile-msg {
  margin-top: 10px;
  font-size: 0.85rem;
  min-height: 1.2em;
}

.profile-msg.error {
  color: #c0392b;
}

.profile-msg.ok {
  color: #2d7a4f;
}

.btn-profile-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: #546489;
  font-size: 0.82rem;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease;
}

.btn-profile-link:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.module-link.profile-locked {
  pointer-events: none;
  opacity: 0.45;
  cursor: not-allowed;
}

/* 康复师申请与下方表单卡片对齐、留出间隔 */
.profile-page .profile-therapist-section {
  width: 100%;
  margin-bottom: 16px;
  padding: 22px 24px;
  border-radius: 24px;
  border: 1px solid rgba(var(--primary-rgb), 0.16);
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(28, 42, 58, 0.05);
  box-sizing: border-box;
}

.profile-page .profile-therapist-section.profile-section {
  margin-bottom: 16px;
  padding-bottom: 22px;
  border-bottom: 0;
}

.profile-page .profile-training-report-section {
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.profile-page .profile-training-report-section .profile-section-head h2 {
  margin: 0;
}

.profile-page .profile-training-report-hint {
  margin: 0 0 14px;
  font-size: 0.82rem;
  color: var(--sub);
  line-height: 1.5;
}

/* 个人资料表单保持原始固定布局，不随全局字号缩放 */
.profile-page .profile-card {
  font-size: 16px;
}

.profile-page .profile-card .profile-required-banner {
  margin-bottom: 14px;
  padding: 12px 14px;
  font-size: 14.08px;
  line-height: 1.5;
}

.profile-page .profile-card .profile-section {
  margin-bottom: 22px;
  padding-bottom: 18px;
}

.profile-page .profile-card .profile-section h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

.profile-page .profile-card .profile-section-head h2 {
  margin: 0;
}

.profile-page .profile-card .profile-pt-unit {
  font-size: 13px;
}

.profile-page .profile-card .profile-pt-degree {
  font-size: 13.6px;
}

.profile-page .profile-card .profile-pt-valid-hint {
  font-size: 12.8px;
}

.profile-page .profile-card .profile-field {
  margin-bottom: 12px;
}

.profile-page .profile-card .profile-field label,
.profile-page .profile-card .profile-field .field-label {
  margin-bottom: 6px;
  font-size: 13.6px;
}

.profile-page .profile-card .profile-field input[type="text"],
.profile-page .profile-card .profile-field input[type="tel"],
.profile-page .profile-card .profile-field input[type="number"],
.profile-page .profile-card .profile-field select,
.profile-page .profile-card .profile-field textarea {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14.4px;
  line-height: 1.4;
}

.profile-page .profile-card .profile-field .field-hint {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.4;
}

.profile-page .profile-card .field-error-hint {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.4;
}

.profile-page .profile-card .profile-inline {
  gap: 12px;
}

.profile-page .profile-card .profile-inline .profile-field {
  min-width: 120px;
}

.profile-page .profile-card .profile-radio-group {
  gap: 8px;
}

.profile-page .profile-card .profile-radio-group label {
  gap: 8px;
  font-size: 14.08px;
}

.profile-page .profile-card .profile-radio-group input {
  margin-top: 3px;
}

.profile-page .profile-card .profile-subpanel {
  margin-top: 10px;
  padding: 12px;
}

.profile-page .profile-card .profile-actions {
  gap: 10px;
  margin-top: 18px;
}

.profile-page .profile-card .profile-msg {
  margin-top: 10px;
  font-size: 13.6px;
}

.profile-page .profile-card .profile-hearing-panel {
  margin-left: 0;
  margin-right: 0;
  padding: 16px 16px 18px;
  background: var(--primary-surface);
}

.profile-page .profile-card .profile-hearing-actions .btn-primary {
  min-width: 8.5rem;
}

.font-size-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.font-size-option {
  min-width: 4.5rem;
  min-height: 2.5rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: var(--fs-body-sm);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.font-size-option:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.font-size-option.is-active,
.font-size-option[aria-checked="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(var(--primary-rgb), 0.18);
}

.font-size-option:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.theme-color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.theme-color-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 2.5rem;
  padding: 0.45rem 0.85rem 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: var(--fs-body-sm);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.theme-color-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(var(--primary-shadow-rgb), 0.12);
  flex-shrink: 0;
}

.theme-color-option:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.theme-color-option.is-active,
.theme-color-option[aria-checked="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(var(--primary-rgb), 0.18);
}

.theme-color-option:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.theme-custom-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.theme-color-input {
  width: 52px;
  height: 40px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
}

.theme-color-hex {
  font-size: var(--fs-body-sm);
  font-weight: 600;
  color: var(--primary-muted);
  letter-spacing: 0.04em;
}

.theme-apply-custom {
  min-height: 2.5rem;
}
