/* ==========================================================================
   Typeface
   Inter, self-hosted: the CSP allows fonts from 'self' only, so a Google Fonts
   link would simply be blocked. One variable file covers 400-700, which is
   fewer bytes than the three static weights it replaces.
   `swap` because the fallback below is metrically close enough that the reflow
   is not disruptive, and blocking text on a font is worse than a brief swap.
   ========================================================================== */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ==========================================================================
   Peptix — design tokens
   Light surface #ffffff / dark surface #15191e.
   Accent teal is validated for WCAG AA as text and as a button fill.
   ========================================================================== */
:root {
  color-scheme: light;

  --page:        #f6f7f8;
  --surface:     #ffffff;
  --sunken:      #f1f3f5;
  --border:      #e4e7eb;
  --border-firm: #d3d8de;

  --text:        #12161c;
  --text-2:      #5b6470;
  --text-3:      #7a838f;

  --accent:      #0f766e;
  --accent-hi:   #0b5f59;
  --accent-ink:  #ffffff;
  --accent-wash: #e6f2f0;
  --accent-line: #bcdcd7;

  --good:        #0ca30c;
  --warn:        #fab219;
  --crit:        #d03b3b;
  --good-ink:    #0a6b25;
  --warn-ink:    #8a5300;
  --crit-ink:    #b3242f;
  --good-wash:   #e4f5e4;
  --warn-wash:   #fdf1d9;
  --crit-wash:   #fbe6e6;

  --track:       #dfe9e7;
  --track-warn:  #fbebcd;
  --track-crit:  #f6dedf;

  --glass:       #ffffff;
  --scrim:       rgba(12, 18, 24, .42);
  --ring:        rgba(15, 118, 110, .32);

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --shadow-1: 0 1px 2px rgba(16, 22, 28, .06);
  --shadow-3: 0 10px 40px -12px rgba(16, 22, 28, .32), 0 2px 8px rgba(16, 22, 28, .10);

  --sans: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --page:        #0d1013;
    --surface:     #15191e;
    --sunken:      #1b2027;
    --border:      #252c34;
    --border-firm: #333c46;

    --text:        #e9edf2;
    --text-2:      #96a1ae;
    --text-3:      #7d8894;

    --accent:      #2dd4bf;
    --accent-hi:   #5ee3d2;
    --accent-ink:  #0a1512;
    --accent-wash: #17302e;
    --accent-line: #23504b;

    --good-ink:    #4cc44c;
    --warn-ink:    #fab219;
    --crit-ink:    #ef6b6b;
    --good-wash:   #14290f;
    --warn-wash:   #302510;
    --crit-wash:   #331a1b;

    --track:       #1d3835;
    --track-warn:  #33290f;
    --track-crit:  #341d1e;

    --glass:       #171c22;
    --scrim:       rgba(2, 5, 8, .62);
    --ring:        rgba(45, 212, 191, .38);

    --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-3: 0 12px 44px -12px rgba(0, 0, 0, .75), 0 2px 8px rgba(0, 0, 0, .5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --page:        #0d1013;
  --surface:     #15191e;
  --sunken:      #1b2027;
  --border:      #252c34;
  --border-firm: #333c46;

  --text:        #e9edf2;
  --text-2:      #96a1ae;
  --text-3:      #7d8894;

  --accent:      #2dd4bf;
  --accent-hi:   #5ee3d2;
  --accent-ink:  #0a1512;
  --accent-wash: #17302e;
  --accent-line: #23504b;

  --good-ink:    #4cc44c;
  --warn-ink:    #fab219;
  --crit-ink:    #ef6b6b;
  --good-wash:   #14290f;
  --warn-wash:   #302510;
  --crit-wash:   #331a1b;

  --track:       #1d3835;
  --track-warn:  #33290f;
  --track-crit:  #341d1e;

  --glass:       #171c22;
  --scrim:       rgba(2, 5, 8, .62);
  --ring:        rgba(45, 212, 191, .38);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-3: 0 12px 44px -12px rgba(0, 0, 0, .75), 0 2px 8px rgba(0, 0, 0, .5);
}

/* ==========================================================================
   base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
/* an author display rule would otherwise beat the hidden attribute */
[hidden] { display: none !important; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--page);
  color: var(--text);
  font: 400 15px/1.5 var(--sans);
  /* No `tnum` here on purpose. Tabular figures pad every digit to one width,
     which in a name like "BPC-157" pushes the narrow 1 apart and reads as
     "BPC - 157". The places that genuinely need columns to line up already ask
     for it themselves via .tnum and font-variant-numeric. */
  /* `pretty` asks the browser to avoid leaving a single word alone on the last
     line. It is what stops copy like "...the mark to pull / to." and
     "...their own vials and / stats." Unsupported browsers just wrap normally. */
  text-wrap: pretty;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* `break-word`, not `anywhere`. `anywhere` was set here on the body, so every
     element in the app was free to break mid-word the moment its box was even
     slightly tight - which is where "Retatruti / de" came from. `break-word`
     still rescues a string too long for its line, but only as a last resort. */
  overflow-wrap: break-word;
}
h1, h2, h3, h4 { margin: 0; font-weight: 620; letter-spacing: -.012em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--surface); color: var(--text);
  padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid var(--border);
}
.skip:focus { top: 8px; }

.muted { color: var(--text-2); }
.small { font-size: 13px; }
.tnum { font-variant-numeric: tabular-nums; }
.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ==========================================================================
   top bar + tabs
   ========================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--page);
  border-bottom: 1px solid var(--border);
}
.topbar-in {
  max-width: 960px; margin: 0 auto;
  padding: 10px 16px 8px;
  display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; margin-right: auto; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
}
.brand-name { font-size: 17px; font-weight: 680; letter-spacing: -.02em; }

.topbar-right { display: flex; align-items: center; gap: 6px; }
.pop-wrap { position: relative; }

.account-btn {
  display: flex; align-items: center; gap: 7px;
  max-width: 190px;
  padding: 5px 9px 5px 5px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; box-shadow: var(--shadow-1);
}
.account-btn:hover { border-color: var(--border-firm); }
.account-btn .caret { color: var(--text-3); flex: none; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: var(--accent-wash); color: var(--accent);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; text-transform: uppercase;
}
.account-name {
  font-size: 13.5px; font-weight: 560;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.icon-btn {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text-2); box-shadow: var(--shadow-1);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-firm); }

.tabs {
  max-width: 960px; margin: 0 auto;
  padding: 0 10px;
  display: flex; gap: 2px;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  padding: 9px 12px 11px;
  background: none; border: 0;
  color: var(--text-2); font-size: 14px; font-weight: 540;
  white-space: nowrap; border-radius: 8px 8px 0 0;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); font-weight: 640; }
.tab[aria-selected="true"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 0;
  height: 2px; background: var(--accent); border-radius: 2px 2px 0 0;
}

/* ==========================================================================
   layout
   ========================================================================== */
.view {
  max-width: 960px; margin: 0 auto;
  padding: 18px 16px calc(96px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px;
}
.view:focus { outline: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.card-pad { padding: 16px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 14.5px; font-weight: 640; letter-spacing: -.008em; }

.section-head { display: flex; align-items: center; gap: 10px; padding: 0 2px 2px; }
.section-head h2 {
  font-size: 12px; font-weight: 660; color: var(--text-2);
  letter-spacing: .05em; text-transform: uppercase;
}

.rows > * + * { border-top: 1px solid var(--border); }
.row-pad { padding: 12px 16px; }

.grid { display: grid; gap: 10px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.vial-grid { grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); }
@media (max-width: 400px) { .vial-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.flex { display: flex; align-items: center; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.spacer { margin-left: auto; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ==========================================================================
   buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 14px; min-height: 38px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-firm); border-radius: 10px;
  font-size: 14px; font-weight: 560; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--sunken); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn-ghost { background: none; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--sunken); color: var(--text); }
.btn-danger { color: var(--crit-ink); }
.btn-danger:hover { background: var(--crit-wash); border-color: var(--crit); }
.btn-sm { padding: 6px 10px; min-height: 32px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }

.fab {
  position: fixed; right: 18px; z-index: 35;
  bottom: calc(18px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 18px;
  background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 999px;
  font-size: 14.5px; font-weight: 620;
  box-shadow: var(--shadow-3);
}
.fab:hover { background: var(--accent-hi); }
@media (max-width: 560px) {
  .fab { padding: 15px; }
  .fab span { display: none; }
}

/* ==========================================================================
   chips + badges
   ========================================================================== */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-row.scroll {
  flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
  margin: 0 -16px; padding: 0 16px 2px;
}
.chip-row.scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; min-height: 36px;
  background: var(--surface); border: 1px solid var(--border-firm);
  border-radius: 999px; font-size: 13.5px; font-weight: 540;
  color: var(--text); white-space: nowrap;
}
.chip:hover { background: var(--sunken); }
.chip[aria-pressed="true"] {
  background: var(--accent-wash); border-color: var(--accent-line); color: var(--accent);
  font-weight: 620;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 640;
  background: var(--sunken); color: var(--text-2);
  white-space: nowrap;
}
.badge svg { flex: none; }
.badge-warn { background: var(--warn-wash); color: var(--warn-ink); }
.badge-crit { background: var(--crit-wash); color: var(--crit-ink); }
.badge-accent { background: var(--accent-wash); color: var(--accent); }

/* ==========================================================================
   forms
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label {
  font-size: 12.5px; font-weight: 620; color: var(--text-2);
}
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; min-height: 42px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-firm); border-radius: 10px;
  font-size: 15px;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring);
}
.textarea { min-height: 72px; resize: vertical; line-height: 1.45; }
.select {
  appearance: none; -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237a838f' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.hint { font-size: 12.5px; color: var(--text-2); }
.err { font-size: 12.5px; color: var(--crit-ink); font-weight: 560; }

.split { display: grid; grid-template-columns: 1fr 104px; gap: 8px; align-items: end; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 460px) { .pair { grid-template-columns: 1fr; } }

.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--sunken); border-radius: 10px; border: 1px solid var(--border);
}
.seg button {
  padding: 6px 12px; border: 0; background: none; border-radius: 7px;
  font-size: 13px; font-weight: 560; color: var(--text-2);
}
.seg button[aria-pressed="true"] {
  background: var(--surface); color: var(--text); font-weight: 620;
  box-shadow: var(--shadow-1);
}

/* ==========================================================================
   meters, stat tiles, bar list, tables
   ========================================================================== */
.tile {
  padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-1);
}
.tile-label { font-size: 12.5px; font-weight: 560; color: var(--text-2); }
.tile-value { margin-top: 4px; font-size: 27px; font-weight: 660; letter-spacing: -.022em; line-height: 1.1; }
.tile-sub { margin-top: 2px; font-size: 12px; color: var(--text-3); }

.meter-track { height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.meter-fill { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.meter.is-low  .meter-track { background: var(--track-warn); }
.meter.is-low  .meter-fill  { background: var(--warn); }
.meter.is-crit .meter-track { background: var(--track-crit); }
.meter.is-crit .meter-fill  { background: var(--crit); }

.barlist { display: flex; flex-direction: column; gap: 12px; }
.barlist-row { display: grid; grid-template-columns: minmax(70px, 26%) 1fr auto; gap: 12px; align-items: center; }
.barlist-name { font-size: 13.5px; font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barlist-track { height: 10px; background: var(--sunken); border-radius: 5px; overflow: hidden; }
.barlist-fill { height: 100%; background: var(--accent); border-radius: 0 5px 5px 0; min-width: 3px; }
.barlist-value { font-size: 13px; font-weight: 620; color: var(--text-2); font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .barlist-row { grid-template-columns: minmax(58px, 34%) 1fr auto; gap: 8px; } }

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th, table.tbl td { padding: 9px 12px; text-align: left; white-space: nowrap; }
table.tbl th {
  font-size: 11.5px; font-weight: 660; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
table.tbl td { border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl td.name { font-weight: 560; white-space: normal; min-width: 118px; }
table.tbl .num { text-align: right; }

/* ==========================================================================
   vial + log rows
   ========================================================================== */
.vial-card { display: flex; flex-direction: column; }
.vial-main { display: flex; padding: 15px 16px 12px; flex: 1; }
.vial-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 9px; }
.vial-head { display: flex; align-items: flex-start; gap: 8px; }
.vial-name {
  font-size: 16px; font-weight: 650; letter-spacing: -.012em; line-height: 1.25;
  /* Clamped to two lines, but `break-word` rather than `anywhere`: `anywhere`
     breaks eagerly at any character, which is what split "Retatrutide" across
     lines as "Retatruti / de". This only breaks a word that cannot fit a line
     by itself, so ordinary peptide names stay whole. */
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; overflow-wrap: break-word;
}
.vial-sub { margin-top: 3px; font-size: 12.5px; color: var(--text-2); line-height: 1.4; }
.vial-meta { display: flex; gap: 3px 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
/* Wrap between items, never inside one: a date or a count split across lines
   reads as two facts instead of one. */
.vial-meta > span { white-space: nowrap; }
.vial-figs { display: flex; align-items: baseline; gap: 8px; justify-content: space-between; margin-bottom: -3px; }
.vial-remain { font-size: 13.5px; font-weight: 620; font-variant-numeric: tabular-nums; }
.vial-notes { margin-top: -2px; }
.vial-foot {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 0 16px 14px; margin-top: auto;
}
.actions { display: flex; gap: 2px; margin-left: auto; flex: none; }
.act {
  width: 32px; height: 32px; display: grid; place-items: center;
  background: none; border: 1px solid transparent; border-radius: 8px; color: var(--text-3);
}
.act:hover { background: var(--sunken); color: var(--text); border-color: var(--border); }
.act.danger:hover { background: var(--crit-wash); color: var(--crit-ink); border-color: transparent; }
.act[disabled] { opacity: .35; pointer-events: none; }
.is-finished { opacity: .72; }

.log-row { display: flex; align-items: flex-start; gap: 12px; padding: 11px 16px; }
.log-row + .log-row { border-top: 1px solid var(--border); }
.log-time {
  flex: none; width: 64px; padding-top: 2px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums;
}
.log-main { min-width: 0; flex: 1; }
.log-title { font-size: 14.5px; font-weight: 560; }
.log-dose { font-weight: 680; }
.log-sub { margin-top: 2px; font-size: 12.5px; color: var(--text-2); display: flex; gap: 4px 10px; flex-wrap: wrap; }
.log-note { margin-top: 4px; font-size: 12.5px; color: var(--text-2); }
.day-head {
  display: flex; align-items: baseline; gap: 8px;
  padding: 9px 16px;
  background: var(--sunken);
  font-size: 11.5px; font-weight: 660; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .05em;
}
.day-head + .log-row { border-top: 0; }

/* ==========================================================================
   calendar
   ========================================================================== */
.cal-card { overflow: hidden; }
.cal-right { border-top: 1px solid var(--border); }
@media (min-width: 860px) {
  /* the month and the chosen day sit side by side instead of leaving dead space */
  .cal-card  { display: grid; grid-template-columns: 508px minmax(0, 1fr); align-items: start; }
  .cal-right { border-top: 0; border-left: 1px solid var(--border); align-self: stretch; }
}
.cal-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 6px; }
.cal-title { font-size: 14.5px; font-weight: 640; min-width: 128px; }
.cal-grid {
  display: grid;
  /* minmax(0,…) so the seven columns can shrink on a narrow phone */
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  padding: 0 12px 12px;
  max-width: 476px;   /* keeps day cells square-ish instead of stretching wide */
}
.cal-dow {
  text-align: center; padding: 4px 0 6px;
  font-size: 11px; font-weight: 660; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em;
}
.cal-cell {
  position: relative; aspect-ratio: 1 / 1; min-height: 38px; max-height: 62px;
  min-width: 0; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 1px solid transparent; border-radius: 10px;
  background: none; color: var(--text);
  font-size: 13px; font-variant-numeric: tabular-nums;
}
.cal-cell.out { color: var(--text-3); opacity: .45; }
.cal-cell.has { background: var(--accent-wash); color: var(--accent); font-weight: 660; }
.cal-cell.today { border-color: var(--border-firm); font-weight: 700; }
.cal-cell.sel { background: var(--accent); color: var(--accent-ink); font-weight: 700; border-color: var(--accent); }
.cal-cell:not(.empty):hover { border-color: var(--accent-line); }
.cal-cell .cnt { font-size: 10px; font-weight: 700; line-height: 1; }
.cal-cell.empty { pointer-events: none; }

/* ==========================================================================
   syringe
   ========================================================================== */
.syr-panel {
  background: var(--sunken); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px;
}
.syr-read { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.syr-big { font-size: 25px; font-weight: 680; letter-spacing: -.022em; }
.syr-big em { font-style: normal; font-size: 15px; font-weight: 600; color: var(--text-2); margin-left: 6px; }
.syr-alt { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.syr-note { margin-top: 8px; font-size: 12.5px; color: var(--text-2); }
.syr-note.bad { color: var(--crit-ink); font-weight: 560; }
.syringe { width: 100%; height: auto; margin-top: 6px; }
.syr-barrel  { fill: var(--surface); }
.syr-outline { fill: none; stroke: var(--border-firm); stroke-width: 1.5; }
.syr-metal   { fill: var(--text-3); }
.syr-metal-l { stroke: var(--text-3); }
.syr-plastic { fill: var(--border-firm); }
.syr-rod     { fill: var(--border); }
.syr-gasket  { fill: var(--text-2); }
.syr-liquid  { fill: var(--accent); opacity: .30; }
.syr-tick    { stroke: var(--text-2); stroke-width: 1.1; }
.syr-tick.mj { stroke: var(--text); stroke-width: 1.5; }
/* halo in the surface colour so a number stays readable under the plunger */
.syr-num {
  fill: var(--text-2); font: 600 11px var(--sans);
  stroke: var(--surface); stroke-width: 3px; paint-order: stroke fill;
}
.syr-over .syr-liquid { fill: var(--crit); opacity: .28; }
.syr-over .syr-outline { stroke: var(--crit); }

/* the whole diagram scales down on a phone — thicken it so it stays readable */
@media (max-width: 600px) {
  .syr-num     { font-size: 21px; stroke-width: 5px; }
  .syr-tick    { stroke-width: 2; }
  .syr-tick.mj { stroke-width: 2.8; }
  .syr-outline { stroke-width: 2.4; }
}

/* ==========================================================================
   popover / modal / toast
   ========================================================================== */
.popover {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  min-width: 248px; max-width: min(320px, calc(100vw - 24px));
  background: var(--glass); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-3);
  padding: 6px; max-height: 70vh; overflow-y: auto;
}
.pop-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 10px; background: none; border: 0; border-radius: 9px;
  font-size: 14px; text-align: left; color: var(--text);
}
.pop-item:hover { background: var(--sunken); }
.pop-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.pop-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.scrim {
  position: fixed; inset: 0; z-index: 70;
  background: var(--scrim);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .14s ease;
}
@media (min-width: 640px) { .scrim { align-items: center; padding: 24px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }

.modal {
  width: 100%; max-width: 520px;
  max-height: min(92vh, 880px);
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-3);
  animation: rise .18s cubic-bezier(.2, .7, .3, 1);
}
@media (min-width: 640px) { .modal { border-radius: var(--r-lg); } }
.modal.wide { max-width: 600px; }
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 16px; border-bottom: 1px solid var(--border); flex: none;
}
.modal-title { font-size: 16px; font-weight: 660; letter-spacing: -.014em; }
.modal-body { padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border); flex: none;
}
.modal-foot .btn { flex: 1; }
@media (min-width: 640px) { .modal-foot .btn { flex: none; min-width: 96px; } }

.toasts {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 90;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: max-content; max-width: calc(100vw - 32px);
}
.toast {
  padding: 10px 15px;
  background: var(--text); color: var(--page);
  border-radius: 999px; font-size: 13.5px; font-weight: 560;
  box-shadow: var(--shadow-3);
  animation: rise .18s ease;
}
.toast.bad { background: var(--crit); color: #fff; }

/* ==========================================================================
   empty states + banners
   ========================================================================== */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 32px 20px; text-align: center;
}
.empty-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--sunken); color: var(--text-3);
}
.empty-title { font-size: 14.5px; font-weight: 620; }
.empty-text { font-size: 13px; color: var(--text-2); max-width: 34ch; }

.banner {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px; border-radius: var(--r);
  background: var(--warn-wash); color: var(--warn-ink);
  font-size: 13px; font-weight: 540;
}
.banner svg { flex: none; margin-top: 1px; }
.banner.crit { background: var(--crit-wash); color: var(--crit-ink); }
.banner.ok   { background: var(--accent-wash); color: var(--accent-hi); }
.banner span { flex: 1 1 auto; }

/* The slot sits between the top bar and the view, so it has to carry the same
   gutters the view does rather than run edge to edge. */
.notice-slot { max-width: 900px; margin: 0 auto; padding: 12px 16px 0; }

/* A button that has to read as a link: the actions behind these are ordinary
   requests, not navigation, so an <a> would be wrong for the keyboard and for
   assistive software even though it would look the same. */
.linkish {
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; font-weight: 600; color: var(--accent);
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.linkish:hover { color: var(--accent-hi); }
/* These labels are two or three words acting as one control; splitting
   "Resend email" across lines makes it read as part of the sentence beside it. */
.linkish { white-space: nowrap; }
.linkish:disabled { opacity: .6; cursor: default; text-decoration: none; }
.linkish:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

.auth-aside { margin: -4px 0 4px; text-align: right; font-size: 13px; }
.auth-note { margin: 0 0 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   boot screen
   ========================================================================== */
.boot {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  color: var(--text-2);
}
.boot-mark {
  width: 44px; height: 44px; border-radius: 13px;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
  animation: pulse 1.6s ease-in-out infinite;
}
.boot-text { font-size: 13.5px; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.is-busy { pointer-events: none; }
.is-busy .modal-body { opacity: .6; }

/* ==========================================================================
   signed-out screen
   ========================================================================== */
.auth { min-height: 100vh; display: flex; }
.auth-grid {
  width: 100%; max-width: 1120px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr;
  gap: 0;
}
@media (min-width: 940px) {
  .auth-grid { grid-template-columns: 1.05fr .95fr; align-items: center; gap: 56px; }
}

.auth-pitch { padding: 40px 24px 8px; }
@media (min-width: 940px) { .auth-pitch { padding: 48px 8px 48px 32px; } }

.brand-lg { gap: 11px; margin-bottom: 26px; }
.brand-lg .brand-mark { width: 38px; height: 38px; border-radius: 11px; }
.brand-lg .brand-name { font-size: 21px; }

/* Headings get `balance` instead: it evens the line lengths across the whole
   heading rather than only protecting the last line, which is what a short
   multi-line title needs. */
h1, h2, h3, .pitch-title, .auth-title, .empty-title { text-wrap: balance; }

.pitch-title {
  font-size: clamp(28px, 4.6vw, 40px);
  line-height: 1.12; letter-spacing: -.028em; font-weight: 680;
  max-width: 15ch; margin-bottom: 26px;
}
.pitch-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; max-width: 44ch; }
.pitch-list li { display: flex; gap: 13px; align-items: flex-start; }
.pitch-icon {
  /* 30px holding a 16px glyph left too much dead air, so the marks read as
     small and faint next to 14.5px bold labels. A larger tile with a larger
     glyph and a hairline edge gives them the weight the text already has. */
  width: 36px; height: 36px; flex: none; border-radius: 11px;
  background: var(--accent-wash); color: var(--accent);
  border: 1px solid var(--accent-line);
  display: grid; place-items: center;
}
/* Size and stroke come from the markup in auth-view.js, which draws these to a
   common optical box; nothing to override here. */
.pitch-list strong { display: block; font-size: 14.5px; font-weight: 620; letter-spacing: -.006em; }
/* Scoped to the span inside the text div, not every span in the list. The tile
   is a span too, so the looser `.pitch-list span` outranked `.pitch-icon` on
   specificity and painted the marks grey - the accent colour set there had
   never actually taken effect. */
.pitch-list div span { display: block; font-size: 13px; color: var(--text-2); margin-top: 3px; line-height: 1.5; }

.auth-panel { padding: 28px 20px calc(40px + env(safe-area-inset-bottom)); }
@media (min-width: 940px) { .auth-panel { padding: 48px 32px 48px 8px; } }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  padding: 8px 8px 22px;
  max-width: 430px; margin: 0 auto;
}
.auth-seg { display: flex; width: 100%; margin-bottom: 4px; }
.auth-seg button { flex: 1; padding: 9px 10px; }

.auth-form { padding: 12px 16px 0; display: flex; flex-direction: column; gap: 14px; }
.auth-title { font-size: 19px; font-weight: 670; letter-spacing: -.02em; }
.auth-sub { font-size: 13.5px; color: var(--text-2); margin-top: -8px; }
.auth-form .err { margin-top: -4px; }

.auth-foot { text-align: center; font-size: 13px; color: var(--text-2); margin-top: 18px; }
.auth-foot strong { color: var(--text); font-weight: 620; }
.auth-legal {
  text-align: center; font-size: 12px; color: var(--text-3);
  margin-top: 10px; max-width: 42ch; margin-left: auto; margin-right: auto; line-height: 1.5;
}

/* ==========================================================================
   inputs with a trailing control
   ========================================================================== */
.input-wrap { position: relative; display: flex; }
.input-wrap .input { padding-right: 62px; }
.input-btn {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  padding: 5px 9px; border: 0; border-radius: 7px;
  background: var(--sunken); color: var(--text-2);
  font-size: 12.5px; font-weight: 600;
}
.input-btn:hover { color: var(--text); }

.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row .input { flex: 1; min-width: 0; }
.input-row .btn { flex: none; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dialog-text { font-size: 14px; line-height: 1.5; }
.page-note {
  text-align: center; font-size: 12.5px; color: var(--text-2);
  padding: 4px 8px; line-height: 1.55; max-width: 60ch; margin: 0 auto;
}
.avatar-lg { width: 38px; height: 38px; font-size: 15px; }
.btn-lg { min-height: 46px; font-size: 15px; font-weight: 620; }
.btn-danger-solid {
  background: var(--crit); border-color: var(--crit); color: #fff;
}
.btn-danger-solid:hover { background: #b6302f; border-color: #b6302f; color: #fff; }

/* ==========================================================================
   searchable dropdown (body-level, so a dialog can never clip it)
   ========================================================================== */
.combo-pop {
  position: fixed; z-index: 95;
  display: flex; flex-direction: column;
  background: var(--glass);
  border: 1px solid var(--border-firm);
  border-radius: var(--r);
  box-shadow: var(--shadow-3);
  overflow: hidden;
}
.combo-list { overflow-y: auto; padding: 5px; overscroll-behavior: contain; }
.combo-item {
  display: block; width: 100%; text-align: left;
  padding: 9px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--text);
  font-size: 14.5px; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.combo-item:hover, .combo-item.is-active { background: var(--sunken); }
.combo-item.is-active { box-shadow: inset 0 0 0 1px var(--accent-line); }
.combo-item mark { background: none; color: var(--accent); font-weight: 700; }
.combo-foot {
  padding: 8px 12px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-3); background: var(--surface);
}

/* ==========================================================================
   account menu extras
   ========================================================================== */
.pop-user { display: flex; align-items: center; gap: 10px; padding: 10px 10px 8px; }

@media (max-width: 400px) {
  .vial-main { padding: 13px 13px 10px; }
  .vial-foot { padding: 0 13px 12px; }
}
