/* =====================================================================
   CRM Funtrail — интерфейс (desktop + mobile)
   ===================================================================== */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8ee;
  --border-strong: #cfd7e0;
  --text: #0f1b2a;
  --text-2: #4a5a6c;
  --muted: #7b8a9b;
  --primary: #0f766e;
  --primary-600: #0d6660;
  --primary-50: #e7f5f3;
  --danger: #dc2626;
  --danger-50: #fdecec;
  --warning: #d97706;
  --warning-50: #fef5e6;
  --success: #16a34a;
  --success-50: #e9f8ef;
  --info: #2563eb;
  --info-50: #eaf1fe;
  --sidebar: #0c1d2b;
  --sidebar-text: #b6c4d2;
  --sidebar-active: #15324a;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(15, 27, 42, .06), 0 1px 3px rgba(15, 27, 42, .04);
  --shadow-lg: 0 10px 30px rgba(15, 27, 42, .16);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --topbar-h: 56px;
  --sidebar-w: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1520; --surface: #111e2b; --surface-2: #0f1a26; --border: #1f3042; --border-strong: #2b4157;
    --text: #e6edf4; --text-2: #b1c0cf; --muted: #7d90a3; --primary: #2bb3a3; --primary-600: #3cc4b4; --primary-50: #0f2e2d;
    --danger-50: #3a1717; --warning-50: #3a2a10; --success-50: #102e1c; --info-50: #12233f;
    --sidebar: #08121b; --sidebar-active: #13283b; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1520; --surface: #111e2b; --surface-2: #0f1a26; --border: #1f3042; --border-strong: #2b4157;
  --text: #e6edf4; --text-2: #b1c0cf; --muted: #7d90a3; --primary: #2bb3a3; --primary-600: #3cc4b4; --primary-50: #0f2e2d;
  --danger-50: #3a1717; --warning-50: #3a2a10; --success-50: #102e1c; --info-50: #12233f;
  --sidebar: #08121b; --sidebar-active: #13283b; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 .75em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.neg, .text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.strike { text-decoration: line-through; opacity: .6; }
.ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.inline { display: inline; }
.hidden { display: none !important; }
.right { text-align: right; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mb-0 { margin-bottom: 0; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--sidebar); color: var(--sidebar-text);
  position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; height: var(--topbar-h); border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: inherit; text-decoration: none; cursor: pointer; }
.brand-logo { width: 32px; height: 32px; border-radius: 8px; background: var(--primary); color: #fff; display: grid; place-items: center; }
.brand-logo .ic { width: 20px; height: 20px; }
.brand-name { color: #fff; font-weight: 650; font-size: 15px; line-height: 1.1; flex: 1; }
.brand-name small { display: block; font-weight: 500; color: var(--sidebar-text); font-size: 11px; letter-spacing: .08em; }
.nav { flex: 1; overflow-y: auto; padding: 8px; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: #6f8396; padding: 14px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--sidebar-text); font-weight: 500; }
.nav-link:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 var(--primary); }
.sidebar-foot { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.06); }
.me { display: flex; align-items: center; gap: 10px; flex: 1; color: #fff; min-width: 0; }
.me:hover { text-decoration: none; }
.me strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { color: var(--sidebar-text); }
.sidebar .icon-btn { color: var(--sidebar-text); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-grid; place-items: center; font-weight: 600; flex: none; font-size: 13px; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 20px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.search { flex: 1; max-width: 520px; position: relative; display: flex; align-items: center; }
.search .ic { position: absolute; left: 10px; color: var(--muted); }
.search input { width: 100%; padding: 8px 12px 8px 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { background: none; border: 0; padding: 7px; border-radius: 8px; color: var(--text-2); cursor: pointer; display: inline-grid; place-items: center; position: relative; }
.icon-btn:hover { background: var(--surface-2); text-decoration: none; }
.bell-count { position: absolute; top: 1px; right: 0; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; border-radius: 9px; padding: 0 5px; min-width: 17px; line-height: 17px; text-align: center; }
.content { padding: 20px; max-width: 1480px; width: 100%; }
.only-mobile { display: none !important; }
.sidebar-backdrop { display: none; }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-title { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.page-title h1 { margin: 0; }
.page-sub { color: var(--text-2); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.back { color: var(--text-2); padding: 4px; border-radius: 6px; margin-top: -1px; }
.back:hover { background: var(--surface); }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 550;
  cursor: pointer; white-space: nowrap; line-height: 1.2; text-decoration: none !important; min-height: 36px;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn .ic { width: 16px; height: 16px; }
.btn-sm { padding: 5px 10px; font-size: 13px; min-height: 30px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-danger-ghost { color: var(--danger); border-color: transparent; background: transparent; }
.btn-danger-ghost:hover { background: var(--danger-50); border-color: transparent; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn.active { background: var(--primary-50); border-color: var(--primary); color: var(--primary); }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 8px 8px 0; }
.link-sm { font-size: 12.5px; background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; font-family: inherit; }
.link-danger { color: var(--danger); }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { display: inline-block; padding: 1px 7px; border-radius: 10px; border: 1px solid var(--border); font-size: 11px; color: var(--text-2); margin-left: 2px; }
.chip:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.chip-wa:hover { border-color: #25d366; color: #128c4a; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; }
.card + .card, .card + .grid, .grid + .card, .grid + .grid { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); align-items: start; }
.dl { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 6px 12px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; word-break: break-word; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; font-weight: 600; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; color: inherit; display: block; }
a.kpi:hover { border-color: var(--primary); text-decoration: none; }
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-value { font-size: 20px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.kpi-danger .kpi-value { color: var(--danger); }
.kpi-warning .kpi-value { color: var(--warning); }
.kpi-success .kpi-value { color: var(--success); }
.delta-up { color: var(--success); } .delta-down { color: var(--danger); }

/* ---------- Badges ---------- */
.badge { --c: #64748b; display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #fff; background: var(--c); white-space: nowrap; line-height: 1.5; }
.badge-soft { background: color-mix(in srgb, var(--c) 14%, transparent); color: color-mix(in srgb, var(--c) 80%, var(--text)); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--muted); }
.dot-ok { background: var(--success); } .dot-soon { background: var(--warning); } .dot-overdue { background: var(--danger); }
.tag { display: inline-flex; gap: 4px; align-items: center; font-size: 11.5px; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.tag-warn { background: var(--warning-50); border-color: transparent; color: var(--warning); }
.tag-danger { background: var(--danger-50); border-color: transparent; color: var(--danger); }
.tag-info { background: var(--info-50); border-color: transparent; color: var(--info); }

/* ---------- Alerts ---------- */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid transparent; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert-success { background: var(--success-50); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert-error { background: var(--danger-50); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-warning { background: var(--warning-50); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.alert-info { background: var(--info-50); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }

/* ---------- Forms ---------- */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 8px 10px; width: 100%; min-height: 36px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 35%, transparent); border-color: var(--primary); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; min-height: 0; accent-color: var(--primary); padding: 0; }
input[type=color] { padding: 2px; height: 36px; }
input[type=file] { padding: 6px; }
textarea { resize: vertical; }
input[readonly] { background: var(--surface-2); color: var(--text-2); }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 12.5px; color: var(--text-2); font-weight: 550; }
.field .req { color: var(--danger); }
.field .hint { color: var(--muted); }
.field .error { color: var(--danger); font-weight: 500; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-all, .span-4 { grid-column: 1 / -1; }
.field-check { justify-content: flex-end; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px !important; color: var(--text) !important; font-weight: 450 !important; padding: 8px 0; }
.form-section { grid-column: 1 / -1; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; padding-top: 10px; border-top: 1px dashed var(--border); margin-top: 4px; }
.form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding-top: 6px; }
.form-sticky { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 12px 16px; margin: 16px -16px -16px; border-radius: 0 0 var(--radius) var(--radius); z-index: 5; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.input-group { display: flex; }
.input-group > * { border-radius: 0; }
.input-group > :first-child { border-radius: 8px 0 0 8px; }
.input-group > :last-child { border-radius: 0 8px 8px 0; margin-left: -1px; }
.warnings { background: var(--warning-50); border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent); color: var(--warning); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
.warnings ul { margin: 4px 0 8px; padding-left: 18px; }
.radio-tabs { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.radio-tabs label { padding: 6px 12px; cursor: pointer; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.radio-tabs input { display: none; }
.radio-tabs label:has(input:checked) { background: var(--primary-50); color: var(--primary); font-weight: 600; }
.mail-from { padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }

/* Inline (раскрывающиеся) формы вместо модальных окон */
details.inline-form { margin-top: 10px; }
details.inline-form > summary { list-style: none; display: inline-flex; }
details.inline-form > summary::-webkit-details-marker { display: none; }
details.inline-form[open] > summary { margin-bottom: 10px; background: var(--primary-50); border-color: var(--primary); color: var(--primary); }
details.inline-form > form, details.inline-form > .inline-body { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
details.row-details > summary { cursor: pointer; list-style: none; }
details.row-details > summary::-webkit-details-marker { display: none; }

/* ---------- Filters ---------- */
.filters { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 14px; }
.filters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; align-items: end; }
.filters .field label { font-size: 12px; }
.filters-toggle { display: none; }
.view-switch { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 12px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:hover { background: color-mix(in srgb, var(--primary) 3%, transparent); }
.table tfoot td { font-weight: 650; background: var(--surface-2); border-top: 2px solid var(--border-strong); }
.table .num { text-align: right; white-space: nowrap; }
.table-compact td, .table-compact th { padding: 6px 10px; }
.table tr.row-danger td { background: color-mix(in srgb, var(--danger) 6%, transparent); }
.table tr.row-warning td { background: color-mix(in srgb, var(--warning) 7%, transparent); }
.table tr.row-muted td { color: var(--muted); }
.table tr.row-void td { text-decoration: line-through; color: var(--muted); }
.table tr.row-void td.no-strike, .table tr.row-void td.no-strike * { text-decoration: none; }
.card > .table-wrap .table tr:last-child td { border-bottom: 0; }
.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--muted); }
.bar { display: inline-block; width: 100%; max-width: 160px; height: 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; vertical-align: middle; }
.bar > span { display: block; height: 100%; background: var(--primary); }
.progress { height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.progress > span { display: block; height: 100%; background: var(--success); }

/* ---------- Pager ---------- */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; flex-wrap: wrap; }
.pager-links { display: flex; gap: 4px; flex-wrap: wrap; }
.pager-links a, .pager-links span { padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); font-size: 13px; }
.pager-links .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 14px; scrollbar-width: none; scroll-margin-top: 70px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 14px; color: var(--text-2); font-weight: 550; border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab .count { font-size: 11px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 0 6px; color: var(--text-2); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Order header ---------- */
.order-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.fin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.fin-grid > div { background: var(--surface); padding: 10px 12px; }
.fin-grid .l { font-size: 12px; color: var(--muted); }
.fin-grid .v { font-weight: 650; font-variant-numeric: tabular-nums; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.timeline li::after { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }

/* ---------- Checklist ---------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 10px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist .done .cl-title { text-decoration: line-through; color: var(--muted); }
.checklist .overdue .cl-due { color: var(--danger); font-weight: 600; }
.cl-title { flex: 1; }
.cl-toggle { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; cursor: pointer; padding: 0; color: #fff; }
.done .cl-toggle { background: var(--success); border-color: var(--success); }
.cl-toggle .ic { width: 14px; height: 14px; }

/* ---------- Comments & files ---------- */
.comment { padding: 10px 0; border-bottom: 1px solid var(--border); }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.comment-head .avatar { width: 24px; height: 24px; font-size: 11px; }
.comment-text { white-space: pre-wrap; word-break: break-word; }
.comment-edit > summary { list-style: none; cursor: pointer; }
.comment-edit > summary::-webkit-details-marker { display: none; }
.comment-edit[open] > summary { display: none; }
.comment-form { margin-top: 12px; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.file-card { display: flex; gap: 10px; border: 1px solid var(--border); border-radius: 8px; padding: 8px; background: var(--surface); }
.file-preview { width: 64px; height: 64px; border-radius: 6px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; flex: none; }
.file-preview img { width: 100%; height: 100%; object-fit: cover; }
.file-ext { font-size: 11px; font-weight: 700; color: var(--text-2); }
.file-meta { min-width: 0; }
.file-name { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; scroll-snap-type: x mandatory; }
.kanban-col { flex: 0 0 290px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 190px); scroll-snap-align: start; }
.kanban-head { padding: 10px 12px; font-weight: 650; display: flex; align-items: center; gap: 4px; border-bottom: 2px solid var(--c); }
.kanban-head .count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 500; }
.kanban-cards { padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 60px; }
.kanban-col.drag-over .kanban-cards { background: var(--primary-50); outline: 2px dashed var(--primary); outline-offset: -4px; border-radius: 8px; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px; box-shadow: var(--shadow); cursor: grab; font-size: 13px; }
.kanban-card.dragging { opacity: .5; }
.kanban-card a.title { font-weight: 650; color: var(--text); }
.kanban-card .meta { color: var(--muted); font-size: 12px; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.kanban-card select { margin-top: 8px; font-size: 12px; min-height: 30px; padding: 4px 6px; }
.kanban-mobile-move { display: none; }

/* ---------- Calendar ---------- */
.cal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.cal-title { font-size: 15px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-wd { padding: 6px 8px; font-size: 12px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); text-align: center; }
.cal-cell { min-height: 108px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.other { background: var(--surface-2); }
.cal-cell.other .cal-day { color: var(--muted); }
.cal-cell.today .cal-day { background: var(--primary); color: #fff; }
.cal-day { font-size: 12px; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: var(--text); }
.cal-ev { --c: #3b82f6; display: block; font-size: 11.5px; padding: 2px 6px; border-radius: 4px; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--text); border-left: 3px solid var(--c); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal-ev:hover { text-decoration: none; background: color-mix(in srgb, var(--c) 24%, transparent); }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 6px; }
.cal-list-day { display: grid; grid-template-columns: 110px 1fr; border-bottom: 1px solid var(--border); }
.cal-list-day.today { background: var(--primary-50); }
.cal-list-date { padding: 10px 12px; font-weight: 650; }
.cal-list-events { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.cal-ev-row { --c: #3b82f6; display: flex; gap: 10px; padding: 8px 10px; border-radius: 6px; border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 8%, var(--surface)); color: var(--text); }
.cal-ev-row:hover { text-decoration: none; background: color-mix(in srgb, var(--c) 16%, var(--surface)); }
.cal-ev-time { font-weight: 700; min-width: 44px; }

/* ---------- Dashboard ---------- */
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.w-12 { grid-column: span 12; } .w-8 { grid-column: span 8; } .w-6 { grid-column: span 6; } .w-4 { grid-column: span 4; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 10px 16px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-start; }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.tour-time { font-weight: 700; font-size: 15px; min-width: 48px; font-variant-numeric: tabular-nums; }
.mini-stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; }

/* ---------- Notifications ---------- */
.ntf { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); color: inherit; }
.ntf:hover { background: var(--surface-2); text-decoration: none; }
.ntf.unread { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.ntf.unread .ntf-title { font-weight: 650; }
.ntf-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: transparent; }
.ntf.unread .ntf-dot { background: var(--primary); }

/* ---------- Driver mobile screen ---------- */
.trip-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.trip-card + .trip-card { margin-top: 14px; }
.trip-time { font-size: 26px; font-weight: 750; font-variant-numeric: tabular-nums; }
.big-input { font-size: 20px; padding: 12px; min-height: 50px; font-variant-numeric: tabular-nums; }
.btn-lg { padding: 12px 18px; font-size: 16px; min-height: 48px; width: 100%; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, #0c1d2b 0%, #0f766e 100%); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 16px; padding: 28px; box-shadow: var(--shadow-lg); }
.auth-card .brand-logo { width: 44px; height: 44px; border-radius: 12px; margin-bottom: 14px; }
.auth-card .brand-logo .ic { width: 26px; height: 26px; }

/* ---------- Confirm dialog (единственное модальное окно) ---------- */
.confirm-dialog { border: 0; border-radius: 14px; padding: 22px; max-width: 420px; width: calc(100% - 32px); box-shadow: var(--shadow-lg); background: var(--surface); color: var(--text); }
.confirm-dialog::backdrop { background: rgba(8, 18, 27, .5); }
.confirm-text { font-size: 15px; margin-bottom: 18px; white-space: pre-line; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Diff (audit) ---------- */
.diff td.old { color: var(--danger); background: var(--danger-50); }
.diff td.new { color: var(--success); background: var(--success-50); }
.json { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-all; }

/* ---------- Documents (print) ---------- */
.doc { max-width: 820px; margin: 0 auto; background: #fff; color: #111; padding: 40px; border-radius: var(--radius); border: 1px solid var(--border); }
.doc h1 { font-size: 24px; }
.doc table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.doc th, .doc td { border-bottom: 1px solid #ddd; padding: 8px; text-align: left; }
.doc .num { text-align: right; }
.doc-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.doc-toolbar { max-width: 820px; margin: 0 auto 12px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Tax invoice: тёмная шапка с суммой к оплате, все цены с GST */
.inv { --inv-navy: #001254; --inv-muted: #646e7d; --inv-rule: #e2e6ec; max-width: 820px; margin: 0 auto; background: #fff; color: var(--inv-navy);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.inv-banner { background: var(--inv-navy); color: #fff; padding: 44px 64px 40px; }
.inv-kicker { font-size: 12px; font-weight: 700; letter-spacing: .12em; }
.inv-amount { font-size: 44px; font-weight: 700; line-height: 1.15; margin-top: 8px; }
.inv-amount span { font-size: 16px; font-weight: 400; }
.inv-due { margin-top: 14px; color: #dfe4f2; }
.inv-body { padding: 40px 64px 28px; }
.inv-parties { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.inv-right { text-align: right; }
.inv-label { font-size: 12px; letter-spacing: .1em; color: var(--inv-muted); margin-bottom: 6px; }
.inv-name { font-size: 22px; font-weight: 700; }
.inv-name-sm { font-size: 17px; }
.inv-muted { color: var(--inv-muted); font-size: 14px; line-height: 1.5; margin-top: 2px; }
.inv-meta { display: flex; gap: 28px; flex-wrap: wrap; border-top: 1px solid var(--inv-rule); border-bottom: 1px solid var(--inv-rule); padding: 12px 0; margin: 28px 0 24px; color: var(--inv-muted); font-size: 14px; }
.inv-meta strong { color: var(--inv-navy); margin-left: 6px; }
.inv-table { width: 100%; border-collapse: collapse; }
.inv-table th { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--inv-muted); text-align: left; padding: 10px 0; border-bottom: 1px solid var(--inv-rule); }
.inv-table td { padding: 14px 0; border-bottom: 1px solid var(--inv-rule); font-size: 15px; vertical-align: top; }
.inv-table .num { text-align: right; padding-left: 16px; white-space: nowrap; }
.inv-sub { font-size: 12px; color: var(--inv-muted); margin-top: 3px; }
.inv-sum { display: flex; justify-content: flex-end; gap: 48px; color: var(--inv-muted); margin-top: 12px; font-size: 15px; }
.inv-sum span:last-child { color: var(--inv-navy); min-width: 110px; text-align: right; }
.inv-total { display: flex; justify-content: space-between; font-size: 21px; font-weight: 700; border-top: 1px solid var(--inv-rule); margin-top: 28px; padding-top: 18px; }
.inv-note { font-size: 12px; color: var(--inv-muted); margin-top: 6px; }
.inv-pay { border-top: 1px solid var(--inv-rule); margin-top: 24px; padding-top: 18px; line-height: 1.6; }
.inv-foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--inv-rule); margin-top: 28px; padding-top: 18px; color: var(--inv-muted); font-size: 14px; }
@media (max-width: 640px) {
  .inv-banner, .inv-body { padding-left: 20px; padding-right: 20px; }
  .inv-amount { font-size: 34px; }
  .inv-right { text-align: left; }
}
@media print { .inv { border: 0; border-radius: 0; } }

@media print {
  .sidebar, .topbar, .bottom-nav, .page-actions, .doc-toolbar, .filters, .no-print, .tabs, .pager { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; max-width: none; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; }
  .doc { border: 0; padding: 0; }
  .table th { background: #eee !important; }
  a { color: #000; }
  .table-cards td::before { display: none !important; }
}

/* =====================================================================
   Адаптив
   ===================================================================== */
@media (max-width: 1200px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .w-8, .w-4 { grid-column: span 12; }
  .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .w-6 { grid-column: span 12; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  :root { --topbar-h: 52px; }
  .only-mobile { display: inline-grid !important; }
  .sidebar { transform: translateX(-105%); transition: transform .22s ease; width: min(86vw, 300px); box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(8,18,27,.45); z-index: 35; }
  body.sidebar-open { overflow: hidden; }
  .main { margin-left: 0; }
  .topbar { padding: 0 10px; gap: 6px; }
  .content { padding: 14px 12px calc(84px + env(safe-area-inset-bottom)); }
  h1 { font-size: 19px; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .dash { gap: 12px; }

  .bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex !important; justify-content: space-around; align-items: center;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--text-2); background: none; border: 0; font-family: inherit; padding: 2px; cursor: pointer; }
  .bottom-nav a.active { color: var(--primary); }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav .ic { width: 22px; height: 22px; }
  .bottom-nav .bn-plus { flex: 0 0 52px; height: 52px; border-radius: 50%; background: var(--primary); color: #fff; justify-content: center; margin-top: -24px; box-shadow: var(--shadow-lg); }

  /* Таблицы → карточки */
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tfoot, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { border-bottom: 1px solid var(--border); padding: 8px 12px; }
  .table-cards tbody tr:hover { background: none; }
  .table-cards td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table-cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; max-width: 45%; }
  .table-cards td[data-label=""]::before { display: none; }
  .table-cards td.num { white-space: normal; }
  .table-cards td.cell-main { display: block; text-align: left; padding-bottom: 4px; }
  .table-cards td.cell-main::before { display: none; }
  .table-cards td:empty { display: none; }
  .table-cards tfoot tr { background: var(--surface-2); }

  .filters-toggle { display: inline-flex; }
  .filters:not(.open) .filters-grid { display: none; }
  .filters { padding: 8px 10px; }
  .filters.open .filters-grid { margin-top: 10px; }
  .page-actions { width: 100%; }
  .kanban-col { flex-basis: 84vw; max-height: none; }
  .kanban-mobile-move { display: block; }
  .cal-cell { min-height: 64px; padding: 2px; }
  .cal-ev { font-size: 0; padding: 0; height: 6px; border-left-width: 0; border-radius: 3px; background: var(--c); }
  .cal-ev b { display: none; }
  .cal-list-day { grid-template-columns: 1fr; }
  .cal-list-date { padding-bottom: 0; }
  .hide-xs { display: none !important; }
  .doc { padding: 18px; }
  .form-sticky { margin: 16px -12px -16px; padding: 10px 12px; }
}
@media (max-width: 520px) {
  .form-grid, .form-grid.cols-2, .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2, .span-3 { grid-column: 1 / -1; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 17px; }
  .dl { grid-template-columns: 1fr; gap: 0 0; }
  .dl dt { margin-top: 8px; font-size: 12px; }
  .page-actions .btn { flex: 1 1 auto; }
  .cal-toolbar { justify-content: center; }
  .search input { font-size: 16px; }
  input, select, textarea { font-size: 16px; }
}

/* ---------- Автодополнение клиента ---------- */
.picker { position: relative; }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 20; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto; }
.picker-list:empty { display: none; }
.picker-item { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; padding: 8px 12px; border: 0; background: none; border-bottom: 1px solid var(--border); cursor: pointer; font: inherit; color: var(--text); }
.picker-item:hover { background: var(--primary-50); }
.picker-empty { padding: 10px 12px; color: var(--muted); }
.picker-snippet { color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
[data-mail-reuse] .picker-list { max-height: 340px; }
.print-only { display: none; }
@media print { .print-only { display: block !important; } .kpis { grid-template-columns: repeat(4, 1fr); } }

/* Внутри сеток отступы задаёт gap, а не соседство карточек */
.grid > .card + .card, .grid > * + .card, .grid > .card + .grid, .dash > .card + .card { margin-top: 0; }
.fin-grid { gap: 0; background: transparent; }
.fin-grid > div { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }

/* ---------- Почта партнёров ---------- */
.nav-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: auto; border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
.card-head .nav-count, .btn .nav-count, .row-actions .nav-count { margin-left: 4px; }
.mail-ind { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.mail-ind .ic { width: 16px; height: 16px; }
.mail-ind .nav-count { margin-left: 0; }
.mail-ind.has-unread { color: var(--danger); font-weight: 600; }
.mail-ind .cell-sub { font-weight: 400; }
.mail-threads > li { align-items: center; }
.mail-threads > li.unread .cell-title { font-weight: 750; }
.mail-threads > li.unread { background: color-mix(in srgb, var(--info) 5%, transparent); }
.mail-dir { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; }
.mail-dir .ic { width: 15px; height: 15px; }
.mail-dir.in { background: var(--info-50); color: var(--info); }
.mail-dir.out { background: var(--primary-50); color: var(--primary); }
.mail-thread { display: flex; flex-direction: column; gap: 12px; }
.mail-msg { border-left: 4px solid var(--info); max-width: 92%; }
.mail-msg.out { border-left-color: var(--primary); align-self: flex-end; background: color-mix(in srgb, var(--primary) 4%, var(--surface)); }
.mail-msg.in { align-self: flex-start; }
.mail-msg.unread { box-shadow: 0 0 0 2px color-mix(in srgb, var(--info) 35%, transparent); }
.mail-msg.out .avatar { background: var(--text-2); }
.mail-head { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px 6px; }
.mail-head .grow { flex: 1; min-width: 0; word-break: break-word; }
.mail-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; flex: none; max-width: 40%; }
.mail-error { color: var(--danger); font-size: 12px; max-width: 320px; word-break: break-word; }
.mail-body { padding: 4px 16px 10px 56px; }
.mail-text { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.mail-html { margin-top: 8px; }
.mail-html iframe { display: block; width: 100%; height: 420px; margin-top: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; resize: vertical; overflow: auto; }
.mail-atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mail-att { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); font-size: 12.5px; max-width: 100%; color: var(--text); }
.mail-att:hover { border-color: var(--primary); text-decoration: none; }
.mail-att .ic { width: 14px; height: 14px; flex: none; }
.mail-att.disabled { opacity: .6; }
.file-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.file-list:empty { display: none; }
.file-list .file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.file-remove { border: 0; background: none; padding: 0 2px; font-size: 16px; line-height: 1; color: var(--muted, #64748B); cursor: pointer; }
.file-remove:hover { color: #EF4444; }
.mail-actions { padding: 0 16px 12px 56px; }
.mail-assign { padding: 10px 16px 14px 56px; border-top: 1px solid var(--border); }
.mail-assign select { max-width: 280px; }
.mail-assign .mail-spam { margin-left: auto; }
.mail-blocked > summary { cursor: pointer; list-style: none; }
.mail-blocked > summary::-webkit-details-marker { display: none; }
@media (max-width: 860px) {
  .mail-msg { max-width: 100%; }
  .mail-head { flex-wrap: wrap; padding: 10px 12px 4px; }
  .mail-meta { flex-direction: row; align-items: center; max-width: none; width: 100%; justify-content: space-between; text-align: left; }
  .mail-body, .mail-actions, .mail-assign { padding-left: 12px; padding-right: 12px; }
  .mail-html iframe { height: 360px; }
  .mail-assign select { max-width: none; flex: 1 1 100%; }
}

/* ---------- Коммуникации ---------- */
.comm-quick { flex-wrap: wrap; }
details.comm-new { margin-top: 10px; }
.comm-filter { display: flex; flex-wrap: wrap; gap: 4px; }
.comm-filter .chip { margin-left: 0; font-size: 12px; padding: 2px 9px; }
.chip.active { background: var(--primary-50); border-color: var(--primary); color: var(--primary); }
.comm-list > li { align-items: flex-start; }
.comm-list > li:target { background: color-mix(in srgb, var(--primary) 7%, transparent); }
.comm-ic { position: relative; flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: color-mix(in srgb, var(--c, #64748B) 15%, transparent); color: color-mix(in srgb, var(--c, #64748B) 85%, var(--text)); }
.comm-ic .ic { width: 15px; height: 15px; }
.comm-ic.sm { width: 26px; height: 26px; margin-top: 2px; }
.comm-ic.sm .ic { width: 13px; height: 13px; }
.comm-arrow { position: absolute; right: -4px; bottom: -4px; font-size: 11px; line-height: 1; background: var(--surface); border-radius: 50%; padding: 1px 2px; color: var(--text-2); }
.comm-item.in .comm-arrow { color: var(--info); }
.comm-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.comm-text { margin-top: 6px; padding: 6px 10px; border-left: 3px solid var(--border); background: var(--surface-2); border-radius: 0 8px 8px 0; white-space: normal; overflow-wrap: anywhere; }
.comm-item.in .comm-text { border-left-color: var(--info); }
.comm-item.out .comm-text { border-left-color: var(--primary); }
.comm-summary { margin-top: 6px; overflow-wrap: anywhere; }
.comm-files { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.comm-files .chip { margin-left: 0; display: inline-flex; gap: 4px; align-items: center; }
.comm-files .ic { width: 12px; height: 12px; }
.comm-state { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.comm-state:empty { display: none; }
.comm-state .ic, .comm-head .tag .ic { width: 12px; height: 12px; }
.comm-actions { margin-top: 6px; flex-wrap: wrap; align-items: flex-start; }
.comm-actions details.inline-form { margin-top: 0; flex: 1 1 100%; }
.comm-actions details.inline-form[open] { order: 10; }
.comm-actions details.inline-form > summary.link-sm { cursor: pointer; }
.comm-attempts { margin-top: 6px; }
.comm-attempts > summary { cursor: pointer; }
.comm-attempts .list > li { padding-left: 0; padding-right: 0; }
.comm-sec { gap: 12px 14px; }
.comm-missed-hint { align-self: end; padding-bottom: 8px; }
.comm-fu { display: inline-flex; flex-wrap: wrap; gap: 2px 8px; }
.comm-fu button { background: none; border: 0; padding: 0; cursor: pointer; }

/* Рассылки: выбор получателей */
.rcpt-table tr[hidden] { display: none; }
.rcpt-table .rcpt-check { width: 36px; text-align: center; }
.rcpt-table input[type=checkbox] { width: 16px; height: 16px; }
