/* Портал ТСЖ — светлая тема. Все цвета проверены на контраст (см. contrast.py). */
:root {
  --bg: #FFFFFF;
  --surface: #F8F9FD;      /* заливка блока вместо рамки */
  /* тень плотная и короткая + тонкий кант: разделяет края, не размазывает фон */
  --shadow: 0 1px 3px rgba(23,32,74,0.05), 0 0 0 1px rgba(23,32,74,0.035);
  --shadow-card: 0 1px 2px rgba(23,32,74,0.06), 0 0 0 1px rgba(23,32,74,0.045);
  --surface-2: #EEF1F8;    /* вложенный элемент, ховер */
  --line: #E8EBF2;
  --text: #16181D;
  --muted: #6C727C;
  --accent: #3A4CB0;
  --accent-soft: #EEF0FC;
  --green: #08845B;
  --ok-bg: #E9F8F1;   --ok-fg: #0B6B47;
  --warn-bg: #FFF4E0; --warn-fg: #8A5A00;
  --err-bg: #FDECE8;  --err-fg: #9E3520;
  --r-block: 20px;
  --r-inner: 16px;
  --r-pill: 999px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Golos Text', 'Segoe UI', system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

/* ——— каркас ——— */
.shell { width: 100%; max-width: 1440px; min-height: 100vh; margin: 0 auto; display: flex; flex-direction: column; }
.header { height: 76px; flex-shrink: 0; display: flex; align-items: center; gap: 28px; padding: 0 40px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: #FFF; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.brand .name { font-size: 15px; font-weight: 600; line-height: 1.25; }
.brand .sub { font-size: 12px; color: var(--muted); line-height: 1.3; }
.nav { display: flex; align-items: center; gap: 4px; flex-grow: 1; }
.nav a { font-size: 15px; font-weight: 500; color: var(--muted); text-decoration: none; padding: 9px 14px; border-radius: var(--r-pill); }
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a.on { color: var(--text); font-weight: 600; }
.main { flex-grow: 1; padding: 8px 40px 48px; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.page-head .where { font-size: 14px; color: var(--muted); }
.row { display: flex; gap: 20px; align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 20px; }
.grow { flex-grow: 1; min-width: 0; }

/* ——— блоки ——— */
.block { background: var(--surface); border-radius: var(--r-block); padding: 24px; box-shadow: var(--shadow); }
.block.plain { background: var(--bg); padding: 0; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.block-title { font-size: 17px; font-weight: 600; }
.card { background: var(--bg); border-radius: var(--r-inner); padding: 18px; box-shadow: var(--shadow-card); }
.link { font-size: 14px; font-weight: 500; color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ——— кнопки ——— */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 48px; padding: 0 22px; border: none; border-radius: var(--r-pill); font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-green { background: var(--green); color: #FFF; }
.btn-accent { background: var(--accent); color: #FFF; }
.btn-outline { background: var(--bg); color: var(--accent); box-shadow: inset 0 0 0 1.5px #D5DAEC; }
.btn-ghost { background: var(--surface-2); color: var(--accent); }
.btn-sm { height: 40px; padding: 0 16px; font-size: 14px; }
.icon-btn { width: 48px; height: 48px; border: none; border-radius: var(--r-pill); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; }
.icon-btn .dot { position: absolute; top: 12px; right: 13px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.select { display: inline-flex; align-items: center; gap: 10px; height: 48px; padding: 0 18px; border: none; border-radius: var(--r-pill); background: var(--surface); font-family: inherit; font-size: 15px; font-weight: 600; color: var(--text); cursor: pointer; }

/* ——— мелочи ——— */
.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; border-radius: var(--r-pill); padding: 5px 12px; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge-warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge-err { background: var(--err-bg); color: var(--err-fg); }
.badge-info { background: var(--accent-soft); color: var(--accent); }
.badge-mute { background: var(--surface-2); color: var(--muted); }
.amount { font-size: 46px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.05; }
.stat { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.label { font-size: 14px; color: var(--muted); }
.note { font-size: 13px; color: var(--muted); line-height: 1.5; }
.banner { border-radius: var(--r-inner); padding: 18px 22px; font-size: 15px; font-weight: 500; }
.banner-ok { background: var(--ok-bg); color: var(--ok-fg); }

.dl { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.dl > div { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; text-align: right; }

.feed { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.feed li { display: flex; flex-direction: column; gap: 4px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: none; padding-bottom: 0; }
.feed li:first-child { padding-top: 0; }
.feed .t { font-size: 14px; font-weight: 500; line-height: 1.4; }
.feed .d { font-size: 13px; color: var(--muted); }

/* ——— админский каркас: светлый сайдбар ——— */
.layout { display: flex; min-height: 100vh; }
.side { width: 264px; flex-shrink: 0; background: var(--surface); padding: 24px 16px; display: flex; flex-direction: column; gap: 28px; }
.side .brand { padding: 0 8px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { font-size: 15px; font-weight: 500; color: var(--muted); text-decoration: none; padding: 11px 14px; border-radius: 12px; }
.side-nav a:hover { background: var(--bg); color: var(--text); }
.side-nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side .who { margin-top: auto; background: var(--bg); border-radius: var(--r-inner); padding: 14px 16px; box-shadow: var(--shadow-card); }
.side .who b { display: block; font-size: 14px; font-weight: 600; }
.side .who span { font-size: 13px; color: var(--muted); }
.content { flex-grow: 1; min-width: 0; padding: 28px 36px 48px; display: flex; flex-direction: column; gap: 20px; }
.toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* ——— вкладки, поиск, фильтры ——— */
.tabs { display: flex; gap: 6px; }
.tab { font-size: 15px; font-weight: 500; color: var(--muted); text-decoration: none; padding: 10px 16px; border-radius: var(--r-pill); }
.tab.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.search { flex-grow: 1; height: 48px; border: none; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--shadow); padding: 0 22px; font-family: inherit; font-size: 15px; color: var(--text); }
.search::placeholder { color: var(--muted); }
.filter { display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 20px; border: none; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--shadow); font-family: inherit; font-size: 15px; font-weight: 500; color: var(--text); cursor: pointer; }

/* ——— таблица ——— */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 13px; font-weight: 500; color: var(--muted); padding: 0 16px 14px; }
.tbl td { padding: 16px; border-top: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr:hover td { background: var(--bg); }
.tbl tr.hot td { background: var(--err-bg); }
.tbl tr.me td { background: var(--accent-soft); }
.tbl .num { font-weight: 600; }
.tbl .right { text-align: right; }
.tbl tfoot td { border-top: 1px solid var(--line); font-weight: 700; font-size: 15px; }

/* ——— журнал / ход работы ——— */
.timeline { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 20px; }
.timeline li { position: relative; padding-left: 26px; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.timeline li.wait::before { background: var(--bg); box-shadow: inset 0 0 0 2px #C7CCD6; }
.timeline li.now::before { background: var(--warn-fg); }
.timeline .t { font-size: 15px; font-weight: 600; line-height: 1.35; }
.timeline .d { font-size: 13px; color: var(--muted); line-height: 1.5; }
.timeline .say { margin-top: 8px; background: var(--bg); border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.5; }

/* ——— фотоплейсхолдеры ——— */
.slots { display: flex; gap: 12px; flex-wrap: wrap; }
.slot { width: 128px; height: 96px; border-radius: var(--r-inner); background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--line); display: flex; align-items: center; justify-content: center; text-align: center; font-size: 12px; color: var(--muted); padding: 8px; }
.slot.add { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px #CFD6F5; color: var(--accent); font-weight: 600; flex-direction: column; gap: 4px; }

/* ——— телефон исполнителя ——— */
.phone-page { min-height: 100vh; background: #EDEFF5; display: flex; align-items: center; justify-content: center; padding: 24px; }
.phone { width: 390px; height: 844px; background: var(--bg); border-radius: 32px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 18px 50px rgba(23,32,74,0.16); }
.phone-head { background: var(--surface); padding: 20px 20px 18px; display: flex; flex-direction: column; gap: 16px; flex-shrink: 0; }
.phone-body { flex-grow: 1; overflow: hidden; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.phone-foot { padding: 12px 16px 20px; display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; }
.chips { display: flex; gap: 8px; }
.chip { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--bg); border-radius: var(--r-pill); padding: 8px 14px; }
.chip.on { background: var(--accent); color: #FFF; }
.task { background: var(--surface); border-radius: var(--r-inner); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; }
.task .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.task .t { font-size: 16px; font-weight: 600; line-height: 1.3; }
.tbl .nw { white-space: nowrap; }
.row.even { align-items: stretch; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* карточка заявки в списке */
.ticket { background: var(--surface); border-radius: var(--r-inner); padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; }
.ticket.on { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px #CFD6F5; }
.ticket .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ticket .no { font-size: 13px; font-weight: 600; color: var(--muted); }
.ticket .t { font-size: 15px; font-weight: 600; line-height: 1.35; }

/* ——— подсказка у заголовка блока ——— */
.titled { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hint {
  display: inline-flex; align-items: center; justify-content: center;
  width: 19px; height: 19px; flex-shrink: 0; border-radius: 50%;
  background: var(--surface-2); color: var(--muted);
  font-size: 12px; font-weight: 700; font-style: normal; line-height: 1;
  cursor: help; position: relative;
}
.hint:hover, .hint:focus-visible { background: var(--accent-soft); color: var(--accent); outline: none; }
.hint::after {
  content: attr(data-hint);
  position: absolute; left: 50%; top: calc(100% + 10px); transform: translateX(-50%);
  width: 300px; max-width: 70vw;
  background: var(--text); color: var(--bg);
  font-size: 13px; font-weight: 400; line-height: 1.5; text-align: left;
  padding: 11px 14px; border-radius: 12px;
  opacity: 0; visibility: hidden; pointer-events: none; z-index: 30;
  transition: opacity 0.12s ease;
  box-shadow: 0 8px 28px rgba(23,32,74,0.18);
}
.hint::before {
  content: ""; position: absolute; left: 50%; top: calc(100% + 4px);
  transform: translateX(-50%); border: 6px solid transparent;
  border-bottom-color: var(--text);
  opacity: 0; visibility: hidden; z-index: 30; transition: opacity 0.12s ease;
}
.hint:hover::after, .hint:focus-visible::after,
.hint:hover::before, .hint:focus-visible::before { opacity: 1; visibility: visible; }
/* у правого края всплывающая подсказка ушла бы за экран */
.hint.left::after { left: auto; right: -8px; transform: none; }
.hint.left::before { left: auto; right: 4px; transform: none; }
@media (prefers-reduced-motion: reduce) { .hint::after, .hint::before { transition: none; } }

/* ─────────────────────────── телефон и планшет ───────────────────────────
   Жильцы заходят с телефона, поэтому это не украшение, а рабочий режим.
   ponytail: ширины блоков заданы инлайном в шаблонах, поэтому здесь !important —
   переписывать полсотни шаблонов ради трёх правил не стоит.
*/
@media (max-width: 900px) {
  /* кабинет жильца */
  .shell { min-height: 100dvh; }
  .header { height: auto; flex-wrap: wrap; padding: 14px 16px; gap: 10px; }
  .brand .name { font-size: 14px; }
  .nav {
    order: 5; width: 100%; flex-wrap: nowrap; overflow-x: auto; gap: 2px;
    padding-bottom: 2px; scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; font-size: 14px; padding: 8px 12px; }
  .select, .icon-btn { height: 42px; }
  .icon-btn { width: 42px; }
  .main { padding: 6px 16px 40px; gap: 16px; }

  /* панель управления: боковое меню становится верхней лентой */
  .layout { flex-direction: column; }
  .side {
    width: 100%; flex-direction: row; align-items: center; gap: 14px;
    padding: 12px 16px; overflow-x: auto; scrollbar-width: none;
    /* без min-width флекс-элемент не даёт себя сжать, и вся страница
       становится шире экрана вместо того, чтобы прокручиваться меню */
    min-width: 0;
  }
  .layout > *, .content, .main, .row > *, .col > * { min-width: 0; }
  /* ponytail: страницу режем по ширине экрана, прокрутка остаётся внутри
     меню и таблиц. Точечно ловить каждый вылезающий блок дороже, чем польза */
  .layout, .shell { max-width: 100vw; overflow-x: hidden; }
  .side::-webkit-scrollbar { display: none; }
  .side .brand { flex-shrink: 0; }
  .side-nav { flex-direction: row; gap: 4px; }
  .side-nav a { white-space: nowrap; padding: 9px 14px; font-size: 14px; }
  .side .who { margin-top: 0; flex-shrink: 0; padding: 10px 14px; }
  .content { padding: 18px 16px 40px; }

  /* колонки складываются в одну */
  .row, .col { flex-direction: column; }
  .row > *, .col > * { width: 100% !important; max-width: 100% !important; }
  .row.even { align-items: stretch; }

  /* заголовки и суммы соразмерно экрану */
  .page-head { gap: 6px; }
  .page-head h1 { font-size: 24px; }
  .toolbar h1 { font-size: 24px !important; }
  .amount { font-size: 34px; }
  .stat { font-size: 22px; }
  .block { padding: 18px; border-radius: 16px; }
  .block-head { flex-wrap: wrap; gap: 8px; }

  /* таблицы прокручиваются внутри себя, а не растягивают страницу */
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; flex-shrink: 0; }
  .tbl { display: block; overflow-x: auto; white-space: nowrap; }
  .tbl td, .tbl th { padding: 12px 10px; }

  /* подсказка не должна вылезать за край экрана */
  .hint::after { width: 260px; max-width: 78vw; }

  /* кнопки в столбик на всю ширину */
  .btn { width: 100%; }
  .toolbar > div:last-child { width: 100%; display: flex; flex-direction: column; gap: 8px; }
}

@media (max-width: 520px) {
  .brand .sub { display: none; }
  .page-head .where { font-size: 13px; }
  .amount { font-size: 30px; }
  .slot { width: 100% !important; }
}

/* ——— периоды с раскрытием: детализация открывается на месте, а не уводит ——— */
.шапка-периода,
.период > summary {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) repeat(4, minmax(90px, 140px));
  gap: 12px;
  align-items: center;
}
.шапка-периода { padding: 0 44px 12px 16px; font-size: 13px; }
.период { border-top: 1px solid var(--line); }
.период > summary {
  padding: 16px 16px 16px 40px;
  cursor: pointer;
  list-style: none;
  position: relative;
  font-size: 14px;
}
.период > summary::-webkit-details-marker { display: none; }
.период > summary::before {
  content: "›";
  position: absolute;
  left: 16px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  transition: transform 0.15s ease;
}
.период[open] > summary::before { transform: rotate(90deg); }
.период > summary:hover { background: var(--bg); }
.период > summary .месяц { font-weight: 600; }
.период[open] > summary { background: var(--accent-soft); }

@media (max-width: 900px) {
  .шапка-периода { display: none; }
  .период > summary {
    grid-template-columns: 1fr auto;
    row-gap: 4px;
    padding-left: 34px;
  }
  .период > summary .месяц { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .период > summary::before { transition: none; }
}

/* ——— заявка как переписка (кабинет жильца) ——— */
.chat { display: flex; flex-direction: column; gap: 10px; }
.chat .msg { max-width: 86%; padding: 12px 14px; border-radius: 16px; font-size: 15px; line-height: 1.5; white-space: pre-line; }
.chat .msg.me { align-self: flex-end; background: var(--accent); color: #FFF; border-bottom-right-radius: 6px; }
.chat .msg.them { align-self: flex-start; background: var(--bg); box-shadow: var(--shadow-card); border-bottom-left-radius: 6px; }
.chat .msg.photo { padding: 6px; }
.chat .msg.photo img { display: block; max-width: 240px; max-height: 240px; border-radius: 10px; }
.chat .meta { display: block; font-size: 11px; opacity: .7; margin-top: 4px; }
.chat .who { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--accent); }
.chat .sys { align-self: center; font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: var(--r-pill); padding: 5px 12px; text-align: center; }
.chat .sys b { color: var(--text); font-weight: 600; }
/* QR оплаты: размер задаём здесь, картинка тянется по viewBox */
.qr { width: 190px; height: 190px; }
.qr svg { display: block; width: 100%; height: 100%; }

.composer { display: flex; align-items: flex-end; gap: 8px; background: var(--bg); border-radius: 24px; padding: 6px 6px 6px 16px; box-shadow: inset 0 0 0 1.5px var(--line); }
.composer:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
/* Полоса «добавьте кабинет на телефон»: снизу, поверх страницы, не перекрывая
   содержимое целиком. Показывается один раз, дальше человек её закрывает. */
.yarlyk {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 50;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--bg); border-radius: var(--r-inner); padding: 12px 16px;
  box-shadow: 0 8px 28px rgba(20, 20, 43, 0.18), 0 0 0 1px var(--line);
  font-size: 14px; max-width: 640px; margin: 0 auto;
}
.yarlyk > span { flex: 1; min-width: 200px; }

/* Поле формы: подпись, ввод и подсказка друг под другом. Без этого браузер
   ставил их в строку, и подсказка обтекала поле. Ширину ограничиваем: у
   textarea собственный cols=40, и на телефоне она вылезала за край экрана. */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > .label { font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea { max-width: 100%; box-sizing: border-box; }
.field textarea { width: 100%; }

.composer textarea { flex: 1; border: none; background: transparent; font-family: inherit; font-size: 15px; resize: none; padding: 9px 0; min-height: 40px; max-height: 160px; outline: none; color: var(--text); }
.composer .ico { width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--surface-2); color: var(--accent); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; font-size: 16px; }
.composer .ico.send { background: var(--accent); color: #FFF; }

/* Заявка-чат во всю доступную высоту: переписка прокручивается внутри,
   поле ввода всегда на виду — иначе на длинной переписке до него не добраться. */
/* align-items у .row — flex-start, поэтому карточка тянулась по тексту, а не по экрану */
.row.tickets { flex: 1; min-height: 0; align-items: stretch; }
.row.tickets > .col { max-height: 100%; overflow-y: auto; }
.chat-card { display: flex; flex-direction: column; max-height: 100%; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 22px 4px; }
.chat-foot { padding: 10px 22px 22px; }

/* Кнопка «назад» к списку заявок: нужна только на телефоне, где список и
   переписка — разные экраны. */
.nazad { display: none; }

@media (max-width: 900px) {
  /* на телефоне колонки складываются в одну — фиксированная высота там мешает */
  .row.tickets, .row.tickets > .col, .chat-card { max-height: none; }
  .chat-scroll { overflow: visible; padding: 16px 16px 4px; }
  .chat-foot { padding: 10px 16px 18px; }

  /* один экран — одно дело: или список заявок, или переписка по одной из них */
  .row.tickets[data-otkryta] > .col { display: none; }
  .row.tickets:not([data-otkryta]) .chat-card { display: none; }
  .nazad {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; margin-right: 10px; flex-shrink: 0;
    border-radius: 50%; background: rgba(255, 255, 255, 0.6);
    color: inherit; text-decoration: none; font-size: 19px; line-height: 1;
  }
}
.composer .ico.has-file { background: var(--ok-bg); color: var(--ok-fg); }
.status-big { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--r-pill); font-weight: 600; font-size: 14px; white-space: nowrap; }
.ticket-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 22px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.ticket-head .state { font-size: 16px; font-weight: 600; margin-top: 4px; line-height: 1.35; }
/* статус — цветной пилюлей, сама шапка нейтральная */
.ticket-head.info .status-big { background: var(--accent-soft); color: var(--accent); }
.ticket-head.warn .status-big { background: var(--warn-bg); color: var(--warn-fg); }
.ticket-head.ok   .status-big { background: var(--ok-bg); color: var(--ok-fg); }
.ticket-head.err  .status-big { background: var(--err-bg); color: var(--err-fg); }
.ticket-head.mute .status-big { background: var(--bg); color: var(--muted); }
@media (max-width: 520px) { .ticket-head { flex-direction: column; align-items: flex-start; } }
.tbl tr.rowlink { cursor: pointer; }
.tbl tr.rowlink:hover td { background: var(--surface-2); }
.chat .msg.me .who { color: rgba(255,255,255,.85); }
.chat .sys.internal { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }

/* ——— заявка у диспетчера: полоса свойств и история-таблица ——— */
.props { padding: 16px 20px; }
.props-grid { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin: 0; }
.props-grid .prop { display: flex; flex-direction: column; gap: 5px; min-width: 150px; }
.props-grid .prop.grow { flex: 1 1 260px; }
.props-grid .prop label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.props-grid .prop select, .props-grid .prop input:not([type=file]), .props-grid .prop textarea { height: 42px; border-radius: 12px; padding: 0 12px; font-size: 14px; }
.props-grid .prop textarea { height: auto; padding: 10px 12px; }
.prop-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.fold { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.tl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.45; white-space: pre-line; }
.tl tr:last-child td { border-bottom: none; }
.tl td.when { color: var(--muted); white-space: nowrap; width: 100px; }
.tl td.who { white-space: nowrap; width: 130px; font-weight: 600; }
.tl tr.res td.who { color: var(--accent); }
.tl tr.res td:last-child { background: var(--accent-soft); border-radius: 8px; }
.tl tr.sys td { color: var(--muted); }
.tl tr.sys td b { color: var(--text); }
.tl .thumb { display: block; max-width: 220px; max-height: 160px; border-radius: 8px; margin-top: 4px; }
.reply { display: flex; gap: 8px; align-items: flex-end; margin-top: 14px; }
.reply textarea { flex: 1; border: none; border-radius: 14px; background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--line); padding: 11px 14px; font-family: inherit; font-size: 14px; resize: none; min-height: 44px; max-height: 160px; }
.reply textarea:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
@media (max-width: 700px) { .tl td.who { width: auto; } .tl td.when { width: auto; font-size: 12px; } .prop-actions { margin-left: 0; } }
