/* Chartstone patient app: one phone-width column, matching Lorraine's app. */
:root {
  --blue: #1F6FC9; --blue-deep: #17539A; --sky: #E6F2FC; --page: #EEF2F8; --white: #FFFFFF;
  --ink: #1D2433; --slate: #39445A; --muted: #5C677A; --line: #CFD6E2;
  --body: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--body); font-size: 18px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); }
button { font: inherit; cursor: pointer; }
a:focus-visible, button:focus-visible { outline: 3px solid #F2A33A; outline-offset: 2px; }

.stage { height: 100%; display: flex; justify-content: center; align-items: center; padding-inline: 16px; }
.app { width: 100%; max-width: 430px; height: 100%; max-height: 900px; background: var(--white); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 28px; box-shadow: 0 18px 50px rgba(29,36,51,.12); }
@media (max-width: 520px) { .stage { padding-inline: 0; } .app { max-height: none; border: 0; border-radius: 0; box-shadow: none; } }

.top { background: var(--blue); color: #fff; display: flex; align-items: center; gap: 12px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
.word { flex: 1; color: #fff; text-decoration: none; font-size: 23px; font-weight: 700; }
.word small { display: block; font-size: 12.5px; font-weight: 400; opacity: .9; }
.sq { width: 46px; height: 46px; border-radius: 10px; background: var(--blue-deep); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.sq svg { width: 26px; height: 26px; }

.screen { flex: 1; overflow-y: auto; padding: 22px 18px 26px; min-height: 0; background: linear-gradient(var(--sky), var(--page) 330px); }
h1 { font-size: 30px; font-weight: 400; line-height: 1.15; margin: 0 0 14px; }
.welcome { text-align: center; color: var(--blue-deep); }
.ckhead { font-size: 40px; font-weight: 700; color: var(--blue); }
.note { color: var(--slate); margin: 0 0 14px; font-size: 17px; }
.hint { color: var(--muted); font-size: 15px; text-align: center; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.tile { background: #fff; border-radius: 14px; box-shadow: 0 2px 8px rgba(29,36,51,.14); padding: 18px 6px; min-height: 96px; display: grid; place-items: center; text-align: center; font-size: 16px; line-height: 1.2; color: var(--slate); text-decoration: none; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 1px 5px rgba(29,36,51,.10); margin-bottom: 14px; }
.card .in { padding: 14px 16px; }
.card b.t { display: block; font-size: 19px; color: var(--slate); line-height: 1.25; }
.card .sub { color: var(--muted); font-size: 16px; margin: 6px 0 0; }

.btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn { display: inline-block; margin-top: 12px; border: 1.5px solid var(--blue); background: #fff; color: var(--blue); border-radius: 6px; padding: 9px 18px; font-size: 17px; text-decoration: none; }
.btns .btn { margin-top: 0; }
.btn.fill { background: var(--blue); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }

.greet { text-align: center; margin: 6px 0 16px; }
.greet p { margin: 0; color: var(--muted); font-size: 17px; }

.tabs { display: flex; border-top: 1px solid var(--line); background: #fff; padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabs a { flex: 1; text-align: center; padding: 14px 4px; color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 600; }
.tabs a.active { color: var(--blue); box-shadow: inset 0 3px 0 var(--blue); }

/* sign in */
.field { display: block; margin: 8px 0 4px; }
.field span { display: block; font-size: 15px; font-weight: 600; color: var(--slate); margin-bottom: 6px; }
.field input { width: 100%; border: 2px solid var(--line); border-radius: 8px; padding: 12px; font: inherit; font-size: 18px; color: var(--ink); background: #fff; }
.field input:focus { outline: 3px solid #F2A33A; outline-offset: 1px; border-color: var(--blue); }
.btn.wide { width: 100%; text-align: center; padding: 13px 18px; }
.alert { background: #FBEEE4; color: #B4541F; border-radius: 8px; padding: 10px 14px; font-size: 16px; }
.hint.bad { color: #B4541F; font-weight: 600; }

/* records */
h2 { font-size: 22px; font-weight: 400; color: var(--slate); margin: 22px 0 10px; }
.upload { position: relative; overflow: hidden; cursor: pointer; }
.upload input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload.disabled { opacity: .6; pointer-events: none; }
.rec { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.rec > div { min-width: 0; }
.rec .t { overflow-wrap: anywhere; }
.link { border: 0; background: none; color: var(--blue); font-size: 16px; padding: 4px 0; flex-shrink: 0; text-decoration: none; font-weight: 600; white-space: nowrap; }
.acts { display: flex; gap: 14px; flex-shrink: 0; }

/* ask */
.sugg { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.sugg button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 12px 14px; text-align: left; font-size: 17px; color: var(--slate); }
.chat { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.msg { font-size: 18px; line-height: 1.5; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; max-width: 86%; background: var(--sky); padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; }
.msg.ai { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.msg.ai p { margin: 0 0 8px; } .msg.ai p:last-of-type { margin-bottom: 0; }
.flag { display: inline-block; margin-top: 10px; font-size: 14px; font-weight: 700; color: #B4541F; background: #FBEEE4; padding: 4px 12px; border-radius: 999px; }
.think { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.think i { width: 10px; height: 10px; border-radius: 50%; background: var(--blue); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(.6); opacity: .5; } 50% { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .think i { animation: none; } }
.askbar { display: flex; gap: 8px; align-items: flex-end; }
.askbar textarea { flex: 1; min-width: 0; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 17px; resize: none; color: var(--ink); background: #fff; }
.askbar .btn { margin-top: 0; }

/* nurse view */
.pill { display: inline-block; font-size: 14px; font-weight: 700; padding: 3px 10px; border-radius: 999px; margin: 4px 6px 0 0; background: var(--sky); color: var(--blue-deep); }
.pill.ok { background: #E7F5EC; color: #1F7A3E; }
.pill.warn { background: #FBEEE4; color: #B4541F; }
.pill.flagpill { background: #FBEEE4; color: #B4541F; }
a.card { display: block; text-decoration: none; color: inherit; }
.prow .sub { margin-top: 2px; }
.prow .t { overflow-wrap: anywhere; }
.card.look, .drow.look { border-left: 5px solid #E8863A; }
.back { margin: 0 0 8px; font-size: 16px; }
.back a { text-decoration: none; font-weight: 600; }
.pemail { font-size: 22px; overflow-wrap: anywhere; color: var(--blue-deep); }
.drow { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); }
.drow:last-child { border-bottom: 0; }
.drow .day { flex: 1 0 120px; font-weight: 600; color: var(--slate); font-size: 16px; }
.drow .pill { margin-top: 0; }
.qa.shared { border-color: #E8863A; background: #FFF8F2; }
.qa .flag { margin: 0 0 8px; }
.qa .when { margin-bottom: 8px; font-size: 14px; }
.qa .ans { margin: 0 0 6px; font-size: 16px; color: var(--ink); }
.qa .t { font-size: 17px; white-space: pre-wrap; overflow-wrap: anywhere; }
.peek { border-top: 1px solid var(--line); padding: 10px 16px 12px; }
.peek summary { cursor: pointer; color: var(--blue); font-size: 16px; font-weight: 600; }
.peektext { margin: 8px 0 0; font-size: 15px; line-height: 1.4; color: var(--slate); white-space: pre-wrap; overflow-wrap: anywhere; }
.peeknone { padding: 0 16px 12px; }

/* portal */
.portal { min-height: 100%; display: flex; flex-direction: column; background: var(--page); }
.portal-wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding-inline: 24px; }
.portal-hero { background: var(--blue); color: #fff; padding: calc(56px + env(safe-area-inset-top, 0px)) 0 104px; }
.portal-hero h1 { margin: 0; font-size: 48px; font-weight: 700; line-height: 1.1; letter-spacing: -.01em; }
.portal-tag { margin: 14px 0 0; max-width: 32em; font-size: 21px; line-height: 1.4; opacity: .94; }
.portal-main { flex: 1; margin-top: -60px; padding-bottom: 48px; }
.portal-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.portal-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(29,36,51,.10); padding: 26px 24px 24px; display: flex; flex-direction: column; }
.portal-icon { width: 52px; height: 52px; border-radius: 12px; background: var(--sky); color: var(--blue); display: grid; place-items: center; margin-bottom: 16px; }
.portal-icon svg { width: 28px; height: 28px; }
.portal-card h2 { margin: 0 0 8px; font-size: 24px; font-weight: 700; line-height: 1.2; color: var(--ink); }
.portal-card p { flex: 1; margin: 0 0 22px; font-size: 18px; color: var(--slate); }
.portal-btn { display: block; text-align: center; background: var(--blue); color: #fff; text-decoration: none; font-size: 18px; font-weight: 600; border-radius: 8px; padding: 14px 18px; }
.portal-btn:hover { background: var(--blue-deep); }
.portal-foot { border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 15px; padding: 18px 0 calc(18px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 820px) {
  .portal-cards { grid-template-columns: 1fr; gap: 16px; }
  .portal-hero { padding: calc(36px + env(safe-area-inset-top, 0px)) 0 84px; }
  .portal-hero h1 { font-size: 36px; }
  .portal-tag { font-size: 19px; }
}
@media (max-width: 520px) { .portal-wrap { padding-inline: 16px; } }
