@font-face { font-family: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/geist-latin.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; }
@font-face { font-family: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/geist-latin-ext.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; }

:root {
  --bg: #000; --ink: #fff; --fg: 255, 255, 255;
  --muted: rgba(var(--fg), 0.52); --dim: rgba(var(--fg), 0.2);
  --glass: rgba(var(--fg), 0.06); --glass-hi: rgba(var(--fg), 0.09);
  --edge: rgba(var(--fg), 0.06); --line: rgba(var(--fg), 0.1);
  --radius: 32px; --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --red: #f23f43; --green: #23a55a; --amber: #f0b232;
  --f-sans: "Geist", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --sheet: rgba(16, 16, 18, 0.97);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eef0f3; --ink: #0b0c0e; --fg: 11, 12, 14;
  --glass: rgba(255, 255, 255, 0.72); --glass-hi: rgba(255, 255, 255, 0.95);
  --edge: rgba(11, 12, 14, 0.06); --sheet: rgba(255, 255, 255, 0.97);
  color-scheme: light;
}
:root[data-theme="light"] .tile, :root[data-theme="light"] .folder.active,
:root[data-theme="light"] .row.active, :root[data-theme="light"] .chip { box-shadow: inset 0 0 0 1px rgba(11,12,14,.06), 0 1px 2px rgba(11,12,14,.04); }

@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .35s var(--ease) both; }
::view-transition-new(root) { animation: vt-in .55s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; filter: blur(8px); transform: scale(.985); } }
@keyframes vt-in { from { opacity: 0; filter: blur(8px); transform: scale(1.015); } }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { transition: background-color .5s var(--ease), color .5s var(--ease); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--f-sans); font-size: 15px; font-weight: 500; line-height: 1.5;
  letter-spacing: -0.02em; -webkit-font-smoothing: antialiased; min-height: 100vh; min-height: 100dvh;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
h1, h2, h3, p { margin: 0; font-weight: 500; }
h1, h2, h3 { text-wrap: balance; line-height: 1.1; letter-spacing: -0.035em; }
::selection { background: var(--ink); color: var(--bg); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

.theme-switch {
  all: unset; position: relative; width: 44px; height: 24px; border-radius: 999px; cursor: pointer; flex: none;
  background: rgba(var(--fg), .12); box-shadow: inset 0 0 0 1px rgba(var(--fg), .1); transition: background .4s var(--ease);
}
.theme-switch:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.theme-switch .knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); display: grid; place-items: center; transition: transform .55s var(--ease), background .4s var(--ease); }
.theme-switch .knob svg { width: 11px; height: 11px; color: var(--bg); transition: opacity .3s var(--ease); position: absolute; }
.theme-switch .sun { opacity: 0; }
:root[data-theme="light"] .theme-switch .knob { transform: translateX(20px); }
:root[data-theme="light"] .theme-switch .moon { opacity: 0; }
:root[data-theme="light"] .theme-switch .sun { opacity: 1; }

.btn { all: unset; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border-radius: 999px; font-size: 14px; background: rgba(var(--fg), .08); transition: background .3s var(--ease), transform .3s var(--ease), opacity .3s; white-space: nowrap; }
.btn:hover { background: rgba(var(--fg), .14); }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.primary:hover { opacity: .88; }
.btn.danger { color: var(--red); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: rgba(var(--fg), .08); }
.btn.icon { padding: 9px; width: 36px; height: 36px; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.on { background: var(--ink); color: var(--bg); }

.field input, .field select, .input {
  font-weight: 400; color: var(--ink); background: rgba(var(--fg), .05); border: 0; border-radius: 14px; padding: 12px 14px;
  box-shadow: inset 0 0 0 1px rgba(var(--fg), .12); width: 100%; outline: none; transition: box-shadow .25s var(--ease);
}
.field input:focus, .field select:focus, .input:focus { box-shadow: inset 0 0 0 1.5px var(--ink); }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-size: 14px; color: var(--muted); font-weight: 400; }

/* Login */
.login-page { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; max-width: 1120px; margin: 0 auto; padding-inline: max(16px, env(safe-area-inset-left, 0px)); }
.login-main { display: grid; place-items: center; padding-block: 48px; }
.login-card { width: min(100%, 420px); display: grid; gap: 16px; padding: 36px 32px 28px; border-radius: var(--radius); background: var(--glass); box-shadow: inset 0 1px 0 1px var(--edge); animation: rise 1s var(--ease) both; }
.login-mark { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--ink); color: var(--bg); font-size: 26px; letter-spacing: -0.04em; margin-bottom: 6px; }
.login-card h1 { font-size: clamp(2rem, 5vw, 2.6rem); letter-spacing: -0.05em; line-height: 1; }
.login-sub { color: var(--muted); font-weight: 400; margin-top: -8px; }
.login-msg { font-size: 14.5px; font-weight: 400; padding: 12px 14px; border-radius: 14px; color: var(--red); background: rgba(242, 63, 67, .1); }
.login-form { display: grid; gap: 12px; margin-top: 4px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 76px; height: 50px; }
.pw-toggle { all: unset; cursor: pointer; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 13.5px; padding: 6px 10px; border-radius: 999px; color: var(--muted); }
.pw-toggle:hover { color: var(--ink); background: rgba(var(--fg), .08); }
.login-btn { height: 50px; padding: 0 18px; margin-top: 4px; font-size: 15.5px; border-radius: 16px; }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 400; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--ink); width: 16px; height: 16px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 18px; font-size: 15px; }
.topbar .l, .topbar .r { display: flex; gap: 22px; align-items: center; min-width: 0; }
.brand { display: inline-flex; gap: 10px; align-items: center; font-size: 16px; }
.brand-mark { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--ink); color: var(--bg); font-size: 16px; letter-spacing: -0.04em; flex: none; }
.who { color: var(--muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clock { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 400; }
.footer { display: flex; justify-content: space-between; gap: 12px; padding-block: 28px 28px; color: var(--muted); font-size: 14px; font-weight: 400; flex-wrap: wrap; }

/* App */
.app { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); padding-bottom: 16px; }
.panes { display: grid; grid-template-columns: 236px minmax(320px, 420px) minmax(0, 1fr); gap: 16px; min-height: 0; }
.tile { position: relative; border-radius: var(--radius); background: var(--glass); box-shadow: inset 0 1px 0 1px var(--edge); min-height: 0; min-width: 0; }

.side { display: flex; flex-direction: column; gap: 14px; min-height: 0; padding-top: 4px; }
.compose-btn { height: 52px; border-radius: 18px; font-size: 15.5px; justify-content: flex-start; padding-inline: 18px; }
.folders { display: grid; gap: 2px; overflow: auto; padding-right: 2px; }
.folder { all: unset; cursor: pointer; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 14px; border-radius: 16px; color: var(--muted); transition: background .3s var(--ease), color .3s var(--ease); }
.folder:hover { background: rgba(var(--fg), .05); color: var(--ink); }
.folder.active { background: var(--glass-hi); color: var(--ink); box-shadow: inset 0 1px 0 1px var(--edge); }
.folder svg { width: 18px; height: 18px; }
.folder .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder .count { font-size: 12.5px; font-variant-numeric: tabular-nums; padding: 1px 8px; border-radius: 999px; background: rgba(var(--fg), .1); color: var(--ink); }
.folder .count:empty { display: none; }
.side-foot { margin-top: auto; display: grid; gap: 6px; padding: 14px; border-radius: 20px; background: var(--glass); font-size: 13px; color: var(--muted); font-weight: 400; }
.side-foot b { color: var(--ink); font-weight: 500; }

.list { display: flex; flex-direction: column; overflow: hidden; }
.list-head { padding: 24px 24px 12px; display: grid; gap: 14px; }
.list-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.list-title h1 { font-size: clamp(1.6rem, 2.4vw, 2.1rem); letter-spacing: -0.045em; }
.list-title > span { color: var(--muted); font-size: 13.5px; font-weight: 400; font-variant-numeric: tabular-nums; }
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 40px; border-radius: 999px; height: 42px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filters .btn { padding: 6px 12px; font-size: 13px; }
.bulk { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 8px 10px; border-radius: 999px; background: var(--glass-hi); font-size: 13px; animation: rise .5s var(--ease) both; }
.bulk .btn { padding: 6px 12px; font-size: 13px; }
.rows { overflow: auto; padding: 4px 10px 10px; flex: 1; overscroll-behavior: contain; }
.row { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 14px 14px; border-radius: 20px; cursor: pointer; transition: background .25s var(--ease); animation: rise .6s var(--ease) both; }
.row:hover { background: rgba(var(--fg), .05); }
.row.active { background: var(--glass-hi); box-shadow: inset 0 1px 0 1px var(--edge); }
.row.selected { background: rgba(var(--fg), .1); }
.row .av { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-size: 15px; background: rgba(var(--fg), .1); color: var(--ink); position: relative; }
.row .av input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.row .av .tick { display: none; width: 18px; height: 18px; }
.row.selected .av, .rows.selecting .row .av { background: rgba(var(--fg), .14); }
.row.selected .av { background: var(--ink); color: var(--bg); }
.row.selected .av .letter, .rows.selecting .row .av .letter { display: none; }
.rows.selecting .row .av .tick, .row.selected .av .tick { display: block; }
.row .top { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; min-width: 0; }
.row .who { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
.row.unread .who, .row.unread .subj { font-weight: 600; }
.row .when { color: var(--muted); font-size: 12.5px; font-weight: 400; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row .subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; display: flex; gap: 6px; align-items: center; }
.row .snip { color: var(--muted); font-size: 13.5px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.4; margin-top: 2px; }
.row .dot { position: absolute; left: 4px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--ink); }
.row .marks { display: inline-flex; gap: 4px; color: var(--muted); flex: none; }
.row .marks svg { width: 13px; height: 13px; }
.row .marks .star { color: var(--amber); }
.m-only, .drawer-head, .scrim { display: none; }
.row .av, .sender .av { background: hsl(var(--h, 220) 34% 24%); color: hsl(var(--h, 220) 85% 84%); }
:root[data-theme="light"] .row .av, :root[data-theme="light"] .sender .av { background: hsl(var(--h, 220) 75% 89%); color: hsl(var(--h, 220) 50% 30%); }
.row.selected .av { background: var(--ink) !important; color: var(--bg) !important; }
.row-main { min-width: 0; }
.subj-text { overflow: hidden; text-overflow: ellipsis; }
.snip-line { display: flex; align-items: flex-start; gap: 8px; }
.snip-line .snip { flex: 1; min-width: 0; }
.row-star { all: unset; cursor: pointer; flex: none; padding: 4px; margin: -2px -4px -4px 0; border-radius: 999px; color: var(--dim); transition: color .25s var(--ease), transform .25s var(--ease); }
.row-star svg { width: 17px; height: 17px; display: block; }
.row-star:hover { color: var(--ink); }
.row-star.on { color: var(--amber); }
.row-star:active { transform: scale(.85); }
.row-star:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.list-empty { padding: 48px 24px; color: var(--muted); text-align: center; font-weight: 400; }
.more { margin: 8px auto 16px; display: flex; }

.reader { overflow: auto; overscroll-behavior: contain; }
.reader-empty { height: 100%; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 32px; font-weight: 400; }
.reader-empty b { display: block; color: var(--ink); font-size: clamp(1.5rem, 2.6vw, 2.2rem); letter-spacing: -0.045em; font-weight: 500; margin-bottom: 8px; }
.toolbar { position: sticky; top: 0; z-index: 3; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 16px 20px; background: linear-gradient(var(--bg), transparent); }
.reader .tile-bg { position: absolute; inset: 0; border-radius: inherit; background: var(--glass); pointer-events: none; }
.toolbar .sp { flex: 1; }
.msg { padding: 8px 32px 32px; display: grid; gap: 22px; animation: rise .7s var(--ease) both; }
.msg h1 { font-size: clamp(1.6rem, 3vw, 2.4rem); letter-spacing: -0.045em; overflow-wrap: anywhere; }
.sender { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.sender .av { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: rgba(var(--fg), .1); font-size: 17px; }
.sender .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sender .n small { color: var(--muted); font-weight: 400; font-size: 13.5px; margin-left: 6px; }
.sender .t { color: var(--muted); font-size: 13.5px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sender .d { color: var(--muted); font-size: 13px; font-weight: 400; text-align: right; white-space: nowrap; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 400; background: rgba(var(--fg), .08); color: var(--muted); }
.badge.ok { background: rgba(35, 165, 90, .16); color: var(--green); }
.badge.bad { background: rgba(242, 63, 67, .14); color: var(--red); }
.badge.warn { background: rgba(240, 178, 50, .16); color: var(--amber); }
.banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 14px 12px 18px; border-radius: 18px; background: rgba(var(--fg), .06); font-size: 14px; font-weight: 400; color: var(--muted); }
.banner.bad { background: rgba(242, 63, 67, .1); color: var(--red); }
.banner .btn { padding: 6px 12px; font-size: 13px; }
.body-frame { width: 100%; border: 0; border-radius: 20px; background: #fff; min-height: 120px; display: block; }
.body-text { white-space: pre-wrap; overflow-wrap: anywhere; font-weight: 400; font-size: 15.5px; line-height: 1.65; letter-spacing: -0.01em; }
.body-text a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--dim); }
.body-text .q { color: var(--muted); }
.atts { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.chip { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px; border-radius: 20px; background: var(--glass); box-shadow: inset 0 1px 0 1px var(--edge); transition: background .4s var(--ease), transform .4s var(--ease); min-width: 0; }
.chip:hover { background: var(--glass-hi); transform: translateY(-2px); }
.chip .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(var(--fg), .08); font-size: 11px; text-transform: uppercase; letter-spacing: 0; color: var(--muted); }
.chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.chip small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.chip .x { all: unset; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 999px; }
.chip .x:hover { color: var(--ink); background: rgba(var(--fg), .1); }
.details { font-size: 13px; color: var(--muted); font-weight: 400; display: grid; gap: 4px; padding: 14px 16px; border-radius: 16px; background: rgba(var(--fg), .04); overflow-wrap: anywhere; }

/* Compose */
.compose { position: fixed; right: 24px; bottom: 24px; z-index: 60; width: min(680px, calc(100vw - 32px)); height: min(720px, calc(100dvh - 48px)); display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; border-radius: 28px; background: var(--sheet); -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4); box-shadow: inset 0 0 0 1px rgba(var(--fg), .1), 0 30px 80px rgba(0, 0, 0, .45); animation: sheet-in .6s var(--ease) both; overflow: hidden; }
.compose.min { height: 64px; grid-template-rows: auto; }
.compose.min > :not(.c-head) { display: none; }
.c-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 10px 24px; }
.c-head b { font-size: 17px; letter-spacing: -0.03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-head .acts { display: flex; gap: 4px; }
.c-fields { display: grid; padding: 0 24px; }
.c-line { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 8px; align-items: center; border-bottom: 1px solid var(--line); min-height: 46px; }
.c-line label { color: var(--muted); font-size: 14px; font-weight: 400; }
.c-line input, .c-line select { all: unset; font-weight: 400; padding: 10px 0; min-width: 0; width: 100%; }
.c-line select { cursor: pointer; }
.c-line .toggles { display: flex; gap: 2px; }
.c-line .toggles .btn { padding: 5px 10px; font-size: 13px; }
.c-body { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; padding: 10px 24px 0; }
.fmt { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; min-height: 40px; margin: 0 -6px 6px; padding: 0 0 6px; border-bottom: 1px solid var(--line); }
.fmt .btn { flex: none; width: 36px; height: 36px; padding: 0; color: var(--muted); }
.fmt .btn svg { width: 18px; height: 18px; }
.fmt .btn:hover, .fmt .btn:focus-visible { color: var(--ink); }
.fmt-sep { flex: none; width: 1px; height: 20px; margin: 0 6px; background: var(--line); }
.editor { overflow: auto; outline: none; font-weight: 400; font-size: 15.5px; line-height: 1.6; letter-spacing: -0.01em; padding: 6px 2px 16px; min-height: 0; overflow-wrap: anywhere; }
.editor:empty::before { content: attr(data-placeholder); color: var(--dim); }
.editor blockquote { margin: 8px 0; padding-left: 14px; border-left: 2px solid var(--line); color: var(--muted); }
.editor a { text-decoration: underline; }
.c-atts { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 10px; }
.c-atts .chip { grid-template-columns: minmax(0, 1fr) auto; padding: 8px 8px 8px 14px; border-radius: 14px; max-width: 260px; }
.c-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 14px 18px; border-top: 1px solid var(--line); }
.c-foot .l, .c-foot .r { display: flex; gap: 6px; align-items: center; }
.c-status { color: var(--muted); font-size: 13px; font-weight: 400; }
.send-btn { padding: 11px 22px; font-size: 15px; }
.dropzone { position: absolute; inset: 8px; border-radius: 22px; border: 1.5px dashed var(--muted); display: none; place-items: center; background: var(--sheet); font-size: 18px; z-index: 5; }
.compose.dragging .dropzone { display: grid; }

.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 80; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: center; padding: 11px 12px 11px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 14px; box-shadow: 0 16px 40px rgba(0, 0, 0, .35); animation: rise .5s var(--ease) both; }
.toast.err { background: var(--red); color: #fff; }
.toast .btn { padding: 5px 12px; font-size: 13px; background: rgba(var(--fg), .2); color: inherit; }
:root:not([data-theme="light"]) .toast .btn { background: rgba(0, 0, 0, .12); }

.menu { position: fixed; z-index: 70; min-width: 200px; padding: 6px; border-radius: 18px; background: var(--sheet); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: inset 0 0 0 1px rgba(var(--fg), .1), 0 20px 50px rgba(0, 0, 0, .4); animation: rise .35s var(--ease) both; display: grid; }
.menu button { all: unset; cursor: pointer; padding: 9px 12px; border-radius: 12px; font-size: 14px; font-weight: 400; }
.menu button:hover, .menu button:focus-visible { background: rgba(var(--fg), .08); }
.kbd-help { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(0, 0, 0, .5); animation: fade .3s var(--ease) both; }
.kbd-help .tile { width: min(520px, calc(100vw - 32px)); padding: 28px 30px; background: var(--sheet); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); display: grid; gap: 14px; }
.kbd-help h2 { font-size: 24px; }
.kbd-help dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; font-weight: 400; }
.kbd-help dt { font-family: var(--f-mono); font-size: 13px; padding: 2px 8px; border-radius: 8px; background: rgba(var(--fg), .1); justify-self: start; }
.kbd-help dd { margin: 0; color: var(--muted); }

.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--dim); border-top-color: var(--ink); animation: spin .8s linear infinite; }
.loading { display: grid; place-items: center; padding: 48px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); filter: blur(6px); } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(30px) scale(.97); filter: blur(10px); } }
@keyframes fade { from { opacity: 0; } }
.split-in .ch { display: inline-block; animation: word-in 1s var(--ease) both; white-space: pre; }
@keyframes word-in { from { opacity: 0; transform: translateY(40%); filter: blur(8px); } }

.back-btn { display: none; }

.acct { all: unset; cursor: pointer; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; background: hsl(var(--h, 260) 45% 42%); color: #fff; transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.acct:hover { box-shadow: 0 0 0 3px rgba(var(--fg), .14); }
.acct:active { transform: scale(.94); }
.acct:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.side-links { display: grid; gap: 2px; padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--line); }
.menu-title { padding: 8px 12px 6px; font-size: 12.5px; color: var(--muted); font-weight: 400; border-bottom: 1px solid var(--line); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.settings { display: none; overflow: auto; overscroll-behavior: contain; grid-column: 2 / -1; padding: 0 0 40px; }
.panes[data-view="settings"] .settings { display: block; }
.panes[data-view="settings"] .list, .panes[data-view="settings"] .reader { display: none; }
.set-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 22px 28px 16px; background: linear-gradient(var(--bg) 60%, transparent); }
.set-head h1 { font-size: clamp(1.8rem, 3vw, 2.6rem); letter-spacing: -0.05em; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 16px; padding: 4px 24px 24px; align-items: start; }
.set-card { display: grid; gap: 16px; padding: 26px 26px 24px; border-radius: 28px; background: rgba(var(--fg), .04); box-shadow: inset 0 1px 0 1px var(--edge); animation: rise .6s var(--ease) both; min-width: 0; }
.set-card h2 { font-size: 1.35rem; letter-spacing: -0.04em; }
.set-desc { color: var(--muted); font-weight: 400; font-size: 14.5px; margin-top: -10px; line-height: 1.5; }
.set-body { display: grid; gap: 14px; min-width: 0; }
.set-body textarea.input { resize: vertical; min-height: 110px; line-height: 1.55; font-family: inherit; }
.set-body select.input { cursor: pointer; }
.hint { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.set-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.set-list { display: grid; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.set-list .set-row:last-of-type { border-bottom: 0; }
.set-row-main { display: grid; gap: 2px; min-width: 0; font-weight: 400; overflow-wrap: anywhere; }
.set-row-main b { font-weight: 500; }
.set-row-main small { color: var(--muted); font-size: 13px; }
.set-row-acts { display: flex; gap: 4px; flex: none; }
.set-row .btn { padding: 7px 12px; font-size: 13.5px; flex: none; }
.who-preview { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 20px; background: rgba(var(--fg), .05); }
.who-preview .av { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; background: hsl(var(--h, 220) 34% 24%); color: hsl(var(--h, 220) 85% 84%); flex: none; }
:root[data-theme="light"] .who-preview .av { background: hsl(var(--h, 220) 75% 89%); color: hsl(var(--h, 220) 50% 30%); }
.who-preview span { display: grid; min-width: 0; }
.who-preview small { color: var(--muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.inline-add { display: flex; gap: 8px; align-items: stretch; }
.addr-in { flex: 1; display: flex; align-items: center; border-radius: 14px; background: rgba(var(--fg), .05); box-shadow: inset 0 0 0 1px rgba(var(--fg), .12); padding-right: 14px; min-width: 0; }
.addr-in input { box-shadow: none !important; background: transparent !important; min-width: 0; }
.addr-in span { color: var(--muted); font-weight: 400; white-space: nowrap; }
.rule-form { display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px; align-items: center; }
.rule-form .input { padding: 10px 12px; }
.rule-form > input { grid-column: 2 / -1; }
.rule-form > .rule-word:nth-of-type(2) { grid-column: 1; }
.rule-form > select:nth-of-type(3) { grid-column: 2; }
.rule-form > select:nth-of-type(4) { grid-column: 3; }
.rule-form > .btn { grid-column: 1 / -1; justify-self: start; }
.rule-word { color: var(--muted); font-weight: 400; font-size: 14px; padding-right: 2px; }
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px; background: rgba(var(--fg), .07); justify-self: start; }
.seg button { all: unset; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; padding: 8px 16px; border-radius: 999px; font-size: 14px; color: var(--muted); transition: background .3s var(--ease), color .3s var(--ease); }
.seg button svg { width: 16px; height: 16px; }
.seg button.on { background: var(--ink); color: var(--bg); }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 18px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 400; font-size: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.kv dd { margin: 0; display: flex; gap: 10px; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; font-size: 14.5px; }
.kv dt:last-of-type, .kv dd:last-of-type { border-bottom: 0; }
.copy { all: unset; cursor: pointer; font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: rgba(var(--fg), .08); color: var(--muted); flex: none; }
.copy:hover { color: var(--ink); }

.c-line { position: relative; }
.suggest { position: absolute; left: 56px; right: 0; top: calc(100% + 4px); z-index: 10; display: grid; padding: 6px; border-radius: 18px; background: var(--sheet); box-shadow: inset 0 0 0 1px rgba(var(--fg), .1), 0 18px 40px rgba(0, 0, 0, .4); animation: rise .25s var(--ease) both; }
.suggest-row { all: unset; cursor: pointer; display: flex; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 12px; min-width: 0; }
.suggest-row.on, .suggest-row:hover { background: rgba(var(--fg), .08); }
.suggest-row .av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; flex: none; background: hsl(var(--h, 220) 34% 24%); color: hsl(var(--h, 220) 85% 84%); }
:root[data-theme="light"] .suggest-row .av { background: hsl(var(--h, 220) 75% 89%); color: hsl(var(--h, 220) 50% 30%); }
.suggest-main { display: grid; min-width: 0; }
.suggest-main b { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-main small { color: var(--muted); font-size: 12.5px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor .sig { color: var(--muted); }
.attach-btn span { font-size: 14px; }

.atts-wrap { display: grid; gap: 12px; padding-top: 6px; border-top: 1px solid var(--line); }
.atts-head { display: flex; gap: 10px; align-items: baseline; font-size: 14px; }
.atts-head .muted { font-weight: 400; font-size: 13px; }
.chip-main { display: grid; min-width: 0; }
.chip-main .nm { display: block; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.thumb { all: unset; cursor: zoom-in; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; background: rgba(var(--fg), .06); box-shadow: inset 0 0 0 1px var(--edge); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s var(--ease); }
.thumb:hover img { transform: scale(1.04); }
.thumb:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.lightbox { position: fixed; inset: 0; z-index: 110; display: grid; grid-template-rows: auto minmax(0, 1fr); background: rgba(0, 0, 0, .9); animation: fade .25s var(--ease) both; color: #fff; }
.lb-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: max(12px, env(safe-area-inset-top, 0px)) 16px 12px 20px; }
.lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; }
.lb-acts { display: flex; gap: 6px; flex: none; }
.lightbox .btn { background: rgba(255, 255, 255, .12); color: #fff; }
.lightbox .btn.ghost { background: transparent; }
.lb-stage { display: grid; place-items: center; padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px)); min-height: 0; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 12px; animation: rise .4s var(--ease) both; }

.row { touch-action: pan-y; }
.row[data-swipe]::before { content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; }
.row.swipe-armed[data-swipe="archive"] { box-shadow: -200px 0 0 0 rgba(35, 165, 90, .35); }
.row.swipe-armed[data-swipe="delete"] { box-shadow: 200px 0 0 0 rgba(242, 63, 67, .35); }

@media (max-width: 1180px) {
  .panes { grid-template-columns: 76px minmax(300px, 380px) minmax(0, 1fr); }
  .side .compose-btn span, .folder .name, .side-foot { display: none; }
  .compose-btn { justify-content: center; padding: 0; }
  .folder { grid-template-columns: 20px; justify-content: center; position: relative; }
  .folder .count { position: absolute; top: 4px; right: 4px; padding: 0 5px; font-size: 10.5px; }
}
@media (max-width: 860px) {
  body { font-size: 15.5px; }
  .app { padding: 0; height: 100dvh; grid-template-rows: minmax(0, 1fr); }
  .app > .topbar { display: none; }
  .panes { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .tile { border-radius: 0; background: transparent; box-shadow: none; }
  :root[data-theme="light"] .tile, :root[data-theme="light"] .folder.active, :root[data-theme="light"] .row.active { box-shadow: none; }
  .m-only { display: inline-flex; }

  .list-head { padding: max(10px, env(safe-area-inset-top, 0px)) 12px 4px; gap: 10px; }
  .search-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px; height: 54px; padding: 0 6px; border-radius: 999px; background: var(--glass-hi); box-shadow: inset 0 1px 0 1px var(--edge); }
  .search-row .search { flex: 1; }
  .search-row .search svg { display: none; }
  .search-row .search input { all: unset; width: 100%; height: 54px; font-size: 16px; font-weight: 400; padding: 0 6px; color: var(--ink); }
  .search-row .search input::placeholder { color: var(--muted); }
  .search-row .btn.icon { width: 44px; height: 44px; padding: 0; box-sizing: border-box; }
  .search-row .btn.icon svg { width: 22px; height: 22px; }
  .acct { all: unset; cursor: pointer; width: 38px; height: 38px; margin-right: 4px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; background: hsl(var(--h, 260) 45% 42%); color: #fff; }
  .acct:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
  .list-title { padding: 6px 6px 0; }
  .list-title h1 { font-size: 15px; letter-spacing: -0.01em; color: var(--muted); font-weight: 500; }
  .filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -12px; padding-inline: 12px; }
  .filters::-webkit-scrollbar { display: none; }
  .filters .btn { padding: 7px 14px; font-size: 14px; }
  .rows { padding: 0 6px calc(110px + env(safe-area-inset-bottom, 0px)); }
  .row { grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 12px 8px 12px 12px; border-radius: 18px; }
  .row .av { width: 44px; height: 44px; border-radius: 50%; font-size: 18px; }
  .row .dot { left: 2px; }
  .row .who { font-size: 16.5px; }
  .row .when { font-size: 13px; }
  .row .subj { font-size: 15.5px; }
  .row .snip { font-size: 14.5px; -webkit-line-clamp: 1; }
  .row-star { padding: 6px; margin: -6px -4px -6px 0; }
  .row-star svg { width: 21px; height: 21px; }
  .row:active { background: rgba(var(--fg), .06); }
  .row.active { background: transparent; box-shadow: none; }

  .side { position: fixed; top: 0; bottom: 0; left: 0; z-index: 50; width: min(320px, 86vw); padding: max(14px, env(safe-area-inset-top, 0px)) 12px calc(14px + env(safe-area-inset-bottom, 0px)); gap: 10px; background: var(--bg); box-shadow: inset -1px 0 0 var(--line), 20px 0 60px rgba(0, 0, 0, .4); border-radius: 0 28px 28px 0; transform: translateX(-105%); transition: transform .45s var(--ease); visibility: hidden; }
  .panes.drawer-open .side { transform: none; visibility: visible; }
  .drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 8px 8px; }
  .side .compose-btn { display: none; }
  .folders { gap: 2px; }
  .folder { grid-template-columns: 22px minmax(0, 1fr) auto; padding: 13px 16px; border-radius: 999px; font-size: 15.5px; justify-content: stretch; }
  .folder svg { width: 21px; height: 21px; }
  .folder .name { display: block; }
  .folder .count { position: static; padding: 1px 9px; font-size: 13px; }
  .folder.active { background: rgba(var(--fg), .12); }
  .side-foot { display: grid; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity .35s var(--ease); }
  .panes.drawer-open .scrim { opacity: 1; pointer-events: auto; }

  .m-fab { position: fixed; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 31; height: 58px; padding: 0 22px 0 18px; gap: 12px; border-radius: 20px; font-size: 16px; box-shadow: 0 14px 34px rgba(0, 0, 0, .45); transition: padding .35s var(--ease), gap .35s var(--ease), transform .3s var(--ease); }
  .m-fab svg { width: 22px; height: 22px; }
  .m-fab span { max-width: 120px; overflow: hidden; transition: max-width .35s var(--ease), opacity .25s; }
  .panes.fab-small .m-fab { padding: 0 18px; gap: 0; }
  .panes.fab-small .m-fab span { max-width: 0; opacity: 0; }

  .panes[data-view="reader"] .m-fab { display: none; }
  .panes[data-view="list"] .reader { display: none; }
  .panes[data-view="reader"] .list { display: none; }
  .panes[data-view="reader"] .reader { position: fixed; inset: 0; z-index: 35; background: var(--bg); }
  .back-btn { display: inline-flex; }
  .toolbar { flex-wrap: nowrap; gap: 2px; padding: max(10px, env(safe-area-inset-top, 0px)) 8px 8px; background: var(--bg); box-shadow: 0 1px 0 var(--line); }
  .toolbar .btn { width: 42px; height: 42px; padding: 0; background: transparent; }
  .toolbar .btn:not(.icon) span { display: none; }
  .toolbar .btn svg { width: 19px; height: 19px; }
  .msg { padding: 18px 16px calc(32px + env(safe-area-inset-bottom, 0px)); gap: 18px; }
  .msg h1 { font-size: 1.75rem; }
  .sender { grid-template-columns: 42px minmax(0, 1fr); row-gap: 2px; }
  .sender .d { grid-column: 2; text-align: left; }
  .body-frame { border-radius: 16px; }
  .body-text { font-size: 16px; }
  .atts { grid-template-columns: minmax(0, 1fr); }

  .compose { inset: 0; width: 100vw; height: 100dvh; border-radius: 0; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); animation: sheet-up .45s var(--ease) both; }
  .compose.min { height: 100dvh; grid-template-rows: auto auto minmax(0, 1fr) auto; }
  .compose.min > :not(.c-head) { display: revert; }
  .c-head { padding: 10px 8px 6px 18px; }
  .c-head .acts .btn:first-child { display: none; }
  .c-fields, .c-body { padding-inline: 16px; }
  .c-line { grid-template-columns: 58px minmax(0, 1fr) auto; }
  .c-line input, .c-line select, .editor { font-size: 16px; }
  .c-line input[aria-label="Your name"] { display: none; }
  .fmt { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; margin-inline: -16px; padding-inline: 10px; }
  .fmt::-webkit-scrollbar { display: none; }
  .c-foot { padding: 10px 12px 12px 16px; }
  .toasts { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); width: calc(100vw - 32px); }
  .toast { justify-content: space-between; }
  .menu { left: 8px !important; right: 8px; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); border-radius: 22px; padding: 8px; }
  .menu button { padding: 13px 14px; font-size: 15.5px; }
  .panes[data-view="settings"] .settings { position: fixed; inset: 0; z-index: 35; background: var(--bg); }
  .panes[data-view="settings"] .m-fab { display: none; }
  .set-head { padding: max(10px, env(safe-area-inset-top, 0px)) 12px 10px; background: var(--bg); box-shadow: 0 1px 0 var(--line); }
  .set-head h1 { font-size: 1.6rem; }
  .set-grid { padding: 12px 12px calc(32px + env(safe-area-inset-bottom, 0px)); gap: 12px; }
  .set-card { padding: 22px 18px 20px; border-radius: 24px; }
  .set-row { flex-wrap: wrap; }
  .rule-form { grid-template-columns: minmax(0, 1fr); }
  .rule-form > * { grid-column: 1 / -1 !important; }
  .rule-word { display: none; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dt { border-bottom: 0; padding-bottom: 0; }
  .side-links .folder .count { display: none; }
  .suggest { left: 0; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lb-acts .btn:not(.icon) { padding: 8px 12px; font-size: 13px; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }

.modal-back { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .25s var(--ease) both; }
.modal-back.closing { animation: fade .2s var(--ease) reverse both; }
.modal { width: min(440px, 100%); display: grid; gap: 14px; padding: 28px 26px 22px; border-radius: 28px; background: var(--sheet); box-shadow: inset 0 0 0 1px rgba(var(--fg), .1), 0 30px 80px rgba(0, 0, 0, .5); animation: modal-in .45s var(--ease) both; }
.modal h2 { font-size: 1.6rem; letter-spacing: -0.045em; }
.modal p { color: var(--muted); font-weight: 400; line-height: 1.5; }
.modal .input { height: 48px; font-size: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; flex-wrap: wrap; }
.modal-actions .btn { padding: 12px 20px; font-size: 15px; }
.modal-actions .btn.danger-fill { background: var(--red); color: #fff; }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.97); filter: blur(8px); } }
@media (max-width: 860px) {
  .modal-back { place-items: end stretch; padding: 0; }
  .modal { width: 100%; border-radius: 28px 28px 0 0; padding: 26px 20px calc(18px + env(safe-area-inset-bottom, 0px)); animation: sheet-up .4s var(--ease) both; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; height: 50px; padding: 0; border-radius: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.send-group { display: inline-flex; align-items: stretch; height: 44px; border-radius: 999px; background: var(--ink); overflow: hidden; }
.send-group .btn { height: auto; border-radius: 0; box-sizing: border-box; }
.send-group .send-btn { padding: 0 16px 0 22px; }
.send-group .sched-btn { width: 42px; padding: 0 4px 0 0; box-shadow: inset 1px 0 0 color-mix(in srgb, var(--bg) 22%, transparent); }
.send-group .sched-btn svg { width: 18px; height: 18px; }
.fmt .tpl-btn { width: auto; padding: 0 12px; gap: 6px; font-size: 13.5px; margin-left: auto; }
.fmt .tpl-btn svg { width: 17px; height: 17px; }
.sched-when { color: var(--amber) !important; }

.thread { display: grid; gap: 8px; padding: 14px; border-radius: 20px; background: rgba(var(--fg), .04); box-shadow: inset 0 0 0 1px var(--edge); }
.thread-head { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13.5px; font-weight: 400; padding: 0 4px 2px; }
.thread-head svg { width: 15px; height: 15px; }
.thread-list { display: grid; gap: 2px; }
.thread-item { all: unset; cursor: pointer; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px 10px; border-radius: 14px; min-width: 0; }
.thread-item:hover, .thread-item:focus-visible { background: rgba(var(--fg), .06); }
.thread-item .av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; background: hsl(var(--h, 220) 34% 24%); color: hsl(var(--h, 220) 85% 84%); }
:root[data-theme="light"] .thread-item .av { background: hsl(var(--h, 220) 75% 89%); color: hsl(var(--h, 220) 50% 30%); }
.thread-main { display: grid; min-width: 0; }
.thread-top { display: flex; justify-content: space-between; gap: 10px; min-width: 0; }
.thread-top b { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-top small { color: var(--muted); font-size: 12.5px; font-weight: 400; white-space: nowrap; }
.thread-snip { color: var(--muted); font-size: 13.5px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-more { all: unset; cursor: pointer; font-size: 13px; color: var(--muted); padding: 6px 10px; border-radius: 999px; justify-self: start; }
.thread-more:hover { color: var(--ink); background: rgba(var(--fg), .06); }

.source .source-wrap { overflow: auto; padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px)); min-height: 0; }
.source-text { margin: 0; padding: 18px; border-radius: 16px; background: #0d0d0f; color: #d6d6d6; font: 12.5px/1.55 var(--f-mono); white-space: pre-wrap; overflow-wrap: anywhere; letter-spacing: 0; }
.kbd-help .tile { max-height: calc(100dvh - 48px); overflow: auto; }

@media print {
  body { background: #fff !important; color: #000 !important; }
  .side, .list, .scrim, .m-fab, .toolbar, .toasts, .topbar, .thread, .banner, .badges, .details, .compose, .menu, .settings { display: none !important; }
  .app, .panes { display: block !important; height: auto !important; padding: 0 !important; }
  .reader { display: block !important; position: static !important; overflow: visible !important; background: #fff !important; box-shadow: none !important; }
  .msg { padding: 0 !important; animation: none !important; color: #000; }
  .sender .av { display: none; }
  .split-in .ch { animation: none !important; }
  .body-frame { box-shadow: none; }
}

.cat-tabs { display: flex; gap: 4px; width: 100%; padding: 4px; border-radius: 16px; background: rgba(var(--fg), .05); margin-bottom: 2px; overflow-x: auto; scrollbar-width: none; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab { all: unset; cursor: pointer; flex: 1; min-width: max-content; display: inline-flex; gap: 6px; align-items: center; justify-content: center; padding: 8px 12px; border-radius: 12px; font-size: 13.5px; color: var(--muted); transition: background .3s var(--ease), color .3s var(--ease); }
.cat-tab svg { width: 15px; height: 15px; }
.cat-tab:hover { color: var(--ink); }
.cat-tab.on { background: var(--glass-hi); color: var(--ink); box-shadow: inset 0 1px 0 1px var(--edge); }
.cat-n { font-size: 11.5px; padding: 0 6px; border-radius: 999px; background: var(--ink); color: var(--bg); line-height: 17px; }
.label-filter { position: relative; padding-left: 26px !important; }
.label-filter::before { content: ""; position: absolute; left: 11px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--lc); }
.label-filter.on { background: color-mix(in srgb, var(--lc) 26%, transparent); color: var(--ink); }
.label-chips { display: inline-flex; gap: 4px; flex: none; }
.label-chip { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500; letter-spacing: 0; color: color-mix(in srgb, var(--lc) 70%, var(--ink)); background: color-mix(in srgb, var(--lc) 20%, transparent); white-space: nowrap; }
.msg > .label-chips { margin-top: -10px; }
.chip-cal { flex: none; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: rgba(62, 199, 214, .18); color: #3ec7d6; letter-spacing: 0; }
.swatches { display: inline-flex; gap: 4px; margin-right: 4px; }
.swatch { all: unset; cursor: pointer; width: 16px; height: 16px; border-radius: 50%; background: var(--sc); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .15); }
.swatch.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--sc); }
.meter { height: 10px; border-radius: 999px; background: rgba(var(--fg), .08); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: inherit; background: var(--ink); transition: width 1s var(--ease); }
.meter.warn span { background: var(--amber); }
.meter-head { display: flex; gap: 10px; align-items: baseline; }
.meter-head b { font-size: 1.4rem; letter-spacing: -0.03em; }
.sub-head { font-size: 14px; margin-top: 6px; }
.set-row a.btn { padding: 7px 12px; font-size: 13.5px; }
.set-row a.btn svg { width: 15px; height: 15px; }

.invite { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 18px; border-radius: 20px; background: rgba(62, 199, 214, .08); box-shadow: inset 0 0 0 1px rgba(62, 199, 214, .25); }
.inv-date { width: 54px; height: 58px; border-radius: 14px; display: grid; place-items: center; align-content: center; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
.inv-date small { font-size: 11px; color: #3ec7d6; letter-spacing: .04em; }
.inv-date b { font-size: 22px; line-height: 1; }
.inv-main { display: grid; gap: 2px; min-width: 0; font-size: 14px; font-weight: 400; }
.inv-kind { font-size: 12px; color: #3ec7d6; text-transform: uppercase; letter-spacing: .05em; }
.inv-title { font-size: 16.5px; font-weight: 500; overflow-wrap: anywhere; }


.drag-ghost { position: fixed; top: -100px; left: 0; padding: 8px 14px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 13.5px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.dragging-mail .folder { outline: 1px dashed transparent; }
.folder.drop-on { background: color-mix(in srgb, var(--green) 25%, transparent) !important; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--green); }

body.compact .row { padding-block: 8px; gap: 10px; }
body.compact .row .av { width: 30px; height: 30px; font-size: 13px; border-radius: 50%; }
body.compact .row { grid-template-columns: 30px minmax(0, 1fr); }
body.compact .row .snip { -webkit-line-clamp: 1; font-size: 13px; }

@media (max-width: 860px) {
  .invite { grid-template-columns: auto minmax(0, 1fr); }
  .invite > .btn { grid-column: 1 / -1; justify-self: start; }
  .cat-tab span:not(.cat-n) { font-size: 13px; }
  .swatches { display: none; }
}

.codes-box { display: grid; gap: 12px; padding: 18px; border-radius: 18px; background: rgba(var(--fg), .05); box-shadow: inset 0 0 0 1px var(--line); animation: rise .4s var(--ease) both; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; margin: 0; padding-left: 22px; font: 15px/1.6 var(--f-mono); letter-spacing: .02em; }
.steps { display: grid; gap: 10px; margin: 0; padding-left: 20px; font-weight: 400; font-size: 14.5px; }
.steps .key { display: block; margin-top: 6px; padding: 10px 12px; border-radius: 10px; background: rgba(var(--fg), .08); font: 15px var(--f-mono); letter-spacing: .08em; word-break: break-all; user-select: all; }
.link { text-decoration: underline; text-underline-offset: 3px; }
.act-bad { color: var(--red); }
.activity .set-row small.muted { white-space: nowrap; font-size: 12.5px; font-weight: 400; }

.modal-form { display: grid; gap: 12px; }
.modal-form textarea.input { resize: vertical; font-family: inherit; }
.contacts-wrap { display: grid; gap: 14px; padding: 4px 28px 40px; max-width: 860px; }
.contact-list { display: grid; }
.contact-letter { position: sticky; top: 76px; z-index: 1; padding: 14px 4px 6px; font-size: 13px; color: var(--muted); background: linear-gradient(var(--bg) 70%, transparent); }
.contact-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.contact-row .av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: hsl(var(--h, 220) 34% 24%); color: hsl(var(--h, 220) 85% 84%); }
:root[data-theme="light"] .contact-row .av { background: hsl(var(--h, 220) 75% 89%); color: hsl(var(--h, 220) 50% 30%); }
.contact-row .set-row-acts .btn { padding: 7px 12px; font-size: 13.5px; }
.contact-row .set-row-acts .btn.icon { width: 34px; height: 34px; padding: 0; box-sizing: border-box; }
.set-head .btn, .set-head a.btn { padding: 8px 14px; font-size: 14px; }
.pop { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; padding: 8px; min-width: 0; width: max-content; }
.colour-pop { grid-template-columns: repeat(8, 1fr); gap: 6px; padding: 10px; }
.colour-pop .swatch { width: 22px; height: 22px; }
.emoji { all: unset; cursor: pointer; width: 36px; height: 36px; display: grid; place-items: center; font-size: 20px; border-radius: 10px; }
.emoji:hover, .emoji:focus-visible { background: rgba(var(--fg), .1); }
@media (max-width: 860px) {
  .contacts-wrap { padding: 12px 12px 40px; }
  .contact-letter { top: 60px; }
  .contact-row { grid-template-columns: 40px minmax(0, 1fr); }
  .contact-row .set-row-acts { grid-column: 2; }
  .set-head { flex-wrap: wrap; }
  .pop { left: 8px !important; right: 8px; top: auto !important; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); width: auto; grid-template-columns: repeat(8, 1fr); }
}

.ptr { height: 0; overflow: hidden; display: grid; place-items: center; transition: height .3s var(--ease); color: var(--muted); }
.ptr svg { width: 22px; height: 22px; transition: color .2s; }
.ptr.armed svg { color: var(--ink); }
.ptr.spinning svg { animation: spin .8s linear infinite; }
@media (min-width: 861px) { .ptr { display: none; } }
.cats { min-width: 0; }
.toolbar .narrow { display: none; }
@keyframes qrpulse { 50% { opacity: .4; } }
@media (max-width: 860px) {
  .toolbar .wide { display: none !important; }
  .toolbar .narrow { display: inline-grid; place-items: center; }
  .toolbar { gap: 6px; }
  .cat-tabs { margin-bottom: 0; }
  .cat-tab { padding: 8px 10px; }
}

.quick-reply { display: grid; gap: 12px; margin-top: 8px; }
.qr-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-inline: -2px; padding: 2px 28px 2px 2px; mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); }
.qr-chips::-webkit-scrollbar { display: none; }
.qr-chip { all: unset; cursor: pointer; flex: none; max-width: 80%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 9px 16px; border-radius: 999px; font-size: 14px; color: var(--ink); box-shadow: inset 0 0 0 1px rgba(var(--fg), .2); transition: background .25s var(--ease), box-shadow .25s var(--ease); animation: rise .45s var(--ease) both; }
.qr-chip:hover, .qr-chip:focus-visible { background: rgba(var(--fg), .08); box-shadow: inset 0 0 0 1px rgba(var(--fg), .35); }
.qr-chip:active { background: rgba(var(--fg), .14); }
.quick-reply.typing .qr-chips { display: none; }
.qr-wait { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); padding: 9px 2px; animation: qrpulse 1.4s ease-in-out infinite; }
.qr-wait svg { width: 16px; height: 16px; }
.qr-box { display: flex; align-items: flex-end; gap: 6px; padding: 6px 6px 6px 18px; border-radius: 26px; background: rgba(var(--fg), .06); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .25s var(--ease), background .25s var(--ease); }
.qr-box:focus-within { background: rgba(var(--fg), .08); box-shadow: inset 0 0 0 1px rgba(var(--fg), .3); }
.qr-text { all: unset; flex: 1; min-width: 0; min-height: 24px; max-height: 240px; padding: 10px 0; font: inherit; font-size: 15px; font-weight: 400; line-height: 1.5; color: var(--ink); resize: none; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.qr-text::placeholder { color: var(--muted); }
.qr-tools { display: flex; gap: 2px; flex: none; }
.qr-expand, .qr-send { all: unset; cursor: pointer; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); transition: background .25s var(--ease), color .25s var(--ease), opacity .25s var(--ease); }
.qr-expand svg, .qr-send svg { width: 19px; height: 19px; }
.qr-expand:hover, .qr-expand:focus-visible { background: rgba(var(--fg), .1); color: var(--ink); }
.qr-send:not(:disabled) { background: var(--ink); color: var(--bg); }
.qr-send:disabled { cursor: default; opacity: .45; }
.qr-send:focus-visible, .qr-expand:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.addr-pick { position: relative; display: flex; align-items: center; flex: none; max-width: 60%; color: var(--muted); }
.addr-pick select { all: unset; cursor: pointer; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 12px 22px 12px 4px; font-weight: 400; color: var(--muted); }
.addr-pick select:focus-visible { color: var(--ink); }
.addr-pick select option { color: initial; }
.addr-pick svg { position: absolute; right: 0; width: 16px; height: 16px; pointer-events: none; }
@media (max-width: 860px) {
  .fmt .tpl-btn { width: 36px; padding: 0; margin-left: 0; }
  .fmt .tpl-btn span { display: none; }
}
.c-top { display: grid; min-width: 0; }
.fmt .ai-btn { color: var(--ink); }
.fmt .ai-btn.on { background: rgba(var(--fg), .12); }
.ai-panel { display: grid; gap: 8px; padding: 2px 0 12px; animation: rise .35s var(--ease) both; }
.ai-panel[hidden] { display: none; }
.ai-box { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 22px; background: rgba(var(--fg), .06); box-shadow: inset 0 0 0 1px rgba(var(--fg), .2); }
.ai-box:focus-within { box-shadow: inset 0 0 0 1px rgba(var(--fg), .4); }
.ai-box > svg { flex: none; width: 18px; height: 18px; margin-bottom: 11px; color: var(--muted); }
.ai-in { all: unset; flex: 1; min-width: 0; min-height: 22px; max-height: 120px; padding: 9px 0; font: inherit; font-size: 15px; font-weight: 400; line-height: 1.45; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; overflow-y: auto; field-sizing: content; }
.ai-in::placeholder { color: var(--muted); }
.ai-go { all: unset; cursor: pointer; flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: var(--bg); transition: opacity .25s var(--ease); }
.ai-go svg { width: 17px; height: 17px; }
.ai-go:disabled { opacity: .45; cursor: default; }
.ai-panel.busy .ai-box > svg { color: var(--ink); animation: qrpulse 1.2s ease-in-out infinite; }
.ai-foot { display: flex; align-items: center; gap: 8px; min-height: 0; overflow-x: auto; scrollbar-width: none; }
.ai-foot:empty { display: none; }
.ai-foot::-webkit-scrollbar { display: none; }
.ai-tones { display: flex; gap: 6px; flex: none; }
.ai-tones .qr-chip { padding: 7px 13px; font-size: 13.5px; }
.ai-note { flex: none; color: var(--muted); font-size: 13px; font-weight: 400; }
.ai-panel.busy .ai-note { animation: qrpulse 1.2s ease-in-out infinite; }
.ai-undo { flex: none; padding: 6px 12px; font-size: 13px; margin-left: auto; }
