/* x-mail.ru: кабинет и админка. Вид SMTP/FTP/CRM/Keys: плотный, рабочий.
   Бренд (W6): бирюзовый #0f766e (белый текст 5,47:1), нейтральные с бирюзовым оттенком, шрифт Onest (fonts.css).
   Палитра и проверка контраста WCAG AA: .misc/brand/palette.json, генератор .misc/brand/build.py. */
:root {
  --brand: #0f766e;
  --brand-hover: #0b5d57;
  --brand-soft: #e6f3f1;
  --brand-line: #b5ddd7;
  --brand-ink: #0a4f4a;
  --bg: #f4f7f7;
  --panel: #fff;
  --line: #dde5e5;
  --line-2: #c9d4d4;
  --text: #0f1d24;
  --muted: #56656b;
  --danger: #c93636;
  --danger-soft: #fdeaea;
  --ok: #1f8a4c;
  --ok-soft: #e7f6ec;
  --warn: #9a6300;
  --warn-soft: #fff4dc;
  --radius: 8px;
  font-family: Onest, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); overflow-x: hidden; }
[hidden] { display: none !important; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 650; margin: 0; }
h2 { font-size: 17px; font-weight: 650; margin: 0 0 12px; }
h3 { font-size: 14px; font-weight: 650; margin: 16px 0 6px; }
h3:first-child { margin-top: 0; }
p { margin: 0 0 10px; }
code, .mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12.5px; }
code { background: #f1f3f6; border-radius: 4px; padding: 1px 5px; }
.pre { white-space: pre-wrap; word-break: break-all; background: #f7f8fa; border: 1px solid var(--line); border-radius: 6px; padding: 10px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; max-height: 480px; overflow: auto; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.wrap-any { overflow-wrap: anywhere; word-break: break-word; }
.err { color: var(--danger); }
.mt { margin-top: 18px; }
.mt-s { margin-top: 8px; }
.inline { display: inline; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Кнопки и поля ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 7px;
  background: #fff; color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: #f7f8fa; border-color: #c3c9d3; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b02c2c; border-color: #b02c2c; }
.btn-danger-ghost { color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(0, 0, 0, .05); border-color: transparent; }
.btn-sm { min-height: 28px; padding: 0 10px; font-size: 13px; }
.btn-wide { width: 100%; height: 42px; margin-top: 12px; }
.linkbtn { border: 0; background: none; color: var(--brand); cursor: pointer; font: inherit; padding: 0; }
.linkbtn:disabled { color: var(--muted); cursor: default; }
.input { width: 100%; min-height: 36px; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 7px; background: #fff; font: inherit; color: var(--text); }
.input:focus { outline: 2px solid var(--brand-line); border-color: var(--brand); }
textarea.input { resize: vertical; line-height: 1.45; }
select.input[multiple] { padding: 4px; }
.input-sm { min-height: 30px; font-size: 13px; padding: 3px 8px; }
.field { display: block; margin: 0 0 12px; min-width: 0; }
.field > span:first-child { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.check { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0 10px; cursor: pointer; }
.check input { margin-top: 3px; }
.checks { display: flex; flex-wrap: wrap; gap: 0 18px; margin: 4px 0 6px; }
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-row > .field { flex: 1 1 220px; }
.form-row > .btn, .form-row > .check { margin-bottom: 12px; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.addr { display: flex; align-items: center; gap: 6px; }
.addr .input { flex: 1; min-width: 0; }
.addr b { font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.search { margin: 0 0 14px; max-width: 640px; }
.search .input { flex: 1 1 200px; width: auto; }

/* ── Верхняя полоса ── */
.top { display: flex; align-items: center; gap: 18px; min-height: 54px; padding: 0 18px; background: #fff; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; font-size: 16px; }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--brand); display: inline-flex; }
.top-nav { display: flex; gap: 2px; align-items: center; overflow-x: auto; scrollbar-width: none; }
.top-nav a { color: var(--muted); padding: 6px 10px; border-radius: 6px; font-weight: 500; white-space: nowrap; }
.top-nav a.active, .top-nav a:hover { color: var(--text); background: var(--bg); text-decoration: none; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.acc-switch select { max-width: 220px; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; color: var(--text); padding: 3px 8px 3px 3px; border-radius: 99px; min-width: 0; }
.user-chip:hover, .user-chip.active { background: var(--bg); text-decoration: none; }
.user-name { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-weight: 650; font-size: 13px; flex: none; }
.imp-bar { display: flex; align-items: center; gap: 12px; justify-content: center; flex-wrap: wrap; background: #fff3c4; border-bottom: 1px solid #ecd27a; padding: 8px 16px; font-size: 13px; }
.imp-bar form { margin: 0; }

/* ── Страница ── */
.wrap { max-width: 1140px; margin: 0 auto; padding: 22px 20px 50px; }
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head .actions { margin-left: auto; }
.sub-head { margin-top: 4px; }
.sub-head .search { margin: 0; flex: 1 1 240px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; overflow-wrap: anywhere; }
.crumbs a { color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; min-width: 0; }
.card.narrow { max-width: 620px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.card-head h2 { margin: 0; }
.card.danger { border-color: #f1c9c9; }
.card.frozen { border-color: #f1c9c9; background: #fffafa; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 16px; }
.stat-label { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.stat-value { font-size: 20px; font-weight: 650; margin-bottom: 6px; }
.stat-value .muted { font-size: 14px; font-weight: 400; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0 0 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.reg dt { font-weight: 600; margin-top: 8px; }
.reg dd { margin: 2px 0 0; color: var(--muted); }
details summary { cursor: pointer; color: var(--brand); }
.foot { margin-top: 30px; text-align: center; }
.flash, .msg, .banner { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; background: var(--ok-soft); color: #155c33; overflow-wrap: anywhere; }
.flash-error, .msg-err, .banner-bad { background: var(--danger-soft); color: #8a2020; }
.banner-warn { background: var(--warn-soft); color: #744a00; }
.banner-info { background: var(--brand-soft); color: var(--brand-ink); }
.msg { position: sticky; top: 8px; z-index: 5; box-shadow: 0 2px 10px rgba(20, 30, 50, .08); }
.result { margin-top: 12px; padding: 12px 14px; background: #f7f8fa; border: 1px solid var(--line); border-radius: var(--radius); overflow-wrap: anywhere; }
.result .pw { font-size: 15px; }
.empty { text-align: center; padding: 50px 20px; background: #fff; border: 1px dashed var(--line-2); border-radius: var(--radius); margin-bottom: 16px; }
.empty p { max-width: 540px; margin: 8px auto 0; }

/* ── Таблицы ── */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 16px; border-radius: var(--radius); }
.card .table-wrap { margin-bottom: 0; }
table.list { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table.list th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
table.list td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list .num { text-align: right; font-variant-numeric: tabular-nums; }
table.list.compact td, table.list.compact th { padding: 5px 10px; font-size: 13px; }
table.list tr.undone td { color: var(--muted); }
table.dns td.val { min-width: 220px; max-width: 460px; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions form { display: inline; }

/* ── Метки, полосы, вкладки ── */
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; background: #eef0f3; color: #4a5260; font-size: 12px; font-weight: 500; white-space: nowrap; }
.st-ok { background: var(--ok-soft); color: var(--ok); }
.st-warn { background: var(--warn-soft); color: var(--warn); }
.st-bad { background: var(--danger-soft); color: var(--danger); }
.st-wait { background: var(--brand-soft); color: var(--brand-ink); }
.st-off { background: #eef0f3; color: var(--muted); }
.sev-crit { color: var(--danger); font-weight: 600; }
.sev-warn { color: var(--warn); }
.bar { height: 6px; background: #edf0f4; border-radius: 99px; overflow: hidden; margin: 4px 0; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.bar i.warn { background: #e09a00; }
.bar i.bad { background: var(--danger); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 8px 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); border-bottom-color: var(--brand); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 7px; overflow: hidden; }
.seg a { padding: 5px 12px; color: var(--muted); }
.seg a.on { background: var(--brand-soft); color: var(--brand); }
.pager { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0 16px; }
.pager a, .pager span { padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 6px; background: #fff; }
.pager span.on { background: var(--brand-soft); border-color: var(--brand-line); }
.setting { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding: 8px 0; }
.setting .field { flex: 1 1 320px; margin: 0; }

/* ── Вход ── */
body.auth { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.auth-box { width: 100%; max-width: 390px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 28px; box-shadow: 0 2px 10px rgba(20, 30, 50, .05); }
.auth-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; margin-bottom: 20px; }
.auth-box h1 { font-size: 20px; margin-bottom: 6px; }
.auth-box .sub { color: var(--muted); margin: 0 0 16px; }
.auth-err { color: var(--danger); font-size: 13px; margin-top: 10px; }
.auth-back { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; margin-bottom: 12px; font: inherit; }
.code-input { text-align: center; letter-spacing: 8px; font-size: 22px; height: 50px; font-variant-numeric: tabular-nums; }
.consent { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; font-size: 13px; }
.consent input { margin-top: 2px; }
.auth-foot { margin-top: 16px; font-size: 13px; color: var(--muted); text-align: center; }
.auth-legal { margin-top: 14px; font-size: 12.5px; }
.auth-legal a { color: var(--muted); }

/* ── Поддержка (W6, pages/app/support.php, assets/js/support.js) ── */
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 11.5px; font-weight: 600; vertical-align: 1px; }
.sup-list { display: grid; gap: 8px; margin-bottom: 16px; }
.sup-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); }
.sup-item:hover { border-color: var(--brand-line); text-decoration: none; }
.sup-item.is-unread { border-color: var(--brand-line); background: #fbfefd; }
.sup-item__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.sup-item__main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); flex: none; }
.sup-files { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sup-chosen { list-style: none; margin: 0; padding: 0; width: 100%; font-size: 13px; }
.sup-chosen li { padding: 2px 0; overflow-wrap: anywhere; }
.sup-msgs { display: grid; gap: 12px; margin: 14px 0 18px; }
.sup-msg { max-width: 82%; padding: 10px 14px; border-radius: 12px; background: #f6f8f8; border: 1px solid var(--line); overflow-wrap: anywhere; }
.sup-msg--out { justify-self: end; background: var(--brand-soft); border-color: var(--brand-line); }
.sup-msg__who { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.sup-msg__body { white-space: pre-wrap; }
.sup-atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sup-att { display: inline-flex; flex-direction: column; gap: 4px; max-width: 220px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 12.5px; }
.sup-att img { max-width: 200px; max-height: 140px; border-radius: 6px; object-fit: cover; }
.sup-reply { border-top: 1px solid var(--line); padding-top: 14px; }
@media (max-width: 720px) { .sup-msg { max-width: 100%; } }

/* ── Узкие экраны (до 360 px без прокрутки вбок; широкие таблицы листаются внутри .table-wrap) ── */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .grid-2, .form-2 { grid-template-columns: minmax(0, 1fr); }
  .top { gap: 8px 12px; padding: 8px 12px; }
  .top-nav { order: 3; width: 100%; }
  .user-name { display: none; }
  .wrap { padding: 16px 12px 40px; }
  .card { padding: 14px 14px; }
  h1 { font-size: 19px; }
  .page-head .actions { margin-left: 0; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd { margin-bottom: 6px; }
  .acc-switch select { max-width: 150px; }
}
@media (max-width: 420px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .auth-box { padding: 20px 16px; }
  .site .hero h1 { font-size: 25px; }
}
/* Подсказки о заполнении места (миграция 0060): плашка с кнопкой и окно раз в сутки (assets/js/app.js) */
.quota-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.quota-banner > div { flex: 1 1 320px; }
.qmodal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 29, 36, .45); }
.qmodal[hidden] { display: none; }
.qmodal-box { background: var(--panel); border-radius: 12px; max-width: 480px; width: 100%; padding: 22px 22px 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, .2); }
.qmodal-box h2 { margin: 0 0 10px; font-size: 20px; }
.qmodal-box p { margin: 0 0 10px; }
.qmodal-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 14px; }
