/* Basal Patient Portal. Look copied from portal/prototype.html (paper inside,
   like basalclinic.ca), without the device frame, the tour rail and Ask Basal. */
:root{
  --ground:#F6F2EA; --card:#ECE6D8; --card2:#FBF9F4; --text:#141F1A; --muted:#5E6F65; --rule:#D8D2C4;
  --forest:#21382E; --on-forest:#ECE6D8; --copper:#A9633F; --sprout:#5C8A48; --alert:#B5452B; --alert-bg:#F7E3DC; --soft:#E3EBDD;
  --display:"Newsreader",Georgia,serif; --ui:"Jost","Avenir Next","Segoe UI",system-ui,sans-serif; --mono:"DM Mono",ui-monospace,Menlo,monospace;
}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){
  --ground:#111A16; --card:#1A2620; --card2:#16211C; --text:#E9E4D8; --muted:#94A09A; --rule:#2B3833;
  --forest:#2C4A3C; --on-forest:#ECE6D8; --copper:#C98A62; --sprout:#8FB37A; --alert:#E08A70; --alert-bg:#3A221B; --soft:#1F3027; color-scheme:dark}}
:root[data-theme="dark"]{
  --ground:#111A16; --card:#1A2620; --card2:#16211C; --text:#E9E4D8; --muted:#94A09A; --rule:#2B3833;
  --forest:#2C4A3C; --on-forest:#ECE6D8; --copper:#C98A62; --sprout:#8FB37A; --alert:#E08A70; --alert-bg:#3A221B; --soft:#1F3027; color-scheme:dark}

html,body{height:100%;margin:0}
body{background:var(--ground);color:var(--text);font-family:var(--ui);font-size:15px;-webkit-font-smoothing:antialiased;overflow:hidden}
button,input,textarea{font:inherit;color:inherit}
button{background:none;border:0;padding:0;cursor:pointer;-webkit-tap-highlight-color:transparent}
:focus-visible{outline:2px solid var(--copper);outline-offset:2px}
a{color:var(--copper)}
.mono{font-family:var(--mono);font-variant-numeric:tabular-nums}
.dia{width:10px;height:10px;border:1.5px solid var(--copper);transform:rotate(45deg);display:inline-block}

.app{position:relative;height:100vh;height:100dvh;max-width:480px;margin:0 auto;display:flex;flex-direction:column;overflow:hidden;isolation:isolate;padding-top:env(safe-area-inset-top,0px);box-sizing:border-box}
@media (min-width:520px){.app{border-left:1px solid var(--rule);border-right:1px solid var(--rule)}}
#app{flex:1;min-height:0;display:flex;flex-direction:column}
.enter{animation:enter .3s cubic-bezier(.2,.8,.2,1)}
@keyframes enter{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){.enter,.sheet{animation:none!important}}
.head{flex:none;display:flex;align-items:center;justify-content:space-between;padding:10px 20px 8px}
.brand{display:flex;align-items:center;gap:10px;font-weight:500;letter-spacing:.36em;font-size:12px}
.avatar{width:34px;height:34px;border-radius:50%;background:var(--forest);color:var(--on-forest);display:grid;place-items:center;font-size:13px;font-weight:600}
.scroll{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;padding:4px 20px 24px;scrollbar-width:none}
.scroll::-webkit-scrollbar{display:none}
.eyebrow{font-size:11px;letter-spacing:.16em;text-transform:uppercase;color:var(--muted);font-weight:500}
.h1{font-family:var(--display);font-weight:300;font-size:32px;line-height:1.1;margin:4px 0 0;text-wrap:balance}
.h2{font-family:var(--display);font-weight:400;font-size:21px;margin:0;line-height:1.2}
.sec{font-size:11px;letter-spacing:.16em;text-transform:uppercase;color:var(--muted);font-weight:500;margin:24px 0 10px}
.card{background:var(--card);border-radius:22px;padding:16px 18px}
.stack{display:flex;flex-direction:column;gap:10px}
.small{font-size:13px;color:var(--muted);line-height:1.5}
.btn{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:50px;border-radius:16px;background:var(--forest);color:var(--on-forest);font-weight:500;font-size:16px;text-decoration:none}
.btn.ghost{background:transparent;color:var(--text);border:1px solid var(--rule)}
.btn[disabled]{opacity:.45;cursor:default}
.link{color:var(--copper);text-decoration:underline;font-size:14px}
.field{width:100%;box-sizing:border-box;border:1px solid var(--rule);background:var(--card2);border-radius:14px;padding:14px 16px;font-size:17px}
.code{letter-spacing:.5em;text-align:center;font-family:var(--mono);font-size:22px}
.err{color:var(--alert);font-size:14px;line-height:1.4;min-height:0;margin:0}
.err:empty{display:none}
.ok-note{font-size:14px;line-height:1.45;background:var(--soft);border-radius:14px;padding:10px 14px;margin:0}

/* sign in */
.signin{flex:1;display:flex;flex-direction:column;padding:28px 24px calc(28px + env(safe-area-inset-bottom,0px));gap:16px;overflow-y:auto}
.signin .mark{display:flex;align-items:center;gap:12px;font-weight:500;letter-spacing:.42em;font-size:14px;margin-bottom:auto}
.signin form{display:flex;flex-direction:column;gap:12px}
.check{display:flex;gap:12px;align-items:flex-start;font-size:14px;line-height:1.45}
.check input{width:20px;height:20px;margin:1px 0 0;accent-color:var(--forest);flex:none}

/* home */
.status{background:var(--forest);color:var(--on-forest);border-radius:24px;padding:18px 18px 16px}
.status .eyebrow{color:rgba(236,230,216,.7)}
.status .h2{color:var(--on-forest);margin-top:6px}
.status p{margin:8px 0 0;font-size:14px;line-height:1.5;color:rgba(236,230,216,.85)}
.steps{list-style:none;margin:16px 0 0;padding:0;display:flex;flex-direction:column}
.steps li{display:grid;grid-template-columns:22px 1fr auto;gap:10px;align-items:start;padding:7px 0;font-size:14px;position:relative}
.steps li::before{content:"";position:absolute;left:10px;top:24px;bottom:-8px;width:1.5px;background:rgba(236,230,216,.22)}
.steps li:last-child::before{display:none}
.dot{width:20px;height:20px;border-radius:50%;border:1.5px solid rgba(236,230,216,.4);display:grid;place-items:center;box-sizing:border-box;position:relative;z-index:1;background:var(--forest)}
.done .dot{background:var(--on-forest);border-color:var(--on-forest)}
.done .dot svg{stroke:var(--forest)}
.now .dot{border-color:var(--copper);box-shadow:0 0 0 4px rgba(201,138,98,.25)}
.now .dot::after{content:"";width:8px;height:8px;border-radius:50%;background:var(--copper)}
.steps .when{font-family:var(--mono);font-size:11.5px;color:rgba(236,230,216,.65);padding-top:2px}
.steps .step-note{grid-column:2 / 4;font-size:12.5px;line-height:1.4;color:rgba(236,230,216,.7);margin-top:-6px}
.steps .later{color:rgba(236,230,216,.6)}
.tiles{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.tile{background:var(--card);border-radius:20px;padding:14px 16px;text-align:left;display:flex;flex-direction:column;gap:4px;min-width:0}
.tile b{font-family:var(--display);font-weight:400;font-size:22px}
.tile span{font-size:13px;color:var(--muted)}
.facts{display:flex;flex-direction:column;margin:0}
.facts div{display:flex;justify-content:space-between;gap:16px;padding:11px 0;border-bottom:1px solid var(--rule);font-size:14px}
.facts div:last-child{border:0}
.facts dt{color:var(--muted)}
.facts dd{margin:0;text-align:right}

/* messages */
.thread{display:flex;flex-direction:column;gap:12px;padding-bottom:8px}
.day{align-self:center;font-family:var(--mono);font-size:11px;color:var(--muted);margin:6px 0 2px}
.bub{max-width:82%;padding:11px 14px;border-radius:18px;font-size:15px;line-height:1.45;white-space:pre-wrap;overflow-wrap:anywhere}
.bub.me{align-self:flex-end;background:var(--forest);color:var(--on-forest);border-bottom-right-radius:6px}
.bub.them{align-self:flex-start;background:var(--card);border-bottom-left-radius:6px}
.bub img{display:block;max-width:100%;max-height:260px;border-radius:12px;margin:2px 0 6px}
.who{font-size:11.5px;color:var(--muted);margin:0 4px -6px}
.meta{font-size:11.5px;opacity:.7;margin-top:4px;display:block}
.redcard{align-self:stretch;border-radius:18px;padding:14px 16px;font-size:14.5px;line-height:1.5;background:var(--alert-bg);border:1.5px solid var(--alert)}
.redcard b{color:var(--alert)}
.compose{flex:none;border-top:1px solid var(--rule);padding:10px 14px 12px;background:var(--ground)}
.compose .bar{display:flex;gap:8px;align-items:flex-end}
.compose textarea{flex:1;min-width:0;resize:none;border:1px solid var(--rule);background:var(--card2);border-radius:20px;padding:10px 14px;font-size:16px;line-height:1.4;max-height:120px}
.iconbtn{width:42px;height:42px;border-radius:50%;display:grid;place-items:center;flex:none}
.iconbtn.send{background:var(--forest);color:var(--on-forest)}
.iconbtn.send[disabled]{opacity:.45}
.iconbtn.attach{border:1px solid var(--rule);cursor:pointer}
.compose .jane-note{font-size:13px;line-height:1.45;background:var(--soft);border-radius:12px;padding:8px 12px;margin:0 0 8px}
.compose .note{font-size:12px;color:var(--muted);margin:8px 4px 0}
.topics{display:flex;gap:6px;overflow-x:auto;scrollbar-width:none;margin:0 0 8px;padding:1px}
.topics::-webkit-scrollbar{display:none}
.topics button{flex:none;font-size:13px;border:1px solid var(--rule);border-radius:999px;padding:6px 12px;color:var(--muted);background:var(--card2)}
.topics button.on{background:var(--forest);border-color:var(--forest);color:var(--on-forest)}
.topics-label{font-size:12px;color:var(--muted);margin:0 4px 6px}
.file{display:inline-flex;gap:8px;align-items:center;font-size:12.5px;background:var(--soft);border-radius:999px;padding:4px 6px 4px 10px;margin:0 0 8px}
.file button{width:22px;height:22px;border-radius:50%;display:grid;place-items:center}

/* pay */
.owed{font-family:var(--display);font-weight:300;font-size:56px;line-height:1;margin:8px 0 2px}
.sheet-wrap{position:absolute;inset:0;background:rgba(10,16,13,.45);display:flex;align-items:flex-end;z-index:20}
.sheet{width:100%;background:var(--ground);border-radius:28px 28px 0 0;padding:22px 22px calc(28px + env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;gap:14px;box-sizing:border-box;animation:up .3s cubic-bezier(.2,.8,.2,1)}
@keyframes up{from{transform:translateY(40px);opacity:0}to{transform:none;opacity:1}}
.paid{display:flex;gap:12px;align-items:center;background:var(--soft);border-radius:18px;padding:14px 16px;font-size:14px}

/* tabs */
.tabs{flex:none;display:grid;grid-template-columns:repeat(3,1fr);border-top:1px solid var(--rule);padding:6px 6px calc(8px + env(safe-area-inset-bottom,0px));background:var(--ground)}
.tabs button{display:flex;flex-direction:column;align-items:center;gap:3px;font-size:11px;color:var(--muted);padding:6px 0;position:relative}
.tabs button.on{color:var(--text);font-weight:500}
.tabs svg{width:22px;height:22px}
.badge{position:absolute;top:2px;left:calc(50% + 6px);min-width:16px;height:16px;border-radius:8px;background:var(--copper);color:#fff;font-size:10px;display:grid;place-items:center;padding:0 4px;box-sizing:border-box}

.toast{position:absolute;left:16px;right:16px;bottom:calc(84px + env(safe-area-inset-bottom,0px));background:var(--text);color:var(--ground);border-radius:14px;padding:12px 16px;font-size:14px;z-index:30;text-align:center}
.loading{flex:1;display:grid;place-items:center}
