.ci-dialog {
  width: min(960px, calc(100% - 32px));
  max-width: none;
  max-height: 90vh;
  color: var(--ink);
}

.ci-dialog[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ci-header,
.ci-body,
.ci-footer {
  padding: 16px 22px;
}

.ci-header,
.ci-footer {
  flex: none;
}

.ci-header {
  border-bottom: 1px solid var(--line);
}

.ci-footer {
  border-top: 1px solid var(--line);
}

.ci-footer .d-acts {
  flex-wrap: wrap;
  margin: 0;
}

.ci-footer p:empty {
  margin: 0;
}

.ci-footer p:not(:empty) {
  margin: 0 0 10px;
}

.ci-body {
  min-height: 0;
  overflow: auto;
  overflow-wrap: anywhere;
  overscroll-behavior: contain;
}

.ci-drop {
  width: 100%;
  min-height: 120px;
  padding: 16px;
  border: 1px dashed var(--line2);
  border-radius: 8px;
  font-weight: 600;
}

.ci-drop:hover,
.ci-drop.ci-dragover {
  border-color: var(--acc);
  background: var(--side);
}

.ci-dialog #ci-hint {
  margin-top: 8px;
}

.ci-file-line,
.ci-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.ci-file-line b {
  min-width: 0;
}

.ci-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.ci-section h4,
.ci-summary {
  margin-bottom: 10px;
}

.ci-fields,
.ci-tariff {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
}

.ci-dialog label {
  margin: 0;
}

.ci-fields select {
  margin-top: 4px;
}

.ci-dialog .ci-tariff {
  display: grid;
  align-items: center;
}

.ci-tariff + .ci-tariff {
  margin-top: 8px;
}

.ci-dialog .sw {
  display: inline-flex;
  position: relative;
  align-items: center;
  gap: 8px;
}

.ci-dialog .sw input {
  width: 1px;
  height: 1px;
}

.ci-dialog .knob {
  margin: 0;
}

.ci-table-scroll {
  max-height: 42vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ci-table.tbl {
  table-layout: fixed;
  border: 0;
  border-radius: 0;
  overflow: visible;
}

.ci-table th:first-child {
  width: 9%;
}

.ci-table th:last-child {
  width: 27%;
}

.ci-table th {
  position: sticky;
  top: 0;
}

.ci-table td {
  padding-block: 6px;
  vertical-align: top;
}

.ci-create {
  display: flex;
  align-items: flex-start;
  gap: 5px;
}

.ci-check {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ok);
  color: #fff;
  font: 700 11px/16px system-ui, sans-serif;
  text-align: center;
}

.ci-skips {
  margin: 6px 0 0 20px;
}

.ci-skips li {
  padding: 6px 0;
}

.ci-skips li + li {
  border-top: 1px solid var(--line);
}

@media (max-width: 560px) {
  .ci-header,
  .ci-body,
  .ci-footer {
    padding: 12px;
  }

  .ci-fields,
  .ci-tariff {
    grid-template-columns: minmax(0, 1fr);
  }

  .ci-tariff {
    gap: 4px;
  }

  .ci-table th,
  .ci-table td {
    padding-inline: 3px;
    font-size: 12px;
  }

  .ci-table th:first-child {
    width: 13%;
  }

  .ci-create {
    flex-wrap: wrap;
    gap: 2px 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ci-dialog .knob,
  .ci-dialog .knob::after {
    transition: none;
  }
}

/* Правки Claude: телефон і дати не переносяться, номер рядка вузький. */
.ci-table th:first-child { width: 64px; }
.ci-table th:nth-child(3) { width: 156px; }
.ci-table th:nth-child(5) { width: 128px; }
.ci-table td:nth-child(1), .ci-table td:nth-child(3), .ci-table td:nth-child(5) { white-space: nowrap; font-variant-numeric: tabular-nums; }
