/* Белое поле, чёрный текст, одна гарнитура. Иерархия — размером и весом, а не украшениями. */
:root {
  --ink: #000;
  --grey: #7f7f7f;
  --rule: #e3e3e3;
  --paper: #fff;
  --up: #0a8a3e;
  --down: #d7261e;
  --pad: clamp(20px, 4vw, 64px);
  --font: "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.45 var(--font); font-feature-settings: "tnum" 1, "lnum" 1; }

a { color: inherit; text-decoration: none; border-bottom: 1px solid rgba(0, 0, 0, .22); transition: border-color .15s; }
a:hover { border-bottom-color: var(--ink); }
a.ext::after { content: "\2009↗"; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

button, .btn { font: inherit; cursor: pointer; }
.btn { display: inline-block; border: 0; background: var(--ink); color: var(--paper); padding: 11px 20px 12px; border-radius: 0; }
.btn:hover { background: #333; }
.btn[disabled] { background: var(--rule); color: var(--grey); cursor: default; }
.link { border: 0; background: none; padding: 0; color: inherit; border-bottom: 1px dashed rgba(0, 0, 0, .35); }
.link:hover { border-bottom-color: var(--ink); }
.link.danger { color: var(--down); border-bottom-color: rgba(215, 38, 30, .4); }

/* шапка */
header.top { display: flex; align-items: baseline; gap: 40px; padding: 22px var(--pad); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 20px; letter-spacing: -.01em; border: 0; }
nav { display: flex; gap: 28px; flex-wrap: wrap; }
nav a, nav b { font-size: 16px; }
nav b { font-weight: 700; }
.state { margin-left: auto; color: var(--grey); font-size: 14px; flex: 0 1 auto; min-width: 0; text-align: right; }
@media (min-width: 721px) { header.top { flex-wrap: nowrap; } nav { flex-wrap: nowrap; white-space: nowrap; } .who { white-space: nowrap; } }
.state a { color: var(--ink); }

main { padding: 0 var(--pad) 120px; }

/* заголовок раздела — главный элемент страницы */
h1 { font-size: clamp(40px, 6.2vw, 104px); line-height: .98; letter-spacing: -.035em; font-weight: 700; margin: 56px 0 24px; max-width: 16ch; }
h1.long { max-width: 22ch; }
.lead { font-size: clamp(19px, 1.7vw, 26px); line-height: 1.35; max-width: 46ch; margin: 0 0 12px; letter-spacing: -.01em; }
.lead + .lead { margin-top: 0; }
h2 { font-size: clamp(24px, 2.2vw, 34px); letter-spacing: -.02em; line-height: 1.1; margin: 80px 0 16px; font-weight: 700; }
h3 { font-size: 19px; margin: 40px 0 10px; }
p { max-width: 70ch; }
.muted { color: var(--grey); }
.small { font-size: 14px; }
.up { color: var(--up); }
.down { color: var(--down); }
.nowrap { white-space: nowrap; }

/* переключатели вида: обычный текст, выбранное — жирным */
.filters { display: flex; flex-wrap: wrap; gap: 14px 40px; align-items: baseline; margin: 48px 0 18px; }
.filters .group { display: flex; gap: 16px; flex-wrap: wrap; align-items: baseline; }
.filters .label { color: var(--grey); }
.filters b { font-weight: 700; }
.filters input[type=search] { font: inherit; border: 0; border-bottom: 1px solid var(--ink); padding: 2px 0; width: 260px; background: transparent; }
.filters input[type=search]:focus { outline: none; border-bottom-width: 2px; }

/* таблицы на всю ширину */
.tablewrap { overflow-x: auto; margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th { text-align: left; font-weight: 400; color: var(--grey); font-size: 13px; padding: 10px 14px 10px 0; border-bottom: 1px solid var(--ink); vertical-align: bottom; white-space: nowrap; }
th.sort { cursor: pointer; user-select: none; }
th.sort:hover { color: var(--ink); }
th.on { color: var(--ink); }
td { padding: 11px 14px 11px 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; white-space: nowrap; }
th.r, td.r { text-align: right; }
td.wrap { white-space: normal; min-width: 280px; max-width: 520px; }
tr:hover td { background: #fafafa; }
td .sub { display: block; color: var(--grey); font-size: 13px; }
.star { border: 0; background: none; font-size: 19px; line-height: 1; padding: 0 4px; color: #c9c9c9; }
.star.on { color: var(--ink); }
.star:hover { color: var(--ink); }
.more { margin-top: 24px; }

/* формы: подпись над полем, без плейсхолдеров вместо подписей */
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 26px 40px; max-width: 1200px; margin: 24px 0; }
.field label { display: block; color: var(--grey); font-size: 14px; margin-bottom: 6px; }
.field input[type=text], .field input[type=number], .field input[type=date], .field input[type=password], .field select, .field textarea {
  font: inherit; width: 100%; border: 0; border-bottom: 1px solid var(--ink); padding: 6px 0; background: transparent; border-radius: 0; }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-bottom-width: 2px; padding-bottom: 5px; }
.field .hint { color: var(--grey); font-size: 13px; margin-top: 6px; }
.field.wide { grid-column: span 2; }
.check { display: flex; gap: 10px; align-items: baseline; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
.actions { display: flex; gap: 24px; align-items: baseline; flex-wrap: wrap; margin: 8px 0 0; }
.saved { color: var(--up); }
.error { color: var(--down); }
/* индикатор памяти и диска сервера на «Данных» */
.meters { margin: 24px 0 8px; display: grid; gap: 8px; max-width: 720px; }
.meter { display: grid; grid-template-columns: 160px 160px 1fr; gap: 12px; align-items: center; font-size: 14px; }
.meter .label { color: var(--grey); }
.meter .bar { display: block; height: 6px; background: #eee; }
.meter .bar i { display: block; height: 100%; background: var(--ink); }
.meter.hot .bar i { background: var(--down); }
.meter.hot > span:last-child { color: var(--down); }
@media (max-width: 640px) { .meter { grid-template-columns: 1fr; gap: 4px; } }
/* ⚑ подозрительно точные входы — заметно, но без тревожной плашки */
.flag { color: #c2410c; text-decoration: none; }
.susp { margin: 32px 0 0; max-width: 720px; }
.susp h3 { margin: 0 0 8px; }

/* inline-редактирование в таблице */
td input.inline { font: inherit; border: 0; border-bottom: 1px dashed rgba(0,0,0,.3); background: transparent; padding: 1px 0; width: 100%; min-width: 120px; }
td input.inline.num { width: 90px; min-width: 0; text-align: right; }
td input.inline::placeholder { color: #b5b5b5; }
td input.inline:focus { outline: none; border-bottom: 1px solid var(--ink); }

/* сводка кошелька: определения в две колонки */
dl.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 28px 40px; margin: 40px 0 0; }
dl.facts div { border-top: 1px solid var(--ink); padding-top: 10px; }
dl.facts dt { color: var(--grey); font-size: 14px; }
dl.facts dd { margin: 2px 0 0; font-size: clamp(26px, 2.4vw, 38px); letter-spacing: -.02em; font-weight: 700; line-height: 1.1; }
dl.facts dd .word { display: inline-block; font-size: clamp(19px, 1.5vw, 24px); letter-spacing: -.01em; line-height: 1.2; padding-top: 4px; }
dl.facts dd small { display: block; font-size: 14px; font-weight: 400; color: var(--grey); letter-spacing: 0; margin-top: 6px; line-height: 1.35; }

/* журнал задач */
.job { border-top: 1px solid var(--ink); padding: 14px 0 18px; }
.job .head { display: flex; gap: 24px; align-items: baseline; flex-wrap: wrap; }
.job .title { font-weight: 700; }
.job.done { padding: 10px 0 12px; border-top-color: var(--rule); }
.job.done .title { font-weight: 400; }
.bar { height: 3px; background: var(--rule); margin: 12px 0 10px; max-width: 640px; }
.bar i { display: block; height: 100%; background: var(--ink); transition: width .4s; }
.log { font-size: 14px; color: var(--grey); max-height: 220px; overflow: auto; max-width: 900px; }
.log div { padding: 1px 0; }
.log div:last-child { color: var(--ink); }

ol.steps { padding-left: 1.3em; max-width: 70ch; }
ol.steps li { margin: 0 0 22px; padding-left: 6px; }
ol.steps li::marker { font-weight: 700; }

.addr { font-size: 15px; color: var(--grey); word-break: break-all; }
.empty { font-size: clamp(19px, 1.7vw, 26px); max-width: 40ch; line-height: 1.35; margin: 40px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 10px 0; }

@media (max-width: 720px) { .field.wide { grid-column: auto; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- аккаунт ---------- */
.who { font-size: 14px; display: flex; gap: 14px; align-items: baseline; }
.state + .who { margin-left: 28px; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 700; text-align: center; line-height: 18px; vertical-align: 2px; }
body.guest header.top .state, body.guest header.top nav { display: none; }
.auth { max-width: 760px; }
.form.narrow { grid-template-columns: 1fr; max-width: 420px; gap: 22px; }
.btn.small { padding: 6px 12px 7px; font-size: 14px; }
.jobmsg { margin: 8px 0 0; max-width: 900px; }
.m-only { display: none !important; }
select.plain { font: inherit; border: 0; border-bottom: 1px solid var(--ink); background: transparent; padding: 2px 0; border-radius: 0; }

/* ---------- телефон ---------- */
@media (max-width: 720px) {
  body { font-size: 16px; }
  header.top { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; padding: 16px var(--pad) 10px; align-items: baseline; }
  header.top nav { grid-column: 1 / -1; grid-row: 2; overflow-x: auto; white-space: nowrap; gap: 20px; flex-wrap: nowrap; padding-bottom: 6px; scrollbar-width: none; }
  header.top nav::-webkit-scrollbar { display: none; }
  .who { grid-column: 2; grid-row: 1; justify-self: end; }
  .who .muted { display: none; }
  .state, .state + .who { margin: 0; }
  .state { grid-column: 1 / -1; grid-row: 3; font-size: 13px; }
  h1 { font-size: clamp(34px, 10vw, 48px); margin: 28px 0 18px; letter-spacing: -.03em; }
  h2 { margin-top: 56px; }
  .lead { font-size: 19px; }
  .m-only { display: flex !important; }
  .m-hide { display: none !important; }
  .filters { gap: 12px 24px; margin-top: 32px; }
  .filters .group { gap: 6px 14px; }
  .filters input[type=search] { width: 100%; }
  .filters .group:has(input[type=search]) { flex: 1 1 100%; }

  /* таблица превращается в список: строка — блок, ячейка — подпись и значение */
  .tablewrap { margin: 0; padding: 0; overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; padding: 16px 0 18px; border-bottom: 1px solid var(--rule); }
  tr:first-child { border-top: 1px solid var(--ink); }
  tr:hover td { background: none; }
  td { border: 0; padding: 0; white-space: normal; text-align: left !important; min-width: 0 !important; max-width: none !important; font-size: 16px; }
  td::before { content: attr(data-label); display: block; color: var(--grey); font-size: 12px; margin-bottom: 1px; }
  td[data-label=""]::before { display: none; }
  td.t { grid-column: 1 / -1; font-size: 18px; font-weight: 700; order: -2; }
  td.t::before { display: none; }
  td.t .sub { font-weight: 400; }
  td.sc { order: -3; grid-column: 2; grid-row: 1; justify-self: end; width: auto; }
  tr:has(td.sc) td.t { grid-column: 1; grid-row: 1; }
  td:empty { display: none; }
  .star { font-size: 26px; padding: 4px 6px; min-width: 44px; min-height: 44px; }
  td input.inline, td input.inline.num { width: 100%; text-align: left; font-size: 16px; }
  .actions-cell .btn { margin-right: 14px; }

  dl.facts { grid-template-columns: 1fr 1fr; gap: 22px 18px; }
  dl.facts dd { font-size: 26px; }
  .form { grid-template-columns: 1fr; gap: 22px; }
  .btn { padding: 13px 20px 14px; }
  .actions { gap: 18px; }
  .job .head { gap: 8px 16px; }
}
@media (max-width: 380px) { dl.facts { grid-template-columns: 1fr; } }

.code { font-size: clamp(40px, 5vw, 64px); font-weight: 700; letter-spacing: .08em; margin: 8px 0 20px; font-variant-numeric: tabular-nums; user-select: all; }
table.cmds { max-width: 900px; } table.cmds td.t { width: 260px; }

/* ---------- избранное: вкладки и события ---------- */
.addline { margin-top: 36px; align-items: end; }
.addline .field { min-width: min(420px, 100%); }
.addline .field + .field { min-width: min(300px, 100%); }
nav.tabs { display: flex; gap: 32px; margin: 56px 0 8px; padding-bottom: 14px; border-bottom: 1px solid var(--ink); font-size: 19px; flex-wrap: wrap; }
nav.tabs b { font-weight: 700; }
#tabBody > .lead:first-child { margin-top: 28px; }
.loading { margin-top: 28px; }

.events { margin-top: 8px; }
.event { padding: 26px 0 30px; border-bottom: 1px solid var(--rule); max-width: 1100px; }
.event .ehead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 24px; }
.event h3 { margin: 0; font-size: 21px; line-height: 1.25; letter-spacing: -.01em; flex: 1 1 420px; }
.event .meta { margin: 0; color: var(--grey); }
.event .meta b { color: var(--ink); }
.vote { display: flex; height: 6px; margin: 16px 0 4px; gap: 2px; max-width: 640px; }
.vote i { display: block; height: 100%; }
.choice { margin-top: 16px; }
.clabel { margin-bottom: 6px; }
.dot { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: 0; }
.wrow { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr) 110px 130px 170px 120px; gap: 4px 18px;
        padding: 7px 0 7px 16px; border-top: 1px solid #f0f0f0; align-items: baseline; }
.wrow .r { text-align: right; white-space: nowrap; }
.wnote { color: var(--grey); font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.notebox { margin: 32px 0 0; max-width: 640px; }
.notebox label { display: block; color: var(--grey); font-size: 14px; margin-bottom: 6px; }
.notebox textarea { width: 100%; font: inherit; border: 0; border-bottom: 1px solid var(--ink); padding: 6px 0; resize: vertical; background: transparent; }
.notebox textarea:focus { outline: none; border-bottom-width: 2px; }
td.notecell { min-width: 220px; }
@media (max-width: 720px) {
  nav.tabs { gap: 20px; font-size: 17px; margin-top: 36px; overflow-x: auto; flex-wrap: nowrap; white-space: nowrap; }
  .event h3 { font-size: 19px; flex-basis: 100%; }
  .wrow { grid-template-columns: 1fr auto; padding-left: 0; }
  .wrow .wnote { grid-column: 1 / -1; order: 5; }
  .wrow .r { text-align: left; }
  .wrow .muted:last-child { grid-column: 1 / -1; }
}
.wrow .wname { justify-self: start; }
.notebox .hint { display: block; color: var(--grey); font-size: 13px; margin-top: 6px; }

/* ---------- ИИ ---------- */
.askbox { max-width: 760px; margin-top: 14px; }
.askbox textarea { width: 100%; font: inherit; font-size: 18px; border: 0; border-bottom: 1px solid var(--ink); padding: 8px 0; resize: vertical; background: transparent; }
.askbox textarea:focus { outline: none; border-bottom-width: 2px; }
.answer { margin-top: 24px; border-left: 3px solid var(--ink); padding: 4px 0 4px 18px; }
.answer .q { color: var(--grey); margin: 0 0 8px; }
.answer .a { white-space: pre-wrap; font-size: 17px; line-height: 1.5; max-width: 70ch; }
.provider { border-top: 1px solid var(--rule); padding-top: 16px; margin-top: 22px; max-width: 1100px; }
.provider h4 { margin: 0 0 6px; font-size: 17px; }
.provider .form { margin: 12px 0; }
ul.facts { list-style: none; padding: 0; margin: 16px 0 8px; max-width: 70ch; }
ul.facts li { border-top: 1px solid #ddd; padding: 10px 0; font-size: 17px; display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
ul.facts li:last-child { border-bottom: 1px solid #ddd; }
.answer .react { font-size: 32px; }
/* внутри Телеграма: шапку даёт сам Телеграм, свою делаем компактнее */
html.tg header.top { padding-top: 12px; padding-bottom: 12px; gap: 8px 24px; }
html.tg header.top .state { display: none; }
