/* PaperSwipe — style A "Clean Utility", light + dark */

:root {
  --bg: #F2F4F7;
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --press: #EAECF0;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --faint: #98A2B3;
  --line: #E4E7EC;
  --accent: #2563EB;
  --accent-ink: #FFFFFF;
  --accent-soft: #EEF4FF;
  --ok: #079455;
  --ok-soft: #ECFDF3;
  --no: #D92D20;
  --no-soft: #FEF3F2;
  --hl: rgba(250, 204, 21, .38);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  --scrim: rgba(16, 24, 40, .4);
  --radius: 14px;
  --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C111D; --surface: #161B26; --surface-2: #1B212D; --press: #232A37;
    --ink: #F5F5F6; --ink-2: #CECFD2; --muted: #94969C; --faint: #61646C; --line: #2A303C;
    --accent: #5B8DEF; --accent-ink: #0C111D; --accent-soft: #1A2540;
    --ok: #47CD89; --ok-soft: #0F2A1D; --no: #F97066; --no-soft: #2F1614;
    --hl: rgba(250, 204, 21, .32);
    --shadow-sm: none; --shadow: 0 1px 0 rgba(255,255,255,.03); --shadow-lg: 0 16px 40px rgba(0,0,0,.5);
    --scrim: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C111D; --surface: #161B26; --surface-2: #1B212D; --press: #232A37;
  --ink: #F5F5F6; --ink-2: #CECFD2; --muted: #94969C; --faint: #61646C; --line: #2A303C;
  --accent: #5B8DEF; --accent-ink: #0C111D; --accent-soft: #1A2540;
  --ok: #47CD89; --ok-soft: #0F2A1D; --no: #F97066; --no-soft: #2F1614;
  --hl: rgba(250, 204, 21, .32);
  --shadow-sm: none; --shadow: 0 1px 0 rgba(255,255,255,.03); --shadow-lg: 0 16px 40px rgba(0,0,0,.5);
  --scrim: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg.i { width: 20px; height: 20px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- layout ---------- */
.screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; }
.screen.full { max-width: none; height: 100%; }
.topbar {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--top) + 12px) 16px 12px;
}
.topbar .title { flex: 1; min-width: 0; font-weight: 800; font-size: 20px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title.sm { font-size: 17px; }
.content { flex: 1; padding: 4px 16px 24px; display: flex; flex-direction: column; gap: 12px; }

.iconbtn {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: var(--surface); color: var(--ink-2); box-shadow: var(--shadow-sm); flex: 0 0 auto;
}
.iconbtn:active { background: var(--press); }
.iconbtn.plain { background: none; box-shadow: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 18px; border-radius: 12px; font-weight: 700; font-size: 15px;
  background: var(--surface); color: var(--ink-2); box-shadow: var(--shadow-sm); border: 1px solid var(--line);
  text-decoration: none;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.danger { color: var(--no); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:not(:disabled):active { transform: translateY(1px); }
.linkbtn { color: var(--accent); font-weight: 700; }

.bottombar {
  position: sticky; bottom: 0; z-index: 5; display: flex; gap: 10px;
  padding: 12px 16px calc(var(--bottom) + 14px);
  background: linear-gradient(transparent, var(--bg) 30%);
}
.bottombar .btn { flex: 1; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.input {
  height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  padding: 0 14px; font-size: 16px; width: 100%;
}
textarea.input { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-error { color: var(--no); font-size: 14px; font-weight: 600; }
.hint { color: var(--muted); font-size: 13.5px; }

/* ---------- auth ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: calc(var(--top) + 24px) 20px calc(var(--bottom) + 24px); }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; letter-spacing: -.02em; margin-bottom: 8px; }
.brand img { width: 36px; height: 36px; }
.auth h1 { font-size: 26px; letter-spacing: -.02em; margin: 0; line-height: 1.2; }
.auth p { margin: 0; color: var(--muted); }
.seg { display: flex; background: var(--press); padding: 3px; border-radius: 11px; gap: 2px; }
.seg button { flex: 1; height: 34px; border-radius: 9px; font-size: 13.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--surface); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-sm);
  min-height: 56px;
}
.row:active { background: var(--press); }
.row .t { flex: 1; min-width: 0; font-weight: 700; font-size: 14.5px; line-height: 1.35; overflow-wrap: anywhere; }
.row .chev { color: var(--faint); }
.row .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.row.ghost { opacity: .65; }
.row .err { color: var(--no); }
.empty { text-align: center; color: var(--muted); padding: 48px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty .big { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--surface); color: var(--faint); box-shadow: var(--shadow-sm); }
.empty .big svg.i { width: 26px; height: 26px; }
.empty b { color: var(--ink); font-size: 17px; }

.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: 0 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* add bar */
.addbar {
  display: flex; align-items: center; gap: 10px; background: var(--surface);
  border: 1.5px dashed var(--faint); border-radius: var(--radius); padding: 4px 6px 4px 14px;
}
.addbar:focus-within { border-style: solid; border-color: var(--accent); }
.addbar .plus { color: var(--accent); }
.addbar input { flex: 1; min-width: 0; border: 0; background: none; height: 44px; font-size: 16px; outline: none; }
.addbar input::placeholder { color: var(--muted); }
.addbar .kbd { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--bg); padding: 3px 7px; border-radius: 6px; }
body.dragging .addbar { border-color: var(--accent); background: var(--accent-soft); }
@media (hover: none) { .addbar .kbd { display: none; } }

/* ---------- review ---------- */
.review { height: 100vh; height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; overflow: hidden; }
.progress { height: 4px; border-radius: 99px; background: var(--line); margin: 0 16px; overflow: hidden; flex: 0 0 auto; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.deck { flex: 1; position: relative; margin: 16px 16px 0; min-height: 0; }
.card {
  position: absolute; inset: 0; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none;
  will-change: transform;
}
.card.next { transform: translateY(10px) scale(.96); opacity: .7; pointer-events: none; }
.card.back2 { transform: translateY(20px) scale(.92); opacity: .4; pointer-events: none; }
.card .scroll { flex: 1; overflow-y: auto; padding: 24px 22px 12px; -webkit-overflow-scrolling: touch; }
.card h2 { margin: 0; font-size: 21px; line-height: 1.25; font-weight: 800; letter-spacing: -.02em; text-wrap: balance; }
.card .desc { margin: 10px 0 0; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.card .secs { margin-top: 18px; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.card details { border-bottom: 1px solid var(--line); }
.card summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 2px; font-weight: 700; font-size: 14px; color: var(--ink); cursor: pointer;
}
.card summary::-webkit-details-marker { display: none; }
.card summary svg.i { width: 18px; height: 18px; color: var(--faint); transition: transform .2s; }
.card details[open] summary svg.i { transform: rotate(180deg); }
.card details .body { padding: 0 2px 16px; color: var(--ink-2); font-size: 14px; line-height: 1.55; user-select: text; -webkit-user-select: text; }
.card details ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.card .pending { margin-top: 18px; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13.5px; }
.card .openpdf {
  margin: 0 16px 16px; height: 46px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; color: var(--accent); flex: 0 0 auto;
}
.card .stamp {
  position: absolute; top: 22px; padding: 6px 12px; border-radius: 10px; font-weight: 800; font-size: 15px;
  letter-spacing: .06em; opacity: 0; pointer-events: none; border: 2.5px solid;
}
.card .stamp.ok { left: 20px; color: var(--ok); transform: rotate(-12deg); background: var(--ok-soft); }
.card .stamp.no { right: 20px; color: var(--no); transform: rotate(12deg); background: var(--no-soft); }
.card.fly { transition: transform .32s ease-in, opacity .32s ease-in; }
.card.snap { transition: transform .25s cubic-bezier(.2,.9,.3,1.2); }

.actions { display: flex; justify-content: center; align-items: center; gap: 28px; padding: 18px 0 calc(var(--bottom) + 20px); flex: 0 0 auto; }
.act {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line);
}
.act svg.i { width: 28px; height: 28px; stroke-width: 2.6; }
.act.no { color: var(--no); }
.act.ok { color: var(--ok); }
.act.sm { width: 46px; height: 46px; color: var(--muted); }
.act.sm svg.i { width: 20px; height: 20px; stroke-width: 2.2; }
.act:disabled { opacity: .35; cursor: default; }
.act:not(:disabled):active { transform: scale(.94); }
.act.no:not(:disabled):hover { background: var(--no-soft); }
.act.ok:not(:disabled):hover { background: var(--ok-soft); }

.done { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px; }
.done .big { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); }
.done .big svg.i { width: 34px; height: 34px; stroke-width: 2.6; }
.done h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.done p { margin: 0; color: var(--muted); }
.done .btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }

/* ---------- pdf view ---------- */
.pdfview { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.pdfview .topbar { border-bottom: 1px solid var(--line); }
.pdfbody { flex: 1; display: flex; min-height: 0; position: relative; }
.pages { flex: 1; min-width: 0; overflow: auto; touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; }
.pages-inner {
  display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 16px 12px 120px;
  width: max-content; min-width: 100%; transform-origin: 0 0; will-change: transform;
}
.page {
  position: relative; background: #fff; box-shadow: var(--shadow); border-radius: 4px; overflow: hidden; flex: 0 0 auto;
  --user-unit: 1; --scale-round-x: 1px; --scale-round-y: 1px; isolation: isolate;
}
.page canvas { display: block; width: 100%; height: 100%; }
.page .hls { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.page .hlc { position: absolute; inset: 0; mix-blend-mode: multiply; }
.page .hlc i { position: absolute; background: var(--c); }
.page .cms { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.page .cms i { position: absolute; border-bottom: 2px solid #2563EB; }
.page .num { position: absolute; bottom: 6px; right: 8px; font-size: 11px; color: #98A2B3; z-index: 3; pointer-events: none; }
.pdf-loading { padding: 60px 0; display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--muted); }
.zoom { display: flex; gap: 6px; }
@media (hover: none) { .zoom { display: none; } }

.pdfbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; justify-content: center; gap: 12px;
  padding: 12px 16px calc(var(--bottom) + 14px); pointer-events: none;
}
.pdfbar > * { pointer-events: auto; }
.pdfbar .pill { display: flex; gap: 8px; align-items: center; background: var(--surface); border-radius: 99px; padding: 6px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.pdfbar .act { width: 52px; height: 52px; box-shadow: none; border: 0; }
.pdfbar .act.on.ok { background: var(--ok-soft); }
.pdfbar .act.on.no { background: var(--no-soft); }
.pdfbar .status { font-size: 13px; font-weight: 700; color: var(--muted); padding: 0 8px; }

.selpop {
  position: fixed; z-index: 30; display: flex; gap: 2px; background: var(--ink); color: var(--bg);
  border-radius: 10px; padding: 4px; box-shadow: var(--shadow-lg);
}
.selpop { align-items: center; }
.selpop .dot { width: 28px; height: 28px; padding: 0; margin: 0 3px; border-radius: 50%; background: var(--c); border: 2px solid rgba(255,255,255,.85); }
.selpop .sep { width: 1px; align-self: stretch; margin: 4px 4px; background: rgba(127,127,127,.4); }
.selpop button:not(.dot) { padding: 8px 12px; border-radius: 7px; font-weight: 700; font-size: 13.5px; display: flex; gap: 6px; align-items: center; }
.selpop button:active { background: rgba(127,127,127,.3); }
.selpop svg.i { width: 16px; height: 16px; }

/* pdf.js text layer (from pdf_viewer.css, trimmed) */
.textLayer {
  position: absolute; text-align: initial; inset: 0; overflow: clip; opacity: 1; line-height: 1;
  -webkit-text-size-adjust: none; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; z-index: 1;
  --min-font-size: 1;
  --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size));
  --min-font-size-inv: calc(1 / var(--min-font-size));
}
.textLayer { -webkit-touch-callout: none; }
.textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; user-select: text; -webkit-user-select: text; }
.textLayer > :not(.markedContent), .textLayer .markedContent span:not(.markedContent) {
  z-index: 1; --font-height: 0; font-size: calc(var(--text-scale-factor) * var(--font-height));
  --scale-x: 1; --rotate: 0deg;
  transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));
}
.textLayer .markedContent { display: contents; }
.textLayer ::selection { background: rgba(37, 99, 235, .28); color: transparent; }
.textLayer br::selection { background: transparent; }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; user-select: none; -webkit-user-select: none; }
.textLayer.selecting .endOfContent { top: 0; }

/* ---------- sheets, dialogs, toasts ---------- */
#overlay { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity .2s; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px; max-height: 88%;
  background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg);
  padding: 8px 18px calc(var(--bottom) + 18px); overflow-y: auto; pointer-events: auto;
  transform: translateY(100%); transition: transform .25s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column; gap: 14px;
}
.sheet .grab { width: 38px; height: 5px; border-radius: 99px; background: var(--line); margin: 2px auto 4px; flex: 0 0 auto; }
.sheet h3 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.sheet p { margin: 0; color: var(--muted); }
.open .scrim { opacity: 1; }
.open .sheet { transform: none; }
@media (min-width: 700px) {
  .sheet { bottom: auto; top: 50%; border-radius: 20px; transform: translateY(-40%) scale(.98); opacity: 0; transition: transform .2s, opacity .2s; padding-bottom: 20px; width: calc(100% - 32px); }
  .open .sheet { transform: translateY(-50%); opacity: 1; }
}
.menu { display: flex; flex-direction: column; }
.menu button, .menu a {
  display: flex; color: inherit; text-decoration: none; align-items: center; gap: 14px; padding: 14px 4px; text-align: left; font-weight: 600; font-size: 15px;
  border-bottom: 1px solid var(--line);
}
.menu > :last-child { border-bottom: 0; }
.menu svg.i { color: var(--muted); }
.menu button.danger, .menu button.danger svg.i { color: var(--no); }
.copyrow { display: flex; gap: 8px; }
.copyrow .input { font-size: 14px; }
.members { display: flex; flex-direction: column; gap: 2px; }
.members .m { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 14.5px; }
.members .m span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.members .m small { color: var(--muted); font-weight: 600; }
.quote { border-left: 4px solid var(--c, #FFF176); padding: 4px 0 4px 12px; color: var(--ink-2); font-size: 14px; max-height: 140px; overflow: auto; }
.hl-list { display: flex; flex-direction: column; gap: 8px; }
.hl-list button { text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.hl-list .q { font-size: 13.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hl-list .n { font-size: 13px; color: var(--ink); font-weight: 600; }
.hl-list .p { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.row2 { display: flex; gap: 10px; }
.row2 .btn { flex: 1; min-width: 0; padding: 0 10px; }

#toasts {
  position: fixed; left: 0; right: 0; bottom: calc(var(--bottom) + 96px); z-index: 50; display: flex; flex-direction: column;
  align-items: center; gap: 8px; pointer-events: none; padding: 0 16px;
}
.toast {
  background: var(--ink); color: var(--bg); border-radius: 12px; padding: 11px 14px; font-weight: 600; font-size: 14px;
  display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-lg); pointer-events: auto; max-width: 480px;
  animation: toastin .2s ease-out;
}
.toast.err { background: var(--no); color: #fff; }
.toast button { font-weight: 800; color: inherit; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }

.settings section { background: var(--surface); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-sm); }
.settings h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.settings .me { font-weight: 700; overflow-wrap: anywhere; display: flex; flex-direction: column; }
.settings .me small { font-weight: 500; color: var(--muted); font-size: 13.5px; }

.usage { display: flex; flex-direction: column; gap: 10px; }
.usage .bar { height: 10px; border-radius: 99px; background: var(--press); overflow: hidden; }
.usage .bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .4s; }
.usage.warn .bar i { background: #F79009; }
.usage.full .bar i { background: var(--no); }
.usage-text b { color: var(--ink); }

.center-load { flex: 1; display: grid; place-items: center; padding: 60px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}

/* marker colour picker */
.colors { display: flex; gap: 12px; }
.dot { border-radius: 50%; background: var(--c); border: 2px solid var(--line); }
.dot.lg { width: 38px; height: 38px; }
.dot.on { outline: 3px solid var(--accent); outline-offset: 2px; }

/* comments panel */
.badge-btn { position: relative; }
.badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #2563EB; color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.cpanel {
  width: 340px; flex: 0 0 auto; background: var(--surface); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
@media (max-width: 899px) {
  .cpanel { position: absolute; top: 0; right: 0; bottom: 0; width: min(88vw, 360px); z-index: 8; box-shadow: var(--shadow-lg); border-left: 0; }
}
.cp-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--line); }
.cp-scroll { flex: 1; overflow-y: auto; padding: 12px 12px calc(var(--bottom) + 110px); display: flex; flex-direction: column; gap: 10px; }
.cp-empty { padding: 8px 4px; }
.cmt { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.cmt.focus { border-color: #2563EB; box-shadow: 0 0 0 2px rgba(37, 99, 235, .15); }
.cmt.draft { cursor: default; border-color: #2563EB; }
.cmt .meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.cmt .meta b { color: var(--ink); }
.cmt .q { font-size: 12.5px; color: var(--muted); border-left: 2px solid #2563EB; padding-left: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cmt .body { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cmt .acts { display: flex; gap: 14px; font-size: 13px; }
.linkbtn.danger { color: var(--no); }
.cp-notes { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.cp-notes label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.other-note { font-size: 13.5px; }
.other-note p { margin: 2px 0 0; color: var(--ink-2); white-space: pre-wrap; }

/* collaborators */
.members { display: flex; flex-direction: column; }
.member { display: flex; align-items: center; gap: 12px; padding: 10px 2px; text-align: left; border-bottom: 1px solid var(--line); }
.member:last-child { border-bottom: 0; }
.member[disabled] { cursor: default; opacity: 1; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; flex: 0 0 auto; }
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.who b { font-size: 14.5px; }
.who small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 11.5px; font-weight: 800; color: var(--accent); background: var(--accent-soft); padding: 3px 8px; border-radius: 99px; }
.member .chev { color: var(--faint); }

/* permission switches */
.perm-list { display: flex; flex-direction: column; }
.perm { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.perm:last-child { border-bottom: 0; }
.perm > span:first-child { flex: 1; display: flex; flex-direction: column; }
.perm b { font-size: 14.5px; font-weight: 600; }
.perm small { color: var(--muted); font-size: 12.5px; }
.perm.fixed { cursor: default; opacity: .6; }
.switch { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 99px; background: var(--press); position: relative; flex: 0 0 auto; cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch:checked, .switch.on { background: var(--ok); }
.switch:checked::after, .switch.on::after { transform: translateX(18px); }

/* add-to-home-screen instructions */
.install-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.install-steps li { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: center; }
.install-steps .st { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.install-steps .n { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 12px; display: grid; place-items: center; flex: 0 0 auto; }
.install-steps p { margin: 4px 0 0; font-size: 13.5px; }
.ill-wrap { background: var(--bg); border-radius: 12px; padding: 12px; display: grid; place-items: center; min-height: 92px; }
.ill { width: 100%; font-size: 11px; color: var(--ink-2); }
.ill .hot { color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent); border-radius: 7px; }
.ill svg.i { width: 16px; height: 16px; }
.ill.bar { display: flex; justify-content: space-around; align-items: center; background: var(--surface); border-radius: 10px; padding: 8px 4px; font-size: 14px; }
.ill.bar span { display: grid; place-items: center; min-width: 24px; min-height: 24px; }
.ill.bar.top { justify-content: space-between; gap: 6px; padding: 6px 8px; }
.ill.bar .url { flex: 1; justify-content: start; background: var(--bg); border-radius: 6px; padding: 3px 6px; font-size: 10px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ill.list { background: var(--surface); border-radius: 10px; overflow: hidden; }
.ill.list div { padding: 6px 8px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.ill.list div:last-child { border-bottom: 0; }
.ill.list .hot { border-radius: 0; font-weight: 700; }
.ill.confirm { background: var(--surface); border-radius: 10px; overflow: hidden; }
.ill.confirm .hdr { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--line); gap: 4px; }
.ill.confirm .hdr b { font-size: 9.5px; }
.ill.confirm .hdr span { color: var(--accent); }
.ill.confirm .hdr .hot { padding: 1px 6px; font-weight: 700; }
.ill.confirm .app { display: flex; align-items: center; gap: 8px; padding: 8px; font-weight: 700; }
.ill.confirm img { width: 26px; height: 26px; border-radius: 6px; }
.ill.menubar { display: flex; gap: 10px; align-items: center; background: var(--surface); border-radius: 8px; padding: 6px 10px; font-size: 12px; }
.ill.menubar b { width: 12px; height: 14px; background: var(--ink); border-radius: 50% 50% 45% 45%; }
.ill.menubar .hot { padding: 1px 6px; font-weight: 700; }
@media (max-width: 420px) { .install-steps li { grid-template-columns: 1fr; } }

/* approved rows with an APA button */
.row.split { padding: 0 6px 0 0; gap: 4px; }
.row.split:active { background: var(--surface); }
.row-main { flex: 1; min-width: 0; display: flex; align-items: center; text-align: left; padding: 14px; min-height: 56px; border-radius: var(--radius); }
.row-main:active { background: var(--press); }

/* APA sheet */
.cite-body { display: flex; flex-direction: column; gap: 12px; }
.cite { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.cite .lbl { grid-column: 1 / -1; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cite .txt { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
.cite .btn { height: 38px; padding: 0 14px; }
.cite-body > .linkbtn { align-self: flex-start; }
.cite-form { display: flex; flex-direction: column; gap: 10px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.row3 .input { min-width: 0; }

/* activity */
.activity { display: flex; flex-direction: column; }
.activity .day { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 0 6px; }
.activity .day:first-child { padding-top: 0; }
.activity .ev { display: flex; gap: 12px; justify-content: space-between; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 1.45; }
.activity .ev span { color: var(--ink-2); overflow-wrap: anywhere; }
.activity .ev b { color: var(--ink); font-weight: 700; }
.activity time { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; flex: 0 0 auto; }

.build { text-align: center; color: var(--faint); font-size: 12px; margin: 4px 0 0; }
.build .linkbtn { font-size: 12px; }
