/* ==========================================================================
   FitAF Peptide Calc — APP LAYOUT
   Shell, navigation, and per-view component styles.
   ========================================================================== */

/* ---------- App shell ---------- */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.app-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

/* Sidebar (desktop) */
.sidebar {
  position: sticky; top: 0; height: 100vh; align-self: start;
  background: linear-gradient(180deg, #080d1a 0%, #060913 100%);
  border-right: 1px solid var(--line); padding: 22px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.sidebar__brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 6px 10px 20px; }
.sidebar__brand img { height: 26px; width: auto; max-width: 100%; }
.sidebar__brand span { font-weight: 800; letter-spacing: .26em; font-size: 10px; text-transform: uppercase; color: var(--cyan); padding-left: 2px; }
.navlink {
  display: flex; align-items: center; gap: 13px; padding: 12px 14px;
  border-radius: var(--r-sm); color: var(--t-2); font-weight: 700; font-size: 15px;
  cursor: pointer; border: 1px solid transparent; transition: all .14s;
}
.navlink svg { width: 20px; height: 20px; stroke: currentColor; flex: none; }
.navlink:hover { color: var(--white); background: var(--glass); }
.navlink.active { color: var(--cyan); background: rgba(0,255,242,.07); border-color: var(--cyan-line); box-shadow: 0 0 22px rgba(0,255,242,.10) inset; }
.sidebar__spacer { flex: 1; }
.sidebar__user { border-top: 1px solid var(--line); padding-top: 14px; font-size: 13px; }
.sidebar__user b { display: block; color: var(--white); }

/* Main */
.main { min-width: 0; display: flex; flex-direction: column; }
.mhead { display: contents; }                 /* desktop: no header wrapper */
.topbar { display: none; align-items: center; justify-content: space-between; padding: 12px 16px; }
.topbar img { height: 26px; }
.view { padding: 38px clamp(18px, 4vw, 44px) 80px; max-width: 1180px; width: 100%; margin: 0 auto; }
.view__head { margin-bottom: 24px; }
.view__head h1 { font-size: clamp(28px, 4vw, 42px); }
.view__head p { color: var(--t-3); margin: 8px 0 0; max-width: 640px; line-height: 1.6; }

/* Top tab nav (mobile only) */
.topnav { display: none; }

/* ---------- Grids ---------- */
.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--auto { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

/* ---------- Stat tiles ---------- */
.stat { background: var(--card-2); border: 1px solid var(--line-2); border-radius: var(--r); padding: 18px 20px; }
.stat__n { font-size: 30px; font-weight: 900; color: var(--cyan); letter-spacing: -.03em; }
.stat__l { font-size: 12px; color: var(--t-3); text-transform: uppercase; letter-spacing: .12em; font-weight: 700; margin-top: 4px; }

/* ============== LOGIN ============== */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 28px; overflow-x: hidden; }
.login-card { width: 100%; max-width: 420px; text-align: center; }
.login-card img { max-height: 56px; max-width: 100%; width: auto; height: auto; margin-bottom: 18px; }
.login-card h1 { font-size: 30px; }
.login-card .login-sub { color: var(--t-3); margin: 8px 0 26px; font-size: 15px; }
.login-card .field { text-align: left; margin-bottom: 14px; }
.login-foot { margin-top: 18px; font-size: 13px; color: var(--t-4); }
.login-tabs { display: flex; gap: 8px; margin-bottom: 22px; }
.login-tabs button { flex: 1; padding: 10px; background: var(--glass); border: 1px solid var(--line-2); color: var(--t-2); border-radius: var(--r-sm); font-weight: 700; cursor: pointer; }
.login-tabs button.active { color: var(--cyan); border-color: var(--cyan-line); background: rgba(0,255,242,.06); }
.prov-list { display: flex; flex-direction: column; gap: 9px; margin-bottom: 16px; }
.prov-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 12px 16px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: rgba(255,255,255,.04); color: var(--white); font-weight: 700; font-size: 15px; cursor: pointer; transition: border-color .14s, background .14s, transform .1s; }
.prov-btn:hover { border-color: var(--cyan-line); background: rgba(255,255,255,.07); transform: translateY(-1px); }
.prov-mark { display: inline-flex; width: 18px; height: 18px; }
.or-div { display: flex; align-items: center; gap: 12px; color: var(--t-4); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; margin: 4px 0 16px; }
.or-div::before, .or-div::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.optin { display: flex; align-items: flex-start; gap: 10px; text-align: left; font-size: 13px; color: var(--t-2); line-height: 1.4; margin: 4px 0 8px; cursor: pointer; }
.optin input { width: 18px; height: 18px; accent-color: var(--cyan); margin-top: 1px; flex: none; }
.login-err { color: var(--red); font-size: 13.5px; min-height: 18px; text-align: left; margin: 2px 0 6px; }
.login-link { color: var(--cyan); font-size: 13px; cursor: pointer; }

/* ============== CALCULATOR ============== */
.calc-grid { display: grid; grid-template-columns: 1fr 360px; gap: 22px; align-items: start; }
.calc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.calc-inline { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.result-card { position: sticky; top: 90px; }
.result-big { text-align: center; padding: 8px 0 16px; }
.result-big .n { font-size: 52px; font-weight: 900; color: var(--cyan); line-height: 1; letter-spacing: -.04em; text-shadow: 0 0 28px rgba(0,255,242,.45); }
.result-big .u { font-size: 15px; color: var(--t-2); margin-top: 6px; font-weight: 700; letter-spacing: .04em; }
.result-list { list-style: none; padding: 0; margin: 0; }
.result-list li { display: flex; justify-content: space-between; padding: 11px 2px; border-top: 1px solid var(--line); font-size: 14px; }
.result-list li span:first-child { color: var(--t-3); }
.result-list li b { color: var(--white); }

/* Syringe viz */
.syringe { margin: 6px 0 4px; }
.syringe svg { width: 100%; height: auto; }

/* ============== LIBRARY ============== */
.lib-toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.lib-toolbar .input { max-width: 360px; }
.cat-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-tab { padding: 8px 14px; border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--glass); color: var(--t-2); font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; }
.cat-tab.active { color: var(--cyan); border-color: var(--cyan-line); background: rgba(0,255,242,.06); }
.cmpd-card { cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; display: flex; flex-direction: column; gap: 10px; }
.cmpd-card:hover { transform: translateY(-3px); border-color: var(--cyan-line); box-shadow: 0 0 40px rgba(0,255,242,.12), 0 24px 50px rgba(0,0,0,.5); }
.cmpd-card h3 { font-size: 19px; }
.cmpd-card .cmpd-cat { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--cyan); font-weight: 800; }
.cmpd-card p { color: var(--t-3); font-size: 13.5px; line-height: 1.55; margin: 0; flex: 1; }

/* Compound detail */
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.detail-aka { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 0; }
.detail-section { margin-top: 26px; }
.detail-section h2 { font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: var(--t-3); margin-bottom: 12px; }
.spec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.spec { background: var(--glass); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 13px 15px; }
.spec .k { font-size: 11px; color: var(--t-4); text-transform: uppercase; letter-spacing: .1em; }
.spec .v { font-size: 15px; color: var(--white); font-weight: 700; margin-top: 3px; word-break: break-word; }
.ref { border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 14px 16px; margin-bottom: 10px; background: rgba(255,255,255,.02); }
.ref .j { color: var(--cyan); font-weight: 800; font-size: 12px; letter-spacing: .04em; }
.ref .t { font-weight: 700; margin: 4px 0; font-size: 15px; }
.ref .m { color: var(--t-4); font-size: 12px; }
.faq { border-top: 1px solid var(--line); padding: 14px 0; }
.faq .q { font-weight: 700; }
.faq .a { color: var(--t-3); font-size: 14px; line-height: 1.6; margin-top: 6px; }

/* ============== DESIGNER ============== */
.proto-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; background: var(--card-2); border: 1px solid var(--line-2); border-radius: var(--r); padding: 14px 16px; margin-bottom: 10px; }
.proto-item .meta { color: var(--t-3); font-size: 13px; margin-top: 3px; }
.proto-item .meta b { color: var(--cyan); font-weight: 700; }

/* ============== SCHEDULER ============== */
.cal-card { max-width: 760px; margin: 0 auto; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--t-4); text-transform: uppercase; letter-spacing: .1em; padding: 6px 0; font-weight: 700; }
.cal-cell { min-height: 88px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 6px; font-size: 13px; position: relative; background: var(--glass); overflow: hidden; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.cal-cell:hover { border-color: var(--cyan-line); }
.cal-cell.empty { background: transparent; border-color: transparent; cursor: default; }
.cal-cell.today { border-color: var(--cyan); box-shadow: 0 0 16px rgba(0,255,242,.2) inset; }
.cal-cell.sel { outline: 2px solid var(--cyan); outline-offset: -1px; box-shadow: 0 0 22px rgba(0,255,242,.25); }
.cal-cell.alldone { background: rgba(52,211,153,.06); border-color: rgba(52,211,153,.35); }
.cal-cell .d { color: var(--t-2); font-weight: 700; }
.cal-cell .ev { margin-top: 4px; display: flex; flex-direction: column; gap: 3px; }
.cal-cell .ev .e { font-size: 10px; padding: 2px 5px; border-radius: 5px; background: rgba(0,255,242,.12); color: var(--cyan); border: 1px solid var(--cyan-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-cell .ev .e.done { background: rgba(52,211,153,.12); color: var(--green); border-color: rgba(52,211,153,.4); text-decoration: line-through; }
.cal-cell .ev .e--more { background: transparent; border: 0; color: var(--t-4); padding: 1px 2px; }
.day-panel { max-width: 760px; margin: 16px auto 0; }
.agenda-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.agenda-item .tick { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; cursor: pointer; flex: none; }
.agenda-item .tick.done { border-color: var(--green); background: rgba(52,211,153,.15); }
.agenda-item .tick.done svg { stroke: var(--green); }

/* ============== TRACKER ============== */
.log-row { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 13px 0; border-top: 1px solid var(--line); }
.log-row .when { color: var(--t-4); font-size: 12px; }
.site-map { display: flex; gap: 8px; flex-wrap: wrap; }
.site-opt { padding: 8px 13px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--glass); cursor: pointer; font-size: 13px; color: var(--t-2); }
.site-opt.active { border-color: var(--cyan-line); color: var(--cyan); background: rgba(0,255,242,.06); }

/* ============== QR ============== */
.qr-stage { max-width: 460px; margin: 0 auto; }
#qr-reader { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--cyan-line); box-shadow: 0 0 40px rgba(0,255,242,.15); }
.qr-result { margin-top: 18px; }

/* ============== SHOP (stub) ============== */
.shop-stub { text-align: center; padding: 60px 20px; }
.shop-stub .pill { margin-bottom: 18px; }

/* ---------- Themed select (custom dropdown) ---------- */
.tsel { position: relative; width: 100%; }
.tsel__trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 14px 14px 16px; background: var(--glass); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); color: var(--white); font-size: 16px; cursor: pointer; text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.tsel__trigger:hover { border-color: var(--cyan-line); }
.tsel.open .tsel__trigger { border-color: var(--cyan-soft); box-shadow: 0 0 0 3px rgba(0,255,242,.08); }
.tsel__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tsel__label.is-ph { color: var(--t-faint); }
.tsel__caret { color: var(--cyan); transition: transform .2s ease; flex: none; }
.tsel.open .tsel__caret { transform: rotate(180deg); }
.tsel__panel {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 80;
  max-height: 320px; padding: 6px; display: none; flex-direction: column;
  background: #0b1120; border: 1px solid var(--cyan-line); border-radius: var(--r);
  box-shadow: 0 0 44px rgba(0,255,242,.16), 0 24px 50px rgba(0,0,0,.65);
  animation: fadeUp .16s ease;
}
.tsel.open .tsel__panel { display: flex; }
.tsel__search { margin-bottom: 6px; flex: none; font-size: 15px; padding: 11px 13px; }
.tsel__list { overflow-y: auto; }
.tsel__panel--search .tsel__list { max-height: 250px; }
.tsel__empty { padding: 16px; text-align: center; color: var(--t-4); font-size: 14px; }
.tsel__opt {
  padding: 11px 13px; border-radius: var(--r-sm); color: var(--t-1); font-size: 15px; cursor: pointer;
  border: 1px solid transparent; transition: background .15s, color .15s, box-shadow .15s, border-color .15s, transform .1s;
}
.tsel__opt:hover { background: rgba(0,255,242,.08); color: var(--cyan); border-color: var(--cyan-line); box-shadow: inset 0 0 22px rgba(0,255,242,.18); }
.tsel__opt:active { background: rgba(0,255,242,.18); transform: scale(.99); }
.tsel__opt.sel { color: var(--cyan); background: rgba(0,255,242,.07); border-color: var(--cyan-line); }
.tsel__list::-webkit-scrollbar { width: 9px; }
.tsel__list::-webkit-scrollbar-track { background: transparent; }
.tsel__list::-webkit-scrollbar-thumb { background: rgba(0,255,242,.28); border-radius: 8px; border: 2px solid #0b1120; }

/* ---------- Number input + custom steppers ---------- */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.numwrap { position: relative; width: 100%; }
.numwrap .input.num { padding-right: 46px; }
.num__steps { position: absolute; top: 6px; right: 6px; bottom: 6px; display: flex; flex-direction: column; gap: 3px; }
.num__step {
  flex: 1; width: 32px; display: grid; place-items: center;
  background: rgba(0,255,242,.07); border: 1px solid var(--line-2); border-radius: 7px;
  color: var(--cyan); cursor: pointer; padding: 0;
  transition: background .14s, box-shadow .14s, border-color .14s;
}
.num__step:hover { background: rgba(0,255,242,.16); border-color: var(--cyan-line); box-shadow: 0 0 14px rgba(0,255,242,.28); }
.num__step:active { background: rgba(0,255,242,.3); }

/* ---------- Wizard ---------- */
.wiz-preview { background: var(--glass); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 12px 14px; }
.wiz-step { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.wiz-step:last-of-type { border-bottom: 0; }
.wiz-step b { color: var(--cyan); }

/* ---------- Stack Builder ---------- */
.sb-callout { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sb-callout .btn { flex: none; }

.sb-head { margin-bottom: 16px; }
.sb-steps { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; }
.sb-step { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--t-4); }
.sb-step.active { color: var(--cyan); }
.sb-step.done { color: var(--t-2); }

.sb-goals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sb-goal { display: flex; gap: 10px; align-items: flex-start; padding: 13px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--glass); cursor: pointer; transition: border-color .14s, box-shadow .14s, transform .1s; }
.sb-goal:hover { border-color: var(--cyan-line); }
.sb-goal.sel { border-color: var(--cyan); background: rgba(0,255,242,.07); box-shadow: 0 0 22px rgba(0,255,242,.12) inset; }
.sb-goal:active { transform: scale(.99); }
.sb-goal__check { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line-2); display: grid; place-items: center; flex: none; color: var(--bg); background: transparent; }
.sb-goal.sel .sb-goal__check { background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 12px rgba(0,255,242,.5); }
.sb-goal.sel .sb-goal__check svg { stroke: #04121a; }
.sb-goal__t { font-weight: 800; font-size: 14px; line-height: 1.2; }
.sb-goal__d { color: var(--t-3); font-size: 12px; margin-top: 3px; line-height: 1.35; }

.sb-section { margin-bottom: 16px; }
.sb-section__t { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--cyan); margin-bottom: 8px; }
.sb-pick { display: flex; gap: 11px; align-items: center; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--glass); cursor: pointer; margin-bottom: 7px; transition: border-color .14s, background .14s; }
.sb-pick:hover { border-color: var(--cyan-line); }
.sb-pick.sel { border-color: var(--cyan-line); background: rgba(0,255,242,.06); }
.sb-pick__check { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--line-2); display: grid; place-items: center; flex: none; }
.sb-pick.sel .sb-pick__check { background: var(--cyan); border-color: var(--cyan); }
.sb-pick.sel .sb-pick__check svg { stroke: #04121a; }
.sb-pick { align-items: flex-start; }
.sb-pick__t { font-weight: 700; font-size: 14.5px; }
.sb-pick__d { color: var(--t-2); font-size: 12.5px; line-height: 1.45; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sb-pick__meta { color: var(--cyan); font-size: 11.5px; margin-top: 4px; opacity: .9; }
.sb-star { color: var(--cyan); }

.sb-level { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.sb-lvl { flex: 1 1 130px; text-align: left; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--glass); color: var(--t-2); cursor: pointer; transition: border-color .14s, background .14s; }
.sb-lvl:hover { border-color: var(--cyan-line); }
.sb-lvl.active { border-color: var(--cyan); background: rgba(0,255,242,.08); color: var(--white); box-shadow: 0 0 20px rgba(0,255,242,.12) inset; }
.sb-lvl__s { font-size: 11.5px; color: var(--t-3); margin-top: 2px; font-weight: 500; }
.sb-why { font-size: 12.5px; line-height: 1.5; color: var(--t-2); background: rgba(0,255,242,.05); border-left: 2px solid var(--cyan-line); padding: 9px 12px; border-radius: 0 8px 8px 0; margin-bottom: 10px; }
.sb-why a { color: var(--cyan); }

/* questionnaire */
.sb-quiz-q { margin-bottom: 18px; }
.sb-quiz-q__t { font-weight: 700; font-size: 15px; margin-bottom: 9px; }
.sb-quiz-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.sb-quiz-opt { padding: 10px 15px; border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--glass); color: var(--t-2); font-weight: 600; font-size: 13.5px; cursor: pointer; transition: border-color .14s, color .14s, background .14s, box-shadow .14s; }
.sb-quiz-opt:hover { border-color: var(--cyan-line); color: var(--white); }
.sb-quiz-opt.active { border-color: var(--cyan); color: var(--cyan); background: rgba(0,255,242,.08); box-shadow: 0 0 16px rgba(0,255,242,.18); }

.sb-foot { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: space-between; gap: 10px; margin: 18px -22px -22px; padding: 15px 22px; border-top: 1px solid var(--line); background: #0c1120; }
.sb-foot .btn { min-width: 120px; justify-content: center; }
.btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; transform: none; }

@media (max-width: 540px) { .sb-goals { grid-template-columns: 1fr; } .sb-callout { flex-direction: column; align-items: stretch; } .sb-callout .btn { width: 100%; } }

/* ---------- Order / cart ---------- */
.order-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); }
.order-row:first-child { border-top: 0; }

/* ---------- Modal / toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(2,4,10,.72); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fadeUp .2s ease; }
.modal { width: 100%; max-width: 520px; max-height: 88vh; overflow: auto; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #0c1322; border: 1px solid var(--cyan-line); color: var(--white); padding: 13px 20px; border-radius: var(--r); box-shadow: 0 0 30px rgba(0,255,242,.25); z-index: 200; font-weight: 700; font-size: 14px; animation: fadeUp .25s ease; }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 50px 20px; color: var(--t-4); }
.empty svg { width: 42px; height: 42px; stroke: var(--t-faint); margin-bottom: 12px; }

/* ====================================================================
   RESPONSIVE
   ==================================================================== */
@media (max-width: 920px) {
  .calc-grid { grid-template-columns: 1fr; }
  .result-card { position: static; }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  /* sticky header = brand bar + top tab strip */
  .mhead { display: block; position: sticky; top: 0; z-index: 30; background: rgba(6,9,19,.96); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
  .mhead { padding-top: calc(env(safe-area-inset-top) + 10px); }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 12px; }
  .topbar__logo { height: 24px; width: auto; }
  .topnav { display: none; }
  .view { padding: 54px 16px 112px; }
  .bottomnav { display: flex; }
  .fab-feedback { bottom: 94px; }
  .calc-row { grid-template-columns: 1fr; }
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
  .cal-grid { gap: 4px; }
  .cal-cell { min-height: 66px; padding: 4px; }
  .cal-cell .ev .e { font-size: 9px; padding: 1px 3px; }
}
@media (max-width: 420px) {
  .cal-cell { padding: 3px; font-size: 11px; min-height: 58px; }
}

/* ---- titration: warnings, mandatory acks, weekly check-in ---- */
.text-warn { color: #ffb454; }
.wiz-warn { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0 4px;
  padding: 11px 13px; border-radius: var(--r-sm); font-size: 13px; line-height: 1.4;
  background: rgba(255, 180, 84, .08); border: 1px solid rgba(255, 180, 84, .38); }
.wiz-warn input { width: 18px; height: 18px; accent-color: #ffb454; margin-top: 1px; flex: none; }
.wiz-warn--info { background: var(--cyan-faint); border-color: var(--cyan-line); }
.wiz-warn--info input { accent-color: var(--cyan); }
.shake { animation: shake .45s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-6px)} 40%,80%{transform:translateX(6px)} }

.wiz-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.wiz-choice { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left;
  padding: 11px 12px; border-radius: var(--r-sm); cursor: pointer;
  background: var(--card-2); border: 1px solid var(--line-2); color: var(--white); }
.wiz-choice b { font-size: 14px; }
.wiz-choice span { font-size: 11px; }
.wiz-choice:hover { border-color: var(--cyan-line); }
.wiz-choice.is-on { border-color: var(--cyan); background: rgba(0,255,242,.07); box-shadow: 0 0 18px rgba(0,255,242,.12) inset; }
.wiz-choice.is-on b { color: var(--cyan); }
.wiz-radio { display: flex; gap: 9px; align-items: center; padding: 9px 11px; margin-bottom: 7px;
  border-radius: var(--r-sm); background: var(--card-2); border: 1px solid var(--line-2); cursor: pointer; font-size: 13.5px; }
.wiz-radio input { width: 17px; height: 17px; accent-color: var(--cyan); flex: none; }
.wiz-radio:hover { border-color: var(--cyan-line); }

.checkin-banner { background: var(--card-2); }
.checkin-banner__pulse { width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center; color: var(--cyan);
  background: rgba(0,255,242,.10); border: 1px solid var(--cyan-line);
  box-shadow: 0 0 0 0 rgba(0,255,242,.45); animation: ciPulse 2s infinite; }
@keyframes ciPulse { 0%{box-shadow:0 0 0 0 rgba(0,255,242,.4)} 70%{box-shadow:0 0 0 12px rgba(0,255,242,0)} 100%{box-shadow:0 0 0 0 rgba(0,255,242,0)} }
@media (max-width: 560px) { .wiz-choices { grid-template-columns: 1fr; } }

/* ---- time-of-day pill (AM/PM) on protocol items + day panel ---- */
.time-pill { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px;
  font-size: 10px; font-weight: 800; letter-spacing: .06em; vertical-align: middle; }
.time-pill--am { background: rgba(255, 180, 84, .14); color: #ffc06a; border: 1px solid rgba(255, 180, 84, .4); }
.time-pill--pm { background: rgba(120, 130, 255, .16); color: #aab2ff; border: 1px solid rgba(120, 130, 255, .45); }

/* "Learn more" link on stack-builder pick rows */
.sb-pick__learn { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 800;
  letter-spacing: .02em; color: var(--cyan); cursor: pointer; }
.sb-pick__learn:hover { text-decoration: underline; }

/* Floating feedback button — bottom-right, over the whole app (below modals z=100) */
.fab-feedback { position: fixed; right: 20px; bottom: 20px; z-index: 60;
  width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer; color: #04141a;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #00FFF2, #0bb5ad);
  box-shadow: 0 6px 24px rgba(0,255,242,.35);
  animation: fabPulse 2.8s infinite; transition: transform .15s ease, box-shadow .2s ease; }
.fab-feedback:hover { transform: translateY(-2px) scale(1.06); box-shadow: 0 10px 30px rgba(0,255,242,.55); }
.fab-feedback:active { transform: scale(.95); }
@keyframes fabPulse {
  0% { box-shadow: 0 6px 24px rgba(0,255,242,.35), 0 0 0 0 rgba(0,255,242,.45); }
  70% { box-shadow: 0 6px 24px rgba(0,255,242,.35), 0 0 0 14px rgba(0,255,242,0); }
  100% { box-shadow: 0 6px 24px rgba(0,255,242,.35), 0 0 0 0 rgba(0,255,242,0); } }
@media (max-width: 560px) { .fab-feedback { width: 52px; height: 52px; right: 16px; bottom: 94px; } }

/* ---- bottom nav (mobile only; desktop uses the sidebar) ---- */
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  gap: 2px; padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(8,11,22,.97); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
@media (min-width: 761px) { .bottomnav { display: none; } }
.bottomnav__tab { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 4px; border-radius: 12px; color: var(--t-4); font-size: 10px; font-weight: 700;
  cursor: pointer; border: 1px solid transparent; text-decoration: none; }
.bottomnav__tab svg { width: 22px; height: 22px; stroke: currentColor; }
.bottomnav__tab.active { color: var(--cyan); background: rgba(0,255,242,.10); border-color: var(--cyan-line); }

/* ---- "More" sheet ---- */
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.more-item { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px;
  border-radius: 14px; background: var(--card-2); border: 1px solid var(--line-2); color: var(--white);
  font-size: 12px; font-weight: 700; cursor: pointer; }
.more-item:hover { border-color: var(--cyan-line); color: var(--cyan); }
.more-item svg { stroke: currentColor; }

/* ---- login logo centered (fix lopsided) ---- */
.login-card { text-align: center; }
.login-card .logo-pulse, .login-card > img { display: block; margin: 0 auto 12px; }

/* ---- top bar brand (logo + Peptide Suite) ---- */
.topbar__brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.topbar__suite { font-weight: 800; letter-spacing: .14em; font-size: 10px; text-transform: uppercase;
  color: var(--cyan); white-space: nowrap; padding-top: 2px; }

/* ---- FitAF AI chat (fixed-height: log scrolls, composer pinned at bottom) ---- */
.view--ai { height: 100dvh; display: flex; flex-direction: column;
  padding: 22px clamp(16px, 4vw, 44px) 16px; max-width: 920px; margin: 0 auto; overflow: hidden; }
.ai-view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ai-view .view__head { flex: none; }
.ai-log { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 10px; padding: 6px 2px; }
.ai-suggest { flex: none; }
.ai-composer { flex: none; }
@media (max-width: 760px) {
  .view--ai { height: calc(100dvh - 56px - 88px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 16px 14px 12px; }
}
.ai-msg { display: flex; }
.ai-msg--user { justify-content: flex-end; }
.ai-msg--assistant { justify-content: flex-start; }
.ai-bubble { max-width: 88%; padding: 11px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; }
.ai-msg--user .ai-bubble { background: linear-gradient(145deg, #00FFF2, #0bb5ad); color: #04141a; font-weight: 600; border-bottom-right-radius: 5px; }
.ai-msg--assistant .ai-bubble { background: var(--card-2); border: 1px solid var(--line-2); color: var(--t-1); border-bottom-left-radius: 5px; }
.ai-typing { display: inline-flex; gap: 4px; padding: 3px 0; }
.ai-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--t-4); animation: aiBlink 1.2s infinite; }
.ai-typing span:nth-child(2) { animation-delay: .2s; }
.ai-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes aiBlink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.ai-suggest { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 10px; }
.ai-chip { padding: 8px 12px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line-2);
  color: var(--t-2); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.ai-chip:hover { border-color: var(--cyan-line); color: var(--cyan); }
.ai-composer { display: flex; gap: 8px; align-items: flex-end; padding-top: 8px; }
.ai-input { resize: none; min-height: 46px; max-height: 120px; }
.ai-card__icon { width: 44px; height: 44px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--cyan); background: var(--cyan-faint); border: 1px solid var(--cyan-line); }
.ai-card:hover { border-color: var(--cyan-line); }

/* AI "add to schedule" action under a proposal */
.ai-action { display: flex; justify-content: flex-start; margin: -2px 0 4px; }
.ai-action .btn { box-shadow: 0 0 0 1px var(--cyan-line) inset; }
