/* 1Mail web — direction C «Разговоры»: cards on paper, conversation as a thread, docked composer */
:root { --bubble: #F5F3EE; --bubble-mine: #EEF6DF; --card: #FFFFFF; --shadow: 0 1px 0 #E6E9E7; --radius: 16px; }
[data-theme="dark"] { --bubble: #1F3038; --bubble-mine: #22382F; --card: #18272F; --shadow: 0 1px 0 #0D171C; }
html, body { height: 100%; }
body { overflow: hidden; background: var(--canvas); }
.btn { border-radius: 12px; }
.btn:focus-visible, .qchip:focus-visible, .card:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--canvas), 0 0 0 4px var(--teal); }

/* ---------- Shell ---------- */
.shell { height: 100vh; height: 100dvh; display: grid; grid-template-rows: 76px 1fr; grid-template-columns: 248px 1fr; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 0 20px 0 0; }
.topbar .brand { width: 248px; padding-left: 26px; flex: none; }
.topbar .brand b { font-size: 25px; } .topbar .brand img { width: 30px; height: 30px; }
.search { position: relative; flex: 1; max-width: 720px; z-index: 30; }
.search > .icon { position: absolute; left: 18px; top: 13px; color: var(--text-muted); pointer-events: none; }
.search input { width: 100%; height: 48px; border-radius: 24px; border: 1px solid transparent; background: var(--card); box-shadow: var(--shadow);
  padding: 0 20px 0 52px; font-size: 14.5px; color: var(--text); }
.search input::placeholder { color: var(--text-muted); }
.search input:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(8,127,118,.12); }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.qchips { display: flex; gap: 8px; }
.qchip { height: 38px; border-radius: 19px; border: 0; background: var(--card); box-shadow: var(--shadow); padding: 0 15px; display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--text); cursor: pointer; transition: background var(--t-quick) var(--ease), color var(--t-quick) var(--ease); }
.qchip:hover { background: var(--hover); }
.qchip[aria-pressed="true"] { background: var(--ink); color: #fff; }
[data-theme="dark"] .qchip[aria-pressed="true"] { background: var(--lime); color: var(--ink); }
.qchip .icon { color: inherit; }
.me-btn { margin-left: auto; border: 0; background: transparent; padding: 0; cursor: pointer; border-radius: 50%; }
.me-btn .av { width: 40px; height: 40px; font-size: 14px; }
.menu-btn { display: none; }

/* Avatars: deterministic colour per sender */
.av { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; flex: none; letter-spacing: .01em; }
.av.lime { background: var(--lime) !important; color: var(--ink); }
.av.xs { width: 22px; height: 22px; font-size: 9px; border: 2px solid var(--card); }

/* ---------- Sidebar ---------- */
.side { display: flex; flex-direction: column; padding: 2px 16px 18px 20px; overflow-y: auto; gap: 0; }
.new-btn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 54px; border-radius: 16px; background: var(--action); color: #fff;
  font-weight: 700; font-size: 15px; text-decoration: none; box-shadow: 0 8px 20px rgba(194,62,44,.22); margin-bottom: 18px; transition: background var(--t-quick) var(--ease); }
.new-btn:hover { background: #AD3626; }
.nav { display: grid; gap: 2px; }
.nav a { position: relative; display: flex; align-items: center; gap: 13px; height: 42px; padding: 0 14px; border-radius: 21px; text-decoration: none; font-size: 14px; color: var(--text); }
.nav a .icon { color: var(--text-muted); width: 20px; height: 20px; }
.nav a:hover { background: rgba(255,255,255,.55); }
[data-theme="dark"] .nav a:hover { background: var(--hover); }
.nav a.active { background: var(--card); box-shadow: var(--shadow); font-weight: 700; }
.nav a.active .icon { color: var(--action); }
[data-theme="dark"] .nav a.active .icon { color: var(--coral); }
.nav a .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a .count { font-size: 12px; font-weight: 700; }
.nav a .more-btn { display: none; width: 30px; height: 30px; margin-right: -8px; border: 0; border-radius: 8px; background: transparent; color: var(--text-muted); cursor: pointer; place-items: center; }
.nav a .more-btn:hover { background: var(--hover); color: var(--text); }
.nav a.has-more:hover .more-btn, .nav a.has-more:focus-within .more-btn, .nav a .more-btn[aria-expanded="true"] { display: grid; }
.nav a.has-more:hover .count { display: none; }
.cats { display: grid; gap: 8px; margin: 20px 0 0; }
.cat { display: flex; align-items: center; gap: 11px; height: 46px; padding: 0 12px; border-radius: 13px; background: rgba(255,255,255,.55); text-decoration: none; font-size: 13.5px; color: var(--text); }
[data-theme="dark"] .cat { background: var(--surface); }
.cat:hover, .cat.active { background: var(--card); box-shadow: var(--shadow); }
.cat.active { font-weight: 700; }
.cat .ci { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.cat.coral .ci { background: var(--coral-soft); color: var(--action); } .cat.teal .ci { background: var(--teal-soft); color: var(--teal); }
.cat .nm { flex: 1; } .cat b { font-size: 12px; } .cat .muted { font-size: 12px; color: var(--text-muted); }
.labels-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 4px 14px; }
.labels-head .icon-btn { width: 34px; height: 34px; color: var(--text-muted); }
.labels a { height: 36px; font-size: 13.5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; margin: 0 4px 0 5px; flex: none; }
.empty-labels { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 14px; border: 1px dashed var(--line); border-radius: 18px; background: transparent; color: var(--text-muted); font-size: 13px; cursor: pointer; }
.empty-labels:hover { color: var(--text); border-color: var(--text-muted); }
.side-foot { margin-top: auto; padding-top: 22px; display: grid; gap: 12px; }
.store { padding: 0 6px; }
.store-h { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-muted); }
.store-bar { height: 5px; border-radius: 3px; background: rgba(24,37,43,.08); margin-top: 7px; overflow: hidden; }
[data-theme="dark"] .store-bar { background: var(--line); }
.store-bar i { display: block; height: 100%; background: var(--teal); border-radius: 3px; }
.biz-link { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 14px; border-radius: 13px; background: rgba(255,255,255,.55); text-decoration: none; font-size: 13px; color: var(--text); }
[data-theme="dark"] .biz-link { background: var(--surface); }
.biz-link:hover { background: var(--card); }
.biz-link .icon:first-child { color: var(--action); } .biz-link .icon:last-child { margin-left: auto; color: var(--text-muted); }

/* ---------- Main: list + conversation ---------- */
.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.panes { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(380px, 460px) 1fr; }
.panes.no-reader { grid-template-columns: 1fr; }
.panes.no-reader .list-col { max-width: 920px; }
.list-col { display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: 0 14px 0 4px; }
.main-head { position: relative; display: flex; align-items: baseline; gap: 12px; padding: 4px 6px 12px; min-height: 40px; }
.main-head h1 { font-size: 22px; letter-spacing: -.01em; }
.main-head .sub { margin-left: auto; font-size: 12.5px; color: var(--text-muted); }
.main-head .btn-ghost { margin-left: 8px; }
.list { flex: 1; min-height: 0; overflow-y: auto; display: grid; gap: 10px; align-content: start; padding: 2px 2px 20px; scrollbar-width: thin; }
.list .more { display: flex; justify-content: center; padding: 8px; }

/* Card */
.card { position: relative; display: block; background: var(--card); border-radius: var(--radius); padding: 14px 16px 14px; border: 1.5px solid transparent;
  text-decoration: none; color: inherit; transition: box-shadow var(--t-quick) var(--ease), border-color var(--t-quick) var(--ease); }
.card:hover { box-shadow: 0 6px 20px rgba(24,37,43,.07); }
.card.selected { border-color: var(--text); }
.card.checked { border-color: var(--teal); background: var(--teal-soft); }
.c1 { display: flex; align-items: center; gap: 10px; min-width: 0; }
.c1 .who { font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c1 .when { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.c1 .flag { color: var(--coral); }
.card.unread .who { font-weight: 700; }
.card.unread .when { color: var(--action); font-weight: 700; }
[data-theme="dark"] .card.unread .when { color: #FF8A73; }
.sel-av { border: 0; cursor: pointer; padding: 0; transition: transform var(--t-quick) var(--ease); }
.sel-av:hover { transform: scale(1.06); box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--teal); }
.subj { display: block; font-size: 14px; margin-top: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.unread .subj { font-weight: 700; }
.snip { display: block; font-size: 13px; color: var(--text-muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c3 { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.lab { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 3px 8px; margin-left: 6px; }
.c3 .lab { margin: 0; }
.fp { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; background: var(--bubble); border-radius: 8px; padding: 4px 9px; max-width: 190px; color: var(--text); }
.fp i { width: 8px; height: 10px; border-radius: 2px; flex: none; }
.fp.more { color: var(--text-muted); font-weight: 700; }
.fp button { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; display: grid; place-items: center; padding: 0 0 0 2px; }
.fp.loading { opacity: .55; }
.stack { display: inline-flex; align-items: center; margin-left: auto; padding-left: 6px; }
.stack .av + .av { margin-left: -6px; }
.stack em { font-style: normal; font-size: 11.5px; color: var(--text-muted); margin-left: 6px; }
.card .quick { display: none; gap: 0; margin: -6px -8px -6px 0; }
.card .quick .icon-btn { width: 32px; height: 32px; border-radius: 8px; color: var(--text-muted); }
.card .quick .icon-btn:hover { color: var(--text); background: var(--hover); }
.card:hover .quick, .card:focus-within .quick { display: flex; }
.card:hover .when, .card:focus-within .when { display: none; }
@media (hover: none) { .card .quick { display: none !important; } .card .when { display: inline !important; } }
.icon-btn.on, .icon-btn.on:hover { color: var(--coral) !important; }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.compact .card { padding: 10px 14px; } .compact .snip, .compact .c3 { display: none; } .compact .subj { margin-top: 5px; }

/* Bulk bar */
.bulkbar { position: absolute; inset: -4px 0 6px 0; display: flex; align-items: center; gap: 2px; padding: 0 8px 0 12px; background: var(--card); border-radius: 14px;
  box-shadow: 0 6px 20px rgba(24,37,43,.1); z-index: 3; animation: om-pop var(--t-quick) var(--ease); overflow-x: auto; }
.bulkbar b { font-size: 13px; margin: 0 10px 0 10px; white-space: nowrap; }
.bulkbar .icon-btn { width: 38px; height: 38px; flex: none; }
.bulkbar .btn-ghost { margin-left: auto; flex: none; }

/* Conversation */
.reader { background: var(--card); border-radius: 22px 0 0 0; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.conv-head { display: flex; align-items: flex-start; gap: 14px; padding: 22px 28px 16px 32px; border-bottom: 1px solid var(--line); }
.conv-head .ch-text { flex: 1; min-width: 0; }
.conv-head h2 { font-size: 24px; line-height: 1.25; letter-spacing: -.015em; overflow-wrap: anywhere; }
.conv-head p { font-size: 13px; color: var(--text-muted); margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ch-tools { display: flex; gap: 8px; flex: none; }
.icon-btn.sq { width: 40px; height: 40px; border-radius: 12px; background: var(--bubble); color: var(--text); }
.icon-btn.sq:hover { background: var(--hover); }
.r-back { display: none; }
.conv-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 28px 12px 32px; }
.conv-loading { flex: 1; display: grid; place-items: center; }
.thread { display: grid; gap: 14px; max-width: 920px; }
.older { display: flex; align-items: center; gap: 14px; border: 0; background: transparent; color: var(--text-muted); font-size: 13px; cursor: pointer; padding: 4px 0; width: 100%; }
.older::before, .older::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.older:hover span { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.msg { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; align-items: start; }
.msg > .av { width: 40px; height: 40px; font-size: 13px; }
.bubble { background: var(--bubble); border-radius: 4px 18px 18px 18px; padding: 16px 20px; min-width: 0; text-align: left; color: var(--text); border: 0; font: inherit; width: 100%; }
.msg.mine { grid-template-columns: minmax(0, 1fr) 40px; }
.msg.mine > .av { order: 2; }
.msg.mine .bubble { order: 1; background: var(--bubble-mine); border-radius: 18px 4px 18px 18px; }
.msg.short .bubble { cursor: pointer; padding: 12px 18px; transition: filter var(--t-quick) var(--ease); }
.msg.short .bubble:hover { filter: brightness(.975); }
.bh { display: flex; align-items: baseline; gap: 8px; font-size: 13px; min-width: 0; }
.bh b { font-size: 14px; white-space: nowrap; }
.bh .addr { color: var(--text-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bh .when { margin-left: auto; color: var(--text-muted); font-size: 12px; white-space: nowrap; padding-left: 12px; }
.bh .flag { color: var(--coral); }
.short-text { font-size: 14px; color: var(--text); opacity: .85; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.to-line { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.msg-text { margin-top: 14px; font-size: 15px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-text a, .unsub a { color: var(--action); }
.msg-frame { width: 100%; border: 0; margin-top: 12px; min-height: 40px; display: block; background: transparent; border-radius: 10px; }
.img-banner { margin-top: 14px; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--card); font-size: 12px; color: var(--text-muted); }
.img-banner button { margin-left: auto; }
.atts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.att-card { display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 10px; border-radius: 12px; background: var(--card); border: 0; cursor: pointer; color: var(--text); text-align: left; max-width: 300px; }
.att-card:hover { box-shadow: 0 4px 14px rgba(24,37,43,.08); }
.att-card .tile { width: 36px; height: 42px; border-radius: 8px; display: grid; place-items: center; font-size: 9.5px; font-weight: 700; flex: none; }
.att-t { min-width: 0; } .att-t b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .att-t span { font-size: 12px; color: var(--text-muted); }
.auth-note { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--warn-text); background: var(--warn-bg); border-radius: 10px; padding: 8px 12px; margin-top: 12px; }
.unsub { font-size: 12px; color: var(--text-muted); margin-top: 14px; }

/* Docked composer */
.composer { padding: 6px 28px 22px 32px; }
.sugg { display: flex; gap: 8px; margin-bottom: 10px; overflow-x: auto; scrollbar-width: none; }
.sugg button { flex: none; font-size: 12.5px; border: 1px solid var(--line); border-radius: 16px; padding: 7px 13px; background: var(--card); color: var(--text); cursor: pointer; }
.sugg button:hover { border-color: var(--teal); color: var(--teal); }
.cmp-box { border: 1.5px solid var(--text); border-radius: 18px; padding: 12px 12px 10px 16px; background: var(--card); }
.cmp-box:focus-within { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(8,127,118,.1); }
.cmp-text { width: 100%; border: 0; resize: none; font: 14.5px/1.6 var(--font); color: var(--text); background: transparent; outline: none; min-height: 48px; max-height: 260px; }
.cmp-text::placeholder { color: var(--text-muted); }
.cmp-atts { display: flex; flex-wrap: wrap; gap: 6px; }
.cmp-atts:empty { display: none; } .cmp-atts:not(:empty) { margin: 4px 0 6px; }
.cmp-bar { display: flex; align-items: center; gap: 2px; }
.cmp-bar .icon-btn { width: 38px; height: 38px; color: var(--text-muted); }
.cmp-bar .icon-btn:hover { color: var(--text); }
.cmp-mode { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 10px; background: var(--bubble); color: var(--text); cursor: pointer; margin-right: 4px; }
.cmp-hint { margin-left: auto; font-size: 11px; color: var(--text-muted); padding-right: 12px; }
.cmp-send { height: 42px; padding: 0 18px; font-size: 13.5px; }

/* Empty states */
.empty { flex: 1; display: grid; place-content: center; justify-items: center; text-align: center; padding: 48px 24px; gap: 12px; }
.empty img { width: 220px; margin-bottom: 8px; }
.empty h2 { font-size: 22px; }
.empty p { font-size: 13.5px; color: var(--text-muted); max-width: 340px; line-height: 1.6; }
.empty .btn { margin-top: 12px; }
.empty.small { padding: 48px 20px; background: var(--card); border-radius: var(--radius); }
.empty.small h2 { font-size: 16px; } .empty.small p { font-size: 12.5px; }
.panes.is-empty .reader { display: none; }
.panes.is-empty { grid-template-columns: 1fr; }
.panes.is-empty .list-col { max-width: 820px; }
.skeleton { height: 10px; border-radius: 5px; background: var(--hover); margin: 9px 0; }

/* Search suggestions */
.q-suggest { position: absolute; left: 0; right: 0; top: 54px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 6px;
  box-shadow: 0 18px 44px rgba(16,28,34,.16); display: grid; animation: om-pop var(--t-quick) var(--ease); }
.q-suggest .label { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); padding: 8px 12px 4px; }
.q-suggest [role=option] { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: center; min-height: 44px; padding: 6px 10px; border: 0; border-radius: 12px; background: transparent; text-align: left; cursor: pointer; color: var(--text); }
.q-suggest [role=option] > .icon { color: var(--text-muted); justify-self: center; }
.q-suggest [role=option] .avatar { width: 28px; height: 28px; font-size: 9px; }
.q-suggest [role=option] b { font-size: 13.5px; font-weight: 400; display: block; } .q-suggest [role=option] small { font-size: 11.5px; color: var(--text-muted); }
.q-suggest [role=option]:hover, .q-suggest [role=option][aria-selected="true"] { background: var(--hover); }
.q-tips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 8px 8px; border-top: 1px solid var(--line); margin-top: 4px; align-items: center; }
.q-tips .label { padding: 0 6px 0 4px; width: 100%; }
.q-tips button { border: 1px solid var(--line); background: var(--card); border-radius: 14px; height: 28px; padding: 0 10px; font-size: 11.5px; color: var(--text-muted); cursor: pointer; }
.q-tips button:hover { border-color: var(--teal); color: var(--text); }
.q-tips code { font: 700 11.5px var(--font); color: var(--text); }

/* ---------- Search page ---------- */
.search-page { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 24px 0 4px; max-width: 980px; }
.filters { display: flex; gap: 8px; margin: 0 6px 14px; flex-wrap: wrap; }
.chip-select { height: 34px; border-radius: 17px; border: 0; background: var(--card); box-shadow: var(--shadow); font-size: 12.5px; padding: 0 32px 0 14px; color: var(--text);
  appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='%2364717A' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-size: 18px; background-repeat: no-repeat; background-position: right 8px center; cursor: pointer; }
.chip-select.on { background-color: var(--ink); color: #fff; }
.results { flex: 1; overflow-y: auto; display: grid; gap: 10px; align-content: start; padding: 2px 2px 20px; }

/* ---------- Compose page ---------- */
.compose-page { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 24px 0 4px; max-width: 1040px; }
.compose-page .main-head { align-items: center; }
.compose-page .main-head .saved { margin-left: auto; font-size: 12px; color: var(--teal); }
.compose-card { flex: 1; min-height: 0; background: var(--card); border-radius: 22px 22px 0 0; display: flex; flex-direction: column; overflow: hidden; }
.c-row { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 12px; min-height: 56px; margin: 0 28px; border-bottom: 1px solid var(--line); }
.c-row > label { font-size: 12.5px; color: var(--text-muted); }
.c-row input, .c-row select { border: 0; background: transparent; height: 54px; font-size: 14px; outline: none; min-width: 0; width: 100%; color: var(--text); }
.c-row select { appearance: none; cursor: pointer; }
.c-links { display: flex; gap: 10px; font-size: 12px; }
.c-links button { border: 0; background: transparent; color: var(--action); cursor: pointer; padding: 6px 2px; font-size: 12px; font-weight: 700; }
.rcpts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 0; }
.rcpts input { flex: 1; min-width: 160px; height: 36px; }
.rc { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 12px; border-radius: 15px; background: var(--bubble); font-size: 13px; }
.rc.bad { background: var(--danger-bg); color: var(--action); }
.rc button { width: 22px; height: 22px; border: 0; border-radius: 11px; background: transparent; cursor: pointer; display: grid; place-items: center; color: inherit; }
.rc button:hover { background: var(--hover); }
.suggest { position: absolute; z-index: 20; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(24,37,43,.14); padding: 6px; min-width: 300px; }
.suggest button { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: center; width: 100%; border: 0; background: transparent; padding: 8px; border-radius: 10px; text-align: left; cursor: pointer; color: var(--text); }
.suggest button[aria-selected="true"], .suggest button:hover { background: var(--hover); }
.suggest b { font-size: 13px; display: block; } .suggest span { font-size: 11.5px; color: var(--text-muted); }
.suggest .avatar { width: 28px; height: 28px; font-size: 9px; }
.editor { flex: 1; min-height: 160px; overflow-y: auto; padding: 26px 28px 16px; font-size: 15px; line-height: 1.7; outline: none; }
.editor:empty::before { content: attr(data-placeholder); color: var(--text-muted); }
.editor blockquote { margin: 12px 0 0; padding-left: 14px; border-left: 2px solid var(--line); color: var(--text-muted); }
.c-atts { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 28px 14px; }
.c-att { display: grid; grid-template-columns: 24px 1fr 28px; align-items: center; gap: 10px; width: 230px; height: 54px; padding: 0 6px 0 12px; border-radius: 12px; background: var(--bubble); }
.c-att .icon { color: var(--action); } .c-att b { font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .c-att span { font-size: 11px; color: var(--text-muted); }
.c-att .icon-btn { width: 28px; height: 28px; color: var(--text-muted); } .c-att.loading { opacity: .6; }
.fmt { display: flex; gap: 4px; padding: 8px 22px; border-top: 1px solid var(--line); }
.fmt .icon-btn { width: 38px; height: 38px; color: var(--text-muted); }
.c-foot { display: flex; align-items: center; gap: 12px; padding: 6px 28px 22px; flex-wrap: wrap; }
.c-foot .btn-primary { min-width: 150px; height: 46px; font-size: 14px; }
.c-foot .attach { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; font-size: 13px; color: var(--text-muted); cursor: pointer; height: 42px; padding: 0 10px; border-radius: 12px; }
.c-foot .attach:hover { background: var(--hover); color: var(--text); }
.c-foot .icon-btn { margin-left: auto; color: var(--text-muted); }
.drop { outline: 2px dashed var(--teal); outline-offset: -8px; }

/* ---------- Settings ---------- */
.settings-page { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 24px 0 4px; max-width: 1080px; }
.settings { flex: 1; min-height: 0; display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
.s-tabs { display: grid; align-content: start; gap: 2px; }
.s-tabs a { height: 40px; display: flex; align-items: center; padding: 0 16px; border-radius: 20px; font-size: 13.5px; text-decoration: none; color: var(--text); }
.s-tabs a:hover { background: rgba(255,255,255,.55); }
.s-tabs a.active { background: var(--card); box-shadow: var(--shadow); font-weight: 700; }
.s-pane { overflow-y: auto; padding: 26px 32px 40px; background: var(--card); border-radius: 22px 22px 0 0; }
.s-pane h2 { font-size: 20px; } .s-pane .sub { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.s-block { padding: 22px 0; border-bottom: 1px solid var(--line); display: grid; gap: 14px; }
.s-block:last-of-type { border-bottom: 0; } .s-block h3 { font-size: 14px; }
.s-line { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.s-line p { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.themes { display: grid; grid-template-columns: repeat(3, minmax(0, 180px)); gap: 16px; margin-top: 20px; }
.theme-opt { display: grid; gap: 12px; cursor: pointer; position: relative; }
.theme-opt input { position: absolute; opacity: 0; }
.theme-prev { height: 108px; border-radius: 14px; border: 1px solid var(--line); padding: 10px; display: grid; grid-template-columns: 28px 1fr; gap: 8px; }
.theme-opt input:checked + .theme-prev { outline: 2px solid var(--action); outline-offset: 2px; }
.theme-opt input:focus-visible + .theme-prev { box-shadow: 0 0 0 4px rgba(8,127,118,.3); }
.theme-prev i { border-radius: 6px; display: block; } .theme-prev .lines { display: grid; gap: 7px; align-content: start; padding: 8px; border-radius: 8px; } .theme-prev .lines i { height: 6px; }
.theme-cap { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.radio { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line); display: inline-block; }
.theme-opt input:checked ~ .theme-cap .radio { border: 5px solid var(--action); }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 13px; background: #C9D1D2; transition: background var(--t-quick) var(--ease); }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform var(--t-quick) var(--ease); }
.switch input:checked + span { background: var(--teal); } .switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--teal); }
.small-select { width: 150px; height: 40px; font-size: 13px; border-radius: 12px; }
.s-save { margin-top: 24px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 12px 16px; align-items: center; font-size: 13px; }
.kv span { color: var(--text-muted); font-size: 12px; }
.code-box { font-size: 14px; font-weight: 700; letter-spacing: .06em; background: var(--bubble); border-radius: 12px; padding: 12px 14px; word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.filter-row, .contact-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.filter-row:last-child, .contact-row:last-child { border-bottom: 0; }
.fr-text b, .cr-text b { display: block; font-size: 13.5px; } .fr-text span, .cr-text span { font-size: 12.5px; color: var(--text-muted); }
.contact-row .avatar { width: 36px; height: 36px; font-size: 11px; }
.filter-form { display: grid; gap: 18px; }
.fgroup { display: grid; gap: 12px; padding: 16px; border-radius: 16px; background: var(--bubble); }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chk-line { display: flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; }
.chips-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-pick { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 12.5px; color: var(--text); }
.chip-pick[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-soft); color: var(--teal); font-weight: 700; }
.chip-pick .dot { margin: 0; }

/* ---------- Auth ---------- */
body.auth-mode { overflow: auto; }
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: min(440px, 100%); background: var(--card); border-radius: 26px; padding: 40px 36px 34px; display: grid; gap: 20px; box-shadow: 0 30px 80px rgba(24,37,43,.08); }
.auth-card .brand { margin-bottom: 6px; }
.auth-card h1 { font-size: 30px; line-height: 1.15; } .auth-card .lead { color: var(--text-muted); font-size: 14px; margin-top: -8px; }
.auth-card form { display: grid; gap: 16px; } .auth-card .input { height: 48px; border-radius: 14px; }
.auth-card .btn-primary { width: 100%; height: 50px; border-radius: 14px; margin-top: 6px; font-size: 15px; }
.auth-card .alt { font-size: 13.5px; color: var(--text-muted); text-align: center; } .auth-card .alt a { color: var(--action); font-weight: 700; text-decoration: none; }
.suffix { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.suffix:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(8,127,118,.14); }
.suffix input { border: 0; flex: 1; min-width: 0; padding: 0 0 0 14px; height: 46px; outline: none; background: transparent; }
.suffix span { display: grid; place-items: center; padding: 0 14px 0 4px; color: var(--text-muted); }
.auth-foot { margin-top: 24px; text-align: center; font-size: 12px; color: var(--text-muted); } .auth-foot a { color: var(--text-muted); }
.notice { display: flex; gap: 12px; align-items: center; padding: 16px 18px; border-radius: 14px; font-size: 13px; font-weight: 700; }

/* ---------- Tablet / mobile ---------- */
.tabbar { display: none; }
@media (max-width: 1280px) { .qchip span { display: none; } .qchip { width: 38px; padding: 0; justify-content: center; } }
@media (max-width: 1100px) { .panes { grid-template-columns: minmax(320px, 380px) 1fr; } }
@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 64px 1fr auto; }
  .side { display: none; }
  .side.open { display: flex; position: fixed; inset: 64px auto 0 0; width: 290px; background: var(--canvas); z-index: 40; padding-top: 14px; box-shadow: 20px 0 60px rgba(24,37,43,.18); }
  .menu-btn { display: inline-grid; margin-left: 8px; }
  .topbar { gap: 10px; padding-right: 12px; }
  .topbar .brand { width: auto; padding-left: 0; } .topbar .brand b { font-size: 21px; } .topbar .brand img { width: 24px; height: 24px; }
  .qchips { display: none; }
  .search input { height: 42px; }
  .search > .icon { top: 10px; }
  .me-btn .av { width: 36px; height: 36px; }
  .panes { grid-template-columns: 1fr; }
  .panes.has-sel .list-col { display: none; }
  .panes:not(.has-sel) .reader { display: none; }
  .list-col, .search-page, .compose-page, .settings-page { padding: 0 12px; }
  .reader { border-radius: 20px 20px 0 0; margin: 0 8px; }
  .r-back { display: inline-grid; margin: -6px 0 0 -10px; }
  .conv-head { padding: 16px 16px 12px; gap: 8px; } .conv-head h2 { font-size: 19px; }
  .ch-tools .icon-btn.sq:not(:last-child) { display: none; }
  .conv-scroll { padding: 14px 14px 8px; } .composer { padding: 4px 12px 12px; }
  .msg { grid-template-columns: 32px minmax(0, 1fr); gap: 10px; } .msg.mine { grid-template-columns: minmax(0, 1fr) 32px; } .msg > .av { width: 32px; height: 32px; font-size: 11px; }
  .bubble { padding: 12px 14px; } .cmp-hint { display: none; } .cmp-bar .icon-btn[aria-label="Открыть в полном редакторе"] { display: none; } .cmp-send { margin-left: auto; }
  .tabbar { display: flex; justify-content: space-around; background: var(--card); margin: 0 10px 10px; border-radius: 18px; height: 58px; box-shadow: 0 6px 24px rgba(24,37,43,.08); }
  .tabbar a { display: grid; justify-items: center; gap: 2px; align-content: center; font-size: 10px; text-decoration: none; padding: 0 6px; color: var(--text-muted); min-width: 56px; }
  .tabbar a.active { color: var(--action); }
  .settings { grid-template-columns: 1fr; } .s-tabs { display: flex; overflow-x: auto; } .s-tabs a { flex: none; } .s-pane { padding: 20px; }
  .themes { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .c-row { margin: 0 16px; } .editor { padding: 20px 16px 12px; } .c-foot { padding: 4px 16px 16px; }
}
@media (max-width: 560px) { .form-2 { grid-template-columns: 1fr; } .att-card { max-width: 100%; width: 100%; } .bulkbar .btn-ghost { display: none; } .contact-row .btn { display: none; } .filter-row, .contact-row { grid-template-columns: auto 1fr auto; } }
.list, .results { grid-template-columns: minmax(0, 1fr); overflow-x: hidden; }
.card { min-width: 0; }

/* ---------- Fixes: file chips, thumbnails, quotes, scrollbars ---------- */
.fp { white-space: nowrap; max-width: 240px; min-width: 0; }
.fp .fn { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.c3 { flex-wrap: nowrap; overflow: hidden; }
.c3 .lab { flex: none; }
.c3 .fp { flex: 0 1 auto; }
.snip.empty { font-style: italic; opacity: .8; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 16px; max-width: 640px; }
.thumbs.one { grid-template-columns: minmax(0, 360px); }
.thumb { position: relative; border: 0; padding: 0; border-radius: 14px; overflow: hidden; background: var(--card); cursor: zoom-in; aspect-ratio: 4 / 3; display: block; }
.thumbs.one .thumb { aspect-ratio: auto; max-height: 420px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform var(--t-default) var(--ease); }
.thumbs.one .thumb img { height: auto; max-height: 420px; object-fit: contain; background: var(--card); }
.thumb:hover img { transform: scale(1.02); }
.thumb.loading { min-height: 120px; background: linear-gradient(90deg, var(--hover) 0%, var(--line) 50%, var(--hover) 100%); background-size: 200% 100%; animation: om-shimmer 1.4s linear infinite; }
.thumb-cap { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; align-items: baseline; padding: 22px 12px 9px; color: #fff; font-size: 11.5px; text-align: left;
  background: linear-gradient(transparent, rgba(16,28,34,.72)); opacity: 0; transition: opacity var(--t-quick) var(--ease); }
.thumb:hover .thumb-cap, .thumb:focus-visible .thumb-cap { opacity: 1; }
.thumb-cap b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; min-width: 0; }
.thumb-cap span { flex: none; opacity: .8; }
.lightbox { position: fixed; inset: 0; z-index: 140; background: rgba(12,20,24,.92); display: grid; place-items: center; animation: om-fade var(--t-default) var(--ease); }
.lightbox > img { max-width: min(92vw, 1600px); max-height: calc(100vh - 140px); object-fit: contain; border-radius: 10px; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.lb-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: 14px 18px; color: #fff; font-size: 13px; }
.lightbox .icon-btn { color: #fff; background: rgba(255,255,255,.08); }
.lightbox .icon-btn:hover { background: rgba(255,255,255,.18); }
.lb-prev, .lb-next { position: absolute; top: 50%; transform: translateY(-50%); width: 48px !important; height: 48px !important; border-radius: 24px !important; }
.lb-prev { left: 20px; } .lb-next { right: 20px; }
.quote-toggle { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; border: 0; background: var(--card); color: var(--text-muted); border-radius: 12px; height: 30px; padding: 0 12px; font-size: 12px; cursor: pointer; }
.quote-toggle:hover { color: var(--text); }
.quote-toggle .dots { font-weight: 700; letter-spacing: 1px; }
.msg-frame { margin-top: 10px; }
/* No visible scrollbars — scrolling stays (wheel, touch, keyboard). */
.list, .conv-scroll, .side, .results, .s-pane, .editor, .q-suggest, .sugg, .bulkbar, .om-menu, .settings, .s-tabs { scrollbar-width: none; -ms-overflow-style: none; }
.list::-webkit-scrollbar, .conv-scroll::-webkit-scrollbar, .side::-webkit-scrollbar, .results::-webkit-scrollbar, .s-pane::-webkit-scrollbar, .editor::-webkit-scrollbar,
.q-suggest::-webkit-scrollbar, .sugg::-webkit-scrollbar, .bulkbar::-webkit-scrollbar, .om-menu::-webkit-scrollbar, .s-tabs::-webkit-scrollbar { display: none; width: 0; height: 0; }
