/* index.html */
:root {
      --bg: #f7f9fb;
      --fg: #0f172a;
      --muted: #64748b;
      --brand: #6aa6a6;
      --brand-2: #a9d2d2;
      --card: #ffffff;
      --ring: rgba(106, 166, 166, .35);
      --maxw: 1100px;
      --radius: 18px;
      --radius-sm: 14px;
      --shadow: 0 20px 50px -25px rgba(15, 23, 42, .25);
      --header-h: 64px;
      --anchor-gap: 4px;
    }

    * {
      box-sizing: border-box
    }

    html {
      scroll-behavior: smooth;
      scroll-padding-top: 0;
      overflow-y: scroll;
    }

    body {
      margin: 0;
      font-family: "Noto Sans TC", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Microsoft JhengHei", sans-serif;
      color: var(--fg);
      background: var(--bg)
    }

    a {
      color: inherit;
      text-decoration: none
    }

    img {
      max-width: 100%;
      display: block
    }

    .container {
      max-width: var(--maxw);
      margin: 0 auto;
      padding: 0 20px
    }

    /* Header */
    header {
      position: sticky;
      top: 0;
      z-index: 40;
      background: rgba(247, 249, 251, .72);
      backdrop-filter: saturate(160%) blur(14px);
      border-bottom: 1px solid rgba(15, 23, 42, .06)
    }

    .nav {
      display: flex;
      align-items: center;
      justify-content: space-between;
      height: 64px
    }

    .brand {
      display: flex;
      gap: 12px;
      align-items: center
    }

    .logo {
      width: 40px;
      height: 40px;
      border-radius: 12px;
      background: linear-gradient(135deg, var(--brand), var(--brand-2));
      display: flex;
      align-items: center;
      justify-content: center;
      color: #fff;
      font-weight: 800;
      font-size: 18px;
      letter-spacing: 0;
      position: relative;
      top: 1px
    }

    .brand h1 {
      font-size: 18px;
      margin: 0;
      font-weight: 700
    }

    .nav-links {
      display: flex;
      gap: 22px
    }

    .nav-links a {
      padding: 10px 12px;
      border-radius: 10px;
      font-weight: 500
    }

    .nav-links a:hover {
      background: rgba(15, 23, 42, .06)
    }

    .nav-cta {
      display: flex;
      gap: 12px;
      align-items: center
    }

    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 10px 18px;
      border-radius: 999px;
      font-weight: 700;
      border: 1px solid transparent;
      cursor: pointer;
      transition: transform .08s ease, box-shadow .2s ease, filter .2s ease
    }

    .btn-primary {
      background: var(--brand);
      color: white;
      box-shadow: 0 12px 30px -18px var(--ring)
    }

    .btn-primary:hover {
      filter: brightness(.98)
    }

    .btn-primary:active {
      transform: translateY(1px)
    }

    .btn-ghost {
      border-color: rgba(15, 23, 42, .12);
      background: rgba(255, 255, 255, .7)
    }

    .btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
      filter: grayscale(50%);
    }

    .hamburger {
      display: none;
      border: none;
      background: transparent;
      font-size: 28px;
      line-height: 1;
      padding: 6px 10px;
      border-radius: 10px
    }

    .hamburger:focus {
      outline: 2px solid var(--brand)
    }

    @media (max-width:900px) {
      .nav-links {
        display: none
      }

      .hamburger {
        display: block
      }
    }

    /* Hero & General Layout */
    .hero {
      position: relative;
      overflow: hidden
    }

    .hero .container {
      display: grid;
      grid-template-columns: 1.15fr .85fr;
      gap: 48px;
      align-items: center;
      padding: 50px 20px
    }

    .tag {
      display: inline-block;
      background: rgba(106, 166, 166, .14);
      color: #0f766e;
      padding: 7px 12px;
      border-radius: 999px;
      font-size: 12px;
      font-weight: 800;
      letter-spacing: .06em
    }

    .hero h2 {
      font-size: 44px;
      line-height: 1.18;
      margin: 16px 0
    }

    .hero p {
      color: var(--muted);
      font-size: 18px
    }

    .hero-actions {
      display: flex;
      gap: 12px;
      margin-top: 22px;
      flex-wrap: wrap
    }

    .hero-card {
      background: var(--card);
      border: 1px solid rgba(15, 23, 42, .06);
      border-radius: var(--radius);
      padding: 20px;
      box-shadow: var(--shadow)
    }

    .hero-illus {
      position: relative
    }

    .blob {
      position: absolute;
      inset: auto -35% -45% auto;
      width: 120%;
      height: 120%;
      background: radial-gradient(600px 420px at 60% 15%, rgba(106, 166, 166, .28), transparent 60%), radial-gradient(600px 420px at 25% 85%, rgba(169, 210, 210, .22), transparent 60%)
    }

    .photo {
      border-radius: 22px;
      aspect-ratio: 4/5;
      background: linear-gradient(180deg, #cfe7e7, #eef5f5);
      display: grid;
      place-items: center;
      overflow: hidden
    }

    .photo-img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block
    }

    @media (max-width:900px) {
      .hero .container {
        grid-template-columns: 1fr;
        gap: 28px;
        padding: 36px 20px
      }

      .hero h2 {
        font-size: 34px
      }
    }

    /* 招募者文宣 Modal */
    .global-rec-overlay {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      width: 100vw;
      height: 100vh;
      background-color: rgba(0, 0, 0, 0.6);
      backdrop-filter: blur(3px);
      z-index: 9999;
      justify-content: center;
      align-items: center;
    }

    .global-rec-container {
      position: relative;
      background-color: #fff;
      width: 90%;
      max-width: 700px;
      max-height: 85vh;
      border-radius: 12px;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
      display: flex;
      flex-direction: column;
      animation: recSlideIn 0.4s ease-out;
    }

    .global-rec-header {
      padding: 20px 25px;
      border-bottom: 1px solid #eee;
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: #fff;
      border-top-left-radius: 12px;
      border-top-right-radius: 12px;
      flex-shrink: 0;
    }

    .global-rec-header h3 {
      margin: 0;
      font-size: 1.3rem;
      color: #2c3e50;
      font-weight: bold;
    }

    .global-rec-close-x {
      color: #999;
      font-size: 36px;
      font-weight: bold;
      cursor: pointer !important;
      line-height: 1;
      padding: 0 15px;
      transition: color 0.2s;
      z-index: 10000;
      pointer-events: auto;
    }

    .global-rec-close-x:hover {
      color: #333;
    }

    .global-rec-body {
      padding: 20px 30px;
      overflow-y: auto;
      font-size: 1rem;
      line-height: 1.6;
      color: #444;
      text-align: justify;
    }

    .global-rec-body h4 {
      margin-top: 20px;
      margin-bottom: 10px;
      color: #2c3e50;
      border-left: 4px solid #aebcb9;
      padding-left: 10px;
    }

    .global-rec-body ul,
    .global-rec-body ol {
      padding-left: 20px;
      margin-bottom: 15px;
    }

    .global-rec-footer {
      padding: 15px 25px;
      border-top: 1px solid #eee;
      background-color: #f8f9fa;
      border-bottom-left-radius: 12px;
      border-bottom-right-radius: 12px;
      text-align: center;
      flex-shrink: 0;
    }

    .global-rec-agree-btn {
      background-color: #8fa09d;
      color: white;
      padding: 12px 40px;
      border: none;
      border-radius: 30px;
      cursor: pointer !important;
      font-size: 1rem;
      font-weight: bold;
      transition: background 0.3s;
      pointer-events: auto;
    }

    .global-rec-agree-btn:hover {
      background-color: #728280;
    }

    @keyframes recSlideIn {
      from {
        opacity: 0;
        transform: translateY(-20px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    /* Section / FAQ / Card 等 */
    section {
      padding: 40px 0
    }

    #services {
      padding-bottom: 36px;
    }

    #faq {
      padding-top: 12px;
    }

    .section-head {
      display: flex;
      align-items: end;
      justify-content: space-between;
      gap: 20px;
      margin-bottom: 28px
    }

    .section-head h3 {
      font-size: 28px;
      margin: 0
    }

    .muted {
      color: var(--muted)
    }

    .cards {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 20px
    }

    .card {
      background: var(--card);
      border: 1px solid rgba(15, 23, 42, .06);
      border-radius: var(--radius);
      padding: 22px;
      box-shadow: 0 16px 40px -28px rgba(15, 23, 42, .35)
    }

    .card .icon {
      width: 46px;
      height: 46px;
      border-radius: 14px;
      display: grid;
      align-content: center;
      justify-content: center;
      padding-bottom: 3px;
      box-sizing: border-box;
      background: rgba(106, 166, 166, .12);
      color: #0f766e;
      font-size: 20px
    }

    .card p {
      color: var(--muted);
      margin: 0
    }

    .card ul {
      margin: 8px 0 0 12px;
      padding-left: 16px;
      color: var(--muted)
    }

    @media (max-width:900px) {
      .cards {
        grid-template-columns: 1fr
      }
    }

    .faq {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px
    }

    details {
      background: var(--card);
      border: 1px solid rgba(15, 23, 42, .06);
      border-radius: var(--radius-sm);
      padding: 16px;
      transition: box-shadow .25s ease, border-color .25s ease
    }

    summary {
      font-weight: 700;
      cursor: pointer;
      list-style: none;
      display: flex;
      align-items: center;
      gap: 10px
    }

    summary::-webkit-details-marker {
      display: none
    }

    .caret {
      flex: 0 0 auto;
      transition: transform .25s ease
    }

    details[open] {
      box-shadow: 0 18px 50px -30px rgba(15, 23, 42, .35);
      border-color: rgba(106, 166, 166, .35)
    }

    details[open] .caret {
      transform: rotate(90deg)
    }

    details p {
      color: var(--muted);
      margin: 10px 0 0
    }

    @media (max-width:900px) {
      .faq {
        grid-template-columns: 1fr
      }
    }

    .faq-deep-link {
      text-decoration: none;
      color: inherit;
    }

    .faq-deep-link:hover {
      text-decoration: underline;
      color: var(--brand);
    }

    #faq::before,
    #services::before,
    #approach::before,
    #about::before,
    #testimonials::before {
      content: "";
      display: block;
      height: calc(var(--header-h) + var(--anchor-gap));
      margin-top: calc(-1 * (var(--header-h) + var(--anchor-gap)));
      visibility: hidden;
      pointer-events: none;
    }

    /* Form */
    form {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 14px
    }

    label {
      font-size: 14px;
      color: var(--muted)
    }

    input,
    textarea,
    select {
      width: 100%;
      padding: 12px;
      border-radius: 12px;
      border: 1px solid rgba(15, 23, 42, .15);
      background: white
    }

    textarea {
      min-height: 120px;
      resize: vertical
    }

    .col-span-2 {
      grid-column: span 2
    }

    .notice {
      font-size: 13px;
      color: var(--muted)
    }

    .required {
      color: #be123c;
      font-weight: 700;
      font-size: 14px
    }

    .radio-group {
      display: grid;
      gap: 8px
    }

    .radio-group.columns-2 {
      grid-template-columns: 1fr 1fr
    }

    .radio-group label {
      display: flex;
      align-items: center;
      gap: 8px;
      line-height: 1.4;
      padding: 6px 8px;
      border-radius: 8px;
      cursor: pointer
    }

    .radio-group input[type="radio"],
    .radio-group input[type="checkbox"] {
      flex: 0 0 auto;
      width: 16px;
      height: 16px;
      margin: 0;
      vertical-align: middle;
      accent-color: var(--brand)
    }

    fieldset {
      border: 1px solid rgba(15, 23, 42, .08);
      border-radius: 12px;
      padding: 12px
    }

    fieldset legend {
      padding: 0 6px;
      font-weight: 700;
      color: var(--fg);
      font-size: 14px
    }

    @media (max-width:700px) {
      form {
        grid-template-columns: 1fr
      }

      .col-span-2 {
        grid-column: auto
      }

      .radio-group.columns-2 {
        grid-template-columns: 1fr
      }
    }

    /* Mobile sheet */
    .sheet {
      position: fixed;
      inset: 0 0 0 auto;
      width: min(78vw, 360px);
      background: white;
      transform: translateX(100%);
      transition: transform .25s ease;
      box-shadow: -30px 0 60px -30px rgba(15, 23, 42, .35);
      z-index: 60;
      display: flex;
      flex-direction: column
    }

    .sheet.open {
      transform: translateX(0)
    }

    .sheet header {
      position: relative;
      height: auto;
      border: 0;
      padding: 20px 20px
    }

    .sheet header .hamburger {
      position: fixed;
      right: 12px;
      top: 12px;
      display: block;
      z-index: 70
    }

    .sheet .links {
      display: flex;
      flex-direction: column;
      padding: 12px 20px;
      gap: 10px
    }

    .sheet a {
      padding: 12px;
      border-radius: 12px
    }

    .sheet a:hover {
      background: rgba(15, 23, 42, .06)
    }

    .sheet-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, .35);
      opacity: 0;
      pointer-events: none;
      transition: opacity .25s ease;
      z-index: 55
    }

    .sheet-backdrop.open {
      opacity: 1;
      pointer-events: auto
    }

    /* Auth Modal */
    .modal {
      position: fixed;
      inset: 0;
      display: grid;
      place-items: center;
      opacity: 0;
      pointer-events: none;
      transition: opacity .2s ease;
      z-index: 70
    }

    .modal.open {
      opacity: 1;
      pointer-events: auto
    }

    .modal-backdrop {
      position: absolute;
      inset: 0;
      background: rgba(15, 23, 42, .45)
    }

    .modal-card {
      position: relative;
      width: min(90vw, 850px);
      background: #fff;
      border-radius: 18px;
      box-shadow: 0 30px 80px -30px rgba(15, 23, 42, .5);
      padding: 22px 22px 26px;
      border: 1px solid rgba(15, 23, 42, .06);
      max-height: 90vh;
      overflow: auto;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
    }

    .modal-close {
      position: absolute;
      right: 12px;
      top: 10px;
      border: 0;
      background: transparent;
      font-size: 28px;
      line-height: 1;
      cursor: pointer;
      z-index: 5;
      width: 32px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .tabs {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
      margin: 28px auto 16px;
      max-width: 720px;
    }

    @media (max-width:520px) {
      .tabs {
        margin: 30px auto 16px;
        max-width: none;
      }
    }

    .tab {
      flex: 1;
      padding: 10px;
      border-radius: 12px;
      border: 1px solid rgba(15, 23, 42, .12);
      background: #f8fafc;
      font-weight: 700;
      cursor: pointer;
      text-align: center
    }

    .tab.active {
      background: var(--brand);
      color: #fff;
      border-color: transparent
    }

    .auth-form {
      display: grid;
      gap: 12px
    }

    .auth-form.hidden {
      display: none
    }

    .chip {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px;
      border-radius: 999px;
      background: rgba(106, 166, 166, .15);
      margin-right: 8px;
      align-self: center;
    }

    .history-clock-btn {
      display: none;
      width: 40px;
      height: 40px;
      min-width: 40px;
      padding: 0;
      border-radius: 999px;
      border: 1px solid rgba(15, 23, 42, .12);
      background: rgba(255, 255, 255, .8);
      color: #1e293b;
      line-height: 1;
    }

    .history-clock-btn svg {
      width: 20px;
      height: 20px;
      display: block;
      fill: currentColor;
    }

    .history-clock-btn:hover {
      background: #f8fafc;
      box-shadow: 0 8px 20px -14px rgba(15, 23, 42, .45);
    }

    @media (max-width:900px) {
      .nav-cta {
        gap: 8px;
      }

      .history-clock-btn {
        display: inline-flex;
      }

      .chip {
        margin-right: 0;
        padding: 8px 10px;
      }
    }

    .global-history-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.38);
      opacity: 0;
      pointer-events: none;
      transition: opacity .22s ease;
      z-index: 910;
    }

    .global-history-backdrop.active {
      opacity: 1;
      pointer-events: auto;
    }

    .global-history-panel {
      position: fixed;
      top: auto;
      left: 0;
      right: 0;
      bottom: 0;
      width: 100%;
      height: 75vh;
      transform: translateY(100%);
      transition: transform 0.24s ease;
      z-index: 920;
      background: #fff;
      border-top: 1px solid rgba(15, 23, 42, .08);
      border-radius: 16px 16px 0 0;
      box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.2);
      display: flex;
      flex-direction: column;
      padding: 15px;
      padding-bottom: calc(15px + env(safe-area-inset-bottom));
      display: none;
      overflow-y: auto;
    }

    .global-history-panel.active {
      transform: translateY(0);
    }

    .global-history-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 14px;
    }

    .global-history-head h4 {
      margin: 0;
      font-size: 16px;
      color: #0f172a;
    }

    .global-history-close {
      border: none;
      width: 40px;
      height: 40px;
      border-radius: 999px;
      background: #f1f5f9;
      color: #334155;
      font-size: 22px;
      line-height: 1;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .global-history-new-chat {
      width: 100%;
      min-height: 44px;
      border: none;
      border-radius: 999px;
      padding: 12px;
      background: var(--brand);
      color: #fff;
      font-weight: 700;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      margin-bottom: 0;
      transition: filter .2s;
    }

    .global-history-new-chat:hover {
      filter: brightness(.95);
    }

    .global-history-section-label {
      margin: 20px 0 5px;
      font-size: 12px;
      color: var(--muted);
      font-weight: 700;
    }

    .global-history-empty {
      margin: 0;
      font-size: 14px;
      color: #cbd5e1;
      padding: 10px;
      font-style: italic;
    }

    .global-history-list {
      margin-top: 8px;
      display: flex;
      flex-direction: column;
      gap: 6px;
      overflow-y: auto;
      padding-bottom: 6px;
    }

    .global-history-item {
      border: none;
      background: #fff;
      flex: 1;
      min-width: 0;
      text-align: left;
      padding: 10px 12px;
      border-radius: 10px;
      color: #334155;
      font-size: 14px;
      cursor: pointer;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .global-history-item:hover {
      background: #f1f5f9;
    }

    .global-history-row.active .global-history-item {
      background: #e2e8f0;
      color: #0f172a;
    }

    .global-history-row {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .global-history-pin-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      border: none;
      border-radius: 8px;
      background: transparent;
      color: #94a3b8;
      font-size: 16px;
      line-height: 1;
      cursor: pointer;
      flex: 0 0 auto;
    }

    .global-history-pin-btn svg {
      width: 16px;
      height: 16px;
      display: block;
      stroke: currentColor;
      fill: none;
      stroke-width: 1.9;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .global-history-pin-btn:hover {
      background: #f1f5f9;
      color: #475569;
    }

    .global-history-pin-btn.active {
      color: #0f766e;
      background: #e6fffb;
    }

    .global-history-pin-btn.active svg {
      fill: currentColor;
      stroke: currentColor;
    }

    .global-history-more-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      border: none;
      border-radius: 8px;
      background: transparent;
      color: #64748b;
      font-size: 20px;
      line-height: 1;
      cursor: pointer;
      flex: 0 0 auto;
    }

    .global-history-more-btn:hover {
      background: #f1f5f9;
      color: #0f172a;
    }

    .global-history-actions-overlay {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.38);
      z-index: 960;
      display: none;
      align-items: flex-end;
      justify-content: center;
    }

    .global-history-actions-overlay.active {
      display: flex;
    }

    .global-history-actions-sheet {
      width: min(520px, 100%);
      background: #fff;
      border-radius: 18px 18px 0 0;
      padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
      box-shadow: 0 -16px 30px rgba(15, 23, 42, 0.22);
      display: grid;
      gap: 10px;
      touch-action: manipulation;
    }

    .global-history-actions-title {
      margin: 4px 4px 10px;
      font-size: 13px;
      color: var(--muted);
      text-align: left;
    }

    .global-history-actions-btn {
      width: 100%;
      text-align: left;
      border: none;
      border-radius: 12px;
      min-height: 44px;
      background: #fff;
      padding: 14px 12px;
      font-size: 16px;
      color: #0f172a;
      cursor: pointer;
    }

    .global-history-actions-btn:hover {
      background: #f8fafc;
    }

    .global-history-actions-btn.delete {
      color: #b91c1c;
    }

    .global-history-delete-modal {
      position: fixed;
      inset: 0;
      z-index: 970;
      display: none;
      align-items: center;
      justify-content: center;
      background: rgba(15, 23, 42, 0.45);
      padding: 16px;
    }

    .global-history-delete-modal.active {
      display: flex;
    }

    .global-history-delete-card {
      width: min(900px, 100%);
      background: #fff;
      border-radius: 24px;
      box-shadow: 0 30px 60px -26px rgba(15, 23, 42, 0.45);
      padding: 44px 36px 34px;
    }

    .global-history-delete-title {
      margin: 0 0 20px;
      font-size: 34px;
      line-height: 1.2;
      color: #0f172a;
      font-weight: 800;
    }

    .global-history-delete-body {
      margin: 0;
      font-size: 16px;
      line-height: 1.5;
      color: #475569;
      min-height: 56px;
    }

    .global-history-delete-actions {
      margin-top: 24px;
      display: flex;
      justify-content: flex-end;
      gap: 14px;
    }

    .global-history-delete-btn {
      border: none;
      border-radius: 999px;
      min-height: 52px;
      min-width: 96px;
      padding: 10px 24px;
      font-size: 16px;
      font-weight: 800;
      cursor: pointer;
    }

    .global-history-delete-btn.cancel {
      background: #eef4fb;
      color: #64748b;
    }

    .global-history-delete-btn.confirm {
      background: var(--brand);
      color: #fff;
    }

    @media (max-width: 768px) {
      .global-history-delete-card {
        border-radius: 20px;
        padding: 26px 22px 22px;
      }

      .global-history-delete-title {
        font-size: 28px;
      }

      .global-history-delete-body {
        font-size: 15px;
        min-height: 48px;
      }

      .global-history-delete-btn {
        min-height: 44px;
        min-width: 82px;
        font-size: 15px;
      }
    }

    .global-history-row.editing {
      display: block;
      padding: 12px;
      background: #f8fafc;
      border-radius: 12px;
    }

    .global-history-inline-editor {
      width: 100%;
      display: grid;
      gap: 12px;
    }

    .global-history-inline-input {
      width: 100%;
      border: 4px solid #0f172a;
      border-radius: 20px;
      padding: 10px 16px;
      font-size: 20px;
      color: #0f172a;
      background: #fff;
      min-height: 44px;
    }

    .global-history-inline-actions {
      display: flex;
      justify-content: flex-end;
      gap: 10px;
    }

    .global-history-inline-btn {
      border: none;
      border-radius: 999px;
      min-height: 44px;
      padding: 8px 18px;
      font-size: 16px;
      font-weight: 700;
      cursor: pointer;
    }

    .global-history-inline-btn.cancel {
      background: #eef4fb;
      color: #334155;
    }

    .global-history-inline-btn.save {
      background: var(--brand);
      color: #fff;
    }

    .global-history-inline-btn:disabled {
      opacity: 0.55;
      cursor: not-allowed;
      filter: grayscale(20%);
    }

    html.global-history-open,
    body.global-history-open {
      overflow: hidden;
    }

    @media (max-width: 768px) {
      .global-history-panel {
        display: flex;
      }
    }

    label.notice {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      line-height: 1.2
    }

    label.notice input[type="checkbox"] {
      width: 16px;
      height: 16px;
      margin: 0;
      vertical-align: middle;
      accent-color: var(--brand)
    }

    .auth-form>div[style*="justify-content:space-between"] {
      gap: 12px;
      flex-wrap: wrap
    }

    /* Card Link */
    .card-link {
      text-decoration: none;
      color: inherit;
      outline: none;
      transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
      display: flex;
      flex-direction: column;
      height: 100%;
      justify-content: center;
      gap: 15px;
    }

    .card-link:hover {
      transform: translateY(-2px);
      box-shadow: 0 22px 60px -28px rgba(15, 23, 42, .35)
    }

    .card-link:focus-visible {
      border-color: var(--ring);
      box-shadow: 0 0 0 4px rgba(106, 166, 166, .18), 0 18px 50px -30px rgba(15, 23, 42, .35)
    }

    .card-link h4 {
      margin: 0;
    }

    .card-link p {
      margin: 0;
    }

    .card-header {
      display: flex;
      align-items: center;
      gap: 12px
    }

    .card-header .icon {
      flex-shrink: 0;
    }

    .card-header h4 {
      font-size: 18px;
      font-weight: 700;
      margin: 0
    }

    .card p {
      color: var(--muted);
    }

    .card ul {
      margin: 0 0 0 10px;
      padding-left: 14px;
      color: var(--muted);
    }

    .card li {
      margin: 6px 0
    }

    /* Search Bar */
    .hero .container {
      align-items: start;
    }

    .hero-card {
      margin-top: 14px;
    }

    .search-wrap {
      margin-top: 10px;
    }

    .search-bar {
      position: relative;
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 12px 10px 44px;
      border-radius: 999px;
      background: #fff;
      border: 1px solid rgba(15, 23, 42, .12);
      box-shadow: 0 6px 22px -12px rgba(15, 23, 42, .25);
      transition: box-shadow .2s ease, border-color .2s ease
    }

    .search-bar:focus-within {
      border-color: rgba(106, 166, 166, .45);
      box-shadow: 0 0 0 4px rgba(106, 166, 166, .14), 0 10px 28px -16px rgba(15, 23, 42, .28)
    }

    .search-icon {
      position: absolute;
      left: 14px;
      width: 22px;
      height: 22px;
      opacity: .6;
      pointer-events: none
    }

    .search-input {
      flex: 1;
      border: 0;
      outline: 0;
      background: transparent;
      font-size: 16px;
      line-height: 1.3;
      padding: 8px 0;
      color: var(--fg)
    }

    .search-input::placeholder {
      color: #9aa4b2
    }

    .search-btn {
      border: 0;
      border-radius: 999px;
      padding: 10px 16px;
      font-weight: 800;
      cursor: pointer;
      background: var(--brand);
      color: #fff;
      box-shadow: 0 10px 28px -18px rgba(106, 166, 166, .6);
      transition: filter .15s ease, transform .05s ease;
      flex: 0 0 auto
    }

    .search-btn:hover {
      filter: brightness(.98)
    }

    .search-btn:active {
      transform: translateY(1px)
    }

    .search-hint-line {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 10px;
      font-size: 15px;
      color: var(--muted)
    }

    .search-hint-chips {
      display: inline-flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .search-hint-chip {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border: 1px solid rgba(106, 166, 166, .45);
      background: rgba(106, 166, 166, .12);
      color: #2f5f66;
      border-radius: 999px;
      min-height: 44px;
      padding: 10px 16px;
      font-size: 15px;
      font-weight: 700;
      line-height: 1.2;
      cursor: pointer;
      transition: background .15s ease, transform .05s ease;
      touch-action: manipulation;
      -webkit-tap-highlight-color: transparent;
    }

    .search-hint-chip:hover {
      background: rgba(106, 166, 166, .2);
    }

    .search-hint-chip:active {
      transform: translateY(1px);
    }

    @media (max-width:560px) {
      .search-bar {
        padding-right: 12px
      }

      .search-btn {
        padding: 10px 14px
      }

      .search-hint-chip {
        min-height: 46px;
        padding: 11px 18px;
        font-size: 16px;
      }
    }

    /* Register, Share, Intro, Dashboard 等額外樣式略（沿用你原本） */
    :root {
      --content-w: 760px;
      --fs-base: 17px;
      --fs-title: 18px;
      --fs-label: 15px;
      --fs-option: 15px;
      --fs-option-mini: 14px;
      --group-gap: 6px;
    }

    :root {
      --peach: #fff1e6;
      --peach-line: #f5c8aa;
    }

    #page-content {
      animation: fadeIn 0.3s ease-in-out;
      display: block !important;
      width: 100% !important;
      max-width: none !important;
      min-height: calc(100vh - var(--header-h));
      overflow: visible !important;
      visibility: visible !important;
      opacity: 1 !important;
    }

    @keyframes fadeIn {
      from {
        opacity: 0;
        transform: translateY(10px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .consent-content {
      max-height: 50vh;
      overflow-y: auto;
      background: #f7f9fb;
      padding: 10px 15px;
      border-radius: 12px;
      border: 1px solid rgba(15, 23, 42, .1);
      margin-top: 10px;
    }

    .consent-content h4 {
      margin-top: 15px;
      margin-bottom: 5px;
      text-align: left;
    }

    .consent-content p,
    .consent-content li {
      font-size: 14px;
      color: var(--muted);
      text-align: left;
      margin-top: 0;
      margin-bottom: 10px;
    }

    .consent-content p:last-of-type {
      margin-bottom: 0;
    }

    .consent-content ol {
      display: flex;
      flex-direction: column;
      gap: 10px;
      padding-left: 20px;
      margin-top: 0;
      margin-bottom: 10px;
      list-style-position: outside;
    }

    .consent-actions {
      display: flex;
      flex-direction: column;
      gap: 12px;
      margin-top: 20px;
    }

    label.consent-check {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 14px;
      cursor: pointer;
    }

    label.consent-check input {
      width: 16px;
      height: 16px;
      flex-shrink: 0;
    }

    label.consent-check input:disabled+span {
      color: var(--muted);
      cursor: not-allowed;
      opacity: 0.7;
    }

    .security-q {
      display: grid;
      grid-template-columns: 1fr;
      gap: 8px;
      margin-bottom: 12px;
    }

    @media (min-width: 600px) {
      .security-q {
        grid-template-columns: 1.2fr 1fr;
      }
    }

    .captcha-wrap {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 8px;
    }

    .captcha-code {
      font-family: 'Courier New', Courier, monospace;
      font-size: 24px;
      font-weight: bold;
      letter-spacing: 5px;
      padding: 10px 15px;
      background: #eee;
      border-radius: 8px;
      border: 1px solid #ccc;
      text-decoration: line-through;
      user-select: none;
    }

    .profile-grid {
      display: grid;
      grid-template-columns: auto 1fr;
      gap: 12px 15px;
      align-items: center;
      max-width: 400px;
    }

    .profile-grid label {
      font-weight: 700;
      color: var(--muted);
      text-align: right;
    }

    .patient-list-container {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .patient-list-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
      padding: 12px;
      border-radius: 12px;
      background: var(--bg);
      border: 1px solid rgba(15, 23, 42, .06);
    }

    .patient-info {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .patient-info strong {
      font-size: 1.1em;
    }

    .patient-actions {
      display: flex;
      gap: 8px;
    }

    .patient-actions .btn {
      padding: 5px 12px;
      font-size: 14px;
    }

    .form-divider {
      border: 0;
      border-top: 1px solid #e2e8f0;
      margin: 20px 0;
    }

    .dashboard-layout {
      display: grid;
      grid-template-columns: 240px 1fr;
      gap: 20px;
    }

    .categories-hero .container {
      max-width: 1320px;
    }

    .categories-page .container {
      max-width: 1320px;
      padding-bottom: 32px;
    }

    @media (min-width: 901px) {
      .categories-page .container {
        height: clamp(360px, calc(100vh - var(--header-h) - 220px), 760px);
      }

      .dashboard-layout {
        height: 100%;
        align-items: stretch;
      }

      .dashboard-sidebar,
      .dashboard-content {
        min-height: 0;
        overflow-y: auto;
        scrollbar-gutter: stable;
      }
    }

    .dashboard-sidebar h4 {
      margin-top: 0;
      text-align: center;
      margin-bottom: 8px;
    }

    .category-nav {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .category-nav a {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 10px 14px;
      border-radius: 10px;
      font-weight: 500;
      color: var(--muted);
      transition: background .2s ease, color .2s ease;
    }

    .category-link-text {
      min-width: 0;
      flex: 1 1 auto;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .category-clear-search-btn {
      width: 32px;
      height: 32px;
      border: 1px solid rgba(100, 116, 139, .32);
      border-radius: 999px;
      background: #ffffff;
      color: #475569;
      font-size: 20px;
      line-height: 1;
      padding: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      flex: 0 0 auto;
      transition: background .2s ease, color .2s ease, border-color .2s ease;
    }

    .category-clear-search-btn:hover {
      background: #f8fafc;
      color: #0f172a;
      border-color: rgba(51, 65, 85, .48);
    }

    .category-nav a.active .category-clear-search-btn {
      border-color: rgba(255, 255, 255, .55);
      background: rgba(255, 255, 255, .18);
      color: #ffffff;
    }

    .category-nav a.active .category-clear-search-btn:hover {
      background: rgba(255, 255, 255, .3);
    }

    @media (max-width: 900px) {
      .category-clear-search-btn {
        width: 38px;
        height: 38px;
        font-size: 24px;
      }
    }

    .category-nav a:hover {
      background: #eef2f6;
      color: var(--fg);
    }

    .category-nav a.active {
      background: var(--brand);
      color: #ffffff;
      font-weight: 700;
    }

    .dashboard-content h4 {
      margin-top: 0;
    }

    .table-container {
      width: 100%;
      overflow-x: auto;
      background: var(--card);
      border: 1px solid rgba(15, 23, 42, .06);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
    }

    .data-table {
      width: 100%;
      border-collapse: collapse;
    }

    .data-table th,
    .data-table td {
      padding: 12px 15px;
      text-align: left;
      border-bottom: 1px solid #e2e8f0;
    }

    .data-table th {
      background: var(--bg);
      font-size: 13px;
      font-weight: 700;
      color: var(--muted);
      text-transform: uppercase;
    }

    .data-table tbody tr:last-child td {
      border-bottom: none;
    }

    .data-table tbody tr:hover {
      background: #fcfcfd;
    }

    .data-table .table-link {
      color: inherit;
      font-weight: 500;
      text-decoration: none;
    }

    .data-table .table-link:hover {
      text-decoration: underline;
      color: var(--brand);
    }

    .data-table th:first-child,
    .data-table td:first-child {
      width: 70px;
      text-align: center;
    }

    .data-table th:nth-child(4),
    .data-table td:nth-child(4) {
      width: 100px;
      text-align: center;
    }

    .data-table th:last-child,
    .data-table td:last-child {
      width: 130px;
    }

    @media (max-width: 900px) {
      .dashboard-layout {
        grid-template-columns: 1fr;
      }

      .dashboard-sidebar {
        border-bottom: 1px solid #e2e8f0;
        padding-bottom: 15px;
      }

      .categories-page .container {
        height: auto;
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
      }

      .table-container {
        background: transparent;
        border: none;
        box-shadow: none;
        overflow: visible;
      }

      .data-table {
        display: block;
      }

      .data-table thead {
        display: none;
      }

      .data-table tbody {
        display: block;
      }

      .data-table tbody tr {
        display: grid;
        gap: 10px;
        margin-bottom: 14px;
        padding: 14px;
        border: 1px solid rgba(15, 23, 42, .08);
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 10px 26px -18px rgba(15, 23, 42, .22);
      }

      .data-table tbody tr td {
        width: auto !important;
        display: flex;
        gap: 10px;
        justify-content: space-between;
        align-items: flex-start;
        border-bottom: none;
        padding: 0;
        text-align: left !important;
      }

      .data-table tbody tr td[data-label]::before {
        content: attr(data-label);
        flex: 0 0 72px;
        color: var(--muted);
        font-size: 13px;
        font-weight: 700;
      }
    }

    /* Share CSS */
    :root {
      --peach: #fff1e6;
      --peach-line: #f5c8aa;
    }

    .share-wrap {
      display: block !important;
      width: min(100%, 1000px) !important;
      max-width: 1000px;
      min-height: 240px !important;
      margin: 0 auto;
      padding: 32px 20px 56px;
      color: var(--fg);
      visibility: visible !important;
      opacity: 1 !important;
      box-sizing: border-box;
    }

    #share.card {
      display: block !important;
      width: 100% !important;
      max-width: 1100px;
      min-height: 360px !important;
      background: #fff;
      border-radius: 18px;
      box-shadow: 0 16px 40px -28px rgba(15, 23, 42, 0.35);
      border: 1px solid rgba(15, 23, 42, 0.06);
      padding: 40px;
      visibility: visible !important;
      opacity: 1 !important;
      position: relative !important;
      box-sizing: border-box;
    }

    #share h2 {
      margin: 0 0 8px;
      font-size: 28px;
    }

    #share .muted {
      margin: 0 0 12px;
    }

    #share form {
      display: flex;
      flex-direction: column;
      gap: 14px;
    }

    #share .section-title {
      margin: 14px 0 4px;
      font-size: 18px;
      font-weight: 800;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    #share .block {
      border: 1px dashed rgba(15, 23, 42, .10);
      border-radius: 14px;
      background: #fff;
      padding: 12px;
      margin-bottom: 12px;
    }

    #share .prompt {
      background: var(--peach);
      border: 1px solid var(--peach-line);
      border-radius: 12px;
      padding: 12px;
      margin-bottom: 10px;
    }

    #share .prompt strong {
      font-weight: 800;
    }

    #share .badge-required {
      display: inline-block;
      margin-left: 6px;
      padding: 2px 6px;
      border-radius: 8px;
      font-size: 12px;
      font-weight: 800;
      color: #fff;
      background: #ef4444;
    }

    #share fieldset {
      border: 1px solid rgba(15, 23, 42, .12);
      border-radius: 12px;
      padding: 12px;
      margin: 0;
    }

    #share .choices {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    #share .choice {
      display: flex;
      align-items: center;
      gap: 10px;
      justify-content: flex-start !important;
      padding: 10px 12px;
      border: 1px solid rgba(15, 23, 42, .12);
      border-radius: 12px;
      background: #fff;
      cursor: pointer;
      transition: all 0.2s;
    }

    #share .choice:hover {
      border-color: rgba(15, 23, 42, .24);
      background: #fafafa;
    }

    #share .choice:has(input:checked) {
      border-color: var(--brand);
      box-shadow: 0 0 0 4px rgba(106, 166, 166, .14);
    }

    #share .choice input {
      width: 16px;
      height: 16px;
      margin: 0;
      accent-color: var(--brand);
      flex-shrink: 0;
      cursor: pointer;
    }

    #share .choice span {
      font-size: 1rem;
      color: #333;
    }

    #share .inline {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    #share textarea {
      min-height: 120px;
      resize: vertical;
    }

    .hint-box {
      margin-top: 8px;
      font-size: 0.9rem;
      background: rgba(255, 255, 255, 0.6);
      color: #666;
      padding: 8px 0;
    }

    #share .choice.tooltip-target {
      position: relative;
    }

    #share .choice.tooltip-target::after {
      content: attr(data-tooltip);
      position: absolute;
      bottom: 100%;
      left: 50%;
      transform: translateX(-50%) scale(0.95);
      margin-bottom: 10px;
      background-color: #1e293b;
      color: #fff;
      padding: 10px 14px;
      border-radius: 6px;
      font-size: 0.9rem;
      line-height: 1.5;
      width: max-content;
      max-width: 280px;
      white-space: normal;
      text-align: justify;
      box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      z-index: 2000;
      transition: all 0.2s ease;
    }

    #share .choice.tooltip-target::before {
      content: '';
      position: absolute;
      bottom: 100%;
      left: 50%;
      transform: translateX(-50%);
      margin-bottom: 4px;
      border-width: 6px;
      border-style: solid;
      border-color: #1e293b transparent transparent transparent;
      opacity: 0;
      visibility: hidden;
      z-index: 2000;
    }

    @media (hover: hover) {

      #share .choice.tooltip-target:hover::after,
      #share .choice.tooltip-target:hover::before {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) scale(1);
      }
    }

    #share .choice.tooltip-target.show-tooltip::after,
    #share .choice.tooltip-target.show-tooltip::before {
      opacity: 1;
      visibility: visible;
      transform: translateX(-50%) scale(1);
    }

    #share .tag-container {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      margin-bottom: 16px;
      margin-top: 8px;
    }

    #share .smart-tag {
      display: inline-flex;
      align-items: center;
      padding: 0;
      border: 1px solid #ddd;
      border-radius: 20px;
      background: #fff;
      cursor: pointer;
      user-select: none;
      transition: all 0.2s ease;
      overflow: hidden;
      font-size: 0.95rem;
      color: #555;
    }

    #share .smart-tag:hover {
      border-color: #bbb;
      background: #fafafa;
    }

    #share .smart-tag.active {
      border-color: var(--brand);
      background: #f0fdfd;
      color: var(--brand);
      font-weight: 600;
      box-shadow: 0 2px 5px rgba(106, 166, 166, 0.2);
    }

    #share .smart-tag span.text {
      padding: 8px 14px;
    }

    #share .smart-tag span.icon {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 100%;
      align-self: stretch;
      background: #f0f0f0;
      border-left: 1px solid #ddd;
      color: #888;
      font-weight: bold;
      transition: all 0.2s ease;
    }

    #share .smart-tag.active span.icon {
      background: var(--brand);
      border-left-color: var(--brand);
      color: white;
    }

    .fade-in {
      animation: fadeIn 0.4s ease-out;
    }

    #share .actions {
      display: flex;
      justify-content: flex-end;
      gap: 10px;
      margin-top: 4px
    }

    #share .steps-progress {
      display: flex;
      align-items: center;
      gap: .75rem;
      margin: .75rem 0 1.1rem
    }

    #share .steps-progress .bar {
      flex: 1;
      height: 6px;
      background: #e5e7eb;
      border-radius: 999px;
      overflow: hidden
    }

    #share .steps-progress .bar>i {
      display: block;
      height: 100%;
      width: 100%;
      background: #5b8def
    }


/* pages/chat.html */
/* === 聊天室專用樣式 (視窗捲動版 + 刪除功能) === */

  /* 1. 外層容器：不再限制高度，讓內容自然撐開 */
  .chat-wrapper {
    display: flex;
    width: 100%;
    min-height: calc(100vh - 64px);
    /* 至少填滿剩下的畫面 */
    align-items: flex-start;
    /* 讓側邊欄置頂 */
    background: #fff;
  }

  /* 2. 側邊欄：改成 Sticky (黏在左邊不動) */
  .chat-sidebar {
    width: 260px;
    /* 關鍵：讓它黏在 Header 下方 */
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    /* 高度填滿 */

    background: #fff;
    border-right: 1px solid rgba(15, 23, 42, .08);
    display: flex;
    flex-direction: column;
    padding: 15px;
    overflow-y: auto;
    /* 側邊欄自己內容多時可捲動 */
  }

  .chat-sidebar-mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
  }

  .chat-sidebar-mobile-header h4 {
    margin: 0;
    font-size: 16px;
    color: #0f172a;
  }

  .chat-sidebar-close-btn {
    border: none;
    background: #f1f5f9;
    color: #334155;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
  }

  .mobile-history-backdrop {
    display: none;
  }

  .new-chat-btn {
    width: 100%;
    padding: 12px;
    border-radius: 99px;
    background: var(--brand);
    color: white;
    border: none;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: filter 0.2s;
    flex-shrink: 0;
  }

  .new-chat-btn:hover {
    filter: brightness(0.95);
  }

  .chat-history {
    flex: 1;
    overflow-y: auto;
    margin-top: 20px;
  }

  .history-label {
    font-size: 12px;
    color: var(--muted);
    margin: 10px 0 5px;
    font-weight: 700;
  }

  /* === 歷史列表項目 (Flex 排版：文字靠左，按鈕靠右) === */
  .history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;

    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #334155;
    margin-bottom: 4px;
  }

  .history-item:hover {
    background: #f1f5f9;
  }

  .history-item.active {
    background: #e2e8f0;
  }

  .history-title-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
  }

  .history-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-left: 8px;
  }

  .history-action-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 6px;
    border-radius: 4px;
    display: none;
  }

  /* 滑鼠移到該行時才顯示按鈕 */
  .history-item:hover .history-action-btn {
    display: block;
  }

  .history-more-btn {
    display: none;
    border: none;
    background: transparent;
    color: #64748b;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
  }

  .history-more-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
  }

  .delete-chat-btn:hover {
    color: #ef4444;
    /* 紅色 */
    background: rgba(239, 68, 68, 0.1);
  }

  .edit-chat-btn {
    font-size: 16px;
  }

  .edit-chat-btn:hover {
    color: var(--brand);
    background: rgba(0, 102, 102, 0.1);
  }

  .history-edit-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 14px;
    color: #0f172a;
  }

  .history-mobile-editor {
    width: 100%;
    display: grid;
    gap: 10px;
  }

  .history-mobile-edit-input {
    width: 100%;
    border: 1px solid #94a3b8;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 16px;
    color: #0f172a;
    background: #fff;
  }

  .history-mobile-edit-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
  }

  .history-mobile-edit-btn {
    border: none;
    border-radius: 999px;
    min-height: 40px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
  }

  .history-mobile-edit-btn.cancel {
    background: #e2e8f0;
    color: #334155;
  }

  .history-mobile-edit-btn.save {
    background: var(--brand);
    color: #fff;
  }

  /* 空狀態文字 */
  .history-empty {
    font-size: 14px;
    color: #cbd5e1;
    padding: 10px;
    font-style: italic;
  }


  /* 3. 主內容區 */
  .chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 64px);
    position: relative;
  }

  .chat-content {
    flex: 1;
    /* 移除 overflow: auto，改用瀏覽器原本的捲軸 */
    overflow: visible;
    padding: 20px 16px 40px 16px;
    display: flex;
    flex-direction: column;
    padding-bottom: 40px;
  }

  /* 4. 輸入框：Sticky 黏在底部 */
  .input-area-wrapper {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    padding: 16px;
    z-index: 10;
  }

  .input-box {
    max-width: 100%;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .input-box input {
    flex: 1 1 0;
    min-width: 0;
    padding: 14px 18px;
    border-radius: 99px;
    border: 1px solid #cbd5e1;
    outline: none;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s;
    background: #fff;
  }

  .input-box input:focus {
    border-color: var(--brand);
  }

  .icon-circle-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #e2e8f0;
    color: #0f172a;
    font-size: 18px;
    transition: all 0.2s;
  }

  .icon-circle-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
  }

  .icon-circle-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.15);
  }

  #record-btn {
    background: #f1f5f9;
    color: #0f172a;
  }

  #record-btn.recording {
    background: #fee2e2;
    color: #b91c1c;
  }

  #chat-submit-btn {
    background: var(--brand);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
  }

  .message.voice-transcript .msg-bubble {
    border: 1px dashed rgba(255, 255, 255, 0.4);
  }

  .message.voice-error .msg-bubble {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px dashed #fecaca;
  }

  /* 其他元件 */
  .welcome-box {
    text-align: center;
    margin-top: 60px;
  }

  .logo-large {
    width: 60px;
    height: 60px;
    background: var(--brand);
    color: white;
    font-size: 30px;
    font-weight: 800;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
  }

  .suggestions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    max-width: 600px;
    margin: 30px auto 0;
  }

  .suggestion-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .suggestion-card:hover {
    border-color: var(--brand);
    background: #fff;
  }

  .chat-messages-list {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .message {
    display: flex;
    gap: 12px;
    width: 50%;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(5px)
    }

    to {
      opacity: 1;
      transform: translateY(0)
    }
  }

  .message.user {
    align-self: flex-end;
    justify-content: flex-end;
    margin-left: 0;
  }

  .message.ai {
    align-self: flex-start;
  }

  .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
  }

  .avatar.a {
    background: var(--brand);
    color: white;
  }

  .avatar.u {
    background: #e2e8f0;
    color: #64748b;
  }

  .msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.6;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    max-width: 100%;
    word-break: break-word;
  }

  .message.ai .msg-bubble {
    background: #f1f5f9;
    border-top-left-radius: 4px;
    max-width: calc(100% - 48px);
  }

  .message.user .msg-bubble {
    background: var(--brand);
    color: white;
    border-top-right-radius: 4px;
  }

  .disclaimer {
    text-align: left;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 10px;
    margin-bottom: 0;
    padding-left: 5px;
  }

  .chat-mode-switch {
    display: flex;
    gap: 10px;
    margin: 4px 0 16px;
    flex-wrap: wrap;
  }

  .chat-mode-btn {
    border: 1px solid rgba(15, 23, 42, .12);
    background: #fff;
    color: #334155;
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
  }

  .chat-mode-btn.active {
    background: rgba(106, 166, 166, .14);
    border-color: rgba(106, 166, 166, .45);
    color: #0f766e;
  }

  .share-interview-panel {
    display: none;
    background: #f8fbfb;
    border: 1px solid rgba(106, 166, 166, .28);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
  }

  .share-interview-panel.active {
    display: block;
  }

  .share-interview-progress {
    font-size: 13px;
    font-weight: 700;
    color: #0f766e;
    margin-bottom: 10px;
  }

  .share-interview-question {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.5;
  }

  .share-interview-tip {
    margin-top: 8px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
  }

  .share-interview-result {
    display: none;
    margin-top: 14px;
    background: #fff;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, .26);
    padding: 14px;
  }

  .share-interview-result.active {
    display: block;
  }

  .share-result-title {
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 8px;
  }

  .share-result-body {
    font-size: 15px;
    color: #0f172a;
    line-height: 1.7;
    white-space: pre-wrap;
  }

  .share-manual-editor {
    display: none;
    margin-top: 14px;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, .26);
    border-radius: 14px;
    padding: 14px;
  }

  .share-manual-editor.active {
    display: block;
  }

  .share-editor-title {
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 10px;
  }

  .share-editor-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .share-editor-option {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: center;
    justify-content: flex-start;
    column-gap: 12px;
    row-gap: 8px;
    width: 100%;
    min-width: 0;
    min-height: 64px;
    padding: 16px 14px;
    border: 1px solid #d7dee8;
    border-radius: 18px;
    background: #fff;
    box-sizing: border-box;
    font-size: 15px;
    color: #334155;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
  }

  .share-editor-option:hover {
    border-color: rgba(15, 118, 110, 0.35);
    box-shadow: 0 8px 18px rgba(15, 118, 110, 0.08);
  }

  .share-editor-option.checked {
    border-color: rgba(15, 118, 110, 0.48);
    background: #f0fdfa;
  }

  .share-editor-option input[type="checkbox"],
  .share-editor-option input[type="radio"] {
    margin: 0;
    width: 20px;
    height: 20px;
    justify-self: start;
    align-self: center;
  }

  .share-editor-choice {
    display: block;
    width: auto;
    min-width: 0;
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.6;
    letter-spacing: 0.01em;
    color: #334155;
    white-space: normal;
    word-break: break-word;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    text-align: left;
    justify-self: start;
    align-self: center;
  }

  .share-editor-option input[type="text"] {
    min-width: 0;
    width: 100%;
    height: 42px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 14px;
    cursor: text;
  }

  .share-editor-option-other {
    align-items: center;
    grid-template-columns: 20px auto minmax(180px, 1fr);
  }

  .share-editor-group textarea {
    width: 100%;
    min-height: 100px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 12px 14px;
    resize: vertical;
    font-size: 15px;
    line-height: 1.6;
  }

  .share-interview-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
  }

  .share-panel-btn {
    border: none;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
  }

  .share-panel-btn.primary {
    background: var(--brand);
    color: #fff;
  }

  .share-panel-btn.soft {
    background: #e2e8f0;
    color: #334155;
  }

  .share-panel-btn.ghost {
    background: #fff;
    color: #0f766e;
    border: 1px solid rgba(106, 166, 166, .45);
  }

  .share-panel-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
  }

  .share-interview-summary {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
  }

  .share-summary-item {
    width: 52px;
    height: 52px;
    border: 2px solid transparent;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    padding: 0;
    flex: 0 0 auto;
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease;
  }

  .share-summary-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 118, 110, 0.16);
  }

  .share-summary-item-filled {
    background: #0f766e;
    color: #fff;
  }

  .share-summary-item-empty {
    background: #e2e8f0;
    color: #64748b;
  }

  .share-summary-item-skipped {
    background: #fef3c7;
    color: #b45309;
  }

  .share-summary-item.active {
    border-color: #0f172a;
    box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.08);
  }

  .modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    padding: 16px;
  }

  .modal-overlay.active {
    display: flex;
  }

  .modal-card {
    width: min(900px, 100%);
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 30px 60px -26px rgba(15, 23, 42, 0.45);
    padding: 44px 36px 34px;
  }

  .modal-title {
    margin: 0 0 20px;
    font-size: 34px;
    line-height: 1.2;
    color: #0f172a;
    font-weight: 800;
  }

  .modal-body {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    color: #475569;
    min-height: 56px;
  }

  .modal-actions {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
    gap: 14px;
  }

  .modal-btn {
    border: none;
    border-radius: 999px;
    min-height: 52px;
    min-width: 96px;
    padding: 10px 24px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
  }

  .modal-btn.cancel {
    background: #eef4fb;
    color: #64748b;
  }

  .modal-btn.danger {
    background: var(--brand);
    color: #fff;
  }

  .mobile-actions-overlay {
    position: fixed;
    inset: 0;
    z-index: 960;
    background: rgba(15, 23, 42, 0.38);
    display: none;
    align-items: flex-end;
    justify-content: center;
  }

  .mobile-actions-overlay.active {
    display: flex;
  }

  .mobile-actions-sheet {
    width: min(520px, 100%);
    background: #fff;
    border-radius: 18px 18px 0 0;
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
    box-shadow: 0 -16px 30px rgba(15, 23, 42, 0.22);
    touch-action: manipulation;
  }

  .mobile-actions-title {
    margin: 4px 4px 10px;
    font-size: 13px;
    color: #64748b;
  }

  .mobile-action-btn {
    width: 100%;
    text-align: left;
    border: none;
    background: #fff;
    border-radius: 12px;
    padding: 14px 12px;
    font-size: 16px;
    color: #0f172a;
    cursor: pointer;
    min-height: 44px;
  }

  .mobile-action-btn:hover {
    background: #f8fafc;
  }

  .mobile-action-btn.delete {
    color: #b91c1c;
  }

  html.mobile-history-open,
  body.mobile-history-open {
    overflow: hidden;
    overscroll-behavior: none;
  }

  @media (max-width: 768px) {
    .message {
      width: 100%;
    }

    .message.ai .msg-bubble,
    .message.user .msg-bubble {
      max-width: 80%;
    }

    .chat-main {
      min-height: calc(100vh - 64px);
    }

    .chat-sidebar {
      position: fixed;
      top: auto;
      left: 0;
      right: 0;
      bottom: 0;
      width: 100%;
      height: 75vh;
      border-right: none;
      border-top: 1px solid rgba(15, 23, 42, .08);
      border-radius: 16px 16px 0 0;
      z-index: 920;
      transform: translateY(100%);
      transition: transform 0.24s ease;
      box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.2);
      padding-bottom: calc(15px + env(safe-area-inset-bottom));
    }

    .chat-sidebar.is-mobile-open {
      transform: translateY(0);
    }

    .chat-sidebar-mobile-header {
      display: flex;
    }

    .mobile-history-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.38);
      z-index: 910;
      display: none;
    }

    .mobile-history-backdrop.active {
      display: block;
    }

    .history-item:hover .history-action-btn {
      display: none;
    }

    .history-more-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .history-action-btn {
      display: none !important;
    }

    .history-item.mobile-editing {
      display: block;
      padding: 12px;
      background: #f8fafc;
      border-radius: 12px;
    }

    .modal-card {
      border-radius: 20px;
      padding: 26px 22px 22px;
    }

    .modal-title {
      font-size: 28px;
    }

    .modal-body {
      font-size: 15px;
      min-height: 48px;
    }

    .modal-btn {
      min-height: 44px;
      min-width: 82px;
      font-size: 15px;
    }

    .suggestions {
      grid-template-columns: 1fr;
    }
  }


/* pages/detail.html */
.detail-page {
    padding-top: 20px;
    padding-bottom: 60px;
  }

  .detail-top-actions {
    margin-bottom: 20px;
  }

  .detail-back-link {
    padding-left: 14px;
    color: #64748b;
    border-color: rgba(15, 23, 42, 0.12);
    background: rgba(255, 255, 255, 0.8);
  }

  .detail-back-link:hover {
    color: #334155;
    background: #fff;
  }

  .detail-card {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  }

  .detail-header {
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    padding-bottom: 22px;
    margin-bottom: 30px;
  }

  .detail-title {
    margin: 0 0 16px 0;
    color: #334155;
    font-size: clamp(1.8rem, 3.6vw, 3.6rem);
    line-height: 1.26;
    letter-spacing: 0.01em;
  }

  .detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
  }

  .detail-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    padding: 8px 14px;
    border-radius: 12px;
    background: #eef4f4;
    color: #7a7a7a;
    font-size: 0.9rem;
  }

  .detail-meta-item b {
    color: #5f6368;
  }

  .detail-meta-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #dde8e9;
  }

  .section-head-green {
    color: #2e7d32;
    font-weight: bold;
    font-size: 1.25rem;
    margin-top: 40px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px dashed #a5d6a7;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .section-head-green::before {
    content: '✿';
    color: #4caf50;
    font-size: 1.4rem;
    line-height: 1;
  }

  .detail-row {
    display: flex;
    margin-bottom: 15px;
    align-items: stretch;
    border: 1px solid transparent;
  }

  .detail-label {
    background-color: #ffccbc;
    color: #bf360c;
    font-weight: 700;
    padding: 12px 16px;
    width: 30%;
    min-width: 220px;
    border-left: 6px solid #ff7043;
    display: flex;
    align-items: center;
    font-size: 1rem;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    line-height: 1.4;
  }

  .detail-value {
    flex: 1;
    padding: 12px 20px;
    background-color: #fff;
    color: #333;
    line-height: 1.6;
    display: flex;
    align-items: center;
    border-top: 1px solid #ffe0b2;
    border-bottom: 1px solid #ffe0b2;
    border-right: 1px solid #ffe0b2;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
  }

  .highlight-text {
    background: #fff3e0;
    padding: 2px 6px;
    border-radius: 4px;
    color: #e65100;
  }

  @media (max-width: 768px) {
    .detail-card { padding: 20px !important; }

    .detail-title {
      font-size: clamp(1.5rem, 8vw, 2.1rem);
      margin-bottom: 12px;
    }

    .detail-meta-item {
      width: 100%;
    }

    .detail-row {
      flex-direction: column;
      gap: 0;
      margin-bottom: 20px;
      box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }

    .detail-label {
      width: 100%;
      border-left: 5px solid #ff7043;
      border-radius: 4px 4px 0 0;
      min-width: auto;
    }

    .detail-value {
      border: 1px solid #eee;
      border-top: none;
      border-radius: 0 0 4px 4px;
    }
  }

/* Converted inline style attributes */
.csp-style-001 { text-align: justify; }
.csp-style-002 { margin-left: 18px; padding-left: 20px; }
.csp-style-003 { text-align: center; margin-bottom: 5px; }
.csp-style-004 { text-align: center; font-size: 1.15em; margin-top: 5px; margin-bottom: 5px; }
.csp-style-005 { text-align: center; margin-bottom: 0; }
.csp-style-006 { text-align: center; font-size: 1.15em; margin-top: 10px; margin-bottom: 5px; }
.csp-style-007 { display:flex;align-items:center;justify-content:space-between; }
.csp-style-008 { font-size: 12px; margin-top: 4px; }
.csp-style-009 { font-size: 13px; margin-top: 0; margin-bottom: 12px; }
.csp-style-010 { padding: 5px 10px; font-size: 14px; }
.csp-style-011 { margin-top:10px; }
.csp-style-012 { margin-top:8px; min-height: 22px; }
.csp-style-013 { grid-template-columns: 1fr; max-width: 800px; margin: 20px auto; }
.csp-style-014 { padding: 50px; text-align: center; align-items: center; gap: 20px; }
.csp-style-015 { flex-direction: column; gap: 15px; }
.csp-style-016 { width: 72px; height: 72px; font-size: 32px; }
.csp-style-017 { font-size: 28px; }
.csp-style-018 { font-size: 18px; color: var(--fg); opacity: 0.8; max-width: 600px; }
.csp-style-019 { list-style: none; padding: 0; display: flex; gap: 20px; justify-content: center; margin-top: 10px; }
.csp-style-020 { display: flex; align-items: center; gap: 6px; }
.csp-style-021 { color:var(--brand); }
.csp-style-022 { padding-top: 34px; padding-bottom: 34px; }
.csp-style-023 { margin-left:6px; }
.csp-style-024 { display:none; }
.csp-style-025 { grid-template-columns: 1fr; max-width: 400px; margin-top: 10px; }
.csp-style-026 { grid-template-columns: 1fr; }
.csp-style-027 { margin:0; }
.csp-style-028 { max-width: 200px; }
.csp-style-029 { font-size: 13px; margin: 0 0 12px 0; }
.csp-style-030 { margin-top: 20px; }
.csp-style-031 { text-align: center; padding: 20px; }
.csp-style-032 { display:none; margin: 12px 0 16px; }
.csp-style-033 { display:flex; justify-content:flex-end; gap:10px; margin-bottom: 16px; }
.csp-style-034 { padding: 8px 2px; }
.csp-style-035 { display:none; margin-bottom: 12px; }
.csp-style-036 { font-size:0.9rem; color:#555; margin-bottom:8px; }
.csp-style-037 { gap:12px; }
.csp-style-038 { width: min(320px, 55%); margin-left:auto; }
.csp-style-039 { display:flex; justify-content:flex-end; gap:10px; }
