/* Портал CRM для руководителя и менеджеров. Цвета — токены ниже, тёмная тема — по настройке системы. */
:root {
  --bg: #eef1f5;
  --side: #1f2a3a;
  --side-ink: #c9d3e0;
  --side-on: #fff;
  --side-hover: rgba(255, 255, 255, .06);
  --card: #fff;
  --ink: #1d2327;
  --muted: #6b7280;
  --line: #e3e7ec;
  --accent: #1f6fd1;
  --accent-soft: #e8f0fb;
  --accent-ink: #fff;
  --ok: #178a46;
  --ok-soft: #e6f6ec;
  --bad: #c62d2d;
  --bad-soft: #fcecec;
  --warn: #b26a00;
  --warn-soft: #fff5e0;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --r: 10px;
  --side-w: 232px;
  --top-h: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --side: #0b0e12;
    --side-ink: #9aa4b2;
    --card: #181c22;
    --ink: #e6e9ee;
    --muted: #8b95a5;
    --line: #2a3039;
    --accent: #4a9fe0;
    --accent-soft: #15283d;
    --accent-ink: #0b1620;
    --ok: #3ccf7a;
    --ok-soft: #10281b;
    --bad: #ff6b6b;
    --bad-soft: #2a1617;
    --warn: #f5b041;
    --warn-soft: #2a2210;
    --shadow: none;
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.p-splash, .p-empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.p-empty.is-bad { color: var(--bad); }
.p-muted { color: var(--muted); }
.p-bad { color: var(--bad); }
.p-ok { color: var(--ok); }
.p-small { font-size: 12px; }
.p-nowrap { white-space: nowrap; }
.p-right { text-align: right; }

/* ---------- Вход ---------- */
.p-login { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.p-login form { width: 100%; max-width: 360px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 28px; display: grid; gap: 14px; }
.p-login h1 { font-size: 20px; }
.p-login .p-logo { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.p-logo b { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 15px; }

/* ---------- Каркас ---------- */
.p-layout { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); grid-template-rows: var(--top-h) 1fr; min-height: 100%; }
.p-side { grid-row: 1 / 3; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: auto; }
.p-side .p-logo { height: var(--top-h); padding: 0 18px; display: flex; align-items: center; gap: 10px; color: var(--side-on); font-weight: 600; font-size: 15px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.p-side .p-logo small { display: block; font-weight: 400; font-size: 11px; color: var(--side-ink); }
.p-nav { padding: 10px 10px 16px; display: grid; gap: 2px; }
.p-nav a, .p-nav span.is-soon { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; color: var(--side-ink); font-size: 14px; }
.p-nav a:hover { background: var(--side-hover); color: var(--side-on); text-decoration: none; }
.p-nav a.is-on { background: var(--accent); color: #fff; }
.p-nav i { font-style: normal; width: 22px; text-align: center; font-size: 17px; filter: grayscale(.3); }
.p-nav a.is-on i { filter: none; }
.p-nav b { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 11px; display: grid; place-items: center; }
.p-nav .p-nav-sep { margin: 10px 12px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: rgba(255, 255, 255, .35); }
.p-nav span.is-soon { opacity: .45; cursor: default; }
.p-nav span.is-soon small { margin-left: auto; font-size: 10px; border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; }
.p-side .p-side-foot { margin-top: auto; padding: 12px 18px 16px; font-size: 12px; color: rgba(255, 255, 255, .4); border-top: 1px solid rgba(255, 255, 255, .07); }
.p-side .p-side-foot a { color: var(--side-ink); display: block; margin-top: 4px; }

.p-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--card); border-bottom: 1px solid var(--line); }
.p-top h1 { font-size: 17px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-search { position: relative; width: 280px; max-width: 40vw; }
.p-search input { width: 100%; height: 36px; padding: 0 12px 0 34px; border: 1px solid var(--line); border-radius: 18px; background: var(--bg); outline: none; }
.p-search input:focus { border-color: var(--accent); background: var(--card); }
.p-search::before { content: '🔍'; position: absolute; left: 11px; top: 8px; font-size: 14px; opacity: .6; }
.p-user { display: flex; align-items: center; gap: 10px; }
.p-user .p-avatar { cursor: pointer; }
.p-user .p-user-name { font-size: 13px; line-height: 1.2; }
.p-user .p-user-name small { display: block; color: var(--muted); font-size: 11px; }
.p-avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13px; flex: none; }
.p-avatar.is-all { background: var(--ok-soft); color: var(--ok); }
.p-avatar.is-big { width: 56px; height: 56px; font-size: 20px; }
.p-menu-btn { display: none; }

.p-main { padding: 20px 24px 40px; min-width: 0; }
.p-main.is-chat { padding: 0; display: flex; flex-direction: column; height: calc(100vh - var(--top-h)); }

/* ---------- Общие элементы ---------- */
.p-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); white-space: nowrap; }
.p-btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.p-btn.is-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.p-btn.is-primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
.p-btn.is-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.p-btn.is-bad { color: var(--bad); border-color: var(--bad-soft); }
.p-btn.is-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.p-btn.is-icon { width: 36px; padding: 0; justify-content: center; }
.p-btn:disabled { opacity: .5; cursor: default; }
.p-link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; }
.p-link:hover { text-decoration: underline; }
.p-link.is-bad { color: var(--bad); }
.p-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.p-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.p-toolbar .p-grow { flex: 1; }
.p-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid var(--line); background: var(--card); font-size: 13px; cursor: pointer; }
.p-chip.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.p-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.p-seg button { height: 34px; padding: 0 12px; border: 0; background: var(--card); color: var(--muted); }
.p-seg button.is-on { background: var(--accent-soft); color: var(--accent); }

.p-card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; }
.p-card + .p-card { margin-top: 16px; }
.p-card h3 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.p-card h3 .p-muted { font-weight: 400; font-size: 13px; }
.p-card h3 .p-right { margin-left: auto; font-weight: 400; font-size: 13px; }
.p-grid { display: grid; gap: 16px; }
.p-grid.is-2 { grid-template-columns: 1fr 1fr; }
.p-grid.is-3 { grid-template-columns: repeat(3, 1fr); }
.p-grid.is-4 { grid-template-columns: repeat(4, 1fr); }
.p-grid.is-deal { grid-template-columns: minmax(300px, 380px) 1fr; align-items: start; }
@media (max-width: 1100px) { .p-grid.is-4 { grid-template-columns: 1fr 1fr; } .p-grid.is-deal { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .p-grid.is-2, .p-grid.is-3, .p-grid.is-4 { grid-template-columns: 1fr; } }

.p-field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.p-field > input, .p-field > select, .p-field > textarea { height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); outline: none; width: 100%; }
.p-field > textarea { height: auto; padding: 8px 10px; resize: vertical; }
.p-field > input:focus, .p-field > select:focus, .p-field > textarea:focus { border-color: var(--accent); }
.p-form { display: grid; gap: 12px; }
.p-form .p-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.p-dl { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 0; font-size: 14px; }
.p-dl dt { color: var(--muted); }
.p-dl dd { margin: 0; word-break: break-word; }
.p-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.p-table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.p-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.p-table tr:last-child td { border-bottom: 0; }
.p-table tr.is-link { cursor: pointer; }
.p-table tr.is-link:hover td { background: var(--accent-soft); }
.p-table .p-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.p-tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.p-tag i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.p-tag.is-late { background: var(--bad-soft); color: var(--bad); }
.p-tag.is-ok { background: var(--ok-soft); color: var(--ok); }
.p-tag.is-warn { background: var(--warn-soft); color: var(--warn); }
.p-tag.is-accent { background: var(--accent-soft); color: var(--accent); }
.p-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.p-tabs button { height: 38px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); margin-bottom: -1px; }
.p-tabs button.is-on { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.p-tabs button b { margin-left: 6px; font-weight: 500; color: var(--muted); font-size: 12px; }

/* тосты и диалоги */
.p-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 1000; padding: 10px 16px; border-radius: 8px; background: #1d2327; color: #fff; opacity: 0; transition: .25s; box-shadow: var(--shadow-lg); max-width: 90vw; }
.p-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.p-toast.is-bad { background: var(--bad); }
.p-modal-back { position: fixed; inset: 0; z-index: 900; background: rgba(10, 14, 20, .5); display: grid; place-items: center; padding: 20px; }
.p-modal { width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: var(--card); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 22px; }
.p-modal.is-wide { max-width: 760px; }
.p-modal h2 { font-size: 18px; margin-bottom: 14px; }
.p-modal .p-modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.p-check { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--ink); }
.p-check input { margin-top: 3px; }
.p-pop { position: absolute; z-index: 800; min-width: 220px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; }
.p-pop button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none; border-radius: 6px; text-align: left; color: var(--ink); }
.p-pop button:hover { background: var(--accent-soft); }
.p-pop .p-pop-sep { height: 1px; background: var(--line); margin: 4px 0; }
.p-pop .p-pop-title { padding: 6px 10px 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* ---------- Рабочий стол ---------- */
.p-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.p-tile { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 16px; display: grid; gap: 2px; cursor: pointer; border: 1px solid transparent; }
.p-tile:hover { border-color: var(--accent); }
.p-tile .p-tile-v { font-size: 26px; font-weight: 600; line-height: 1.1; }
.p-tile .p-tile-l { font-size: 13px; color: var(--muted); }
.p-tile.is-bad .p-tile-v { color: var(--bad); }
.p-tile.is-ok .p-tile-v { color: var(--ok); }
.p-tile.is-accent .p-tile-v { color: var(--accent); }
.p-bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 6px; }
.p-bars div { flex: 1; display: grid; grid-template-rows: 1fr auto; gap: 4px; text-align: center; font-size: 11px; color: var(--muted); height: 100%; }
.p-bars i { display: block; align-self: end; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .85; }
.p-bars i[data-v]:hover { opacity: 1; }
.p-stage-bars { display: grid; gap: 8px; }
.p-stage-bars div { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.p-stage-bars i { grid-column: 1 / 3; height: 6px; border-radius: 3px; background: var(--bg); overflow: hidden; display: block; }
.p-stage-bars i b { display: block; height: 100%; border-radius: 3px; }

/* ---------- Канбан ---------- */
.p-board-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px 12px; }
.p-board { display: flex; gap: 12px; align-items: flex-start; min-height: 60vh; }
.p-col { flex: 0 0 270px; width: 270px; background: rgba(127, 140, 160, .08); border-radius: var(--r); display: flex; flex-direction: column; max-height: calc(100vh - var(--top-h) - 150px); }
.p-col.is-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.p-col-head { padding: 10px 12px 8px; display: flex; align-items: center; gap: 8px; border-top: 3px solid var(--line); border-radius: var(--r) var(--r) 0 0; }
.p-col-head b { font-size: 13px; }
.p-col-head .p-muted { font-size: 12px; margin-left: auto; white-space: nowrap; }
.p-col-body { padding: 0 8px 8px; overflow-y: auto; display: grid; gap: 8px; align-content: start; flex: 1; min-height: 60px; }
.p-dcard { background: var(--card); border-radius: 8px; box-shadow: var(--shadow); padding: 10px 12px; cursor: grab; display: grid; gap: 5px; border-left: 3px solid transparent; }
.p-dcard:hover { box-shadow: 0 2px 8px rgba(16, 24, 40, .14); }
.p-dcard.is-drag { opacity: .4; }
.p-dcard.is-late { border-left-color: var(--bad); }
.p-dcard .p-dcard-t { font-weight: 600; font-size: 14px; line-height: 1.3; }
.p-dcard .p-dcard-m { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.p-dcard .p-dcard-f { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.p-dcard .p-dcard-f .p-avatar { width: 22px; height: 22px; font-size: 10px; }
.p-dcard .p-dcard-f .p-sum { margin-left: auto; font-weight: 600; color: var(--ink); }
.p-list-deals .p-table td:first-child { font-weight: 600; }

/* ---------- Сделка ---------- */
.p-deal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; }
.p-deal-head h2 { font-size: 22px; flex: 1; min-width: 200px; }
.p-pipe { display: flex; gap: 3px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 2px; }
.p-pipe button { flex: 1; min-width: 92px; height: 34px; border: 0; background: var(--line); color: var(--muted); font-size: 12px; position: relative; padding: 0 10px 0 18px; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-pipe button:first-child { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); padding-left: 10px; border-radius: 6px 0 0 6px; }
.p-pipe button.is-done { background: var(--ok-soft); color: var(--ok); }
.p-pipe button.is-cur { color: #fff; font-weight: 600; }
.p-pipe button:disabled { cursor: default; }
.p-task { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.p-task:first-of-type { border-top: 0; padding-top: 0; }
.p-task-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-weight: 500; }
.p-task select { height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); padding: 0 8px; }
.p-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.p-timeline li { display: grid; grid-template-columns: 12px 1fr; gap: 10px; align-items: start; font-size: 13px; }
.p-timeline li i { width: 12px; height: 12px; border-radius: 50%; margin-top: 3px; display: block; }
.p-timeline li.is-done { color: var(--muted); }
.p-timeline li b { display: block; }
.p-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.p-history li { padding: 10px 12px; border-radius: 8px; background: var(--bg); font-size: 13px; }
.p-history li.is-comment { background: var(--accent-soft); }
.p-history li.is-deleted { opacity: .6; }
.p-history li .p-h-meta { font-size: 12px; color: var(--muted); margin-bottom: 2px; display: flex; gap: 8px; }
.p-history li .p-h-meta .p-link { margin-left: auto; }

/* файлы */
.p-files { display: grid; gap: 6px; }
.p-file { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); }
.p-file:hover { border-color: var(--accent); }
.p-file.is-locked { border-color: var(--warn); }
.p-file .p-ficon { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 13px; background: #8c8f94; overflow: hidden; }
.p-file .p-ficon img { width: 100%; height: 100%; object-fit: cover; }
.p-file .p-fname { font-weight: 500; word-break: break-word; }
.p-file .p-fname a { color: var(--ink); }
.p-file .p-fmeta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.p-file .p-facts { display: flex; gap: 4px; }
.p-file .p-facts .p-btn { height: 30px; padding: 0 9px; font-size: 13px; }
.p-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-bottom: 12px; }
.p-photos button { aspect-ratio: 1; border: 0; padding: 0; border-radius: 8px; overflow: hidden; background: var(--bg); cursor: zoom-in; }
.p-photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.p-drop { border: 2px dashed var(--line); border-radius: var(--r); padding: 16px; text-align: center; color: var(--muted); font-size: 13px; margin-top: 10px; }
.p-drop.is-over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.p-progress { font-size: 13px; color: var(--muted); padding: 6px 0; }
.p-versions { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 13px; }
.p-versions li { display: flex; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 6px; background: var(--bg); }
.p-versions li .p-muted { flex: 1; }

/* диск и клиенты */
.p-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 15px; min-width: 0; }
.p-crumbs a { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.p-crumbs a.is-cur { color: var(--ink); font-weight: 600; }
.p-crumbs span { color: var(--muted); }
.p-file.is-folder .p-fname a { color: var(--ink); font-weight: 600; }
.p-browser { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin-top: 10px; display: grid; }
.p-browser-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; text-align: left; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.p-browser-row:last-child { border-bottom: 0; }
.p-browser-row:hover { background: var(--accent-soft); }
.p-browser-row span { text-align: center; font-weight: 700; font-size: 12px; color: var(--muted); }
.p-browser-row b { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-browser-row small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.p-modal .p-crumbs { font-size: 13px; margin-top: 4px; }
.p-notes { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); resize: vertical; font: inherit; }
.p-notes:focus { border-color: var(--accent); outline: none; }

/* редактор во весь экран */
.p-office { position: fixed; inset: 0; z-index: 950; background: var(--card); display: grid; grid-template-rows: 48px 1fr; }
.p-office-bar { display: flex; align-items: center; gap: 10px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--card); }
.p-office-bar .p-office-name { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-office-bar .p-office-name small { font-weight: 400; color: var(--muted); margin-left: 8px; }
.p-office-bar .p-state { font-size: 13px; color: var(--muted); white-space: nowrap; }
.p-office-bar .p-state.is-dirty { color: var(--warn); }
.p-office-bar .p-state.is-saving { color: var(--accent); }
.p-office iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.p-office .p-ro { background: var(--warn-soft); color: var(--warn); font-size: 13px; padding: 6px 14px; }
.p-office.has-ro { grid-template-rows: 48px auto 1fr; }

/* просмотр картинки */
.p-viewer { position: fixed; inset: 0; z-index: 960; background: rgba(0, 0, 0, .88); display: grid; grid-template-rows: 1fr auto; cursor: zoom-out; }
.p-viewer img { max-width: 100%; max-height: 100%; margin: auto; object-fit: contain; }
.p-viewer-bar { display: flex; gap: 16px; padding: 12px 16px; color: #ddd; font-size: 13px; align-items: center; }
.p-viewer-bar a, .p-viewer-bar button { color: #fff; background: none; border: 1px solid #666; border-radius: 6px; padding: 4px 10px; }

/* ---------- Задачи и проекты ---------- */
.p-joblist { display: grid; gap: 4px; }
.p-jobrow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink); border: 1px solid transparent; }
.p-jobrow:hover { background: var(--accent-soft); text-decoration: none; }
.p-jobrow.is-done { opacity: .6; }
.p-jobrow.is-done b { text-decoration: line-through; }
.p-jobdot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.p-jobmain { flex: 1; min-width: 0; display: grid; }
.p-jobmain b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-jobmain em, .p-prio { font-style: normal; color: var(--bad); font-weight: 700; }
.p-jobcard .p-dcard-t { font-weight: 500; }
.p-jsearch { height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 15px; background: var(--card); color: var(--ink); outline: none; width: 180px; }
.p-jsearch:focus { border-color: var(--accent); }
.p-status { height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-weight: 600; }
.p-prose { white-space: pre-wrap; word-break: break-word; }
.p-project { cursor: pointer; display: grid; gap: 8px; align-content: start; }
.p-project:hover { box-shadow: 0 2px 8px rgba(16, 24, 40, .14); }
.p-project-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.p-project-stats { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.p-project-stats b { color: var(--ink); }
.p-project-people { display: flex; gap: 4px; flex-wrap: wrap; }
.p-project-people .p-avatar { width: 26px; height: 26px; font-size: 10px; }
.p-colors { display: flex; gap: 8px; flex-wrap: wrap; }
.p-colors label { cursor: pointer; }
.p-colors input { display: none; }
.p-colors i { display: block; width: 26px; height: 26px; border-radius: 50%; border: 3px solid transparent; }
.p-colors input:checked + i { border-color: var(--ink); }
.p-members { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

/* ---------- Лента ---------- */
.p-grid.is-feed { grid-template-columns: minmax(0, 720px) 260px; }
@media (max-width: 1100px) { .p-grid.is-feed { grid-template-columns: 1fr; } .p-feed-side { display: none; } }
.p-feed-day { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 14px 0 6px; }
.p-feedrow { display: flex; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--card); box-shadow: var(--shadow); margin-bottom: 6px; font-size: 13px; }
.p-feedicon { width: 24px; text-align: center; flex: none; }
.p-post { margin-bottom: 10px; }
.p-post.is-pinned { border: 1px solid var(--warn); background: var(--warn-soft); }
.p-post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.p-post-head > div { flex: 1; }
.p-post-comments { margin-top: 12px; display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.p-post-c { display: flex; gap: 8px; font-size: 13px; }
.p-post-c .p-avatar { width: 26px; height: 26px; font-size: 10px; }
.p-post-reply { display: flex; gap: 6px; margin-top: 10px; }
.p-post-reply input { flex: 1; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); color: var(--ink); outline: none; }
.p-post-reply input:focus { border-color: var(--accent); }

/* ---------- Календарь ---------- */
.p-grid.is-cal { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
@media (max-width: 1000px) { .p-grid.is-cal { grid-template-columns: 1fr; } }
.p-cal-head { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0 6px; }
.p-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.p-cal-cell { min-height: 92px; padding: 4px 6px; border-radius: 8px; background: var(--bg); cursor: pointer; display: grid; align-content: start; gap: 2px; border: 1px solid transparent; overflow: hidden; }
.p-cal-cell:hover { border-color: var(--accent); }
.p-cal-cell.is-out { opacity: .45; }
.p-cal-cell.is-today .p-cal-num { background: var(--accent); color: var(--accent-ink); }
.p-cal-cell.is-sel { border-color: var(--accent); background: var(--accent-soft); }
.p-cal-num { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 13px; font-weight: 600; }
.p-cal-item { font-size: 11px; line-height: 1.3; padding: 1px 4px; border-left: 3px solid var(--accent); background: var(--card); border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-cal-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.p-cal-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; }
@media (max-width: 720px) { .p-cal-cell { min-height: 54px; padding: 2px 4px; } .p-cal-item { font-size: 0; height: 6px; padding: 0; width: 100%; background: currentColor; border: 0; border-radius: 3px; opacity: .6; } .p-cal-legend { display: none; } }

/* ---------- Чат ---------- */
.p-chat { display: grid; grid-template-columns: 300px 1fr; flex: 1; min-height: 0; }
.p-chat-list { border-right: 1px solid var(--line); overflow-y: auto; background: var(--card); }
.p-chat-row { display: flex; gap: 10px; padding: 10px 14px; align-items: center; color: var(--ink); border-bottom: 1px solid var(--line); }
.p-chat-row:hover { background: var(--accent-soft); text-decoration: none; }
.p-chat-row.is-on { background: var(--accent-soft); }
.p-chat-row .p-chat-main { flex: 1; min-width: 0; }
.p-chat-row .p-chat-top { display: flex; justify-content: space-between; gap: 8px; }
.p-chat-row .p-chat-top b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-chat-row .p-chat-last { display: flex; gap: 8px; font-size: 13px; color: var(--muted); }
.p-chat-last span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.p-chat-last i { font-style: normal; background: var(--accent); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 11px; min-width: 18px; text-align: center; }
.p-chat-row.is-unread .p-chat-top b { font-weight: 700; }
.p-thread { display: grid; grid-template-rows: 48px 1fr auto; min-height: 0; background: var(--bg); }
.p-thread-head { display: flex; align-items: center; gap: 10px; padding: 0 16px; background: var(--card); border-bottom: 1px solid var(--line); font-weight: 600; }
.p-thread-head .p-actions { margin-left: auto; }
.p-thread-body { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.p-day { align-self: center; font-size: 12px; color: var(--muted); background: var(--card); padding: 2px 10px; border-radius: 10px; margin: 8px 0; }
.p-msg { max-width: 70%; align-self: flex-start; background: var(--card); border-radius: 12px 12px 12px 4px; padding: 8px 12px; box-shadow: var(--shadow); position: relative; }
.p-msg.is-mine { align-self: flex-end; background: var(--accent-soft); border-radius: 12px 12px 4px 12px; }
.p-msg.is-deleted { opacity: .6; font-style: italic; }
.p-msg-name { font-size: 12px; color: var(--accent); font-weight: 600; margin-bottom: 2px; }
.p-msg-text { white-space: pre-wrap; word-break: break-word; }
.p-msg-time { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.p-msg-del { background: none; border: 0; font-size: 12px; opacity: 0; cursor: pointer; }
.p-msg:hover .p-msg-del { opacity: .7; }
.p-msg-img { border: 0; padding: 0; background: none; display: block; cursor: zoom-in; }
.p-msg-img img { max-width: 320px; max-height: 240px; border-radius: 8px; display: block; }
.p-msg-file { display: inline-flex; gap: 6px; align-items: center; }
.p-tick { font-style: normal; color: var(--muted); }
.p-tick.is-read { color: var(--accent); }
.p-composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 16px; background: var(--card); border-top: 1px solid var(--line); }
.p-composer textarea { flex: 1; max-height: 140px; min-height: 38px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 19px; resize: none; background: var(--bg); outline: none; }
.p-composer textarea:focus { border-color: var(--accent); }
.p-composer .p-attach { width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer; font-size: 18px; }
.p-composer .p-send { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); }
.p-chat-empty { display: grid; place-items: center; color: var(--muted); }

/* ---------- Сотрудники ---------- */
.p-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.p-person { display: flex; gap: 12px; align-items: center; }
.p-person .p-person-name { font-weight: 600; }
.p-person .p-muted { font-size: 12px; }
.p-online { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 4px; }

/* ---------- Мобильная ширина ---------- */
@media (max-width: 900px) {
  :root { --side-w: 0px; }
  .p-layout { grid-template-columns: minmax(0, 1fr); }
  .p-side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 30; transform: translateX(-100%); transition: .2s; }
  .p-side.is-open { transform: none; box-shadow: var(--shadow-lg); }
  .p-menu-btn { display: inline-flex; }
  .p-main { padding: 16px; }
  .p-search { width: 160px; }
  .p-user .p-user-name { display: none; }
  .p-chat { grid-template-columns: 1fr; }
  .p-chat.has-thread .p-chat-list { display: none; }
  .p-chat:not(.has-thread) .p-thread { display: none; }
  .p-msg { max-width: 88%; }
  .p-board-wrap { margin: 0 -16px; padding: 0 16px 12px; }
  .p-file { grid-template-columns: 40px 1fr; }
  .p-file .p-facts { grid-column: 1 / 3; }
  /* таблицы с nowrap-ячейками не должны растягивать страницу: колонки сетки сжимаются, карточка прокручивается */
  .p-grid > * { min-width: 0; }
  .p-card { overflow-x: auto; }
  .p-tiles { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .p-deal-head h2 { font-size: 19px; min-width: 0; flex-basis: 100%; }
  .p-crumbs a { max-width: 140px; }
}

/* ---------- ИИ-помощник ---------- */
.p-ai-fab { position: fixed; right: 22px; bottom: 22px; z-index: 700; width: 50px; height: 50px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 22px; box-shadow: var(--shadow-lg); display: grid; place-items: center; }
.p-ai-fab:hover { filter: brightness(1.08); }
.p-ai { position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 100vw; z-index: 750; background: var(--card); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); display: grid; grid-template-rows: auto auto auto 1fr auto; }
.p-ai-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.p-ai-head b { font-size: 15px; }
.p-ai-head .p-muted { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-ai-head .p-btn.is-sm { width: 30px; height: 30px; padding: 0; justify-content: center; }
.p-ai-ctx { padding: 8px 14px 0; font-size: 12px; color: var(--muted); }
.p-ai-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.p-ai-chips .p-chip { height: 26px; font-size: 12px; padding: 0 10px; }
.p-ai-log { overflow: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 12px; }
.p-ai-q { background: var(--accent-soft); color: var(--ink); border-radius: 12px 12px 4px 12px; padding: 8px 11px; margin-left: 32px; white-space: pre-wrap; word-break: break-word; font-size: 13px; }
.p-ai-a { background: var(--bg); border-radius: 12px 12px 12px 4px; padding: 8px 11px; margin: 6px 24px 0 0; white-space: pre-wrap; word-break: break-word; font-size: 13.5px; line-height: 1.5; }
.p-ai-item.is-bad .p-ai-a { background: var(--bad-soft); color: var(--bad); }
.p-ai-acts { display: flex; gap: 6px; margin-top: 6px; }
.p-ai-compose { border-top: 1px solid var(--line); padding: 10px 14px; display: grid; gap: 8px; }
.p-ai-compose textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); resize: vertical; min-height: 64px; outline: none; }
.p-ai-compose textarea:focus { border-color: var(--accent); }
.p-ai-compose .p-grow, .p-actions .p-grow { flex: 1; }
.p-ai-dots i { animation: p-ai-blink 1.2s infinite; }
.p-ai-dots i:nth-child(2) { animation-delay: .2s; }
.p-ai-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes p-ai-blink { 0%, 60%, 100% { opacity: .2; } 30% { opacity: 1; } }
@media (max-width: 720px) { .p-ai { width: 100vw; } .p-ai-fab { right: 14px; bottom: 14px; } }
/* ---------- Скрипты продаж ---------- */
.p-grid.is-script { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .p-grid.is-script { grid-template-columns: 1fr; } }
.p-script-head { display: flex; align-items: flex-start; gap: 8px; }
.p-script-head > div { flex: 1; min-width: 0; }
.p-script.is-arch { opacity: .65; }
.p-script-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 13px; }
.p-node { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; background: var(--card); }
.p-node-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.p-node-head input { flex: 1; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); font-weight: 600; }
.p-node-num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 600; flex: none; }
.p-node textarea, .p-obj textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); resize: vertical; font-size: 14px; }
.p-node-tips { width: 100%; height: 32px; margin-top: 6px; padding: 0 10px; border: 1px dashed var(--line); border-radius: 8px; background: var(--warn-soft); color: var(--ink); font-size: 13px; }
.p-node-answers { margin-top: 10px; display: grid; gap: 6px; }
.p-ans { display: grid; grid-template-columns: 1fr 190px 130px auto; gap: 6px; align-items: center; }
.p-ans input, .p-ans select { height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); font-size: 13px; min-width: 0; }
.p-ans select[hidden] { display: none; }
@media (max-width: 720px) { .p-ans { grid-template-columns: 1fr 1fr; } }
.p-obj { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.p-obj-head { display: flex; gap: 8px; margin-bottom: 6px; }
.p-obj-title { flex: 1; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); font-weight: 600; }
.p-node input:focus, .p-node textarea:focus, .p-node select:focus, .p-obj input:focus, .p-obj textarea:focus { outline: none; border-color: var(--accent); }

.p-run { position: fixed; inset: 0; z-index: 880; background: var(--bg); display: grid; grid-template-rows: 56px 1fr; }
.p-run-bar { display: flex; align-items: center; gap: 10px; padding: 0 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.p-run-name { flex: 1; min-width: 0; line-height: 1.2; }
.p-run-name b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-run-name small { color: var(--muted); font-size: 12px; }
.p-run-body { display: grid; grid-template-columns: 1fr; min-height: 0; overflow: hidden; }
.p-run-body.has-side { grid-template-columns: 1fr 360px; }
.p-run-main { overflow: auto; padding: 24px; max-width: 900px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.p-run-crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); }
.p-run-crumbs span { background: var(--card); border-radius: 12px; padding: 3px 10px; }
.p-run-crumbs i { font-style: normal; color: var(--accent); }
.p-run-step { background: var(--card); border-radius: 14px; padding: 22px 26px; box-shadow: var(--shadow); }
.p-run-text { font-size: 20px; line-height: 1.5; margin-top: 6px; }
.p-run-tips { margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: var(--warn-soft); font-size: 13px; }
.p-run-answers { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.p-run-answers button { min-height: 60px; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--accent-soft); background: var(--card); color: var(--ink); font-size: 15px; font-weight: 500; text-align: left; display: flex; flex-direction: column; gap: 2px; }
.p-run-answers button:hover { border-color: var(--accent); }
.p-run-answers button.is-end { border-style: dashed; }
.p-run-answers button small { font-weight: 400; color: var(--muted); font-size: 12px; }
.p-run-foot { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; margin-top: auto; }
.p-run-foot textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); resize: vertical; }
.p-run-side { border-left: 1px solid var(--line); background: var(--card); overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.p-run-side input[type=search] { height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); }
.p-run-objitem { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.p-run-objitem summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.p-run-objitem div { padding: 6px 0 2px; font-size: 14px; line-height: 1.45; }
.p-run-ai { margin-top: auto; border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 6px; }
.p-run-ai textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); resize: vertical; }
.p-run-ai-out { white-space: pre-wrap; font-size: 13.5px; line-height: 1.45; }
.p-run-results { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.p-run-results label { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.p-run-results label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 900px) { .p-run-body.has-side { grid-template-columns: 1fr; } .p-run-body.has-side .p-run-main { display: none; } .p-run-text { font-size: 17px; } }
/* ---------- MCP ---------- */
.p-code { margin: 6px 0; padding: 10px 12px; border-radius: 8px; background: var(--bg); font-size: 12px; line-height: 1.45; white-space: pre-wrap; word-break: break-all; }
.p-code.is-inline { padding: 6px 10px; margin: 0; }
.p-inp { height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); }
.p-modal details { margin: 8px 0; }
.p-modal details summary { cursor: pointer; }
/* ---------- Облака ---------- */
.p-browser { max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.p-browser-row.is-file { cursor: default; grid-template-columns: 28px 1fr auto auto; }
.p-browser-row.is-file:hover { background: transparent; }
.p-browser-row.is-file .p-btn { margin-left: 8px; }
/* ---------- Телефония ---------- */
.p-call-pop { position: fixed; right: 22px; bottom: 86px; z-index: 760; width: 340px; max-width: calc(100vw - 32px); background: var(--card); border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); padding: 14px; display: grid; gap: 8px; animation: p-call-in .25s ease-out; }
.p-call-pop + .p-call-pop { bottom: 300px; }
@keyframes p-call-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.p-call-head { display: flex; align-items: center; gap: 10px; }
.p-call-head > div { flex: 1; min-width: 0; }
.p-call-ring { font-size: 22px; animation: p-call-shake 1s infinite; }
@keyframes p-call-shake { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-15deg); } 40% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } 80% { transform: rotate(5deg); } }
.p-call-deals { display: grid; gap: 2px; }
.p-call-deals a { font-weight: 500; }
/* ---------- Почта ---------- */
.p-watch-types { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.p-watch-types .p-check { font-size: 13px; }
@media (max-width: 720px) { .p-watch-types { grid-template-columns: 1fr; } }.p-progress i { display: block; height: 6px; border-radius: 3px; background: var(--accent); transition: width .3s; min-width: 2px; }
/* ---------- Почтовые ящики ---------- */
.p-mail { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.p-mail-side { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 8px 0; position: sticky; top: calc(var(--top-h) + 16px); max-height: calc(100vh - var(--top-h) - 32px); overflow: auto; }
.p-mail-box { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 6px; }
.p-mail-box-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 8px 4px 14px; font-weight: 600; font-size: 13px; }
.p-mail-box-head span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-mail-box-head .p-btn { height: 26px; width: 26px; }
.p-mail-err { margin: 0 10px 4px 14px; font-size: 11px; color: var(--bad); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-mail-folder { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px 7px 14px; border: 0; background: none; color: var(--ink); font-size: 14px; text-align: left; cursor: pointer; border-radius: 0; }
.p-mail-folder i { font-style: normal; width: 20px; text-align: center; flex: none; }
.p-mail-folder b { margin-left: auto; font-size: 11px; font-weight: 600; background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 1px 7px; }
.p-mail-folder:hover { background: var(--accent-soft); }
.p-mail-folder.is-on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.p-mail-folder.is-dim { color: var(--muted); }
.p-mail-side-foot { display: flex; gap: 6px; padding: 10px 14px 4px; border-top: 1px solid var(--line); margin-top: 8px; flex-wrap: wrap; }
.p-mail-main { min-width: 0; }
.p-mail-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.p-mail-tools h3 { font-size: 17px; margin: 0; }
.p-mail-tools .p-inp { height: 30px; font-size: 13px; }
.p-mail-menu { display: none; }
.p-mail-list { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.p-mail-row { display: grid; grid-template-columns: 22px 28px 200px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 10px 14px 10px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.p-mail-row:last-of-type { border-bottom: 0; }
.p-mail-row:hover, .p-mail-row.is-sel { background: var(--accent-soft); }
.p-mail-cb { width: 16px; height: 16px; margin: 0; cursor: pointer; accent-color: var(--accent); }
.p-mail-selbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 12px; margin-bottom: 10px; border-radius: 10px; background: var(--accent-soft); font-size: 13px; }
.p-mail-selbar b { font-weight: 600; margin-right: 6px; }
.p-mail-row.is-unread .p-mail-who, .p-mail-row.is-unread .p-mail-subj > span { font-weight: 700; }
.p-mail-star { border: 0; background: none; font-size: 17px; color: var(--muted); cursor: pointer; padding: 0; line-height: 1; }
.p-mail-star.is-on { color: #e8a200; }
.p-mail-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.p-mail-who small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
.p-mail-subj { min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-mail-subj i { font-style: normal; color: var(--muted); font-size: 12px; }
.p-mail-subj small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.p-mail-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.p-mail-pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px; }
.p-mail-view { display: grid; gap: 12px; }
.p-mail-head h2 { margin: 0 0 8px; font-size: 18px; word-break: break-word; }
.p-mail-hdr { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 14px; margin-bottom: 4px; word-break: break-word; }
.p-mail-ai { margin: 8px 0; padding: 8px 12px; border-radius: 8px; background: var(--accent-soft); font-size: 13px; }
.p-mail-acts { margin-top: 8px; }
.p-mail-body { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.p-mail-body iframe { display: block; width: 100%; height: 320px; border: 0; background: #fff; }
.p-mail-imgs { padding: 6px 10px; background: var(--bg); border-top: 1px solid var(--line); }
.p-mail-pre { margin: 0; padding: 12px 14px; white-space: pre-wrap; word-break: break-word; font: 14px/1.5 inherit; color: var(--ink); background: var(--card); max-height: 60vh; overflow: auto; }
.p-mail-atts { display: flex; flex-wrap: wrap; gap: 8px; }
.p-mail-att { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font-size: 13px; max-width: 100%; }
.p-mail-att b { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; color: #fff; font-size: 11px; flex: none; }
.p-mail-att small { color: var(--muted); }
.p-mail-reply { border-top: 1px solid var(--line); padding-top: 12px; }
.p-mail-answer { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: var(--bg); font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
@media (max-width: 900px) {
  .p-mail { grid-template-columns: 1fr; }
  .p-mail-side { display: none; position: static; max-height: none; }
  .p-mail-side.is-open { display: block; }
  .p-mail-menu { display: inline-flex; }
  .p-mail-row { grid-template-columns: 22px 24px minmax(0, 1fr) auto; }
  .p-mail-who { grid-column: 3; }
  .p-mail-subj { grid-column: 3 / 5; }
  .p-mail-meta { grid-column: 4; grid-row: 1; }
}