/* Brand colors from LUCKY's lucky-booking.css. */
    :root {
      color-scheme: light;
      --page: #fbf1f2;
      --pale: #fdf6f7;
      --surface: #fff9f5;
      --soft: #fcf5f2;
      --ink: #4a382d;
      --deep: #4b3a2b;
      --muted: #7a6758;
      --border: #d9c2b8;
      --yellow: #f3e7bf;
      --hover: #e8d9aa;
      --gold: #d5b26a;
      --shadow: 0 2px 8px rgb(61 47 41 / 8%);
      font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
      color: var(--ink);
      background: var(--page);
      font-size: 16px;
      line-height: 1.6;
    }
    * { box-sizing: border-box; }
    body { margin: 0; }
    h1, h2, h3, p, dl, dd { margin: 0; }
    [hidden] { display: none !important; }
    :focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
    button, select, input, textarea { font: inherit; color: inherit; }
    button, summary, select { cursor: pointer; }
    .wrap { width: min(100% - 24px, 504px); margin-inline: auto; }
    .topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
    .topbar .wrap, .brand, .between { display: flex; align-items: center; gap: 12px; }
    .topbar .wrap { min-height: 68px; }
    .between, .topbar .wrap { justify-content: space-between; }
    .brand { gap: 9px; line-height: 1.35; }
    .brand img { border-radius: 8px; object-fit: contain; flex: none; }
    .brand strong { display: block; font-size: 15px; color: var(--deep); }
    .brand small, .muted { color: var(--muted); }
    .brand small { font-size: 12px; }
    .pill {
      display: inline-flex; align-items: center; flex: none; min-height: 28px;
      padding: 2px 9px; border: 1px solid var(--border); border-radius: 100px;
      background: var(--pale); color: var(--deep); font-size: 12px; font-weight: 700;
    }
    main.wrap { padding: 16px 0 36px; }
    .card { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
    .intro { padding: 18px 16px 16px; }
    .eyebrow { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .13em; }
    h1 { margin: 3px 0 4px; font-size: clamp(27px, 7vw, 34px); line-height: 1.25; color: var(--deep); }
    .intro > .muted { font-size: 14px; }
    .pet-card {
      display: grid; grid-template-columns: 42px minmax(0, 1fr) minmax(88px, auto);
      align-items: center; gap: 10px; margin-top: 15px; padding: 10px;
      background: var(--pale); border: 1px solid var(--border); border-radius: 10px;
    }
    .pet-mark {
      display: grid; place-items: center; width: 42px; height: 42px;
      border: 1px solid var(--gold); border-radius: 12px; background: var(--yellow);
      color: var(--deep); font-size: 20px; font-weight: 700;
    }
    .pet-card strong { display: block; font-size: 18px; line-height: 1.25; }
    .pet-card small { color: var(--muted); font-size: 12px; }
    .field { display: grid; min-width: 0; gap: 4px; }
    .field > label { font-size: 13px; font-weight: 700; }
    .field > :is(input, select, textarea), .pet-select {
      width: 100%; min-width: 0; min-height: 44px; padding: 8px 9px;
      background: #fff; border: 1px solid var(--border); border-radius: 8px;
    }
    .field > textarea { min-height: 82px; resize: vertical; }
    .tabs {
      display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px;
      margin: 13px 0; padding: 4px; border: 1px solid var(--border);
      background: var(--surface); border-radius: 12px;
    }
    .tab, .button {
      min-height: 44px; border: 1px solid transparent; border-radius: 8px;
      font-weight: 700; line-height: 1.35; text-align: center;
    }
    .tab { padding: 5px 2px; background: transparent; font-size: 14px; color: var(--deep); }
    .tab[aria-selected="true"] { background: var(--yellow); border-color: var(--gold); }
    .button { padding: 9px 12px; background: var(--yellow); border-color: var(--gold); color: var(--deep); font-size: 14px; }
    .button:hover { background: var(--hover); }
    .button.secondary { background: var(--surface); border-color: var(--border); }
    .button.secondary:hover { background: var(--pale); }
    .button.full { width: 100%; }
    .button:disabled { opacity: .65; cursor: default; }
    .handbook-link { display: grid; align-content: center; text-decoration: none; }
    #owner-gate .panel-action:has([hidden]):not(:has(:is(a, button):not([hidden]))) { display: none; }
    .panel { padding: 16px; }
    h2 { color: var(--deep); font-size: 21px; line-height: 1.35; }
    .panel-caption { margin: 4px 0 12px; font-size: 13px; }
    .rows { display: grid; gap: 8px; }
    .record { min-width: 0; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
    .record > summary {
      display: flex; justify-content: space-between; align-items: center; gap: 8px;
      min-height: 49px; padding: 8px 11px; list-style: none; border-radius: 10px;
    }
    .record > summary::-webkit-details-marker { display: none; }
    .record > summary::after {
      content: ""; flex: 0 0 7px; height: 7px; margin-right: 2px; margin-top: -3px;
      border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg);
    }
    .record[open] > summary::after { margin-top: 4px; transform: rotate(225deg); }
    .record[open] > summary { background: var(--soft); border-radius: 10px 10px 0 0; }
    .record-name { font-weight: 700; overflow-wrap: anywhere; }
    .record-date { display: block; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
    .record-body { padding: 10px 11px 12px; font-size: 14px; overflow-wrap: anywhere; }
    .record-actions { display: flex; gap: 8px; margin-top: 12px; }
    .record-actions > .button { flex: 1; }
    .facts > div { display: grid; grid-template-columns: 5em minmax(0, 1fr); gap: 6px; padding: 4px 0; }
    .facts dt { color: var(--muted); }
    .handoff {
      margin-top: 8px; padding: 8px 10px; border: 1px solid var(--gold); border-radius: 8px;
      background: #fff4de; font-size: 13px;
    }
    .handoff strong { display: block; margin-bottom: 2px; }
    .panel-action { margin-top: 12px; }
    .status { min-height: 0; font-size: 13px; color: var(--deep); }
    .status:not(:empty) { margin-top: 10px; }
    .footer { text-align: center; margin: 16px 0 0; color: var(--muted); font-size: 12px; }
    dialog {
      width: min(100% - 24px, 480px); max-height: calc(100dvh - 28px);
      padding: 0; overflow: auto; color: var(--ink); background: var(--surface);
      border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 36px rgb(61 47 41 / 18%);
    }
    dialog::backdrop { background: rgb(74 56 45 / 38%); }
    .dialog-content { padding: 16px; }
    .dialog-header { margin-bottom: 12px; }
    .dialog-header h2 { font-size: 20px; }
    .dialog-form { display: grid; gap: 10px; }
    .dialog-actions { display: flex; gap: 8px; margin-top: 12px; }
    .dialog-actions > .button { flex: 1; }
    .preview { margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
    .sheet { color: var(--ink); line-height: 1.55; overflow-wrap: anywhere; }
    .sheet-heading { padding-bottom: 10px; border-bottom: 1px solid var(--border); }
    .sheet-heading .brand { margin-bottom: 7px; }
    .sheet h2 { margin-bottom: 3px; }
    .sheet h3 { color: var(--deep); font-size: 15px; margin: 10px 0 3px; }
    .sheet p, .sheet dl { font-size: 13px; }
    .sheet-foot { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
    #print-sheet { display: none; }
    .sr-only {
      position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
      clip-path: inset(50%); white-space: nowrap; border: 0;
    }
    @media (max-width: 350px) {
      .intro, .panel { padding-inline: 12px; }
      .topbar .wrap { gap: 6px; }
      .brand { gap: 6px; }
    }
    @page { size: A4 portrait; margin: 16mm; }
    @media print {
      :root, body { background: #fff; }
      #app, dialog { display: none !important; }
      #print-sheet { display: block; }
      .sheet { padding: 0; color: #25211e; }
      .sheet-heading { padding-bottom: 5mm; }
      .sheet-heading .brand { margin-bottom: 5mm; }
      .sheet .brand strong { font-size: 13pt; }
      .sheet h2 { font-size: 24pt; margin-bottom: 2mm; }
      .sheet h3 { font-size: 15pt; margin: 6mm 0 2mm; }
      .sheet p, .sheet dl { font-size: 12pt; }
      .sheet .facts > div { padding: 1.5mm 0; }
      .sheet .sheet-foot { margin-top: 8mm; padding-top: 3mm; font-size: 10pt; }
    }
/* Screen refinement: existing LUCKY pink/brown palette, flat surfaces and clear spacing. */
@media screen {
  :root { --page: #fff9f5; --surface: #fff; --border: rgb(74 56 45 / 14%); --shadow: none; }
  body { background: var(--page); }
  .wrap { width: min(100% - 36px, 600px); }
  .topbar { background: var(--pale); border-bottom: 0; }
  .topbar .wrap { min-height: 62px; }
  .brand img { width: 34px; height: 34px; }
  .brand strong { font-size: 14px; }
  .brand small { font-size: 11px; }
  .topbar .pill { display: none; }
  .handbook-booking-link { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 0 6px 10px; color: var(--deep); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
  .handbook-booking-link:hover { text-decoration: underline; text-underline-offset: 4px; }
  main.wrap { padding: 22px 0 36px; }
  .page-heading h1 { font-size: 25px; margin: 0 0 6px; letter-spacing: -.02em; }
  .page-heading p { font-size: 14px; }
  .handbook-nav { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border); margin: 20px 0 24px; }
  .handbook-nav button { position: relative; border: 0; background: none; min-height: 48px; font-weight: 700; font-size: 16px; color: var(--muted); }
  .handbook-nav button[aria-pressed="true"] { color: var(--deep); }
  .handbook-nav button[aria-pressed="true"]::after { content: ""; position: absolute; height: 3px; border-radius: 3px; background: #e3b1b6; bottom: -1px; left: 25%; right: 25%; }
  .card { box-shadow: none; }
  .intro { background: transparent; border: 0; padding: 0 0 8px; }
  .pet-card { margin: 0; padding: 0; background: none; border: 0; grid-template-columns: 40px minmax(0, 1fr) minmax(94px, auto); gap: 12px; }
  .pet-mark { width: 40px; height: 40px; border: 0; background: #fbf1f2; font-size: 18px; }
  .pet-select { background: #fff; border-color: var(--border); }
  .tabs { border: 0; border-radius: 0; padding: 0; margin: 18px 0; background: transparent; gap: 2px; }
  .tab { font-size: 14px; border-radius: 8px; }
  .tab[aria-selected="true"] { background: #fbf1f2; border-color: transparent; }
  .panel { background: transparent; border: 0; padding: 0; }
  h2 { font-size: 19px; }
  .panel-caption { margin: 5px 0 16px; font-size: 14px; }
  .rows { gap: 12px; }
  .record { border-radius: 14px; border-color: var(--border); }
  .record > summary { padding: 15px; min-height: 64px; }
  .record[open] > summary { background: transparent; border-radius: 14px; }
  .record-name { font-size: 17px; }
  .record-date { margin-top: 3px; font-size: 13px; }
  .record-body { padding: 0 15px 15px; }
  .facts > div { padding: 5px 0; }
  .record-actions { padding-top: 10px; border-top: 1px solid var(--border); }
  .record-actions > .button { border-color: transparent; background: #fdf6f7; }
  .button { border-radius: 10px; font-size: 15px; }
  .button.secondary { background: #fff; }
  .button.panel-action:not(.secondary) { background: #fbf1f2; border-color: #e3b1b6; }
  .footer { margin-top: 26px; font-size: 12px; line-height: 1.8; }
  .footer a { color: var(--deep); text-underline-offset: 3px; }
  dialog { background: #fff; border: 0; border-radius: 16px; }
  .dialog-content { padding: 20px; }
  #owner-gate { padding: 20px; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
  #gate-title { font-size: 20px; margin-bottom: 8px; }
  .guide-urgent { background: #fbf1f2; border-radius: 14px; padding: 18px; }
  .guide-kicker { display: block; font-size: 12px; font-weight: 700; color: #873535; margin-bottom: 5px; }
  .guide-urgent h2 { font-size: 18px; }
  .guide-urgent > p { margin-top: 8px; font-size: 14px; }
  .guide-filters { display: flex; gap: 8px; margin: 22px 0; }
  .guide-filters button { flex: 1; min-height: 44px; border: 1px solid transparent; border-radius: 10px; padding: 7px 4px; background: transparent; color: var(--muted); font-size: 14px; }
  .guide-filters button[aria-pressed="true"] { background: #fff; border-color: var(--border); color: var(--deep); font-weight: 700; }
  .section-heading { margin: 0 0 14px; }
  .section-heading h2 { font-size: 20px; }
  .section-heading p { font-size: 14px; margin-top: 5px; }
  .guide-card { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 18px; }
  .disease-list { padding: 0 18px; }
  .disease-item + .disease-item { border-top: 1px solid var(--border); }
  .disease-item > summary { min-height: 74px; display: flex; align-items: center; gap: 12px; padding: 18px 0; list-style: none; }
  .disease-item > summary::-webkit-details-marker { display: none; }
  .disease-item > summary > span { min-width: 0; flex: 1; }
  .disease-item > summary strong { display: block; font-size: 16px; }
  .disease-item > summary small { display: block; font-size: 14px; line-height: 1.7; color: var(--muted); margin-top: 5px; }
  .disease-item > summary::after { content: "+"; color: var(--muted); font-size: 21px; font-weight: 400; }
  .disease-item[open] > summary::after { content: "−"; }
  .disease-body { padding: 0 0 18px; }
  .guide-action { font-size: 15px; line-height: 1.8; }
  .guide-meta { font-size: 12px; color: var(--muted); line-height: 1.8; margin-top: 13px; }
  .guide-meta > div { display: flex; flex-wrap: wrap; gap: 2px 12px; }
  .guide-meta a { display: inline-block; color: var(--muted); text-decoration-thickness: 1px; text-underline-offset: 3px; padding-block: 4px; overflow-wrap: anywhere; }
  .text-action { min-height: 44px; background: none; border: 0; padding: 10px 0 0; color: var(--deep); font-weight: 700; font-size: 14px; text-align: left; }
  .text-action:hover { text-decoration: underline; text-underline-offset: 4px; }
  .guide-note { margin-top: 16px; border-radius: 14px; padding: 18px; background: #fdf6f7; }
  .guide-note h3 { font-size: 16px; margin-bottom: 8px; }
  .guide-note p { font-size: 15px; line-height: 1.8; }
  .guide-shortcuts { display: flex; flex-wrap: wrap; gap: 8px 22px; }
  .checkup-table { border-collapse: collapse; width: 100%; font-size: 14px; line-height: 1.7; text-align: left; }
  .checkup-table thead { background: #fdf6f7; }
  .checkup-table th, .checkup-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
  .checkup-table th:first-child { width: 40%; }
  .checkup-table tbody th { font-weight: 500; }
  .age-care-card { margin-bottom: 16px; }
  .age-care-card > p { margin: 8px 0 12px; font-size: 14px; }
  .age-care-table thead th:first-child { width: 50%; }
  .age-care-table tbody th { color: var(--deep); font-weight: 700; }
  .age-care-table tbody small { margin-inline-start: 5px; font-weight: 400; }
  .daily-list { padding: 0; margin: 0; list-style: none; }
  .daily-list li + li { margin-top: 18px; }
  .daily-list strong { font-size: 16px; }
  .daily-list p { color: var(--muted); font-size: 15px; line-height: 1.8; margin-top: 4px; }
  .guide-disclaimer { font-size: 12px; line-height: 1.8; color: var(--muted); margin: 22px 0 0; }
  .weight-trend { margin: 0 0 20px; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: #fff; }
  .weight-trend-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .weight-trend-heading h3 { font-size: 17px; line-height: 1.5; }
  .weight-chart-unit { color: var(--muted); font-size: 12px; }
  .weight-trend-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 15px 0 8px; }
  .weight-trend-stats > div { display: grid; gap: 3px; }
  .weight-trend-stats span { font-size: 12px; color: var(--muted); }
  .weight-trend-stats strong { font-size: 23px; line-height: 1.4; font-variant-numeric: tabular-nums; }
  .weight-trend-stats strong small { font-size: 13px; font-weight: 500; }
  .weight-chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
  .weight-chart-grid { stroke: var(--border); stroke-width: 1; }
  .weight-chart-label { fill: var(--muted); font-family: inherit; font-size: 11px; font-variant-numeric: tabular-nums; }
  .weight-chart-line { fill: none; stroke: var(--deep); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
  .weight-chart-hit { fill: transparent; }
  .weight-chart-dot { fill: #e3b1b6; stroke: var(--deep); stroke-width: 1.5; pointer-events: none; }
  [data-weight-point] { cursor: pointer; outline: none; }
  [data-weight-point][aria-pressed="true"] .weight-chart-dot { r: 6; stroke-width: 2.5; }
  [data-weight-point]:focus-visible .weight-chart-hit { fill: #fbf1f2; stroke: var(--deep); stroke-width: 1.5; }
  .weight-chart-selection { min-height: 24px; margin-top: 4px; font-size: 14px; color: var(--deep); font-variant-numeric: tabular-nums; }
  .weight-chart-note { margin-top: 8px; font-size: 12px; line-height: 1.7; color: var(--muted); }
  .weight-chart-empty { padding: 18px 0; font-size: 14px; line-height: 1.8; color: var(--muted); }
  @media (max-width: 350px) {
    .wrap { width: calc(100% - 28px); }
    .intro, .panel { padding-inline: 0; }
    .guide-card, .guide-urgent, .guide-note { padding: 15px; }
    .disease-list { padding-block: 0; }
    .dialog-content { padding: 16px; }
    .checkup-table th, .checkup-table td { padding-inline: 6px; }
  }
}

/* The health sheet uses the same A4 dimensions in preview and print. */
.health-summary-action { margin-top: 18px; }
.health-summary-help { margin-top: 6px; font-size: 12px; text-align: center; }
#print-dialog:has(.health-sheet) { width: min(100% - 24px, 760px); }
.preview:has(.health-sheet) { overflow-x: auto; }
.sheet.health-sheet { width: 178mm; max-width: none; padding: 0; background: #fff; color: #332b25; font-size: 9.5pt; line-height: 1.4; overflow-wrap: anywhere; }
.health-sheet p, .health-sheet h4 { font-size: inherit; line-height: inherit; }
.health-sheet h2 { margin: 1mm 0 0; font-size: 20pt; line-height: 1.25; color: #332b25; }
.health-summary-heading { display: flex; justify-content: space-between; gap: 6mm; padding-bottom: 3mm; border-bottom: 1px solid #b9a79d; }
.health-sheet .health-summary-brand { font-size: 9pt; font-weight: 700; letter-spacing: .03em; }
.health-sheet .health-summary-stamp { text-align: right; color: #65574d; font-size: 8.5pt; flex: none; }
.health-summary-pet { margin: 3mm 0; padding: 2.5mm 3mm; border: 1px solid #d9c2b8; border-radius: 3mm; }
.health-sheet h3 { margin: 0 0 1mm; font-size: 11.5pt; line-height: 1.35; color: #332b25; }
.health-summary-pet h3 { font-size: 14pt; }
.health-summary-weight { margin: 3mm 0 4mm; }
.health-summary-weight > h3 { display: flex; justify-content: space-between; }
.health-summary-weight > h3 > span { font-size: 9pt; font-weight: 400; }
.health-summary-weight-stats { display: flex; justify-content: space-between; gap: 4mm; margin: 1mm 0; }
.health-sheet .health-summary-scope { font-size: 8.5pt; color: #65574d; line-height: 1.4; }
.health-sheet .weight-chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.health-sheet .weight-chart-grid { stroke: #ddd5d0; stroke-width: 1; }
.health-sheet .weight-chart-label { fill: #55483e; font: 12px "Microsoft JhengHei", sans-serif; }
.health-sheet .weight-chart-line { fill: none; stroke: #4a382d; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.health-sheet .weight-chart-dot { fill: #fff; stroke: #4a382d; stroke-width: 1.5; }
.health-summary-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6mm; }
.health-summary-records { min-width: 0; }
.health-summary-records > h3 { padding-bottom: 1.5mm; border-bottom: 1px solid #b9a79d; }
.health-summary-record { margin-top: 2mm; padding-bottom: 2mm; border-bottom: 1px solid #ddd5d0; }
.health-summary-record h4 { margin: 0 0 1mm; font-weight: 700; }
.health-summary-record p + p { margin-top: .6mm; }
.health-sheet .health-summary-note { white-space: normal; overflow-wrap: anywhere; }
.health-summary-footer { margin-top: 4mm; padding-top: 2mm; border-top: 1px solid #b9a79d; }
.health-sheet .health-summary-footer p { font-size: 8.5pt; color: #65574d; }
@media print {
  .sheet.health-sheet { break-inside: avoid; }
  .health-summary-heading, .health-summary-pet, .health-summary-weight, .health-summary-record { break-inside: avoid; }
}
