/* =====================================================================
   Pet_OS — minimalist design system
   Palette: #f3e9e2 (cream) · #739695 (sage) · #c8e5db (mint)
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Brand palette — three colors only */
  --cream:        #f3e9e2;
  --sage:         #739695;
  --mint:         #c8e5db;

  /* Derived */
  --sage-dark:    #56777a;
  --sage-soft:    #e6eded;

  --brand:        var(--sage);
  --brand-dark:   var(--sage-dark);
  --brand-soft:   var(--mint);
  --accent:       var(--sage);
  --accent-soft:  var(--mint);

  /* Status — kept inside the palette wherever sensible */
  --good:        var(--sage);
  --good-bg:     var(--mint);
  --warn:        #b9895b;
  --warn-bg:     #f4e3d2;
  --bad:         #b16969;
  --bad-bg:      #ecd9d6;
  --info:        var(--sage);
  --info-bg:     var(--mint);

  /* Neutrals — warm greys that sit with the cream */
  --bg:        var(--cream);
  --surface:   #ffffff;
  --surface-2: #fbf6f1;
  --ink:       #2a3636;
  --ink-2:     #5e6c6c;
  --ink-3:     #97a1a1;
  --line:      #e7ddd2;
  --line-2:    #efe6dc;

  --radius:    14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow:    0 1px 1px rgba(42,54,54,.03);
  --shadow-sm: none;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}

a { color: var(--sage-dark); text-decoration: none; }
a:hover { color: var(--ink); }
h1, h2, h3, h4 { line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 0.98rem; }
small { font-size: .8rem; }
hr { border: none; border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- Layout */
/* dvh (not vh) so the page is exactly the VISIBLE viewport on mobile — 100vh is the
   larger URL-bar-hidden height, which left scrollable empty space below the content
   past the fixed bottom-nav. vh first as a fallback for browsers without dvh. */
.layout { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;        /* dynamic viewport height — excludes mobile browser bars */
  overflow-y: auto;
  scrollbar-width: none;        /* compact spacing lets every item fit; hide the bar */
}
.sidebar::-webkit-scrollbar { width: 0; height: 0; display: none; }

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 2px 8px 8px;
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  object-fit: cover; display: block; flex: none;
}
.brand-name { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.02em; color: var(--ink); }
.brand-name span { color: var(--sage); font-weight: 700; }
.brand-sub { font-size: .68rem; color: var(--ink-3); font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }

.nav-group-label {
  font-size: .62rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3);
  padding: 6px 10px 3px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 5px 11px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-weight: 500; font-size: .875rem;
  cursor: pointer; transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--sage-soft); color: var(--ink); }
.nav-item.active { background: var(--mint); color: var(--sage-dark); font-weight: 600; }
.nav-item .ico { width: 18px; height: 18px; flex: 0 0 18px; }
.nav-item .ico svg { display: block; }

.sidebar-foot {
  margin-top: auto;
  padding: 8px 10px 2px;
  border-top: 1px solid var(--line);
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--mint); color: var(--sage-dark);
  display: grid; place-items: center; font-weight: 700; font-size: .78rem;
  flex: 0 0 32px;
}
.user-chip .meta { line-height: 1.2; min-width: 0; }
.user-chip .meta b { font-size: .85rem; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .meta small { color: var(--ink-3); display: block; font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- Main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 30px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar .menu-btn {
  display: none; background: none; border: none; cursor: pointer;
  color: var(--ink-2); padding: 4px;
}
.topbar .back-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line);
  cursor: pointer; color: var(--ink-2); flex-shrink: 0;
}
.topbar .back-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--sage); }
.topbar .back-btn svg { width: 18px; height: 18px; }
.page-title { flex: 1; min-width: 0; }
.page-title h1 { font-size: 1.25rem; }
.page-title p { color: var(--ink-2); font-size: .82rem; }

.dog-switch {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 12px 4px 4px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; cursor: pointer; font-weight: 500; font-size: .85rem;
  color: var(--ink);
}
.dog-switch:hover { border-color: var(--sage); }
.dog-switch .dog-ph {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--mint); display: grid; place-items: center;
  color: var(--sage-dark); font-weight: 700; font-size: .8rem;
}
.pet-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 200;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg, 0 4px 16px rgba(0,0,0,.12)); min-width: 180px;
  padding: 4px; display: flex; flex-direction: column; gap: 2px;
}
.pet-dd-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border: none; background: none; cursor: pointer; font-size: .85rem;
  color: var(--ink); border-radius: var(--radius-sm); width: 100%; text-align: left;
}
.pet-dd-item:hover { background: var(--mint-light, var(--mint)); }
.pet-dd-item.active { background: var(--mint); font-weight: 600; cursor: default; }

/* Notifications (care team invites) */
.notif-wrap { position: relative; display: inline-flex; }
.notif-btn { position: relative; }
.notif-badge {
  position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 999px; background: #e5484d; color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.notif-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 200;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg, 0 6px 24px rgba(0,0,0,.14)); width: 300px; max-width: 86vw;
  padding: 6px; overflow: hidden;
}
.notif-head { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #889); padding: 8px 10px 6px; font-weight: 700; }
.notif-empty { padding: 18px 12px; text-align: center; color: var(--muted, #889); font-size: .85rem; }
.notif-item { padding: 10px; border-radius: var(--radius-sm); }
.notif-item + .notif-item { border-top: 1px solid var(--line); }
.notif-text { font-size: .85rem; line-height: 1.45; margin-bottom: 8px; color: var(--ink); }
.notif-actions { display: flex; gap: 8px; }
.notif-toast {
  position: fixed; bottom: 22px; right: 22px; z-index: 1000;
  background: var(--ink, #2a3636); color: #fff; padding: 12px 16px; border-radius: 10px;
  font-size: .88rem; max-width: 320px; box-shadow: 0 6px 24px rgba(0,0,0,.22);
  opacity: 0; transform: translateY(12px); transition: opacity .3s ease, transform .3s ease;
}
.notif-toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 600px) { .notif-toast { left: 16px; right: 16px; bottom: 80px; max-width: none; } }

/* Multi-pet dashboard overview */
.po-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-bottom: 4px; }
.po-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm, 12px); padding: 16px; }
.po-card.active { border-color: var(--sage, #739695); box-shadow: 0 0 0 1px var(--sage, #739695) inset; }
.po-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.po-head .dog-ph { width: 38px; height: 38px; border-radius: 50%; background: var(--mint); color: var(--sage-dark); font-weight: 700; display: grid; place-items: center; flex: none; }
.po-id b { display: block; font-size: .95rem; }
.po-id small { color: var(--muted, #889); font-size: .76rem; }
.po-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 10px; margin-bottom: 12px; }
.po-stat span { display: block; font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.po-stat small { color: var(--muted, #889); font-size: .72rem; }
.po-card .po-switch { width: 100%; }

.guest-banner {
  background: var(--mint);
  color: var(--sage-dark);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .85rem;
  display: flex; align-items: center; gap: 10px;
  font-weight: 500;
  margin-bottom: 18px;
  border: 1px solid rgba(115,150,149,.15);
}
.guest-banner .gb-label { font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: .7rem; background: rgba(255,255,255,.6); padding: 3px 8px; border-radius: 999px; }
.guest-banner a { font-weight: 700; }
.guest-banner .gb-exit { background: var(--sage-dark); color: #fff; padding: 6px 12px; border-radius: 8px; white-space: nowrap; }
.guest-banner .gb-exit:hover { background: var(--ink); color: #fff; }
@media (max-width: 600px) {
  .guest-banner { flex-wrap: wrap; }
  .guest-banner .gb-cta { margin-left: 0 !important; }
}

.content {
  padding: 26px 30px 60px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}

/* ---------------------------------------------------------------- Grid */
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Card */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card.pad-lg { padding: 26px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.card-head .sub { color: var(--ink-3); font-size: .78rem; font-weight: 500; }
.card-link { font-size: .82rem; font-weight: 600; color: var(--sage); }
.card-link:hover { color: var(--sage-dark); }

.section-title {
  font-size: .68rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3);
  margin: 28px 0 12px;
}

/* ---------------------------------------------------------------- Stat */
.stat .label {
  font-size: .68rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px;
}
.stat .value { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.025em; color: var(--ink); }
.stat .value .unit { font-size: .85rem; color: var(--ink-3); font-weight: 500; margin-left: 3px; }
.stat .delta { font-size: .76rem; font-weight: 500; margin-top: 4px; color: var(--ink-2); }
.stat .icon-badge { margin-bottom: 12px; }

.icon-badge {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--mint); color: var(--sage-dark);
}
.icon-badge.teal,
.icon-badge.coral,
.icon-badge.blue,
.icon-badge.amber {
  background: var(--mint); color: var(--sage-dark);
}

/* ---------------------------------------------------------------- Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: .72rem; font-weight: 600; letter-spacing: .01em;
  background: var(--sage-soft); color: var(--ink-2);
  border: 1px solid var(--line);
}
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.good { background: var(--mint); color: var(--sage-dark); border-color: rgba(115,150,149,.18); }
.badge.warn { background: var(--warn-bg); color: #8d6433; border-color: rgba(185,137,91,.2); }
.badge.bad  { background: var(--bad-bg);  color: #8e4a4a; border-color: rgba(177,105,105,.2); }
.badge.info { background: var(--mint); color: var(--sage-dark); border-color: rgba(115,150,149,.18); }
.badge.muted{ background: var(--surface-2); color: var(--ink-2); }

.pos { color: var(--sage); }
.neg { color: var(--bad); }
.muted-txt { color: var(--ink-3); }

/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 10px;
  font-family: inherit; font-weight: 600; font-size: .86rem;
  cursor: pointer; border: 1px solid transparent; transition: .12s;
  white-space: nowrap;
}
.btn-primary { background: var(--sage); color: #fff; }
.btn-primary:hover { background: var(--sage-dark); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--sage); }
.btn-accent { background: var(--mint); color: var(--sage-dark); border-color: rgba(115,150,149,.2); }
.btn-accent:hover { background: var(--sage-soft); }
.btn-guest { background: var(--mint); color: var(--sage-dark); border: 2px solid var(--sage); font-weight: 700; padding: 12px 22px; font-size: .95rem; box-shadow: 0 3px 10px rgba(115,150,149,.22); }
.btn-guest:hover { background: var(--sage); color: #fff; border-color: var(--sage); }
.btn-sm { padding: 6px 12px; font-size: .8rem; border-radius: 8px; }
.btn svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- Forms */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: .76rem; font-weight: 600;
  color: var(--ink-2); margin-bottom: 6px; letter-spacing: -0.005em;
}
.input, select.input, textarea.input {
  width: 100%; box-sizing: border-box; min-height: 42px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 9px;
  font-family: inherit; font-size: .9rem; line-height: 1.3; color: var(--ink);
  background: var(--surface); transition: .12s;
}
.input:focus, select.input:focus, textarea.input:focus {
  outline: none; border-color: var(--sage);
  box-shadow: 0 0 0 3px var(--mint); background: #fff;
}
textarea.input { resize: vertical; min-height: 70px; }
/* Native date/time inputs otherwise render a different height and let their value
   overflow the box (worst on iOS, where it overlaps the card). Normalising the
   appearance makes them behave like a normal text input so they sit inside the
   box and line up with the other fields. The calendar/clock picker still opens. */
input[type="date"].input, input[type="time"].input, input[type="datetime-local"].input {
  -webkit-appearance: none; appearance: none; height: 42px;
}
.input::-webkit-date-and-time-value { text-align: left; margin: 0; }
.input::-webkit-calendar-picker-indicator { margin-left: 4px; opacity: 1; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.hint { font-size: .74rem; color: var(--ink-3); margin-top: 4px; }

/* Toggle pills — rounded binary selectors */
.toggle-pills {
  display: inline-flex; border-radius: 999px; overflow: hidden;
  border: 1px solid var(--line); background: var(--surface);
}
.toggle-pills .pill {
  padding: 8px 20px; border: none; background: none; cursor: pointer;
  font-size: .85rem; font-weight: 600; color: var(--ink-2);
  transition: background .15s, color .15s;
  position: relative;
}
.toggle-pills .pill + .pill { border-left: 1px solid var(--line); }
.toggle-pills .pill:hover { background: var(--mint); color: var(--ink); }
.toggle-pills .pill.active {
  background: var(--sage); color: #fff;
}

/* Form save status */
.form-status {
  font-size: .82rem; font-weight: 500; padding: 0; margin-top: 8px;
  border-radius: 8px; transition: all .2s;
}
.form-status:empty { display: none; }
.form-status.saving { color: var(--ink-2); padding: 8px 12px; background: var(--mint); }
.form-status.ok { color: #2d6a4f; padding: 8px 12px; background: #d8f3dc; }
.form-status.err { color: #7a3a3a; padding: 8px 12px; background: var(--bad-bg); }

.chip-select { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-select label {
  padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px;
  font-size: .82rem; font-weight: 500; cursor: pointer; color: var(--ink-2);
  background: var(--surface);
}
.chip-select input { display: none; }
.chip-select input:checked + label,
.chip-select label.on {
  background: var(--mint); border-color: var(--sage);
  color: var(--sage-dark); font-weight: 600;
}

.pwd-wrap { position: relative; }
.pwd-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--ink-3);
  font-size: .78rem; font-weight: 600; padding: 4px 8px; border-radius: 6px;
}
.pwd-toggle:hover { color: var(--sage-dark); background: var(--surface-2); }

/* ---------------------------------------------------------------- Table */
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th {
  text-align: left; font-size: .68rem; text-transform: uppercase;
  letter-spacing: .08em; color: var(--ink-3); font-weight: 600;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
}
.table td {
  padding: 11px 12px; border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- Misc UI */
.divider { height: 1px; background: var(--line); margin: 18px 0; }

.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line-2);
}
.list-row:last-child { border-bottom: none; }
.list-row .lr-main { flex: 1; min-width: 0; }
.list-row .lr-main b { font-size: .9rem; font-weight: 600; display: block; }
.list-row .lr-main small { color: var(--ink-3); display: block; font-size: .76rem; }
.list-row .lr-time { font-size: .78rem; color: var(--ink-3); font-weight: 500; white-space: nowrap; }

.timeline { position: relative; padding-left: 20px; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px;
  width: 1px; background: var(--line);
}
.tl-item { position: relative; padding: 4px 0 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -20px; top: 7px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #fff; border: 2px solid var(--sage);
}
.tl-item.coral::before,
.tl-item.amber::before,
.tl-item.blue::before { border-color: var(--sage); }
.tl-item .tl-time { font-size: .73rem; color: var(--ink-3); font-weight: 600; }
.tl-item .tl-body { font-size: .86rem; }
.tl-day { font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); margin: 16px 0 8px -20px; }
.tl-day:first-child { margin-top: 0; }

.progress {
  height: 6px; border-radius: 999px; background: var(--sage-soft);
  overflow: hidden;
}
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--sage); }
.progress.coral > span,
.progress.blue > span,
.progress.amber > span { background: var(--sage); }

.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid; font-size: .86rem;
  background: var(--surface);
}
.alert .a-ico { flex: 0 0 18px; margin-top: 2px; color: currentColor; }
.alert .a-ico svg { width: 18px; height: 18px; }
.alert b { display: block; font-weight: 700; }
.alert.warn { background: var(--warn-bg); border-color: rgba(185,137,91,.25); color: #6f4f29; }
.alert.bad  { background: var(--bad-bg);  border-color: rgba(177,105,105,.25); color: #6f3838; }
.alert.good { background: var(--mint);    border-color: rgba(115,150,149,.25); color: var(--sage-dark); }
.alert.info { background: var(--sage-soft); border-color: var(--line); color: var(--ink-2); }

.kv { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line-2); font-size: .87rem; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink-2); }
.kv .v { font-weight: 600; color: var(--ink); }

.empty-hint {
  text-align: center; color: var(--ink-3); font-size: .85rem;
  padding: 24px 12px; border: 1px dashed var(--line); border-radius: var(--radius-sm);
}

/* Defensive SVG sizing — inline width/height wins, but this keeps icons
   inside their badges if attributes are absent. */
svg { max-width: 100%; height: auto; }
.feature .f-ico svg, .icon-badge svg, .nav-item .ico svg,
.alert .a-ico svg, .btn svg, .pwd-toggle svg { width: 18px; height: 18px; }

/* Auto-save indicator */
.autosave-status {
  font-size: .74rem; color: var(--ink-3); margin-top: 8px; min-height: 16px;
  display: flex; align-items: center; gap: 6px;
}
.autosave-status.saving { color: var(--ink-2); }
.autosave-status.saved  { color: var(--sage-dark); }
.autosave-status.error  { color: #8e4a4a; }

/* Flash banner shown after a save+redirect */
.flash-banner {
  background: var(--mint); color: var(--sage-dark);
  border: 1px solid rgba(115,150,149,.2);
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: .87rem; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px;
}
.flash-banner.error { background: var(--bad-bg); color:#8e4a4a; border-color: rgba(177,105,105,.25); }

/* Topbar action cluster */
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-actions .icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink-2); cursor: pointer; padding: 0;
  text-decoration: none; transition: .12s;
}
.topbar-actions .icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--sage); }
.topbar-actions .icon-btn svg { width: 18px; height: 18px; }

/* charts */
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .76rem; color: var(--ink-2); font-weight: 500; }
.legend .lg { display: flex; align-items: center; gap: 6px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }

/* hero — kept calm, uses sage with mint highlight */
.hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 30px;
  color: var(--ink);
  position: relative;
}
.hero h2 { font-size: 1.4rem; margin-bottom: 4px; }
.hero p { color: var(--ink-2); font-size: .92rem; }
.hero .hero-stats { display: flex; gap: 32px; margin-top: 18px; flex-wrap: wrap; }
.hero .hero-stats .hs .n { font-size: 1.4rem; font-weight: 700; color: var(--sage-dark); letter-spacing: -0.02em; }
.hero .hero-stats .hs .l { font-size: .7rem; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; margin-top: 2px; }

/* ---------------------------------------------------------------- Landing page */
.landing {
  background: var(--cream);
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
}
.landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 40px;
  max-width: 1200px; margin: 0 auto;
}
.landing-nav .brand { padding: 0; gap: 10px; }
.landing-nav .nav-actions { display: flex; gap: 10px; align-items: center; }

.landing-hero {
  max-width: 1100px; margin: 0 auto;
  padding: 56px 40px 72px;
  display: grid; grid-template-columns: 1.05fr 0.95fr;
  gap: 60px; align-items: center;
}
.landing-hero h1 {
  font-size: 3rem; line-height: 1.05;
  letter-spacing: -0.03em; margin-bottom: 18px;
}
.landing-hero h1 .accent-mint { background: var(--mint); padding: 0 8px; border-radius: 6px; }
.landing-hero .lead {
  font-size: 1.08rem; color: var(--ink-2);
  line-height: 1.55; margin-bottom: 26px; max-width: 480px;
}
.landing-hero .cta-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.landing-hero .btn-primary { padding: 12px 22px; font-size: .95rem; }
.landing-hero .btn-ghost { padding: 12px 22px; font-size: .95rem; background: transparent; border-color: var(--sage); color: var(--sage-dark); }
.landing-hero .micro { display: flex; gap: 18px; margin-top: 22px; font-size: .8rem; color: var(--ink-3); }
.landing-hero .micro span::before { content: "✓"; color: var(--sage); margin-right: 6px; font-weight: 700; }

.hero-visual {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
}
.hero-visual::after {
  content: ""; position: absolute;
  inset: -16px -16px auto auto;
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--mint); z-index: -1;
}
.hero-visual .hv-title { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 14px; }
.hero-visual .hv-stat { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.hero-visual .hv-stat:last-of-type { border-bottom: none; }
.hero-visual .hv-stat b { font-weight: 600; font-size: .92rem; }
.hero-visual .hv-stat small { color: var(--ink-3); font-size: .76rem; }
.hero-visual .hv-stat .v { font-weight: 700; color: var(--sage-dark); font-size: 1.05rem; }

.section {
  max-width: 1100px; margin: 0 auto;
  padding: 64px 40px;
}
.section.alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section.alt-wrap { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section .eyebrow {
  font-size: .72rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--sage); margin-bottom: 12px;
}
.section h2 {
  font-size: 2rem; letter-spacing: -0.025em; max-width: 640px;
  margin-bottom: 14px;
}
.section .section-lead { color: var(--ink-2); font-size: 1rem; max-width: 620px; line-height: 1.55; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 40px; }
.step { padding: 6px 0; }
.step .num {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--mint); color: var(--sage-dark);
  display: grid; place-items: center; font-weight: 700; font-size: .9rem;
  margin-bottom: 14px;
}
.step h3 { font-size: 1.05rem; margin-bottom: 6px; }
.step p { color: var(--ink-2); font-size: .9rem; line-height: 1.55; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 40px; }
.feature {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.feature .f-ico {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--mint); color: var(--sage-dark);
  display: grid; place-items: center; margin-bottom: 14px;
}
.feature .f-ico svg { width: 20px; height: 20px; }
.feature h3 { font-size: 1rem; margin-bottom: 6px; }
.feature p { color: var(--ink-2); font-size: .88rem; line-height: 1.55; }

.vet-section {
  background: var(--mint);
  border-radius: var(--radius-lg);
  padding: 40px;
  margin-top: 24px;
}
.vet-section h2 { color: var(--sage-dark); margin-bottom: 14px; }
.vet-section p { color: var(--sage-dark); font-size: .95rem; line-height: 1.6; opacity: .85; max-width: 640px; }
.vet-section .vet-perks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 28px; }
.vet-section .vp { background: rgba(255,255,255,.6); border-radius: var(--radius); padding: 18px; }
.vet-section .vp h4 { font-size: .92rem; color: var(--sage-dark); margin-bottom: 6px; font-weight: 700; }
.vet-section .vp p { font-size: .82rem; color: var(--sage-dark); opacity: .85; }

.cta-band {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 44px;
  text-align: center;
  margin: 36px 0;
}
.cta-band h2 { font-size: 1.9rem; margin-bottom: 10px; }
.cta-band p { color: var(--ink-2); font-size: 1rem; margin-bottom: 22px; }
.cta-band .row { justify-content: center; }

.landing-foot {
  border-top: 1px solid var(--line);
  padding: 32px 40px;
  margin-top: 24px;
}
.landing-foot .lf-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px;
}
.landing-foot .lf-links { display: flex; flex-wrap: wrap; align-items: center; row-gap: 10px; column-gap: 22px; font-size: .85rem; color: var(--ink-2); }
.landing-foot small { color: var(--ink-3); font-size: .78rem; }

/* ---------------------------------------------------------------- Responsive */
.scrim {
  display: none; position: fixed; inset: 0; z-index: 40;
  background: rgba(42,54,54,.3);
}

/* ---- Bottom nav (mobile only) ---- */
.bottom-nav { display: none; }
.mobile-quick-sheet { display: none; }

@media (max-width: 1080px) {
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .g-3 { grid-template-columns: repeat(2, 1fr); }
  .span-3 { grid-column: span 2; }
  .landing-hero { grid-template-columns: 1fr; gap: 40px; padding: 40px 30px; }
  .landing-hero h1 { font-size: 2.4rem; }
  .feature-grid, .steps, .vet-section .vet-perks { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .sidebar {
    position: fixed; z-index: 50; left: 0; top: 0;
    width: 280px;
    height: 100dvh; overflow-y: auto;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 0 10px 40px -10px rgba(42,54,54,.25);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .scrim { display: block; }
  .topbar .menu-btn { display: block; }
  .topbar .back-btn + .menu-btn { display: none; }
  .topbar .back-btn { width: 32px; height: 32px; border-radius: 8px; }
  .topbar .back-btn svg { width: 17px; height: 17px; }
  .content { padding: 20px 16px calc(78px + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding: 12px 16px; gap: 10px; }
  .topbar .page-title h1 { font-size: 1.05rem; }
  .topbar .page-title p { display: none; }
  .g-2, .g-3, .g-4 { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: span 1; }
  .field-row { flex-direction: column; gap: 0; }
  /* 16px stops iOS auto-zooming (and shifting the layout) when a field is tapped */
  .input, select.input, textarea.input { font-size: 16px; }
  .hero { padding: 20px; border-radius: var(--radius); }
  .hero h2 { font-size: 1.15rem; }
  .hero p { font-size: .85rem; }
  .hero .hero-stats { gap: 12px; }
  .hero .hero-stats .hs .n { font-size: 1.1rem; }
  .hero .hero-stats .hs .l { font-size: .62rem; }
  .dog-switch .dog-name-txt { display: none; }
  .stat .value { font-size: 1.4rem; }
  .card { padding: 16px; }
  .card-head { flex-wrap: wrap; gap: 8px; }
  .table { font-size: .8rem; display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table th, .table td { padding: 8px 10px; white-space: nowrap; }
  .chart svg { max-height: 180px; }
  .row.no-print { flex-direction: column; gap: 10px; }
  .row.no-print .alert { margin-bottom: 0; }
  .landing-nav { padding: 18px 20px; }
  .landing-hero { padding: 28px 20px; }
  .landing-hero h1 { font-size: 2rem; }
  .section { padding: 44px 20px; }
  .feature-grid, .steps, .vet-section .vet-perks { grid-template-columns: 1fr; }
  .cta-band { padding: 28px 20px; }
  .cta-band h2 { font-size: 1.5rem; }

  /* ---- Mobile bottom navigation ---- */
  /* Anchored to the very bottom edge (no gap below, so you never scroll into a
     void beyond it) but with a rounded top, a clear border and a strong upward
     shadow so it stands out from the flat, square browser chrome. */
  .bottom-nav {
    display: flex;
    position: fixed; z-index: 30;
    left: 0; right: 0; bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around; align-items: stretch; gap: 2px;
    box-shadow: 0 -7px 24px -5px rgba(42,54,54,.22), 0 -1px 4px rgba(42,54,54,.10);
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; padding: 8px 4px 6px;
    border: none; background: none; cursor: pointer;
    color: var(--ink-3); font-size: .62rem; font-weight: 600;
    text-decoration: none; flex: 1; min-width: 0; border-radius: 14px;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s, color .15s;
  }
  /* Active tab gets a filled pill so the current page is obvious. */
  .bottom-nav a.active, .bottom-nav button.active {
    color: var(--sage-dark); background: var(--mint);
  }
  .bottom-nav svg { width: 22px; height: 22px; flex: 0 0 22px; }
  .bottom-nav span { display: block; line-height: 1; }

  /* Quick-actions grid (from bottom nav "Log" tab) */
  .mobile-quick-sheet {
    display: none; position: fixed; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); left: 12px; right: 12px; z-index: 35;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 14px;
    box-shadow: 0 12px 30px -6px rgba(42,54,54,.3);
  }
  .mobile-quick-sheet.open { display: block; }
  .mobile-quick-sheet .mqs-title { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); margin-bottom: 10px; }
  .mobile-quick-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  }
  .mobile-quick-grid .ql-cat-btn {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 14px 8px; border-radius: var(--radius-sm);
    background: var(--surface-2); border: 1px solid var(--line);
    color: var(--ink); font-size: .78rem; font-weight: 600; cursor: pointer;
  }
  .mobile-quick-grid .ql-cat-btn:active, .mobile-quick-grid .ql-cat-btn.active {
    background: var(--mint); border-color: var(--sage); color: var(--sage-dark);
  }
  .mobile-quick-grid .ql-cat-btn svg { width: 24px; height: 24px; color: var(--sage-dark); }
  .ql-inline-area { display: none; margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
  .ql-inline-head { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--sage-dark); margin-bottom: 8px; }
}

/* ---------------------------------------------------------------- Quick Log shared */
.ql-form .ql-row { margin-bottom: 8px; display: flex; gap: 8px; }
.ql-form .ql-row .input { flex: 1; }
.ql-form .ql-row .btn { min-height: 38px; }
.ql-status { font-size: .78rem; margin-top: 6px; min-height: 1.2em; text-align: center; }
.ql-status.saving { color: var(--ink-3); }
.ql-status.ok { color: var(--good, #34a853); font-weight: 600; }
.ql-status.err { color: var(--bad, #ea4335); font-weight: 600; }
.ql-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.ql-modal { width: min(380px, 90vw); z-index: 1001; animation: qlFadeIn .15s ease; }
@keyframes qlFadeIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
.sidebar-ql { display: flex; gap: 6px; padding: 4px 12px 8px; flex-wrap: wrap; }
.ql-sidebar-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--sage-dark); cursor: pointer; transition: background .15s, border-color .15s;
}
.ql-sidebar-btn:hover { background: var(--mint); border-color: var(--sage); }
.ql-sidebar-btn svg { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- Print */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 12px; }
  .sidebar, .topbar, .scrim, .no-print, .guest-banner,
  .bottom-nav, #quick-sheet, .ql-sheet { display: none !important; }
  .main { display: block; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #d6dae0; break-inside: avoid; }
  .hero { background: #f9f6f3 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-only { display: block !important; }
  a { color: var(--ink); }

  /* Pet_OS letterhead — first page only (normal document flow at the very top,
     so it never overlaps content and does not repeat). Stays well under 1/5 of
     an A4 page (~59mm). */
  .print-letterhead {
    display: flex !important; align-items: center; justify-content: space-between; gap: 12px;
    margin: 0 0 7mm; padding-bottom: 4mm; border-bottom: 3px solid #739695;
    break-inside: avoid; break-after: avoid;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .print-letterhead .pl-brand { display: flex; align-items: center; gap: 4mm; }
  .print-letterhead .pl-mark { width: 15mm; height: 15mm; color: #739695; display: inline-flex; }
  .print-letterhead .pl-mark svg { width: 100%; height: 100%; }
  .print-letterhead .pl-name { font-weight: 800; font-size: 25px; color: #2a3636; letter-spacing: -0.02em; line-height: 1; }
  .print-letterhead .pl-name span { color: #739695; }
  .print-letterhead .pl-sub { font-size: 9px; text-transform: uppercase; letter-spacing: .12em; color: #8a9a9a; margin-top: 3px; }
  .print-letterhead .pl-doc { text-align: right; }
  .print-letterhead .pl-doc b { display: block; font-size: 15px; color: #2a3636; }
  .print-letterhead .pl-doc small { font-size: 11px; color: #8a9a9a; }

  /* Provenance footer — in normal flow at the end of the document, so it prints
     once after the last record (on the final page only). */
  .print-footer {
    display: flex !important; align-items: center; justify-content: space-between;
    margin-top: 8mm; padding-top: 2mm; border-top: 1px solid #d6dae0;
    font-size: 9px; color: #8a9a9a; break-inside: avoid;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
}
.print-only, .print-letterhead, .print-footer { display: none; }

/* ---- Vet summary: owner-chosen sections + "withheld" footer ---- */
.vs-off { display: none !important; }
.vs-panel .card-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.vs-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 8px 14px; margin-top: 6px; }
.vs-check { display: flex; align-items: center; gap: 9px; font-size: .9rem; color: var(--ink); cursor: pointer;
  padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); user-select: none; }
.vs-check:hover { border-color: var(--sage, #739695); }
.vs-check input { width: 17px; height: 17px; accent-color: var(--sage, #739695); flex: none; cursor: pointer; }
.vs-mini { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-bottom: 12px; }
.vs-mini .vs-m { display: flex; flex-direction: column; }
.vs-m > span { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); }
.vs-m > b { font-size: 1.05rem; color: var(--ink); }
.vs-excluded-card { background: var(--surface-2, #fbf6f1); border: 1px dashed var(--line, #d6dae0); }
.vs-excluded { font-size: .85rem; color: var(--ink-2); line-height: 1.5; }
.vs-exc-note { margin-top: 6px; font-size: .8rem; color: var(--ink-3); }
.vs-exc-ok { color: var(--sage, #739695); font-weight: 600; }
.vs-subnote { margin-top: 3px; font-size: .82rem; color: var(--ink-2); line-height: 1.45; white-space: pre-wrap; }
@media print {
  /* ---- Vet summary: compact, FLOWING print (multiple sections per page) ----
     The global `.card { break-inside: avoid }` forced each section onto its own
     page (huge whitespace). Here cards flow; only small units stay intact. */
  #vs-print-root { font-size: 9.5px; }
  #vs-print-root .card { break-inside: auto !important; margin: 0 0 6px !important;
    padding: 7px 9px !important; border: 1px solid #cfd6d6 !important; border-radius: 5px; }
  #vs-print-root .card-head { margin-bottom: 3px !important; }
  #vs-print-root .card-head h2 { font-size: 12px !important; margin: 0; }
  #vs-print-root .card-head .sub, #vs-print-root .card-head .badge { font-size: 8px !important; }
  /* Tables: dense, header repeats on each page, rows never split */
  #vs-print-root .table { font-size: 9px !important; }
  #vs-print-root .table th { padding: 2px 5px !important; background: #eef2f1 !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #vs-print-root .table td { padding: 2px 5px !important; }
  #vs-print-root .table thead { display: table-header-group; }
  #vs-print-root .table tr { break-inside: avoid; }
  #vs-print-root .vs-subnote { font-size: 8.5px !important; margin-top: 1px; }
  #vs-print-root .vs-mobile { display: none !important; }
  #vs-print-root .vs-desktop { display: block !important; }
  /* Symptom notes are free-text paragraphs — a table <td> CLIPS them at a page
     break. Render the symptoms section as flowing block cards in print so long
     notes wrap and flow onto the next page instead of being cut off. */
  #vs-print-root [data-vsec="symptoms"] .vs-desktop { display: none !important; }
  #vs-print-root [data-vsec="symptoms"] .vs-mobile { display: block !important; }
  #vs-print-root [data-vsec="symptoms"] .vs-card { break-inside: avoid; border: none !important;
    box-shadow: none !important; background: none !important; padding: 3px 0 6px !important;
    margin: 0 !important; border-radius: 0 !important; border-bottom: 1px solid #e3e8e8 !important; }
  #vs-print-root [data-vsec="symptoms"] .vs-card .l1 { font-size: 8px; }
  #vs-print-root [data-vsec="symptoms"] .vs-card .l2 { font-size: 10px; font-weight: 700; }
  #vs-print-root [data-vsec="symptoms"] .vs-card .l4 { font-size: 9px; color: #33403f;
    white-space: pre-wrap; line-height: 1.4; margin-top: 2px; }

  /* Header (Patient / Owner / Care) — tight band at the very top, ≤ 1/4 page,
     clear labels + dark legible values */
  #vs-print-root .vs-header { break-inside: avoid; padding: 8px 10px !important; margin-bottom: 8px !important; }
  #vs-print-root .vs-header img { width: 26px !important; height: 26px !important; }
  #vs-print-root .vs-header .brand-name { font-size: 14px !important; }
  #vs-print-root .vs-header .muted-txt { font-size: 8.5px !important; }
  #vs-print-root .vs-header .badge { display: none !important; }
  #vs-print-root .vs-header .divider { margin: 5px 0 !important; }
  #vs-print-root .vs-header .grid { gap: 10px !important; }
  #vs-print-root .vs-header .section-title { font-size: 8.5px !important; letter-spacing: .05em;
    color: #3d5a5a !important; margin-bottom: 2px !important; font-weight: 700; }
  #vs-print-root .vs-header .kv { padding: 1px 0 !important; }
  #vs-print-root .vs-header .kv .k { font-size: 9px; color: #6a7a7a; }
  #vs-print-root .vs-header .kv .v { font-size: 9.5px; color: #1e2b2b; font-weight: 600; }
  #vs-print-root .vs-header p { font-size: 9px !important; margin: 0 !important; color: #33403f; }

  /* Weight chart + mini stats: keep small so the section isn't a page-filler */
  #vs-print-root svg { max-height: 120px !important; }
  #vs-print-root .vs-mini { gap: 3px 18px !important; margin-bottom: 5px !important; }
  #vs-print-root .vs-mini .vs-m > span { font-size: 7.5px; }
  #vs-print-root .vs-mini .vs-m > b { font-size: 11px; }
  #vs-print-root .kv { padding: 1px 0 !important; }

  .vs-excluded-card { border: 1px dashed #b9c2c2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #vs-print-root .vs-excluded { font-size: 8.5px !important; }
}

/* Toggle switch */
.toggle-row{display:flex;align-items:center;justify-content:space-between;padding:8px 0;border-bottom:1px solid var(--line-2);}
.toggle-row:last-child{border-bottom:none;}
.toggle-label{font-size:.88rem;font-weight:500;color:var(--ink);}
.toggle-sub{font-size:.76rem;color:var(--ink-3);margin-top:1px;}
.toggle-switch{position:relative;width:44px;height:26px;flex-shrink:0;}
.toggle-switch input{opacity:0;width:0;height:0;position:absolute;}
.toggle-switch .slider{position:absolute;inset:0;background:var(--line);border-radius:26px;cursor:pointer;transition:background .2s;}
.toggle-switch .slider::before{content:'';position:absolute;width:20px;height:20px;left:3px;bottom:3px;background:#fff;border-radius:50%;transition:transform .2s;box-shadow:0 1px 3px rgba(0,0,0,.18);}
.toggle-switch input:checked+.slider{background:var(--sage);}
.toggle-switch input:checked+.slider::before{transform:translateX(18px);}
.toggle-switch input:disabled+.slider{opacity:.5;cursor:default;}
.perm-section{margin-top:12px;padding:12px 14px;background:var(--surface-2);border-radius:12px;}

/* --- Advanced Settings --- */
.adv-back{margin-bottom:16px;}
.adv-section .card-head{display:flex;justify-content:space-between;align-items:center;}
.adv-arrow{font-size:14px;color:var(--muted);transition:transform .2s;}
.adv-body{padding:0 20px 16px;}
.adv-row{border-bottom:1px solid var(--line);padding:10px 0;}
.adv-row:last-child{border-bottom:none;}
.adv-row-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
.adv-row-summary{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;}
.adv-row-fields{padding:12px 0 4px;}
.adv-fields-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:10px;}
.adv-field{display:flex;flex-direction:column;gap:2px;}
.adv-label{font-size:11px;font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.5px;}
.adv-val{font-size:14px;color:var(--text);padding:4px 0;}
.adv-status{font-size:13px;margin-left:4px;}
.adv-status.saving{color:var(--muted);}
.adv-status.ok{color:var(--sage);}
.adv-status.err{color:var(--bad);}
@media(max-width:600px){
  .adv-fields-grid{grid-template-columns:1fr;}
}

/* Clinical overview metric tiles */
.metric-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;}
.metric-tile{text-align:center;padding:12px 8px;border-radius:10px;background:var(--glass,rgba(255,255,255,.06));}
.metric-val{font-size:1.6rem;font-weight:700;line-height:1.2;color:var(--txt);}
.metric-label{font-size:.82rem;opacity:.7;margin-top:2px;}
.metric-sub{font-size:.72rem;opacity:.5;margin-top:4px;}
@media(max-width:768px){.metric-grid{grid-template-columns:repeat(3,1fr);}}
@media(max-width:480px){.metric-grid{grid-template-columns:repeat(2,1fr);}}

/* Clinical history entries */
.clin-list{padding:0 0 8px;}
.clin-entry{padding:16px 20px;border-bottom:1px solid var(--line);}
.clin-entry:last-child{border-bottom:none;}
.clin-head{display:flex;justify-content:space-between;align-items:center;gap:8px;}
.clin-date{font-size:.82rem;opacity:.6;}
.clin-title{font-size:1rem;font-weight:600;margin:6px 0 2px;}
.clin-author{font-size:.82rem;opacity:.6;margin-bottom:4px;}
.clin-notes{font-size:.88rem;line-height:1.5;margin-top:6px;white-space:pre-line;opacity:.85;}
.clin-nextdue{display:inline-flex;align-items:center;gap:6px;margin-top:8px;font-size:.85rem;font-weight:600;color:var(--sage-dark);}
.clin-nextdue svg{width:15px;height:15px;flex:0 0 auto;}
.clin-nextdue.clin-overdue{color:var(--bad);}
.clin-actions{flex-shrink:0;}
.clin-photos{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px;}
.clin-photos img{width:52px;height:52px;object-fit:cover;border-radius:8px;border:1px solid var(--line);transition:transform .15s;cursor:zoom-in;}
.clin-photos img:hover{transform:scale(1.15);}
@media(max-width:600px){.clin-head{flex-direction:column;align-items:flex-start;}.clin-actions{margin-top:6px;}}
.blood-table{width:100%;border-collapse:collapse;margin-top:10px;font-size:.82rem;}
.blood-table th{text-align:left;padding:6px 10px;border-bottom:2px solid var(--line);font-weight:600;opacity:.6;font-size:.75rem;text-transform:uppercase;}
.blood-table td{padding:5px 10px;border-bottom:1px solid var(--line);}
.blood-table tr:last-child td{border-bottom:none;}
.blood-table .neg{color:var(--bad);}

/* ===== Hover explainer tooltips (data-tip) ===== */
[data-tip]{position:relative}
[data-tip]::after{
  content:attr(data-tip);
  position:absolute; left:50%; bottom:calc(100% + 9px);
  transform:translateX(-50%) translateY(4px);
  width:max-content; min-width:150px; max-width:250px;
  background:var(--ink); color:#fff;
  font-size:.72rem; line-height:1.4; font-weight:500; text-align:left;
  padding:8px 11px; border-radius:9px;
  box-shadow:0 8px 24px rgba(42,54,54,.24);
  opacity:0; visibility:hidden; pointer-events:none;
  transition:opacity .14s ease, transform .14s ease; z-index:80; white-space:normal;
}
[data-tip]::before{
  content:''; position:absolute; left:50%; bottom:calc(100% + 4px);
  transform:translateX(-50%) translateY(4px);
  border:5px solid transparent; border-top-color:var(--ink);
  opacity:0; visibility:hidden; pointer-events:none;
  transition:opacity .14s ease, transform .14s ease; z-index:81;
}
[data-tip]:hover::after,[data-tip]:focus-visible::after{opacity:1;visibility:visible;transform:translateX(-50%) translateY(0)}
[data-tip]:hover::before,[data-tip]:focus-visible::before{opacity:1;visibility:visible;transform:translateX(-50%) translateY(0)}

/* Sidebar items: float the tip to the right so it never covers the menu */
.sidebar [data-tip]::after{left:calc(100% + 12px);bottom:auto;top:50%;transform:translateY(-50%) translateX(-4px)}
.sidebar [data-tip]::before{left:calc(100% + 3px);bottom:auto;top:50%;transform:translateY(-50%) translateX(-4px);border:5px solid transparent;border-right-color:var(--ink)}
.sidebar [data-tip]:hover::after,.sidebar [data-tip]:focus-visible::after{transform:translateY(-50%) translateX(0)}
.sidebar [data-tip]:hover::before,.sidebar [data-tip]:focus-visible::before{transform:translateY(-50%) translateX(0)}

/* No hover tooltips on touch devices (the FAQ + native titles cover those) */
@media (hover:none){ [data-tip]::after,[data-tip]::before{display:none!important} }
@media (max-width:900px){ .sidebar [data-tip]::after,.sidebar [data-tip]::before{display:none!important} }

/* ===== Guest demo FAQ / welcome card ===== */
.faq-card{border:1px solid var(--sage-soft);background:linear-gradient(180deg,var(--sage-soft) 0%, var(--surface) 70px)}
.faq-card h2{font-size:1.05rem}
.faq-list{margin-top:14px;display:grid;gap:8px}
.faq-item{border:1px solid var(--line);border-radius:var(--radius-sm);background:var(--surface);overflow:hidden}
.faq-item summary{cursor:pointer;list-style:none;padding:12px 14px;font-weight:600;font-size:.9rem;color:var(--ink);
  display:flex;align-items:center;justify-content:space-between;gap:10px}
.faq-item summary::-webkit-details-marker{display:none}
.faq-item summary::after{content:'+';font-size:1.15rem;font-weight:600;color:var(--sage);line-height:1;flex:none}
.faq-item[open] summary::after{content:'\2013'}
.faq-item[open] summary{border-bottom:1px solid var(--line-2)}
.faq-item .faq-a{padding:12px 14px;font-size:.85rem;line-height:1.55;color:var(--ink-2)}
.faq-item:hover{border-color:var(--sage)}

/* ===== Recent activity — day-by-day navigation ===== */
.ra-head{align-items:center}
.ra-nav{display:flex;align-items:center;gap:6px}
.ra-daylabel{font-size:.82rem;font-weight:600;color:var(--ink-2);min-width:118px;text-align:center}
.ra-daylabel-static{min-width:0}
.ra-prev,.ra-next{width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;
  font-size:1.15rem;line-height:1;border:1px solid var(--line);border-radius:8px;background:var(--surface);
  color:var(--ink-2);cursor:pointer;padding:0;transition:background .12s ease,color .12s ease,border-color .12s ease}
.ra-prev:hover:not(:disabled),.ra-next:hover:not(:disabled){background:var(--sage-soft);color:var(--ink);border-color:var(--sage)}
.ra-prev:disabled,.ra-next:disabled{opacity:.35;cursor:default}

/* ===== Weigh-in history table polish ===== */
.wh-table td{vertical-align:middle}
.wh-date{font-weight:600;color:var(--ink)}
.wh-note{font-size:.72rem;color:var(--ink-3);margin-top:2px;max-width:280px;line-height:1.35}
.wh-chg{font-weight:600}
.wh-badge{font-size:.58rem;margin-left:6px;vertical-align:middle}
.wh-latest{background:linear-gradient(90deg,var(--sage-soft),transparent 70%)}
.wh-latest td:first-child{box-shadow:inset 3px 0 0 var(--sage)}

/* ===== Vet Summary — responsive tables → stacked cards on small screens ===== */
.vs-mobile{display:none}
@media (max-width:760px){
  .vs-desktop{display:none}
  .vs-mobile{display:block}
}
.vs-card{border:1px solid var(--line);border-radius:11px;padding:11px 13px;margin-bottom:9px;background:var(--surface);box-shadow:var(--shadow)}
.vs-card .l1{display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:.74rem;font-weight:600;color:var(--ink-3);text-transform:uppercase;letter-spacing:.02em}
.vs-card .l2{font-size:.95rem;font-weight:700;color:var(--ink);margin-top:4px;display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.vs-card .l3{font-size:.82rem;color:var(--ink-2);margin-top:3px}
.vs-card .l4{font-size:.82rem;color:var(--ink-3);margin-top:4px;line-height:1.45}
.vs-pill{font-size:.72rem;font-weight:700;color:var(--sage-dark);background:var(--sage-soft);border-radius:20px;padding:2px 9px;text-transform:none;letter-spacing:0}
.vs-metrics{display:grid;grid-template-columns:1fr 1fr;gap:2px 16px;margin-top:8px}
.vs-m{display:flex;justify-content:space-between;gap:8px;font-size:.82rem;padding:4px 0;border-bottom:1px dashed var(--line-2)}
.vs-m span{color:var(--ink-3)}
.vs-m b{color:var(--ink);font-weight:600}

/* ===== Dashboard stat cards — combined into one card on mobile ===== */
.dash-stats{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.ds-tile{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;
  padding:12px 6px;border-radius:12px;background:var(--surface-2);border:1px solid var(--line-2)}
.ds-ico{color:var(--sage);margin-bottom:5px;display:flex;align-items:center;justify-content:center}
.ds-ico svg{width:22px;height:22px}
.ds-val{font-size:1.3rem;font-weight:700;color:var(--ink);line-height:1.05}
.ds-val small{font-size:.72rem;font-weight:600;color:var(--ink-3)}
.ds-lbl{font-size:.68rem;color:var(--ink-3);text-transform:uppercase;letter-spacing:.03em;margin-top:3px;line-height:1.2}
.dash-stat-card{padding:14px}

/* ===== Medication page — log form + list side by side, stack on mobile ===== */
.med-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 18px; margin-top: 18px; }
@media (max-width: 760px) { .med-grid { grid-template-columns: 1fr; } }

/* ===== Conditions page ===== */
.cond-chips { display:flex; flex-wrap:wrap; gap:8px; }
.cond-chip { padding:7px 13px; border:1px solid var(--line); border-radius:999px; background:var(--surface); color:var(--ink-2); font-size:.82rem; font-weight:600; cursor:pointer; transition:.12s; }
.cond-chip:hover { border-color:var(--sage); color:var(--ink); }
.cond-chip.active { background:var(--sage); border-color:var(--sage); color:#fff; }
.cond-list { display:flex; flex-direction:column; gap:0; }
.cond-entry { padding:14px 0; border-bottom:1px solid var(--line-2); }
.cond-entry:last-child { border-bottom:none; }
.cond-when { font-size:.78rem; color:var(--ink-3); font-weight:600; display:flex; align-items:center; gap:8px; }
.cond-title { font-size:.98rem; font-weight:700; color:var(--ink); margin-top:3px; }
.cond-author { font-size:.8rem; color:var(--ink-2); margin-top:2px; }
.cond-notes { font-size:.86rem; color:var(--ink-2); margin-top:6px; line-height:1.5; }
.cond-photos { display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }
.cond-photos img { width:96px; height:96px; object-fit:cover; border-radius:10px; border:1px solid var(--line); }

/* ===== Image lightbox (in-page photo viewer) ===== */
body.lb-lock { overflow: hidden; }
.lb-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(20,26,26,.85);
  display: none; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; }
.lb-overlay.open { display: flex; }
.lb-img { max-width: min(90vw, 900px); max-height: 88vh; width: auto; height: auto;
  object-fit: contain; border-radius: 10px; box-shadow: 0 12px 50px rgba(0,0,0,.55); cursor: default; }
.lb-close { position: absolute; top: 16px; right: 20px; width: 42px; height: 42px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.16); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
.lb-close:hover { background: rgba(255,255,255,.32); }
.cond-photos img { cursor: zoom-in; }

/* ------------------------------------------------------------------ Mobile readability
   Faint secondary text (the muted greys) can be hard to read on small / high-DPI
   screens. On mobile only, make it slightly bolder and a touch larger so it
   stands out from the background. Colours are intentionally left unchanged. */
@media (max-width: 720px) {
  /* App secondary / muted text */
  .sub, .card-head .sub { font-weight: 600; font-size: .82rem; }
  .hint { font-weight: 600; font-size: .78rem; }
  small { font-size: .84rem; }
  .stat .label { font-weight: 700; font-size: .7rem; }
  .stat .delta { font-weight: 600; font-size: .8rem; }
  .stat .value .unit { font-weight: 600; }
  .list-row .lr-main small, .lr-main small { font-weight: 600; font-size: .8rem; }
  .list-row .lr-time, .tl-time { font-weight: 600; }
  .muted-txt { font-weight: 600; }
  .page-title p { font-weight: 500; font-size: .85rem; }
  .table thead th { font-weight: 700; }
  .cond-when, .cond-author { font-weight: 600; }
  .po-id small, .po-stat small { font-weight: 600; }
  .user-chip .meta small { font-weight: 600; }

  /* Landing-page secondary text */
  .landing-hero .lead { font-weight: 500; }
  .landing-hero .micro { font-weight: 600; font-size: .82rem; }
  .step p, .feature p, .cta-band p { font-weight: 500; font-size: .92rem; }
  .vet-section p, .vet-section .vp p { font-weight: 600; }
  .landing-foot .lf-links { font-weight: 600; }
  .landing-foot small { font-weight: 600; font-size: .8rem; }
}

/* Small phones: stop the landing header from cramming the brand and the three
   login/CTA buttons onto one line — stack the brand, then lay the buttons out in
   a 2-up grid with the primary CTA full-width beneath. */
@media (max-width: 600px) {
  .landing-nav { flex-wrap: wrap; padding: 12px 14px; gap: 10px; }
  .landing-nav .brand-sub { display: none; }
  .landing-nav .nav-actions {
    width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  }
  .landing-nav .nav-actions .btn {
    width: 100%; justify-content: center; font-size: .8rem; padding: 9px 6px;
  }
  .landing-nav .nav-actions .btn-primary { grid-column: 1 / -1; }

  /* Footer: stack the three blocks and centre the links so they wrap into tidy
     rows with comfortable tap targets instead of squashing onto one line. */
  .landing-foot { padding: 28px 18px; }
  .landing-foot .lf-inner { flex-direction: column; text-align: center; gap: 16px; }
  .landing-foot .lf-links { justify-content: center; row-gap: 14px; column-gap: 20px; }
  .landing-foot .lf-links a { padding: 2px 0; }
}

/* === CSP-refactor generated utility classes (Phase 1) BEGIN — do not edit by hand === */
/* Auto-generated: inline-style -> utility classes (CSP: drop style-src unsafe-inline) */
.cs002535c2{margin-top:12px}
.cs015ccf91{max-width:280px}
.cs03ca248c{width:60px;height:60px;border-radius:14px;font-size:1.4rem;display:grid;place-items:center;background:var(--mint);color:var(--sage-dark);font-weight:700}
.cs05f83e3e{text-align:center;color:var(--muted);padding:24px 0}
.cs0674c99e{margin:12px 0 6px;font-size:.85rem}
.cs06a4eaa9{margin:2px 0 6px}
.cs0998cfa6{margin:0 0 10px}
.cs09d2645d{display:flex;gap:6px;justify-content:center;margin-bottom:10px;flex-wrap:wrap}
.cs0a8321c2{display:flex;gap:12px;flex-wrap:wrap}
.cs0d083f01{border-top:1px solid var(--line);margin-top:10px;padding-top:10px}
.cs0f8ab67f{padding:24px}
.cs116e33d4{text-decoration:none}
.cs1188506b{display:flex;gap:12px;align-items:center}
.cs12602178{font-size:.65rem;padding:2px 8px}
.cs12f5078b{color:var(--bad)}
.cs1386d503{margin:0}
.cs197caa1c{border-radius:2.5mm;object-fit:cover}
.cs1d73260a{display:flex;gap:8px;margin-top:12px}
.cs1e28117f{font-size:.85rem}
.cs1e38db19{max-width:580px;margin:24px auto}
.cs21550a0e{border-radius:11px;object-fit:cover;flex:none}
.cs2475a49c{flex:0 0 130px}
.cs25b3f227{justify-content:space-between;align-items:flex-start}
.cs28d53b44{font-size:.8rem;font-weight:600}
.cs2937bfc9{margin-bottom:6px}
.cs29491a97{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:16px;padding:0 16px 16px}
.cs298a08a1{flex-shrink:0;font-size:.6rem}
.cs2a9780cb{display:flex;align-items:center;gap:8px}
.cs2bb449c5{font-size:.82rem;font-weight:700;color:var(--ink-2,#4a5e5e);margin-bottom:2px}
.cs2c406fe1{min-width:92px;color:var(--muted,#6b756b);font-size:.85rem}
.cs304cd5c4{gap:8px}
.cs35bf4c50{display:flex;gap:8px;flex-wrap:wrap;align-items:flex-end}
.cs38ea7886{font-size:.7rem;padding:2px 8px}
.cs3b6ea3b0{font-size:.7rem;text-transform:uppercase;letter-spacing:.05em;margin-bottom:4px}
.cs3f8b0c8f{font-size:.85rem;font-weight:600}
.cs40ffb232{margin-top:8px;font-size:.72rem}
.cs416c260c{padding:10px 0}
.cs4203b167{padding:0 16px 16px}
.cs4299a86b{margin:2px 0 10px;padding:8px 10px;border-radius:8px;background:var(--surface-2);border:1px solid var(--line);color:var(--ink);font-size:.85rem}
.cs43cf0a8f{width:32px;height:32px}
.cs4425bd83{display:flex;gap:8px;justify-content:center}
.cs46b97fad{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:8px}
.cs46d9728a{text-align:center;margin-top:6px}
.cs47bf79cd{justify-content:space-between;align-items:center;margin-bottom:18px}
.cs487b71ac{margin-right:6px}
.cs4a909ea7{margin-top:18px}
.cs4dca390c{display:flex;justify-content:space-between;align-items:flex-start;gap:8px}
.cs4ddbe905{white-space:nowrap}
.cs4e3268c5{margin:-6px 0 10px}
.cs4ed22e4f{width:100%;margin-top:12px}
.cs525d357c{width:28px;height:28px;font-size:.8rem}
.cs5371db16{margin-top:10px}
.cs53896af7{margin-top:0}
.cs553a645f{margin-top:14px}
.cs57e3b83c{display:flex;align-items:center;gap:16px;margin:4px 0 8px}
.cs5892cc35{border-radius:9px;object-fit:cover}
.cs59d2d25d{display:flex;align-items:center;gap:6px;width:100%;background:none;border:none;cursor:pointer;color:var(--muted);font-size:.78rem;font-weight:600;padding:4px 0}
.cs5a95e492{display:flex;align-items:center;gap:8px;margin:8px 0;flex-wrap:wrap}
.cs5aa3351e{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.cs5c0e5c5c{font-size:2rem}
.cs5cb88d6c{font-weight:700;font-size:.92rem}
.cs5cd105e1{flex-shrink:0}
.cs5d029f6b{display:flex;align-items:center;gap:8px;cursor:pointer}
.cs5fdf3b88{font-size:.65rem;padding:3px 9px;color:var(--bad,#b16969);flex:none;align-self:center}
.cs6179637e{margin-bottom:14px}
.cs6338c16e{flex:1;min-width:120px;padding:16px;font-size:1.1rem}
.cs640fb1f6{font-size:.75rem}
.cs69a81fa6{flex:1;min-width:120px;padding:16px;font-size:1.1rem;background:var(--ink);border-color:var(--ink)}
.cs6b8c4e6f{color:#c62828}
.cs6bc2c43f{display:flex;justify-content:center;gap:6px;margin-top:12px}
.cs6c080f71{font-size:.82rem;font-weight:700;color:var(--ink-2);margin-bottom:2px}
.cs6c660c40{font-size:.8rem}
.cs6d567387{width:100%}
.cs6e851220{margin:0;min-width:130px}
.cs7783fdb9{text-align:right;white-space:nowrap}
.cs7b56b780{text-align:center;padding:16px 8px;border-radius:12px;background:var(--surface-2)}
.cs7eef7a4b{width:64px;height:64px;object-fit:cover}
.cs83456371{margin-left:auto}
.cs8417f0ab{font-size:2rem;font-weight:800;color:var(--ink)}
.cs85478e18{display:flex;gap:6px;margin-bottom:14px;flex-wrap:wrap}
.cs85c94008{font-size:.78rem;margin-top:4px;text-align:center}
.cs885bcd31{align-items:center;gap:16px;margin-bottom:16px}
.cs8900119e{flex:1;min-width:200px}
.cs89bd09bd{flex:1;min-width:0}
.cs8e86974b{margin-bottom:16px}
.cs8ecb7ab7{padding:10px 14px;border-radius:10px;background:var(--bg-inset,var(--bg));border:1px solid var(--line);margin-bottom:6px}
.cs8f4df63b{margin:0 6px 6px 0}
.cs901210d0{flex-wrap:wrap}
.cs90dab10d{font-size:.65rem;padding:1px 6px}
.cs90e775c8{font-size:.82rem;font-weight:600;color:var(--ink-2);margin-bottom:6px}
.cs981232ad{font-size:.65rem;text-transform:uppercase;letter-spacing:.05em;margin-bottom:1px}
.cs9c68691e{display:flex;gap:8px}
.cs9cf24ebc{font-size:2.6rem;line-height:1}
.cs9e3c4ccb{margin-top:6px}
.cs9f471482{display:flex;flex-wrap:wrap;margin:6px 0 2px}
.csa08e41ae{font-size:1.6rem;font-weight:800;color:var(--ink)}
.csa18ac805{margin-top:4px}
.csa2ef1fee{width:30px;height:30px}
.csa37c8065{margin-top:10px;padding:10px 12px;border-radius:10px;background:var(--surface-2);border:1px solid var(--line);color:var(--ink);font-size:.85rem}
.csa4d27b00{border-top:1px solid var(--line);padding-top:12px;margin-top:4px;display:flex;flex-direction:column;gap:8px}
.csa58b070e{margin-bottom:4px}
.csa7409f75{margin-bottom:10px}
.csab66dd84{font-size:1.4rem}
.csac536598{width:100%;margin-top:6px;display:none}
.csaeef964b{flex:1;min-width:200px;margin:0}
.csb0043ef4{margin-top:16px}
.csb202c6d4{cursor:pointer}
.csb4f3977c{cursor:pointer;font-weight:600;margin:10px 0}
.csb5053b62{align-items:flex-start}
.csb59192e1{max-width:440px;margin:0 auto 16px}
.csbe254048{margin-bottom:18px}
.csc06f0888{margin:8px 0 4px}
.csc1ad78c0{color:var(--muted,#6b756b);font-size:.82rem}
.csc2fdd3c6{color:var(--sage2)}
.csc2fec4e5{padding:8px}
.csc67d2150{font-size:.78rem;margin-top:2px}
.csc694ca20{padding:20px;text-align:center;color:#ccc}
.csc9d43774{margin:0 0 12px}
.cscb458930{display:none}
.cscc73531a{font-size:.72rem}
.cscca18063{margin:10px 0}
.cscec64b9c{margin:-8px 0 8px;font-style:italic;color:var(--muted)}
.csd0eaf63a{width:100%;margin-top:8px}
.csd28c23a4{font-size:.72rem;margin-top:3px}
.csd4316970{margin-top:8px}
.csd51702bf{margin-bottom:8px}
.csda5cd676{flex:1}
.csdc455531{font-size:.82rem;margin-top:2px}
.csdc8170b4{margin:0;min-width:140px}
.csdcb2d585{display:none;margin-top:8px}
.cse0e9ec07{display:flex;gap:8px;flex-wrap:wrap}
.cse154c586{background:#78350f;color:#fff;border-color:#78350f}
.cse472839b{transition:transform .2s}
.cse4d0f6a7{color:var(--ink-3);font-size:.65rem}
.cse7ec5403{margin-bottom:0}
.csebe081d3{text-align:center;margin-top:8px;font-size:.75rem}
.csec5915ea{padding:4px 0}
.cseda6c30d{opacity:.7}
.csf088a2f0{background:none;border:none;color:var(--sage);cursor:pointer;font-size:.78rem;font-weight:600;padding:2px 0;margin-top:2px}
.csf0f58ef1{padding:0 20px 16px}
.csf155e7d0{font-size:.7rem;padding:1px 6px}
.csf18f30d7{font-weight:700;margin-bottom:10px}
.csf2d6b7dc{width:100%;max-width:280px;border-radius:8px;image-rendering:pixelated;aspect-ratio:32/24}
.csf5bbbb7a{background:#06b6d4;color:#fff;border-color:#06b6d4}
.csf71f5b24{width:34px;height:34px}
.csf7d9249f{color:var(--ink)}
.csf858a887{height:36px}
.csf9de584c{margin-top:8px;display:flex;gap:8px}
.csfa9aeccc{display:block}
.csfb0e6529{display:flex;flex-wrap:wrap;gap:10px;align-items:flex-end;margin-bottom:14px}
.csfbf92c22{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.csfcf40289{margin-top:40px}
.csfe35b5b6{position:absolute;left:-9999px;width:1px;height:1px}
.csfeb0556e{text-align:center;margin-bottom:10px}
/* === CSP-refactor generated utility classes (Phase 1) END === */

/* === CSP Phase 4: clinical/conditions styles moved out of injected <style> BEGIN === */
/* clinical */
.clin-cond-chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}.clin-cond-chip{display:inline-flex;align-items:center;gap:8px;background:var(--mint,#e6f0ee);color:var(--sage-dark,#4a6b6b);border-radius:15px;padding:4px 6px 4px 12px;font-size:.82rem;font-weight:600}.clin-cond-chip button{border:none;background:rgba(0,0,0,.10);color:inherit;width:18px;height:18px;border-radius:50%;cursor:pointer;font-size:13px;line-height:1;padding:0;display:grid;place-items:center}.clin-cond-chip button:hover{background:rgba(0,0,0,.20)}.clin-head-l{display:flex;align-items:flex-start;gap:9px}.clin-check input{width:17px;height:17px;cursor:pointer;accent-color:var(--sage,#739695);margin-top:3px}.clin-hist-head{display:flex;align-items:center;gap:14px;flex-wrap:wrap}.clin-hist-head>div:first-child{margin-right:auto}.clin-selectall{display:inline-flex;align-items:center;gap:6px;font-size:.82rem;color:var(--ink-3,#8a9a9a);cursor:pointer}.clin-selectall input{accent-color:var(--sage,#739695)}.clin-newcond{display:flex;gap:6px;align-items:center}.clin-newcond .input{max-width:190px;margin:0}.clin-bulk{display:flex;align-items:center;gap:10px;flex-wrap:wrap;background:var(--mint,#e6f0ee);border-radius:12px;padding:10px 14px;margin:0 0 14px}.clin-bulk .clin-bulk-count{font-size:.85rem;color:var(--sage-dark,#4a6b6b)}.clin-bulk select{width:auto;min-width:170px;margin:0}
/* conditions */
.cond-additem{display:flex;align-items:center;gap:10px;padding:8px 10px;border:1px solid var(--line,#e7ecec);border-radius:10px;margin-bottom:6px}.cond-additem .lr-main{flex:1;min-width:0}.cond-addlist{max-height:460px;overflow:auto}.cond-entry{position:relative}.cond-rm{position:absolute;top:10px;right:10px;margin:0}.cond-del{margin:0}.cond-chip{cursor:pointer;text-decoration:none}.cond-newform{margin-top:6px}.cond-head-tools{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.cond-sortwrap{display:flex;align-items:center;gap:6px}.cond-sortwrap label{font-size:.8rem;color:var(--ink-3,#8a9a9a)}.cond-sortwrap select{width:auto;display:inline-block;padding:6px 28px 6px 10px;min-height:auto}
/* === CSP Phase 4 END === */

/* === CSP Phase 4c: dynamic inline style="" attributes → classes (nonces don't cover style attrs) === */
.adh-good{color:var(--good,#34a853)}
.adh-warn{color:var(--warn,#f9a825)}
.adh-bad{color:var(--bad,#ea4335)}
.status-btn{flex:1;min-width:120px}
.status-btn.sel-attention{background:#c0492f;color:#fff;border-color:#c0492f}
.status-btn.sel-monitoring{background:#d99a00;color:#fff;border-color:#d99a00}
.status-btn.sel-stable{background:#3a9a4f;color:#fff;border-color:#3a9a4f}
/* === CSP Phase 4c END === */

/* Food review queue — detailed, checkable cards */
.fr-row{flex-direction:column;align-items:stretch;gap:6px}
.fr-analytics{font-size:.8rem;color:var(--ink-2);font-weight:600}
.fr-comp{font-size:.78rem;color:var(--ink-3);line-height:1.45;max-height:5.8em;overflow-y:auto;background:rgba(127,127,127,.09);border-radius:8px;padding:7px 9px}
.fr-src{font-size:.8rem;font-weight:600;display:inline-block}
.fr-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:4px}
.fr-typelbl{display:flex;align-items:center;gap:6px;font-size:.78rem;color:var(--ink-3);font-weight:600;margin-right:auto}
.fr-typelbl .fr-type{width:auto;padding:4px 8px;font-size:.8rem;min-width:92px}
.fr-edit{width:100%}
.fr-edit .field{margin-bottom:7px}
.fr-edit textarea.input{min-height:58px;resize:vertical}
.fr-edit .fr-actions{margin-top:2px}

/* ---------------------------------------------------------------- Health Score
   Parity with the iOS Health Score. Band colours are fixed hexes set via SVG
   stroke/fill *attributes*; everything below styles surfaces/text with theme
   vars and sets SVG geometry via classes (never inline styles → CSP-safe). */
.hs-ring { display: block; width: 132px; height: 132px; }
.hs-ring-sm { width: 84px; height: 84px; }
.hs-ring-track { stroke: var(--line-2); }
.hs-ring-num { fill: var(--ink); }
.hs-ring-cap { fill: var(--ink-3); }

.hs-top { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.hs-ring-wrap { flex: 0 0 auto; }
.hs-top-main { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.hs-band-pill { font-size: .8rem; }
.hs-summary { margin: 0; color: var(--ink-2); font-size: .92rem; line-height: 1.45; }
.hs-conf { width: 100%; }
.hs-conf-label { font-size: .76rem; color: var(--ink-3); margin-bottom: 6px; }

/* Bars + meter: coloured rect over a rounded, clipped track (SVG box bg). */
.hs-bar, .hs-meter { display: block; width: 100%; border-radius: 999px; overflow: hidden; background: var(--line-2); }
.hs-bar { height: 10px; }
.hs-meter { height: 6px; max-width: 260px; }
.hs-meter-fill { fill: var(--sage); }

.hs-row { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.hs-row:last-of-type { border-bottom: none; }
.hs-row-label { flex: 0 0 36%; min-width: 0; }
.hs-row-label b { display: block; font-size: .9rem; font-weight: 600; color: var(--ink); }
.hs-row-label small { display: block; font-size: .74rem; color: var(--ink-3); margin-top: 1px; }
.hs-bar-wrap { flex: 1 1 auto; min-width: 40px; }
.hs-row-score { flex: 0 0 auto; width: 30px; text-align: right; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.hs-absent { font-size: .78rem; color: var(--ink-3); padding-top: 12px; }
.hs-driver-ico { background: var(--mint); color: var(--sage-dark); }
.hs-disclaimer { margin-top: 14px; }

.hs-empty { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.hs-empty-ring { flex: 0 0 auto; }
.hs-empty-body { flex: 1 1 240px; min-width: 0; }
.hs-empty-title { font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.hs-empty-sub { color: var(--ink-2); font-size: .88rem; line-height: 1.5; }

/* Compact dashboard card */
.hs-card-body { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.hs-card-ring { flex: 0 0 auto; }
.hs-card-main { flex: 1 1 220px; min-width: 0; }
.hs-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.hs-card-main h2 { font-size: 1.05rem; }
.hs-card-main .sub { color: var(--ink-2); font-size: .86rem; margin-bottom: 8px; line-height: 1.4; }

@media (max-width: 640px) {
  .hs-top, .hs-empty { gap: 16px; }
  .hs-row-label { flex-basis: 44%; }
}

/* ---- Bristol Stool Scale guide (opened from the toilet page) ---- */
.bristol-help { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
  margin-left: 6px; padding: 0; border: 1.5px solid var(--sage, #3f8f6f); border-radius: 50%; background: none;
  color: var(--sage, #3f8f6f); font: inherit; font-size: .8rem; font-weight: 700; line-height: 1; cursor: pointer; vertical-align: middle; }
.bristol-help:hover { background: var(--sage, #3f8f6f); color: #fff; }
.bristol-img { width: 100%; height: auto; border-radius: 8px; display: block; }
.bristol-overlay { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center;
  justify-content: center; background: rgba(20, 30, 26, .55); padding: 16px; }
.bristol-modal { background: var(--card, #fff); color: var(--ink, #1c2b2b); border-radius: 16px;
  max-width: 520px; width: 100%; max-height: 88vh; overflow-y: auto; padding: 22px 22px 26px;
  box-shadow: 0 18px 50px rgba(0,0,0,.3); position: relative; }
.bristol-modal h3 { margin: 0 32px 6px 0; font-size: 1.15rem; }
.bristol-close { position: absolute; top: 12px; right: 14px; background: none; border: 0; font-size: 1.6rem;
  line-height: 1; color: var(--ink-2, #6d8388); cursor: pointer; }
.bg-intro { font-size: .9rem; color: var(--ink-2, #4a5a5a); margin: 0 0 14px; line-height: 1.5; }
.bg-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line, #e4ecec); }
.bg-ill { flex: 0 0 72px; display: flex; align-items: center; justify-content: center; }
.bg-txt { flex: 1; }
.bg-h { font-weight: 700; font-size: .92rem; }
.bg-h.bg-good { color: var(--sage-dark, #2f6b52); }
.bg-h.bg-warn { color: #9a6b2e; }
.bg-d { font-size: .86rem; color: var(--ink-2, #4a5a5a); margin-top: 2px; }
