/* Electron — compact light-gray mail client */

/* DM Sans, self-hosted (no third-party requests, GDPR-friendly) */
@font-face { font-family: "DM Sans"; font-style: normal; font-display: swap; font-weight: 100 1000; src: url(../fonts/dm-sans-latin-ext-wght-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "DM Sans"; font-style: normal; font-display: swap; font-weight: 100 1000; src: url(../fonts/dm-sans-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }


:root {
  /* added to every UI font size; bumped on mobile. Not applied to .editor (outgoing mail) or email bodies (iframes). */
  --fs-up: 0px;
  --canvas: #f2f3f5;
  --list: #fcfcfc;
  /* unread rows in the message list (not the sidebar pills, see --unread-bg below) */
  --unread-item-bg: #f4f8ff;
  --unread-item-edge: #dbe4f7;
  --paper: #ffffff;
  --hover: rgba(23, 25, 30, .045);
  --press: rgba(23, 25, 30, .08);
  --line: #e4e6ea;
  --line-strong: #d5d8de;
  --ink: #17191e;
  --ink-2: #27292f;
  --muted: #697080;
  --faint: #9aa0ac;
  /* accent: users override --charge (profile); everything else derives from it so pale or black accents stay legible */
  --charge: #f7f7f7;
  --charge-ink: oklch(from var(--charge) min(l, .44) min(calc(c * 1.3), .2) h);          /* text/links on white */
  --charge-soft: oklch(from var(--charge) max(l, .94) min(c, .05) h);
  --charge-softer: oklch(from var(--charge) max(l, .975) min(c, .025) h);
  --on-charge: oklch(from var(--charge) clamp(0, calc((.68 - l) * 1000), 1) 0 0);   /* black or white text on the accent */
  --charge-hover: color-mix(in oklab, var(--charge) 86%, var(--on-charge));
  --charge-edge: oklch(from var(--charge) min(l, .86) c h);    /* borders: still visible when the accent is near-white */
  --charge-mark: oklch(from var(--charge) min(l, .62) c h);    /* small dots and indicators on light backgrounds */
  /* brand pastel gradient (logo ring, send button border); the end stops are set per use so they can brighten on hover */
  --brand-ring-mid: #b2f7ef, #eff7f6, #f7d6e0, #f2b5d4;
  --danger: #d93b3b;
  --danger-soft: #fdeeee;
  --ok: #1f9d55;
  --warn: #c98a07;
  --brand-blue: #b2f7ef;
  /* sidebar count pills: unread in light blue, read/total in light grey; text is a deep shade of each */
  --unread-bg: #e0ebff;
  --unread-ink: oklch(from var(--unread-bg) .45 calc(c * 4.5) h);
  --read-bg: #e4e4e4;
  --read-ink: oklch(from var(--read-bg) .46 0 0);
  /* comments: tints of the brand light blue */
  --comment-base: var(--unread-bg);
  --comment: color-mix(in oklab, var(--comment-base) 55%, white);
  --comment-softer: color-mix(in oklab, var(--comment-base) 22%, white);
  --comment-ring: var(--comment-base);
  --comment-line: oklch(from var(--comment-base) .86 calc(c * 1.6) h);
  --radius-s: 5px;
  --radius: 7px;
  --radius-l: 10px;
  --shadow-pop: 0 1px 2px rgba(15, 18, 25, .06), 0 8px 28px rgba(15, 18, 25, .12);
  --shadow-card: 0 1px 1px rgba(15, 18, 25, .03), 0 1px 3px rgba(15, 18, 25, .05);
  --font: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --sidebar-w: 232px;
  --list-w: 352px;
  --rail-w: 44px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: calc(13px + var(--fs-up));
  line-height: 1.45;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  font-optical-sizing: auto;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--charge-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
[x-cloak] { display: none !important; }
:focus-visible { outline: 2px solid var(--charge-ink); outline-offset: 1px; border-radius: 4px; }
::selection { background: oklch(from var(--charge) clamp(.84, l, .9) min(c, .1) h); }

.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 14px; height: 14px; }
.i.xs { width: 12px; height: 12px; }
.i.lg { width: 18px; height: 18px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ───────── layout ───────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) var(--list-w) minmax(0, 1fr) var(--rail-w);
  height: 100vh;
  overflow: hidden;
}
.app.no-sidebar { grid-template-columns: 0 var(--list-w) minmax(0, 1fr) var(--rail-w); }
.app.no-sidebar .sidebar { visibility: hidden; }

/* Drag-to-resize handles on the sidebar and list pane right edges; the grey line shows on hover and while dragging */
.sidebar, .listpane { position: relative; }
.sidebar-scrim { display: none; }   /* mobile: frosts the list behind the open sidebar; tap it to close */
.pane-resize { position: absolute; top: 0; bottom: 0; right: -4px; width: 7px; z-index: 5; cursor: col-resize; touch-action: none; }
.pane-resize::after { content: ""; position: absolute; top: 0; bottom: 0; left: 2px; width: 3px; background: transparent; transition: background .15s; }
.pane-resize:hover::after { background: var(--line-strong); transition-delay: .12s; }
.pane-resize.is-dragging::after { background: var(--faint); transition-delay: 0s; }
body.is-resizing-pane { cursor: col-resize !important; user-select: none; -webkit-user-select: none; }
body.is-resizing-pane iframe { pointer-events: none; }

/* ───────── sidebar ───────── */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--canvas);
  border-right: 1px solid var(--line);
}
.side-top { display: flex; align-items: center; gap: 4px; padding: 10px 10px 6px 12px; }
.brand { display: flex; align-items: center; gap: 5px; font-size: calc(15px + var(--fs-up)); margin-right: auto; --logo-size: 21px; }

/* ───────── logo ─────────
   Frosted glass core over a rotating pastel conic ring (the send button's palette) with a blurred, breathing halo
   underneath and a glint sweeping the glass. The mark is sized by its own --logo-size; everything inside is in em.
   .logo--intro: pop/draw-on/wipe on load (auth pages always, the app once per tab).
   :hover / .is-busy: a second "boost" angle is un-paused on top of the idle spin, so it speeds up 3x and slows back
   down without the gradient snapping; the square also softens towards a circle. */
@property --logo-angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@property --logo-boost { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@property --logo-reveal { syntax: "<angle>"; initial-value: 400deg; inherits: false; }
@property --logo-core-r { syntax: "<length>"; initial-value: .161em; inherits: true; }
@property --logo-c1 { syntax: "<color>"; initial-value: #97e1ef; inherits: true; }
@property --logo-c6 { syntax: "<color>"; initial-value: #96e1ef; inherits: true; }
.logo {
  --logo-c1: #97e1ef; --logo-c6: #96e1ef;
  transition: --logo-c1 .4s ease, --logo-c6 .4s ease;
}
.logo:hover, .logo.is-busy { --logo-c1: #7bdff2; --logo-c6: #7bdff2; }
.logo-mark {
  position: relative;
  flex: none;
  font-size: var(--logo-size, 24px);
  width: .536em; height: .536em;
  margin: .161em;   /* the ring and halo overflow the box by this much */
  --logo-core-r: .161em;
  transition: --logo-core-r .55s cubic-bezier(.34, 1.56, .64, 1), transform .12s cubic-bezier(.4, 0, .2, 1);
}
.logo:hover .logo-mark, .logo.is-busy .logo-mark { --logo-core-r: .23em; }   /* almost round, never quite */
.logo:hover:active .logo-mark { transform: scale(.94); }
.logo-mark > span { position: absolute; display: block; }
.logo-mark__glow, .logo-mark__ring {
  inset: -.161em;
  border-radius: calc(var(--logo-core-r) + .161em);
  background: conic-gradient(from calc(var(--logo-angle) + var(--logo-boost)), var(--logo-c1), var(--brand-ring-mid), var(--logo-c6));
}
.logo-mark__glow {
  filter: blur(max(.13em, 2px));
  opacity: .55;
  animation: logo-spin 8s linear infinite, logo-boost 4s linear infinite paused, logo-breathe 3.6s ease-in-out infinite alternate;
}
.logo-mark__ring {
  -webkit-mask-image: conic-gradient(#000 calc(var(--logo-reveal) - 40deg), transparent var(--logo-reveal));
  mask-image: conic-gradient(#000 calc(var(--logo-reveal) - 40deg), transparent var(--logo-reveal));
  animation: logo-spin 8s linear infinite, logo-boost 4s linear infinite paused;
}
.logo-mark__core {
  inset: 0;
  border-radius: var(--logo-core-r);
  background:
    linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, .7) 50%, transparent 62%) no-repeat,
    linear-gradient(160deg, rgba(255, 255, 255, .72) 0%, rgba(255, 255, 255, .5) 55%, rgba(255, 255, 255, .58) 100%);
  background-size: 250% 100%, auto;
  background-position: 110% 0, 0 0;
  -webkit-backdrop-filter: blur(.09em) saturate(1.5);
  backdrop-filter: blur(.09em) saturate(1.5);
  box-shadow:
    inset 0 max(.012em, .5px) 0 rgba(255, 255, 255, .85),
    inset 0 0 0 max(.012em, .5px) rgba(255, 255, 255, .45),
    inset 0 -.03em .06em rgba(18, 18, 18, .06),
    0 .03em .08em rgba(18, 18, 18, .08);
  animation: logo-glint 7s ease-in-out 1.4s infinite;
}
.logo:hover .logo-mark__glow, .logo:hover .logo-mark__ring,
.logo.is-busy .logo-mark__glow, .logo.is-busy .logo-mark__ring { animation-play-state: running; }
.logo-word { display: inline-block; font-weight: 600; padding-left:1px; letter-spacing: -.01em; text-transform: uppercase; font-feature-settings: "ss01" on, "ss02" on; white-space: nowrap; }
.logo-keep-case { text-transform: none; }   /* "Neon" in "QUASII. Neon" stays mixed case inside the uppercase wordmark */
.logo-tm { font-size: .413em; font-weight: 400; vertical-align: top; line-height: 1; }
.logo--intro .logo-mark__glow { animation: logo-glow-in .9s cubic-bezier(.22, 1, .36, 1) .55s backwards, logo-spin 8s linear infinite, logo-boost 4s linear infinite paused, logo-breathe 3.6s ease-in-out infinite alternate; }
.logo--intro .logo-mark__ring { animation: logo-ring-draw .95s cubic-bezier(.65, 0, .35, 1) .2s backwards, logo-spin 8s linear infinite, logo-boost 4s linear infinite paused; }
.logo--intro .logo-mark__core { animation: logo-core-pop .6s cubic-bezier(.34, 1.56, .64, 1) backwards, logo-glint 7s ease-in-out 1.4s infinite; }
.logo--intro .logo-word { animation: logo-word-in .85s cubic-bezier(.22, 1, .36, 1) .38s backwards; }
@keyframes logo-spin { to { --logo-angle: 1turn; } }
@keyframes logo-boost { to { --logo-boost: 1turn; } }
@keyframes logo-breathe { from { opacity: .38; } to { opacity: .7; } }
@keyframes logo-glow-in { from { transform: scale(.4); } }
@keyframes logo-ring-draw { from { --logo-reveal: 0deg; } to { --logo-reveal: 400deg; } }
@keyframes logo-core-pop { from { transform: scale(0) rotate(-90deg); } }
@keyframes logo-glint { 0% { background-position: 110% 0, 0 0; } 18%, 100% { background-position: -10% 0, 0 0; } }
@keyframes logo-word-in {
  from { clip-path: inset(-.3em 100% -.3em -.1em); transform: translateX(-.12em); opacity: 0; }
  to { clip-path: inset(-.3em -.3em -.3em -.1em); transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .logo, .logo-mark, .logo-mark > span, .logo-word { animation: none !important; transition: none !important; }
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: var(--radius-s);
  color: var(--ink-2);
  position: relative;
  flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn:active, .icon-btn.on { background: var(--press); }
.icon-btn[disabled] { opacity: .35; pointer-events: none; }
.icon-btn .badge { position: absolute; top: 3px; right: 3px; }

.compose-btn {
  display: flex; align-items: center; gap: 6px;
  margin: 2px 10px 8px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  font-weight: 550;
}
.compose-btn:hover { border-color: var(--line-strong); }
.compose-btn kbd { margin-left: auto; }

.side-scroll { flex: 1; overflow-y: auto; padding: 0 8px 12px; scrollbar-width: thin; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--radius-s);
  color: var(--ink-2);
  text-align: left;
  white-space: nowrap;
}
/* every item, not just siblings: account rows sit inside x-if/x-for wrapper divs */
.side-scroll .nav-item { margin-top: 2px; }
.side-scroll > .nav-item:first-child { margin-top: 0; }
.nav-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { background: var(--hover); color: var(--ink); }
.nav-item.active { background: var(--paper); color: var(--ink); font-weight: 550; box-shadow: var(--shadow-card); }
.nav-item.sub { padding-left: 26px; height: 26px; font-size: calc(12.5px + var(--fs-up)); }
.nav-item .twist { width: 14px; margin-left: -4px; margin-right: -5px; color: var(--faint); display: grid; place-items: center; }
.nav-item .twist .i { transition: transform .15s; }
.nav-item .twist.closed .i { transform: rotate(-90deg); }
.nav-gap { height: 10px; }
.nav-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 8px 4px;
  font-size: calc(11.5px + var(--fs-up));
  color: var(--muted);
  font-weight: 550;
}
.nav-head button { color: var(--faint); }
.nav-head button:hover { color: var(--ink); }

/* counts: a grey total pill, split into [unread | total] with a light-blue unread half when something is unread */
.count { display: inline-flex; align-items: center; font-variant-numeric: tabular-nums; }
.count .u, .count .t { height: 17px; line-height: 17px; padding: 0 6px; border-radius: 99px; font-size: calc(11px + var(--fs-up)); }
.count .t { background: var(--read-bg); color: var(--read-ink); font-weight: 550; }
.count .t:empty { display: none; }
.count .u { background: var(--unread-bg); color: var(--unread-ink); font-weight: 650; border-radius: 99px 0 0 99px; }
.count .u:not([style*="none"]) + .t { border-radius: 0 99px 99px 0; padding-left: 5px; }
.nav-item:hover .count .u { background: oklch(from var(--unread-bg) calc(l - .03) calc(c * 1.3) h); }
.nav-item:hover .count .t { background: oklch(from var(--read-bg) calc(l - .03) 0 0); }

.team-chip {
  width: 18px; height: 18px;
  border-radius: 5px;
  display: inline-grid; place-items: center;
  font-size: calc(9px + var(--fs-up)); font-weight: 700;
  background: var(--c, #e4e6ea);
  color: oklch(from var(--c, #e4e6ea) .4 calc(c * 2.4) h);
  flex: none;
  letter-spacing: .02em;
}
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; background: var(--c, #e4e6ea); box-shadow: inset 0 0 0 1.5px oklch(from var(--c, #e4e6ea) .62 calc(c * 2.4) h); }
.tag-ic { fill: var(--c); color: oklch(from var(--c) .55 calc(c * 2.4) h); }

.side-foot { border-top: 1px solid var(--line); padding: 6px 8px; position: relative; }
.me-btn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 6px; border-radius: var(--radius-s); text-align: left; }
.me-btn:hover { background: var(--hover); }

/* ───────── avatars ───────── */
.av {
  --s: 24px;
  width: var(--s); height: var(--s);
  border-radius: 50%;
  display: inline-grid; place-items: center;
  font-size: calc(var(--s) * .42);
  font-weight: 650;
  background: var(--c, #e4e6ea);
  color: oklch(from var(--c, #e4e6ea) .4 calc(c * 2.4) h);
  flex: none;
  position: relative;
  user-select: none;
  letter-spacing: -.01em;
}
.av.sq { border-radius: 7px; }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.av.s16 { --s: 16px; font-size: calc(8px + var(--fs-up)); }
.av.s20 { --s: 20px; }
.av.s28 { --s: 28px; }
.av.s32 { --s: 32px; }
.av.s36 { --s: 36px; }
.av .online { position: absolute; right: -1px; bottom: -1px; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px var(--canvas); }
.av-stack { display: inline-flex; }
.av-stack .av { box-shadow: 0 0 0 1.5px var(--paper); }
.reader-scroll .av-stack .av { box-shadow: 0 0 0 1.5px var(--list); }
.av-stack .av + .av { margin-left: -5px; }
.platform-av { color: #fff; }

/* ───────── list pane ───────── */
.listpane {
  display: flex; flex-direction: column;
  min-height: 0;
  background: var(--paper);
  border-right: 1px solid var(--line);
}
.list-top { display: flex; align-items: center; gap: 6px; padding: 9px 10px 8px; border-bottom: 1px solid var(--line); }
.search {
  flex: 1;
  display: flex; align-items: center; gap: 7px;
  height: 30px;
  padding: 0 8px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--muted);
}
.search:focus-within { border-color: var(--charge-edge); box-shadow: 0 0 0 3px var(--charge-soft); color: var(--ink); }
.search input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; color: var(--ink); }
.search input::placeholder { color: var(--faint); }
.list-title { display: flex; align-items: baseline; gap: 8px; padding: 9px 14px 4px; }
.list-title h2 { font-size: calc(15px + var(--fs-up)); font-weight: 650; margin: 0; letter-spacing: -.01em; }
.list-title .muted { font-size: calc(12px + var(--fs-up)); }
.filter-pill { font-size: calc(11.5px + var(--fs-up)); padding: 2px 7px; border-radius: 99px; background: var(--charge-soft); color: var(--charge-ink); display: inline-flex; align-items: center; gap: 4px; }

.bulkbar { display: flex; align-items: center; gap: 2px; padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--charge-softer); }
.bulkbar .n { font-weight: 600; margin-right: auto; padding-left: 4px; }

.list-scroll { flex: 1; overflow-y: auto; padding: 2px 6px 16px; scrollbar-width: thin; }
.group-head { font-size: calc(11.5px + var(--fs-up)); font-weight: 600; color: var(--muted); padding: 10px 8px 4px; position: sticky; top: 0; background: var(--paper); z-index: 1; }

.item {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  column-gap: 9px;
  padding: 8px 10px 9px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
}
.item + .item::before { content: ""; position: absolute; left: -7px; right: -7px; top: -1px; height: 1px; background: #efeff0; pointer-events: none; }
.item.active, .item.unread { margin: 2px 0; }
.item.active::before, .item.active + .item::before, .item.unread::before, .item.unread + .item::before { display: none; }
.item.unread { background: var(--unread-item-bg); border-color: var(--unread-item-edge); }
.item:hover { background: #fcfcfc }
.item.unread:hover { background: linear-gradient(var(--hover), var(--hover)); }
.item.active { background: var(--list); border-color: var(--line); box-shadow: var(--shadow-card); }
.item.checked { background: var(--charge-soft); }
.item.active.checked { background: var(--charge-soft); border-color: var(--charge-edge); }
.item .lead { padding-top: 1px; position: relative; }
.item .lead .pick { position: absolute; inset: 0 0 auto 0; display: none; }
.item.checked .lead .av, .list-select-mode .item .lead .av { display: none; }
.item.checked .lead .pick, .list-select-mode .item .lead .pick { display: grid; }
/* Hover swap only where a real pointer exists: on iOS a :hover that changes display eats the first tap */
@media (hover: hover) {
  .item:hover .lead .av { display: none; }
  .item:hover .lead .pick { display: grid; }
}
.pick { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-strong); background: var(--paper); place-items: center; margin: 2px; }
.item.checked .pick { background: var(--charge); border-color: var(--charge-edge); color: var(--on-charge); }
.l1 { display: flex; align-items: center; gap: 6px; min-width: 0; }
.l1 .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.l1 time { font-size: calc(11.5px + var(--fs-up)); color: var(--faint); flex: none; font-variant-numeric: tabular-nums; }
.l2 { color: var(--ink); font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l3row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.l3row .l3 { flex: 1; min-width: 0; }
.l3 { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: calc(12.5px + var(--fs-up)); }
.item .meta { display: flex; align-items: center; gap: 5px; margin-top: 4px; min-height: 0; flex-wrap: wrap; }
.item .meta:empty { display: none; }
.mini { display: inline-flex; align-items: center; gap: 3px; font-size: calc(11.5px + var(--fs-up)); color: var(--muted); }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 18px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: calc(11px + var(--fs-up));
  font-weight: 550;
  background: var(--c, #e4e6ea);
  color: oklch(from var(--c, #e4e6ea) .4 calc(c * 2.4) h);
  white-space: nowrap;
}
.chip .x { opacity: .6; }
.chip .x:hover { opacity: 1; }
.chip.draft { --c: #FEE0DC; }
.chip.snooze { --c: #E5D7F4; }
.chip.neutral { --c: #eceef1; }
.star-on { color: #e6a700; fill: #ffc53d; }

.list-empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.list-empty .i { width: 28px; height: 28px; color: var(--faint); margin-bottom: 8px; }
.list-empty b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 2px; }
.load-more { display: block; width: 100%; padding: 10px; color: var(--muted); font-size: calc(12px + var(--fs-up)); text-align: center; }
.skeleton { height: 64px; margin: 4px 2px; border-radius: var(--radius); background: linear-gradient(90deg, #eef0f2 0%, #f6f7f8 50%, #eef0f2 100%); background-size: 200% 100%; animation: sk 1.2s infinite linear; }
@keyframes sk { to { background-position: -200% 0; } }

/* ───────── reader ───────── */
.reader { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--paper); }
.toolbar { display: flex; align-items: center; gap: 2px; padding: 8px 12px; border-bottom: 1px solid var(--line); min-height: 47px; }
.tb-sep { width: 1px; height: 18px; background: var(--line); margin: 0 6px; }
.split-btn { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); height: 30px; }
.split-btn > button { padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; font-weight: 550; }
.split-btn > button + button { border-left: 1px solid var(--line); padding: 0 6px; }
.split-btn > button:hover { background: var(--hover); }

.presence-bar { display: flex; align-items: center; gap: 6px; font-size: calc(12px + var(--fs-up)); color: var(--muted); padding: 0 8px; }
.presence-bar .typing { color: var(--charge-ink); font-weight: 550; }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--charge-mark); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.reader-scroll { flex: 1; overflow-y: auto; scrollbar-width: thin; background: var(--list); }
.reader-inner { max-width: 880px; margin: 0 auto; padding: 18px 28px 28px; }
.conv-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.conv-head h1 { font-size: calc(21px + var(--fs-up)); line-height: 1.25; font-weight: 600; letter-spacing: -.015em; margin: 0; flex: 1; overflow-wrap: anywhere; }
.conv-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: -2px 0 14px; align-items: center; }
.conv-tags .assignee { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px 0 3px; border-radius: 99px; background: var(--canvas); font-size: calc(12px + var(--fs-up)); }

.msg {
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--paper);
  margin-bottom: 10px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.msg-head { display: flex; align-items: flex-start; gap: 10px; padding: 14px 25px; cursor: pointer; }
.msg.open .msg-head { cursor: default; }
.msg-head .from { font-weight: 600; }
.msg-head .addr { color: var(--muted); font-weight: 400; }
.msg-head .to { color: var(--muted); font-size: calc(12px + var(--fs-up)); margin-top: 1px; }
.msg-head time { color: var(--faint); font-size: calc(12px + var(--fs-up)); white-space: nowrap; }
.msg.collapsed .msg-head { padding: 9px 14px; }
.msg.collapsed .snip { color: var(--muted); }
.msg.out { border-color: #dfe4fb; }
.msg.out .msg-head { background: var(--charge-softer); }
.msg-body { padding: 10px 25px 14px; }
.msg-body iframe { display: block; width: 100%; border: 0; height: 60px; background: #fff; color-scheme: light; }
.quote-toggle { display: inline-grid; place-items: center; height: 14px; padding: 0 6px; margin: 6px 0 0; border-radius: 4px; background: var(--canvas); color: var(--muted); font-weight: 700; letter-spacing: 1px; font-size: calc(10px + var(--fs-up)); line-height: 1; }
.quote-toggle:hover { background: var(--press); color: var(--ink); }
.atts { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 14px; }
.att {
  display: inline-flex; align-items: center; gap: 8px;
  max-width: 260px;
  padding: 6px 10px 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--paper);
}
.att:hover { border-color: var(--line-strong); text-decoration: none; background: var(--canvas); }
.att .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; font-size: calc(12.5px + var(--fs-up)); }
.att .s { color: var(--faint); font-size: calc(11.5px + var(--fs-up)); }
.att .ic { width: 26px; height: 26px; border-radius: 6px; background: var(--canvas); display: grid; place-items: center; color: var(--muted); flex: none; }

/* chat bubbles */
.chat-day { text-align: center; font-size: calc(11.5px + var(--fs-up)); color: var(--faint); margin: 14px 0 8px; }
.bubble-row { display: flex; gap: 8px; margin: 3px 0; align-items: flex-end; }
.bubble-row.out { flex-direction: row-reverse; }
.bubble { max-width: min(560px, 78%); padding: 7px 11px; border-radius: 14px; background: var(--canvas); overflow-wrap: anywhere; }
.bubble .txt { white-space: pre-wrap; }
.bubble-row.in .bubble { border-bottom-left-radius: 4px; }
.bubble-row.out .bubble { background: var(--charge); color: var(--on-charge); box-shadow: inset 0 0 0 1px var(--charge-edge); border-bottom-right-radius: 4px; }
.bubble .bt { display: block; font-size: calc(10.5px + var(--fs-up)); opacity: .65; margin-top: 2px; text-align: right; }
.bubble img { max-width: 260px; border-radius: 8px; display: block; margin: 2px 0; }
.bubble a { color: inherit; text-decoration: underline; }
.bubble .bn { display: block; font-size: calc(12px + var(--fs-up)); font-weight: 600; margin-bottom: 1px; }
.bubble .bn .faint { font-weight: 400; }
a.profile-link, .bubble a.profile-link, a.av { color: inherit; text-decoration: none; }
a.profile-link[href]:hover, .bubble a.profile-link[href]:hover { text-decoration: underline; }
a.av[href]:hover { box-shadow: 0 0 0 2px var(--charge-edge); }
.bubble-reply { margin-right: 8px; font-size: calc(10.5px + var(--fs-up)); color: inherit; text-decoration: underline; }

/* timeline: comments and events */
.event { display: flex; align-items: center; gap: 8px; font-size: calc(12px + var(--fs-up)); color: var(--muted); margin: 8px 0 8px 14px; }
.event .i { color: var(--faint); }
.comment { display: flex; gap: 9px; margin: 10px 0; padding: 9px 12px; background: var(--comment); border: 1px solid var(--comment-line); border-radius: var(--radius-l); }
.comment .who { font-weight: 600; }
.comment time { color: var(--muted); font-size: calc(11.5px + var(--fs-up)); margin-left: 6px; }
.comment .text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 1px; }
.comment .text code { font: calc(12px + var(--fs-up)) ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: rgba(0,0,0,.06); padding: 1px 4px; border-radius: 4px; }
.comment .edited { color: var(--faint); font-size: calc(11px + var(--fs-up)); margin-left: 6px; }
.comment-acts { display: flex; align-self: flex-start; margin: -4px -6px 0 0; opacity: 0; transition: opacity .1s; }
.comment:hover .comment-acts, .comment-acts:focus-within { opacity: 1; }
.comment-edit textarea { width: 100%; border: 1px solid var(--comment-line); border-radius: var(--radius); background: var(--paper); padding: 6px 8px; margin: 4px 0 6px; resize: none; outline: 0; line-height: 1.4; }
.comment-atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.comment-atts .thumb img { display: block; max-width: 220px; max-height: 160px; border-radius: var(--radius); border: 1px solid var(--comment-line); }
.comment-atts .att { max-width: 260px; }
.mention { color: var(--charge-ink); font-weight: 600; }
/* a link to a conversation in this app, inside a comment or chat message */
.conv-link { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 0 7px; border: 1px solid var(--comment-line); border-radius: 99px; background: var(--paper); color: var(--ink-2); font-size: calc(12px + var(--fs-up)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.conv-link:hover { text-decoration: none; border-color: var(--line-strong); }

/* team chat: lighter than thread comments, since a room is mostly messages */
.room .room-post { position: relative; margin: 1px 0; padding: 7px 10px; background: none; border-color: transparent; }
/* five actions would eat the text column on narrow screens, so they float over the message instead of taking width */
.room .room-post .comment-acts { position: absolute; top: -10px; right: 8px; margin: 0; padding: 1px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); pointer-events: none; }
.room .room-post:hover .comment-acts, .room .room-post .comment-acts:focus-within, .room .room-post.menu-open .comment-acts { pointer-events: auto; }
.room .room-post:hover, .room .room-post.menu-open { background: var(--comment-softer); border-color: var(--comment-line); }
.room-post.menu-open .comment-acts { opacity: 1; }
.room-post.flash { animation: post-flash 1.8s ease-out; }
@keyframes post-flash { from, 40% { background: var(--comment); border-color: var(--comment-line); } }
.pinned-mark { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; font-size: calc(11px + var(--fs-up)); color: var(--charge-ink); }
.pin-on { color: var(--charge-ink); }
.reply-quote { display: flex; align-items: center; gap: 6px; max-width: 100%; margin: 3px 0 2px; padding: 2px 8px; border-left: 2px solid var(--comment-line); border-radius: 0 var(--radius-s) var(--radius-s) 0; background: var(--comment-softer); color: var(--muted); font-size: calc(12px + var(--fs-up)); text-align: left; }
.reply-quote b { color: var(--ink-2); font-weight: 600; }
.reply-quote:not(:disabled):hover { background: var(--comment); }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.reaction { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border: 1px solid var(--line); border-radius: 99px; background: var(--paper); color: var(--muted); font-size: calc(12px + var(--fs-up)); font-variant-numeric: tabular-nums; }
.reaction:hover { border-color: var(--line-strong); }
.reaction.mine { background: var(--comment); border-color: var(--comment-line); color: var(--ink); }
.react-pop { display: flex; gap: 2px; min-width: 0; padding: 4px; top: 30px; }
.react-pop button { width: 30px; height: 30px; border-radius: var(--radius-s); font-size: calc(17px + var(--fs-up)); line-height: 1; }
.react-pop button:hover { background: var(--hover); }
.react-pop button.on { background: var(--comment); }
.pin-strip { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--list); color: var(--muted); }
.pins { display: flex; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.pin { display: inline-flex; align-items: center; flex: none; max-width: 280px; height: 24px; padding-left: 9px; border: 1px solid var(--line); border-radius: 99px; background: var(--paper); }
.pin-go { display: flex; gap: 5px; min-width: 0; overflow: hidden; white-space: nowrap; font-size: calc(12px + var(--fs-up)); color: var(--ink-2); }
.pin-go span { overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.pin-x { width: 22px; height: 22px; display: grid; place-items: center; flex: none; border-radius: 50%; color: var(--faint); }
.pin-x:hover { color: var(--ink); }
.room-box .reply-to, .chat-reply-to { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 880px; margin: 0 auto 6px; padding-left: 4px; font-size: calc(12px + var(--fs-up)); color: var(--muted); }
.room-members { margin-left: 6px; }
.room-members .av { box-shadow: 0 0 0 1.5px var(--paper); }
.room-members .av.off { opacity: .45; }
.av.everyone { background: var(--canvas); color: var(--muted); }

.reply-actions { display: flex; gap: 6px; margin: 4px 0 6px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--paper);
  font-weight: 550;
  color: var(--ink);
  white-space: nowrap;
}
.btn:hover { border-color: var(--line-strong); background: var(--canvas); text-decoration: none; }
.btn.primary { background: var(--charge); border-color: var(--charge-edge); color: var(--on-charge); }
.btn.primary:hover { background: var(--charge-hover); border-color: var(--charge-hover); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: #f3c7c7; }
.btn.sm { height: 26px; padding: 0 9px; font-size: calc(12.5px + var(--fs-up)); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
/* Send split button: accent-coloured core with a slowly rotating pastel border.
   Two background layers — the fill clipped to padding-box, the conic gradient to border-box — under a transparent
   border. The angle is a registered @property so it can animate (static gradient where unsupported). */
@property --send-angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes send-spin { to { --send-angle: 1turn; } }
.send-btn {
  --send-ring: #97e1ef, var(--brand-ring-mid), #96e1ef;
  --send-fill: var(--charge);
  display: inline-flex; align-items: stretch;
  height: 34px;
  border: 4px solid transparent;
  border-radius: 11px;
  background: linear-gradient(var(--send-fill), var(--send-fill)) padding-box, conic-gradient(from var(--send-angle), var(--send-ring)) border-box;
  color: var(--on-charge);
  box-shadow: 0 2px 8px rgba(174, 161, 213, .3);
  transition: transform .1s cubic-bezier(.4, 0, .2, 1), box-shadow .1s cubic-bezier(.4, 0, .2, 1);
  animation: send-spin 8s linear infinite;
}
.send-btn:hover { --send-ring: #7bdff2, var(--brand-ring-mid), #7bdff2; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(174, 161, 213, .4); animation-duration: 2.67s; }
.send-btn:active { transform: none; box-shadow: 0 2px 8px rgba(174, 161, 213, .3); }
.send-btn > button { display: inline-flex; align-items: center; justify-content: center; color: inherit; font-weight: 500; }
.send-btn > button:focus-visible { outline-offset: -2px; }
.send-main { padding: 0 16px; border-radius: 7px 0 0 7px; }
.send-more { width: 28px; border-radius: 0 7px 7px 0; border-left: 1px solid color-mix(in srgb, var(--on-charge) 22%, var(--charge)); }
.send-btn.busy { opacity: .55; animation: none; transform: none; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .send-btn { animation: none; } }

.comment-box { border-top: 1px solid var(--line); padding: 10px 16px 12px; background: var(--paper); }
.comment-input {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 4px 4px 4px 12px;
  background: var(--paper);
  max-width: 880px;
  margin: 0 auto;
  position: relative;
}
.comment-input:focus-within { border-color: var(--comment-line); background: var(--comment-softer); box-shadow: 0 0 0 3px var(--comment-ring); }
.comment-input .cmp-atts { flex-basis: 100%; padding: 6px 0 2px; }
.comment-input .icon-btn { color: var(--muted); }
.comment-input .icon-btn.send { color: var(--charge-ink); }
.comment-input textarea { flex: 1 1 0; min-width: 120px; border: 0; outline: 0; resize: none; background: none; padding: 6px 0; max-height: 160px; min-height: 30px; line-height: 1.4; }
.comment-input textarea::placeholder { color: var(--faint); }
.comment-hint { max-width: 880px; margin: 5px auto 0; font-size: calc(11px + var(--fs-up)); color: var(--faint); height: 0; overflow: hidden; transition: height .12s; }
.comment-box:focus-within .comment-hint { height: 14px; }
.emoji-pop { display: grid; grid-template-columns: repeat(8, 30px); gap: 2px; padding: 6px; width: auto; }
.emoji-pop button { width: 30px; height: 30px; border-radius: var(--radius-s); font-size: calc(17px + var(--fs-up)); line-height: 1; }
.emoji-pop button:hover { background: var(--hover); }

.empty-reader { flex: 1; display: grid; place-items: center; color: var(--muted); text-align: center; }
.empty-reader .big { font-size: calc(15px + var(--fs-up)); font-weight: 600; color: var(--ink); margin: 12px 0 4px; }
.empty-reader kbd { margin: 0 2px; }
.orbit-art { position: relative; width: 72px; height: 72px; margin: 0 auto; border-radius: 50%; border: 1.5px dashed var(--line-strong); }
.orbit-art::before { content: ""; position: absolute; inset: 28px; border-radius: 50%; background: var(--line-strong); }
.orbit-art::after { content: ""; position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--charge-mark); top: -5px; left: 31px; transform-origin: 5px 41px; animation: orbit 14s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .orbit-art::after { animation: none; } }

kbd { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 4px; border: 1px solid var(--line); background: var(--paper); font: 550 calc(10.5px + var(--fs-up)) var(--font); color: var(--muted); box-shadow: 0 1px 0 var(--line); }

/* ───────── composer ───────── */
.composer {
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-l);
  background: var(--paper);
  box-shadow: var(--shadow-pop);
  margin: 8px 0 12px;
  display: flex; flex-direction: column;
}
.composer.focused { border-color: var(--charge-edge); box-shadow: 0 0 0 3px var(--charge-soft), var(--shadow-pop); }
.cmp-row { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--line); min-height: 36px; }
.cmp-row > .lbl { color: var(--muted); width: 46px; flex: none; font-size: calc(12.5px + var(--fs-up)); }
.cmp-row.subject input.plain { font-weight: 600; font-size: calc(15px + var(--fs-up)); color: var(--ink); }
.cmp-row select, .cmp-row input.plain { border: 0; outline: 0; background: none; flex: 1; min-width: 0; padding: 4px 0; }
.recips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; flex: 1; min-width: 0; position: relative; }
.recips input { border: 0; outline: 0; flex: 1; min-width: 120px; padding: 4px 0; background: none; }
.rchip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 4px 0 8px; border-radius: 99px; background: var(--canvas); font-size: calc(12.5px + var(--fs-up)); max-width: 100%; }
.rchip.bad { background: var(--danger-soft); color: var(--danger); }
.rchip button { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; color: var(--muted); }
.rchip button:hover { background: var(--press); color: var(--ink); }
.suggest { position: absolute; top: calc(100% + 6px); left: 0; width: 320px; z-index: 30; }
.editor {
  min-height: 140px;
  max-height: 52vh;
  overflow-y: auto;
  padding: 12px 14px;
  outline: 0;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.editor:empty::before { content: attr(data-placeholder); color: var(--faint); pointer-events: none; }
.editor blockquote { margin: 8px 0; padding-left: 10px; border-left: 2px solid var(--line-strong); color: var(--muted); }
.editor p { margin: 0 0 .6em; }
.editor ul, .editor ol { margin: 0 0 .6em; padding-left: 22px; }
.editor .sig { color: var(--muted); }
.editor img { max-width: 100%; height: auto; border-radius: 2px; }
.editor img[data-pending] { opacity: .45; }
.pop.swatches { min-width: 0; }
.swatch-grid { display: grid; grid-template-columns: repeat(4, 22px); gap: 6px; padding: 2px 8px 6px; }
.img-frame { position: absolute; z-index: 5; pointer-events: none; outline: 1.5px solid var(--unread-ink); border-radius: 2px; }
.img-handle {
  position: absolute; right: -6px; bottom: -6px;
  width: 11px; height: 11px; border-radius: 3px;
  background: var(--paper); border: 1.5px solid var(--unread-ink);
  cursor: nwse-resize; pointer-events: auto; touch-action: none;
}
.swatch { width: 22px; height: 22px; border-radius: 6px; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.swatch:hover { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--line-strong); }
.cmp-atts { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; }
.cmp-foot { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-top: 1px solid var(--line); }
.cmp-foot .status { font-size: calc(12px + var(--fs-up)); color: var(--faint); margin: 0 6px; }
.cmp-tools { display: contents; }   /* on mobile: a one-row strip you swipe sideways, see responsive */
.cmp-error { margin: 0 12px 8px; padding: 7px 10px; border-radius: var(--radius); background: var(--danger-soft); color: var(--danger); font-size: calc(12.5px + var(--fs-up)); }
.chat-composer .editor { min-height: 64px; }
/* signature editor (Settings → Signatures); positioned so the image resize frame can sit over it */
.sig-edit { position: relative; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--paper); }
.sig-tools { display: flex; align-items: center; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.sig-tools .pop { top: calc(100% + 4px); }
.sig-tools .status { font-size: calc(12px + var(--fs-up)); color: var(--faint); margin-left: 6px; }
#sig-editor { min-height: 110px; max-height: 320px; }

/* new message in the reader pane */
.compose-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.tb-title { font-weight: 600; padding: 0 6px; }
.compose-pane .editor { min-height: 280px; max-height: none; }

/* ───────── popovers & menus ───────── */
.pop {
  position: absolute;
  z-index: 50;
  min-width: 200px;
  max-width: 320px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-pop);
  padding: 4px;
}
.pop.right { right: 0; }
.pop.up { bottom: calc(100% + 6px); top: auto; }
.pop-anchor { position: relative; display: inline-flex; }
.pop .mi {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border-radius: var(--radius-s);
  text-align: left;
  white-space: nowrap;
}
.pop .mi:hover, .pop .mi.hl { background: var(--hover); }
.pop .mi .hint { margin-left: auto; color: var(--faint); font-size: calc(11.5px + var(--fs-up)); }
.pop .mi .check { margin-left: auto; color: var(--charge-ink); }
.pop .mi.danger { color: var(--danger); }
.pop .sep { height: 1px; background: var(--line); margin: 4px; }
.pop .ph { padding: 6px 8px 4px; font-size: calc(11.5px + var(--fs-up)); color: var(--muted); font-weight: 550; }
.pop input.find { width: 100%; height: 30px; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0 8px; outline: 0; margin-bottom: 4px; }
.pop input.find:focus { border-color: var(--charge-edge); }
.pop .scroll { max-height: 280px; overflow-y: auto; }
.pop .custom { display: flex; gap: 6px; padding: 6px 4px 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.pop .custom input { flex: 1; min-width: 0; height: 28px; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0 6px; }

/* ───────── right rail & details ───────── */
.rail { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 0; border-left: 1px solid var(--line); background: var(--canvas); }
.rail .sp { flex: 1; }
.details { width: 280px; border-left: 1px solid var(--line); background: var(--list); overflow-y: auto; padding: 14px 16px; flex: none; }
.details h3 { font-size: calc(12px + var(--fs-up)); font-weight: 600; color: var(--muted); margin: 16px 0 6px; }
.details h3:first-child { margin-top: 0; }
.kv { display: grid; grid-template-columns: 82px 1fr; gap: 4px 8px; font-size: calc(12.5px + var(--fs-up)); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.reader-wrap { display: flex; min-height: 0; flex: 1; }

/* ───────── modal ───────── */
.overlay { position: fixed; inset: 0; background: rgba(255, 255, 255, .28); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); z-index: 80; display: grid; place-items: center; padding: 24px; }
.modal { background: var(--paper); border-radius: 14px; box-shadow: 0 24px 80px rgba(15,18,25,.3); width: min(920px, 100%); height: min(680px, calc(100vh - 48px)); display: grid; grid-template-columns: 200px 1fr; overflow: hidden; }
.modal.small { width: min(460px, 100%); height: auto; display: block; padding: 20px; }
.preview { background: var(--paper); border-radius: 14px; box-shadow: 0 24px 80px rgba(15,18,25,.3); max-width: 100%; max-height: calc(100dvh - 48px); display: flex; flex-direction: column; overflow: hidden; }
.preview.pdf { width: min(1000px, 100%); height: calc(100dvh - 48px); }
.preview-bar { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 14px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: calc(13px + var(--fs-up)); }
.preview img, .preview video { display: block; max-width: 100%; max-height: calc(100dvh - 96px); min-height: 0; object-fit: contain; }
.preview iframe { flex: 1; width: 100%; border: 0; }
.preview audio { margin: 20px; width: min(420px, calc(100vw - 88px)); }
.modal-nav { background: var(--canvas); border-right: 1px solid var(--line); padding: 14px 8px; }
.modal-nav h2 { font-size: calc(14px + var(--fs-up)); margin: 2px 8px 12px; }
.modal-nav .nav-group + .nav-group .nav-head { padding-top: 16px; }
.modal-nav .nav-group:first-of-type .nav-head { padding-top: 0; }
.modal-nav .nav-item + .nav-item { margin-top: 2px; }
.modal-body { overflow-y: auto; padding: 22px 28px 32px; }
.modal-body h3 { font-size: calc(16px + var(--fs-up)); margin: 0 0 4px; font-weight: 650; letter-spacing: -.01em; }
.modal-body h4 { font-size: calc(13px + var(--fs-up)); margin: 24px 0 8px; font-weight: 600; }
.modal-body p.lead { color: var(--muted); margin: 0 0 16px; max-width: 60ch; }
.settings-list { border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; }
.settings-list .li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--line); }
.settings-list .li:first-child { border-top: 0; }
.settings-list .li .t { font-weight: 550; }
.settings-list .li .s { font-size: calc(12px + var(--fs-up)); color: var(--muted); }
.settings-list .li-link { cursor: pointer; }
.settings-list .li-link:hover { background: var(--hover); }
.modal-body .back-link { margin: -4px 0 10px -8px; color: var(--muted); }
.modal-body .back-link:hover { color: var(--ink); }
.connect-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.status-pill { font-size: calc(11px + var(--fs-up)); font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--canvas); color: var(--muted); }
.status-pill.ready { background: #e6f6ec; color: var(--ok); }
.status-pill.syncing, .status-pill.pending { background: var(--charge-soft); color: var(--charge-ink); }
.status-pill.error { background: var(--danger-soft); color: var(--danger); }

/* soft checkbox: light-blue fill with a dark tick when on */
input.tick { appearance: none; -webkit-appearance: none; flex: none; width: 16px; height: 16px; margin: 0; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--paper) center / 12px 12px no-repeat; cursor: pointer; }
input.tick:checked { background-color: var(--unread-bg); border-color: oklch(from var(--unread-bg) calc(l - .1) calc(c * 1.6) h); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-4.9' fill='none' stroke='%2317191e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
input.tick:focus-visible { outline: 2px solid var(--unread-bg); outline-offset: 1px; }
input.tick:disabled { opacity: .5; cursor: default; }
.seg { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--canvas); }
.seg button { border: 0; border-radius: 6px; padding: 5px 12px; background: none; color: var(--muted); font: inherit; font-size: calc(13px + var(--fs-up)); cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--paper); color: var(--ink); font-weight: 550; box-shadow: 0 1px 2px rgba(23, 25, 30, .12); }

.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-size: calc(12.5px + var(--fs-up)); color: var(--muted); font-weight: 550; }
.form input:not([type=checkbox]):not([type=radio]):not([type=color]), .form select, .form textarea, input.field, select.field {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  background: var(--paper);
  color: var(--ink);
  font-size: calc(13px + var(--fs-up));
  font-weight: 400;
  outline: 0;
}
.form textarea { height: auto; min-height: 90px; padding: 8px 10px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus, input.field:focus { border-color: var(--charge-edge); box-shadow: 0 0 0 3px var(--charge-soft); }
.form .checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.form .checks label { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 400; }
.form .actions { display: flex; gap: 8px; justify-content: flex-end; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
fieldset { border: 0; padding: 0; margin: 0 0 6px; }
legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.inline-editor { border: 1px solid var(--line); border-radius: var(--radius-l); padding: 14px; margin: 10px 0; background: var(--list); }
code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: calc(12px + var(--fs-up)); background: var(--canvas); padding: 2px 5px; border-radius: 4px; word-break: break-all; }
.alert { padding: 9px 12px; border-radius: var(--radius); font-size: calc(13px + var(--fs-up)); margin-bottom: 12px; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: #e6f6ec; color: var(--ok); }
.alert.info { background: var(--charge-softer); color: var(--charge-ink); }
.color-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.color-swatches button { width: 22px; height: 22px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.hex-input { width: 92px; height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius-s); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: calc(12px + var(--fs-up)); outline: 0; }
.color-swatches button.on { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }

/* ───────── toasts ───────── */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 8px 8px 8px 14px; border-radius: var(--radius-l); box-shadow: var(--shadow-pop); font-size: calc(13px + var(--fs-up)); }
.toast.error { background: var(--danger); }
.toast button { color: #c9d2ff; font-weight: 600; padding: 3px 8px; border-radius: 5px; }
.toast button:hover { background: rgba(255,255,255,.1); }
.toast .i { opacity: .7; }

.notif-pop { width: 340px; max-width: 340px; }
.notif { display: flex; gap: 9px; padding: 8px; border-radius: var(--radius-s); cursor: pointer; text-align: left; width: 100%; }
.notif:hover { background: var(--hover); }
.notif.unread { background: var(--charge-softer); }
.notif .t { font-size: calc(12.5px + var(--fs-up)); white-space: normal; }
.notif time { font-size: calc(11px + var(--fs-up)); color: var(--faint); }
.badge { min-width: 15px; height: 15px; padding: 0 4px; border-radius: 99px; background: var(--charge-ink); color: #fff; font-size: calc(9.5px + var(--fs-up)); font-weight: 700; display: inline-grid; place-items: center; box-shadow: 0 0 0 2px var(--canvas); }

/* ───────── auth pages ───────── */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: var(--canvas); }
.auth-card { width: min(380px, 100%); background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: var(--shadow-card); }
.auth-card.wide { width: min(640px, 100%); }
.auth-card h1 { font-size: calc(20px + var(--fs-up)); margin: 18px 0 14px; letter-spacing: -.015em; }
.auth-logo { display: flex; align-items: center; gap: 8px; font-size: calc(18px + var(--fs-up)); --logo-size: 34px; }
.steps { padding-left: 18px; display: grid; gap: 12px; margin: 0 0 20px; }

/* ───────── responsive ───────── */
@media (max-width: 1180px) {
  :root { --list-w: 312px; --sidebar-w: 208px; }
  .details { display: none; }
}
@media (max-width: 920px) {
  :root { --fs-up: 1px; }
  /* composer tools: one row, swipe to scroll, no visible scrollbar. Their menus hang off .cmp-foot so the strip doesn't clip them */
  .cmp-foot { position: relative; }
  .cmp-foot > .grow { display: none; }
  .cmp-tools { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  .cmp-tools::-webkit-scrollbar { display: none; }
  .cmp-tools > * { flex: none; }
  .cmp-tools .pop-anchor { position: static; }
  .cmp-tools .status { white-space: nowrap; }
  .app, .app.no-sidebar { grid-template-columns: 1fr; }
  .app > .sidebar, .app > .rail, .pane-resize { display: none; }
  .app.show-sidebar > .sidebar { display: flex; visibility: visible; position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 70; box-shadow: var(--shadow-pop); }
  .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 69; background: rgba(255, 255, 255, .28); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
  .desktop-only { display: none !important; }
  .app.mobile-reader > .listpane { display: none; }
  .app:not(.mobile-reader) > .reader { display: none; }
  .reader-inner { padding: 14px 14px 24px; }
  .modal { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .modal-nav { display: flex; overflow-x: auto; gap: 4px; padding: 8px; }
  .modal-nav h2, .modal-nav .nav-head { display: none; }
  .modal-nav .nav-group { display: contents; }
  .modal-nav .nav-item + .nav-item { margin-top: 0; }
  .modal-body { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
}
.mobile-only { display: none; }
@media (max-width: 920px) { .mobile-only { display: inline-grid; } }
.comment-box .comment-input:not(.chat-composer) { background: var(--comment-softer); }
