/* Hydrip Patient Portal - design system.
 * Website language: porcelain ground, deep navy ink, jade / pistachio /
 * peach accents used by meaning and varied by section, liquid glass on
 * the chrome only (header, tab bar, hero), quiet white content cards.
 * No blue or blue-gray text in the portal chrome. The one exception,
 * directed explicitly: the message thread uses iPhone Messages
 * geometry and colors inside the chat surface only. */
:root {
  --porcelain: #F6F6F3;
  --ink: #1E1E2B;
  --ink-soft: #4A463F;
  --ink-faint: #7A756B;
  --jade: #2E7D5B;
  --jade-deep: #256B4D;
  --pistachio: #A9CBB2;
  --pistachio-soft: #E7F0E9;
  --peach: #F6CFA9;
  --peach-soft: #FBEBD9;
  --peach-silk-1: #F5CFC4;
  --peach-silk-2: #FECEC2;
  --peach-silk-3: #FEECE2;
  --amber: #9A6A00;
  --amber-bg: #F7E7C3;
  --red: #B3402A;
  --red-bg: #F8E3DC;
  --card: #FFFFFF;
  --line: #E7E3DB;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-line: rgba(30, 30, 43, 0.08);
  --radius: 20px;
  --shadow: 0 10px 30px rgba(30, 30, 43, 0.07);
  --font-body: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "DM Serif Display", Georgia, "Times New Roman", serif;
  /* iMessage surface (chat only) */
  --im-blue: #007AFF;
  --im-gray: #E9E9EB;
  --im-ink: #1C1C1E;
  --im-time: #8E8E93;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background:
    radial-gradient(1100px 500px at 85% -80px, var(--peach-silk-3), transparent 60%),
    radial-gradient(900px 480px at -10% 30%, var(--pistachio-soft), transparent 55%),
    var(--porcelain);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; margin: 0; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px 120px; }
@media (min-width: 900px) { .wrap { max-width: 720px; } }

/* ---------- glass chrome ---------- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  backdrop-filter: blur(18px) saturate(1.5);
  border: 1px solid var(--glass-line);
}
header.appbar {
  position: sticky; top: 0; z-index: 40;
  margin: 0 -16px; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
  border-left: none; border-right: none; border-top: none;
}
.wordmark { font-family: var(--font-display); font-size: 22px; letter-spacing: 0.04em; }
.wordmark span { color: var(--jade); }
.signout {
  border: 1px solid var(--line); background: rgba(255,255,255,0.7);
  color: var(--ink-soft); border-radius: 999px; padding: 6px 14px; font-size: 13px;
}
nav.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 40;
  display: flex; gap: 4px; padding: 6px; border-radius: 999px;
  box-shadow: var(--shadow);
}
nav.tabbar button {
  border: none; background: transparent; color: var(--ink-soft);
  font-size: 14px; font-weight: 600; padding: 10px 16px; border-radius: 999px;
  position: relative;
}
nav.tabbar button.active { background: var(--ink); color: #fff; }
nav.tabbar button .dot {
  position: absolute; top: 6px; right: 10px; width: 8px; height: 8px;
  border-radius: 50%; background: #E8A33D; border: 2px solid #fff;
}

/* ---------- generic cards & type ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.section-label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-faint); margin: 26px 4px 10px;
}
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.empty {
  text-align: center; padding: 28px 20px; color: var(--ink-soft);
}
.empty .big { font-family: var(--font-display); font-size: 20px; color: var(--ink); margin-bottom: 6px; }

/* ---------- login ---------- */
.login-wrap { max-width: 440px; margin: 0 auto; padding: 48px 16px 40px; }
.login-card { border-radius: 28px; padding: 30px 26px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 30px; margin: 10px 0 8px; }
.chip {
  display: inline-block; font-size: 11px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px;
}
.chip.jade { background: var(--pistachio-soft); color: var(--jade-deep); }
.chip.peach { background: var(--peach-soft); color: #8A5A18; }
.field { margin: 16px 0 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input {
  width: 100%; padding: 13px 14px; font-size: 16px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px; background: #fff;
  outline: none;
}
.field input:focus { border-color: var(--jade); box-shadow: 0 0 0 3px var(--pistachio-soft); }
.btn {
  border: none; border-radius: 999px; padding: 13px 22px;
  font-size: 15px; font-weight: 700; width: 100%;
}
.btn.primary { background: var(--jade); color: #fff; }
.btn.primary:active { background: var(--jade-deep); }
.btn.ghost { background: transparent; color: var(--jade-deep); border: 1.5px solid var(--pistachio); }
.btn:disabled { opacity: 0.55; cursor: default; }
.notice {
  border-radius: 14px; padding: 12px 14px; font-size: 14px; margin: 14px 0;
}
.notice.info { background: var(--pistachio-soft); color: var(--jade-deep); }
.notice.warn { background: var(--amber-bg); color: var(--amber); }
.notice.error { background: var(--red-bg); color: var(--red); }

/* ---------- hero (Home + Results) ---------- */
.hero {
  border-radius: 28px; padding: 22px; margin-top: 18px;
  background:
    linear-gradient(135deg, rgba(245,207,196,0.55), rgba(254,206,194,0.35) 45%, rgba(254,236,226,0.6)),
    var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  backdrop-filter: blur(18px) saturate(1.5);
  border: 1px solid var(--glass-line); box-shadow: var(--shadow);
  display: flex; gap: 18px; align-items: center;
}
.hero .ringbox { flex: 0 0 auto; position: relative; width: 104px; height: 104px; }
.hero .ringnum {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}
.hero .ringnum .n { font-family: var(--font-display); font-size: 30px; line-height: 1; }
.hero .ringnum .of { font-size: 11px; color: var(--ink-soft); margin-top: 3px; }
.hero h2 { font-size: 21px; margin-bottom: 4px; }
.hero p { margin: 0; font-size: 14px; color: var(--ink-soft); }

/* ---------- appointment card ---------- */
.appt {
  margin-top: 14px; border-radius: var(--radius); padding: 16px 18px;
  background: linear-gradient(120deg, var(--pistachio-soft), #F2F7F1);
  border: 1px solid #D8E7DC; display: flex; gap: 14px; align-items: center;
}
.appt .when {
  flex: 0 0 auto; text-align: center; background: #fff; border-radius: 14px;
  padding: 8px 10px; border: 1px solid #D8E7DC; min-width: 62px;
}
.appt .when .d { font-family: var(--font-display); font-size: 20px; }
.appt .when .m { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); }
.appt .what { font-weight: 700; }
.appt .who { font-size: 13px; color: var(--ink-soft); }

/* ---------- dose tracker ---------- */
.med { margin-top: 14px; }
.med .top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.med h3 { font-size: 20px; }
.med .form { font-size: 13px; color: var(--ink-faint); }
.bignum { display: flex; align-items: baseline; gap: 8px; margin: 12px 0 2px; }
.bignum .n { font-family: var(--font-display); font-size: 46px; line-height: 1; }
.bignum .u { color: var(--ink-soft); font-size: 15px; }
.supplybar { height: 10px; border-radius: 999px; background: #EFECE5; margin: 12px 0 6px; position: relative; overflow: visible; }
.supplybar .fill { height: 100%; border-radius: 999px; background: var(--jade); }
.supplybar .tick {
  position: absolute; top: -3px; width: 2px; height: 16px; background: var(--amber);
}
.medfacts { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; color: var(--ink-soft); margin: 8px 0 4px; }
.medfacts b { color: var(--ink); }
.logbtn { margin-top: 12px; }
.reorder {
  margin-top: 14px; border-radius: 16px; padding: 14px 16px;
  background: var(--peach-soft); border: 1px solid var(--peach);
}
.reorder .t { font-weight: 700; margin-bottom: 4px; }
.reorder .btn { margin-top: 10px; background: var(--ink); color: #fff; }
.confirmed {
  margin-top: 14px; border-radius: 16px; padding: 14px 16px;
  background: var(--pistachio-soft); border: 1px solid var(--pistachio);
  color: var(--jade-deep); font-size: 14px;
}
.pill {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 4px 10px;
  border-radius: 999px; white-space: nowrap;
}
.pill.in { background: var(--pistachio-soft); color: var(--jade-deep); }
.pill.watch { background: var(--amber-bg); color: var(--amber); }
.pill.low, .pill.high { background: var(--red-bg); color: var(--red); }

/* ---------- markers ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 4px; }
.filters button {
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  border-radius: 999px; padding: 7px 13px; font-size: 13px; font-weight: 600;
}
.filters button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.marker { margin-top: 12px; padding: 16px 18px; }
.marker .row1 { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.marker .name { font-weight: 700; font-size: 16px; }
.marker .lab { font-size: 12px; color: var(--ink-faint); }
.marker .val { text-align: right; }
.marker .val .v { font-family: var(--font-display); font-size: 22px; }
.marker .val .u { font-size: 12px; color: var(--ink-faint); }
.rangebar { position: relative; height: 8px; border-radius: 999px; background: #EFECE5; margin: 16px 2px 6px; }
.rangebar .opt { position: absolute; top: 0; height: 100%; border-radius: 999px; background: var(--pistachio); }
.rangebar .dot {
  position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%;
  transform: translate(-50%, -50%); background: var(--ink); border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(30,30,43,0.25);
}
.rangebar .pdot {
  position: absolute; top: 50%; width: 9px; height: 9px; border-radius: 50%;
  transform: translate(-50%, -50%); background: #fff; border: 2px solid #B9B2A4;
}
.rangelabels { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-faint); }
.marker .more {
  margin-top: 10px; border: none; background: none; color: var(--jade-deep);
  font-size: 13px; font-weight: 700; padding: 0;
}
.marker .detail { margin-top: 8px; font-size: 14px; color: var(--ink-soft); display: none; }
.marker.open .detail { display: block; }
.marker .detail .note {
  margin-top: 10px; background: var(--peach-silk-3); border: 1px solid var(--peach-silk-1);
  border-radius: 12px; padding: 10px 12px; color: var(--ink);
}
.calc { margin-top: 12px; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.calc .nm { font-weight: 700; font-size: 16px; }
.calc .lb { font-size: 12px; color: var(--ink-faint); }
.calc .tx { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }

/* ---------- progress ---------- */
.trend { margin-top: 12px; padding: 16px 18px; }
.trend .row1 { display: flex; justify-content: space-between; align-items: baseline; }
.trend .delta { font-size: 13px; font-weight: 700; }
.delta.good { color: var(--jade-deep); }
.delta.bad { color: var(--red); }
.delta.flat { color: var(--ink-faint); }
svg.plot { width: 100%; height: 92px; display: block; margin-top: 8px; }
.plotlabels { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-faint); }

/* ---------- iMessage-style chat (chat surface only) ----------
 * Deliberately plain, like the real Messages app: ONE system font,
 * ONE message text size and weight, plain white ground, bubbles only.
 * No typography variation inside the thread beyond smaller gray meta
 * text (timestamps, system lines). */
.chatcard {
  margin-top: 14px; padding: 0; overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}
.chathead {
  padding: 8px 14px; border-bottom: 1px solid #E5E5EA;
  display: flex; align-items: center; gap: 8px; background: #F6F6F6;
}
.chathead .avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--pistachio), var(--jade));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px;
}
.chathead .t { font-weight: 600; font-size: 14px; color: var(--im-ink); }
.chathead .s { font-size: 11px; color: var(--im-time); }
.thread {
  padding: 12px 12px 4px; display: flex; flex-direction: column;
  background: #fff;
}
.tstamp {
  align-self: center; color: var(--im-time); font-size: 11px;
  margin: 8px 0 6px; text-align: center;
}
.sevent {
  align-self: center; color: var(--im-time); font-size: 12px;
  margin: 8px 0; text-align: center;
}
.brow { display: flex; flex-direction: column; max-width: 78%; }
.brow.me { align-self: flex-end; align-items: flex-end; }
.brow.them { align-self: flex-start; align-items: flex-start; }
.brow + .brow.same { margin-top: 2px; }
.brow + .brow.new { margin-top: 10px; }
.bubble {
  position: relative; padding: 8px 13px; font-size: 17px; font-weight: 400;
  line-height: 1.35;
  border-radius: 18px; word-wrap: break-word; white-space: pre-wrap;
}
.brow.me .bubble { background: var(--im-blue); color: #fff; }
.brow.them .bubble { background: var(--im-gray); color: var(--im-ink); }
/* tails on the last bubble of a group */
.brow.tail.me .bubble { border-bottom-right-radius: 4px; }
.brow.tail.them .bubble { border-bottom-left-radius: 4px; }
.brow.tail.me .bubble::after, .brow.tail.them .bubble::after {
  content: ""; position: absolute; bottom: 0; width: 12px; height: 16px;
}
.brow.tail.me .bubble::after {
  right: -6px;
  background: radial-gradient(circle at top right, transparent 11px, var(--im-blue) 12px);
  transform: scaleX(-1);
}
.brow.tail.them .bubble::after {
  left: -6px;
  background: radial-gradient(circle at top left, transparent 11px, var(--im-gray) 12px);
}
.composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: #fff;
}
.composer .pillfield {
  flex: 1; display: flex; align-items: center;
  border: 1.2px solid #C7C7CC; border-radius: 999px; padding: 0 6px 0 14px;
  background: #fff;
}
.composer textarea {
  flex: 1; border: none; outline: none; resize: none; font-size: 16px;
  line-height: 1.3; padding: 8px 0; max-height: 96px; background: transparent;
  color: var(--im-ink);
}
.composer textarea::placeholder { color: #A0A0A5; }
.sendbtn {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  border: none; background: var(--im-blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; line-height: 1; padding: 0;
}
.sendbtn:disabled { background: #C7C7CC; }
.sendbtn svg { display: block; }
.chatnote { padding: 0 18px 14px; font-size: 12px; color: var(--ink-faint); background: #fff; }

footer.legal { text-align: center; color: var(--ink-faint); font-size: 12px; margin-top: 28px; }
