/* 在宅傷口照護 PWA — mobile-first, high contrast, large touch targets (≥44pt) */
:root {
  --primary: #17899a;
  --primary-2: #0f6f7f;
  --primary-soft: #e3f3f5;
  --ink: #17323a;
  --ink-2: #4b6169;
  --ink-3: #7b8f96;
  --line: #dbe7ea;
  --bg: #f2f8f9;
  --card: #ffffff;
  --green: #23874a;   --green-bg: #e6f5ec;  --green-line: #b9e2c8;
  --yellow: #b77800;  --yellow-bg: #fff4d6; --yellow-line: #f5d37a; --yellow-dot: #f0a51a;
  --red: #d22f2f;     --red-bg: #fde8e8;    --red-line: #f3b5b5;
  --blue: #2a6fdb;    --blue-bg: #e8f0fd;
  --purple: #7b55c7;  --purple-bg: #f1ecfb;
  --radius: 18px;
  --shadow: 0 2px 10px rgba(23, 70, 80, .07);
  --nav-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Heiti TC", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 17px; line-height: 1.55; color: var(--ink);
  background: var(--bg); overflow-x: hidden; word-break: break-word; overflow-wrap: anywhere;
}
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
svg.ic { width: 22px; height: 22px; flex: none; vertical-align: -5px; }   /* default; specific contexts override below */
a { color: var(--primary-2); }
:focus-visible { outline: 3px solid #f0a51a; outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#app { max-width: 600px; margin: 0 auto; min-height: 100dvh; position: relative; overflow-x: clip; }
main.view {
  padding: calc(env(safe-area-inset-top) + 8px) 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px);
  min-height: 100dvh;
}
main.view.no-nav { padding-bottom: calc(env(safe-area-inset-bottom) + 24px); }

/* ---------- hero header ---------- */
.hero { position: relative; padding: 10px 0 14px; min-height: 120px; }
.hero::before {
  content: ""; position: absolute; inset: -60px -16px 0 -16px; z-index: -1;
  background: radial-gradient(120% 90% at 85% 10%, #d6eef1 0%, rgba(214,238,241,0) 60%), linear-gradient(#e8f5f6, var(--bg));
}
.hero .art { position: absolute; right: -8px; top: -4px; width: 46%; max-width: 220px; pointer-events: none; }
.hero h1 { font-size: 28px; line-height: 1.25; margin: 6px 0 2px; font-weight: 800; letter-spacing: .5px; max-width: 64%; }
.hero .sub { color: var(--ink-2); margin: 0; max-width: 62%; font-size: 16px; }
.hero .tagline { margin-top: 8px; color: var(--primary-2); font-size: 15px; max-width: 60%; }
.hero .logo { width: 72px; height: auto; }
.topbar { display: flex; align-items: center; gap: 8px; margin: 2px 0 4px; min-height: 44px; }
.topbar .title { font-size: 20px; font-weight: 800; flex: 1; min-width: 0; }
.back { width: 44px; height: 44px; border: 0; background: transparent; display: grid; place-items: center; color: var(--primary-2); border-radius: 12px; cursor: pointer; }
.back svg { width: 28px; height: 28px; }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin: 12px 0; border: 1px solid #e8f0f2; }
.card.tight { padding: 12px; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-h h2, .card-h h3 { margin: 0; font-size: 19px; font-weight: 800; flex: 1; min-width: 0; }
.card-h .meta { color: var(--ink-3); font-size: 14px; }
.card-h svg.ic { width: 26px; height: 26px; color: var(--primary-2); flex: none; }
.muted { color: var(--ink-3); }
.small { font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 480px) { .grid4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 380px) { .hero h1 { font-size: 25px; } }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 10px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }

/* stat tiles */
.stat { border-radius: 14px; padding: 10px 10px 12px; background: var(--primary-soft); display: flex; flex-direction: column; gap: 2px; min-height: 96px; cursor: pointer; border: 0; text-align: left; }
.stat .lbl { display: flex; gap: 6px; align-items: center; font-size: 14px; color: var(--ink-2); font-weight: 600; }
.stat .lbl svg { width: 20px; height: 20px; flex: none; }
.stat .val { font-size: 30px; font-weight: 800; line-height: 1.1; color: var(--ink); margin-top: auto; }
.stat .val small { font-size: 14px; font-weight: 600; color: var(--ink-2); margin-left: 2px; }
.stat.green { background: var(--green-bg); } .stat.yellow { background: var(--yellow-bg); } .stat.red { background: var(--red-bg); }
.stat.blue { background: var(--blue-bg); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 10px 18px;
  border-radius: 14px; border: 2px solid transparent; font-size: 18px; font-weight: 700; cursor: pointer; text-decoration: none;
  background: var(--primary-soft); color: var(--primary-2); width: 100%; text-align: center; line-height: 1.3;
}
.btn svg { width: 22px; height: 22px; flex: none; }
.btn.primary { background: linear-gradient(90deg, #22a0ae, var(--primary-2)); color: #fff; box-shadow: 0 4px 12px rgba(15,111,127,.25); }
.btn.outline { background: #fff; border-color: var(--primary); color: var(--primary-2); }
.btn.danger { background: var(--red); color: #fff; }
.btn.ghost { background: transparent; color: var(--primary-2); min-height: 44px; width: auto; padding: 6px 10px; font-size: 16px; }
.btn.sm { min-height: 44px; font-size: 16px; padding: 6px 12px; border-radius: 12px; }
.btn[disabled], .btn.loading { opacity: .55; pointer-events: none; }
.btn-row { display: flex; gap: 10px; } .btn-row > * { flex: 1; min-width: 0; }
.link { background: none; border: 0; color: var(--primary-2); font-weight: 700; text-decoration: underline; cursor: pointer; min-height: 44px; padding: 0 4px; font-size: 16px; }

/* quick tiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 84px; padding: 10px 4px;
  border-radius: 14px; background: var(--primary-soft); border: 0; cursor: pointer; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 15px; text-align: center; position: relative; }
.tile .ib { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #fff; }
.tile .ib svg { width: 22px; height: 22px; }
.tile.c-red { background: var(--red-bg); } .tile.c-red svg { color: var(--red); }
.tile.c-green { background: var(--green-bg); } .tile.c-green svg { color: var(--green); }
.tile.c-yellow { background: var(--yellow-bg); } .tile.c-yellow svg { color: var(--yellow); }
.tile.c-blue { background: var(--blue-bg); } .tile.c-blue svg { color: var(--blue); }
.tile.c-purple { background: var(--purple-bg); } .tile.c-purple svg { color: var(--purple); }
.tile .badge { position: absolute; top: 6px; right: 8px; }

/* ---------- forms ---------- */
.field { margin: 12px 0; }
.field > label, .field .label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 17px; }
.req { color: var(--red); margin-left: 2px; }
.input-wrap { display: flex; align-items: center; gap: 8px; border: 2px solid var(--line); border-radius: 14px; background: #fff; padding: 0 12px; min-height: 56px; }
.input-wrap:focus-within { border-color: var(--primary); }
.input-wrap svg { width: 24px; height: 24px; color: var(--ink-2); flex: none; }
.input-wrap input, .input-wrap select { border: 0; outline: 0; flex: 1; min-width: 0; min-height: 52px; background: transparent; font-size: 18px; }
.input, textarea.input, select.input { width: 100%; border: 2px solid var(--line); border-radius: 14px; padding: 12px; min-height: 52px; font-size: 18px; background: #fff; }
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { border-color: var(--primary); outline: 0; }
.hint { color: var(--ink-3); font-size: 14px; margin-top: 4px; }
.err { color: var(--red); font-size: 15px; font-weight: 600; margin-top: 4px; }
.field.invalid .input-wrap, .field.invalid .input, .field.invalid .seg { border-color: var(--red); }
.icon-btn { width: 44px; height: 44px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); border-radius: 10px; flex: none; }
.icon-btn svg { width: 24px; height: 24px; }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; cursor: pointer; padding: 6px 0; }
.check input { width: 26px; height: 26px; accent-color: var(--primary); margin: 0; flex: none; }

/* segmented choice */
.seg { display: flex; flex-wrap: wrap; gap: 8px; border-radius: 14px; border: 2px solid transparent; }
.seg button, .chip {
  min-height: 48px; padding: 8px 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff; cursor: pointer;
  font-weight: 700; font-size: 17px; flex: 1 1 auto; min-width: 64px; color: var(--ink);
}
.seg button[aria-pressed="true"], .chip[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-2); }
.seg.danger button[aria-pressed="true"] { border-color: var(--red); background: var(--red-bg); color: var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { flex: 0 1 auto; min-height: 44px; font-size: 16px; }

/* pain scale */
.pain { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; }
.pain button { min-height: 52px; border-radius: 10px; border: 2px solid var(--line); background: #fff; font-weight: 800; font-size: 17px; cursor: pointer; padding: 0; }
.pain button[aria-pressed="true"] { color: #fff; border-color: transparent; }
.pain-legend { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-3); margin-top: 4px; }
@media (max-width: 400px) { .pain { grid-template-columns: repeat(6, 1fr); } }

/* role tabs */
.roles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: #eef5f6; padding: 4px; border-radius: 16px; }
.roles button { min-height: 56px; border: 0; background: transparent; border-radius: 12px; font-weight: 700; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 4px; color: var(--ink-2); padding: 4px; flex-wrap: wrap; }
.roles button svg { width: 20px; height: 20px; }
.roles button[aria-pressed="true"] { background: linear-gradient(90deg, #22a0ae, var(--primary-2)); color: #fff; }

/* ---------- risk lights ---------- */
.light { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-weight: 800; font-size: 15px; white-space: nowrap; }
.light::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: currentColor; }
.light.green { color: var(--green); background: var(--green-bg); }
.light.yellow { color: var(--yellow); background: var(--yellow-bg); } .light.yellow::before { background: var(--yellow-dot); }
.light.red { color: var(--red); background: var(--red-bg); }
.light.retake, .light.none, .light.pending { color: var(--ink-2); background: #eef2f3; }
.lights { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lightbox { border-radius: 14px; padding: 10px 8px; text-align: center; border: 2px solid transparent; position: relative; }
.lightbox .t { font-weight: 800; font-size: 19px; display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.lightbox .d { font-size: 14px; color: var(--ink-2); }
.lightbox .dot { width: 22px; height: 22px; border-radius: 50%; display: inline-block; }
.lightbox.green { background: var(--green-bg); } .lightbox.green .t { color: var(--green); } .lightbox.green .dot { background: #2f9e5b; }
.lightbox.yellow { background: var(--yellow-bg); } .lightbox.yellow .t { color: var(--yellow); } .lightbox.yellow .dot { background: var(--yellow-dot); }
.lightbox.red { background: var(--red-bg); } .lightbox.red .t { color: var(--red); } .lightbox.red .dot { background: var(--red); }
.lightbox.on { border-color: currentColor; box-shadow: 0 4px 14px rgba(0,0,0,.08); transform: translateY(-2px); }
.lightbox.green.on { border-color: var(--green); } .lightbox.yellow.on { border-color: var(--yellow-dot); } .lightbox.red.on { border-color: var(--red); }
.lightbox.on::after { content: "目前"; position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: #fff; border: 2px solid currentColor; border-radius: 99px; font-size: 12px; padding: 0 8px; font-weight: 800; }
.lightbox.green.on::after { color: var(--green); } .lightbox.yellow.on::after { color: var(--yellow); } .lightbox.red.on::after { color: var(--red); }

.verdict { display: flex; align-items: center; gap: 12px; border-radius: 16px; padding: 14px; }
.verdict { flex-wrap: wrap; }
.verdict .big { font-size: 32px; font-weight: 900; line-height: 1.1; }
.verdict svg { width: 44px; height: 44px; flex: none; }
.verdict.green { background: var(--green-bg); color: var(--green); }
.verdict.yellow { background: var(--yellow-bg); color: var(--yellow); }
.verdict.red { background: var(--red-bg); color: var(--red); }
.verdict.retake, .verdict.none { background: #eef2f3; color: var(--ink-2); }
.verdict .txt { color: var(--ink); font-weight: 700; font-size: 16px; }
@media (max-width: 480px) { .verdict > svg { display: none; } }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.li-btn { display: flex; gap: 12px; align-items: center; width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; min-height: 56px; padding: 0; color: inherit; }
.li-main { flex: 1; min-width: 0; }
.li-title { font-weight: 800; font-size: 18px; }
.li-sub { color: var(--ink-2); font-size: 15px; }
.chev { width: 22px; height: 22px; color: var(--ink-3); flex: none; }
.bullet { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; }
.bullet svg { width: 22px; height: 22px; flex: none; margin-top: 2px; }

.status { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 14px; font-weight: 800; white-space: nowrap; max-width: 100%; }
.status.wrap, .chips .status { white-space: normal; border-radius: 12px; text-align: left; }
.status.done { background: var(--green-bg); color: var(--green); }
.status.pending { background: var(--blue-bg); color: var(--blue); }
.status.overdue { background: var(--red-bg); color: var(--red); }
.status.neutral { background: #eef2f3; color: var(--ink-2); }
.status.warn { background: var(--yellow-bg); color: var(--yellow); }
.badge { min-width: 22px; height: 22px; border-radius: 11px; padding: 0 6px; background: var(--red); color: #fff; font-size: 13px; font-weight: 800; display: inline-grid; place-items: center; }

.thumb { width: 96px; height: 76px; border-radius: 12px; object-fit: cover; background: #eadbd3; flex: none; }
.thumb.lg { width: 100%; height: auto; aspect-ratio: 1; max-height: 260px; }
.photo-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.photo-strip figure { margin: 0; flex: none; width: 116px; scroll-snap-align: start; cursor: pointer; }
.photo-strip img { width: 116px; height: 116px; border-radius: 12px; object-fit: cover; }
.photo-strip figcaption { font-size: 14px; text-align: center; color: var(--ink-2); margin-top: 4px; }

.banner { display: flex; gap: 10px; align-items: flex-start; border-radius: 14px; padding: 12px 14px; font-weight: 600; margin: 12px 0; }
.banner svg { width: 24px; height: 24px; flex: none; margin-top: 1px; }
.banner.info { background: var(--primary-soft); color: var(--primary-2); }
.banner.warn { background: var(--yellow-bg); color: #7d5200; }
.banner.danger { background: var(--red-bg); color: #9b1c1c; border: 2px solid var(--red-line); }
.banner.ok { background: var(--green-bg); color: #1b6b3a; }
.disclaimer { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 6px); z-index: 4; }

.empty { text-align: center; color: var(--ink-3); padding: 18px 8px; font-weight: 600; }
.skeleton { background: linear-gradient(90deg, #e8eff1 25%, #f4f8f9 50%, #e8eff1 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 14px; min-height: 96px; margin: 12px 0; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- bottom nav ---------- */
nav.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 600px; z-index: 20;
  background: rgba(255,255,255,.97); border-top: 1px solid var(--line); display: flex;
  padding-bottom: env(safe-area-inset-bottom); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
nav.tabbar a { flex: 1; min-height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--ink-3); font-size: 13px; font-weight: 700; position: relative; }
nav.tabbar a svg { width: 26px; height: 26px; }
nav.tabbar a[aria-current="page"] { color: var(--primary-2); }
nav.tabbar a .badge { position: absolute; top: 6px; left: calc(50% + 6px); }

/* ---------- sheets / modals / toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10,30,36,.5); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: #fff; width: 100%; max-width: 600px; border-radius: 22px 22px 0 0; padding: 18px 16px calc(env(safe-area-inset-bottom) + 18px); max-height: 90dvh; overflow: auto; animation: up .2s; }
.sheet h3 { margin: 0 0 10px; font-size: 20px; }
.overlay.center { align-items: center; padding: 16px; }
.overlay.center .sheet { border-radius: 22px; }
.lightbox-img { position: fixed; inset: 0; background: #000; z-index: 60; display: flex; flex-direction: column; }
.lightbox-img .zoomer { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; touch-action: pinch-zoom; }
.lightbox-img img { max-width: none; width: 100%; height: auto; }
.lightbox-img .bar { display: flex; justify-content: space-between; align-items: center; padding: calc(env(safe-area-inset-top) + 6px) 12px 8px; color: #fff; }
.lightbox-img .bar button { color: #fff; }
@keyframes fade { from { opacity: 0; } } @keyframes up { from { transform: translateY(30px); opacity: .4; } }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); z-index: 70; display: flex; flex-direction: column; gap: 8px; width: calc(100% - 32px); max-width: 560px; pointer-events: none; }
.toast { background: #17323a; color: #fff; border-radius: 14px; padding: 12px 16px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.2); animation: up .2s; }
.toast.error { background: #a32020; } .toast.ok { background: #1d7a43; }
.netbar { position: sticky; top: 0; z-index: 30; background: #5b4300; color: #fff; text-align: center; font-weight: 700; padding: calc(env(safe-area-inset-top) + 4px) 8px 4px; font-size: 15px; }

/* ---------- camera ---------- */
.cam { position: relative; border-radius: 18px; overflow: hidden; background: #0b1a1e; aspect-ratio: 3 / 4; max-height: 62dvh; margin: 0 auto; width: 100%; }
.cam video, .cam img.preview { width: 100%; height: 100%; object-fit: cover; }
.cam .frame { position: absolute; inset: 14% 12%; border: 3px dashed rgba(255,255,255,.9); border-radius: 22px; pointer-events: none; }
.cam .frame::after { content: "請將傷口置於框內"; position: absolute; bottom: -34px; left: 0; right: 0; text-align: center; color: #fff; font-weight: 700; text-shadow: 0 1px 3px #000; }
.cam .cross { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; transform: translate(-50%,-50%); pointer-events: none; }
.cam .cross::before, .cam .cross::after { content: ""; position: absolute; background: rgba(255,255,255,.85); }
.cam .cross::before { left: 14px; top: 0; width: 2px; height: 30px; } .cam .cross::after { top: 14px; left: 0; height: 2px; width: 30px; }
.cam .live-hint { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.cam .live-hint span { background: rgba(0,0,0,.6); color: #fff; padding: 4px 10px; border-radius: 99px; font-size: 14px; font-weight: 700; }
.cam .live-hint span.bad { background: rgba(196,40,40,.9); }
.cam .placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #cfe; text-align: center; padding: 20px; }
.shutter { width: 78px; height: 78px; border-radius: 50%; border: 5px solid #fff; background: var(--primary); box-shadow: 0 0 0 3px var(--primary); cursor: pointer; flex: none; }
.cam-controls { display: flex; align-items: center; justify-content: space-around; gap: 10px; margin: 14px 0; }
.shots { display: flex; gap: 10px; flex-wrap: wrap; }
.shot { position: relative; width: 96px; }
.shot img { width: 96px; height: 96px; border-radius: 12px; object-fit: cover; }
.shot .q { position: absolute; left: 4px; bottom: 4px; font-size: 12px; font-weight: 800; padding: 1px 6px; border-radius: 8px; background: rgba(255,255,255,.92); }
.shot .rm { position: absolute; top: -8px; right: -8px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--red); color: #fff; display: grid; place-items: center; cursor: pointer; }
.shot .rm svg { width: 18px; height: 18px; }
.shot .st { font-size: 13px; text-align: center; font-weight: 700; }
.progress { height: 8px; border-radius: 4px; background: #e2ecee; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); width: 0; transition: width .2s; }
.ring { --p: 0; width: 120px; height: 120px; border-radius: 50%; background: conic-gradient(var(--primary) calc(var(--p) * 1%), #e2ecee 0); display: grid; place-items: center; flex: none; }
.ring > div { width: 92px; height: 92px; border-radius: 50%; background: #fff; display: grid; place-items: center; text-align: center; line-height: 1.1; }
.ring b { font-size: 28px; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; padding-bottom: 150px; }
.msg { max-width: 84%; display: flex; flex-direction: column; gap: 2px; }
.msg .who { font-size: 13px; color: var(--ink-3); font-weight: 700; }
.msg .bubble { padding: 10px 14px; border-radius: 18px; background: #fff; box-shadow: var(--shadow); white-space: pre-wrap; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.me .bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 6px; }
.msg.them .bubble { border-bottom-left-radius: 6px; }
.msg.sys { align-self: center; max-width: 92%; }
.msg.sys .bubble { background: #e9f1f3; color: var(--ink-2); font-size: 15px; box-shadow: none; text-align: center; }
.msg .time { font-size: 12px; color: var(--ink-3); }
.msg.pending .bubble { opacity: .65; } .msg.failed .bubble { outline: 2px solid var(--red); }
.role-tag { display: inline-block; padding: 0 6px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-2); font-size: 12px; margin-left: 4px; }
.msg-card { background: #fff; border-radius: 16px; padding: 12px; border: 2px solid var(--line); color: var(--ink); min-width: 230px; }
.msg-card.advice { border-color: var(--green-line); background: #f6fcf8; }
.msg-card.appt { border-color: #c6d8fb; background: #f5f8ff; }
.composer { position: fixed; left: 50%; transform: translateX(-50%); width: 100%; max-width: 600px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); padding: 8px 10px; z-index: 15; }
.composer .row { gap: 6px; }
.composer textarea { flex: 1; min-height: 48px; max-height: 120px; border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; resize: none; font-size: 17px; }
.quickq { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.quickq button { flex: none; min-height: 40px; border-radius: 99px; border: 1px solid var(--primary); background: #fff; color: var(--primary-2); font-weight: 700; padding: 4px 12px; font-size: 15px; cursor: pointer; }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--ink-3); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.kpi { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.kpi b { font-size: 34px; line-height: 1; }
.trend-up { color: var(--green); } .trend-down { color: var(--red); } .trend-flat { color: var(--ink-2); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; background: #e6f0f2; border-radius: 14px; padding: 4px; margin: 10px 0; overflow-x: auto; }
.tabs button { flex: 1 0 auto; min-height: 44px; border: 0; background: transparent; border-radius: 10px; font-weight: 700; font-size: 16px; cursor: pointer; color: var(--ink-2); padding: 4px 10px; }
.tabs button[aria-selected="true"] { background: #fff; color: var(--primary-2); box-shadow: var(--shadow); }

/* ---------- exercises ---------- */
.ex-img { width: 100%; border-radius: 16px; background: #f4efe8; aspect-ratio: 16 / 10; object-fit: cover; }
.steps { list-style: none; padding: 0; margin: 12px 0; counter-reset: s; }
.steps li { display: flex; gap: 12px; align-items: center; font-size: 19px; font-weight: 700; margin: 10px 0; }
.steps li::before { counter-increment: s; content: counter(s); width: 38px; height: 38px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; flex: none; font-weight: 800; }
.counter { display: flex; align-items: center; justify-content: center; gap: 14px; background: var(--blue-bg); border-radius: 16px; padding: 14px; font-size: 20px; font-weight: 800; }
.counter .n { font-size: 52px; color: var(--blue); line-height: 1; min-width: 60px; text-align: center; }
.counter button { width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--blue); background: #fff; color: var(--blue); cursor: pointer; display: grid; place-items: center; }
.counter button svg { width: 26px; height: 26px; }
.timer { font-size: 40px; font-weight: 900; text-align: center; color: var(--blue); font-variant-numeric: tabular-nums; }

/* ---------- flow (14) ---------- */
.flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 6px; align-items: stretch; }
.flow .stage { background: #fff; border-radius: 16px; border: 2px solid var(--line); padding: 10px 8px; text-align: center; display: flex; flex-direction: column; gap: 6px; }
.flow .stage .no { width: 34px; height: 34px; border-radius: 50%; background: var(--purple); color: #fff; font-weight: 900; display: grid; place-items: center; margin: 0 auto; }
.flow .arrow { align-self: center; color: var(--primary); font-size: 26px; font-weight: 900; }
.flow .mini { font-size: 13px; color: var(--ink-2); text-align: left; }
.flow .io { font-size: 12px; background: #f3f7f8; border-radius: 8px; padding: 4px 6px; text-align: left; }
@media (max-width: 460px) { .flow { grid-template-columns: 1fr; } .flow .arrow { transform: rotate(90deg); justify-self: center; } }

.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; } .center { text-align: center; }
.hidden { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (min-width: 700px) { body { background: #e6f0f2; } #app { background: var(--bg); box-shadow: 0 0 40px rgba(0,0,0,.06); } }

/* =================== mockup-faithful components (v1.2) =================== */
.hero { padding: 14px 0 10px; min-height: 170px; }
.hero .art { width: 48%; max-width: 240px; right: -10px; top: -6px; }
.hero h1 { font-size: 31px; color: #133b44; letter-spacing: 1px; }
.hero .sub { font-size: 17px; color: #3f5a61; font-weight: 600; }
.hero .hand, .hand {
  display: inline-block; margin-top: 10px; color: #2b4d55; font-size: 16px; line-height: 1.55; transform: rotate(-3deg);
  font-family: "Kaiti TC", "BiauKai", "STKaiti", "DFKai-SB", "Klee", "Yuji Syuku", cursive; font-style: italic;
  padding-bottom: 6px; position: relative; max-width: 62%;
}
.hand::after { content: ""; position: absolute; left: 4%; right: -6%; bottom: -2px; height: 8px;
  border-bottom: 3px solid #5cc0bd; border-radius: 0 0 60% 40% / 0 0 100% 100%; opacity: .8; }
.pagehead { display: grid; grid-template-columns: 44px 1fr 72px; align-items: center; min-height: 64px; margin-bottom: 6px; }
.pagehead h1 { margin: 0; text-align: center; font-size: 25px; color: #133b44; font-weight: 800; }
.pagehead img { width: 72px; justify-self: end; }
.sheetcard { background: #fff; border-radius: 22px; padding: 14px; box-shadow: 0 4px 18px rgba(20,80,90,.08); border: 1px solid #e6f0f2; }
.sec-h { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; }
.sec-h .ib { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-soft); display: grid; place-items: center; color: var(--primary-2); flex: none; }
.sec-h .ib svg { width: 22px; height: 22px; }
.sec-h h2, .sec-h h3 { margin: 0; font-size: 20px; font-weight: 800; flex: 1; }
.sec-h .meta { color: var(--ink-3); font-size: 13px; }

/* 相關畫面 row */
.related { border: 1.5px solid #cfe6ea; border-radius: 18px; padding: 10px; margin: 12px 0; background: #fbfefe; }
.related .rh { display: flex; align-items: center; gap: 6px; font-weight: 800; color: #134a55; margin-bottom: 8px; }
.related .rh svg { width: 18px; height: 18px; color: var(--primary); }
.related .rl { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.related a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 76px; border-radius: 14px;
  text-decoration: none; color: #17323a; font-weight: 700; font-size: 14px; text-align: center; padding: 6px 2px; position: relative; }
.related a svg { width: 26px; height: 26px; }
.related a .badge { position: absolute; top: 4px; right: 6px; }
.rc-teal { background: #e4f4f3; } .rc-teal svg { color: #138a8a; }
.rc-blue { background: #e7f0fd; } .rc-blue svg { color: #2a6fdb; }
.rc-purple { background: #efe9fb; } .rc-purple svg { color: #6b46c1; }
.rc-red { background: #fde9e9; } .rc-red svg { color: #e0453b; }
.rc-green { background: #e5f5ea; } .rc-green svg { color: #23874a; }
.rc-orange { background: #fff1e0; } .rc-orange svg { color: #e07a12; }

/* home lights with chevrons (02) */
.lights3 { display: grid; grid-template-columns: 1fr 14px 1fr 14px 1fr; align-items: stretch; gap: 2px; }
.lights3 .chev2 { align-self: center; color: var(--ink-3); width: 14px; height: 14px; }
.lightbox.on { transform: none; }
.lightbox.on.yellow { box-shadow: 0 0 0 2px var(--yellow-dot) inset, 0 6px 14px rgba(240,165,26,.2); }
.lightbox.on.green { box-shadow: 0 0 0 2px #2f9e5b inset; } .lightbox.on.red { box-shadow: 0 0 0 2px var(--red) inset; }
.lightbox.on::after { display: none; }
.lightbox .badgeon { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); background: #fff; color: inherit; border: 2px solid currentColor; border-radius: 99px; font-size: 11px; padding: 0 7px; font-weight: 800; }
.statrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.statrow .stat { min-height: 104px; padding: 10px 8px; }
.statrow .stat .val { font-size: 32px; }
@media (max-width: 400px) { .statrow { gap: 6px; } .statrow .stat { padding: 8px 6px; } .statrow .stat .val { font-size: 26px; } .statrow .stat .lbl { font-size: 13px; } }
.actions3 { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 8px; margin: 12px 0; }
.actions3 .btn { font-size: 16px; min-height: 52px; padding: 6px; }

/* capture (03) */
.tipbar { display: flex; gap: 12px; align-items: center; background: #e8f6f1; border-radius: 16px; padding: 10px 12px; margin-bottom: 10px; }
.tipbar img { width: 44px; height: 44px; }
.tipbar b { font-size: 17px; color: #134a55; } .tipbar .dots { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; color: #2b4d55; }
.tipbar .dots span::before { content: "●"; color: #23a596; margin-right: 6px; font-size: 10px; vertical-align: 2px; }
.cam .corners { position: absolute; inset: 7% 22%; pointer-events: none; }
.cam .corners i { position: absolute; width: 44px; height: 44px; border: 4px solid #fff; }
.cam .corners i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 14px; }
.cam .corners i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 14px; }
.cam .corners i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 14px; }
.cam .corners i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 14px; }
.cam { aspect-ratio: 16 / 10; }
.shots3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shots3 .shot, .shots3 .slot { width: auto; }
.shots3 .shot img { width: 100%; height: 100px; }
.shots3 .slot { border: 2px dashed #c8d8dc; border-radius: 14px; min-height: 100px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--ink-2); font-size: 14px; gap: 4px; cursor: pointer; background: #fbfdfd; }
.shots3 .slot svg { width: 34px; height: 34px; }
.frow { display: grid; grid-template-columns: 30px 92px 1fr; align-items: center; gap: 8px; background: #f6f9fa; border-radius: 14px; padding: 6px 10px; margin: 8px 0; }
.frow svg { width: 24px; height: 24px; color: #33515a; } .frow label { font-weight: 700; color: #2b4d55; }
.frow .input { min-height: 46px; padding: 8px 10px; font-size: 17px; }
.frow.col { grid-template-columns: 30px 1fr; } .frow.col > div { grid-column: 2; }

/* symptoms (04) */
.painrow { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; }
.painrow button { aspect-ratio: 1; border-radius: 50%; border: 1px solid #d5e2e5; background: #f6f9fa; font-weight: 700; font-size: 17px; cursor: pointer; padding: 0; min-height: 30px; }
.painrow button[aria-pressed="true"] { background: var(--primary-2); color: #fff; border-color: var(--primary-2); transform: scale(1.12); box-shadow: 0 3px 8px rgba(15,111,127,.3); }
.painnow { background: #e6f4f1; color: #155f66; border-radius: 12px; text-align: center; padding: 8px; font-weight: 800; margin-top: 10px; }
.symgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.symgrid button { position: relative; border: 1.5px solid #d5e2e5; background: #fff; border-radius: 14px; min-height: 86px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-weight: 700; font-size: 15px; cursor: pointer; padding: 4px; }
.symgrid button img { width: 34px; height: 34px; object-fit: contain; }
.symgrid button::after { content: ""; position: absolute; top: 6px; right: 6px; width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid #c9d6d9; background: #fff; }
.symgrid button[aria-pressed="true"] { border-color: var(--primary); background: #eef8f9; }
.symgrid button[aria-pressed="true"]::after { background: var(--primary-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7'/%3E%3C/svg%3E") center/12px no-repeat; border-color: var(--primary-2); }
.symdetail { background: #f7fbfb; border-radius: 14px; padding: 4px 12px; margin-top: 8px; }
.symdetail .field { margin: 8px 0; }
.symdetail .seg button { min-height: 42px; font-size: 15px; padding: 4px 8px; }
.tworadio { display: grid; grid-template-columns: 1fr 1fr; border: 1.5px solid #d5e2e5; border-radius: 14px; overflow: hidden; }
.tworadio button { min-height: 50px; border: 0; background: #fff; font-weight: 700; font-size: 17px; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; color: var(--ink-2); }
.tworadio button::before { content: ""; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #c9d6d9; }
.tworadio button[aria-pressed="true"] { background: #eaf6f7; color: var(--primary-2); box-shadow: 0 0 0 2px var(--primary) inset; border-radius: 14px; }
.tworadio button[aria-pressed="true"]::before { border-color: var(--primary-2); background: var(--primary-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7'/%3E%3C/svg%3E") center/13px no-repeat; }
.inforow { display: flex; gap: 12px; align-items: center; background: #e8f5ee; border-radius: 16px; padding: 12px; margin: 12px 0; }
.inforow img { width: 46px; } .inforow b { color: #155f3c; font-size: 17px; } .inforow div { font-size: 14px; color: #33515a; }
.counttxt { text-align: right; font-size: 13px; color: var(--ink-3); margin-top: -4px; }

/* analysis (05) */
.ana-top { display: grid; grid-template-columns: 42% 1fr; gap: 10px; }
.ana-top .photo { position: relative; } .ana-top .photo img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 16px; }
.ana-top .zoom { position: absolute; right: 8px; bottom: 8px; width: 40px; height: 40px; border-radius: 50%; background: rgba(40,40,40,.65); color: #fff; display: grid; place-items: center; border: 0; }
.verdict2 { background: #fff7e0; border-radius: 16px; padding: 10px; } .verdict2 .t { font-weight: 800; font-size: 14px; margin-bottom: 6px; }
.verdict2 .pill { display: flex; align-items: center; gap: 8px; background: #ffe7a6; border-radius: 99px; padding: 6px 12px; }
.verdict2 .pill b { font-size: 28px; color: #b46b00; } .verdict2 .pill span { font-weight: 800; font-size: 17px; }
.verdict2.green { background: #e9f7ee; } .verdict2.green .pill { background: #c7ecd4; } .verdict2.green .pill b { color: var(--green); }
.verdict2.red { background: #fdecec; } .verdict2.red .pill { background: #f9c9c9; } .verdict2.red .pill b { color: var(--red); }
.verdict2.retake, .verdict2.none { background: #f0f3f4; } .verdict2.retake .pill, .verdict2.none .pill { background: #e0e6e8; } .verdict2.retake .pill b { color: var(--ink-2); font-size: 22px; }
.keypts { background: #eef6fb; border-radius: 16px; padding: 10px; margin-top: 8px; } .keypts .t { font-weight: 800; font-size: 14px; }
.riskbar { display: grid; grid-template-columns: 1fr 1fr 1fr; border-radius: 99px; overflow: visible; }
.riskbar div { text-align: center; padding: 8px 2px; font-weight: 800; position: relative; }
.riskbar .g { background: #e3f4e8; color: var(--green); border-radius: 99px 0 0 99px; }
.riskbar .y { background: #fff3d1; color: #a86e00; } .riskbar .r { background: #fde3e3; color: var(--red); border-radius: 0 99px 99px 0; }
.riskbar .on { box-shadow: 0 0 0 2.5px #f0a51a inset; border-radius: 12px; background: #ffe9a8; }
.riskbar .on.g { box-shadow: 0 0 0 2.5px #2f9e5b inset; background: #cdeed8; } .riskbar .on.r { box-shadow: 0 0 0 2.5px var(--red) inset; background: #f9caca; }
.riskbar .on::before { content: "▼"; position: absolute; top: -18px; left: 50%; transform: translateX(-50%); color: #f0a51a; font-size: 14px; }
.riskbar .on.g::before { color: #2f9e5b; } .riskbar .on.r::before { color: var(--red); }
.risklbl { display: grid; grid-template-columns: 1fr 1fr 1fr; text-align: center; font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.cmp2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cmp2 > div { background: #fff; border-radius: 14px; padding: 10px; border: 1px solid #e3eef1; }
.cmp2 .v { font-size: 26px; font-weight: 900; } .cmp2 .v.bad { color: var(--red); } .cmp2 .v.good { color: var(--green); }
.footnote { display: flex; gap: 8px; align-items: center; justify-content: center; background: #eaf5ef; border-radius: 14px; padding: 10px; font-weight: 700; color: #27583c; margin: 12px 0; }
.footnote img { width: 22px; }

/* history (06) */
.phase3 { display: grid; grid-template-columns: 1fr 14px 1fr 14px 1fr; gap: 2px; align-items: start; }
.phase3 figure { margin: 0; cursor: pointer; text-align: center; }
.phase3 .ph { position: relative; } .phase3 .ph img { width: 100%; aspect-ratio: 1 / 0.9; object-fit: cover; border-radius: 12px; }
.phase3 .date { position: absolute; top: 6px; left: 6px; background: rgba(90,100,110,.75); color: #fff; font-weight: 800; border-radius: 99px; padding: 1px 10px; font-size: 14px; }
.phase3 figure:last-of-type .date { background: #138a8a; }
.phase3 .zoom { position: absolute; right: 6px; bottom: 6px; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.85); display: grid; place-items: center; color: #33515a; }
.phase3 .zoom svg { width: 18px; height: 18px; }
.phase3 b { display: block; margin-top: 6px; } .phase3 small { color: var(--ink-2); font-size: 13px; }
.phase3 .chev2 { align-self: center; color: var(--ink-3); margin-top: -40px; }
.trend3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.trend3 > div { border: 1px solid #e3eef1; border-radius: 14px; padding: 8px 6px; background: #fff; }
.trend3 .h { display: flex; align-items: center; gap: 6px; font-weight: 800; justify-content: center; }
.trend3 .h .ib { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; }
.trend3 .h .ib svg { width: 18px; height: 18px; }
.trend3 .tag { text-align: center; border-radius: 10px; padding: 4px; font-weight: 800; font-size: 14px; margin-top: 4px; }
.overall { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; background: #ecf7f5; border-radius: 16px; padding: 12px; margin-top: 10px; }
.overall b.big { color: #138a8a; font-size: 22px; }

/* tasks (07) */
.taskhead { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.datebox { background: #e9f4f7; border-radius: 14px; padding: 8px 12px; text-align: center; font-weight: 700; color: #134a55; }
.tlist { border: 1px solid #e3eef1; border-radius: 16px; padding: 4px 10px; background: #fff; }
.tlist li { display: grid; grid-template-columns: 30px 58px 30px 1fr auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid #edf3f4; }
.tlist li:last-child { border-bottom: 0; }
.tlist .cb { width: 26px; height: 26px; border-radius: 6px; border: 2px solid #9fb4b9; display: grid; place-items: center; background: #fff; cursor: pointer; padding: 0; }
.tlist .cb.on { background: var(--primary-2); border-color: var(--primary-2); color: #fff; }
.tlist .cb svg { width: 18px; height: 18px; }
.tlist .tm { font-weight: 700; font-size: 17px; white-space: nowrap; } .tlist .ti svg { width: 26px; height: 26px; color: #134a55; }
.tlist .tt b { display: block; font-size: 17px; } .tlist .tt small { color: var(--ink-2); font-size: 13px; }
.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 10px; padding: 4px 10px; font-weight: 800; font-size: 14px; white-space: nowrap; border: 0; }
.pill svg { width: 16px; height: 16px; }
.pill.done { background: #e3f4e8; color: var(--green); } .pill.todo { background: #e6f1fb; color: #2a6fdb; } .pill.late { background: var(--red-bg); color: var(--red); }
a.pill, button.pill { cursor: pointer; text-decoration: none; }
.remind { display: flex; gap: 12px; align-items: center; background: #fff5d9; border-radius: 16px; padding: 12px; margin: 12px 0; }
.remind .ib { width: 44px; height: 44px; border-radius: 50%; background: #ffe39a; display: grid; place-items: center; color: #b46b00; flex: none; }
.edu { background: #e8f3f8; border-radius: 16px; padding: 12px; }
.edu .eb { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.edu .eb button { background: #fff; border: 0; border-radius: 12px; min-height: 52px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; font-size: 15px; color: #17323a; }
.edu .eb svg { width: 22px; height: 22px; color: #1d7fa6; }

/* chat (08) */
.chat2 { display: flex; flex-direction: column; gap: 14px; padding: 6px 0 200px; }
.cm { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: start; max-width: 92%; }
.cm .av { width: 52px; height: 52px; border-radius: 50%; }
.cm .bb { background: #fff; border: 1px solid #dfe9ec; border-radius: 18px; padding: 10px 14px; white-space: pre-wrap; box-shadow: 0 2px 6px rgba(0,0,0,.03); }
.cm .tm { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.cm .who { font-size: 12px; color: var(--ink-3); font-weight: 700; margin-bottom: 2px; }
.cm.staff { grid-template-columns: 1fr 52px; align-self: flex-end; }
.cm.staff .av { grid-column: 2; grid-row: 1; } .cm.staff > div { grid-column: 1; grid-row: 1; text-align: left; }
.cm.staff .bb { background: #e3f1fa; border-color: #cfe4f2; }
.cm.staff .tm, .cm.staff .who { text-align: right; }
.cm img.ph { width: 220px; max-width: 100%; border-radius: 14px; border: 4px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.cm.pending .bb { opacity: .6; }
.sysmsg { align-self: center; background: #e9f1f3; color: var(--ink-2); border-radius: 12px; padding: 6px 12px; font-size: 14px; text-align: center; max-width: 92%; }
.apptcard { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; background: #e8f4ef; border-radius: 18px; padding: 10px 12px; border: 1px solid #d5ebe2; }
.apptcard img { width: 64px; } .apptcard .d { font-size: 18px; font-weight: 900; color: #134a55; }
.advbar { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; background: #fbf6dc; border-radius: 14px; padding: 10px 12px; }
.advbar img { width: 36px; }
.chatbtns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.chatbtns > * { min-height: 44px; border-radius: 12px; background: #e6f1f8; border: 0; display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 800; color: #134a55; text-decoration: none; font-size: 15px; cursor: pointer; }
.chatbtns svg { width: 20px; height: 20px; color: #1d7fa6; }
.inputbar { display: grid; grid-template-columns: 1fr 52px; gap: 8px; align-items: end; }
.inputbar .box { display: flex; align-items: center; gap: 6px; border: 1.5px solid #d5e2e5; border-radius: 26px; padding: 2px 6px; background: #fff; }
.inputbar textarea { border: 0; outline: 0; flex: 1; resize: none; min-height: 44px; max-height: 120px; padding: 10px 4px; font-size: 17px; background: transparent; }
.inputbar .send { width: 52px; height: 52px; border-radius: 50%; border: 0; background: linear-gradient(135deg, #22a0ae, var(--primary-2)); color: #fff; display: grid; place-items: center; cursor: pointer; }
.inputbar .send svg { width: 24px; height: 24px; }

/* rehab blue style (11-13) */
.numhead { display: flex; align-items: center; gap: 0; margin: 4px 0 12px; }
.numhead .no { width: 56px; height: 56px; border-radius: 50%; background: #6c2bb8; color: #fff; font-weight: 900; font-size: 26px; display: grid; place-items: center; z-index: 1; flex: none; box-shadow: 0 0 0 3px #fff; }
.numhead h1 { margin: 0 0 0 -14px; flex: 1; background: linear-gradient(90deg, #1255c7, #1c6fe0); color: #fff; font-size: 24px; font-weight: 900; border-radius: 0 14px 14px 0; padding: 8px 14px 8px 26px; letter-spacing: 1px; }
.numhead .back { margin-right: 4px; }
.numhead2 { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; }
.numhead2 .no { width: 44px; height: 44px; border-radius: 50%; background: #6c2bb8; color: #fff; font-weight: 900; font-size: 20px; display: grid; place-items: center; flex: none; }
.numhead2 h1 { margin: 0; flex: 1; font-size: 24px; color: #0e2a6b; font-weight: 900; }
.numhead2 .pg { color: #1b2c55; font-weight: 700; }
.btabs { display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); gap: 8px; margin-bottom: 12px; }
.btabs button { min-height: 50px; border: 0; border-radius: 14px; background: #eef3fb; font-weight: 800; font-size: 16px; color: #1b2c55; cursor: pointer; }
.btabs button[aria-selected="true"] { background: #1565d8; color: #fff; }
.excard { display: grid; grid-template-columns: 112px 1fr auto; gap: 12px; align-items: center; background: #fff; border: 1px solid #e5ebf5; border-radius: 18px; padding: 10px; margin-bottom: 10px; box-shadow: 0 2px 8px rgba(20,50,120,.04); }
.excard img { width: 112px; height: 84px; object-fit: cover; border-radius: 12px; }
.excard b { font-size: 19px; color: #0e2a6b; display: block; } .excard span.m { color: #3c4d6e; font-size: 16px; }
.bbtn { min-height: 48px; border: 0; border-radius: 12px; background: #1565d8; color: #fff; font-weight: 800; font-size: 17px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.bbtn.ok { background: #e3f6e8; color: #1f8a46; } .bbtn.ok svg { width: 22px; height: 22px; }
.bbtn.outline { background: #fff; color: #1b2c55; border: 1.5px solid #c9d6ea; }
.bbtn.off { background: #eef1f5; color: #7a8699; }
.bsteps li::before { background: #1565d8; }
.bcounter { display: flex; align-items: baseline; justify-content: center; gap: 12px; background: #eef4fd; border-radius: 16px; padding: 16px; font-weight: 800; font-size: 20px; color: #0e2a6b; }
.bcounter .n { font-size: 52px; color: #1565d8; }
.kpic { display: grid; grid-template-columns: 54px 1fr; gap: 12px; background: #fff; border: 1px solid #e5ebf5; border-radius: 18px; padding: 14px; margin-bottom: 12px; align-items: start; }
.kpic .ki { width: 54px; height: 54px; display: grid; place-items: center; }
.kpic .ki svg { width: 46px; height: 46px; }
.kpic h3 { margin: 0; font-size: 20px; color: #0e2a6b; } .kpic .big { font-size: 30px; font-weight: 900; color: #0e2a6b; }
.kpic .vs { color: #3c4d6e; font-weight: 700; } .kpic .vs b.up { color: #1f9a4a; } .kpic .vs b.down { color: #1f9a4a; } .kpic .vs b.warn { color: var(--red); }
.kpic .split { display: grid; grid-template-columns: 1fr 1.1fr; gap: 8px; align-items: end; }
.gbar { height: 16px; border-radius: 99px; background: #e8edf3; overflow: hidden; margin: 8px 0; } .gbar i { display: block; height: 100%; background: #1fbf5f; border-radius: 99px; }
.wbars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; align-items: end; height: 96px; }
.wbars i { display: block; background: linear-gradient(#56b4f5, #2196f3); border-radius: 3px 3px 0 0; min-height: 3px; }
.wbars i.none { background: #e6edf3; }
.wlbl { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; font-size: 11px; color: #3c4d6e; text-align: center; margin-top: 3px; }
body.blue nav.tabbar a[aria-current="page"] { color: #1565d8; }
body.blue nav.tabbar a[aria-current="page"] svg { background: #1565d8; color: #fff; border-radius: 8px; padding: 3px; }

/* =================== density pass: match mockup proportions =================== */
body { font-size: 15px; }
main.view { padding-left: 14px; padding-right: 14px; }
.card { padding: 12px; margin: 10px 0; border-radius: 16px; }
.card.tight { padding: 10px; }
.sec-h { margin: 0 0 8px; } .sec-h h2, .sec-h h3, .card-h h2, .card-h h3 { font-size: 17px; }
.sec-h svg.ic, .card-h svg.ic { width: 24px; height: 24px; color: var(--primary-2); }
.sec-h .meta, .card-h .meta { font-size: 13px; }
.sec-h .chev { width: 18px; height: 18px; }
.btn { font-size: 16px; min-height: 48px; border-radius: 12px; }
.btn.sm { min-height: 44px; font-size: 14px; }
.input, textarea.input, select.input, .input-wrap input, .input-wrap select { font-size: 16px; }
.field > label, .field .label { font-size: 15px; }
.li-title { font-size: 16px; } .li-sub { font-size: 14px; }
.light { font-size: 13px; padding: 3px 10px; } .light::before { width: 10px; height: 10px; }
.status { font-size: 13px; }
.banner { font-size: 14px; padding: 10px 12px; }
.small { font-size: 13px; }
/* hero */
.hero { min-height: 150px; padding: 8px 0 6px; }
.hero h1 { font-size: 27px; } .hero .sub { font-size: 15px; } .hero .hand { font-size: 15px; }
.hero .logo { width: 62px; }
.hero.inline .titlebox { display: grid; grid-template-columns: 74px 1fr; column-gap: 8px; align-items: center; max-width: 66%; }
.hero.inline .logo { width: 74px; grid-row: span 2; }
.hero.inline h1 { max-width: none; margin: 0; font-size: 25px; }
.hero.inline .sub { max-width: none; margin: 0; }
.hero.inline .tag2 { color: var(--ink-2); font-size: 15px; margin: 8px 0 0; letter-spacing: 1px; }
/* stats */
.statrow .stat { min-height: 96px; align-items: center; text-align: center; }
.statrow .stat .lbl { font-size: 13px; justify-content: center; white-space: nowrap; }
.statrow .stat .lbl svg { width: 22px; height: 22px; }
.statrow .stat .val { font-size: 30px; margin-top: 6px; white-space: nowrap; }
.statrow .stat .val small { font-size: 12px; }
@media (max-width: 400px) { .statrow .stat .lbl { font-size: 12px; } .statrow .stat .lbl svg { width: 18px; height: 18px; } .statrow .stat .val { font-size: 24px; } }
/* lights */
.lightbox { padding: 10px 4px; } .lightbox .t { font-size: 17px; } .lightbox .d { font-size: 12.5px; line-height: 1.45; }
.lightbox .dot { width: 22px; height: 22px; }
/* related chips (horizontal, mockup 02/06) */
.related.chips4 .rl a { flex-direction: row; min-height: 44px; font-size: 13px; gap: 3px; padding: 4px; }
.related.chips4 .rl a svg { width: 22px; height: 22px; }
.related.chips4 .rl a::after { content: "›"; font-size: 18px; color: var(--ink-3); margin-left: 2px; }
.related { padding: 8px; } .related a { min-height: 66px; font-size: 13px; }
.actions3 .btn { font-size: 15px; min-height: 48px; }
.actions3 .btn svg { width: 22px; height: 22px; }
nav.tabbar a { font-size: 12px; } nav.tabbar a svg { width: 24px; height: 24px; }
.thumb { border-radius: 10px; }
.hero .art { z-index: 0; } .hero h1, .hero .sub, .hero .titlebox, .hero .tag2, .hero .hand { position: relative; z-index: 1; }
.hero.inline .art { width: 40%; max-width: 200px; }
.statrow .stat.green .lbl svg { color: #138a8a; } .statrow .stat.blue .lbl svg { color: #2a6fdb; }
.statrow .stat.yellow .lbl svg { color: #f0a51a; } .statrow .stat .lbl svg { color: #1d6f86; }
.alertline { display: flex; align-items: center; gap: 6px; color: var(--red); font-weight: 700; font-size: 14px; margin-top: 8px; text-decoration: none; }
.alertline svg { width: 18px; height: 18px; }
/* overall scale to match mockup density; minimum heights raised so touch targets stay >= 44px after scaling */
#app { zoom: .9; }
.btn { min-height: 52px; } .btn.sm { min-height: 50px; } .icon-btn, .back { width: 50px; height: 50px; }
.seg button, .chip { min-height: 50px; } .tworadio button { min-height: 52px; white-space: nowrap; font-size: 16px; }
.painrow { gap: 3px; } .painrow button { font-size: 15px; min-height: 0; }
.pagehead h1 { font-size: 24px; }
.tipbar .dots { font-size: 14px; }
.symgrid button { min-height: 84px; font-size: 15px; }
.symgrid button img { width: 32px; height: 32px; }
nav.tabbar a { min-height: 70px; }
.ana-top { align-items: start; }
.overall > span svg { width: 40px; height: 40px; } .overall > div:nth-child(2) { min-width: 0; }
.tlist .tm { font-size: 15px; } .tlist .tt b { font-size: 15px; } .tlist .tt small { font-size: 12px; display: block; line-height: 1.35; }
.tlist .ti svg { width: 22px; height: 22px; } .tlist li { grid-template-columns: 28px 50px 26px 1fr auto; gap: 6px; padding: 8px 0; }
.cm .who { display: none; } .cm .bb { font-size: 15px; }
/* alerts (09) */
.flow4 { display: flex; align-items: flex-start; justify-content: space-between; text-align: center; gap: 2px; }
.flow4 > div { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.flow4 .ci { width: 46px; height: 46px; border-radius: 50%; background: #dff0f6; display: grid; place-items: center; color: #1d6f86; }
.flow4 .ci svg { width: 26px; height: 26px; }
.flow4 b { font-size: 14px; } .flow4 small { font-size: 11.5px; color: var(--ink-2); line-height: 1.35; }
.flow4 .ar { color: #1d6f86; font-weight: 900; margin-top: 12px; }
.acard { background: #fff; border-radius: 16px; padding: 12px 12px 12px 16px; margin: 10px 0; box-shadow: var(--shadow); border: 1px solid #e8f0f2; border-left: 6px solid var(--lc); }
.acard .agrid { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.acard .ah { display: flex; align-items: center; gap: 8px; } .acard .ah b { font-size: 17px; line-height: 1.3; }
.acard .adot { width: 20px; height: 20px; border-radius: 50%; flex: none; box-shadow: 0 0 0 3px #fff, 0 0 0 4px #e0e6e8; }
.acard .aside { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; max-width: 150px; }
.rl3 { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rl3 li { display: flex; align-items: center; gap: 4px; font-size: 13px; } .rl3 svg { width: 16px; height: 16px; }
/* clinician (10) */
.stat3 { display: grid; grid-template-columns: repeat(3, 1fr); }
.stat3 button { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; cursor: pointer; padding: 4px 6px; border-left: 1px solid var(--line); text-align: left; min-height: 64px; }
.stat3 button:first-child { border-left: 0; }
.stat3 .ci { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; flex: none; } .stat3 .ci svg { width: 26px; height: 26px; }
.stat3 small { display: block; font-size: 14px; color: var(--ink-2); } .stat3 b { font-size: 28px; line-height: 1.1; }
.fchips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.fchips button { flex: none; min-height: 44px; border-radius: 12px; border: 0; background: #edf3f5; padding: 4px 14px; font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; cursor: pointer; color: var(--ink-2); }
.fchips button i { width: 12px; height: 12px; border-radius: 50%; }
.fchips button[aria-pressed="true"] { background: linear-gradient(90deg, #22a0ae, var(--primary-2)); color: #fff; }
.ccard { background: #fff; border-radius: 16px; margin: 8px 0; box-shadow: var(--shadow); border: 1px solid #e8f0f2; }
.ccard.open.red { border: 2px solid #f3b5b5; } .ccard.open { border-width: 2px; }
.crow { display: grid; grid-template-columns: 46px minmax(0, 1fr) 64px auto auto 16px; gap: 8px; align-items: center; padding: 10px; cursor: pointer; }
.cav { width: 46px; height: 46px; border-radius: 50%; background: #e3eaee; display: grid; place-items: center; color: #8a9aa1; } .cav svg { width: 26px; height: 26px; }
.cinfo b { display: block; font-size: 16px; } .cinfo small { display: block; font-size: 12px; color: var(--ink-2); line-height: 1.35; }
.crow img { width: 64px; height: 56px; object-fit: cover; border-radius: 8px; }
.ctime { font-size: 12px; } .ctime small { display: block; color: var(--ink-3); font-size: 11px; } .ctime span { white-space: nowrap; }
.clight { display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 6px 10px; font-weight: 800; font-size: 14px; white-space: nowrap; position: relative; }
.clight svg { width: 18px; height: 18px; } .clight .badge { position: absolute; top: -8px; right: -8px; transform: scale(.85); }
.clight.red { background: var(--red-bg); color: var(--red); } .clight.yellow { background: #fff2d0; color: #b46b00; } .clight.green { background: var(--green-bg); color: var(--green); } .clight.none { background: #eef2f3; color: var(--ink-2); }
.crow .chev { width: 16px; height: 16px; color: #1d6f86; }
.cbody { padding: 0 10px 10px; }
.csum { background: #fff4f4; border-radius: 12px; padding: 10px; }
.ccard.yellow .csum, .ccard.green .csum, .ccard.none .csum { background: #f5f9fa; }
.cbox3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.cbox3 > div { background: #fff; border-radius: 10px; padding: 8px; display: flex; align-items: center; gap: 6px; border: 1px solid #f0e3e3; }
.cbox3 svg { width: 24px; height: 24px; color: #1d6f86; flex: none; } .cbox3 small { display: block; font-size: 12px; color: var(--ink-2); }
.cbox3 b { font-size: 20px; } .cbox3 b.bad { color: var(--red); } .cbox3 b small { display: inline; font-size: 12px; }
.cact { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.cact .btn { font-size: 13px; padding: 4px; gap: 4px; min-height: 48px; } .cact .btn svg { width: 18px; height: 18px; }
@media (max-width: 400px) { .cact { grid-template-columns: 1fr 1fr; } .crow { grid-template-columns: 42px minmax(0, 1fr) 56px auto 14px; } .crow .ctime { display: none; } }
.clinks { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 14px; } .clinks a { color: var(--primary-2); font-weight: 700; min-height: 32px; display: inline-flex; align-items: center; }
@media (max-width: 400px) { .cact { grid-template-columns: repeat(4, 1fr); } .crow { grid-template-columns: 40px minmax(0, 1fr) 50px 76px auto 12px; gap: 6px; } .crow .ctime { display: block; } .cact .btn { font-size: 12px; flex-direction: column; gap: 2px; } }
@media (min-width: 401px) { .crow { grid-template-columns: 46px minmax(0, 1fr) 60px 92px auto 14px; } }
.wlbl { font-size: 9px; white-space: nowrap; gap: 2px; } .wlbl span { overflow: hidden; text-align: center; }
.wbars { height: 64px; gap: 3px; }
.kpic .split { grid-template-columns: auto 1fr; gap: 12px; align-items: end; }
.kpic .big { font-size: 26px; white-space: nowrap; } .kpic .vs { font-size: 13px; white-space: nowrap; }
.shots3 .shot .q { top: 74px; bottom: auto; } .shots3 .shot .st { min-height: 30px; display: flex; align-items: center; justify-content: center; font-size: 12.5px; }
