/* 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 {
  --canvas: #f2f3f5;
  --list: #f8f9fa;
  --paper: #ffffff;
  --hover: rgba(23, 25, 30, .045);
  --press: rgba(23, 25, 30, .08);
  --line: #e4e6ea;
  --line-strong: #d5d8de;
  --ink: #17191e;
  --ink-2: #3b3f48;
  --muted: #697080;
  --faint: #9aa0ac;
  --charge: #3555f6;
  --charge-ink: #2440d6;
  --charge-soft: #eceffe;
  --charge-softer: #f4f6ff;
  --danger: #d93b3b;
  --danger-soft: #fdeeee;
  --ok: #1f9d55;
  --warn: #c98a07;
  --comment: #fff8e1;
  --comment-line: #f1e3b0;
  --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: 13px;
  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); outline-offset: 1px; border-radius: 4px; }
::selection { background: #cdd6ff; }

.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; }

/* ───────── 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: 8px; font-weight: 650; font-size: 14px; letter-spacing: -.01em; margin-right: auto; }

.logo-mark {
  position: relative;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  display: inline-block;
  flex: none;
}
.logo-mark::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--ink);
}
.logo-mark::after {
  content: "";
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--charge);
  box-shadow: 0 0 0 2px var(--canvas);
  top: -3px; left: 50%;
  margin-left: -3px;
  transform-origin: 3px 12px;
  animation: orbit 9s linear infinite;
}
@keyframes orbit { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .logo-mark::after { animation: none; } }

.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;
}
.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: 12.5px; }
.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: 11.5px;
  color: var(--muted);
  font-weight: 550;
}
.nav-head button { color: var(--faint); }
.nav-head button:hover { color: var(--ink); }

.count { display: inline-flex; gap: 4px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.count .u { color: var(--charge-ink); font-weight: 650; }
.count .t { color: var(--faint); }
.nav-item.active .count .t { color: var(--muted); }

.team-chip {
  width: 18px; height: 18px;
  border-radius: 5px;
  display: inline-grid; place-items: center;
  font-size: 9px; font-weight: 700;
  color: #fff;
  flex: none;
  letter-spacing: .02em;
}
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }

.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;
  color: #fff;
  flex: none;
  position: relative;
  user-select: none;
  letter-spacing: -.01em;
}
.av.sq { border-radius: 7px; }
.av.s16 { --s: 16px; font-size: 8px; }
.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(--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(--list);
  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); 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: 15px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.list-title .muted { font-size: 12px; }
.filter-pill { font-size: 11.5px; 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: 11.5px; font-weight: 600; color: var(--muted); padding: 10px 8px 4px; position: sticky; top: 0; background: var(--list); 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;
  margin-bottom: 1px;
}
.item:hover { background: var(--hover); }
.item.active { background: var(--paper); border-color: var(--line); box-shadow: var(--shadow-card); }
.item.checked { background: var(--charge-soft); }
.item.active.checked { background: var(--charge-soft); border-color: #c9d2fd; }
.item .lead { padding-top: 1px; position: relative; }
.item .lead .pick { position: absolute; inset: 0 0 auto 0; display: none; }
.item:hover .lead .av, .item.checked .lead .av, .list-select-mode .item .lead .av { display: none; }
.item:hover .lead .pick, .item.checked .lead .pick, .list-select-mode .item .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); color: #fff; }
.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: 11.5px; color: var(--faint); flex: none; font-variant-numeric: tabular-nums; }
.l2 { color: var(--ink-2); 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: 12.5px; }
.item.unread .who { color: var(--ink); font-weight: 650; }
.item.unread .l2 { color: var(--ink); font-weight: 550; }
.item.unread time { color: var(--charge-ink); font-weight: 600; }
.unread-dot { position: absolute; left: -1px; top: 14px; width: 6px; height: 6px; border-radius: 50%; background: var(--charge); }
.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: 11.5px; color: var(--muted); }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 18px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 550;
  background: color-mix(in srgb, var(--c, #888) 14%, white);
  color: color-mix(in srgb, var(--c, #888) 72%, black);
  white-space: nowrap;
}
.chip .x { opacity: .6; }
.chip .x:hover { opacity: 1; }
.chip.draft { --c: #d93b3b; }
.chip.snooze { --c: #8e4ec6; }
.chip.neutral { --c: #697080; }
.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: 12px; 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: 12px; 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); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.reader-scroll { flex: 1; overflow-y: auto; scrollbar-width: thin; }
.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: 21px; 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: 12px; }

.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: 11px 14px; 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: 12px; margin-top: 1px; }
.msg-head time { color: var(--faint); font-size: 12px; 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: 4px 14px 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: 10px; 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: 12.5px; }
.att .s { color: var(--faint); font-size: 11.5px; }
.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: 11.5px; 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: #fff; border-bottom-right-radius: 4px; }
.bubble .bt { display: block; font-size: 10.5px; 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; }

/* timeline: comments and events */
.event { display: flex; align-items: center; gap: 8px; font-size: 12px; 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: 11.5px; margin-left: 6px; }
.comment .text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 1px; }
.mention { color: var(--charge-ink); font-weight: 600; }

.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); color: #fff; }
.btn.primary:hover { background: var(--charge-ink); border-color: var(--charge-ink); }
.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: 12.5px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-group { display: inline-flex; }
.btn-group .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.btn-group .btn + .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; padding: 0 7px; }
.btn.primary + .btn.primary { border-left-color: rgba(255,255,255,.3); }

.comment-box { border-top: 1px solid var(--line); padding: 10px 16px 12px; background: var(--paper); }
.comment-input {
  display: flex; align-items: flex-end; gap: 6px;
  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: #fffdf5; box-shadow: 0 0 0 3px #fff4d0; }
.comment-input textarea { flex: 1; 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); }

.empty-reader { flex: 1; display: grid; place-items: center; color: var(--muted); text-align: center; }
.empty-reader .big { font-size: 15px; 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); top: -5px; left: 31px; transform-origin: 5px 41px; animation: orbit 14s linear infinite; }

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 10.5px var(--font); color: var(--muted); box-shadow: 0 1px 0 var(--line); }

/* ───────── composer ───────── */
.composer {
  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: #b9c4fb; 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: 12.5px; }
.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: 12.5px; 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); }
.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: 12px; color: var(--faint); margin: 0 6px; }
.cmp-error { margin: 0 12px 8px; padding: 7px 10px; border-radius: var(--radius); background: var(--danger-soft); color: var(--danger); font-size: 12.5px; }
.chat-composer .editor { min-height: 64px; }

/* new-message floating window */
.compose-window {
  position: fixed;
  right: calc(var(--rail-w) + 20px);
  bottom: 0;
  width: min(620px, calc(100vw - 32px));
  z-index: 60;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 12px 48px rgba(15, 18, 25, .22);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 40px);
}
.compose-window.min { height: auto; }
.cw-head { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 14px; border-bottom: 1px solid var(--line); background: var(--canvas); border-radius: 12px 12px 0 0; font-weight: 600; cursor: pointer; }
.compose-window .composer { border: 0; box-shadow: none; margin: 0; border-radius: 0; flex: 1; min-height: 0; }
.compose-window .editor { min-height: 220px; max-height: none; flex: 1; }

/* ───────── 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: 11.5px; }
.pop .mi .check { margin-left: auto; color: var(--charge); }
.pop .mi.danger { color: var(--danger); }
.pop .sep { height: 1px; background: var(--line); margin: 4px; }
.pop .ph { padding: 6px 8px 4px; font-size: 11.5px; 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); }
.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: 12px; 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: 12.5px; }
.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(23, 25, 30, .28); 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; }
.modal-nav { background: var(--canvas); border-right: 1px solid var(--line); padding: 14px 8px; }
.modal-nav h2 { font-size: 14px; margin: 2px 8px 12px; }
.modal-body { overflow-y: auto; padding: 22px 28px 32px; }
.modal-body h3 { font-size: 16px; margin: 0 0 4px; font-weight: 650; letter-spacing: -.01em; }
.modal-body h4 { font-size: 13px; 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: 12px; color: var(--muted); }
.connect-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.status-pill { font-size: 11px; 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); }

.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-size: 12.5px; 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: 13px;
  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); 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: 12px; background: var(--canvas); padding: 2px 5px; border-radius: 4px; word-break: break-all; }
.alert { padding: 9px 12px; border-radius: var(--radius); font-size: 13px; 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); }
.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: 13px; }
.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: 12.5px; white-space: normal; }
.notif time { font-size: 11px; color: var(--faint); }
.badge { min-width: 15px; height: 15px; padding: 0 4px; border-radius: 99px; background: var(--charge); color: #fff; font-size: 9.5px; 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: 20px; margin: 18px 0 14px; letter-spacing: -.015em; }
.auth-logo { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 15px; }
.auth-logo .logo-mark::after { box-shadow: 0 0 0 2px var(--paper); }
.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) {
  .app, .app.no-sidebar { grid-template-columns: 1fr; }
  .app > .sidebar, .app > .rail { display: none; }
  .app.show-sidebar > .sidebar { display: flex; position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 70; box-shadow: var(--shadow-pop); }
  .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 { display: none; }
  .modal-body { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .compose-window { right: 0; left: 0; width: 100%; top: 0; border-radius: 0; max-height: none; }
}
.mobile-only { display: none; }
@media (max-width: 920px) { .mobile-only { display: inline-grid; } }
.comment-box .comment-input:not(.chat-composer) { background: #fffdf7; }
