/* Study Notes — styles. Colors and fonts come from CSS variables set by themes.js
   (per profile), so every theme restyles the whole app including the notes. */

:root {
  --bg: #f5f3ee; --surface: #ffffff; --surface-2: #f0eee8; --ink: #1e1f1c; --muted: #6b6c66;
  --line: #e0ddd4; --accent: #2f6f5e; --on-accent: #ffffff; --accent-soft: #e3eeea;
  --ok: #2f7d4f; --ok-soft: #e6f2ea; --warn: #a15c00; --warn-soft: #fbf1e1; --bad: #b3261e; --bad-soft: #fbe9e7;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-read: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs: 16px; --radius: 14px; --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 6px 24px rgb(0 0 0 / .06);
  --topbar-h: 58px; --bottombar-h: 64px;
  color-scheme: light;
}
:root[data-dark="1"] { color-scheme: dark; --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 28px rgb(0 0 0 / .35); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--fs)/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased; min-height: 100vh; min-height: 100dvh; overflow-x: clip;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: .86em; }
.tiny { font-size: .78em; }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.stack > * + * { margin-top: 14px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------------ top & bottom bars */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 18px;
  padding: 0 max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.logo { width: 26px; height: 26px; flex: none; }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 7px 13px; border-radius: 999px; color: var(--muted); font-weight: 550; font-size: .95em; }
.tabs a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.tabs a.on { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.spacer { flex: 1; }
.queue-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: .85em;
  background: var(--accent-soft); color: var(--ink); font-weight: 550; max-width: 44vw;
}
.queue-pill:hover { text-decoration: none; filter: brightness(.98); }
.queue-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s infinite; flex: none; }
.queue-pill.failed { background: var(--bad-soft); }
.queue-pill.failed .dot { background: var(--bad); animation: none; }
@keyframes pulse { 50% { opacity: .35; } }
.avatar-btn { border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; flex: none; }

.avatar {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; flex: none;
  font-weight: 700; font-size: 15px; line-height: 1; user-select: none; text-transform: uppercase; overflow: hidden;
}
.avatar.emoji { text-transform: none; font-size: 18px; }
.avatar.lg { width: 56px; height: 56px; font-size: 24px; }
.avatar.lg.emoji { font-size: 30px; }

.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: none; justify-content: space-around;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
}
.bottombar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 18px;
  color: var(--muted); font-size: .72em; font-weight: 600; border-radius: 12px; }
.bottombar a:hover { text-decoration: none; }
.bottombar a.on { color: var(--accent); }
.bb-icon { font-size: 1.55em; line-height: 1.1; }
.bb-badge { position: absolute; top: 0; right: 8px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  background: var(--accent); color: var(--on-accent); font: 700 11px/18px var(--font-ui); text-align: center; font-style: normal; }

.banner { padding: 10px 18px; background: var(--warn-soft); color: var(--ink); border-bottom: 1px solid var(--line); font-size: .9em; text-align: center; }
.banner.bad { background: var(--bad-soft); }

/* ------------------------------------------------------------------ page */
.view { max-width: 1120px; margin: 0 auto; padding: 26px 22px 60px; outline: none; }
.view.wide { max-width: none; }
.page-head { display: flex; align-items: flex-end; gap: 14px; margin: 4px 0 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.75em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.section-title { font-size: .78em; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 30px 0 10px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card + .card { margin-top: 14px; }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }
.empty .big { font-size: 2em; display: block; margin-bottom: 6px; opacity: .7; }
.error-box { background: var(--bad-soft); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); color: var(--ink);
  padding: 12px 14px; border-radius: 10px; white-space: pre-wrap; word-break: break-word; }
.note-box { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; font-size: .92em; }
.warn-box { background: var(--warn-soft); border-radius: 10px; padding: 12px 14px; font-size: .92em; }
.ok-text { color: var(--ok); } .warn-text { color: var(--warn); } .bad-text { color: var(--bad); }

/* ------------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 7px 15px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600;
  font-size: .93em; cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .15s, filter .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.big { min-height: 48px; padding: 10px 22px; font-size: 1em; border-radius: 12px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.sm { min-height: 30px; padding: 4px 10px; font-size: .84em; border-radius: 8px; }
.btn.block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent;
  color: var(--muted); cursor: pointer; font-size: 1.05em; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.on { color: var(--accent); background: var(--accent-soft); }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 550; }
.linkish:hover { text-decoration: underline; }

label.field { display: block; }
label.field > span, .field-label { display: block; font-size: .84em; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field-hint { font-size: .8em; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=url], input[type=date], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .84em; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=color] { width: 42px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; flex: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 14px; }
.span2 { grid-column: span 2; }

.toggle { display: flex; align-items: flex-start; gap: 11px; padding: 9px 0; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .sw { flex: none; width: 38px; height: 22px; border-radius: 11px; background: var(--line); position: relative; transition: background .15s; margin-top: 1px; }
.toggle .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform .15s; }
.toggle input:checked + .sw { background: var(--accent); }
.toggle input:checked + .sw::after { transform: translateX(16px); }
.toggle input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle b { display: block; font-weight: 600; }
.toggle small { display: block; color: var(--muted); font-size: .84em; margin-top: 1px; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 8px; font-size: .86em; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .1); }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .78em; font-weight: 600;
  background: var(--surface-2); color: var(--muted); max-width: 100%; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.acc { background: var(--accent-soft); color: var(--accent); }
.cdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }

.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .6s ease; }
.progress.indet > i { width: 35% !important; animation: indet 1.4s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(290%); } }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite; flex: none; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.stepper { display: flex; gap: 6px; align-items: center; font-size: .8em; color: var(--muted); flex-wrap: wrap; }
.stepper .st { display: inline-flex; align-items: center; gap: 5px; }
.stepper .st i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); display: inline-block; }
.stepper .st.done i { background: var(--accent); }
.stepper .st.now { color: var(--ink); font-weight: 650; }
.stepper .st.now i { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); animation: pulse 1.6s infinite; }
.stepper .st.fail i { background: var(--bad); }
.stepper .sep { width: 14px; height: 1px; background: var(--line); }

/* ------------------------------------------------------------------ dialogs, menus, toast */
dialog.dlg {
  border: 0; padding: 0; border-radius: 18px; background: var(--surface); color: var(--ink); width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 40px); box-shadow: 0 20px 60px rgb(0 0 0 / .3); overflow: hidden;
}
dialog.dlg.wide { width: min(760px, calc(100vw - 24px)); }
dialog.dlg::backdrop { background: rgb(10 12 10 / .45); backdrop-filter: blur(2px); }
dialog.dlg[open] { display: flex; flex-direction: column; animation: pop .16s ease-out; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.dlg-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 6px; }
.dlg-h h2 { font-size: 1.15em; flex: 1; }
.dlg-b { padding: 8px 18px 16px; overflow: auto; }
.dlg-f { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }
.dlg-f .left { margin-right: auto; }

.menu { position: fixed; z-index: 60; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 48px rgb(0 0 0 / .22); padding: 6px; animation: pop .12s ease-out; }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px; border: 0;
  background: none; color: var(--ink); cursor: pointer; text-align: left; font-size: .93em; }
.menu button:hover, .menu a:hover { background: var(--surface-2); text-decoration: none; }
.menu .menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu .mi { width: 20px; text-align: center; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px); z-index: 90; background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 12px; font-size: .92em; font-weight: 550; opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100vw - 32px);
  box-shadow: 0 10px 30px rgb(0 0 0 / .25); }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: var(--bad); color: #fff; }

/* ------------------------------------------------------------------ profile picker */
.picker { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 30px 18px; overflow: auto; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.picker h1 { font-size: clamp(1.6em, 4vw, 2.4em); margin-bottom: 30px; text-align: center; font-weight: 600; }
.picker .tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; max-width: 760px; }
.ptile { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 118px; border: 0; background: none; cursor: pointer;
  padding: 0; color: var(--muted); font-weight: 600; position: relative; }
.ptile .face { width: 118px; height: 118px; border-radius: 26px; display: grid; place-items: center; color: #fff; font-size: 52px; font-weight: 700;
  text-transform: uppercase; transition: transform .15s, box-shadow .15s; box-shadow: 0 6px 20px rgb(0 0 0 / .12); position: relative; }
.ptile .face.emoji { font-size: 60px; text-transform: none; }
.ptile:hover .face, .ptile:focus-visible .face { transform: translateY(-3px); box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--ink), 0 10px 26px rgb(0 0 0 / .18); }
.ptile:hover { color: var(--ink); }
.ptile .name { max-width: 118px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptile.add .face { background: transparent; border: 2px dashed var(--line); color: var(--muted); box-shadow: none; font-weight: 300; }
.ptile .edit-badge { position: absolute; inset: 0; border-radius: 26px; background: rgb(0 0 0 / .45); display: grid; place-items: center; font-size: 34px; color: #fff; }
.picker .manage { margin-top: 38px; }
.ptile .lock-badge { position: absolute; right: -6px; bottom: -6px; width: 34px; height: 34px; border-radius: 50%; background: var(--surface);
  display: grid; place-items: center; font-size: 16px; box-shadow: 0 2px 8px rgb(0 0 0 / .2); }

.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; }
.icon-grid button { height: 42px; border-radius: 10px; border: 1px solid transparent; background: var(--surface-2); font-size: 22px; cursor: pointer; }
.icon-grid button.on { border-color: var(--accent); background: var(--accent-soft); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .12); }
.swatch.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.preview-face { width: 96px; height: 96px; border-radius: 22px; display: grid; place-items: center; color: #fff; font-size: 44px; font-weight: 700;
  text-transform: uppercase; margin: 4px auto 14px; box-shadow: 0 6px 20px rgb(0 0 0 / .14); }
.preview-face.emoji { font-size: 52px; text-transform: none; }

/* ------------------------------------------------------------------ compose (new notes) */
.compose { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.compose-main > .card { padding: 20px; }
.addbar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.addbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 86px; padding: 10px 6px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer; font-weight: 600;
  font-size: .88em; transition: .15s; text-align: center; }
.addbtn:hover { border-color: var(--accent); background: var(--accent-soft); }
.addbtn .ic { font-size: 1.7em; line-height: 1; }
.addbtn small { color: var(--muted); font-weight: 500; font-size: .82em; }
.dropzone { position: relative; }
.dropzone.drag::after { content: "Drop to add"; position: absolute; inset: -8px; border: 2px dashed var(--accent); border-radius: 18px;
  background: color-mix(in srgb, var(--accent-soft) 85%, transparent); display: grid; place-items: center; font-weight: 700; color: var(--accent); z-index: 5; }
.srclist { margin: 16px 0 0; padding: 0; list-style: none; }
.srclist:empty { display: none; }
.srow { display: flex; gap: 12px; align-items: flex-start; padding: 11px 4px; border-top: 1px solid var(--line); }
.srow:first-child { border-top: 0; }
.srow .kic { width: 38px; height: 38px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: 1.15em; flex: none; overflow: hidden; }
.srow .kic img { width: 100%; height: 100%; object-fit: cover; }
.srow .sname { font-weight: 600; word-break: break-word; }
.srow .smeta { font-size: .82em; color: var(--muted); }
.srow .sid { font: 600 .72em/1 ui-monospace, Menlo, monospace; color: var(--muted); background: var(--surface-2); padding: 3px 5px; border-radius: 5px; margin-right: 4px; vertical-align: 2px; }
.srow .progress { margin-top: 6px; }
.srow textarea { margin-top: 8px; min-height: 110px; }
.detect { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px 14px; margin-top: 18px; }
.detect .src-note { font-size: .78em; color: var(--muted); margin-top: 4px; }
details.more { margin-top: 14px; }
details.more > summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: .9em; list-style: none; padding: 4px 0; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "▸"; display: inline-block; width: 16px; transition: transform .15s; }
details.more[open] > summary::before { transform: rotate(90deg); }
.go-row { display: flex; align-items: center; gap: 14px; margin-top: 20px; flex-wrap: wrap; }
.go-row .hint { color: var(--muted); font-size: .86em; }

.jobs { display: flex; flex-direction: column; gap: 10px; }
.job { display: block; padding: 13px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
a.job:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.job .jt { font-weight: 650; line-height: 1.3; }
.job .jm { font-size: .8em; color: var(--muted); margin-top: 2px; }
.job .jd { font-size: .84em; margin: 8px 0 6px; }
.job .eta { font-size: .8em; color: var(--muted); margin-top: 6px; display: flex; justify-content: space-between; gap: 8px; }
.job.failed { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.job .err { color: var(--bad); font-size: .84em; margin-top: 6px; word-break: break-word; }
.job .acts { display: flex; gap: 6px; margin-top: 9px; }
.side-col .section-title:first-child { margin-top: 0; }

/* ------------------------------------------------------------------ library (Finder columns) */
.lib-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.lib-bar .search { flex: 1 1 220px; max-width: 360px; }
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: .9em; min-height: 30px; margin-bottom: 10px; }
.crumbs a, .crumbs span { padding: 3px 8px; border-radius: 8px; color: var(--muted); font-weight: 600; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.crumbs span.cur { color: var(--ink); }
.crumbs .sep { color: var(--line); padding: 0; }
.finder { container-type: inline-size; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
  height: calc(100dvh - var(--topbar-h) - 190px); min-height: 380px; }
.ftrack { display: flex; height: 100%; transition: transform .38s cubic-bezier(.2, .8, .2, 1); will-change: transform;
  transform: translateX(calc(var(--shift-d, 0) * -50cqw)); }
.phone-only { display: none; }
.fcol { flex: 0 0 50cqw; height: 100%; overflow-y: auto; border-right: 1px solid var(--line); padding: 8px; overscroll-behavior: contain; }
.fcol.first { flex-basis: 50cqw; }
.fcol-h { position: sticky; top: -8px; z-index: 2; background: var(--surface); padding: 8px 10px 8px; margin: -8px -8px 6px; border-bottom: 1px solid var(--line);
  font-size: .76em; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.fcol-h .back { display: none; width: 28px; height: 28px; font-size: 1.4em; margin: -4px 0; }
.fitem { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 11px; border-radius: 10px; border: 0; background: none; color: var(--ink);
  cursor: pointer; text-align: left; }
.fitem:hover { background: var(--surface-2); text-decoration: none; }
.fitem.sel { background: var(--accent-soft); }
.fitem .fi-t { font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.fitem .fi-m { font-size: .8em; color: var(--muted); margin-top: 1px; }
.fitem .chev { color: var(--muted); margin-left: auto; flex: none; opacity: .6; }
.fitem .fdate { flex: none; width: 46px; text-align: center; border-radius: 9px; background: var(--surface-2); padding: 4px 0; line-height: 1.1; }
.fitem.sel .fdate { background: var(--surface); }
.fdate b { display: block; font-size: 1.05em; }
.fdate small { display: block; font-size: .66em; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.fitem .kinds { font-size: .8em; letter-spacing: 2px; }
.fbadge { flex: none; min-width: 26px; text-align: center; font-size: .78em; font-weight: 700; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 1px 7px; }
.fitem.sel .fbadge { background: var(--surface); }
.fprev { padding: 14px 16px; }
.fprev h2 { font-size: 1.3em; margin: 4px 0 6px; }
.fprev .overview { font-family: var(--font-read); margin: 14px 0; line-height: 1.6; }
.fprev .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.fempty { color: var(--muted); padding: 40px 18px; text-align: center; font-size: .92em; }
.results { display: flex; flex-direction: column; gap: 6px; }

/* ------------------------------------------------------------------ session / notes page */
.session { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.session.pinned { grid-template-columns: minmax(0, 1fr) 380px; gap: 26px; }
.ntop { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.ntop .crumbs { margin: 0; flex: 1; min-width: 0; }
.nhead h1 { font-family: var(--font-read); font-size: clamp(1.55em, 3.2vw, 2.15em); line-height: 1.18; margin: 4px 0 8px; }
.nhead .meta { color: var(--muted); font-size: .92em; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.nhead .meta .cdot { margin-right: 5px; vertical-align: 0; }
.statuscard { margin: 18px 0 8px; }
.statuscard .detail { margin: 10px 0 8px; font-weight: 550; }
.statuscard .eta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .86em; margin-top: 7px; flex-wrap: wrap; }
.qline { font-size: .86em; color: var(--muted); margin: 14px 0 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.notes { font-family: var(--font-read); font-size: calc(var(--fs) * 1.06); line-height: 1.68; max-width: 76ch; margin: 22px 0 0; overflow-wrap: break-word; }
.session.pinned .notes { max-width: 72ch; }
.session:not(.pinned) .smain { max-width: 880px; margin: 0 auto; width: 100%; }
.notes .md .qflag { font-size: .72em; vertical-align: 1px; }
.notes p { margin: .45em 0 .7em; }
.notes .overview { font-size: 1.08em; padding: 2px 0 2px 16px; border-left: 3px solid var(--accent); margin: 0 0 28px; color: var(--ink); }
.notes .nsec { margin: 34px 0 0; scroll-margin-top: calc(var(--topbar-h) + 12px); }
.notes h2 { font-family: var(--font-ui); font-size: .8em; text-transform: uppercase; letter-spacing: .09em; color: var(--accent); padding-bottom: 7px;
  border-bottom: 1px solid var(--line); margin-bottom: 14px; font-weight: 750; }
.notes h3 { font-size: 1.1em; margin: 22px 0 4px; font-weight: 700; font-family: var(--font-read); }
.notes .item + .item { border-top: 1px dashed var(--line); padding-top: 4px; }
.notes ul, .notes ol { padding-left: 1.3em; margin: .4em 0; }
.notes li { margin: .35em 0; }
.notes .deliv li { margin: .6em 0; }
.notes .due { font-family: var(--font-ui); display: inline-block; font-size: .74em; font-weight: 700; background: var(--warn-soft); color: var(--warn); padding: 1px 8px; border-radius: 999px; vertical-align: 2px; }
.notes .kind { font-family: var(--font-ui); font-size: .64em; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: var(--surface-2);
  color: var(--muted); padding: 2px 8px; border-radius: 999px; vertical-align: 3px; margin-left: 4px; }
.notes .contrast { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; font-size: .95em; }
.notes blockquote.q { margin: 10px 0 12px; padding: 4px 0 4px 16px; border-left: 3px solid color-mix(in srgb, var(--accent) 55%, var(--line)); }
.notes blockquote.q p { margin: 0; font-style: italic; }
.notes blockquote.q footer { font-family: var(--font-ui); font-size: .76em; color: var(--muted); margin-top: 3px; }
.notes blockquote.q-close { border-left-color: var(--warn); }
.notes blockquote.q-unverified { border-left-color: var(--bad); }
.notes .src { font-family: var(--font-ui); font-size: .68em; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent);
  vertical-align: 2px; white-space: nowrap; text-decoration: none; cursor: pointer; }
.notes a.src:hover { background: var(--accent); color: var(--on-accent); text-decoration: none; }
.notes .qflag { font-family: var(--font-ui); font-size: .95em; font-weight: 650; border-radius: 6px; padding: 1px 6px; margin-left: 4px; }
.notes .qclose { background: var(--warn-soft); color: var(--warn); }
.notes .qbad { background: var(--bad-soft); color: var(--bad); }
.notes .qocr { background: var(--surface-2); color: var(--muted); }
.notes .none { color: var(--muted); font-style: italic; }
.notes .check { list-style: none; padding-left: 0; }
.notes dl.terms { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 8px 18px; margin: 0; }
.notes dl.terms dt { font-weight: 700; }
.notes dl.terms dd { margin: 0; }
.notes figure { margin: 18px 0 22px; }
.notes figure img { display: block; background: #fff; border-radius: 12px; padding: 12px; border: 1px solid var(--line); margin: 0 auto; max-width: min(100%, 660px); max-height: 460px; cursor: zoom-in; }
.notes figcaption { font-family: var(--font-ui); font-size: .82em; color: var(--muted); margin-top: 8px; text-align: center; }
.notes ol.review > li { margin: .9em 0; }
.notes ol.review details summary { font-family: var(--font-ui); font-size: .8em; color: var(--accent); cursor: pointer; font-weight: 650; }
.notes .answer { color: var(--ink); background: var(--surface-2); border-radius: 10px; padding: 8px 12px; margin-top: 6px; }
.notes .banner { font-family: var(--font-ui); font-size: .85em; }
.notes h1, .notes h4 { font-family: var(--font-read); }
.notes .md h1 { font-size: 1.3em; margin: 26px 0 8px; }
.notes .md h2 { margin-top: 28px; }
.notes .md table { border-collapse: collapse; }
.notes .md td, .notes .md th { border: 1px solid var(--line); padding: 4px 8px; }
mark.hit { background: color-mix(in srgb, var(--warn) 30%, transparent); color: inherit; border-radius: 3px; }
.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { background: var(--accent-soft); } 100% { background: transparent; } }

.appx { margin: 46px 0 0; }
.appx > summary { cursor: pointer; font-weight: 700; padding: 12px 0; border-top: 1px solid var(--line); list-style: none; display: flex; align-items: center; gap: 8px; }
.appx > summary::-webkit-details-marker { display: none; }
.appx > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
.appx[open] > summary::before { transform: rotate(90deg); }
.appx .asrc { margin: 18px 0 28px; scroll-margin-top: calc(var(--topbar-h) + 12px); }
.appx .asrc h3 { font-size: 1em; margin-bottom: 4px; }
.appx .legend { font-size: .8em; color: var(--muted); margin: 0 0 10px; }
.appx .turn { font-family: var(--font-read); margin: 0 0 .7em; line-height: 1.6; }
.appx .turn b { font-family: var(--font-ui); font-size: .86em; }
.appx .turn .ts { font: 600 .72em var(--font-ui); color: var(--muted); border: 0; background: var(--surface-2); padding: 1px 6px; border-radius: 6px;
  cursor: pointer; margin-right: 6px; vertical-align: 1px; }
.appx .turn .ts:hover { background: var(--accent); color: var(--on-accent); }
.appx .doctext { font-family: var(--font-read); white-space: pre-wrap; line-height: 1.6; font-size: .96em; }
.appx img.photo { max-width: 100%; max-height: 520px; border-radius: 10px; border: 1px solid var(--line); display: block; margin: 8px 0 12px; }

/* drawer */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: min(400px, 100vw); background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: -18px 0 50px rgb(0 0 0 / .18); transform: translateX(105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  display: flex; flex-direction: column; visibility: hidden; }
.drawer.open { transform: none; visibility: visible; }
.session.pinned .drawer { position: sticky; top: calc(var(--topbar-h) + 14px); height: calc(100dvh - var(--topbar-h) - 28px); width: auto; transform: none;
  visibility: visible; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 1; }
.scrim { position: fixed; inset: 0; z-index: 45; background: rgb(0 0 0 / .28); opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.show { opacity: 1; pointer-events: auto; }
.session.pinned .scrim { display: none; }
.dr-h { display: flex; align-items: center; gap: 4px; padding: 10px 10px 0 14px; }
.dr-h .ttl { font-weight: 700; flex: 1; }
.dr-tabs { display: flex; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.dr-tabs button { border: 0; background: none; padding: 8px 11px; font-weight: 600; font-size: .88em; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.dr-tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.dr-b { flex: 1; overflow-y: auto; padding: 14px 16px calc(24px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.dr-b .blk + .blk { margin-top: 20px; }
.dr-b h4 { margin: 0 0 8px; font-size: .76em; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; font-size: .88em; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.spk { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.spk + .spk { margin-top: 10px; }
.spk .sh { display: flex; align-items: center; gap: 8px; }
.spk .sh input { flex: 1; min-height: 34px; }
.spk .share { font-size: .78em; color: var(--muted); white-space: nowrap; }
.spk .how { font-size: .76em; color: var(--muted); margin-top: 5px; }
.spk .sample { display: flex; gap: 8px; align-items: flex-start; font-size: .84em; margin-top: 6px; color: var(--ink); line-height: 1.4; }
.spk .sample button { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--accent-soft); color: var(--accent); cursor: pointer; font-size: 10px; }
.spk .sample button.playing { background: var(--accent); color: var(--on-accent); }
.logbox { font: .74em/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); border-radius: 10px; padding: 10px;
  white-space: pre-wrap; word-break: break-word; max-height: 60vh; overflow: auto; }
.qlist li { margin: 0 0 10px; font-size: .86em; }
.qlist .qq { font-style: italic; }
.dl-list { display: grid; gap: 6px; }

/* image zoom */
.zoom { position: fixed; inset: 0; z-index: 95; background: rgb(0 0 0 / .8); display: grid; place-items: center; padding: 20px; cursor: zoom-out; animation: fade .15s; }
.zoom img { max-width: 100%; max-height: 100%; background: #fff; border-radius: 10px; padding: 10px; }

/* ------------------------------------------------------------------ study chat */
.ask-btn { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); color: var(--accent); }
.ask-btn.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.chatpanel { display: none; }
.session.chatting { grid-template-columns: minmax(0, 1fr) 420px; gap: 26px; }
.session.chatting .smain { max-width: none; margin: 0; }
.session.chatting .pin-btn { display: none; }
.session.chatting .chatpanel { display: flex; flex-direction: column; position: sticky; top: calc(var(--topbar-h) + 14px);
  height: calc(100dvh - var(--topbar-h) - 28px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; animation: chatin .22s ease-out; }
@keyframes chatin { from { opacity: 0; transform: translateX(16px); } }
.ch-h { display: flex; align-items: center; gap: 2px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line); }
.ch-ttl { flex: 1; font-weight: 700; }
.ch-ctx { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.ch-ctx .chip { background: var(--surface); max-width: 100%; }
.ch-ctx .chip.acc { background: var(--accent-soft); }
.ch-ctx .x { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 0 0 2px; font-size: 1.1em; line-height: 1; }
.ch-msgs { flex: 1; overflow-y: auto; padding: 14px 14px 6px; overscroll-behavior: contain; }
.ch-empty { padding: 18px 4px; }
.ch-hi { font-weight: 650; font-size: 1.05em; }
.ch-sugg { display: flex; flex-wrap: wrap; gap: 6px; }
.ch-sugg .chip { cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 550; padding: 5px 10px; }
.ch-sugg .chip:hover { border-color: var(--accent); }
.msg { margin: 0 0 14px; display: flex; flex-direction: column; }
.msg.me { align-items: flex-end; }
.msg.me .bubble { background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: 14px 14px 4px 14px; max-width: 88%;
  word-break: break-word; font-size: .95em; }
.msg.ai .md { font-family: var(--font-read); font-size: .96em; line-height: 1.6; overflow-wrap: anywhere; }
.msg.ai .md p { margin: 0 0 .6em; }
.msg.ai .md h3, .msg.ai .md h4 { font-family: var(--font-ui); font-size: .92em; margin: .9em 0 .3em; }
.msg.ai .md ul, .msg.ai .md ol { margin: .2em 0 .7em; padding-left: 1.25em; }
.msg.ai .md li { margin: .2em 0; }
.msg.ai .md li.sub { margin-left: 1.1em; }
.msg.ai .md blockquote { margin: .4em 0 .8em; padding-left: 10px; border-left: 3px solid var(--line); font-style: italic; }
.msg.ai .md code { font-size: .88em; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
.msg.ai .md pre { background: var(--surface-2); padding: 10px; border-radius: 8px; overflow-x: auto; }
.msg.ai .md .tbl { overflow-x: auto; margin: .4em 0 .8em; }
.msg.ai .md table { border-collapse: collapse; font-size: .9em; }
.msg.ai .md th, .msg.ai .md td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; }
.msg.ai .md th { background: var(--surface-2); font-family: var(--font-ui); }
.cite { font: 700 .68em var(--font-ui); padding: 1px 5px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); cursor: pointer;
  vertical-align: 2px; white-space: nowrap; text-decoration: none !important; }
.cite:hover { background: var(--accent); color: var(--on-accent); }
.msg-tools { display: flex; gap: 10px; align-items: center; margin-top: 2px; opacity: .75; }
.ch-sep { text-align: center; font-size: .74em; color: var(--muted); margin: 4px 0 14px; display: flex; align-items: center; gap: 8px; }
.ch-sep::before, .ch-sep::after { content: ""; flex: 1; border-top: 1px dashed var(--line); }
.typing { display: flex; align-items: center; gap: 4px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.ch-edits { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 6px; }
.ch-edit { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--surface-2); }
.ch-edit.applied { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.ch-edit.dismissed { opacity: .6; }
.ch-edit .diff { font-size: .88em; margin-top: 4px; }
.ch-edit del { display: block; background: var(--bad-soft); text-decoration: line-through; padding: 2px 6px; border-radius: 5px; margin-bottom: 3px; }
.ch-edit ins { display: block; background: var(--ok-soft); text-decoration: none; padding: 2px 6px; border-radius: 5px; }
.ch-in { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px 6px; border-top: 1px solid var(--line); }
.ch-in textarea { min-height: 42px; max-height: 180px; resize: none; border-radius: 12px; }
.ch-send { min-width: 44px; min-height: 42px; border-radius: 12px; padding: 0; font-size: 1.05em; }
.ch-foot { display: flex; gap: 6px; flex-wrap: wrap; font-size: .72em; color: var(--muted); padding: 0 14px 8px; }
.pk-list { max-height: 52vh; overflow-y: auto; }
.pk-course { font-size: .74em; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 12px 0 4px; }
.pk-row { display: flex; gap: 10px; align-items: center; padding: 7px 4px; border-radius: 8px; cursor: pointer; min-width: 0; }
.pk-row:hover { background: var(--surface-2); }
@media (max-width: 1180px) and (min-width: 981px) { .session.chatting { grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; } }
@media (max-width: 980px) {
  .session.chatting { grid-template-columns: minmax(0, 1fr); }
  .session.chatting .chatpanel { position: fixed; top: 0; right: 0; bottom: 0; left: auto; width: min(460px, 100vw); height: auto; z-index: 55;
    border-radius: 0; border: 0; border-left: 1px solid var(--line); box-shadow: -18px 0 50px rgb(0 0 0 / .2);
    padding-bottom: env(safe-area-inset-bottom); }
  .ch-h { padding-top: max(8px, env(safe-area-inset-top)); }
}
@media (max-width: 760px) {
  body.chat-open { overflow: hidden; }
  .session.chatting .chatpanel { width: 100vw; height: 100dvh; bottom: auto; }
  .ch-in textarea { font-size: 16px; }   /* no zoom-on-focus on iPhone */
  .msg.me .bubble { max-width: 92%; }
}
@media print { .chatpanel { display: none !important; } }

/* ------------------------------------------------------------------ settings */
.settings { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; align-items: start; }
.snav { position: sticky; top: calc(var(--topbar-h) + 18px); display: flex; flex-direction: column; gap: 2px; }
.snav a { padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: .92em; }
.snav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.snav a.on { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.ssec { scroll-margin-top: calc(var(--topbar-h) + 16px); }
.ssec + .ssec { margin-top: 18px; }
.ssec > h2 { font-size: 1.15em; margin-bottom: 4px; }
.ssec > .lead { color: var(--muted); font-size: .9em; margin: 0 0 14px; }
.ssec hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.saved-ind { font-size: .8em; color: var(--ok); opacity: 0; transition: opacity .3s; }
.saved-ind.show { opacity: 1; }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.theme-card { border: 2px solid transparent; border-radius: 14px; padding: 0; background: none; cursor: pointer; text-align: left; color: var(--ink);
  display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; }
.theme-card .sample { border-radius: 12px; padding: 14px 14px 12px; height: 104px; border: 1px solid var(--line); overflow: hidden; }
.theme-card .sample b { display: block; font-size: 1.35em; font-weight: 700; }
.theme-card .sample .ln { height: 5px; border-radius: 3px; margin-top: 7px; opacity: .55; }
.theme-card .sample .acc { display: inline-block; width: 36px; height: 8px; border-radius: 4px; margin-top: 10px; }
.theme-card .tn { display: block; font-size: .86em; font-weight: 650; padding: 6px 4px 2px; }
.theme-card.on { border-color: var(--accent); }
.diy { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-top: 16px; }
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row + .color-row { margin-top: 10px; }
.color-row label { flex: 1; font-weight: 600; font-size: .9em; }
.color-row input[type=text] { width: 96px; font-family: ui-monospace, Menlo, monospace; font-size: .86em; min-height: 36px; }
.live { border-radius: 14px; border: 1px solid var(--line); padding: 16px; }
.clist { display: flex; flex-direction: column; }
.crow { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-top: 1px solid var(--line); }
.crow:first-child { border-top: 0; }
.steps { margin: 8px 0 0; padding-left: 1.3em; }
.steps li { margin: 0 0 10px; font-size: .92em; }
.steps code, .ssec code { font-size: .86em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 980px) {
  .compose { grid-template-columns: minmax(0, 1fr); }
  .session.pinned { grid-template-columns: minmax(0, 1fr); }
  .session.pinned .drawer { position: fixed; top: 0; height: auto; border-radius: 0; box-shadow: -18px 0 50px rgb(0 0 0 / .18); transform: translateX(105%); visibility: hidden; z-index: 50; }
  .session.pinned .drawer.open { transform: none; visibility: visible; }
  .session.pinned .scrim { display: block; }
  .pin-btn { display: none !important; }
  .settings { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .snav { position: sticky; top: var(--topbar-h); z-index: 5; flex-direction: row; overflow-x: auto; background: var(--bg); padding: 8px 0; margin: -8px 0 0; scrollbar-width: none; }
  .snav a { white-space: nowrap; }
}
@media (max-width: 760px) {
  :root { --topbar-h: 54px; }
  .topbar { gap: 10px; }
  .tabs { display: none; }
  .bottombar { display: flex; }
  .view { padding: 16px 14px calc(var(--bottombar-h) + 34px + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 1.45em; }
  .addbar { grid-template-columns: repeat(6, 1fr); gap: 8px; }
  .addbtn { min-height: 70px; grid-column: span 2; font-size: .84em; }
  .addbtn:nth-child(n+4) { grid-column: span 3; flex-direction: row; min-height: 50px; gap: 8px; }
  .addbtn:nth-child(n+4) .ic { font-size: 1.35em; }
  .addbtn small { display: none; }
  .ntop .crumbs { flex-wrap: nowrap; overflow: hidden; }
  .ntop .crumbs a:first-child, .ntop .crumbs .sep:first-of-type { display: none; }
  .detect, .grid2, .grid3, .diy { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .finder { height: calc(100dvh - var(--topbar-h) - var(--bottombar-h) - 170px); min-height: 340px; }
  .fcol, .fcol.first { flex-basis: 100cqw; border-right: 0; }
  .fcol-h .back { display: inline-grid; }
  .ftrack { transform: translateX(calc(var(--shift-m, 0) * -100cqw)); }
  .phone-only { display: block; }
  .drawer { width: 100vw; }
  .toast { bottom: calc(var(--bottombar-h) + 18px + env(safe-area-inset-bottom)); }
  .notes { font-size: calc(var(--fs) * 1.02); }
  .notes dl.terms { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .notes dl.terms dd { margin-bottom: 10px; }
  .queue-pill .qp-text, .hide-sm { display: none; }
  .queue-pill { padding: 7px 10px; }
  .brand span:last-child { display: none; }
  .ptile, .ptile .face { width: 96px; }
  .ptile .face { height: 96px; font-size: 42px; border-radius: 22px; }
  .ptile .face.emoji { font-size: 48px; }
  .ptile .edit-badge { border-radius: 22px; }
  .picker .tiles { gap: 16px; }
  dialog.dlg { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  dialog.dlg[open] { animation: sheet .22s ease-out; }
  .dlg-f .btn { flex: 1; }
  .dlg-f .left { flex: 0 0 100%; order: 3; }
}
@keyframes sheet { from { transform: translateY(40%); opacity: .4; } }
@media (hover: none) { .btn, .icon-btn, .fitem, .addbtn { -webkit-tap-highlight-color: transparent; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media print {
  .topbar, .bottombar, .drawer, .scrim, .ntop, .statuscard, .appx > summary { display: none !important; }
  .view { padding: 0; max-width: none; }
  .appx { display: block; }
}
