:root {
  --pine: #173f35;
  --pine-light: #245848;
  --gold: #b18b4e;
  --ink: #243b34;
  --muted: #7b8981;
  --paper: #f5f4ee;
  --line: #e4e7df;
  --white: #fff;
  --danger: #a44839;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  outline-offset: 4px;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.45;
  cursor: wait;
}
a {
  color: var(--pine);
}
.shell {
  display: grid;
  grid-template-columns: 238px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--pine);
  color: #e4eee4;
  padding: 24px 20px 18px;
  position: fixed;
  width: 238px;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
}
.logo {
  padding: 0 16px 22px;
}
.logo strong {
  display: block;
  font:
    700 35px Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 7px;
  color: #f7f1df;
}
.logo span {
  font-size: 10px;
  letter-spacing: 2.4px;
  color: #a9c0b2;
}
.sidebar nav {
  display: grid;
  gap: 4px;
  /* Пунктов меню много: список прокручивается, а подпись снизу остаётся
     на виду и не обрезается краем экрана. */
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
}
.nav {
  background: transparent;
  border: 0;
  text-align: left;
  padding: 11px 14px;
  border-radius: 9px;
  color: #c1d3c7;
  display: flex;
  align-items: center;
  gap: 13px;
  font-size: 14px;
}
.nav:hover {
  background: #ffffff0c;
}
.nav.active {
  background: #ffffff12;
  color: white;
  box-shadow: inset 3px 0 var(--gold);
}
.nav .icon {
  width: 22px;
  opacity: 0.8;
  font-size: 18px;
}
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid #ffffff19;
  padding: 16px 10px 4px;
  font-size: 12px;
  color: #abc1b3;
}
.sidebar-footer b {
  display: block;
  color: #eef3ed;
  margin: 12px 0 6px;
}
@media (max-height: 960px) {
  .sidebar {
    padding: 18px 16px 14px;
  }
  .logo {
    padding: 0 12px 14px;
  }
  .logo strong {
    font-size: 30px;
    letter-spacing: 6px;
  }
  .nav {
    padding: 8px 12px;
    font-size: 13px;
    gap: 10px;
  }
  .nav .icon {
    font-size: 16px;
    width: 18px;
  }
  .sidebar nav {
    gap: 2px;
  }
  .sidebar-footer {
    padding: 12px 8px 2px;
    font-size: 11px;
  }
  .sidebar-footer b {
    margin: 8px 0 4px;
  }
}
.sidebar-footer a {
  color: #c2d5c7;
}
.workspace {
  grid-column: 2;
  min-width: 0;
}
.topbar {
  height: 80px;
  border-bottom: 1px solid var(--line);
  background: #fcfcf8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  gap: 20px;
}
.breadcrumb {
  font-size: 13px;
  color: var(--muted);
}
.breadcrumb b {
  color: var(--ink);
  font-weight: 500;
}
.logout {
  background: transparent;
  border: 1px solid #d7ded8;
  color: #4c5a50;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  cursor: pointer;
}
.logout:hover {
  border-color: var(--pine);
  color: var(--pine);
}
.top-right {
  display: flex;
  gap: 15px;
  align-items: center;
}
.avatar {
  background: #e6ece4;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  font-size: 12px;
}
.demo-badge {
  color: #9b763e;
  font-size: 11px;
  border: 1px solid #ddcfaf;
  padding: 5px 9px;
  border-radius: 5px;
}
.content {
  padding: 32px 40px 50px;
  max-width: 1550px;
  margin: auto;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 25px;
}
.eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gold);
  margin-bottom: 8px;
}
h1 {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 32px;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.4px;
}
h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 18px;
}
h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 10px;
}
p {
  line-height: 1.6;
}
.subtext {
  font-size: 13px;
  color: var(--muted);
  margin-top: 9px;
}
.btn {
  background: var(--pine);
  color: white;
  border: 1px solid var(--pine);
  border-radius: 7px;
  padding: 11px 17px;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}
.btn:hover {
  background: var(--pine-light);
}
.btn.secondary {
  background: white;
  color: var(--pine);
  border-color: #d6ded4;
}
.btn.secondary:hover {
  background: #f1f4ef;
}
.btn.small {
  padding: 7px 11px;
  font-size: 12px;
}
.btn.danger {
  background: white;
  border-color: #d9b9b2;
  color: var(--danger);
}
.btn-row {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}
.stat {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px 24px;
}
.stat .label {
  font-size: 12px;
  color: var(--muted);
}
.stat .value {
  font-size: 30px;
  margin-top: 12px;
  letter-spacing: -1px;
}
.stat small {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 10px;
}
.grid-two {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 22px;
}
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 20px;
  min-width: 0;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.card-head h2 {
  margin: 0;
}
.hint {
  background: #f8f5ed;
  border-left: 3px solid var(--gold);
  padding: 13px 16px;
  font-size: 12px;
  line-height: 1.6;
  color: #776440;
  margin-bottom: 22px;
}
.empty {
  padding: 40px 15px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}
.empty strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  margin-bottom: 8px;
}
.list-item {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid #eff0eb;
  align-items: center;
}
.list-item:last-child {
  border: 0;
}
.list-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #eef2e9;
  display: grid;
  place-items: center;
  color: var(--pine);
  flex-shrink: 0;
}
.list-main {
  flex: 1;
  min-width: 0;
}
.list-main b {
  display: block;
  font-size: 13px;
  margin-bottom: 5px;
}
.list-main small {
  font-size: 11px;
  color: var(--muted);
}
.tag {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 5px;
  font-size: 10px;
  background: #edf3ec;
  color: #466e52;
  white-space: nowrap;
}
.tag.gold {
  background: #f6efdd;
  color: #997338;
}
.tag.red {
  background: #f8ebe7;
  color: #a45142;
}
.tag.gray {
  background: #f0f1ee;
  color: #778078;
}
.table-wrap {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
th {
  text-align: left;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  font-weight: 500;
}
td {
  padding: 15px 10px;
  border-bottom: 1px solid #eef0ea;
  vertical-align: middle;
}
td b {
  font-weight: 600;
}
/* Нумерация строк в таблицах-списках: узкий серый столбец с ровными цифрами. */
th.num,
td.num {
  width: 38px;
  padding-right: 4px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}
/* Телефон в таблицах — всегда одной строкой: перенос по дефису читается плохо. */
.phone {
  white-space: nowrap;
}
/* ---------- Мини-календарь выбора дат показа ----------
   Директор отмечает конкретные дни и добавляет их разом: программа не обязана
   идти каждую неделю, поэтому периода «с/по» здесь нет. */
.sched {
  max-width: 420px;
  margin: 10px 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fdfcf9;
}
.sched-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.sched-head b {
  font-size: 13px;
  color: var(--pine);
}
.sched-nav {
  display: flex;
  gap: 6px;
}
.sched-dow,
.sched-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.sched-dow span {
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  padding-bottom: 4px;
}
.sched-day {
  position: relative;
  padding: 8px 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
}
.sched-day:hover {
  border-color: var(--gold);
}
.sched-day.out {
  color: #c3cabf;
  background: transparent;
}
.sched-day.picked {
  background: var(--pine);
  border-color: var(--pine);
  color: var(--white);
}
.sched-day.picked:hover {
  background: var(--pine-light);
}
.sched-day .sched-dot {
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--gold);
}
tr.clickable {
  cursor: pointer;
}
tr.clickable:hover {
  background: #f8faf5;
}
.row-actions {
  display: flex;
  gap: 6px;
}
/* выбор клиента в форме мероприятия: список и кнопка «+ Новый» рядом */
.inline-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.inline-row select {
  flex: 1;
}
/* имя клиента в списке — ссылка на его карточку */
.link {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--pine);
  text-align: left;
  cursor: pointer;
}
.link:hover {
  text-decoration: underline;
}
/* строки людей внутри формы организации */
.person-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1.3fr auto;
  gap: 6px;
  margin-bottom: 6px;
}
.person-row input {
  min-width: 0;
}
/* фото компонента в конструкторе: миниатюра в списке и превью в форме */
.component-cell {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.component-thumb {
  width: 72px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  flex-shrink: 0;
  background: #f3f5f0;
}
.component-thumb.empty-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}
.photo-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.photo-preview img {
  width: 160px;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}
/* состав программы: позиция + пометка «обязательно» */
.program-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf9;
}
.program-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
}
.program-line label:first-child {
  flex: 1;
}
.list-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}
/* Галерея программы: несколько фотографий в редакторе */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.gallery-item {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.gallery-item img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fbfcf9;
}
.gallery-item figcaption {
  font-size: 11px;
  color: var(--muted);
}
/* Название мероприятия в шапке карточки: правится прямо на месте */
.deal-title-input {
  font: inherit;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.2;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 4px 10px;
  margin: 2px 0 6px;
  width: min(620px, 62vw);
  max-width: 100%;
}
.deal-title-input:focus {
  outline: 2px solid #2f6b5f40;
  border-color: #2f6b5f;
}
/* ── Плотнее: в разделах и карточках было слишком много пустого места ──
   Значения подобраны умеренно, чтобы ничего не слипалось. */
.content {
  padding: 22px 28px 40px;
}
.page-head {
  margin-bottom: 14px;
  gap: 14px;
}
.page-head h1 {
  font-size: 24px;
}
.stats {
  gap: 12px;
  margin-bottom: 14px;
}
.stat {
  padding: 13px 15px;
}
.stats .stat .value {
  font-size: 20px;
}
.card {
  padding: 15px 17px;
  margin-bottom: 11px;
}
.card-head {
  margin-bottom: 11px;
}
.card-head h2,
.card > h2 {
  font-size: 16px;
}
.card h3,
.card-head h3 {
  font-size: 14px;
}
.tabs {
  gap: 18px;
  margin-bottom: 14px;
}
.tab {
  padding: 9px 0;
}
.detail-head {
  margin-bottom: 11px;
}
.sum-row {
  padding: 5px 0;
}
.builder-grid {
  gap: 13px;
  grid-template-columns: minmax(0, 1fr) 280px;
}
.field {
  margin-bottom: 10px;
}
.btn-row {
  gap: 7px;
}
.deal-title-input {
  font-size: 22px;
  padding: 3px 9px;
  margin: 0 0 4px;
}
/* строки таблиц: меньше вертикальных отступов, горизонтальные не трогаем */
table th,
table td {
  padding-top: 7px;
  padding-bottom: 7px;
}
@media (max-width: 1100px) {
  .content {
    padding: 18px 16px 34px;
  }
  .builder-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 768px) {
  .person-row {
    grid-template-columns: 1fr;
  }
}
.filters {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
input,
select,
textarea {
  background: #fff;
  border: 1px solid #d8ded5;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--ink);
  width: 100%;
}
textarea {
  min-height: 80px;
  resize: vertical;
}
input[type="checkbox"] {
  width: auto;
  accent-color: var(--pine);
}
label {
  display: block;
  font-size: 12px;
  margin-bottom: 7px;
  color: #526459;
}
.field {
  margin-bottom: 16px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.form-grid .wide {
  grid-column: 1/-1;
}
.search {
  max-width: 300px;
}
.kanban {
  display: grid;
  grid-template-columns: repeat(10, 230px);
  gap: 15px;
  overflow: auto;
  padding-bottom: 15px;
}
.kanban-col {
  background: #eeefe8;
  border-radius: 9px;
  padding: 13px;
  min-height: 300px;
}
.kanban-col h3 {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 15px;
}
.deal-tile {
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
}
.deal-tile:hover {
  border-color: var(--gold);
}
.deal-tile b {
  display: block;
  font-size: 12px;
  line-height: 1.5;
}
.deal-tile small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin: 8px 0;
}
.deal-tile .price {
  font-size: 15px;
  margin-top: 15px;
}
.detail-head {
  margin-bottom: 23px;
}
.back {
  border: 0;
  background: none;
  font-size: 12px;
  color: var(--muted);
  padding: 0;
  margin-bottom: 14px;
}
.tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 25px;
  overflow: auto;
}
.tab {
  padding: 14px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.tab.active {
  color: var(--pine);
  border-color: var(--gold);
}
.builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 22px;
}
.calc-line {
  display: grid;
  grid-template-columns: 1fr 95px 95px 30px;
  gap: 10px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.calc-line b {
  font-size: 12px;
}
.calc-line small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 5px;
}
.calc-line input {
  font-size: 12px;
  padding: 8px;
}
.remove {
  border: 0;
  background: none;
  color: #a27b69;
  font-size: 19px;
}
.sum-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 10px 0;
  color: #68766e;
}
.sum-row.total {
  border-top: 1px solid var(--line);
  font-size: 21px;
  color: var(--pine);
  padding-top: 18px;
  font-weight: 600;
}
/* Вид мероприятия выбирается прямо в строке карточки — без отдельного окна. */
.sum-row .inline-select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--pine);
  font: inherit;
  font-weight: 600;
  padding: 4px 8px;
  max-width: 240px;
}
.program-row {
  display: grid;
  grid-template-columns: 55px 1fr 85px;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.program-time {
  font-size: 11px;
  color: var(--gold);
  padding-top: 10px;
}
.resource-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.resource-checks label {
  font-size: 10px;
  display: flex;
  gap: 5px;
  align-items: center;
  margin: 0;
}
.calendar {
  display: grid;
  grid-template-columns: 50px repeat(7, minmax(110px, 1fr));
  min-width: 850px;
  user-select: none;
}
/* Подпись над сеткой: месяц и год (в режиме месяца) или диапазон недели */
.calendar-caption {
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: #fbfcf9;
  border-bottom: 1px solid var(--line);
}
.cal-month + .calendar-caption,
.calendar-caption + .calendar-month {
  border-top: 0;
}
.cal-day {
  border-left: 1px solid #ccd3c4;
  position: relative;
}
.cal-day:last-child {
  border-right: 1px solid #ccd3c4;
}
/* сегодняшний день слегка подкрашен, чтобы не искать его по подписи */
.cal-day.today .cal-body {
  background-color: #fafcf6;
}
.cal-head {
  height: 50px;
  text-align: center;
  font-size: 11px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #fbfcf9;
}
.cal-head b {
  display: block;
  margin-top: 4px;
}
.cal-hours {
  padding-top: 50px;
}
.cal-hours div {
  height: 48px;
  font-size: 10px;
  color: var(--muted);
  text-align: right;
  padding: 0 8px;
}
.cal-body {
  /* 15 часов с 09:00 до 00:00, по 48px на час.
     Час — сплошная линия, полчаса — посветлее: иначе сетка сливается в белое поле. */
  height: 720px;
  position: relative;
  background-image: repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 23px,
      #e8ebe3 23px,
      #e8ebe3 24px
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 47px,
      #ccd3c4 47px,
      #ccd3c4 48px
    );
  border-bottom: 1px solid #ccd3c4;
}
/* последняя подпись «00:00» — граница суток, по высоте не занимает места */
.cal-hours .cal-hour-final {
  height: 0;
  line-height: 0;
  padding-top: 0;
}
/* выделение часов под новую бронь */
.cal-body {
  cursor: crosshair;
}
.cal-pick {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 3;
  pointer-events: none;
  background: #799d7733;
  border-top: 2px solid var(--pine);
  border-bottom: 2px solid var(--pine);
}
.cal-pick span {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--pine);
  background: #ffffffcc;
  border-radius: 3px;
  padding: 1px 4px;
}
.cal-day.today .cal-head {
  background: #eef3ea;
}
/* Месяц целиком: семь колонок, невысокие клетки — помещается на страницу */
.calendar-month {
  display: grid;
  grid-template-columns: repeat(7, minmax(96px, 1fr));
  min-width: 680px;
}
.cal-month-dow {
  padding: 7px 0;
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  background: #fbfcf9;
  border-bottom: 1px solid var(--line);
}
.cal-month-cell {
  min-height: 92px;
  padding: 5px 6px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.cal-month-cell:hover {
  background: #f1f4ef;
}
.cal-month-cell.out {
  background: #fafbf8;
}
.cal-month-cell.out .cal-month-day {
  color: var(--muted);
}
.cal-month-cell.today {
  background: #eef3ea;
}
.cal-month-day {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 3px;
}
.cal-month-chip {
  margin-bottom: 2px;
  padding: 2px 4px;
  font-size: 9px;
  line-height: 1.35;
  background: #e2ece0;
  border-left: 2px solid #658a60;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-month-chip.hold {
  background: #f2ead5;
  border-color: var(--gold);
}
/* Показы программ (повторяющиеся даты) — свой цвет, чтобы их не путали с бронями. */
.cal-month-chip.planned {
  background: #e9e6f4;
  border-color: #6b5f9e;
}
.cal-month-more {
  font-size: 9px;
  color: var(--muted);
}
.btn.active {
  background: var(--pine);
  color: white;
  border-color: var(--pine);
}
.cal-event {
  position: absolute;
  left: 4px;
  right: 4px;
  border-radius: 5px;
  background: #e2ece0;
  border-left: 3px solid #658a60;
  padding: 7px;
  font-size: 10px;
  overflow: hidden;
  cursor: pointer;
}
.cal-event.hold {
  background: #f2ead5;
  border-color: var(--gold);
}
/* Показ программы из расписания: та же сетка, другой цвет и без клиента. */
.cal-event.planned {
  background: #e9e6f4;
  border-left-color: #6b5f9e;
}
.cal-event b {
  display: block;
  line-height: 1.4;
}
.cal-event small {
  display: block;
  font-size: 9px;
  margin-top: 4px;
}
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--pine);
}
.login-card {
  background: var(--paper);
  width: min(480px, 90vw);
  padding: 45px;
  border-radius: 12px;
}
.login-card h1 {
  margin-bottom: 15px;
}
.login-card .btn {
  width: 100%;
  margin-top: 12px;
}
.role-select {
  width: 160px;
  padding: 7px;
  font-size: 11px;
  background: transparent;
}
.loading {
  padding: 50px;
  font-size: 14px;
}
.error {
  color: var(--danger);
  background: #faf0eb;
  padding: 14px;
  font-size: 13px;
  border-radius: 6px;
}
dialog {
  width: min(600px, 92vw);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 28px;
  box-shadow: 0 25px 90px #102e3440;
  max-height: 90vh;
  overflow: auto;
}
dialog::backdrop {
  background: #0c2f2960;
  backdrop-filter: blur(3px);
}
/* Окно на весь экран: сетка недели и список компонентов видны целиком */
dialog.cal-modal {
  width: calc(100vw - 24px);
  max-width: none;
  height: calc(100vh - 24px);
  max-height: none;
  overflow: hidden;
  padding: 20px 24px;
}
/* flex — только у ОТКРЫТОГО окна: иначе закрытый диалог остаётся видимым
   внизу страницы, потому что наше правило перебивает браузерное «скрыть закрытый» */
dialog.cal-modal[open] {
  display: flex;
  flex-direction: column;
}
dialog.cal-modal .modal-head {
  margin-bottom: 14px;
}
dialog.cal-modal form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
dialog.cal-modal .cal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
dialog.cal-modal .cal-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
dialog.cal-modal .cal-nav input {
  width: 155px;
}
dialog.cal-modal .cal-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
dialog.cal-modal .cal-scroll .calendar {
  min-width: 100%;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}
.modal-head h2 {
  margin: 0;
}
.close {
  border: 0;
  background: none;
  font-size: 22px;
  color: var(--muted);
}
#toast {
  position: fixed;
  bottom: 25px;
  right: 25px;
  padding: 14px 20px;
  border-radius: 8px;
  background: var(--pine);
  color: white;
  font-size: 13px;
  box-shadow: 0 5px 20px #0002;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  max-width: 460px;
  z-index: 9;
}
#toast.show {
  opacity: 1;
}
#toast.error-toast {
  background: #8f3c30;
}
.progress {
  height: 5px;
  background: #edf0e8;
  border-radius: 5px;
  overflow: hidden;
}
.progress > div {
  height: 100%;
  background: #799d77;
}
.tiny {
  font-size: 11px;
  color: var(--muted);
}
.calendar-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}
.hidden {
  display: none !important;
}
@media (max-width: 1100px) {
  .sidebar {
    width: 200px;
    padding: 25px 12px;
  }
  .shell {
    grid-template-columns: 200px 1fr;
  }
  .content {
    padding: 25px;
  }
  .topbar {
    padding: 0 25px;
  }
  .stats {
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stat {
    padding: 17px;
  }
  .grid-two,
  .builder-grid {
    grid-template-columns: 1fr;
  }
  .builder-summary {
    order: -1;
  }
  .builder-summary .card {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
  }
  .builder-summary h2 {
    width: 100%;
  }
}
@media (max-width: 700px) {
  .shell {
    display: block;
  }
  .sidebar {
    position: sticky;
    width: auto;
    top: 0;
    bottom: auto;
    padding: 10px 12px;
    z-index: 5;
    display: block;
  }
  .logo {
    display: none;
  }
  .sidebar nav {
    display: flex;
    overflow: auto;
    gap: 3px;
  }
  .nav {
    padding: 10px;
    white-space: nowrap;
    font-size: 11px;
  }
  .nav .icon {
    font-size: 15px;
    width: auto;
  }
  .sidebar-footer {
    display: none;
  }
  .topbar {
    height: 58px;
    padding: 0 16px;
  }
  .breadcrumb {
    font-size: 11px;
  }
  .top-right {
    gap: 7px;
  }
  .avatar {
    display: none;
  }
  .content {
    padding: 22px 16px;
  }
  .page-head {
    align-items: flex-start;
    gap: 12px;
  }
  h1 {
    font-size: 27px;
  }
  .stats {
    grid-template-columns: 1fr 1fr;
  }
  .stat .value {
    font-size: 25px;
  }
  .card {
    padding: 18px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .calc-line {
    grid-template-columns: 1fr 65px 65px 22px;
    gap: 6px;
  }
  .tag {
    font-size: 9px;
  }
  .btn {
    padding: 10px 13px;
    font-size: 11px;
  }
  .role-select {
    width: 125px;
  }
  .page-head .btn-row {
    max-width: 160px;
  }
  #toast {
    left: 15px;
    right: 15px;
    max-width: none;
  }
  .program-row {
    grid-template-columns: 40px 1fr 65px;
  }
  .tabs {
    gap: 20px;
  }
}

/* ---------- закладка «Программы»: список и полноценный редактор ---------- */
.program-row:has(.program-main) { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.program-thumb { width: 56px; height: 56px; flex: 0 0 56px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; color: var(--muted); background: #fbfcf9; }
.program-thumb img { width: 100%; height: 100%; object-fit: cover; }
.program-main { flex: 1; min-width: 0; }
.program-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.program-group { margin-bottom: 14px; }
.program-group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 0 0 6px; }
.program-pick { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 4px; background: #fff; }
.program-pick.on { border-color: var(--accent); background: #fdfaf3; }
.pick-main { display: flex; gap: 10px; align-items: flex-start; flex: 1; cursor: pointer; }
.pick-main input { width: auto; margin-top: 3px; }
/* правая колонка состава — в одну строку: цена, прайс, галочки, «Убрать» */
.pick-side { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 10px; }
/* цена позиции программы: компактное поле рядом с прайсом компонента */
.pick-price { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.pick-price input { width: 86px; padding: 3px 6px; font-size: 12px; text-align: right; }
.pick-price input::placeholder { color: #b9aca0; }
/* «Кто проводит» внутри строки состава: должность → сотрудник.
   Строка состава — flex, поэтому блок занимает всю ширину под ней. */
.program-crew {
  flex-basis: 100%;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed var(--line);
}
.program-pick {
  flex-wrap: wrap;
}
.crew-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
  font-size: 11px;
}
.crew-head .tiny { margin: 0; }
.crew-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
}
.crew-row select {
  flex: 1 1 0;
  min-width: 0;
  padding: 3px 7px;
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.crew-row .btn { flex: 0 0 auto; }
/* ставка должности: нередактируемая сумма рядом с выбором должности */
.crew-rate {
  flex: 0 0 auto;
  min-width: 92px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
  color: var(--pine);
  background: #f1f4ef;
  border: 1px solid var(--line);
  border-radius: 8px;
}
/* ставка в строке «Кто проводит»: правится под мероприятие, по умолчанию — из справочника «Должности» */
.crew-rate-input { width: 96px; flex: 0 0 96px; text-align: right; font-family: inherit; }
.crew-rate-input::placeholder { color: #b9aca0; font-weight: 400; }
/* «цена вручную»: вместо цены и прайса — стоимость из ставок должностей */
/* итоговая стоимость программы под кнопками сохранения */
.program-total { margin: 10px 0 0; font-size: 13px; }
.program-total b { font-size: 15px; color: var(--pine); }
/* должность и ставка участника в составе шоу */
/* несколько должностей у человека: компактные строки «должность + ставка» */
.lineup-person {
  align-items: flex-start;
  padding: 4px 8px;
  margin-bottom: 2px;
  gap: 10px;
}
.lineup-person .pick-main { align-items: flex-start; }
.lineup-person .lineup-name {
  flex: 0 0 250px;
  max-width: 250px;
  font-size: 12px;
}
.lineup-person .lineup-name small { color: var(--muted); font-weight: 400; }
.lineup-rates {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.lineup-rate-row { display: flex; align-items: center; gap: 5px; }
.lineup-rate-row select {
  flex: 0 0 200px;
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.lineup-rate-row input {
  flex: 0 0 88px;
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-align: right;
}
.lineup-rate-row .remove {
  padding: 0 6px;
  font-size: 12px;
  line-height: 1;
}
.lineup-add {
  flex: 0 0 auto;
  padding: 0 9px;
  height: 22px;
  line-height: 1;
  font-size: 12px;
}
.lineup-rate { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.lineup-rate select { font-size: 12px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 8px; background: #fff; max-width: 230px; }
.lineup-rate input { width: 96px; font-size: 12px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 8px; text-align: right; }
/* должности мастер-классов внутри таблицы позиций */
.crew-line td { background: #fbfbf7; border-top: 0; }
.crew-line small { color: var(--muted); }
.pick-cost { font-size: 12px; font-weight: 600; color: var(--pine); white-space: nowrap; }
.pick-cost .tiny { font-weight: 400; color: var(--muted); }
.crew-rate.empty {
  font-weight: 400;
  color: var(--muted);
}
/* окно выбора компонентов: под отмеченным компонентом — его должности */
.pick-positions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: -2px 0 8px 30px;
  padding: 6px 8px;
  background: #f6f4ea;
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.pick-pos {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 9px;
  font-size: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.pick-pos button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.pick-pos button:hover {
  color: var(--danger);
}
.pick-positions select {
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.muted-note {
  color: var(--muted);
}
/* шкала «до N человек — цена» + открытый уровень «от N человек» */
.tier-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 10px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 6px; background: #fff; }
.tier-row input[type="number"] { width: 110px; padding: 4px 8px; font-size: 13px; text-align: right; }
.tier-row .remove { margin-left: auto; }
.tier-row--open { background: #fbf7ef; border-color: var(--line-strong, var(--line)); }
.tier-open-from { min-width: 28px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); font-size: 13px; }
/* архивная позиция в составе программы */
.pick-archived { color: #b3261e; background: #fdecea; border-radius: 5px; padding: 1px 6px; font-size: 11px; white-space: nowrap; }
.program-photo-row { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.program-photo-row .photo-preview { width: 200px; }

/* строка-заголовок группы в таблице компонентов */
.group-row td { background: #f3f5f0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 8px 10px; }

/* Колонка «Цена» в составе мероприятия: как отдельная колонка рядом с количеством и часами */
.calc-line .calc-price {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 96px;
}
.calc-line .calc-price span {
  font-size: 13px;
  font-weight: 500;
  padding: 6px 0;
  white-space: nowrap;
}

/* Строка состава: название · цена · количество · часы · стоимость · крестик
   (у директора между «Стоимостью» и крестиком добавляется «Себестоимость»). */
.calc-line {
  grid-template-columns: minmax(0, 1fr) 118px 92px 84px 118px 30px;
}
.calc-line .calc-price span {
  font-size: 12px;
}
@media (max-width: 900px) {
  .calc-line {
    grid-template-columns: minmax(0, 1fr) 88px 68px 60px 92px 26px;
    gap: 8px;
  }
}

/* Состав мероприятия — таблица: шапка с подписями одна на весь список, строки плотнее,
   категории — как в «Конструкторе» */
#calc-lines .calc-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px 92px 84px 118px 30px;
  gap: 10px;
  padding: 4px 0 8px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
#calc-lines .calc-group {
  padding: 14px 0 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}
#calc-lines .calc-line {
  padding: 7px 0;
  gap: 10px;
}
#calc-lines .calc-line .calc-price span {
  padding: 8px 0;
}
@media (max-width: 900px) {
  #calc-lines .calc-head {
    grid-template-columns: minmax(0, 1fr) 88px 68px 60px 92px 26px;
    gap: 8px;
  }
}

/* Строки состава — ещё ниже: меньше отступы у строк, полей и заголовков групп */
#calc-lines .calc-head {
  padding: 2px 0 6px;
}
#calc-lines .calc-group {
  padding: 9px 0 2px;
}
#calc-lines .calc-line {
  padding: 3px 0;
}
#calc-lines .calc-line input {
  height: 30px;
  padding: 4px 8px;
  font-size: 12px;
}
#calc-lines .calc-line .calc-price span {
  padding: 5px 0;
  font-size: 12px;
}
#calc-lines .calc-line .remove {
  font-size: 16px;
  line-height: 1;
}

/* «Фиксировано» / «За участника» — справа от названия, в одну строку с ним:
   из-за подписи под названием строка была вдвое выше */
#calc-lines .calc-line > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
#calc-lines .calc-line > div:first-child b {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#calc-lines .calc-line > div:first-child small {
  white-space: nowrap;
  color: var(--muted);
}
@media (max-width: 900px) {
  #calc-lines .calc-line > div:first-child small {
    display: none;
  }
}

/* ── Себестоимость и итоги в составе мероприятия ──────────────────────────────
   Колонка себестоимости появляется только у директора: сервер отдаёт `cost`
   лишь ему, у остальных ролей таблица остаётся прежней и не теряет ширину. */
#calc-lines.with-cost .calc-head,
#calc-lines.with-cost .calc-line {
  grid-template-columns: minmax(0, 1fr) 118px 92px 84px 118px 112px 30px;
}
/* «Стоимость» есть у всех ролей, «Себестоимость» — только у директора */
#calc-lines .calc-amount span,
#calc-lines.with-cost .calc-cost span {
  font-size: 12px;
  font-weight: 500;
  padding: 5px 0;
  white-space: nowrap;
  color: var(--ink);
}
@media (max-width: 900px) {
  #calc-lines.with-cost .calc-head,
  #calc-lines.with-cost .calc-line {
    grid-template-columns: minmax(0, 1fr) 84px 64px 56px 88px 84px 26px;
    gap: 8px;
  }
  #calc-lines .calc-amount span,
  #calc-lines.with-cost .calc-cost span {
    font-size: 11px;
  }
}

/* Итоги под таблицей состава: сумма строк, налог на себестоимость, итого, прибыль */
#calc-lines.with-cost .calc-total {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
#calc-lines.with-cost .calc-total .ct-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px 92px 84px 118px 112px 30px;
  gap: 10px;
  align-items: baseline;
  padding: 3px 0;
  font-size: 13px;
}
#calc-lines.with-cost .calc-total .ct-label {
  color: var(--muted);
}
#calc-lines.with-cost .calc-total .ct-price,
#calc-lines.with-cost .calc-total .ct-cost {
  white-space: nowrap;
  text-align: right;
}
#calc-lines.with-cost .calc-total .ct-row.total {
  font-size: 14px;
  font-weight: 600;
  padding-top: 6px;
}
#calc-lines.with-cost .calc-total .ct-row.total .ct-label {
  color: var(--ink);
}
#calc-lines.with-cost .calc-total .ct-row.profit .ct-price {
  font-weight: 600;
  color: var(--pine);
}
#calc-lines.with-cost .calc-total .ct-row.profit.negative .ct-price {
  color: var(--danger);
}
#calc-lines.with-cost .calc-total .ct-note {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}
@media (max-width: 900px) {
  #calc-lines.with-cost .calc-total .ct-row {
    grid-template-columns: minmax(0, 1fr) 84px 64px 56px 88px 84px 26px;
    gap: 8px;
    font-size: 12px;
  }
}

#calc-lines .calc-line label.tiny { display:none; }
/* Responsive card contract: min-content must never widen the page. */
.shell { grid-template-columns: 238px minmax(0,1fr); }
.workspace, .content, #deal-panel, .page-head > div, .builder-grid > *, .grid-two > * { min-width:0; }
.page-head { flex-wrap:wrap; gap:16px; }
.page-head > div:first-child { flex:1 1 320px; }
.page-head .btn-row { max-width:100%; flex-wrap:wrap; }
#deal-title { width:100%; max-width:100%; min-width:0; }
.card:has(> table), .calendar-card, .calendar-container { max-width:100%; overflow-x:auto; }
.card:has(#calc-lines) { container-type:inline-size; }
#calc-lines { max-width:100%; }
#program-blocks .program-row { display:grid; grid-template-columns:48px minmax(0,1fr) 84px; }
#calc-lines .calc-line > div:first-child b { white-space:normal; overflow:visible; overflow-wrap:anywhere; }
@media(max-width:1100px) {
  .shell { grid-template-columns:200px minmax(0,1fr); }
  .builder-summary { order:0; }
  .builder-summary .card { display:block; }
}
@container (max-width:850px) {
  #calc-lines .calc-head { display:none; }
  #calc-lines .calc-line, #calc-lines.with-cost .calc-line { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; padding:16px 0; position:relative; }
  #calc-lines .calc-line > div:first-child { grid-column:1/-1; padding-right:32px; display:block; }
  #calc-lines .calc-line > div:first-child b { display:block; }
  #calc-lines .calc-line > div:first-child small { display:block; }
  #calc-lines .calc-line label.tiny { display:block; margin-bottom:4px; }
  #calc-lines .calc-line .calc-price { min-width:0; }
  #calc-lines .calc-line .remove { position:absolute;right:0;top:12px;width:32px;height:32px; }
  #calc-lines.with-cost .calc-total .ct-row { display:grid;grid-template-columns:minmax(100px,1fr) auto auto;gap:12px; }
  #calc-lines .ct-row > span:empty { display:none; }
  #calc-lines .ct-label { overflow-wrap:anywhere; }
}
@media(max-width:700px) {
  .shell { display:block; }
  .page-head { display:block; }
  .page-head .btn-row { margin-top:14px;max-width:none; }
  .page-head .btn-row .btn { min-height:40px; }
  .topbar { height:auto;min-height:58px;gap:10px;flex-wrap:wrap;padding:12px 16px; }
  .breadcrumb { overflow-wrap:anywhere; }
  .sum-row { gap:12px;flex-wrap:wrap; }
  .sum-row b { min-width:0;overflow-wrap:anywhere; }
  .filters, .calendar-controls, .cal-toolbar, .calendar-nav { flex-wrap:wrap;max-width:100%; }
  .tabs { gap:18px;overflow-x:auto; }
  .card-head { flex-wrap:wrap;gap:12px; }
  .calendar-scroll, .cal-scroll { max-width:100%;min-width:0; }
  .stats .value { font-size:clamp(18px,5vw,25px);overflow-wrap:anywhere; }
}

/* Offer editor: composition on the left, one authoritative summary on the right. */
.estimate-layout { grid-template-columns:minmax(0,1fr); gap:24px; align-items:start; }
.estimate-card { padding:22px; }
.estimate-card .card-head { justify-content:flex-start;gap:12px;margin-bottom:20px; }
.estimate-card .card-head h2 { margin:0; }
.estimate-card .card-head [data-action="deal-add-components"] { margin-left:auto; }
.estimate-settings { display:grid;grid-template-columns:minmax(0,1fr) 250px;gap:20px;align-items:end;padding:0 0 22px;border-bottom:1px solid var(--line);margin-bottom:12px; }
.estimate-template { min-width:0; }
.estimate-template > label { display:block;font-size:12px;color:var(--muted);margin-bottom:8px; }
.estimate-template .filters { display:flex;flex-wrap:nowrap;margin:0;gap:8px; }
.estimate-template select { min-width:0; }
.estimate-settings .form-grid { gap:12px; }
.estimate-settings input, .estimate-settings select { height:40px; }
.estimate-settings .field { margin:0; }
.estimate-layout #calc-lines .calc-head,
.estimate-layout #calc-lines.with-cost .calc-head,
.estimate-layout #calc-lines .calc-line,
.estimate-layout #calc-lines.with-cost .calc-line { grid-template-columns:minmax(180px,1fr) 110px 78px 78px 120px 116px 28px;gap:12px; }
.estimate-layout #calc-lines:not(.with-cost) .calc-head,
.estimate-layout #calc-lines:not(.with-cost) .calc-line { grid-template-columns:minmax(180px,1fr) 110px 78px 78px 120px 28px; }
.estimate-layout #calc-lines .calc-head { font-size:10px;letter-spacing:.035em;padding:10px 0;align-items:center; }
.estimate-layout #calc-lines .calc-head > span:nth-child(2),
.estimate-layout #calc-lines .calc-head > span:nth-child(5),
.estimate-layout #calc-lines .calc-head > span:nth-child(6) { text-align:right; }
.estimate-layout #calc-lines .calc-group { display:flex;align-items:center;justify-content:space-between;gap:16px;background:#f4f6f1;padding:10px 12px;margin-top:14px;border-radius:7px;color:var(--ink);font-size:11px; }
.estimate-layout .calc-group > div { display:flex;gap:10px;align-items:center; }
.estimate-layout .calc-group small { color:var(--muted);font-weight:400;text-transform:none;letter-spacing:0; }
.estimate-layout .calc-group > span { font-weight:600;white-space:nowrap; }
.estimate-layout #calc-lines .calc-line { padding:12px 0;align-items:center; }
.estimate-layout #calc-lines .calc-name { display:block;min-width:0; }
.estimate-layout #calc-lines .calc-name b { font-size:13px;white-space:normal;overflow:visible;line-height:1.45; }
.estimate-layout #calc-lines .calc-name small { display:block;white-space:normal;font-size:11px;line-height:1.5;margin-top:4px; }
.estimate-layout #calc-lines .calc-price { min-width:0; }
.estimate-layout #calc-lines .calc-price,
.estimate-layout #calc-lines .calc-amount,
.estimate-layout #calc-lines .calc-cost { text-align:right; }
.estimate-layout #calc-lines .calc-price span,
.estimate-layout #calc-lines .calc-amount span,
.estimate-layout #calc-lines .calc-cost span { font-size:12px;line-height:1.5;white-space:normal; }
.estimate-layout #calc-lines input { height:36px;padding:6px 9px;font-size:13px; }
/* Затраты строки — поле ввода (только директор): узкое, по правому краю, ручная
   сумма выделена цветом, чтобы её не путали с расчётом по прайсу компонента. */
#calc-lines .calc-cost input { width:100%;text-align:right;padding-right:8px; }
/* Калькулятор в редакторе программы: «гости → итоговая стоимость». */
.price-check { display:flex;flex-wrap:wrap;align-items:center;gap:12px; }
.price-check input { width:110px; }
.price-check-out { font-size:15px;color:var(--ink); }
.price-check-out b { font-size:17px; }
#calc-lines .calc-cost input.is-manual { border-color:#78907f;background:#f2f6ef;font-weight:600; }
.missing-cost { display:inline-block;padding:3px 6px;border-radius:5px;background:#fbf1da;color:#8a621f;font-size:11px;white-space:nowrap; }
.estimate-layout .builder-summary { position:sticky;top:20px; }
.estimate-summary-card { padding:24px; }
.estimate-summary-card h2 { font-size:15px;margin-bottom:22px; }
.estimate-price { padding-bottom:20px; }
.estimate-price > span { display:block;color:var(--muted);font-size:12px; }
.estimate-price > strong { display:block;font-size:30px;letter-spacing:-.03em;line-height:1.3;margin:8px 0;overflow-wrap:anywhere; }
.estimate-price > small { color:var(--muted);font-size:12px; }
.estimate-summary-row { display:flex;justify-content:space-between;align-items:baseline;gap:16px;padding:9px 0;font-size:12px; }
.estimate-summary-row > span { color:#68766e;min-width:0; }
.estimate-summary-row > span small { display:block;font-size:10px;margin-top:4px;color:var(--muted); }
.estimate-summary-row > b { white-space:nowrap;text-align:right;font-weight:600; }
.estimate-economics { padding-top:18px;border-top:1px solid var(--line); }
.estimate-economics h3 { margin:0 0 10px;font-size:12px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted); }
.estimate-profit { border-top:1px solid var(--line);margin-top:10px;padding-top:16px; }
.estimate-profit > span { font-size:12px;display:block;color:var(--muted); }
.estimate-profit > strong { display:block;font-size:20px;margin-top:6px;color:var(--pine); }
.estimate-profit > small { display:block;color:var(--muted);margin-top:5px; }
.estimate-profit.negative > strong { color:var(--danger); }
.estimate-warning { padding:12px;background:#fbf5e6;border:1px solid #eadcb7;border-radius:8px;margin-top:16px;font-size:12px;color:#74551e; }
.estimate-warning p { margin:7px 0;line-height:1.6; }
.estimate-warning details { margin-top:8px; }
.estimate-warning summary { cursor:pointer; }
.estimate-warning ul { padding-left:16px;margin-bottom:0; }
.estimate-warning li { margin-top:7px; }
.estimate-warning .link { text-align:left;font-size:12px;line-height:1.5; }
.estimate-save-note { border-top:1px solid var(--line);padding-top:16px;margin:18px 0 0; }
@media(max-width:1500px) {
  .estimate-layout { grid-template-columns:minmax(0,1fr); }
  .estimate-layout .builder-summary { position:static; }
}
@container (max-width:850px) {
  .estimate-layout #calc-lines .calc-head { display:none; }
  .estimate-layout #calc-lines .calc-line,
  .estimate-layout #calc-lines.with-cost .calc-line,
  .estimate-layout #calc-lines:not(.with-cost) .calc-line { grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 18px;padding:16px 0; }
  .estimate-layout #calc-lines .calc-name { grid-column:1/-1;padding-right:30px; }
  .estimate-layout #calc-lines .calc-price,
  .estimate-layout #calc-lines .calc-amount,
  .estimate-layout #calc-lines .calc-cost { text-align:left; }
  .estimate-layout #calc-lines .calc-line label.tiny { display:block; }
  .estimate-layout #calc-lines .calc-line .remove { position:absolute;top:12px;right:0; }
}
@media(max-width:800px) {
  .estimate-settings { grid-template-columns:minmax(0,1fr);gap:16px; }
  .estimate-card, .estimate-summary-card { padding:18px; }
  .estimate-template .filters .btn { flex-shrink:0; }
}

/* All order totals are part of the composition footer, in the same columns. */
.estimate-layout .estimate-totals { margin-top:24px;border-top:2px solid var(--line);padding-top:16px; }
.estimate-layout .estimate-total-row { display:grid;grid-template-columns:minmax(180px,1fr) 110px 78px 78px 120px 116px 28px;gap:12px;padding:8px 0;font-size:13px;align-items:baseline; }
.estimate-layout .estimate-totals:not(.with-cost) .estimate-total-row { grid-template-columns:minmax(180px,1fr) 110px 78px 78px 120px 28px; }
.estimate-total-row .total-label { grid-column:1/5;min-width:0;color:#68766e; }
.estimate-total-row .total-client { grid-column:5;text-align:right;white-space:nowrap; }
.estimate-total-row .total-expense { grid-column:6;text-align:right; }
.estimate-total-row h3 { margin:0;font-size:14px;color:var(--ink); }
.estimate-total-row.totals-heading { margin-bottom:8px;font-size:11px;color:var(--muted); }
.estimate-total-row.grand-total { border-top:1px solid var(--line);margin-top:8px;padding-top:16px;font-size:17px; }
.estimate-total-row.grand-total .total-label { color:var(--ink);font-weight:600; }
.estimate-total-row.profit-total .total-expense { color:var(--pine); }
.estimate-total-row.profit-total.negative .total-expense { color:var(--danger); }
@container(max-width:850px) {
  .estimate-layout .estimate-total-row,
  .estimate-layout .estimate-totals:not(.with-cost) .estimate-total-row { grid-template-columns:minmax(0,1fr) auto;gap:8px 16px;padding:10px 0; }
  .estimate-total-row .total-label { grid-column:1; }
  .estimate-total-row .total-client { grid-column:2; }
  .estimate-total-row .total-expense { grid-column:2; }
  .estimate-total-row .total-client:empty { display:none; }
  .estimate-totals.with-cost .estimate-total-row .total-client:not(:empty) + .total-expense { grid-column:2;grid-row:auto;font-size:12px;color:var(--muted); }
  .estimate-totals.with-cost .estimate-total-row .total-client:not(:empty) + .total-expense::before { content:"Затраты: ";font-weight:400; }
  .estimate-layout .estimate-total-row.totals-heading .total-client,
  .estimate-layout .estimate-total-row.totals-heading .total-expense { display:none; }
}

@container(max-width:850px) {
  .estimate-layout .estimate-totals.with-cost .estimate-total-row.totals-heading > .total-client,
  .estimate-layout .estimate-totals.with-cost .estimate-total-row.totals-heading > .total-expense { display:none; }
  .estimate-layout .estimate-totals .totals-heading .total-expense::before { content:none; }
}

.operating-cost-picker { margin-top:24px;padding-top:20px;border-top:1px solid var(--line); }
.operating-cost-picker h3 { font-size:14px;margin:0 0 8px; }
#operating-cost-checks { display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:10px;margin-top:14px; }
.operating-cost-choice { display:flex;align-items:flex-start;gap:10px;padding:12px;border:1px solid var(--line);border-radius:8px;cursor:pointer; }
.operating-cost-choice:has(input:checked) { background:#f1f6ef;border-color:#8ba78c; }
.operating-cost-choice input { width:auto;flex:0 0 auto;margin-top:3px; }
.operating-cost-choice span { min-width:0; }
.operating-cost-choice b { font-size:12px;display:block; }
.operating-cost-choice small { font-size:11px;display:block;color:var(--muted);margin-top:5px;line-height:1.5; }

.operating-cost-choice{flex-wrap:wrap}.operating-cost-choice>label{display:flex;align-items:center;gap:10px;flex:1;min-width:160px}.operating-cost-choice>input[type="number"]{width:130px;margin-left:auto}

/* «Входит в стоимость программы»: галочка в колонке «Клиенту» и пометка вместо суммы. */
.calc-amount .included-toggle{display:flex;gap:4px;align-items:flex-start;font-size:10px;line-height:1.25;color:#607d8b;margin-top:4px;cursor:pointer;white-space:normal}
.calc-amount .included-toggle input{margin:0;flex:none}
.calc-amount span.is-included{color:#607d8b;font-style:italic}

/* Номер строки в справочных таблицах: узкая колонка, ровные цифры. */
th.row-num, td.row-num{width:44px;min-width:44px;text-align:right;color:var(--muted);font-variant-numeric:tabular-nums;font-weight:400}

/* Длинные значения (например, «должность» из анкеты на 1000 символов) не
   должны растягивать окно: поля сжимаются, подпись обрезается многоточием. */
dialog:not(.cal-modal) { overflow-x: hidden; }
dialog form, dialog .field, dialog .form-grid > * { min-width: 0; }
dialog input, dialog select, dialog textarea { max-width: 100%; box-sizing: border-box; }
dialog select { text-overflow: ellipsis; }

/* Выбор сотрудников для труппы: одна колонка, ровные строки, длинная
   должность обрезается — список читается и на узком экране. */
.staff-list{display:flex;flex-direction:column;gap:6px;max-height:44vh;overflow:auto;margin-top:4px;padding-right:4px}
.staff-pick{display:flex;align-items:center;gap:10px;margin:0;padding:8px 10px;border:1px solid var(--line);border-radius:9px;background:#fff;font-size:12px;cursor:pointer}
.staff-pick:hover{border-color:#8ba78c}
.staff-pick input{flex:0 0 auto;width:auto;margin:0}
.staff-pick-main{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1}
.staff-pick-main b{font-size:12px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.staff-pick-main small{font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.staff-pick-phone{flex:0 0 auto;font-size:11px;color:var(--muted);white-space:nowrap}

