[hidden] { display: none !important; }
:root {
  --bg: #f6f4ef; --card: #ffffff; --ink: #1f2a2e; --muted: #66727a; --line: #e3dfd6;
  --brand: #2f5d62; --brand-ink: #ffffff; --accent: #a3c9a8; --green: #2e8b57; --green-bg: #dff2e5;
  --warn: #b5651d; --warn-bg: #fbecd9; --danger: #b23a3a; --danger-bg: #f8e1e1; --chip: #eef1ef;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.04);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.45; }
a { color: var(--brand); }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
header.top { background: var(--brand); color: var(--brand-ink); }
header.top .wrap { display: flex; align-items: center; gap: 16px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
header.top .logo { font-weight: 700; letter-spacing: .2px; }
header.top nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
header.top nav a { color: var(--brand-ink); text-decoration: none; padding: 6px 10px; border-radius: 8px; opacity: .85; }
header.top nav a.on, header.top nav a:hover { background: rgba(255,255,255,.15); opacity: 1; }
header.top .who { font-size: .85rem; opacity: .9; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr.click { cursor: pointer; } tr.click:hover td { background: #faf9f5; }
.table-scroll { overflow-x: auto; }
button, .btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 12px; border-radius: 8px; cursor: pointer; }
button.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
button.danger { color: var(--danger); border-color: #e8c3c3; }
button.small { padding: 4px 8px; font-size: .85rem; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); max-width: 100%; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
label > input, label > select, label > textarea { color: var(--ink); font-size: 15px; }
form.stack { display: grid; gap: 10px; }
form.inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--chip); font-size: .8rem; white-space: nowrap; }
.chip.green { background: var(--green-bg); color: var(--green); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.danger { background: var(--danger-bg); color: var(--danger); }
.stat { display: flex; flex-direction: column; } .stat b { font-size: 1.35rem; } .stat span { font-size: .8rem; color: var(--muted); }
.stats { display: flex; gap: 22px; flex-wrap: wrap; margin: 10px 0; }
.banner { padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; }
.banner.warn { background: var(--warn-bg); color: #6d3c10; } .banner.ok { background: var(--green-bg); color: #1b5a37; }
.banner.err { background: var(--danger-bg); color: #7a2323; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 50; max-width: 90vw; }
.minical { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; max-width: 280px; }
.minical div { height: 22px; border-radius: 4px; background: #f1efe9; font-size: .65rem; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.minical .s { background: #f3d7c9; } .minical .t { background: var(--green); color: #fff; } .minical .x { background: transparent; }
details summary { cursor: pointer; color: var(--brand); margin: 6px 0; }
.copybox { user-select: all; -webkit-user-select: all; cursor: text; background: #f7f7f4; border: 1px dashed var(--line); padding: 10px; border-radius: 8px; word-break: break-all; font-size: .9rem; }
.login { max-width: 380px; margin: 12vh auto; text-align: center; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
@media (max-width: 640px) { .wrap { padding: 12px; } th, td { padding: 6px 4px; } }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.card.sub { background: #faf9f6; box-shadow: none; padding: 12px; display: grid; gap: 8px; }
.lbl { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.preview { background: #eef5f3; border-radius: 10px; padding: 12px; }
.mg { color: var(--brand); font-weight: 600; }
.minical .r { background: #ece8f6; } .minical .h { background: #a8d5b8; }

.askwrap { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.askbox { background: #fff; color: #1f2a2e; border-radius: 14px; padding: 18px; max-width: 420px; width: 100%; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.askbox p { margin: 0 0 12px; font-size: 1rem; line-height: 1.4; }
.askin { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid #ccc; border-radius: 8px; margin-bottom: 12px; box-sizing: border-box; }
.askbtns { display: flex; gap: 8px; justify-content: flex-end; }
.askbtns button { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid #ccc; background: #fff; cursor: pointer; }
.askbtns .askok { background: #2f5d62; border-color: #2f5d62; color: #fff; }

/* ===== Balance Medical staff theme: same garden as the patient page, daylight version ===== */
@font-face { font-family: 'Script'; src: url('/static/fonts/dancing-script-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Jost'; src: url('/static/fonts/jost-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Jost'; src: url('/static/fonts/jost-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Jost'; src: url('/static/fonts/jost-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
:root {
  --bg: #f1f5ec;           /* leaf-washed daylight */
  --card: #ffffff;
  --ink: #17221a;
  --muted: #5d6b5f;
  --line: #dde6d6;
  --brand: #1f3d26;        /* deep frond: primary actions */
  --brand-ink: #ffffff;
  --lime: #bfe63a;
  --hibiscus: #d63c1b;
  --gold: #e8a512;
  --green: #2c7a3c; --green-bg: #e3f3d6;
  --warn: #9a5b00; --warn-bg: #fdf0d3;
  --danger: #c0391b; --danger-bg: #fde4dc;
  --chip: #eaf0e4;
  --radius: 18px;
  --shadow: 0 1px 0 rgba(23, 34, 26, .04);
  font-family: 'Jost', -apple-system, system-ui, sans-serif;
}
body { font-family: 'Jost', -apple-system, system-ui, sans-serif; font-size: 16px; }
h1 { font-size: 1.9rem; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; font-weight: 600; }
a { color: var(--brand); }

header.top { background: #000; border-bottom: 3px solid var(--lime); }
header.top .wrap { padding-top: 10px; padding-bottom: 10px; }
header.top .logo { display: flex; align-items: center; gap: 10px; color: var(--lime); text-decoration: none; }
header.top .logo img { width: 44px; height: 44px; border-radius: 50%; display: block; }
header.top .logo span { font-family: 'Script', cursive; font-size: 1.75rem; font-weight: 700; line-height: 1; }
header.top nav a { color: #e9f0e2; border-radius: 999px; padding: 7px 14px; font-weight: 500; opacity: .9; }
header.top nav a.on, header.top nav a:hover { background: var(--lime); color: #000; opacity: 1; }
header.top .who { color: #c7d3c2; }
header.top button { background: transparent; color: #e9f0e2; border-color: #3c4a3f; border-radius: 999px; }

.card { border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 20px 22px; }
.card > h2:first-child, .card .spread h2 { display: flex; align-items: center; gap: 8px; }
button, .btn { border-radius: 999px; padding: 8px 16px; font-family: inherit; font-weight: 500; border-color: #cfdac8; }
button:hover, .btn:hover { border-color: var(--brand); }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { background: #2b5434; }
button.danger { color: var(--danger); border-color: #f0c2b4; }
input, select, textarea { border-radius: 12px; border-color: #cfdac8; font-family: inherit; padding: 9px 11px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid var(--lime); outline-offset: 1px; border-color: var(--brand); }
label { color: var(--muted); font-weight: 500; }

.chip { border-radius: 999px; padding: 3px 10px; font-weight: 500; }
.chip.green { background: var(--green-bg); color: var(--green); }
.chip.danger { background: var(--danger-bg); color: var(--danger); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }

th { color: var(--muted); font-weight: 600; letter-spacing: 0; text-transform: none; font-size: .85rem; border-bottom: 2px solid var(--line); }
td { border-bottom-color: #edf2e8; }
tr.click:hover td { background: #f6faf1; }

/* stats: a lime rule under each number reads as one row of vitals */
.stats { gap: 10px; }
.stat { background: #f7faf3; border-radius: 14px; padding: 10px 14px 9px; border-bottom: 3px solid var(--lime); min-width: 120px; }
.stat b { font-size: 1.45rem; font-weight: 600; }
.stat span { font-size: .82rem; }

details summary { color: var(--brand); font-weight: 500; }
.banner { border-radius: 14px; }
.banner.warn { background: var(--warn-bg); color: #5e3a05; border-left: 4px solid var(--gold); }
.banner.ok { background: var(--green-bg); color: #1d4a26; border-left: 4px solid var(--green); }
.banner.err { background: var(--danger-bg); color: #6e1f0d; border-left: 4px solid var(--hibiscus); }
.copybox { background: #f7faf3; border: 1.5px dashed #b7c9ad; border-radius: 14px; font-size: 1rem; padding: 12px 14px; }
.preview { background: #f2f8ea; border: 1px solid var(--line); border-radius: 16px; }
.card.sub { background: #f8fbf5; border-radius: 16px; }
.mg { color: var(--green); }
.toast { background: #000; color: var(--lime); border-radius: 999px; font-weight: 500; }

.minical { gap: 4px; max-width: 300px; }
.minical div { border-radius: 50%; height: 30px; width: 30px; justify-self: center; font-size: .72rem; background: #eef3e8; }
.minical .s { background: #fde4dc; color: #8a2a13; }
.minical .t { background: var(--lime); color: #000; font-weight: 600; }
.minical .h { background: #dbeeb0; }
.minical .r { background: #fbeee4; color: #9a6a4c; }
.minical .x { background: transparent; width: auto; }

.login { border-top: 4px solid var(--lime); }
.login h1 { font-family: 'Script', cursive; color: var(--brand); font-size: 2.6rem; font-weight: 700; }
.askbtns .askok { background: var(--brand); border-color: var(--brand); }
.copybox { white-space: pre-wrap; }

/* combined "All peptides" calendar */
.cb { --c0: #4f7d1f; --c1: #c2391a; --c2: #1f78b4; --c3: #c98a00; --c4: #7b4bb3; --c5: #148a73; --ck: var(--ink); }
.cb-title { font-size: 1.15rem; }
.cb-head { display: flex; justify-content: space-between; align-items: center; margin: 8px 0; max-width: 640px; }
.cb-head b { font-weight: 600; }
.cb-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; max-width: 640px; }
.cb-dow { text-align: center; font-size: .8rem; color: var(--muted); }
.cb-d { min-height: 54px; border-radius: 8px; border: 1px solid var(--line); padding: 3px 4px 4px; display: flex; flex-direction: column; gap: 3px; background: #fff; }
.cb-d.today { border: 2px solid var(--danger); }
.cb-n { font-size: .78rem; color: var(--muted); line-height: 1; }
.cb-bars { display: flex; flex-direction: column; gap: 2px; }
.cb-list { list-style: none; margin: 14px 0 0; padding: 0; }
.cb-list li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.cb-per { font-size: .9rem; color: var(--muted); }
.cb-per b { color: var(--ink); }
.cb-run.rest { color: #8a5a9e; }
.cb-muted { color: var(--muted); }
.cb-key { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: .85rem; color: var(--muted); }
.cb-key .cb-bar { display: inline-block; width: 22px; vertical-align: middle; margin-right: 6px; }
.cb-bar { display: block; border-radius: 5px; background: transparent; font: 600 10px/16px 'Jost', system-ui, sans-serif; font-style: normal; color: #fff; text-align: center; padding: 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .01em; }
.cb-bar.c0 { --c: var(--c0); } .cb-bar.c1 { --c: var(--c1); } .cb-bar.c2 { --c: var(--c2); } .cb-bar.c3 { --c: var(--c3); } .cb-bar.c4 { --c: var(--c4); } .cb-bar.c5 { --c: var(--c5); } .cb-bar.c-key { --c: var(--ck); }
.cb-bar.dose { background: var(--c); }
.cb-bar.on { background: var(--c); opacity: .35; }
.cb-bar.rest { border: 1.5px dashed var(--c); height: 6px; opacity: .8; }
.cb-bar.start { box-shadow: inset 4px 0 0 #fff; }
.cb-bar.end { box-shadow: inset -4px 0 0 #fff; }
.cb-sw { flex: none; width: 16px; height: 16px; border-radius: 50%; margin-top: 4px; }
.cb-sw.c0 { background: var(--c0); } .cb-sw.c1 { background: var(--c1); } .cb-sw.c2 { background: var(--c2); } .cb-sw.c3 { background: var(--c3); } .cb-sw.c4 { background: var(--c4); } .cb-sw.c5 { background: var(--c5); }
.defset { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 10px; width: 100%; }
.defset legend { color: var(--muted); font-size: .85rem; padding: 0 6px; }
.cu { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cu .cu-n { width: 80px; }
.cu .cu-note { font-size: .8rem; }
/* hormone calendar (staff) */
.hcard .hsum { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 10px 0 14px; }
.hcard .hsum div { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.hcard .hsum b { display: block; } .hcard .hsum span { font-size: .85rem; color: var(--muted); }
.hblock { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin: 0; }
.hblock legend { font-weight: 600; padding: 0 6px; }
.hgrid-wrap { overflow-x: auto; margin: 8px 0 4px; }
.hgrid { border-collapse: collapse; font-size: .8rem; }
.hgrid th { padding: 2px; text-align: center; color: var(--muted); font-weight: 500; min-width: 34px; }
.hgrid th.hb { color: var(--danger); font-weight: 700; }
.hgrid td { padding: 1px; }
.hgrid input { width: 34px; padding: 4px 2px; text-align: center; font-size: .85rem; border-radius: 6px; }
.hadj { gap: 8px; align-items: center; margin-bottom: 6px; }
.htable tr.hbleed td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
.htable tr.hbleed td:nth-child(2) { color: var(--danger); font-weight: 600; }
.hcmp tr.hdiff td { background: var(--warn-bg); }
.hprev { border-top: 1px dashed var(--line); padding-top: 8px; }
.hbody-inline { display: contents; }
.hbody-inline[hidden], [data-personal][hidden], [data-lunarnote][hidden] { display: none !important; }

/* hormone settings editor: color-coded per hormone (matches calendar E/P/T colors) */
.hblock { border-width: 0 0 0 8px; border-style: solid; border-radius: 14px; padding: 12px 14px 8px; margin: 6px 0 14px; }
.hblock legend { font-size: 1.1rem; padding: 4px 12px; border-radius: 999px; color: #fff; }
.hblock[data-s="estrogen"] { border-color: #5f8f12; background: #f3f9e6; }
.hblock[data-s="estrogen"] legend { background: #5f8f12; }
.hblock[data-s="progesterone"] { border-color: #c2185b; background: #fdeef4; }
.hblock[data-s="progesterone"] legend { background: #c2185b; }
.hblock[data-s="testosterone"] { border-color: #b7791f; background: #fdf5e4; }
.hblock[data-s="testosterone"] legend { background: #b7791f; }
.hgrid-wrap { background: #fff; border-radius: 10px; padding: 6px 4px; margin: 10px 0 4px; }
.hgrid-pm { margin-top: 4px; }
.hslot { display: inline-block; padding: 3px 8px; border-radius: 999px; font-weight: 700; font-size: .8rem; white-space: nowrap; }
.hslot-am { background: #fff4c2; color: #7a5a00; }
.hslot-pm { background: #22314a; color: #e8eefc; }
.hgrid input { color: #9aa39b; background: #f6f7f5; border: 1px solid #e3e6e1; }
.hblock[data-s="estrogen"] .hgrid input.nz { color: #fff; background: #5f8f12; border-color: #5f8f12; font-weight: 700; }
.hblock[data-s="progesterone"] .hgrid input.nz { color: #fff; background: #c2185b; border-color: #c2185b; font-weight: 700; }
.hblock[data-s="testosterone"] .hgrid input.nz { color: #fff; background: #b7791f; border-color: #b7791f; font-weight: 700; }
.hgrid th.hb { color: #c0392b; }
.hc-status { align-self: center; font-size: .9rem; color: #b3c0af; margin-right: 6px; }
.hc-status.saving { color: #f7b928; } .hc-status.saved { color: #bfe63a; font-weight: 600; } .hc-status.err { color: #ff8a70; font-weight: 600; }

.hc-autosave { font-size: .95rem; color: #5f6b60; padding: 6px 0; }
.hc-autosave.saving { color: #b7791f; } .hc-autosave.saved { color: #3f7a10; font-weight: 600; } .hc-autosave.err { color: #b23a3a; font-weight: 600; }
.hbody[hidden], [data-pm][hidden], [data-once][hidden] { display: none !important; }

/* lab trends */
.lb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin: 10px 0 14px; }
.lb-chart { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; background: #fff; }
.lb-empty { display: flex; flex-direction: column; gap: 4px; justify-content: center; min-height: 80px; }
.lb-head { display: flex; align-items: center; gap: 10px; }
.lb-last { font-size: 1.5rem; font-weight: 700; margin-left: auto; }
.lb-svg { width: 100%; height: auto; display: block; margin-top: 4px; }
.lb-band { fill: #e3f3cf; }
.lb-tgt { stroke: #5f8f12; stroke-width: 1.2; stroke-dasharray: 2 3; }
.lb-dose { stroke: #c2185b; stroke-width: 1.2; stroke-dasharray: 5 4; }
.lb-line { fill: none; stroke: #1f3a2a; stroke-width: 2.2; }
.lb-dot { fill: #1f3a2a; stroke: #fff; stroke-width: 1.5; }
.lb-ax { font-size: 10px; fill: #6b756c; }
.lb-form { align-items: flex-end; gap: 10px; flex-wrap: wrap; }

.hgrid input.over, .hblock .hgrid input.nz.over { background: #b23a3a !important; border-color: #7a1f1f !important; color: #fff !important; outline: 2px solid #ffcf33; }
.hc-autosave.pending { color: #8a4b00; font-weight: 700; background: #fff3d6; border-radius: 10px; padding: 8px 12px; }
.hpubrow { gap: 10px; align-items: center; }
