/* Почта: три колонки на ПК (папки · список · письмо), одна на телефоне. Светлая и тёмная темы — по системе. */
:root {
  --bg: #f6f7f9; --side: #eef0f4; --panel: #ffffff; --raise: #ffffff; --line: #e4e7ec; --line2: #eef0f3;
  --text: #171a1f; --muted: #667085; --faint: #98a2b3; --hover: #f2f4f7; --press: #e9ecf1;
  --accent: #3d5bdb; --accent-h: #3350c9; --accent-text: #fff; --accent-soft: #eaefff; --sel: #e6ecff;
  --ok: #12805c; --ok-soft: #e7f6ef; --bad: #c4321f; --bad-soft: #fdeeeb; --claude: #b4532a; --claude-soft: #fbf0ea;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .06);
  --r: 10px; --r-sm: 7px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101217; --side: #0c0e12; --panel: #161920; --raise: #1c2029; --line: #262b35; --line2: #1f232c;
    --text: #e6e8ec; --muted: #9aa3b2; --faint: #6b7385; --hover: #1d212a; --press: #252a35;
    --accent: #7c95ff; --accent-h: #91a6ff; --accent-text: #0b1020; --accent-soft: #1b2442; --sel: #1d2747;
    --ok: #4cc79a; --ok-soft: #12291f; --bad: #ff8a78; --bad-soft: #2d1714; --claude: #f0a27c; --claude-soft: #2b1b13;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.grow { flex: 1; }
kbd { font: 600 11px/1 var(--font); padding: 3px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--panel); color: var(--muted); }

/* кнопки и поля */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-weight: 500; white-space: nowrap; box-shadow: var(--shadow); transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); }
.btn:active { background: var(--press); }
.btn .i { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-h); border-color: var(--accent-h); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.danger { color: var(--bad); }
.btn.wide { width: 100%; justify-content: center; height: 40px; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.link { border: 0; background: none; padding: 0; color: var(--accent); display: inline-flex; align-items: center; gap: 5px; }
.link .i { width: 15px; height: 15px; }
input, select, textarea { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; outline: none; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; }
label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; }
label.check { display: flex; gap: 9px; align-items: flex-start; color: var(--text); font-weight: 400; font-size: 14px; }
label.check input { width: auto; margin-top: 3px; box-shadow: none; }

/* вход */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.login-card { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px 24px;
  box-shadow: var(--shadow-lg); display: grid; gap: 12px; text-align: center; }
.login-card h1 { margin: 4px 0 0; font-size: 22px; }
.login-card p { margin: 0 0 8px; }
.logo-lg { justify-self: center; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--accent); color: var(--accent-text); }
.logo-lg .i { width: 26px; height: 26px; }
.err { color: var(--bad); margin: 0; min-height: 1.2em; font-size: 13px; }

/* раскладка */
.app { height: 100vh; height: 100dvh; display: grid; grid-template-columns: 248px minmax(320px, 400px) minmax(0, 1fr); overflow: hidden; overflow: clip; }
.app.wide { grid-template-columns: 248px minmax(0, 1fr); }
.app.wide .listpane { display: none; }

/* боковая панель */
.side { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 10px 10px; gap: 4px; overflow: hidden auto; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 2px 8px 12px; }
.logo { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent); color: var(--accent-text); }
.logo .i { width: 16px; height: 16px; }
.compose { justify-content: center; height: 40px; margin: 0 2px 12px; font-weight: 600; }
.nav { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
.nav-item, .nav-btn { display: flex; align-items: center; gap: 11px; width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text); text-align: left; font-size: 14px; }
.nav-item:hover, .nav-btn:hover { background: var(--hover); }
.nav-item.on { background: var(--sel); color: var(--accent); font-weight: 600; }
.nav-item .i, .nav-btn .i { color: var(--muted); }
.nav-item.on .i { color: var(--accent); }
.nav-item span, .nav-btn span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item b { font-size: 12px; font-weight: 700; color: var(--text); }
.nav-item.on b { color: var(--accent); }
.nav-item .spark .i { width: 15px; height: 15px; color: var(--claude); }
.nav-item .warn, .warn { color: var(--bad); width: 16px; height: 16px; }
.side-h { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 18px 10px 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; margin: 0 4px; }
.dot.all { background: conic-gradient(#3d5bdb 0 33%, #16a34a 0 66%, #d97706 0); }
.accs .nav-item { font-size: 13px; }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 1px; }
.nav-btn { color: var(--muted); font-size: 13px; }
.nav-btn small { color: var(--faint); font-size: 11px; }
.spin .i { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.scrim { display: none; }

/* список */
.listpane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.listhead { display: flex; align-items: center; gap: 6px; padding: 12px 12px 6px; }
.menu-btn { display: none; }
.search { flex: 1; position: relative; }
.search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; height: 16px; pointer-events: none; }
.search input { padding-left: 34px; height: 38px; background: var(--bg); border-color: transparent; border-radius: 9px; }
.search input:focus { background: var(--panel); }
.listbar { display: flex; align-items: center; gap: 10px; padding: 8px 16px 10px; border-bottom: 1px solid var(--line2); }
.listbar h1 { font-size: 18px; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.01em; }
.seg { display: inline-flex; background: var(--bg); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: none; padding: 4px 10px; border-radius: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.list { flex: 1; overflow-y: auto; overscroll-behavior: contain; outline: none; }
.day { position: sticky; top: 0; z-index: 1; padding: 10px 16px 4px; font-size: 11.5px; font-weight: 600; color: var(--faint); background: var(--panel); }
.row { display: flex; gap: 12px; padding: 10px 14px 10px 16px; color: var(--text); position: relative; border-radius: 0; }
.row:hover { background: var(--hover); }
.row.sel { background: var(--sel); }
.row.unread::before { content: ""; position: absolute; left: 6px; top: 22px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.rb { flex: 1; min-width: 0; display: grid; gap: 1px; }
.r1, .r2 { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.who, .subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.who { flex: 1; font-weight: 500; }
.date { font-size: 12px; color: var(--faint); flex: none; }
.subj { color: var(--text); }
.r2 .att { width: 14px; height: 14px; color: var(--faint); align-self: center; }
.r3 { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.unread .who, .row.unread .subj { font-weight: 700; }
.row.unread .date { color: var(--accent); font-weight: 600; }
.row:not(.unread) .who { color: var(--muted); }
.tag { flex: none; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 5px; background: var(--bg); color: var(--muted); }
.tag.claude { background: var(--claude-soft); color: var(--claude); }

/* аватарки */
.av { position: relative; flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; letter-spacing: .02em; color: hsl(var(--h) 45% 32%); background: hsl(var(--h) 70% 90%); }
.av i { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--panel); }
.av.big { width: 44px; height: 44px; font-size: 15px; }
.draft-av { background: var(--bg); color: var(--muted); }
.row.claude .draft-av { background: var(--claude-soft); color: var(--claude); }
@media (prefers-color-scheme: dark) { .av { color: hsl(var(--h) 70% 82%); background: hsl(var(--h) 30% 24%); } }

/* загрузка, пусто */
.skel .srow { display: flex; gap: 12px; padding: 12px 16px; }
.skel i { width: 36px; height: 36px; border-radius: 50%; background: var(--line2); }
.skel div { flex: 1; display: grid; gap: 7px; }
.skel b, .skel-r b { display: block; height: 10px; border-radius: 5px; background: var(--line2); animation: pulse 1.2s ease-in-out infinite; }
.skel b:nth-child(1) { width: 45%; } .skel b:nth-child(2) { width: 80%; } .skel b:nth-child(3) { width: 65%; }
.skel-r { padding: 28px; display: grid; gap: 14px; }
.skel-r b:first-child { height: 22px; width: 60%; } .skel-r b:nth-child(2) { width: 35%; } .skel-r b:nth-child(n+3) { width: 90%; }
@keyframes pulse { 50% { opacity: .45; } }
.empty { display: grid; justify-items: center; gap: 8px; padding: 64px 24px; text-align: center; color: var(--muted); }
.empty .i { width: 40px; height: 40px; stroke-width: 1.3; color: var(--faint); }
.empty p { margin: 4px 0 0; font-size: 15px; color: var(--text); font-weight: 500; }
.empty.small { padding: 24px; }

/* письмо */
.reader { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.reader-empty { margin: auto; display: grid; justify-items: center; gap: 10px; color: var(--muted); text-align: center; padding: 24px; }
.reader-empty .i { width: 56px; height: 56px; stroke-width: 1.1; color: var(--faint); }
.reader-empty p { margin: 0; font-size: 15px; }
.rtool { display: flex; align-items: center; gap: 2px; min-height: 54px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.rtool .back { display: none; }
.rtitle { font-weight: 600; font-size: 15px; padding: 0 6px; }
.rscroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 22px 28px 48px; }
.rhead { max-width: 820px; margin: 0 auto 14px; }
.rhead h1 { font-size: 21px; line-height: 1.3; margin: 0 0 8px; letter-spacing: -.015em; overflow-wrap: anywhere; }
.rsub { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.pill { display: inline-flex; align-items: center; gap: 2px; padding: 2px 9px 2px 5px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.thread { max-width: 820px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card.closed { display: flex; align-items: center; gap: 12px; padding: 11px 16px; cursor: pointer; }
.card.closed:hover { border-color: var(--faint); }
.card.closed .cmeta { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: baseline; }
.card.closed .snip { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.card.closed .av { width: 30px; height: 30px; font-size: 11.5px; }
.card.loading { opacity: .6; }
.card.open { padding: 18px 22px 20px; }
.chead { display: flex; gap: 12px; align-items: flex-start; }
.chead .cmeta { flex: 1; min-width: 0; }
.cfrom { overflow-wrap: anywhere; }
.cfrom .muted { font-size: 13px; }
.to-toggle { font-size: 13px; color: var(--muted); margin-top: 1px; }
.to-toggle .i { width: 13px; height: 13px; }
.cdate { font-size: 12.5px; color: var(--faint); flex: none; white-space: nowrap; padding-top: 2px; }
.details { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 12px 0 0 48px; padding: 10px 12px; background: var(--bg); border-radius: var(--r-sm); font-size: 13px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.cbody { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.6; margin: 16px 0 0 48px; }
.dots { display: block; margin: 8px 0; border: 1px solid var(--line); background: var(--bg); color: var(--muted); border-radius: 6px; padding: 0 8px; line-height: 16px; font-size: 13px; letter-spacing: 2px; }
.dots:hover { background: var(--hover); }
.quoted { color: var(--muted); border-left: 3px solid var(--line); padding-left: 12px; }
.more-text { margin: 10px 0 0 48px; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0 48px; }
.att-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); }
.att-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.att-chip .i { width: 16px; height: 16px; color: var(--muted); }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.att-size { color: var(--faint); font-size: 12px; flex: none; }
.att-chip.busy { border-color: var(--accent); }
.cfoot { margin: 14px 0 0 48px; font-size: 13px; }
iframe.html { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; margin-top: 12px; }

.replyzone { max-width: 820px; margin: 16px auto 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.replybar { display: flex; gap: 8px; flex-wrap: wrap; }
.reply-editor { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 14px 18px; }

/* заметки */
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r-sm); background: var(--accent-soft); font-size: 13.5px; }
.note > .i { margin-top: 1px; }
.note > div { flex: 1; overflow-wrap: anywhere; }
.note.bad { background: var(--bad-soft); color: var(--bad); }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.note.claude { background: var(--claude-soft); }
.note.claude > .i { color: var(--claude); }
.note .btn { height: 30px; }

/* редактор */
.compose-wrap { max-width: 820px; margin: 0 auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 20px; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.editor .note { margin-bottom: 10px; }
.erow { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line2); min-height: 42px; }
.erow > label { width: 56px; flex: none; font-weight: 500; }
.erow input, .erow select { border: 0; box-shadow: none !important; padding: 9px 0; background: transparent; }
.erow select { padding-left: 0; cursor: pointer; }
.ac { flex: 1; position: relative; }
.cc-btn { font-size: 13px; flex: none; }
.editor textarea { border: 0; box-shadow: none !important; padding: 14px 0; min-height: 180px; font-size: 15px; line-height: 1.6; background: transparent; resize: none; }
.editor.compact textarea { min-height: 130px; }
.efoot { display: flex; align-items: center; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line2); }
.kbd-hint { font-size: 12px; color: var(--faint); }
.saved { font-size: 12.5px; color: var(--faint); display: inline-flex; align-items: center; gap: 4px; }
.saved .i { width: 14px; height: 14px; color: var(--ok); }
.editor.sending { opacity: .6; pointer-events: none; }
.suggest { position: absolute; z-index: 20; left: -8px; right: 0; top: 100%; margin-top: 2px; background: var(--raise); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 4px; max-width: 420px; }
.suggest button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 7px 8px; border-radius: var(--r-sm); text-align: left; }
.suggest button.on, .suggest button:hover { background: var(--hover); }
.suggest .av { width: 28px; height: 28px; font-size: 11px; }
.suggest span:last-child { display: grid; min-width: 0; }
.suggest b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* настройки */
.page { max-width: 880px; margin: 0 auto; }
.page h2 { font-size: 16px; margin: 30px 0 12px; }
.lead { color: var(--muted); margin: 0 0 18px; font-size: 14px; max-width: 640px; }
.acc-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.acard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 18px; display: grid; gap: 12px; }
.acard-h { display: flex; align-items: center; gap: 14px; }
.acard-t { flex: 1; min-width: 0; display: grid; }
.acard-t b { font-size: 15px; overflow-wrap: anywhere; }
.acard-t small { color: var(--muted); }
.status { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; background: var(--bg); color: var(--muted); flex: none; }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.bad { background: var(--bad-soft); color: var(--bad); }
.acard-s { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); }
.acard-s b { color: var(--text); }
.acard-a, .arow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.aedit { display: grid; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line2); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tile { display: grid; justify-items: start; gap: 2px; padding: 14px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.tile:hover { border-color: var(--faint); }
.tile.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tile small { color: var(--muted); font-size: 12.5px; }
.tile-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--c); margin-bottom: 8px; }
.card.add-form { margin-top: 14px; padding: 18px 20px; display: grid; gap: 12px; box-shadow: var(--shadow); }
.help { margin: 0; font-size: 13px; color: var(--muted); background: var(--bg); padding: 10px 12px; border-radius: var(--r-sm); }
.grid2 { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }

/* всплывашки */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 14px;
  background: #1d2129; color: #f2f4f7; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); max-width: calc(100% - 32px); font-size: 14px; animation: rise .18s ease-out; }
.toast.bad { background: #8e2414; }
.toast.ok { background: #0f6b4c; }
.toast button { border: 0; background: none; color: #a9bbff; font-weight: 700; padding: 0; }
@keyframes rise { from { transform: translate(-50%, 8px); opacity: 0; } }
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(10, 12, 18, .45); display: grid; place-items: center; padding: 16px; }
.modal-card { width: min(440px, 100%); background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 18px 22px 22px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; }
.modal-h h2 { font-size: 17px; margin: 0; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 16px 0 0; align-items: center; }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; color: var(--muted); }
.fab { display: none; }

/* планшет: панель папок выезжает */
@media (max-width: 1100px) {
  .app { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
  .app.wide { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 30; inset: 0 auto 0 0; width: 272px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .app.side-open .side { transform: none; }
  .app.side-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(10, 12, 18, .4); }
  .menu-btn { display: inline-grid; }
  .app.wide .rtool .back { display: inline-grid; }
}

/* телефон: одна колонка — список или письмо */
@media (max-width: 760px) {
  .app, .app.wide { grid-template-columns: minmax(0, 1fr); }
  .reader { display: none; }
  .app.reading .listpane { display: none; }
  .app.reading .reader { display: flex; }
  .rtool .back { display: inline-grid; }
  .rtool { position: sticky; top: 0; z-index: 2; padding: 8px 10px; min-height: 50px; }
  .rscroll { padding: 16px 12px 90px; }
  .rhead h1 { font-size: 19px; }
  .card.open { padding: 14px 14px 16px; }
  .cbody, .atts, .cfoot, .more-text { margin-left: 0; }
  .details { margin-left: 0; }
  .compose-wrap { padding: 12px 14px; border-radius: var(--r); }
  .fab { display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 20;
    width: 56px; height: 56px; border-radius: 18px; background: var(--accent); color: var(--accent-text); box-shadow: var(--shadow-lg); }
  .fab .i { width: 22px; height: 22px; }
  .app.reading .fab { display: none; }
  .listbar { padding: 6px 14px 10px; }
  .row { padding: 11px 14px 11px 16px; }
  .kbd-hint { display: none; }
  .grid2 { grid-template-columns: 1fr 90px; }
  .toast { bottom: calc(16px + env(safe-area-inset-bottom)); }
}
