/* --- Поручения: доска на компонентах Протокола (stat-card, card, list-filters, badge, cal-day-item) --- */

/* Счётчики по статусам: та же stat-card, цвет точки — по статусу */
.as-stats-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.as-stats-row .as-stat::after { opacity: .9; }
.as-stats-row .as-stat-total::after    { background: var(--primary); opacity: .35; }
.as-stats-row .as-stat-overdue::after  { background: var(--danger); }
.as-stats-row .as-stat-info::after     { background: #94a3b8; }
.as-stats-row .as-stat-rework::after   { background: #7c3aed; }
.as-stats-row .as-stat-progress::after { background: var(--warning); }
.as-stats-row .as-stat-done::after     { background: var(--success); }

.as-filters input[type="search"] { flex: 1 1 220px; }
.as-filters select { max-width: 240px; }

/* Колонки — обычные белые карточки с заголовком */
.as-board {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  align-items: flex-start;
  padding-bottom: .25rem;
}
.as-col { flex: 1 1 300px; min-width: 300px; margin-bottom: 0; transition: box-shadow .15s, border-color .15s; }
.as-col.is-empty { flex: 0 0 200px; min-width: 200px; }
.as-col.is-drop { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow); }
.as-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .85rem;
}
.as-col-head h3 { display: flex; align-items: center; gap: .5rem; margin: 0; }
.as-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.as-dot-overdue  { background: var(--danger); }
.as-dot-info     { background: #94a3b8; }
.as-dot-rework   { background: #7c3aed; }
.as-dot-progress { background: var(--warning); }
.as-dot-done     { background: var(--success); }

/* Поручение — плитка как в «Событиях дня» на дашборде */
.as-list { list-style: none; margin: 0 0 .5rem; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.as-list .empty-state { padding: .25rem 0; }
.as-item {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .7rem .8rem;
  border-radius: 12px;
  background: var(--bg-soft);
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.as-item:hover, .as-item:focus-visible {
  background: color-mix(in srgb, var(--primary) 8%, var(--bg-soft));
  outline: none;
}
.as-item[draggable="true"] { cursor: grab; }
.as-item.is-dragging { opacity: .4; }

.as-item-date {
  font-size: .9rem;
  font-weight: 800;
  color: var(--primary);
  min-width: 3rem;
  padding-top: .1rem;
  line-height: 1.1;
}
.as-item-date small { display: block; font-size: .68rem; font-weight: 700; color: var(--muted); margin-top: .15rem; }
.as-item-date.is-overdue { color: var(--danger); }
.as-item-date-none { font-size: .7rem; color: var(--muted); font-weight: 700; }

.as-item-body { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.as-item-body strong {
  font-size: .88rem;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.as-item-body small { color: var(--muted); font-size: .76rem; font-weight: 600; }
.as-item-note {
  color: var(--text) !important;
  opacity: .75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.as-item-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .2rem; }
.as-item-tags .badge { font-size: .66rem; padding: .15rem .5rem; }

/* Карточка поручения в модальном окне */
.as-detail-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding-right: 2.5rem; margin-bottom: .5rem; }
.as-detail-head h3 { margin: 0; font-size: 1.15rem; font-weight: 800; }
.as-detail-desc { font-size: .98rem; font-weight: 600; line-height: 1.5; color: var(--ink); margin: 0 0 1rem; white-space: pre-line; }
.as-detail .card { box-shadow: none; background: var(--bg-soft); margin-bottom: 1rem; }
.as-detail .card p { font-size: .88rem; margin-bottom: .45rem; overflow-wrap: anywhere; }
.as-detail a { color: var(--accent-blue); font-weight: 700; text-decoration: none; }
.as-label { color: var(--muted); font-weight: 600; }
.as-detail-comment { margin-top: .5rem; font-weight: 600; }
.as-detail-comment small { font-weight: 600; opacity: .8; }

.as-bad { color: var(--danger); font-weight: 800; }
.as-total td { font-weight: 800; background: var(--bg-soft); }
.as-stats { overflow-x: auto; }

@media (max-width: 900px) {
  .as-stats-row { grid-template-columns: repeat(2, 1fr); }
  .as-board { scroll-snap-type: x mandatory; }
  .as-col, .as-col.is-empty { flex: 0 0 86%; min-width: 0; scroll-snap-align: start; }
  .as-detail.grid-2 { grid-template-columns: 1fr; }
  .as-filters select { max-width: none; flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .as-item, .as-col { transition: none; }
}

/* История изменений в карточке поручения — как «События дня» */
.as-history-card { margin-top: .25rem; }
.as-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; max-height: 280px; overflow-y: auto; }
.as-history-item { display: flex; gap: .75rem; align-items: flex-start; padding: .6rem .75rem; border-radius: 12px; background: var(--bg-soft); }
.as-history-time { font-size: .74rem; font-weight: 800; color: var(--primary); min-width: 6.5rem; padding-top: .1rem; }
.as-history-body { display: flex; flex-direction: column; gap: .2rem; min-width: 0; font-size: .86rem; }
.as-history-body .badge { align-self: flex-start; font-size: .66rem; }
.as-history-body small { color: var(--text); opacity: .8; overflow-wrap: anywhere; }
.as-history-body a { color: var(--accent-blue); font-weight: 700; text-decoration: none; }

/* Личные ссылки и рассылка в MAX */
.as-mailing-bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.as-mailing-bar .list-meta { margin: 0; }
.as-mailing-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.as-mailing-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .35rem 0 .65rem; }
.as-mailing-toolbar .list-meta { margin: 0; margin-left: auto; }
.as-link-actions { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.as-link-actions small { color: var(--muted); font-size: .72rem; font-weight: 600; }
.as-mailing-stats { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 1rem; }
.as-mailing-list { max-height: 50vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.as-mailing-list select { width: 100%; max-width: 320px; padding: .35rem .6rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; font-size: .8rem; background: var(--bg-soft); }
.as-mailing-list td { vertical-align: top; }
