:root {
	--ink: #1d2128;
	--ink-soft: #6b7482;
	--ink-faint: #99a2ae;
	--line: #e6e9ee;
	--line-soft: #eff1f5;
	--back-rail: #f7f8fa;
	--back-list: #fcfcfd;
	--accent: #24d0a0;
	--accent-dark: #119c76;
	--accent-pale: #eaf8f3;
	--danger: #c8372d;
}

* {
	box-sizing: border-box;
}

html,
body {
	height: 100%;
}

body {
	margin: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 14px;
	line-height: 1.45;
	color: var(--ink);
	background: #fff;
	-webkit-font-smoothing: antialiased;
}

/*
	A hint in an empty field mustn't read like text somebody already typed: italic and light grey. An address in a placeholder looks exactly like a real address, and when it doesn't, the person sees a stranger's mailbox sitting in "To" and can't work out why the letter won't go.

	opacity: 1 is there for Firefox: it dims placeholders by itself, and over our colour that fades them to nearly white.
*/
::placeholder {
	color: var(--ink-faint);
	opacity: 1;
	font-style: italic;
}

/* ---------- вход ---------- */

.gate {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100%;
	padding: 24px;
}

.gate__form {
	width: 100%;
	max-width: 340px;
}

.gate__title {
	margin: 0 0 24px;
	font-size: 20px;
	font-weight: 600;
}

.gate__title span {
	color: var(--ink-faint);
	font-weight: 400;
}

.gate__text {
	margin: 0 0 20px;
	color: var(--ink-soft);
}

.gate__error {
	margin: 0 0 20px;
	padding: 10px 12px;
	color: var(--danger);
	background: #fdf1f0;
	border-radius: 4px;
}

.field {
	display: block;
	margin-bottom: 20px;
}

.field__label {
	display: block;
	margin-bottom: 7px;
	color: var(--ink-soft);
}

/*
	Поле выглядит как поле: белое, с настоящей рамкой. На фокусе меняется только её цвет — ни теней, ни подпрыгиваний.
*/
.field__input {
	display: block;
	width: 100%;
	height: 42px;
	padding: 0 12px;
	font: inherit;
	color: var(--ink);
	background: #fff;
	border: 1px solid #cfd5de;
	border-radius: 4px;
	transition: border-color 0.12s ease;
}

.field__input:hover {
	border-color: #aeb7c3;
}

.field__input:focus {
	outline: none;
	border-color: var(--accent);
}

/* Поле и приписанный домен выглядят одним полем: рамка на обёртке, а само поле внутри без своей. */
.field__pair {
	display: flex;
	align-items: stretch;
	width: 100%;
	background: #fff;
	border: 1px solid #cfd5de;
	border-radius: 4px;
	transition: border-color 0.12s ease;
}

.field__pair:hover {
	border-color: #aeb7c3;
}

.field__pair:focus-within {
	border-color: var(--accent);
}

.field__input--bare,
.field__input--bare:hover,
.field__input--bare:focus {
	flex: 1 1 auto;
	min-width: 0;
	padding-right: 0;
	background: none;
	border: 0;
	border-radius: 0;
}

/* Подпись, а не значение: выделять и править её нечего. */
.field__suffix {
	display: flex;
	align-items: center;
	flex: none;
	padding: 0 12px 0 1px;
	color: var(--ink-faint);
	white-space: nowrap;
	user-select: none;
	-webkit-user-select: none;
}

/* Человек набрал полный адрес с собакой — подпись начала врать и уходит. Класс ставит auth.js. */
.field__pair--full .field__suffix {
	display: none;
}

.button {
	display: inline-block;
	width: 100%;
	height: 42px;
	padding: 0 16px;
	font: inherit;
	font-weight: 600;
	line-height: 42px;
	color: #fff;
	text-align: center;
	text-decoration: none;
	background: var(--accent);
	border: 0;
	border-radius: 4px;
	cursor: pointer;
	transition: background-color 0.12s ease;
}

.button:hover {
	background: var(--accent-dark);
}

.button--ghost {
	height: 36px;
	line-height: 34px;
	font-weight: 500;
	color: var(--ink-soft);
	background: #fff;
	border: 1px solid #d5dae2;
}

.button:disabled,
.button--ghost:disabled {
	color: var(--ink-faint);
	background: #fff;
	cursor: not-allowed;
}

/* ---------- капча ---------- */

.riddle {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 10px;
}

.riddle__picture {
	display: block;
	/* min-width is for the button sitting next to it: an image carries its own width, and without this flex won't shrink it — it stretches the row past the edge of the form instead. A long riddle is drawn wider than the form on purpose, and scaling it down here costs nothing: on a phone it only comes out sharper. */
	flex: 0 1 auto;
	min-width: 0;
	max-width: 100%;
	height: auto;
	border: 1px solid #cfd5de;
	border-radius: 4px;
}

.riddle__again {
	flex: none;
	width: 32px;
	height: 32px;
	padding: 6px;
	color: var(--ink-soft);
	background: #fff;
	border: 1px solid #d5dae2;
	border-radius: 4px;
	cursor: pointer;
}

.riddle__again:hover {
	color: var(--ink);
	border-color: #aeb7c3;
}

.riddle__again svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* ---------- значки ---------- */

/*
	Спрайт в разметке есть, но рисоваться не должен. У <svg> без заданных размеров по умолчанию 300×150 пикселей, и он раздвинул бы страницу пустым прямоугольником.
*/
.sprite {
	display: none;
}

.ico {
	display: block;
	flex: none;
	width: 16px;
	height: 16px;
}

/* ---------- настройки ---------- */

/* Настройки живут в самом низу левой панели, поэтому список папок забирает всё свободное место над ними. */
.settings {
	flex: none;
	padding: 9px 16px 12px;
	border-top: 1px solid var(--line);
}

.tongue {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
}

.tongue__label {
	flex: none;
	font-size: 12px;
	color: var(--ink-faint);
}

.tongue__pick {
	flex: 1 1 auto;
	min-width: 0;
	height: 28px;
	padding: 0 4px;
	font: inherit;
	font-size: 12px;
	color: var(--ink);
	background: #fff;
	border: 1px solid #d5dae2;
	border-radius: 4px;
	cursor: pointer;
}

.tongue__pick:hover {
	border-color: #aeb7c3;
}

.tongue__pick:focus {
	outline: none;
	border-color: var(--accent);
}

/* Кнопка нужна только без JavaScript: сам по себе выпадающий список ничего бы не отправил. Со скриптом её прячет tongue.js. */
.tongue__go {
	flex: none;
	height: 28px;
	padding: 0 10px;
	font: inherit;
	font-size: 12px;
	color: var(--ink-soft);
	background: #fff;
	border: 1px solid #d5dae2;
	border-radius: 4px;
	cursor: pointer;
}

/* There are two copies of the block - one in the panel, one inside the mailbox menu - and exactly one of them is ever visible. On a wide screen it's the one in the panel. */
.settings--menu {
	display: none;
}

/* На странице входа настройки стоят сами по себе под формой, рамка сверху им не нужна. */
.gate__stack {
	width: 100%;
	max-width: 340px;
}

.settings--gate {
	padding: 18px 0 0;
	border-top: 0;
}

.settings--gate .tongue {
	justify-content: center;
}

.settings--gate .tongue__pick {
	flex: 0 1 auto;
	height: 32px;
	font-size: 13px;
}

/* ---------- каркас ---------- */

.app {
	display: flex;
	height: 100%;
}

.rail {
	display: flex;
	flex-direction: column;
	flex: none;
	width: 212px;
	background: var(--back-rail);
	border-right: 1px solid var(--line);
}

/* ---------- логотип ---------- */

.brand {
	display: block;
	flex: none;
	padding: 14px 16px 12px;
}

.brand__logo {
	display: block;
	width: 140px;
	height: auto;
}

.brand--gate {
	padding: 0 0 24px;
}

.brand--inline {
	padding: 0;
}

/* ---------- переключатель ящиков ---------- */

.who {
	flex: none;
	border-top: 1px solid var(--line);
	border-bottom: 1px solid var(--line);
}

/* Треугольник браузера убираем: у нас своя стрелка, и она справа. */
.who__now {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 10px 16px;
	cursor: pointer;
	list-style: none;
}

.who__now::-webkit-details-marker {
	display: none;
}

.who__now:hover {
	background: #eef0f4;
}

.who__address {
	overflow: hidden;
	font-weight: 600;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.who__arrow {
	display: flex;
	flex: none;
	color: var(--ink-faint);
}

.who[open] .who__arrow {
	transform: rotate(180deg);
}

.who__menu {
	padding: 4px 0 8px;
	background: #fff;
	border-top: 1px solid var(--line-soft);
}

.who__item {
	display: block;
	width: 100%;
	padding: 7px 16px;
	font: inherit;
	color: var(--ink);
	text-align: left;
	text-decoration: none;
	background: none;
	border: 0;
	cursor: pointer;
}

.who__item:hover {
	background: #eef0f4;
}

.who__item--add {
	color: var(--accent-dark);
}

.who__item--quiet {
	color: var(--ink-soft);
}

.rail__write {
	padding: 12px 16px 6px;
}

/*
	На широком экране в кнопке хватает подписи. Значок лежит в разметке и ждёт телефона.
*/
.rail__write .ico {
	display: none;
}

/* ---------- строка о том, что произошло ---------- */

.notice {
	flex: none;
	margin: 0;
	padding: 9px 16px;
	color: #146c52;
	background: var(--accent-pale);
	border-bottom: 1px solid #cdeee2;
}

/* ---------- папки ---------- */

.folders {
	flex: 1 1 auto;
	min-height: 0;
	padding: 6px 0;
	overflow-y: auto;
}

.folder {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 8px 16px;
	color: var(--ink);
	text-decoration: none;
	/*
		Полоска слева есть всегда, просто обычно прозрачная: иначе при переходе между папками текст дёргался бы на три пикселя.
	*/
	border-left: 3px solid transparent;
}

.folder:hover {
	background: #eef0f4;
}

.folder--open {
	font-weight: 600;
	background: #fff;
	border-left-color: var(--accent);
}

.folder__name {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.folder__unread {
	flex: none;
	font-size: 12px;
	font-weight: 600;
	color: var(--ink-soft);
}

/* ---------- список писем ---------- */

.list {
	display: flex;
	flex-direction: column;
	flex: none;
	width: 380px;
	background: var(--back-list);
	border-right: 1px solid var(--line);
}

.list__head {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: none;
	padding: 12px 14px;
	border-bottom: 1px solid var(--line);
}

/* Счётчик упирается в кнопки справа и отжимает их к краю. */
.list__count {
	margin-right: auto;
}

/*
	Кнопка в шапке списка: «Балка» и «написать». Часть из них ссылки, часть кнопки, выглядеть должны одинаково.
*/
.head__act {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex: none;
	height: 30px;
	padding: 0 10px;
	font: inherit;
	font-size: 13px;
	color: var(--ink-soft);
	text-decoration: none;
	white-space: nowrap;
	background: #fff;
	border: 1px solid #d5dae2;
	border-radius: 4px;
	cursor: pointer;
}

.head__act:hover {
	color: var(--ink);
	border-color: #aeb7c3;
}

/*
	Включённая балка видна по кнопке: в этом режиме клик по строке ставит галочку вместо открытия письма, и человек должен понимать, почему.
*/
.head__act[aria-pressed="true"] {
	color: var(--accent-dark);
	background: var(--accent-pale);
	border-color: #a9e2cd;
}

/* ---------- балка ---------- */

/*
	В разметке балка есть всегда, но показывается только при включённом режиме. Так переключение не стоит обращения к серверу.
*/
.balka {
	display: none;
	align-items: center;
	gap: 10px;
	flex: none;
	padding: 8px 12px;
	background: #fff;
	border-bottom: 1px solid var(--line);
}

.app--bulk .balka {
	display: flex;
}

.balka__all {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex: none;
	color: var(--ink-soft);
	cursor: pointer;
}

.balka__count {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	font-size: 13px;
	color: var(--ink-faint);
	white-space: nowrap;
	text-overflow: ellipsis;
}

.balka__where {
	flex: 0 1 auto;
	min-width: 0;
	max-width: 42%;
	height: 30px;
	padding: 0 6px;
	font: inherit;
	font-size: 13px;
	color: var(--ink);
	background: #fff;
	border: 1px solid #d5dae2;
	border-radius: 4px;
}

.balka__do {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 34px;
	height: 30px;
	padding: 0;
	color: var(--ink-soft);
	background: #fff;
	border: 1px solid #d5dae2;
	border-radius: 4px;
	cursor: pointer;
}

.balka__do:hover {
	color: var(--ink);
	border-color: #aeb7c3;
}

.balka__do--danger:hover {
	color: var(--danger);
	border-color: var(--danger);
}

/*
	Пока ничего не выбрано, делать нечего — и кнопки это показывают, вместо того чтобы отправить пустую пачку и получить ответ «ничего не выбрано».
*/
.balka__do:disabled {
	color: #c4cad3;
	background: #fafbfc;
	border-color: var(--line);
	cursor: not-allowed;
}

.list__title {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
}

.list__count {
	font-size: 13px;
	color: var(--ink-faint);
}

.rows {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
}

/*
	Галочки и кнопки балки — одна форма на всю папку, и она же теперь растягивается по высоте вместо .rows.
*/
.picked {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
	margin: 0;
}

/*
	Галочка рядом со строкой, а не внутри: внутри ссылки она не нажималась бы вовсе — клик уходил бы на открытие письма.
*/
.rowbox {
	display: flex;
	align-items: center;
	border-bottom: 1px solid var(--line-soft);
	/* Полоска есть всегда, просто обычно прозрачная: иначе при переходе между письмами текст дёргался бы на три пикселя. */
	border-left: 3px solid transparent;
}

.rowbox:hover {
	background: #f2f4f7;
}

/* Полоска и подсветка висят на строке целиком, а не на ссылке внутри неё. Иначе в балке, где перед ссылкой встаёт галочка, полоска уезжала бы вправо на её ширину. */
.rowbox--open {
	background: var(--accent-pale);
	border-left-color: var(--accent);
}

.rowbox--open:hover {
	background: var(--accent-pale);
}

/*
	Вне балки галочки нет совсем, и места под неё тоже: иначе список всё время стоял бы со сдвигом вправо ради режима, который включают раз в месяц.
*/
.rowbox__pick {
	display: none;
}

.app--bulk .rowbox__pick {
	display: flex;
	align-items: center;
	flex: none;
	padding: 0 2px 0 14px;
	cursor: pointer;
}

.app--bulk .rowbox__pick input {
	width: 16px;
	height: 16px;
	margin: 0;
}

.row {
	display: block;
	flex: 1 1 auto;
	min-width: 0;
	padding: 9px 16px;
	color: inherit;
	text-decoration: none;
}

.row:hover {
	background: #f2f4f7;
}

.row__top,
.row__bottom {
	display: flex;
	align-items: baseline;
	gap: 8px;
}

.row__bottom {
	margin-top: 1px;
}

.row__who {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.row__date {
	flex: none;
	font-size: 12px;
	color: var(--ink-faint);
	white-space: nowrap;
}

.row__subject {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	color: var(--ink-soft);
	white-space: nowrap;
	text-overflow: ellipsis;
}

.row--unread .row__who,
.row--unread .row__subject {
	font-weight: 600;
	color: var(--ink);
}

.row__size {
	flex: none;
	font-size: 12px;
	color: var(--ink-faint);
	white-space: nowrap;
}

.clip {
	display: inline-flex;
	flex: none;
	color: var(--ink-faint);
}

.clip .ico {
	width: 13px;
	height: 13px;
}

.empty {
	flex: 1 1 auto;
	padding: 32px 16px;
	color: var(--ink-faint);
}

/* ---------- страницы ---------- */

.pager {
	display: flex;
	align-items: center;
	gap: 16px;
	flex: none;
	padding: 12px 16px;
	border-top: 1px solid var(--line);
}

.pager__step {
	color: var(--accent-dark);
	text-decoration: none;
	border-bottom: 1px solid currentColor;
}

.pager__step:hover {
	color: var(--ink);
}

.pager__step--off {
	color: var(--ink-faint);
	border-bottom: 0;
}

.pager__where {
	color: var(--ink-faint);
}

/* ---------- письмо ---------- */

.preview {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-width: 0;
	background: #fff;
}

.preview--busy {
	opacity: 0.55;
}

.preview__empty {
	margin: 0;
	padding: 40px 28px;
	color: var(--ink-faint);
}

.msg {
	display: flex;
	flex-direction: column;
	min-height: 0;
	height: 100%;
}

.msg__head {
	flex: none;
	padding: 18px 24px 14px;
	border-bottom: 1px solid var(--line);
}

.msg__subject {
	margin: 0 0 12px;
	font-size: 17px;
	font-weight: 600;
	line-height: 1.3;
}

/*
	Подписи и значения в две колонки: взгляд читает значения одним столбцом, а не выцепляет их из строк разной длины.
*/
.msg__meta {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: 3px 12px;
	margin: 0;
}

.msg__meta dt {
	color: var(--ink-faint);
}

.msg__meta dd {
	margin: 0;
	overflow: hidden;
	text-overflow: ellipsis;
}

/*
	Видно только на узком экране: там письмо занимает весь экран, и уйти с него иначе нечем. На широком рядом стоит сам список.
*/
.msg__back {
	display: none;
	align-items: center;
	gap: 4px;
	margin-bottom: 10px;
	color: var(--ink-soft);
	text-decoration: none;
}

.msg__back:hover {
	color: var(--ink);
}

.msg__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 14px;
}

/*
	Часть действий — ссылки, часть — кнопки в формах. Выглядеть они должны одинаково, поэтому inline-flex и выключенное подчёркивание.
*/
.msg__act {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 30px;
	padding: 0 12px;
	font: inherit;
	font-size: 13px;
	color: var(--ink-soft);
	text-decoration: none;
	white-space: nowrap;
	background: #fff;
	border: 1px solid #d5dae2;
	border-radius: 4px;
	cursor: pointer;
}

.msg__act:hover {
	color: var(--ink);
	border-color: #aeb7c3;
}

.msg__act--danger:hover {
	color: var(--danger);
	border-color: var(--danger);
}

.msg__act:disabled {
	color: var(--ink-faint);
	background: #fafbfc;
	cursor: not-allowed;
}

.msg__drop {
	display: inline-flex;
	/* Форма тут только ради POST, в разметке её быть видно не должно. */
	margin: 0;
	margin-left: auto;
}

/* ---------- вложения ---------- */

.msg__files {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	flex: none;
	padding: 12px 24px;
	border-bottom: 1px solid var(--line);
}

.file {
	display: inline-flex;
	align-items: baseline;
	gap: 8px;
	max-width: 100%;
	padding: 6px 11px;
	color: var(--ink);
	text-decoration: none;
	background: #f6f8fa;
	border: 1px solid var(--line);
	border-radius: 4px;
}

.file:hover {
	border-color: var(--accent);
}

.file__name {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.file__size {
	flex: none;
	font-size: 12px;
	color: var(--ink-faint);
}

/* ---------- полоса про картинки ---------- */

.msg__images {
	display: flex;
	align-items: baseline;
	gap: 12px;
	flex: none;
	padding: 10px 24px;
	font-size: 13px;
	color: #7a5d16;
	background: #fdf6e3;
	border-bottom: 1px solid #f0e3c0;
}

.msg__show {
	flex: none;
	color: #7a5d16;
	white-space: nowrap;
	/* Пунктир — «раскроется здесь же», а не «уведёт на другую страницу». */
	border-bottom: 1px dashed currentColor;
	text-decoration: none;
}

.msg__show:hover {
	color: var(--ink);
}

/* ---------- тело письма ---------- */

/*
	Высоту не подгоняем под содержимое: для этого нужен скрипт внутри песочницы, а скриптов внутри неё быть не должно. Рамка занимает всё оставшееся место и прокручивается сама.
*/
.msg__body {
	display: block;
	flex: 1 1 auto;
	width: 100%;
	min-height: 0;
	border: 0;
}

/* ---------- написать письмо ---------- */

.sheet {
	max-width: 780px;
	margin: 0 auto;
	padding: 24px 24px 48px;
}

.sheet__head {
	display: flex;
	align-items: center;
	gap: 16px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--line);
}

.sheet__title {
	flex: 1 1 auto;
	margin: 0;
	font-size: 17px;
	font-weight: 600;
}

.sheet__back {
	flex: none;
	color: var(--ink-soft);
	text-decoration: none;
	border-bottom: 1px dashed var(--ink-faint);
}

.sheet__back:hover {
	color: var(--ink);
	border-bottom-color: var(--ink);
}

.sheet__form {
	padding-top: 8px;
}

/* Подпись слева, поле справа: взгляд идёт по одному краю, как в шапке письма. */
.line {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 9px 0;
	border-bottom: 1px solid var(--line-soft);
}

.line__label {
	flex: none;
	width: 76px;
	color: var(--ink-faint);
}

.line__fixed {
	color: var(--ink-soft);
}

/*
	Обёртка вокруг поля: от неё отсчитывается выпадающий список подсказок. Отдельным элементом, а не от самой строки, — иначе список пришлось бы отступать от левого края на ширину подписи, числом в пикселях.
*/
.line__box {
	position: relative;
	display: flex;
	flex: 1 1 auto;
	min-width: 0;
}

.hints {
	position: absolute;
	top: calc(100% + 6px);
	left: -8px;
	right: 0;
	z-index: 10;
	max-height: 258px;
	overflow-y: auto;
	background: #fff;
	border: 1px solid #cfd5de;
	border-radius: 4px;
	box-shadow: 0 8px 24px rgba(29, 33, 40, 0.12);
}

.hints__one {
	display: flex;
	align-items: baseline;
	gap: 8px;
	padding: 7px 10px;
	cursor: pointer;
}

/*
	Подсветка одна и та же от мыши и от стрелок на клавиатуре: это одно и то же состояние, и выглядеть оно должно одинаково.
*/
.hints__one:hover,
.hints__one--on {
	background: var(--accent-pale);
}

.hints__name {
	max-width: 45%;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.hints__mail {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	font-size: 13px;
	color: var(--ink-faint);
	white-space: nowrap;
	text-overflow: ellipsis;
}

.line__input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 2px 0;
	font: inherit;
	color: var(--ink);
	background: none;
	border: 0;
}

.line__input:focus {
	outline: none;
}

.line:focus-within {
	border-bottom-color: var(--accent);
}

.sheet__text {
	display: block;
	width: 100%;
	margin-top: 16px;
	padding: 12px 14px;
	font: inherit;
	color: var(--ink);
	background: #fff;
	border: 1px solid #cfd5de;
	border-radius: 4px;
	resize: vertical;
}

.sheet__text:focus {
	outline: none;
	border-color: var(--accent);
}

.sheet__files {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 16px;
}

.pick__label {
	display: block;
	margin-bottom: 6px;
	color: var(--ink-soft);
}

.pick__input {
	font: inherit;
	font-size: 13px;
}

.pick__hint {
	color: var(--ink-faint);
	font-size: 13px;
}

.check {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-top: 14px;
	color: var(--ink-soft);
}

.sheet__send {
	display: flex;
	align-items: center;
	gap: 20px;
	margin-top: 24px;
}

.button--narrow {
	width: auto;
	min-width: 160px;
}

.gate__under {
	margin: 18px 0 0;
	text-align: center;
}

/* Регистрация и восстановление — в ряд, по краям формы: это два равных выхода, а не один с уточнением. */
.gate__under--pair {
	display: flex;
	justify-content: space-between;
	gap: 16px;
}

.gate__under a {
	color: var(--ink-soft);
}

/* ---------- узкий экран ---------- */

/*
	На телефоне это не три колонки, растянутые вверх, а два экрана: список писем и письмо.

	Колонки становятся этажами. Логотип и ящик встают в одну строку, папки идут полосой с горизонтальной прокруткой, список писем занимает весь остаток. Открытое письмо ложится поверх всего, на весь экран, и уходит кнопкой «К письмам».

	Состояние держит класс .app--reading: его ставит сервер, когда письмо открыто прямо по адресу, и mail.js, когда панель подменилась без перезагрузки. Список под письмом остаётся как был, вместе с прокруткой, поэтому возврат ничего не перечитывает из IMAP.

	Подписи в кнопках заменяются значками: четыре слова в ряд на 360 пикселях не живут. Для читалки подпись при этом остаётся — она в aria-label, а не только в тексте.
*/
@media (max-width: 900px) {
	.app {
		flex-direction: column;
	}

	/* Колонка папок превращается в шапку. */
	/*
		Три столбца в первом ряду: логотип, ящик, кнопка письма. Логотипу и половины ширины не надо, так что место под кнопку там есть.
	*/
	.rail {
		display: grid;
		grid-template-columns: auto minmax(0, 1fr) auto;
		align-items: center;
		flex: none;
		width: auto;
		border-right: 0;
		border-bottom: 1px solid var(--line);
	}

	.brand {
		padding: 8px 12px 6px;
	}

	.brand__logo {
		width: 104px;
	}

	.who {
		position: relative;
		border-top: 0;
		border-bottom: 0;
	}

	/*
		Меню ящиков всплывает поверх, а не раздвигает шапку: иначе список писем прыгал бы вниз на пол-экрана каждый раз, когда его открыли.
	*/
	.who__menu {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		z-index: 15;
		border: 1px solid var(--line);
		border-radius: 0 0 4px 4px;
		box-shadow: 0 8px 24px rgba(29, 33, 40, 0.16);
	}

	/*
		Кнопка письма — значком, в первом ряду справа. Полосой во всю ширину она съела бы экран, которого на письма и так не хватает.
	*/
	.rail__write {
		padding: 0 10px 0 2px;
	}

	.rail__write .button {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 38px;
		min-width: 0;
		height: 34px;
		padding: 0;
		line-height: 1;
	}

	.rail__write .ico {
		display: block;
		width: 18px;
		height: 18px;
	}

	.rail__write .button__text {
		display: none;
	}

	.brand {
		grid-row: 1;
		grid-column: 1;
	}

	.who {
		grid-row: 1;
		grid-column: 2;
	}

	.rail__write {
		grid-row: 1;
		grid-column: 3;
		/* keeps the button against the right edge of its column instead of floating in the middle of the header if the column ever comes out wider than the button. */
		justify-self: end;
	}

	/*
		Settings move into the mailbox menu, next to "add a mailbox" and "sign out". Standing on its own in the header, the language picker belonged to nothing and ate width the folders needed - and the menu is what "the bottom of the left panel" means on a phone.
	*/
	.settings--rail {
		display: none;
	}

	.settings--menu {
		display: block;
		padding: 8px 16px 4px;
		border-top: 1px solid var(--line-soft);
	}

	.folders {
		display: flex;
		gap: 4px;
		grid-row: 2;
		grid-column: 1 / -1;
		padding: 6px 8px;
		overflow-x: auto;
		/*
			Полосу прокрутки убираем: папки и так явно продолжаются за край, а лишние четыре пикселя на телефоне дороги.
		*/
		scrollbar-width: none;
	}

	.folders::-webkit-scrollbar {
		display: none;
	}

	.folder {
		flex: none;
		padding: 6px 12px;
		border-left: 0;
		border-bottom: 3px solid transparent;
		border-radius: 4px;
	}

	.folder--open {
		border-left: 0;
		border-bottom-color: var(--accent);
	}

	/* Список забирает весь остаток экрана и прокручивается сам. */
	.list {
		flex: 1 1 auto;
		width: auto;
		min-height: 0;
		border-right: 0;
	}

	.list__head {
		padding: 10px 12px;
	}

	/* Письмо — отдельный экран поверх списка. */
	.preview {
		display: none;
		position: fixed;
		inset: 0;
		z-index: 20;
	}

	.app--reading .preview {
		display: flex;
	}

	.msg__back {
		display: inline-flex;
	}

	/*
		The letter's header, three tight rows instead of four and a bit. It can't scroll away: the body lives in a sandbox and never tells us its height, so the frame takes whatever screen is left and scrolls on its own. Which means the header can only be squeezed, not hidden.

		First row: back on the left, the actions on the right - that used to be two rows. Second: the subject, two lines at most. Third: from, to and when, small.
	*/
	.msg__head {
		display: grid;
		grid-template-columns: auto minmax(0, 1fr);
		align-items: center;
		gap: 4px 10px;
		padding: 6px 12px 8px;
	}

	.msg__back {
		grid-row: 1;
		grid-column: 1;
		margin: 0;
		padding: 4px 4px 4px 0;
	}

	.msg__actions {
		grid-row: 1;
		grid-column: 2;
		flex-wrap: nowrap;
		justify-content: flex-end;
		gap: 6px;
		margin: 0;
	}

	.msg__subject {
		grid-row: 2;
		grid-column: 1 / -1;
		margin: 0;
		font-size: 15px;
		/* a subject running to four lines is half the screen already. two is what we show; the rest of it is in the letter anyway. */
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	/* the labels stay: they cost nothing in height, only in width. */
	.msg__meta {
		grid-row: 3;
		grid-column: 1 / -1;
		gap: 1px 8px;
		font-size: 12px;
	}

	.msg__files,
	.msg__images {
		padding-left: 14px;
		padding-right: 14px;
	}

	/* Вместо подписей — значки. */
	.msg__act-text,
	.head__act-text {
		display: none;
	}

	.msg__act,
	.head__act {
		justify-content: center;
		width: 38px;
		padding: 0;
	}

	.msg__act .ico,
	.head__act .ico,
	.balka__do .ico {
		width: 18px;
		height: 18px;
	}

	.balka {
		padding: 8px 10px;
	}

	.balka__do {
		width: 38px;
	}

	/* Палец — не курсор: по галочке надо попасть, а не прицелиться. */
	.app--bulk .rowbox__pick {
		padding: 0 4px 0 12px;
	}

	.app--bulk .rowbox__pick input {
		width: 20px;
		height: 20px;
	}

	.row {
		padding: 10px 14px;
	}

	/* ---------- написать письмо ---------- */

	.sheet {
		padding: 14px 14px 32px;
	}

	.line__label {
		width: 62px;
	}

	.hints {
		left: -6px;
	}

	.sheet__send {
		gap: 14px;
	}
}
