/* CRM агентства Натальи Грицаевой — «бухгалтер в белых перчатках»:
   спокойная бумажная основа, тёмно-синие чернила, латунный акцент. */

:root {
  --paper: #f5f3ee;
  --surface: #ffffff;
  --ink: #1d2740;
  --ink-soft: #4a5470;
  --muted: #7d8497;
  --line: #e4e1d8;
  --line-strong: #d3cfc3;
  --navy: #1f2d4f;
  --navy-hover: #2b3d68;
  --brass: #a8843f;
  --brass-soft: #f4ecdc;
  --danger: #b4372f;
  --danger-soft: #fbeceb;
  --warn: #9a6a00;
  --warn-soft: #fdf3dc;
  --ok: #2f7a4f;
  --ok-soft: #e7f4ec;
  --info: #2d5fa0;
  --info-soft: #e8f0fb;
  --violet: #6a4aa0;
  --violet-soft: #f0ebf8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(29, 39, 64, .06), 0 2px 8px rgba(29, 39, 64, .04);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--paper); line-height: 1.45; }
a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--brass); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-family: var(--serif); font-size: 1.85rem; font-weight: 500; }
h2 { font-size: 1.02rem; margin-bottom: .75rem; }
h3 { font-size: .9rem; margin: 1.1rem 0 .5rem; color: var(--ink-soft); }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.mono { font-variant-numeric: tabular-nums; font-family: Consolas, "SFMono-Regular", monospace; font-size: .92em; }
.danger-text { color: var(--danger); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); margin: .25rem 0; }
.pad { padding: 1.25rem; }
.count { font-family: var(--font); font-size: .9rem; color: var(--muted); font-weight: 400; margin-left: .35rem; }

/* ——— каркас ——— */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy); color: #dfe4f0; padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: 1.25rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar a { color: #dfe4f0; }
.brand { display: flex; align-items: center; gap: .65rem; }
.brand-mark { width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--brass); color: var(--brass); display: grid; place-items: center; font-family: var(--serif); font-size: .95rem; letter-spacing: .04em; flex: none; }
.brand-text { font-family: var(--serif); font-size: 1rem; line-height: 1.15; }
.brand-text small { font-size: .8rem; opacity: .75; }
/* Логотип агентства (тёмный рисунок на белом) — на светлой плашке, чтобы читался на тёмной панели */
.brand-logo { background: #fff; border-radius: 10px; padding: .45rem .6rem; }
.brand-logo img { display: block; width: 100%; max-width: 230px; height: auto; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: .55rem .75rem; border-radius: 8px; color: #c5cde0; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(255,255,255,.1); color: #fff; box-shadow: inset 3px 0 0 var(--brass); }
.badge { background: rgba(255,255,255,.16); color: #fff; border-radius: 999px; font-size: .75rem; padding: 0 .5rem; min-width: 1.4rem; text-align: center; }
.badge-danger { background: var(--danger); }
.sidebar-user { margin-top: auto; display: flex; gap: .6rem; align-items: center; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-user small { display: block; opacity: .65; }
.sidebar-links { display: flex; justify-content: space-between; font-size: .85rem; }
.sidebar-links a, .sidebar-links .link { color: #9aa5c0; }
.main { padding: 1.75rem 2rem 3rem; max-width: 1280px; width: 100%; }

/* ——— элементы ——— */
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brass-soft); color: var(--navy); display: grid; place-items: center; font-weight: 600; font-size: .8rem; flex: none; }
.sidebar .avatar { background: rgba(255,255,255,.12); color: #fff; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.05rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .5rem .95rem; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--navy); color: var(--navy); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-hover); color: #fff; }
.sidebar .btn-primary { background: var(--brass); border-color: var(--brass); }
.sidebar .btn-primary:hover { background: #b8944d; }
.btn-block { width: 100%; }
.btn-danger-ghost { color: var(--danger); border-color: transparent; background: none; }
.btn-danger-ghost:hover { border-color: var(--danger); color: var(--danger); }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--navy); cursor: pointer; }
.push-right { margin-left: auto; }
.chip { display: inline-block; font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; background: var(--brass-soft); color: #7a5d22; vertical-align: middle; }
.chip-source { background: var(--info-soft); color: var(--info); }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-head p { margin: .35rem 0 0; }
.eyebrow { margin: 0 0 .25rem; color: var(--brass); font-size: .85rem; letter-spacing: .02em; }
.back { display: inline-block; font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card-accent { border-top: 3px solid var(--brass); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.grid-wide-left { grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; display: flex; flex-direction: column; color: var(--ink); box-shadow: var(--shadow); }
.stat b { font-size: 1.85rem; font-weight: 600; line-height: 1.1; font-variant-numeric: lining-nums tabular-nums; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat-danger { border-color: #ebc3c0; background: var(--danger-soft); }
.stat-danger b { color: var(--danger); }
.stat-warn b { color: var(--warn); }

/* ——— задачи ——— */
.task-list { list-style: none; margin: 0; padding: 0; }
.task-row { display: grid; grid-template-columns: 6px minmax(0, 1fr) auto 86px; gap: .75rem; align-items: center; padding: .6rem 0; border-top: 1px solid var(--line); }
.task-row:first-child { border-top: 0; }
.task-title { font-weight: 500; color: var(--ink); }
.task-meta { font-size: .82rem; color: var(--muted); display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }
.task-meta a { color: var(--ink-soft); }
.is-done .task-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.prio { width: 6px; height: 28px; border-radius: 3px; background: var(--line); }
.prio-3 { background: var(--danger); }
.prio-1 { background: transparent; }
.due { font-size: .85rem; text-align: right; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.due-overdue { color: var(--danger); font-weight: 600; }
.due-today { color: var(--warn); font-weight: 600; }

.status { font-size: .75rem; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap; }
.status-new { background: var(--info-soft); color: var(--info); }
.status-in_progress { background: var(--brass-soft); color: #7a5d22; }
.status-waiting { background: var(--warn-soft); color: var(--warn); }
.status-review { background: var(--violet-soft); color: var(--violet); }
.status-done { background: var(--ok-soft); color: var(--ok); }

.cstatus { font-size: .78rem; }
.cstatus::before { content: "●"; margin-right: .3rem; }
.cstatus-active::before { color: var(--ok); }
.cstatus-paused::before { color: var(--danger); }
.cstatus-onboarding::before { color: var(--info); }
.cstatus-closed::before { color: var(--muted); }

.status-buttons { display: flex; flex-wrap: wrap; gap: .4rem; }
.btn-status { font-size: .85rem; padding: .35rem .7rem; border-color: transparent; }
.btn-status.is-current { outline: 2px solid currentColor; cursor: default; }

.timeline { list-style: none; margin: 0 0 1rem; padding: 0; }
.timeline li { padding: .6rem 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; }
.timeline-head { font-size: .85rem; margin-bottom: .15rem; }
.timeline li.is-system { font-size: .85rem; color: var(--muted); }
.comment-form { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }

.handover-form { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
.handovers { list-style: none; margin: 0; padding: 0; }
.handovers li { padding: .6rem 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: .15rem; }
.handovers li:first-child { border-top: 0; }
.handovers .link { align-self: flex-start; margin-top: .2rem; }

.props { display: grid; grid-template-columns: 110px 1fr; gap: .45rem .75rem; margin: 0; font-size: .92rem; }
.props dt { color: var(--muted); }
.props dd { margin: 0; }
.prose p { margin: 0 0 .6rem; }
.contacts, .plain-list { list-style: none; margin: 0; padding: 0; }
.contacts li, .plain-list li { padding: .5rem 0; border-top: 1px solid var(--line); }
.contacts li:first-child, .plain-list li:first-child { border-top: 0; }
.contacts li { position: relative; padding-right: 4.5rem; }
.contacts li > .link { position: absolute; right: 0; top: .55rem; }
.add-contact { margin-top: .75rem; }
.add-contact summary { cursor: pointer; color: var(--navy); font-weight: 500; }
.add-contact .fields { grid-template-columns: 1fr; margin: .75rem 0; }

/* ——— таблицы ——— */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: .8rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: #faf9f6; }
.table td { padding: .7rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fbfaf7; }
.table.compact th, .table.compact td { padding: .5rem .4rem; }
.table.compact th:first-child, .table.compact td:first-child { padding-left: 0; }

/* ——— формы ——— */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; padding: .5rem .65rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(31,45,79,.12); }
textarea { resize: vertical; }
input[type=checkbox] { width: 1.05rem; height: 1.05rem; accent-color: var(--navy); }
.form { max-width: 860px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field > label { font-size: .85rem; color: var(--ink-soft); font-weight: 500; }
.field-wide { grid-column: 1 / -1; }
.field-check label { display: flex; gap: .5rem; align-items: center; font-size: .92rem; color: var(--ink); cursor: pointer; padding-top: 1.4rem; }
.help { color: var(--muted); }
.error { color: var(--danger); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.form-actions { display: flex; gap: .5rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.filter { flex: 1 1 160px; max-width: 260px; }
.filter:first-child { flex: 2 1 240px; max-width: 360px; }

.messages { margin-bottom: 1rem; }
.message { padding: .65rem .9rem; border-radius: 8px; margin-bottom: .5rem; background: var(--info-soft); color: var(--info); }
.message-success { background: var(--ok-soft); color: var(--ok); }
.message-error { background: var(--danger-soft); color: var(--danger); }

/* ——— сотрудники ——— */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.person { display: flex; gap: .9rem; margin: 0; }
.person-body { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.person-stats { display: flex; gap: .9rem; font-size: .85rem; color: var(--ink-soft); margin: .35rem 0; }
.person.is-inactive { opacity: .55; }
.person-head { display: flex; gap: 1rem; align-items: flex-end; }

/* ——— вход ——— */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(circle at 30% 20%, #fff 0, var(--paper) 60%); }
.login-card { width: 100%; max-width: 380px; padding: 2rem; display: flex; flex-direction: column; gap: .5rem; }
.login-card h1 { font-size: 1.4rem; margin: 1.25rem 0 .5rem; }
.login-card label { font-size: .85rem; color: var(--ink-soft); margin-top: .35rem; }
.login-card .btn { margin-top: 1rem; padding: .65rem; }
.brand-center { justify-content: center; }
.brand-center .brand-text { color: var(--navy); }

/* ——— узкие экраны ——— */
@media (max-width: 960px) {
  .grid-2, .grid-wide-left { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .75rem; padding: .75rem 1rem; }
  .brand-text, .sidebar-user, .sidebar-links { display: none; }
  .sidebar .brand-logo img { max-width: 150px; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .sidebar .btn-block { width: auto; }
  .main { padding: 1.25rem 1rem 2rem; }
  .fields { grid-template-columns: 1fr; }
  .task-row { grid-template-columns: 6px minmax(0, 1fr) auto; }
  .task-row .due { grid-column: 2 / -1; text-align: left; }
  h1 { font-size: 1.5rem; }
}

/* ——— меню: группы, таймер ——— */
.nav-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #7f8bab; padding: .9rem .75rem .25rem; }
.timer-box { display: flex; align-items: center; gap: .5rem; background: rgba(168,132,63,.18); border: 1px solid rgba(168,132,63,.5); border-radius: 10px; padding: .55rem .6rem; font-size: .85rem; }
.timer-box small { display: block; opacity: .75; font-size: .72rem; }
.timer-body { flex: 1; min-width: 0; overflow: hidden; }
.timer-dot { width: 9px; height: 9px; border-radius: 50%; background: #d9534f; flex: none; animation: pulse 1.6s infinite; display: inline-block; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.btn-sm { padding: .25rem .55rem; font-size: .8rem; }
.sidebar .btn-sm { background: rgba(255,255,255,.1); color: #fff; border-color: transparent; }
.timer-card .timer-now { margin: 0 0 .6rem; display: flex; align-items: center; gap: .5rem; font-weight: 500; }

/* ——— сверка отчётности ——— */
.legend { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; margin-bottom: 1rem; font-size: .82rem; }
.fstatus { font-size: .75rem; padding: .12rem .5rem; border-radius: 999px; white-space: nowrap; }
.fstatus-todo { background: #eef0f4; color: var(--ink-soft); }
.fstatus-prepared { background: var(--brass-soft); color: #7a5d22; }
.fstatus-sent { background: var(--info-soft); color: var(--info); }
.fstatus-accepted { background: var(--ok-soft); color: var(--ok); }
.fstatus-rejected { background: var(--danger-soft); color: var(--danger); }
.fstatus-na { background: #f3f3f3; color: var(--muted); }
.board th { white-space: nowrap; }
.board td { min-width: 120px; }
.board td:first-child { min-width: 200px; }
.fcell { display: block; border-radius: 8px; padding: .35rem .5rem; margin-bottom: .25rem; line-height: 1.25; border: 1px solid transparent; }
.fcell b { display: block; font-size: .8rem; font-weight: 600; }
.fcell small { font-size: .72rem; opacity: .85; }
.fcell:hover { border-color: currentColor; }
.fcell.is-overdue { box-shadow: inset 3px 0 0 var(--danger); }
.card-danger { border-top: 3px solid var(--danger); }
.generate { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-top: .5rem; }
.check-inline { display: inline-flex; gap: .4rem; align-items: center; font-size: .9rem; }
.quick-steps { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .6rem; }
.quick-steps .btn { justify-content: flex-start; border-color: transparent; }
.filing-line { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.card h2 { display: flex; align-items: baseline; gap: .5rem; }

/* ——— требования, взносы ——— */
.tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 3px; margin-bottom: 1rem; }
.tabs a { padding: .35rem .8rem; border-radius: 7px; color: var(--ink-soft); font-size: .9rem; }
.tabs a.active { background: var(--navy); color: #fff; }
.rstatus { font-size: .75rem; padding: .12rem .5rem; border-radius: 999px; white-space: nowrap; background: #eef0f4; }
.rstatus-new { background: var(--info-soft); color: var(--info); }
.rstatus-in_progress, .rstatus-extension { background: var(--brass-soft); color: #7a5d22; }
.rstatus-answered, .rstatus-closed { background: var(--ok-soft); color: var(--ok); }
.row-danger td { background: #fdf5f4; }
.nowrap { white-space: nowrap; }
.warn-text { color: var(--warn); }
.ok-text { color: var(--ok); font-size: .85rem; }

/* ——— фото дня ——— */
.team-strip { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.team-chip { display: flex; gap: .5rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .25rem .8rem .25rem .25rem; color: var(--ink); font-size: .88rem; }
.team-chip small { display: block; color: var(--muted); font-size: .72rem; }
.team-chip.is-current { border-color: var(--navy); box-shadow: 0 0 0 2px rgba(31,45,79,.12); }
.team-chip.is-empty { opacity: .6; }
.gantt { display: flex; flex-direction: column; gap: 2px; overflow-x: auto; }
.gantt-row { display: grid; grid-template-columns: 240px minmax(480px, 1fr); align-items: center; min-height: 34px; }
.gantt-label { font-size: .85rem; padding-right: .75rem; line-height: 1.2; overflow: hidden; }
.gantt-label small { display: block; color: var(--muted); font-size: .72rem; }
.gantt-track { position: relative; height: 26px; background: #faf9f6; border-radius: 5px; }
.gantt-axis .gantt-track { background: none; height: 18px; }
.gantt-hour { position: absolute; top: 0; font-size: .7rem; color: var(--muted); transform: translateX(-50%); }
.gantt-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.gantt-bar { position: absolute; top: 4px; bottom: 4px; background: var(--navy); border-radius: 4px; min-width: 3px; }
.gantt-pause { background: repeating-linear-gradient(45deg, #e6c98f, #e6c98f 4px, #f4ecdc 4px, #f4ecdc 8px); }
@media (max-width: 760px) { .gantt-row { grid-template-columns: 130px minmax(420px, 1fr); } }
.gantt-hour:last-child { transform: translateX(-100%); }
.gantt-hour:first-child { transform: none; }
td.num { white-space: nowrap; }

/* ——— документы ——— */
.doc-buttons { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .8rem; }
.doc-form { max-width: 980px; }
.doc-form .card h3 { margin-top: 1.2rem; }
.check-row { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.check-row .field-check label { padding-top: 0; }
.sticky-actions { position: sticky; bottom: 0; background: var(--paper); padding: .9rem 0; margin-top: 0; z-index: 2; }
.svc-search { margin-bottom: .75rem; }
.svc-group { border-top: 1px solid var(--line); padding: .5rem 0; }
.svc-group summary { cursor: pointer; display: flex; gap: .6rem; align-items: baseline; font-weight: 500; }
.svc-group summary .svc-all { margin-left: auto; }
.svc-group ul { list-style: none; margin: .4rem 0 0; padding: 0 0 0 1rem; }
.svc-group li label { display: flex; gap: .55rem; align-items: baseline; padding: .25rem 0; font-size: .9rem; cursor: pointer; }
.svc-group li small { white-space: nowrap; margin-left: auto; padding-left: .5rem; }
.svc-count { color: var(--brass); }

/* ——— воронка продаж ——— */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: .75rem; overflow-x: auto; padding-bottom: .5rem; margin-bottom: 1rem; }
.kanban-col { background: #eeebe3; border-radius: var(--radius); padding: .6rem; min-height: 160px; display: flex; flex-direction: column; gap: .5rem; }
.kanban-col header { display: flex; flex-direction: column; gap: .1rem; padding: .1rem .2rem .3rem; font-size: .9rem; min-height: 2.9rem; }
.deal-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .65rem; display: flex; flex-direction: column; gap: .2rem; box-shadow: var(--shadow); font-size: .9rem; }
.deal-card small { font-size: .78rem; }
.deal-card.is-overdue { box-shadow: inset 3px 0 0 var(--danger), var(--shadow); }
.deal-foot { display: flex; justify-content: space-between; align-items: center; margin-top: .2rem; }
.stage-track { display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 1rem; }
.stage-step { font: inherit; font-size: .85rem; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-soft); padding: .45rem .9rem; cursor: pointer; margin-right: -1px; }
.stage-track form:first-child .stage-step { border-radius: 8px 0 0 8px; }
.stage-track form:last-child .stage-step { border-radius: 0 8px 8px 0; }
.stage-step:hover { color: var(--navy); border-color: var(--navy); position: relative; }
.stage-step.is-current { background: var(--navy); color: #fff; border-color: var(--navy); cursor: default; }
.funnel-row { display: grid; grid-template-columns: 180px 1fr 40px 44px; gap: .6rem; align-items: center; margin-bottom: .45rem; font-size: .9rem; }
.funnel-bar { background: #f0ede6; border-radius: 4px; height: 12px; overflow: hidden; }
.funnel-bar i { display: block; height: 100%; background: var(--brass); }
@media (max-width: 760px) { .kanban { grid-template-columns: repeat(5, 230px); } .funnel-row { grid-template-columns: 1fr 1fr 30px 40px; } }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ——— файлы и база знаний ——— */
.drive { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1rem; align-items: start; }
.drive-folders { display: flex; flex-direction: column; gap: 2px; padding: .6rem; position: sticky; top: 1rem; }
.drive-folders a { display: flex; justify-content: space-between; padding: .45rem .6rem; border-radius: 7px; color: var(--ink-soft); font-size: .9rem; }
.drive-folders a.active, .drive-folders a:hover { background: var(--brass-soft); color: var(--ink); }
.upload-box .fields { grid-template-columns: 1fr 1fr; margin-bottom: .8rem; }
.ext { display: inline-block; min-width: 2.6rem; text-align: center; font-size: .68rem; text-transform: uppercase; font-weight: 600; padding: .1rem .3rem; border-radius: 4px; background: #eef0f4; color: var(--ink-soft); }
.article-body { font-size: 1rem; line-height: 1.6; }
input[type=file] { font: inherit; }
@media (max-width: 960px) { .drive { grid-template-columns: 1fr; } .drive-folders { position: static; } }

/* ——— свод отчётности ——— */
.pad-sm { padding: 1rem 1.25rem; }
.svod td:first-child { min-width: 260px; }
.svod-strong td { font-weight: 600; background: #fbfaf6; }
.svod-input td { padding: .35rem .5rem; }
.num-input { text-align: right; font-variant-numeric: tabular-nums; min-width: 110px; padding: .35rem .5rem; }
.num-input.short { width: 90px; min-width: 0; display: inline-block; margin-left: .4rem; }
.svod-settings { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); }

/* ——— рассылки ——— */
.tpl-search { max-width: 420px; margin-bottom: .5rem; }
.tpl-group { margin: 1.25rem 0 .6rem; font-size: 1rem; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .75rem; }
.tpl-card { display: flex; flex-direction: column; gap: .35rem; margin: 0; }
.tpl-card p { margin: 0; color: var(--ink-soft); flex: 1; }
.tpl-card .btn { align-self: flex-start; }
.client-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .3rem 1rem; max-height: 340px; overflow-y: auto; padding: .25rem 0; }
.input-warn { border-color: var(--warn) !important; background: var(--warn-soft) !important; }
.mail-head { display: flex; flex-direction: column; gap: .2rem; padding-bottom: .6rem; border-bottom: 1px solid var(--line); margin-bottom: .6rem; font-size: .9rem; }
.mail-body { white-space: pre-wrap; font-family: Arial, sans-serif; font-size: .9rem; line-height: 1.5; margin: 0; }
code { background: #f1efe9; padding: 0 .25rem; border-radius: 4px; font-size: .85em; }

/* ——— задачи: доска, календарь, чек-лист, проверка, уведомления (17.10.2026) ——— */
form.inline { display: inline-flex; gap: .3rem; align-items: center; margin: 0; }
.badge-brass { background: var(--brass); }
.badge[hidden] { display: none; }
.avatar-sm { width: 24px; height: 24px; font-size: .68rem; }
.pill { background: var(--brass); color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 .45rem; min-width: 1.3rem; text-align: center; }
.chip-check { background: var(--ok-soft); color: var(--ok); }
.chip-review { background: var(--violet-soft); color: var(--violet); }
.stat-ok b { color: var(--ok); }
.card-review { border-top: 3px solid var(--violet); }
.quick-task { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .7rem 1rem; }
.quick-task input[name=title] { flex: 1; min-width: 240px; }
.filter { display: inline-flex; gap: .35rem; align-items: center; font-size: .85rem; color: var(--ink-soft); }
.review-actions { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.review-return { display: flex; gap: .5rem; flex: 1; min-width: 280px; }
.review-return input { flex: 1; }

.meter { display: inline-block; width: 80px; height: 6px; background: var(--line); border-radius: 3px; vertical-align: middle; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.meter-wide { display: block; width: 100%; margin-bottom: .6rem; }
.checklist { list-style: none; margin: 0 0 .75rem; padding: 0; }
.checklist li { display: flex; gap: .6rem; align-items: center; padding: .4rem 0; border-top: 1px solid var(--line); }
.checklist li:first-child { border-top: 0; }
.checklist li.is-done .check-text { text-decoration: line-through; color: var(--muted); }
.check-box { width: 22px; height: 22px; border: 1.5px solid var(--line-strong); border-radius: 5px; background: var(--surface); color: #fff; font-size: .8rem; line-height: 1; cursor: pointer; padding: 0; display: grid; place-items: center; }
.check-box:hover { border-color: var(--ok); }
.is-done .check-box { background: var(--ok); border-color: var(--ok); }
.checklist-add { display: flex; gap: .5rem; align-items: flex-start; }
.checklist-add textarea { flex: 1; }

.kanban-cards { display: flex; flex-direction: column; gap: .5rem; min-height: 60px; flex: 1; }
.kanban-col header.kanban-head { flex-direction: row; align-items: center; gap: .3rem; min-height: 0; padding: .1rem .2rem .3rem; }
.kanban-col.is-over { outline: 2px dashed var(--brass); outline-offset: -2px; }
.kanban-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .65rem .5rem .8rem; box-shadow: var(--shadow); cursor: grab; display: flex; flex-direction: column; gap: .2rem; }
.kanban-card.is-dragging { opacity: .45; }
.kanban-card.is-overdue { border-color: #ebc3c0; }
.kanban-card .task-title { font-size: .9rem; line-height: 1.25; }
.kanban-card .task-meta { font-size: .78rem; color: var(--muted); }
.prio-line { position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: transparent; }
.prio-line.prio-3 { background: var(--danger); }
.kanban-foot { display: flex; align-items: center; gap: .35rem; margin-top: .2rem; }

.cal-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .75rem; flex-wrap: wrap; }
.cal-head h2 { margin: 0; min-width: 150px; text-align: center; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-wd { padding: .45rem .6rem; font-size: .78rem; color: var(--muted); background: #faf9f6; border-bottom: 1px solid var(--line); }
.cal-day { min-height: 108px; padding: .35rem .4rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.is-off { background: #faf9f6; }
.cal-day.is-other { opacity: .45; }
.cal-day.is-today .cal-num { background: var(--navy); color: #fff; border-radius: 999px; padding: 0 .4rem; }
.cal-num { font-size: .8rem; color: var(--ink-soft); align-self: flex-start; }
.cal-task { display: block; font-size: .74rem; line-height: 1.25; padding: .12rem .35rem; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--info-soft); color: var(--info); }
p .cal-task { display: inline-block; }
.cal-in_progress, .cal-waiting { background: var(--brass-soft); color: #7a5d22; }
.cal-review { background: var(--violet-soft); color: var(--violet); }
.cal-done { background: var(--ok-soft); color: var(--ok); text-decoration: line-through; }
.cal-task.is-overdue { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.cal-more { font-size: .72rem; color: var(--muted); }

.legend { display: flex; gap: 1rem; font-size: .82rem; color: var(--ink-soft); margin-bottom: .4rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.key { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.key-ontime { background: var(--navy); }
.key-late { background: var(--danger); }
.chart-wrap { overflow-x: auto; }
.bars .grid { stroke: var(--line); stroke-width: 1; }
.bars .tick { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.bars .bar-ontime { fill: var(--navy); }
.bars .bar-late { fill: var(--danger); }
.bars .hit { fill: transparent; }
.bars .bar-day:hover .hit { fill: rgba(168, 132, 63, .08); }
.compact-pad td, .compact-pad th { padding: .5rem .8rem; }

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li { display: flex; gap: .6rem; align-items: center; padding: .55rem .4rem; border-top: 1px solid var(--line); }
.notif-list li:first-child { border-top: 0; }
.notif-list li.is-unread { background: var(--brass-soft); border-radius: 6px; }
.notif-list li.is-unread a { font-weight: 600; }

/* ——— мессенджер: чат команды и чаты с клиентами ——— */
.messenger { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 1rem; align-items: start; margin-bottom: 1rem; }
.messenger-list { max-height: calc(100vh - 210px); overflow-y: auto; }
.messenger-item { display: flex; flex-direction: column; gap: .1rem; padding: .6rem .85rem; border-bottom: 1px solid var(--line); color: var(--ink); }
.messenger-item:hover { background: #fbfaf7; color: var(--ink); }
.messenger-item.is-current { background: var(--brass-soft); box-shadow: inset 3px 0 0 var(--brass); }
.messenger-item-head { display: flex; justify-content: space-between; gap: .4rem; align-items: center; }
.messenger-last { color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.messenger-people { display: flex; flex-direction: column; gap: .35rem; padding: .75rem .85rem; }
.messenger-people a { display: flex; align-items: center; gap: .45rem; font-size: .88rem; }
.messenger-chat { display: flex; flex-direction: column; height: calc(100vh - 210px); min-height: 420px; }
.messenger-feed { flex: 1; overflow-y: auto; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .5rem; background: #faf9f6; }
.day-sep { text-align: center; font-size: .75rem; color: var(--muted); margin: .4rem 0; }
.day-sep span { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .1rem .6rem; }
.bubble-row { display: flex; gap: .45rem; align-items: flex-end; }
.bubble-row.is-mine { justify-content: flex-end; }
.bubble { max-width: min(560px, 78%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px 12px 12px 4px; padding: .5rem .75rem; font-size: .92rem; overflow-wrap: anywhere; }
.bubble-mine { background: #e9edf6; border-color: #d6ddec; border-radius: 12px 12px 4px 12px; }
.bubble-head { display: flex; gap: .5rem; align-items: baseline; font-size: .78rem; margin-bottom: .15rem; }
.bubble-file { margin-top: .3rem; font-size: .85rem; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.bubble-foot { margin-top: .25rem; font-size: .76rem; display: flex; gap: .6rem; }
.composer { display: flex; gap: .5rem; align-items: flex-end; padding: .75rem; border-top: 1px solid var(--line); background: var(--surface); }
.composer textarea { flex: 1; min-height: 44px; }
.composer-file { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; font-size: 1.1rem; }
.composer-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.composer-file.has-file { border-color: var(--brass); background: var(--brass-soft); }
.stack { display: flex; flex-direction: column; gap: .6rem; align-items: stretch; }
.narrow { max-width: 620px; }
.checks { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .9rem; display: flex; flex-direction: column; gap: .35rem; }
.checks label { display: flex; gap: .5rem; align-items: center; }
@media (max-width: 960px) {
  .messenger { grid-template-columns: 1fr; }
  .messenger-list { max-height: 220px; }
  .cal-day { min-height: 80px; }
  .cal-task { font-size: .68rem; }
}#id_clients { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .6rem; }
#id_clients label { display: flex; gap: .45rem; align-items: center; padding: .1rem 0; }
.steps { margin: 0 0 .75rem; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .25rem; }
.reply-form { display: flex; flex-direction: column; gap: .6rem; }
.check-line { display: flex; gap: .5rem; align-items: center; cursor: pointer; }
.check-line input { margin: 0; flex: none; }

/* ——— экраны ноутбуков (её замечание 17.10.2026: кнопка «Сохранить» не видна без уменьшения масштаба) ——— */
.main { min-width: 0; }
/* Кнопки формы прилипают к низу окна: «Сохранить» видна, где бы ни была прокрутка длинной карточки. */
.form-actions { position: sticky; bottom: 0; z-index: 20; background: var(--paper); padding-bottom: .75rem; }
.card > .form-actions, form.card > .form-actions {
  background: var(--surface); margin: 1.25rem -1.25rem -1.15rem; padding: .75rem 1.25rem;
  border-radius: 0 0 var(--radius) var(--radius); box-shadow: 0 -6px 12px -8px rgba(29, 39, 64, .18);
}
@media (max-width: 1500px), (max-height: 860px) {
  html { font-size: 14px; }
  .main { padding: 1.25rem 1.5rem 2rem; }
  .sidebar { padding: 1rem .75rem; gap: .9rem; }
  .nav a { padding: .4rem .65rem; }
  .brand-logo img { max-width: 190px; }
  .page-head { margin-bottom: 1rem; }
  h1 { font-size: 1.6rem; }
  .card { padding: 1rem 1.1rem; }
  .card > .form-actions, form.card > .form-actions { margin: 1rem -1.1rem -1rem; padding: .65rem 1.1rem; }
}
@media (max-height: 720px) {
  .nav a { padding: .3rem .6rem; font-size: .93rem; }
  .nav-group { margin-top: .2rem; }
}.attach-cell { min-width: 260px; }
.attach-cell details { margin: .3rem 0; }
.attach-cell summary { cursor: pointer; color: var(--navy); }
.attach-settings select { width: auto; display: inline-block; margin-left: .3rem; }
.schedule-form input[type=datetime-local] { width: auto; padding: .4rem .5rem; }
input[type=datetime-local] { font: inherit; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--ink); }
