/* Vitals design system — imported from the Vitals.dc.html canvas.
   Flat 2px ink borders, hard offset shadows, no radii, tabular numerals,
   and tap targets sized for a phone held at the blood-pressure cuff. */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("vendor/fonts/archivo-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: "Archivo";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("vendor/fonts/archivo-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;
}

@font-face {
  font-family: "Archivo Black";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("vendor/fonts/archivo-black-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: "Archivo Black";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("vendor/fonts/archivo-black-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;
}

:root {
  --paper: #edeae2;
  --paper-alt: #e6e2d8;
  --band: #dcd8cb;
  --ink: #141414;
  --muted: #5c584f;
  --faint: #8a857a;
  --accent: #2743f0;
  --alarm: #d91e1e;
  --warn: #e8a200;
  --edge: 2px solid var(--ink);
  --drop: 4px 4px 0 var(--ink);
  --display: "Archivo Black", "Archivo", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; background: var(--paper); }

body {
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
a:hover { color: var(--ink); }

h1, h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: -0.01em; }
h1 { font-size: 26px; line-height: 1.05; margin: 0 0 6px; }
h2 { font-size: 21px; line-height: 1.1; margin: 24px 0 10px; }
h3 { font-size: 17px; margin: 16px 0 8px; }

.page { min-height: 100vh; padding: 16px; }

/* --- chrome ------------------------------------------------------------ */

.topbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  max-width: 1140px;
  margin: 0 auto 16px;
}

.brand {
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.tagline { font-size: 14px; color: var(--muted); }
.topbar .who { margin-left: auto; font-size: 14px; color: var(--muted); }

.frame {
  margin: 0 auto;
  border: var(--edge);
  background: var(--paper);
  max-width: 1140px;
}

.nav {
  display: flex;
  align-items: stretch;
  border-bottom: var(--edge);
  flex-wrap: wrap;
}

.nav a, .nav button {
  flex: 1 1 auto;
  min-height: 56px;
  display: flex;
  align-items: center;
  border: 0;
  border-right: var(--edge);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

.nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.nav form { display: contents; }

.panel { padding: 20px; }

.lede { font-size: 15px; color: var(--muted); margin: 6px 0 0; max-width: 70ch; }

/* --- buttons ----------------------------------------------------------- */

button, .btn {
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  border: var(--edge);
  background: var(--paper);
  color: var(--ink);
  min-height: 56px;
  padding: 0 18px;
  cursor: pointer;
  box-shadow: var(--drop);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:active, .btn:active { box-shadow: 0 0 0 var(--ink); transform: translate(4px, 4px); }

.btn-primary, button.primary {
  background: var(--accent);
  color: var(--paper);
  font-family: var(--display);
  font-size: 20px;
  min-height: 64px;
}

.btn-primary:active, button.primary:active { background: var(--ink); }

.btn-quiet {
  box-shadow: none;
  border: 0;
  background: transparent;
  color: var(--accent);
  min-height: 0;
  padding: 0;
  font-size: 15px;
}

.btn-quiet:active { transform: none; }

.linklike {
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--accent);
  min-height: 0;
  padding: 0;
  font-size: 15px;
  font-weight: 600;
  text-decoration: underline;
}

.linklike:active { transform: none; }

/* --- forms ------------------------------------------------------------- */

form { display: flex; flex-direction: column; gap: 14px; }
form.inline { display: inline; }

label { display: flex; flex-direction: column; gap: 8px; font-size: 15px; font-weight: 600; }

input, select {
  width: 100%;
  min-height: 56px;
  border: var(--edge);
  background: var(--paper);
  color: var(--ink);
  padding: 0 12px;
  font-family: inherit;
  font-size: 18px;
}

input:focus, select:focus { outline: none; background: var(--ink); color: var(--paper); }

.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field-row > label { flex: 1 1 12ch; }

.hint { font-size: 15px; color: var(--muted); }
.actions { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }

/* --- messages ---------------------------------------------------------- */

.notice, .error {
  border: var(--edge);
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 18px;
}

.notice { background: var(--ink); color: var(--paper); }
.error { background: var(--alarm); color: var(--paper); border-color: var(--alarm); }

/* --- dashboard --------------------------------------------------------- */

.headline-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.subhead { font-size: 15px; color: var(--muted); margin-top: 4px; }

.quick-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 20px 0 24px;
  border: var(--edge);
}

.quick-cell {
  min-height: 96px;
  border: 0;
  border-right: var(--edge);
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  padding: 16px;
  box-shadow: none;
  display: block;
}

.quick-cell:last-child { border-right: 0; }
.quick-cell:active { box-shadow: none; transform: translate(2px, 2px); }
.quick-cell.is-accent { background: var(--accent); color: var(--paper); }
.quick-cell .cell-title { font-family: var(--display); font-size: 22px; line-height: 1.1; }
.quick-cell .cell-sub { font-size: 14px; margin-top: 6px; }

.daily-form { flex-direction: row; align-items: center; gap: 12px; margin-top: 10px; }
.daily-form input {
  flex: 1 1 6ch;
  max-width: 9ch;
  min-height: 64px;
  font-family: var(--display);
  font-size: 34px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  padding: 0 6px;
  background: var(--paper);
  color: var(--ink);
}
.daily-form .unit { font-size: 17px; font-weight: 600; }
.daily-form button { min-height: 64px; flex: 0 0 auto; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.card {
  border: 2px solid var(--ink);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.card.is-stale { border-color: var(--faint); color: var(--faint); }
.card-body { padding: 14px 14px 10px; }
.card-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.card-name { font-size: 15px; font-weight: 600; color: var(--muted); }
.card.is-stale .card-name, .card.is-stale .card-range, .card.is-stale .card-at { color: var(--faint); }
.card-range { font-size: 14px; color: var(--muted); }
.card-value { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; }

.big {
  font-family: var(--display);
  font-size: 58px;
  line-height: 0.88;
  font-variant-numeric: tabular-nums;
}

.big.is-long { font-size: 44px; }
.card.is-stale .big { color: var(--faint); }
.card-unit { font-size: 17px; font-weight: 600; color: var(--muted); }
.card-at { font-size: 15px; margin-top: 10px; color: var(--muted); }
.card-empty { font-size: 15px; color: var(--muted); margin-top: 8px; }

.spark { width: 100%; height: 46px; display: block; border-top: var(--edge); border-bottom: var(--edge); }
.card.is-stale .spark { border-color: var(--faint); }

.card-note { padding: 12px 14px; font-size: 15px; font-weight: 600; line-height: 1.35; }
.card-note.is-alarm { background: var(--alarm); color: var(--paper); }
.card-note.is-warn { background: var(--warn); color: var(--ink); }
.card-nudge {
  padding: 12px 14px;
  border-top: 2px solid var(--faint);
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

/* --- metric picker ----------------------------------------------------- */

.slabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.slab {
  min-height: 132px;
  border: var(--edge);
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  padding: 16px;
  box-shadow: var(--drop);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.slab:active { box-shadow: 0 0 0 var(--ink); transform: translate(4px, 4px); }
.slab-name { font-family: var(--display); font-size: 21px; line-height: 1.08; }
.slab-sub { font-size: 15px; color: var(--muted); margin-top: 8px; }
.slab-last { font-size: 15px; margin-top: auto; font-variant-numeric: tabular-nums; }

/* --- keypad ------------------------------------------------------------ */

.entry-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }

.readout { display: flex; border: var(--edge); margin-top: 18px; }

.readout-field {
  flex: 1 1 0;
  min-width: 0;
  border: 0;
  border-right: var(--edge);
  padding: 16px;
  text-align: left;
  background: var(--paper);
  color: var(--ink);
  box-shadow: none;
  display: block;
}

.readout-field:active { box-shadow: none; transform: none; }
.readout-field.is-active { background: var(--ink); color: var(--paper); }
.readout-label { font-size: 15px; font-weight: 600; color: var(--muted); }
.readout-field.is-active .readout-label { color: var(--paper); }

.readout-value {
  font-family: var(--display);
  font-size: 64px;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
  margin-top: 6px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  min-height: 0;
}

.readout-value:focus { outline: none; background: transparent; color: inherit; }
.readout-unit { display: flex; align-items: flex-end; padding: 16px; font-size: 19px; font-weight: 600; color: var(--muted); }

.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }

.pad button {
  min-height: 76px;
  font-family: var(--display);
  font-size: 30px;
  font-variant-numeric: tabular-nums;
  padding: 0;
}

.save-big {
  width: 100%;
  min-height: 76px;
  margin-top: 16px;
  font-family: var(--display);
  font-size: 24px;
  background: var(--accent);
  color: var(--paper);
}

.save-big:active { background: var(--ink); }

/* --- tables ------------------------------------------------------------ */

.table-wrap { border: var(--edge); margin-top: 20px; overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th {
  background: var(--ink);
  color: var(--paper);
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  border-bottom: var(--edge);
}

td { padding: 14px; font-size: 16px; border-bottom: var(--edge); }
tbody tr:nth-child(even) td { background: var(--paper-alt); }
tbody tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; font-weight: 600; }
.row-actions { display: flex; gap: 14px; align-items: baseline; }
.row-actions form { display: inline; }

.tag { display: inline-block; padding: 6px 10px; font-size: 15px; font-weight: 600; }
.tag.is-ok { color: var(--muted); }
.tag.is-warn { background: var(--warn); color: var(--ink); }
.tag.is-alarm { background: var(--alarm); color: var(--paper); }

/* --- chart ------------------------------------------------------------- */

.chart { margin: 20px 0 0; border: var(--edge); padding: 12px; background: var(--paper); }
.chart figcaption { margin-top: 8px; font-size: 15px; color: var(--muted); }
#chart { width: 100%; }

/* --- auth -------------------------------------------------------------- */

.auth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  align-items: start;
}

.auth-card { border: var(--edge); margin-top: 20px; }
.auth-card .field { padding: 14px; border-bottom: var(--edge); }
.auth-card .field:last-child { border-bottom: 0; }
.auth-aside { border: var(--edge); padding: 16px; }
.auth-aside p { font-size: 15px; color: var(--muted); line-height: 1.45; }

.fineprint {
  max-width: 1140px;
  margin: 16px auto 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.4;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- warnings ---------------------------------------------------------- */

.warning-list { list-style: none; margin: 0 0 16px; padding: 0; border: var(--edge); }

.warning {
  display: flex;
  gap: 14px;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 14px;
  border-bottom: var(--edge);
  font-size: 15px;
  line-height: 1.35;
}

.warning:last-child { border-bottom: 0; }
.warning.is-alert { background: var(--alarm); color: var(--paper); }
.warning.is-alert a, .warning.is-alert .linklike { color: var(--paper); }
.warning.is-notice { background: var(--warn); color: var(--ink); }
.warning.is-notice a, .warning.is-notice .linklike { color: var(--ink); }
.warning-body { font-weight: 600; flex: 1 1 24ch; }
.warning-actions { display: flex; gap: 14px; align-items: baseline; }
.warning-actions form { display: inline; }

.badge {
  display: inline-block;
  padding: 2px 7px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge.is-alert { background: var(--alarm); color: var(--paper); }
.badge.is-notice { background: var(--warn); color: var(--ink); }

/* --- medications ------------------------------------------------------- */

.med-list { border: var(--edge); margin-top: 20px; }

.med {
  display: flex;
  gap: 16px;
  align-items: baseline;
  flex-wrap: wrap;
  padding: 16px;
  border-bottom: var(--edge);
}

.med:last-child { border-bottom: 0; }
.med.is-ended { color: var(--muted); }
.med-name { font-size: 18px; font-weight: 700; min-width: 180px; }
.med-dose {
  font-family: var(--display);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  min-width: 90px;
}
.med-when { font-size: 16px; min-width: 170px; }
.med-since { font-size: 15px; color: var(--muted); min-width: 180px; }
.med-notes { font-size: 15px; color: var(--muted); flex: 1 1 12ch; }
.med-actions { margin-left: auto; }

/* --- range switcher ---------------------------------------------------- */

.range-switch { display: flex; margin-top: 20px; }

.range-option {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border: var(--edge);
  margin-left: -2px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
}

.range-option:first-child { margin-left: 0; }
.range-option.is-current { background: var(--ink); color: var(--paper); }
.range-option:active { transform: translate(2px, 2px); }
