/* ARS-X 2.7 — выездные бригады, справка и обучение */
.next-modal-foot .spacer { flex: 1; }
.chip.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--brand); }
.block { display: block; }
.help-btn .ico { width: 18px; height: 18px; }

/* статусы выездов */
.field-status { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; line-height: 1.6; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.field-status.st-route { background: color-mix(in srgb, #F59E0B 18%, transparent); color: #B45309; }
.field-status.st-site { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.field-status.st-done { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.field-status.st-cancel { background: var(--surface-3); color: var(--muted); text-decoration: line-through; }
html[data-theme="dark"] .field-status.st-route { color: #F5B454; }

.crew-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; flex: none; vertical-align: 1px; }
.crew-dot.big { width: 14px; height: 14px; margin: 0; }

/* экран */
.field-screen { display: grid; gap: 14px; min-width: 0; }
.field-screen .screen-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.field-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.field-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.field-toolbar .icon-btn .ico { transform: rotate(-90deg); }
.field-toolbar .icon-btn .ico.flip { transform: rotate(90deg); }
.field-week { font-weight: 650; margin-left: 6px; }

/* расписание недели */
.field-schedule { display: grid; gap: 10px; min-width: 0; }
.field-week-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 14px; align-items: start; }
.field-grid-wrap { padding: 0; overflow-x: auto; min-width: 0; }
.field-grid { width: 100%; min-width: 860px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.field-grid th, .field-grid td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: top; padding: 6px; }
.field-grid thead th { font-size: 12.5px; font-weight: 650; color: var(--text-2); text-align: left; background: var(--surface-2); position: sticky; top: 0; }
.field-grid thead th small { display: block; color: var(--muted); font-weight: 500; }
.field-grid th.today, .field-grid td.today { background: var(--accent-softer); }
.field-grid .crew-col { width: 150px; font-size: 13px; font-weight: 600; text-align: left; background: var(--surface); position: sticky; left: 0; z-index: 1; }
.field-grid td { height: 92px; position: relative; }
.field-grid td .cell-add { position: absolute; right: 4px; bottom: 4px; width: 24px; height: 24px; border-radius: 6px; border: 1px dashed var(--line); background: transparent; color: var(--muted); cursor: pointer; display: none; align-items: center; justify-content: center; padding: 0; }
.field-grid td:hover .cell-add, .field-grid td .cell-add:focus-visible { display: inline-flex; }
.field-grid td .cell-add .ico { width: 14px; height: 14px; }
@media (hover: none) { .field-grid td .cell-add { display: inline-flex; } }

.job-chip { display: grid; gap: 2px; width: 100%; text-align: left; margin-bottom: 4px; padding: 5px 7px; border-radius: 8px; border: 1px solid var(--line); border-left: 4px solid var(--brand); background: var(--surface); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
.job-chip:hover { border-color: var(--accent-line); box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,.08)); }
.job-chip-top { display: flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; }
.job-chip-top .ico { width: 13px; height: 13px; }
.job-chip-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-chip.wide .job-chip-title { white-space: normal; }
.job-chip.st-done { opacity: .75; }
.job-chip.st-done .job-chip-title { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--success) 60%, transparent); }
.job-chip.st-site { background: var(--accent-softer); }
.job-chip-progress { height: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.job-chip-progress i { display: block; height: 100%; background: var(--success); }
.field-unscheduled { display: grid; gap: 6px; align-content: start; }
.field-unscheduled h3 { margin: 0 0 4px; font-size: 14px; }

/* список */
.field-list { display: grid; gap: 12px; min-width: 0; }
.field-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.field-filters input[type=search] { flex: 1 1 240px; min-width: 0; }
.field-filters select, .field-filters input[type=date] { min-height: 36px; }
.field-from { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.field-table td { vertical-align: top; }

/* маршрут */
.field-route { display: grid; gap: 12px; }
.field-route-head { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.field-route-head .field { min-width: 180px; margin: 0; }
.field-route-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.route-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 0; }
.route-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); position: relative; }
.route-list li:last-child { border-bottom: 0; }
.route-num { width: 28px; height: 28px; border-radius: 50%; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; }
.route-main { flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; color: var(--text); font: inherit; cursor: pointer; display: grid; padding: 0; }
.route-main small { color: var(--muted); }

/* карточка выезда */
.field-sub { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.job-detail { display: grid; gap: 16px; }
.job-detail section h3 { margin: 0 0 8px; font-size: 14.5px; }
.job-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; }
.job-info-row { display: grid; gap: 2px; min-width: 0; }
.job-info-row > span { font-size: 12px; color: var(--muted); }
.job-info-row > div { overflow-wrap: anywhere; }
.job-text { white-space: pre-wrap; line-height: 1.5; background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.job-status-row { display: flex; gap: 6px; flex-wrap: wrap; }
.job-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.job-checklist li { padding: 6px 0; border-bottom: 1px dashed var(--line); display: grid; gap: 2px; }
.job-checklist label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.job-checklist input { margin-top: 3px; width: 17px; height: 17px; flex: none; }
.job-checklist li.done span { color: var(--muted); }
.job-checklist .req { color: var(--danger); margin-left: 3px; }
.job-checklist .ico.small { width: 14px; height: 14px; margin-left: 6px; vertical-align: -2px; color: var(--muted); }
.job-checklist small { margin-left: 27px; }
.job-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.job-photos figure { margin: 0; display: grid; gap: 4px; }
.job-photos figcaption { font-size: 12px; color: var(--muted); }
.job-photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; display: block; background: var(--surface-3); }
.job-photo.placeholder { display: flex; align-items: center; justify-content: center; color: var(--muted); }
.job-sign-row { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.job-signature { width: 220px; max-width: 100%; height: 100px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 10px; display: block; }
.stars { color: #F59E0B; letter-spacing: 2px; font-size: 16px; }
.job-events { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.job-events li { display: flex; gap: 10px; align-items: flex-start; }
.job-events li > .ico { width: 16px; height: 16px; margin-top: 2px; color: var(--muted); flex: none; }
.job-events li > div { display: grid; gap: 3px; min-width: 0; }
.job-events .ev-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.job-events audio { max-width: 260px; height: 36px; }

/* бригады и чек-листы */
.crew-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.crew-card { display: grid; gap: 10px; }
.crew-card.inactive { opacity: .6; }
.crew-card-head { display: flex; gap: 10px; align-items: center; }
.crew-card-head > div { flex: 1; min-width: 0; display: grid; }
.crew-card-head small { font-size: 12.5px; }
.crew-people { display: flex; flex-wrap: wrap; gap: 6px; }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; box-shadow: inset 0 0 0 2px var(--surface); }
.color-dot.active { border-color: var(--text); }
.member-pick { display: flex; flex-wrap: wrap; gap: 6px; max-height: 190px; overflow: auto; padding: 2px; }
.member-pick label { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; cursor: pointer; }
.member-pick label.on { background: var(--accent-soft); border-color: var(--accent-line); }
.member-pick input { margin: 0; }
.tpl-preview { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13px; display: grid; gap: 2px; }
.tpl-items { display: grid; gap: 6px; margin: 12px 0; }
.tpl-item { display: grid; grid-template-columns: minmax(0, 1fr) 64px 48px 32px; gap: 8px; align-items: center; }
.tpl-item.head { font-size: 12px; color: var(--muted); font-weight: 600; }
.tpl-item input[type=checkbox] { justify-self: center; width: 17px; height: 17px; }
.tpl-items > .btn { justify-self: start; }

.deal-field .doc-row .field-status { margin-left: auto; }

/* справка */
.help-screen { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.help-nav { display: grid; gap: 12px; position: sticky; top: 12px; max-height: calc(100vh - 140px); overflow: auto; }
.help-nav input[type=search] { width: 100%; }
.help-nav > .btn { justify-self: start; }
.help-section { display: grid; gap: 2px; }
.help-section > b { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 4px 0; }
.help-link { display: flex; gap: 6px; align-items: center; text-align: left; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; }
.help-link:hover { background: var(--surface-2); }
.help-link.active { background: var(--accent-soft); color: var(--brand); font-weight: 600; }
.help-link .ico { width: 14px; height: 14px; flex: none; }
.help-article { min-width: 0; }
.help-article-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.help-article-head h2 { margin: 2px 0 0; }
.help-md { line-height: 1.6; max-width: 820px; }
.help-md h3 { margin: 18px 0 6px; font-size: 16px; }
.help-md h4 { margin: 14px 0 4px; font-size: 14.5px; }
.help-md p { margin: 8px 0; }
.help-md ul, .help-md ol { margin: 6px 0; padding-left: 22px; display: grid; gap: 4px; }
.help-md code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.help-table { margin: 8px 0; }
.help-video { position: relative; width: 100%; max-width: 820px; aspect-ratio: 16 / 9; margin: 6px 0 12px; border-radius: 12px; overflow: hidden; background: #000; }
.help-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.help-context-list { display: grid; gap: 4px; }

@media (max-width: 1100px) {
  .field-week-layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .help-screen { grid-template-columns: 1fr; }
  .help-nav { position: static; max-height: none; }
}
@media (max-width: 640px) {
  .job-info { grid-template-columns: 1fr; }
  .field-route-actions { margin-left: 0; width: 100%; }
  .field-route-head .field { flex: 1 1 140px; min-width: 0; }
  .tpl-item { grid-template-columns: minmax(0, 1fr) 40px 40px 28px; }
  .field-head-actions { width: 100%; }
}
.field-check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; margin-top: 4px; }
.field-check input { width: 17px; height: 17px; margin: 0; flex: none; }
.job-chip-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (max-width: 640px) { .field-grid .crew-col { width: 104px; font-size: 12px; } .field-grid { min-width: 720px; } }
