/* App shell — header、主內容、footer、各頁 layout */
.phimr-app { min-height: 100vh; display: flex; flex-direction: column; }
.ph-header { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,0.9); backdrop-filter: blur(10px); border-bottom: 1px solid #DCE3E7; }
.ph-header-inner { max-width: 1360px; margin: 0 auto; padding: 12px 14px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.ph-brand { display: flex; align-items: center; gap: 12px; cursor: pointer; min-width: 0; text-decoration: none; color: inherit; }
.ph-brand-logo {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 50%; object-fit: cover;
  box-shadow: 0 4px 12px rgba(32, 129, 142, 0.22);
}
.ph-brand-copy {
  display: inline-flex; flex-direction: column; align-items: stretch;
  line-height: 1.15; min-width: 0;
}
.ph-brand-zh {
  font-family: "Chiron GoRound TC", sans-serif;
  font-weight: 700; font-size: 18px; color: #25313A;
  white-space: nowrap; width: max-content;
}
.ph-brand-en {
  font-size: 11.5px; font-weight: 500; color: #7C8891;
  letter-spacing: 0.045em; white-space: nowrap;
  width: 100%; text-align: justify; text-align-last: justify;
}
.ph-nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.ph-nav .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 18px;
  font-weight: 700;
  color: #7C8891;
  text-decoration: none;
  transition: all .15s;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
}
.ph-nav .nav-link:hover { color: #0072B2; }
.ph-nav .nav-link.active { background: #0072B2; color: #fff; }
/* 登出改為 POST 表單，外觀與其他選單連結相同 */
.ph-nav-logout { display: inline-flex; margin: 0; }
.ph-nav-dropdown {
  position: relative;
  display: inline-flex;
}
/* 填補按鈕與下拉選單間隙，避免滑鼠移動時選單消失 */
.ph-nav-dropdown::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 10px;
}
.ph-nav-caret {
  font-size: 14px;
  margin-left: 2px;
}
.ph-nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 168px;
  background: #fff;
  border: 1px solid #DCE3E7;
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 10px 28px rgba(37, 49, 58, 0.12);
  z-index: 50;
}
.ph-nav-dropdown.is-open .ph-nav-dropdown-menu,
.ph-nav-dropdown:hover .ph-nav-dropdown-menu {
  display: block;
}
.ph-nav-dropdown-item {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: #64717A;
  text-decoration: none;
  font-size: 16px;
  font-weight: 700;
}
.ph-nav-dropdown-item:hover,
.ph-nav-dropdown-item.is-current {
  background: #E3F0F8;
  color: #0072B2;
}
.ph-header-start { display: flex; align-items: center; gap: 14px; min-width: 0; flex-shrink: 0; }
.ph-header-end { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.ph-live-badge { display: flex; align-items: center; gap: 7px; padding: 5px 12px; background: #E4F1EC; border: 1px solid #BFDCD3; border-radius: 999px; flex-shrink: 0; }
.ph-live-dot { width: 7px; height: 7px; border-radius: 50%; background: #009E73; box-shadow: 0 0 0 3px rgba(62,142,110,0.18); }
.ph-live-text { font-size: 18px; color: #009E73; font-weight: 500; }
.ph-lang-btn { display: inline-flex; align-items: center; justify-content: center; border: 1px solid #DCE3E7; background: #F7FAFB; border-radius: 999px; width: 40px; height: 40px; padding: 0; font-size: 20px; color: #64717A; cursor: pointer; font-family: inherit; line-height: 1; }
.ph-lang-btn .ph-icon { font-size: 20px; }
.ph-lang-btn:hover { border-color: #0072B2; color: #0072B2; }
.ph-main { flex: 1; width: 100%; }
.ph-section { max-width: 1360px; margin: 0 auto; padding: 32px 14px 48px; }

/* Override DC runtime height:100% — sticky footer with header outside shell */
html, body { height: auto !important; min-height: 100%; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.ph-header { flex-shrink: 0; }
body > .ph-app-shell,
body > .phimr-app {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
}
#dc-root, #dc-root > .sc-host { height: auto !important; min-height: 0 !important; }
.phimr-app > .ph-app-shell,
.ph-app-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.ph-app-shell > .ph-main { flex: 1 0 auto; }
.ph-app-shell > .ph-footer { flex-shrink: 0; margin-top: auto; }

.ph-footer {
  border-top: 1px solid #DCE3E7;
  padding: 18px 14px;
  background: #F7FAFB;
  width: 100%;
  box-sizing: border-box;
}
.ph-footer-inner {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 18px;
  color: #7C8891;
}

.ph-breadcrumb { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 18px; color: #7C8891; margin-bottom: 18px; }
.ph-breadcrumb a { color: #0072B2; text-decoration: none; font-weight: 600; }
.ph-breadcrumb a:hover { text-decoration: underline; }
.ph-breadcrumb-sep { color: #B7C6CC; user-select: none; }
.ph-breadcrumb-current { color: #25313A; font-weight: 700; }
.ph-detail-from { font-size: 18px; color: #64717A; margin: -6px 0 20px; }

/* Detail page — tab panels & grids */
.ph-tab-panels { display: block; width: 100%; }
.ph-tab-panel { display: none !important; }
.ph-tab-panel.is-active { display: block !important; }
.ph-detail-age-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  width: 100%;
  min-width: 0;
}
.ph-detail-age-grid > * { min-width: 0; }
.ph-detail-calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
  width: 100%;
  min-width: 0;
}
.ph-detail-calc-grid > * { min-width: 0; }

/* Page hero — title + accent underline + soft gradient band */
.ph-page-hero {
  background: linear-gradient(135deg, #E3F0F8 0%, #E4F1EC 100%);
  border: 1px solid #CFE8F5;
  border-radius: 16px;
  padding: 16px 22px 18px;
  margin-bottom: 20px;
}
.ph-page-hero-title {
  font-family: "Chiron GoRound TC", sans-serif;
  font-size: clamp(28px, 3.6vw, 36px);
  font-weight: 700;
  margin: 0;
  color: #25313A;
  line-height: 1.2;
}
.ph-page-hero-title::after {
  content: "";
  display: block;
  width: 40px;
  height: 3px;
  margin-top: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #0072B2, #009E73);
}

/* Form cards — centered block only (title/lead stay left like other pages) */
.ph-form-lead {
  margin: 0 0 24px;
  font-size: 18px;
  line-height: 1.75;
  color: #64717A;
}
.ph-form-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  background: #FFFFFF;
  border: 1px solid #DCE3E7;
  border-radius: 18px;
  padding: 28px 32px;
  box-sizing: border-box;
}

/* Auth pages — title + fields in one centered panel */
.ph-auth-section {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 0;
  padding-top: 32px;
  padding-bottom: 48px;
}
.ph-form-card--auth {
  max-width: 480px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 36px 36px 32px;
  border-color: #CFE0E8;
  background:
    linear-gradient(180deg, #F4FAFD 0%, #FFFFFF 88px),
    #FFFFFF;
  box-shadow: 0 10px 28px rgba(37, 49, 58, 0.06);
}
.ph-form-card--auth.ph-form-card--wide {
  max-width: 520px;
}
.ph-form-card--auth.ph-form-card--register {
  max-width: 720px;
  padding: 28px 32px 26px;
}
.ph-auth-header {
  margin: 0 0 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #E6EEF2;
  text-align: center;
}
.ph-auth-title {
  font-family: "Chiron GoRound TC", sans-serif;
  font-size: clamp(26px, 3.2vw, 32px);
  font-weight: 700;
  margin: 0 0 8px;
  color: #25313A;
  line-height: 1.25;
}
.ph-auth-title::after {
  content: "";
  display: block;
  width: 36px;
  height: 3px;
  margin: 10px auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #0072B2, #009E73);
}
.ph-auth-lead {
  margin: 0 auto;
  max-width: 36em;
  font-size: 16px;
  line-height: 1.6;
  color: #64717A;
}
.ph-form-card--auth > .ph-form-alert {
  max-width: none;
  margin: 0 0 14px;
  text-align: center;
}
.ph-auth-fields--register {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
  row-gap: 0;
}
.ph-auth-field {
  min-width: 0;
}
.ph-auth-field--full {
  grid-column: 1 / -1;
}
.ph-auth-field .ph-field-label {
  margin-bottom: 6px;
}
.ph-auth-field .ph-field-input,
.ph-auth-field .ph-password-field {
  margin-bottom: 12px;
}
.ph-auth-field .ph-password-field .ph-field-input {
  margin-bottom: 0;
}
.ph-form-card--auth > .ph-field-hint,
.ph-form-card--register > .ph-field-hint {
  margin: 0 0 14px;
  text-align: center;
}
.ph-form-card--register > .ph-field-hint {
  grid-column: 1 / -1;
}
.ph-form-card--auth > .ph-btn-primary,
.ph-form-card--register > .ph-btn-primary {
  margin-top: 4px;
  width: 100%;
}
.ph-form-card--register > .ph-btn-primary,
.ph-form-card--register > .ph-form-footer {
  grid-column: 1 / -1;
}
.ph-form-card--auth > .ph-form-footer {
  margin: 12px 0 0;
  text-align: center;
}
.ph-form-card--auth:not(.ph-form-card--register) > .ph-field-label {
  margin-bottom: 6px;
}
.ph-form-card--auth:not(.ph-form-card--register) > .ph-field-input,
.ph-form-card--auth:not(.ph-form-card--register) > .ph-password-field {
  margin-bottom: 14px;
}
.ph-form-card--auth:not(.ph-form-card--register) > .ph-btn-primary {
  margin-top: 6px;
  width: 100%;
}
.ph-form-card--wide {
  max-width: 960px;
}
/* 左右兩欄：標籤左、輸入右，滿版展開 */
.ph-form-card--rows {
  display: grid;
  grid-template-columns: minmax(160px, 240px) minmax(0, 1fr);
  column-gap: 28px;
  row-gap: 18px;
  align-items: center;
}
.ph-form-card--rows > input[type="hidden"] {
  display: none;
}
.ph-form-card--rows > .ph-field-label {
  margin-bottom: 0;
}
.ph-form-card--rows > .ph-field-label:has(+ .ph-field-textarea) {
  align-self: start;
  padding-top: 10px;
}
.ph-form-card--rows > .ph-field-input,
.ph-form-card--rows > .ph-password-field {
  margin-bottom: 0;
}
.ph-form-card--rows > .ph-period-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 0;
}
.ph-period-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  color: #25313A;
  cursor: pointer;
}
.ph-period-option input {
  width: 16px;
  height: 16px;
  accent-color: #0072B2;
}
.ph-form-card--rows > .ph-field-hidden {
  display: none;
}
.ph-form-card--rows > .ph-field-hint {
  grid-column: 2;
  margin: -6px 0 0;
}
.ph-form-card--rows > .ph-btn-primary {
  grid-column: 2;
  justify-self: start;
  margin-top: 4px;
}
.ph-form-card--rows > .ph-btn-primary.ph-btn-primary--block {
  justify-self: stretch;
  width: 100%;
}
.ph-form-alert {
  max-width: 560px;
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 18px;
  line-height: 1.6;
}
.ph-form-alert--error {
  background: #FDECEC;
  border: 1px solid #F2C4C4;
  color: #A33B3B;
}
.ph-form-alert--ok {
  background: #E4F1EC;
  border: 1px solid #BFDCD3;
  color: #1F6B4A;
}
.ph-form-alert--warn {
  background: #FFF6E5;
  border: 1px solid #E8D4A8;
  color: #8A6D3B;
}
.ph-form-alert--hidden {
  display: none;
}
.ph-form-footer {
  grid-column: 2;
  margin: 4px 0 0;
  font-size: 16px;
  color: #64717A;
}
.ph-form-card--rows > .ph-form-footer {
  margin-top: 8px;
}

/* info.jsp — personal / organization blocks (side-by-side on wide screens) */
.ph-info-form {
  max-width: 1280px;
}
.ph-info-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: stretch;
}
.ph-info-block {
  margin: 0;
  height: 100%;
}
.ph-info-block__title {
  grid-column: 1 / -1;
  font-family: "Chiron GoRound TC", sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #25313A;
  margin: 0 0 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid #E6EEF2;
}
.ph-info-block__title::after {
  content: "";
  display: block;
  width: 32px;
  height: 3px;
  margin-top: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #0072B2, #009E73);
}
.ph-info-form > .ph-btn-primary {
  margin-top: 20px;
}
@media (min-width: 960px) {
  .ph-info-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
  }
}
@media (min-width: 960px) and (max-width: 1100px) {
  .ph-info-block.ph-form-card--rows {
    grid-template-columns: 1fr;
    row-gap: 14px;
  }
  .ph-info-block.ph-form-card--rows > .ph-field-label {
    margin-bottom: 4px;
  }
}

.ph-bureau-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 16px;
}
.ph-bureau-card {
  display: block;
  background: #FFFFFF;
  border: 1px solid #DCE3E7;
  border-radius: 16px;
  padding: 22px 20px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.ph-bureau-card:hover {
  border-color: #0072B2;
  box-shadow: 0 4px 16px rgba(0, 114, 178, 0.08);
}
.ph-bureau-card-title {
  font-family: "Chiron GoRound TC", sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #25313A;
  margin-bottom: 8px;
}
.ph-bureau-card-desc {
  font-size: 18px;
  line-height: 1.6;
  color: #64717A;
}
.ph-field-label {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: #25313A;
  margin-bottom: 8px;
}
.ph-field-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #DCE3E7;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 18px;
  font-family: inherit;
  margin-bottom: 16px;
}
.ph-field-input--disabled {
  background: #F7FAFB;
  color: #7C8891;
}
.ph-password-field {
  position: relative;
  margin-bottom: 16px;
}
.ph-password-field .ph-field-input {
  margin-bottom: 0;
  padding-right: 48px;
}
.ph-password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #7C8891;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.ph-password-toggle:hover {
  color: #0072B2;
  background: #F7FAFB;
}
.ph-password-toggle .ph-icon {
  font-size: 18px;
}
.ph-btn-primary {
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  font-size: 18px;
  font-weight: 700;
  font-family: inherit;
  background: #0072B2;
  color: #fff;
  cursor: pointer;
}
.ph-btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.ph-btn-secondary {
  display: inline-flex;
  align-items: center;
  border: 1px solid #DCE3E7;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 18px;
  font-weight: 700;
  font-family: inherit;
  background: #F7FAFB;
  color: #0072B2;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
}
.ph-btn-secondary:hover {
  background: #E3F0F8;
  border-color: #0072B2;
}
.ph-btn-link {
  display: inline-flex;
  align-items: center;
  font-size: 16px;
  font-weight: 700;
  color: #0072B2;
  text-decoration: none;
  padding: 8px 4px;
}
.ph-btn-link:hover { text-decoration: underline; }
button.ph-btn-link {
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
}
.ph-field-select {
  appearance: auto;
  background: #fff;
}
.ph-fhir-auth-basic,
.ph-fhir-auth-bearer {
  display: none;
}
.ph-fhir-actions {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}
.ph-fhir-meta {
  margin: 16px 0 0;
  font-size: 16px;
  color: #7C8891;
  line-height: 1.6;
}
.ph-fhir-docs {
  margin-top: 28px;
  padding: 24px 28px;
  background: #F7FAFB;
  border: 1px solid #DCE3E7;
  border-radius: 16px;
  max-width: 960px;
}
.ph-fhir-docs-title {
  font-family: "Chiron GoRound TC", sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #25313A;
  margin: 0 0 12px;
}
.ph-fhir-docs-list {
  margin: 0 0 12px;
  padding-left: 1.25em;
  font-size: 17px;
  line-height: 1.75;
  color: #64717A;
}
.ph-fhir-docs-note {
  margin: 0;
  font-size: 15px;
  color: #7C8891;
  line-height: 1.6;
}
.ph-fhir-docs-note code {
  font-size: 14px;
  background: #fff;
  border: 1px solid #DCE3E7;
  border-radius: 6px;
  padding: 2px 6px;
}
/* FHIR：固定的資源類型說明 */
.ph-fhir-fixed {
  margin: 0;
  align-self: center;
  font-size: 17px;
  color: #64717A;
  line-height: 1.6;
}
.ph-fhir-fixed code {
  font-size: 16px;
  font-weight: 700;
  color: #1C6EA4;
  background: #E9F5FC;
  border: 1px solid #CFE8F5;
  border-radius: 6px;
  padding: 2px 8px;
}
/* FHIR：轉換結果預覽 */
.ph-fhir-preview {
  margin-top: 28px;
  padding: 24px 28px;
  background: #fff;
  border: 1px solid #DCE3E7;
  border-radius: 16px;
  max-width: 960px;
}
.ph-fhir-preview-status {
  margin: 0 0 14px;
  font-size: 17px;
  line-height: 1.65;
  color: #64717A;
}
.ph-fhir-preview-status--ok {
  color: #1D6B4F;
}
.ph-fhir-preview-status--error {
  color: #B23B3B;
}
.ph-fhir-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.ph-fhir-preview-actions[hidden],
.ph-fhir-skipped[hidden],
.ph-fhir-json[hidden],
.ph-fhir-preview[hidden] {
  display: none;
}
.ph-fhir-skipped-title {
  font-size: 18px;
  font-weight: 700;
  color: #25313A;
  margin: 4px 0 10px;
}
.ph-fhir-table-wrap {
  overflow-x: auto;
  margin-bottom: 14px;
}
.ph-fhir-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 1.5;
}
.ph-fhir-table th,
.ph-fhir-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #E8EDF0;
  vertical-align: top;
}
.ph-fhir-table th {
  color: #7C8891;
  font-weight: 700;
  white-space: nowrap;
}
.ph-fhir-table td:last-child {
  color: #8A4B10;
}
@media (max-width: 640px) {
  .ph-fhir-preview {
    padding: 18px 16px;
  }
  /* 手機上把無法轉換的資料改成一筆一張卡片，原因整行顯示，不必橫向捲動 */
  .ph-fhir-table thead {
    display: none;
  }
  .ph-fhir-table,
  .ph-fhir-table tbody,
  .ph-fhir-table tr {
    display: block;
    width: 100%;
  }
  .ph-fhir-table tr {
    padding: 10px 0;
    border-bottom: 1px solid #E8EDF0;
  }
  .ph-fhir-table td {
    display: inline;
    border-bottom: none;
    padding: 0;
    margin-right: 10px;
    color: #25313A;
    font-weight: 700;
  }
  .ph-fhir-table td:last-child {
    display: block;
    margin: 4px 0 0;
    color: #8A4B10;
    font-weight: 400;
  }
}
.ph-fhir-json {
  margin: 0;
  max-height: 480px;
  overflow: auto;
  background: #1B2530;
  color: #D7E4EA;
  font-size: 14px;
  line-height: 1.55;
  border-radius: 12px;
  padding: 14px;
  font-family: "LXGW WenKai Mono TC", ui-monospace, monospace;
  white-space: pre;
}
.ph-field-textarea {
  resize: vertical;
  min-height: 160px;
  font-family: var(--ph-font);
  line-height: 1.55;
}
.ph-field-hint {
  margin: -8px 0 16px;
  font-size: 15px;
  color: #7C8891;
  line-height: 1.5;
}
.ph-upload-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
}
.ph-upload-tab {
  border: 1px solid #DCE3E7;
  background: #F7FAFB;
  color: #7C8891;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.ph-upload-tab.is-active {
  background: #0072B2;
  border-color: #0072B2;
  color: #fff;
}
.ph-upload-panel { display: none; }
.ph-upload-panel.is-active { display: block; }
.ph-empty-card {
  background: #FFFFFF;
  border: 1px dashed #DCE3E7;
  border-radius: 16px;
  padding: 28px;
  color: #7C8891;
  font-size: 18px;
  line-height: 1.7;
}
.ph-subhead {
  font-size: 18px;
  font-weight: 700;
  color: #25313A;
  margin: 32px 0 12px;
}
.ph-table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid #DCE3E7;
  border-radius: 16px;
}
.ph-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}
.ph-table th,
.ph-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid #E8EEF1;
  vertical-align: top;
}
.ph-table th {
  background: #F7FAFB;
  color: #25313A;
  font-weight: 700;
  white-space: nowrap;
}
.ph-table tr:last-child td { border-bottom: none; }
.ph-table-detail {
  max-width: 360px;
  word-break: break-word;
  color: #64717A;
}
.ph-mode-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  background: #F7FAFB;
  color: #64717A;
}
.ph-mode-pill--single { background: #E3F0F8; color: #0072B2; }
.ph-mode-pill--file,
.ph-mode-pill--excel { background: #E4F1EC; color: #009E73; }
.ph-mode-pill--json { background: #F2ECE0; color: #8A6D3B; }
.ph-mode-pill--fhir { background: #EDE7F6; color: #5E35B1; }
.ph-map-preview {
  margin-top: 24px;
  max-width: 960px;
}
.ph-map-preview th,
.ph-map-preview td {
  font-size: 14px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ph-preview-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin: 8px 0 20px;
}
.ph-preview-actions form {
  margin: 0;
}
.ph-preview-table-wrap {
  max-height: min(70vh, 640px);
  overflow: auto;
}
.ph-cell-warn {
  color: #A33B3B;
  font-weight: 700;
}

/* About page */
.ph-about {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}
.ph-about-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 900px) {
  .ph-about-row {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }
}
.ph-about-card {
  background: #FFFFFF;
  border: 1px solid #DCE3E7;
  border-radius: 18px;
  padding: 26px 28px;
  min-width: 0;
}
.ph-about-card--wide { width: 100%; }
.ph-about-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.ph-about-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ph-about-icon .fi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 22px;
  line-height: 1;
  color: inherit;
}
.ph-about-icon .fi::before {
  color: inherit;
  font-size: 22px;
  line-height: 1;
}
.ph-about-icon--team { background: #E3F0F8; color: #0072B2; }
.ph-about-icon--background { background: #E4F1EC; color: #009E73; }
.ph-about-icon--goals { background: #E8F4FC; color: #0072B2; }
.ph-about-card-head h2 {
  font-family: "Chiron GoRound TC", sans-serif;
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  color: #25313A;
  line-height: 1.3;
}
.ph-about-card p {
  font-size: 18px;
  line-height: 1.85;
  color: #64717A;
  margin: 0 0 14px;
}
.ph-about-card p:last-child { margin-bottom: 0; }
.ph-about-goals-intro { margin-bottom: 20px !important; }
.ph-about-goals {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 900px) {
  .ph-about-goals {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
}
.ph-about-goals li {
  background: #F7FAFB;
  border: 1px solid #E6EEF2;
  border-left: 4px solid #0072B2;
  border-radius: 0 14px 14px 0;
  padding: 18px 20px;
  font-size: 17px;
  line-height: 1.75;
  color: #64717A;
  min-width: 0;
}
.ph-about-goals li:nth-child(2) { border-left-color: #009E73; }
.ph-about-goals li:nth-child(3) { border-left-color: #56B4E9; }
.ph-about-goals strong {
  display: block;
  font-family: "Chiron GoRound TC", sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #25313A;
  margin-bottom: 8px;
}
.ph-about-closing {
  background: linear-gradient(135deg, #E3F0F8 0%, #E4F1EC 100%);
  border: 1px solid #CFE8F5;
  border-radius: 18px;
  padding: 26px 28px;
}
.ph-about-closing p {
  margin: 0;
  font-size: 18px;
  line-height: 1.85;
  color: #3A5566;
}

/* Error page */
.ph-error-section {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
}
.ph-error-panel {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
  background: #FFFFFF;
  border: 1px solid #DCE3E7;
  border-radius: 20px;
  padding: 48px 32px;
  box-shadow: 0 1px 0 rgba(37,49,58,0.03);
}
.ph-error-code {
  font-family: "Chiron GoRound TC", sans-serif;
  font-size: 72px;
  font-weight: 700;
  line-height: 1;
  color: #0072B2;
  margin-bottom: 12px;
}
.ph-error-title {
  font-family: "Chiron GoRound TC", sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: #25313A;
  margin: 0 0 12px;
}
.ph-error-lead {
  font-size: 18px;
  line-height: 1.75;
  color: #64717A;
  margin: 0 0 24px;
}
.ph-error-cta {
  display: inline-block;
  border: 1px solid #DCE3E7;
  background: #F7FAFB;
  border-radius: 12px;
  padding: 10px 22px;
  font-size: 18px;
  font-weight: 700;
  color: #0072B2;
  text-decoration: none;
  transition: all .15s;
}
.ph-error-cta:hover {
  background: #0072B2;
  border-color: #0072B2;
  color: #fff;
}

/* Responsive layout */
:root {
  --ph-text: 18px;
  --ph-gutter: 12px;
  --ph-gutter-md: 16px;
  --ph-gutter-lg: 20px;
  --ph-max-w: min(1360px, 100%);
  --ph-section-pt: 28px;
  --ph-section-pb: 48px;
}
.phimr-app,
.phimr-app > div,
.phimr-app main {
  max-width: 100%;
  overflow-x: clip;
}
.phimr-app [data-screen-label],
.ph-header-inner,
.ph-footer-inner {
  max-width: var(--ph-max-w) !important;
  width: 100%;
  padding-left: var(--ph-gutter) !important;
  padding-right: var(--ph-gutter) !important;
}
.phimr-app [data-screen-label="Dashboard"],
.phimr-app [data-screen-label="Indicator Detail"],
.phimr-app [data-screen-label="AI Explainer"] {
  padding-top: var(--ph-section-pt) !important;
  padding-bottom: var(--ph-section-pb) !important;
}
.phimr-app [data-screen-label="Dashboard"] > div[style*="grid-template-columns"] {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)) !important;
  width: 100%;
  min-width: 0;
}
.phimr-app [data-screen-label="Dashboard"] > div[style*="grid-template-columns"] > * {
  min-width: 0;
}
.phimr-app [data-screen-label="Dashboard"] > div[style*="grid-template-columns"] > * > div:first-child {
  flex-wrap: wrap !important;
  row-gap: 8px;
}
.phimr-app [data-screen-label="Dashboard"] > div[style*="grid-template-columns"] [style*="white-space: nowrap"] {
  white-space: normal !important;
}
.phimr-app [data-screen-label="AI Explainer"] > div[style*="grid-template-columns: 260px"] {
  grid-template-columns: 1fr !important;
}
.ph-chart-panel,
.ph-chart-host {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.ph-chart-panel { overflow: hidden; margin-bottom: 8px; }
.ph-chart-host { overflow: hidden; position: relative; }
.phimr-app [data-ph] {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.phimr-app [data-ph="home-trend"],
.phimr-app [data-ph="detail-trend"] {
  width: 100% !important;
  max-width: 100%;
  height: clamp(260px, 42vw, 380px) !important;
}
.phimr-app [data-ph="pyramid"],
.phimr-app [data-ph="before"] {
  width: 100% !important;
  max-width: 100%;
  height: clamp(280px, 45vw, 400px) !important;
}
.phimr-app sc-raw-table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
}

@media (min-width: 768px) {
  :root {
    --ph-gutter: var(--ph-gutter-md);
    --ph-section-pt: 32px;
    --ph-section-pb: 56px;
  }
  .ph-detail-calc-grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  }
}

@media (min-width: 1024px) {
  :root {
    --ph-gutter: var(--ph-gutter-lg);
    --ph-section-pt: 36px;
    --ph-section-pb: 64px;
  }
  .phimr-app [data-screen-label="AI Explainer"] > div[style*="grid-template-columns: 260px"] {
    grid-template-columns: 260px minmax(0, 1fr) !important;
  }
}

@media (min-width: 1280px) {
  :root { --ph-max-w: min(1400px, calc(100% - 40px)); }
}

@media (max-width: 767px) {
  .ph-header-inner { gap: 12px !important; }
  .ph-header-end {
    width: 100%;
    margin-left: 0 !important;
    justify-content: flex-end;
  }
  .ph-header-start { flex-wrap: wrap; }
  .phimr-app [data-screen-label="Dashboard"] h1,
  .phimr-app [data-screen-label="Indicator Detail"] h1 {
    font-size: 22px !important;
  }
  .phimr-app [data-screen-label="Dashboard"] > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  .ph-brand-logo { width: 38px; height: 38px; }
  .ph-brand-zh { font-size: 15px; }
  .ph-brand-en { font-size: 9.5px; letter-spacing: 0.035em; }
  .ph-auth-section {
    min-height: 0;
    padding-top: 24px;
    padding-bottom: 40px;
  }
  .ph-form-card--auth {
    padding: 28px 22px 24px;
  }
  .ph-auth-fields--register {
    grid-template-columns: 1fr;
  }
  .ph-form-card--rows {
    grid-template-columns: 1fr;
    row-gap: 8px;
  }
  .ph-form-card--rows > .ph-field-label:has(+ .ph-field-textarea) {
    padding-top: 0;
  }
  .ph-form-card--rows > .ph-field-hint,
  .ph-form-card--rows > .ph-btn-primary,
  .ph-form-card--rows > .ph-fhir-actions,
  .ph-form-card--rows > .ph-form-footer {
    grid-column: 1;
  }
}

/* 意見回饋表單 */
.ph-feedback-form { display: flex; flex-direction: column; gap: 8px; }
.ph-feedback-form .ph-field-input { margin-bottom: 8px; }
.ph-feedback-form .ph-btn-primary { align-self: flex-start; }
/* 防機器人的隱藏欄位：真人看不到也不會用 Tab 進入 */
.ph-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------------------------------------------------------------- 主選單（精簡版＋窄螢幕漢堡選單） */
.ph-nav { flex-wrap: nowrap; }
.ph-nav .nav-link { white-space: nowrap; }
.ph-nav-dropdown-menu--end { left: auto; right: 0; }
/* 登出在「帳號」下拉選單裡，外觀與其他選項一致 */
.ph-nav-dropdown-menu .ph-nav-logout { display: block; }
button.ph-nav-dropdown-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  line-height: inherit;
}
.ph-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid #DCE3E7;
  border-radius: 999px;
  background: #F7FAFB;
  color: #64717A;
  font-size: 18px;
  cursor: pointer;
}
.ph-menu-toggle:hover,
.ph-menu-toggle[aria-expanded="true"] { border-color: #0072B2; color: #0072B2; }
.ph-menu-toggle:focus-visible,
.ph-lang-btn:focus-visible,
.ph-nav .nav-link:focus-visible,
.ph-nav-dropdown-item:focus-visible { outline: 2px solid #0072B2; outline-offset: 2px; }

@media (max-width: 899px) {
  .ph-header-inner { flex-wrap: wrap; }
  .ph-header-end { width: auto !important; margin-left: auto !important; flex-wrap: nowrap; order: 2; }
  .ph-header-start { flex: 1 1 auto; flex-wrap: nowrap; min-width: 0; }
  .ph-live-badge { display: none; }
  .ph-menu-toggle { display: inline-flex; }
  .ph-nav {
    display: none;
    order: 3;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px 14px 14px;
    background: #FFFFFF;
    border-bottom: 1px solid #DCE3E7;
    box-shadow: 0 10px 24px rgba(37, 49, 58, 0.10);
  }
  .ph-nav.is-open { display: flex; }
  .ph-nav .nav-link { justify-content: flex-start; border-radius: 12px; padding: 10px 14px; }
  /* 窄螢幕：下拉選單直接展開成縮排清單，標題不可點 */
  .ph-nav-dropdown { display: block; }
  .ph-nav-dropdown::after { display: none; }
  .ph-nav-dropdown-toggle { pointer-events: none; color: #25313A !important; background: transparent !important; }
  .ph-nav-caret { display: none; }
  .ph-nav-dropdown-menu,
  .ph-nav-dropdown:hover .ph-nav-dropdown-menu {
    display: block;
    position: static;
    min-width: 0;
    padding: 0 0 4px 14px;
    border: none;
    box-shadow: none;
    background: transparent;
  }
}

/* ---------------------------------------------------------------- 頁尾連結（平台簡介、相關連結） */
.ph-footer-links {
  max-width: 1360px;
  margin: 0 auto 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 56px;
  padding-bottom: 14px;
  border-bottom: 1px solid #E8ECEE;
}
.ph-footer-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ph-footer-heading { font-size: 15px; font-weight: 700; color: #25313A; margin-bottom: 2px; }
.ph-footer-col a { font-size: 15px; color: #64717A; text-decoration: none; }
.ph-footer-col a:hover { color: #0072B2; text-decoration: underline; }
.ph-footer-col a:focus-visible { outline: 2px solid #0072B2; outline-offset: 2px; border-radius: 2px; }
@media (min-width: 640px) {
  .ph-footer-col:nth-child(2) { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; }
  .ph-footer-col:nth-child(2) .ph-footer-heading { flex-basis: 100%; }
}
@media (max-width: 899px) {
  /* 品牌與選單按鈕維持同一列：品牌文字可縮、英文名稱過長時省略 */
  .ph-header-inner { flex-wrap: nowrap; }
  .ph-header-start { flex: 1 1 0; }
  .ph-brand, .ph-brand-copy { min-width: 0; }
  .ph-brand-zh, .ph-brand-en { overflow: hidden; text-overflow: ellipsis; }
  .ph-header-end { flex-shrink: 0; }
}

/* ---------------------------------------------------------------- 頁面標題（精簡版：取代原本的漸層大方塊） */
.ph-section { padding-top: 20px; }
.ph-page-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  background: none;
  border: none;
  border-bottom: 1px solid #E8ECEE;
  border-radius: 0;
  padding: 0 0 12px;
  margin-bottom: 16px;
}
.ph-page-hero-title {
  font-size: clamp(22px, 2.4vw, 28px);
  display: flex;
  align-items: center;
  gap: 10px;
}
.ph-page-hero-title::after { display: none; }
.ph-page-hero-title::before {
  content: "";
  flex: 0 0 auto;
  width: 4px;
  height: 0.9em;
  border-radius: 999px;
  background: linear-gradient(180deg, #0072B2, #009E73);
}
.ph-breadcrumb + .ph-page-hero { margin-top: 4px; }

/* ---------------------------------------------------------------- 基本資料修改（分頁版） */
.ph-info-card { max-width: 720px; margin: 0; }
.ph-info-card.ph-form-card--rows { grid-template-columns: minmax(120px, 160px) minmax(0, 1fr); }
.ph-info-actions,
.ph-info-card > .ph-info-hint { grid-column: 1 / -1; }
.ph-info-actions { display: flex; justify-content: flex-end; padding-top: 4px; }
.ph-info-hint { font-size: 15px; color: #7C8891; line-height: 1.6; margin: 0; }
.ph-info-panel > .ph-info-hint { margin-top: 12px; max-width: 720px; }
.ph-info-panel > .ph-form-alert { max-width: 720px; }
.ph-info-dl { display: grid; grid-template-columns: minmax(120px, 160px) minmax(0, 1fr); gap: 14px 28px; }
.ph-info-dl dt { font-size: 16px; font-weight: 700; color: #64717A; }
.ph-info-dl dd { margin: 0; font-size: 17px; color: #25313A; overflow-wrap: anywhere; }
@media (max-width: 599px) {
  .ph-info-card.ph-form-card--rows,
  .ph-info-dl { grid-template-columns: 1fr; row-gap: 6px; }
  .ph-info-dl dd { margin-bottom: 10px; }
  .ph-info-card.ph-form-card--rows > .ph-field-input,
  .ph-info-card.ph-form-card--rows > .ph-password-field { margin-bottom: 10px; }
  .ph-info-actions .ph-btn-primary { width: 100%; }
}

/* ---------------------------------------------------------------- 意見回饋：我的意見與平台回覆 */
.ph-fb-mine-title { margin-top: 40px; }
.ph-fb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; max-width: 960px; }
.ph-fb-item { background: #FFFFFF; border: 1px solid #DCE3E7; border-radius: 16px; padding: 16px 20px; }
.ph-fb-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; color: #7C8891; margin-bottom: 8px; }
.ph-fb-badge { font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: #FDF3E1; color: #A86A00; white-space: nowrap; }
.ph-fb-badge--ok { background: #E4F1EC; color: #00795A; }
.ph-fb-text { white-space: pre-wrap; word-break: break-word; font-size: 16px; line-height: 1.7; color: #25313A; }
.ph-fb-reply { margin-top: 12px; padding: 10px 14px; border-left: 3px solid #009E73; background: #F2F8F5; border-radius: 0 12px 12px 0; }
.ph-fb-reply-head { font-size: 14px; font-weight: 700; color: #3E7F66; margin-bottom: 4px; }
/* 表單與下方「我的意見回饋」同寬、靠左對齊 */
.ph-feedback-form.ph-form-card { margin: 0; max-width: 960px; }

/* ---------------------------------------------------------------- 右上角：目前登入者與機構 */
.ph-nav .ph-user-chip { gap: 8px; padding: 4px 10px 4px 4px; border: 1px solid #DCE3E7; background: #F7FAFB; }
.ph-nav .ph-user-chip:hover { border-color: #0072B2; }
.ph-nav .ph-user-chip.active { background: #E3F0F8; color: #0072B2; border-color: #0072B2; }
.ph-user-avatar {
  flex: 0 0 auto;
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0072B2, #009E73); color: #FFFFFF;
  font-size: 15px; font-weight: 700; line-height: 1;
}
.ph-user-text { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; text-align: left; line-height: 1.2; }
.ph-user-name { font-size: 15px; font-weight: 700; color: #25313A; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-user-org { font-size: 12px; font-weight: 500; color: #7C8891; max-width: 11em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-user-card { padding: 8px 12px 10px; margin-bottom: 6px; border-bottom: 1px solid #E8ECEE; min-width: 200px; }
.ph-user-card-name { font-size: 16px; font-weight: 700; color: #25313A; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ph-user-card-org { font-size: 14px; color: #445059; margin-top: 2px; }
.ph-user-card-email { font-size: 13px; color: #7C8891; margin-top: 2px; overflow-wrap: anywhere; }
.ph-user-role { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: #E3F0F8; color: #0072B2; }

@media (max-width: 899px) {
  /* 漢堡選單裡：登入者資訊放最上面，不需要按鈕外框 */
  .ph-nav .ph-user-chip { border: none; background: transparent !important; padding: 6px 4px; }
  .ph-user-name, .ph-user-org { max-width: none; }
  .ph-user-card { display: none; }
}
@media (max-width: 899px) {
  .ph-nav-dropdown--account { order: -1; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid #E8ECEE; }
}
