/* ─── Общие классы разделов: таблицы, теги-статусы, лента (перенос из v9) ───
   Используются страницами (Базы/Проекты/Люди/Касания/Лента), живут в ядре,
   чтобы вид был единым. Подключается глобально в main.tsx после tokens.css. */

/* Таблицы списков. padding-top = 0: иначе строки видны в зазоре НАД sticky-шапкой. */
.tblwrap { flex: 1; overflow: auto; padding: 0 var(--pad-x) 22px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted-2);
  text-align: left;
  padding: 12px 13px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  /* Шапка липнет к верху скролл-контейнера .tblwrap (фон перекрывает строки) */
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
}

/* Кликабельный ID-хвост (deep-link на запись) */
.idcell {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted-2);
  cursor: pointer;
  text-decoration: none;
}
.idcell:hover { color: var(--brand-lt); text-decoration: underline; }
thead th.r, td.r { text-align: right; }
tbody td { padding: 11px 13px; border-bottom: 1px solid var(--line-2); color: var(--ink); }
tbody tr { cursor: pointer; transition: background .14s ease; }
tbody tr:hover td { background: rgba(177, 79, 196, .08); }
tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--brand-lt); }
td .nm2 { font-weight: 600; }
td .sub2 { color: var(--muted-2); font-size: 11px; margin-top: 1px; }
.muted-cell { color: var(--muted-2); }

/* Теги-статусы (тип компании, стадия, факт/план касания) */
.tg {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
  display: inline-block;
}
.tg.customer { background: rgba(86, 194, 138, .16); color: #56C28A; }
.tg.contractor { background: rgba(111, 163, 214, .16); color: #8FB6E0; }
.tg.prescriptor { background: var(--wash); color: var(--brand-lt); }
.tg.scouting { background: rgba(189, 59, 221, .14); color: #D767E8; }
.tg.s0 { background: rgba(167, 159, 181, .16); color: #B5AEC2; }
.tg.s1 { background: rgba(230, 178, 74, .16); color: #E6B24A; }
.tg.s2 { background: rgba(111, 163, 214, .16); color: #8FB6E0; }
.tg.s3 { background: var(--wash); color: var(--brand-lt); }
.tg.plan { background: rgba(230, 178, 74, .16); color: #E6B24A; }
.tg.done { background: rgba(86, 194, 138, .16); color: #56C28A; }
.tg.tover { background: var(--crit-w); color: var(--crit); }
/* Плашка-тип в таблице: единый размер (выровнены по колонке) + аккуратный hover */
.tg.editable {
  cursor: pointer;
  min-width: 104px;
  text-align: center;
  padding: 4px 11px;
  transition: box-shadow .15s var(--ease), filter .15s var(--ease);
}
.tg.editable:hover { box-shadow: 0 0 0 1px currentColor; filter: brightness(1.12); }
.dir {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Лента активности (feed) */
.feed { flex: 1; overflow: auto; padding: 14px var(--pad-x) 24px; max-width: 780px; }
.fi {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  padding: 13px 2px;
  border-bottom: 1px solid var(--line-2);
  position: relative;
}
.fi .fav {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
}
.fi .fic {
  position: absolute;
  left: 24px;
  top: 30px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--rail);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
}
.fi .fic svg { width: 10px; height: 10px; stroke: var(--brand-lt); stroke-width: 2; fill: none; }
.fi .fbody { flex: 1; min-width: 0; }
.fi .ft { font-size: 13px; line-height: 1.45; }
.fi .ft b { font-weight: 600; }
.fi .ft .ent { color: var(--brand-lt); font-weight: 500; }

/* ── Мобильные таблицы: строки превращаются в карточки ── */
@media (max-width: 720px) {
  .tblwrap {
    padding: 0 var(--pad-x) 96px;
  }

  .tblwrap table,
  .tblwrap thead,
  .tblwrap tbody,
  .tblwrap tr,
  .tblwrap th,
  .tblwrap td {
    display: block;
  }

  .tblwrap thead {
    display: none;
  }

  .tblwrap table {
    border-collapse: separate;
    border-spacing: 0;
  }

  .tblwrap tbody {
    display: grid;
    gap: 10px;
  }

  .tblwrap tbody tr {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .035);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .14);
  }

  .tblwrap tbody tr:hover td {
    background: transparent;
  }

  .tblwrap tbody tr:hover td:first-child {
    box-shadow: none;
  }

  .tblwrap tbody td {
    display: grid;
    grid-template-columns: minmax(82px, 32%) 1fr;
    align-items: start;
    gap: 10px;
    min-width: 0;
    padding: 0;
    border-bottom: 0;
    text-align: left;
  }

  .tblwrap tbody td::before {
    content: attr(data-label);
    min-width: 0;
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted-2);
  }

  .tblwrap tbody td:empty {
    display: none;
  }

  .tblwrap tbody td.r {
    text-align: left;
  }

  .tblwrap tbody td:first-child {
    grid-template-columns: 1fr;
    margin-bottom: 1px;
  }

  .tblwrap tbody td:first-child::before {
    display: none;
  }

  .tblwrap .idcell {
    justify-self: start;
    padding: 2px 7px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .04);
  }

  .tblwrap td .nm2 {
    font-size: 14px;
    line-height: 1.25;
  }

  .tblwrap td .sub2 {
    font-size: 11px;
    line-height: 1.35;
  }
}
.fi .fm {
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted-2);
  margin-top: 3px;
}
.fi .fago { flex: none; font-family: var(--mono); font-size: 10px; color: var(--muted-2); white-space: nowrap; }
