/* Фирменная палитра «Промизоляция» по бренд-гайду. */
:root {
  --ink: #000000;
  --muted: #5d6673;
  --green: #437cd3;
  --green-dark: #2e63b3;
  --mint: #eaf2fb;
  --line: #cfd6e2;
  --paper: #f3f1f0;
  --white: #ffffff;
  --shadow: 0 16px 45px rgba(24, 55, 99, 0.13);
}

h1 {
  font-size: clamp(1.19rem, 2.38vw, 1.96rem);
}

h2 {
  font-size: .91rem;
}

body,
.auth-panel {
  background: var(--paper);
}

.topbar,
.sidebar,
.panel,
.stat,
.category-card,
.template-card,
.table-wrap,
.search-panel,
.health-card,
.empty-state,
.auth-card {
  background: var(--white);
}

.secure-label i,
.health-dot.ok {
  background: #437cd3;
}

.health-dot.ok {
  box-shadow: 0 0 0 5px #eaf2fb;
}

.sidebar > a {
  color: #343b46;
  font-size: .86rem;
  white-space: nowrap;
}

.nav-caption {
  color: #717b89;
}

.button.primary {
  box-shadow: 0 8px 20px rgba(67, 124, 211, 0.25);
}

.button.secondary:hover {
  border-color: #7cb3e1;
}

.category-card:hover {
  border-color: #7cb3e1;
  box-shadow: var(--shadow);
}

.document-glyph {
  border-color: #9eacc1;
}

.document-glyph span {
  background: #9eacc1;
}

th,
td,
.detail-list div {
  border-bottom-color: #e3e7ed;
}

th {
  color: #606a78;
  background: #f7f9fc;
}

tbody tr:hover {
  background: #f5f8fd;
}

.badge.success,
.badge.info {
  background: #eaf2fb;
  color: #285ca9;
}

.badge.neutral,
.badge {
  background: #eef1f5;
  color: #515b68;
}

label,
.form-stack label,
.form-grid label {
  color: #252a31;
}

input,
select,
textarea {
  border-color: #bcc6d4;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #437cd3;
  box-shadow: 0 0 0 3px rgba(67, 124, 211, 0.16);
}

.message,
.notice {
  background: #eaf2fb;
  color: #234f91;
  border-color: #bed3f2;
}

.success-panel {
  border-color: #bed3f2;
  background: #f4f8fe;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.workflow span,
.badge.neutral {
  background: #eef1f5;
}

.example.good {
  background: #eaf2fb;
}

.empty-state {
  border-color: #b9c4d3;
}

.placeholder-summary-actions {
  margin-left: auto;
}

.placeholder-summary-actions small {
  white-space: nowrap;
}

.copy-placeholder {
  min-height: 36px;
  padding: 7px 12px;
  white-space: nowrap;
}

.placeholder-tab-manager {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 18px;
}
.placeholder-tab-manager label {
  min-width: min(360px, 100%);
  margin: 0;
}
.placeholder-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.placeholder-tabs small {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  min-height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.placeholder-ajax-status {
  min-height: 22px;
  color: var(--muted);
}
.placeholder-ajax-status.error { color: var(--danger); }
.placeholder-card-actions { padding: 0 22px 22px; }
.composite-schema-builder {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}
.composite-schema-columns { display: grid; gap: 12px; margin-top: 14px; }
.composite-schema-column {
  display: grid;
  grid-template-columns: minmax(130px, .8fr) minmax(180px, 1.4fr) minmax(180px, 1fr);
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-muted);
}
.composite-schema-column .composite-required,
.composite-schema-column .composite-options,
.composite-schema-column [data-composite-column-remove] { grid-column: 1 / -1; }
.composite-schema-column .composite-required { display: flex; align-items: center; gap: 8px; }
@media (max-width: 900px) { .composite-schema-column { grid-template-columns: 1fr; } }

.composite-value-field {
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
  min-width: 0;
}
.composite-value-rows { display: grid; gap: 12px; }
.composite-value-row {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--white) 88%, var(--paper));
}
.composite-value-row-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(180px,1fr));
  gap: 10px;
}
.composite-value-row-fields label { display: grid; gap: 6px; min-width: 0; }
.composite-value-row-fields .wide { grid-column: 1 / -1; }
.composite-value-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.composite-nomenclature { position: relative; }
.composite-nomenclature-results {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  box-shadow: var(--shadow);
}
.composite-nomenclature-results button,
.composite-nomenclature-results span { display: block; width: 100%; padding: 9px 10px; text-align: left; }
.composite-nomenclature-results button { border: 0; border-radius: 7px; background: transparent; cursor: pointer; }
.composite-nomenclature-results button:hover { background: var(--mint); }
.composite-radio-group { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 42px; }
.composite-radio-option { display: inline-flex !important; grid-template-columns: none !important; align-items: center; gap: 6px !important; }

.field-grid label > .field-label-text {
  display: inline-flex;
  flex-direction: row;
  align-items: baseline;
  gap: 3px;
  color: var(--ink);
}

.field-grid .field-label-text > .required-mark {
  color: var(--danger);
}

/* Mobile Safari gives date controls an intrinsic width that can exceed a grid track. */
.contract-form,
.contract-form .form-section,
.contract-form .section-copy,
.contract-form .field-grid,
.contract-form .field-grid > label,
.wizard-form,
.wizard-form .wizard-step,
.wizard-form .wizard-card,
.wizard-form .wizard-field-grid,
.wizard-form .wizard-field-grid > label {
  min-width: 0;
  max-width: 100%;
}

.contract-form input,
.contract-form select,
.contract-form textarea,
.wizard-form input,
.wizard-form select,
.wizard-form textarea {
  min-width: 0;
  max-width: 100%;
}

.contract-form input[type="date"],
.wizard-form input[type="date"] {
  display: block;
  width: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
  -webkit-appearance: none;
  appearance: none;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: -12px 0 24px;
  border-bottom: 1px solid var(--line);
}

.tabs a {
  padding: 12px 16px;
  color: var(--muted);
  font-weight: 750;
  border-bottom: 3px solid transparent;
}

.tabs a.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

.related-document-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.related-document-card h2 {
  margin: 14px 0 8px;
}

.related-document-card p {
  color: var(--muted);
}

.document-card {
  width: 100%;
  max-width: none;
}

.template-card-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.template-card-actions .button {
  min-height: 37px;
  padding: 9px 15px;
  font-size: .85rem;
}

.document-head-actions {
  justify-content: flex-end;
}

.document-download-actions {
  width: 100%;
  flex-wrap: nowrap;
}

.document-edit-action {
  margin-left: auto;
}

.backup-action-form {
  max-width: 720px;
}

.danger-zone {
  border-color: rgba(166, 44, 25, 0.35);
}

.share-dialog {
  max-width: 650px;
}

.link-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.revision-list {
  color: var(--muted);
}

.revision-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
}

.revision-list form {
  flex: 0 0 auto;
}

.registry-panel {
  padding: 0;
  overflow: hidden;
}

.registry-table input[type="number"] {
  width: 180px;
  margin: 0;
}

.registry-table em {
  display: block;
  margin-top: 6px;
  color: var(--danger);
  font-style: normal;
}

.registry-actions {
  display: flex;
  justify-content: flex-end;
  padding: 18px 22px;
  border-top: 1px solid var(--line);
}

.registry-related {
  margin-top: 22px;
}

.registry-documents {
  margin-top: 22px;
  padding: 0;
  overflow: hidden;
}

.registry-documents-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 22px;
}

.registry-documents-head p {
  margin-bottom: 0;
  color: var(--muted);
}

.registry-template-filter {
  flex: 0 1 420px;
}

.registry-documents-tools {
  display: flex;
  flex: 0 1 520px;
  align-items: end;
  justify-content: flex-end;
  gap: 12px;
}

.registry-export-button {
  flex: 0 0 auto;
}

.registry-template-filter label {
  display: block;
  margin-bottom: 7px;
  font-size: .75rem;
  font-weight: 800;
}

.registry-template-filter select {
  margin: 0;
}

.registry-contracts-table {
  overflow: visible;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.registry-contracts-table table {
  width: 100%;
  table-layout: fixed;
}

.registry-contracts-table small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.registry-expand-col { width: 54px; }
.registry-number-col { width: 90px; }
.registry-legal-entity-col { width: 18%; }
.registry-owner-col { width: 16%; }
.registry-created-col { width: 145px; }

.registry-documents > .pagination {
  padding: 18px 22px;
  border-top: 1px solid var(--line);
}

.registry-related > p {
  color: var(--muted);
}

.registry-related-groups {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.registry-related-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f7f9fc;
}

.registry-related-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--mint);
}

.registry-related-heading small {
  color: var(--muted);
}

.registry-related-group .registry-related-list {
  margin-top: 0;
  padding: 12px;
}

.registry-related-unassigned .registry-related-heading {
  background: #fff4dc;
}

.registry-related-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.registry-related-list > span {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.registry-related-list small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.template-title-link {
  color: var(--ink);
  font-weight: 800;
}

.template-title-link:hover {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.form-stack em {
  color: var(--danger);
  font-style: normal;
}

div[id$="_parent_templates"] {
  display: grid;
  gap: 8px;
}

div[id$="_parent_templates"] > div > label {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

input.template-parent-choices[type="checkbox"] {
  order: 2;
  flex: 0 0 19px;
  width: 19px;
  height: 19px;
  margin: 0 0 0 auto;
}

.filters-panel {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.filters-panel label {
  min-width: min(360px, 100%);
}

.users-panel {
  width: 100%;
}

.users-panel .row-actions form {
  display: inline-flex;
  margin: 0;
}

.settings-policy-form .policy-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.settings-policy-form .policy-checkbox-field label {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.settings-policy-form .policy-checkbox-field input[type="checkbox"] {
  flex: 0 0 19px;
  width: 19px;
  height: 19px;
  margin: 0;
}

.settings-policy-form .helptext {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 500;
}

.shares-table {
  overflow: visible;
}

.shares-table table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.shares-table th:nth-child(2) { width: 21%; }
.shares-table th:nth-child(3) { width: 14%; }
.shares-table th:nth-child(4) { width: 13%; }
.shares-table th:nth-child(5) { width: 7%; }
.shares-table th:nth-child(6),
.shares-table th:nth-child(7) { width: 7%; }
.shares-table th:nth-child(8) { width: 10%; }
.shares-table th:nth-child(9) { width: 21%; }

.shares-table th,
.shares-table td {
  overflow-wrap: anywhere;
  padding-left: 10px;
  padding-right: 10px;
}

.share-contract-title {
  font-size: .85em;
  line-height: 1.3;
}

.shares-table .row-actions {
  gap: 6px;
}

.shares-table .row-actions form {
  display: inline-flex;
  margin: 0;
}

.public-document-page {
  min-height: 100vh;
  background: #eef2f8;
}

.public-document-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.public-document-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.public-document-head h1 {
  margin-bottom: 8px;
}

.public-document-head .download-row {
  flex: 0 0 auto;
  margin-top: 0;
}

.public-preview-panel {
  height: calc(100vh - 220px);
  min-height: 560px;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.public-preview-panel iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.public-no-preview {
  margin-top: 18px;
  text-align: center;
}

.public-download-count {
  margin: 12px 4px 0;
  color: var(--muted);
  font-size: .8rem;
}

.user-contract-count {
  margin-bottom: 18px;
}

.form-stack .current-date-default-row,
.form-grid .current-date-default-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  gap: 8px 10px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--mint);
}

.current-date-default-row label {
  grid-column: 2;
  grid-row: 1;
  display: block;
}

.current-date-default-row input[type="checkbox"] {
  grid-column: 1;
  grid-row: 1;
  width: 19px;
  height: 19px;
  margin: 2px 0 0;
}

.current-date-default-row .helptext,
.current-date-default-row .errorlist {
  grid-column: 2;
}

.tree-title {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 220px;
}

.tree-title > span:last-child {
  min-width: 0;
}

.tree-toggle,
.tree-toggle-placeholder,
.tree-branch {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
}

.tree-toggle {
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--green);
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
}

.tree-toggle:hover,
.tree-toggle[aria-expanded="true"] {
  border-color: var(--green);
  background: var(--mint);
}

.tree-title-child {
  padding-left: 14px;
}

.tree-branch {
  display: inline-grid;
  place-items: center;
  color: var(--green);
  font-size: 1.15rem;
}

.tree-child-row {
  background: #f7f9fc;
}

.tree-child-row td:first-child {
  border-left: 4px solid var(--green);
}

.button.compact {
  min-height: 32px;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: .7rem;
  white-space: nowrap;
}

.contracts-table {
  overflow-x: hidden;
  overflow-y: visible;
}

.contracts-table table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.contract-col-title { width: 24%; }
.contract-col-template { width: 15%; }
.contract-col-number { width: 8%; }
.contract-col-created { width: 10%; }
.contract-col-status { width: 14%; }
.contract-col-actions { width: 29%; }

.archive-contracts-table th,
.archive-contracts-table td,
.admin-contracts-archive-table th,
.admin-contracts-archive-table td {
  padding-inline: 8px;
  overflow-wrap: anywhere;
}

.archive-contracts-table .contract-col-title { width: 16%; }
.archive-contracts-table .contract-col-template { width: 10%; }
.archive-contracts-table .contract-col-number { width: 6%; }
.archive-contracts-table .contract-col-document-date { width: 8%; }
.archive-contracts-table .contract-col-parent { width: 14%; }
.archive-contracts-table .contract-col-created { width: 9%; }
.archive-contracts-table .contract-col-archived { width: 9%; }
.archive-contracts-table .contract-col-status { width: 9%; }
.archive-contracts-table .contract-col-actions { width: 19%; }
.archive-contracts-table .contract-row-actions { grid-template-columns: minmax(0, 1fr); }
.archive-contracts-table .contract-row-actions .button { min-width: 0; white-space: normal; }

.admin-contracts-table { overflow-x: hidden; }
.admin-contracts-table table { min-width: 0; }
.restore-conflict-dialog { max-width: 620px; }
.restore-conflict-dialog p:not(.eyebrow) { color: var(--ink); line-height: 1.55; }

.contracts-table td .badge {
  max-width: 100%;
  justify-content: center;
  justify-self: start;
  text-align: center;
  line-height: 1.25;
  white-space: normal;
}

.contract-title-link {
  color: var(--ink);
  font-weight: 700;
  line-height: 1.3;
}

.contract-title-link:hover {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.contract-legal-entity-name {
  font-size: .8em;
}

.template-versions-table table {
  min-width: 0;
  table-layout: fixed;
}

.template-version-upload-panel {
  display: grid;
  grid-template-columns: minmax(210px, .42fr) minmax(0, 1.58fr);
  gap: 28px;
  align-items: start;
}
.template-version-upload-copy h3,
.template-version-history-head h3 { margin-bottom: 5px; }
.template-version-upload-copy p,
.template-version-history-head p,
.template-version-upload-actions > span {
  margin: 0;
  color: var(--muted);
  font-size: .8rem;
}
.template-version-upload-form { min-width: 0; }
.template-status-form {
  display: grid;
  gap: 10px;
  width: min(100%, 320px);
  min-width: 0;
  margin: 0;
}
.template-status-form select,
.template-status-form .button {
  width: 100%;
  min-width: 0;
}
.template-version-upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, .85fr);
  gap: 16px;
  align-items: start;
}
.template-version-upload-grid label > span:first-child { font-weight: 750; }
.template-version-upload-grid small { color: var(--muted); font-size: .74rem; font-weight: 500; line-height: 1.4; }
.template-version-file-field,
.template-version-party-field { min-width: 0; }
.template-version-file-field input[type="file"] { min-height: 48px; padding: 8px; }
.template-version-file-field input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--mint);
  color: var(--green-dark);
  font-weight: 750;
  cursor: pointer;
}
.template-version-upload-grid .template-auto-markup { grid-column: 1 / -1; margin: 0; align-items: center; }
.template-version-upload-grid .template-auto-markup > span { display: flex; flex-direction: column; gap: 2px; }
.template-version-upload-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
}
.template-version-history-panel { margin-top: 18px; min-width: 0; }
.template-version-history-head { margin-bottom: 12px; }
.template-versions-table { width: 100%; overflow: visible; border: 1px solid var(--line); border-radius: 14px; }
.template-versions-table th,
.template-versions-table td { padding: 13px 12px; }
.template-versions-table .version-col-number { width: 7%; }
.template-versions-table .version-col-file { width: 20%; }
.template-versions-table .version-col-purpose { width: 12%; }
.template-versions-table .version-col-created { width: 11%; }
.template-versions-table .version-col-test { width: 10%; }
.template-versions-table .version-col-current { width: 8%; }
.template-versions-table .version-col-actions { width: auto; }
.template-version-file-name strong { overflow-wrap: anywhere; line-height: 1.35; }
.template-version-actions { gap: 8px 12px; align-items: flex-start; }
.template-version-actions form { display: inline-flex; margin: 0; }

.contract-row-actions {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  justify-content: start;
  align-items: center;
  gap: 6px;
}

.contract-row-actions form {
  display: inline-flex;
  margin: 0;
}

.contract-search-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.search-primary-row,
.search-date-row {
  display: grid;
  gap: 12px;
  align-items: end;
}

.search-primary-row {
  grid-template-columns: minmax(280px, 1fr) repeat(3, minmax(165px, .34fr));
}

.objectwork-search-primary-row {
  grid-template-columns: minmax(280px, 1fr) repeat(4, minmax(150px, .34fr));
}

.objectworks-table {
  overflow-x: hidden;
}

.objectworks-table table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.objectworks-table th,
.objectworks-table td {
  padding-left: 9px;
  padding-right: 9px;
  overflow-wrap: anywhere;
}

.objectworks-table th:first-child,
.objectworks-table td:first-child { width: 42px; }
.objectworks-table th:nth-child(2) { width: 20%; }
.objectworks-table th:nth-child(3) { width: 14%; }
.objectworks-table th:nth-child(4) { width: 14%; }
.objectworks-table th:nth-child(5) { width: 11%; }
.objectworks-table th:nth-child(6) { width: 10%; }
.objectworks-table th:nth-child(7) { width: 10%; }
.objectworks-table th:nth-child(8) { width: 10%; }
.objectworks-table th:nth-child(9) { width: 150px; }

.objectworks-table .contract-row-actions {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

.objectworks-table .contract-row-actions .button {
  width: 100%;
  min-width: 0;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
}

.objectwork-template-format {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.objectwork-template-format .badge {
  flex: 0 0 auto;
}

.objectwork-valid-until input:required:invalid {
  border-color: #dc5c4f;
  background: #fff8f7;
}

.objectwork-valid-until em {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.search-date-row {
  grid-template-columns: minmax(180px, 260px) minmax(180px, 260px) auto auto 1fr;
}

.search-date-row label {
  gap: 5px;
}

.search-date-row label > span {
  color: var(--muted);
  font-size: .74rem;
}

@media (max-width: 1200px) {
  .objectwork-search-primary-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .objectwork-search-primary-row .search-input-wrap {
    grid-column: 1 / -1;
  }
}

.search-input-wrap {
  position: relative;
}

.search-input-wrap input {
  padding-right: 44px;
}

.search-clear {
  position: absolute;
  top: 50%;
  right: 10px;
  width: 30px;
  height: 30px;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
}

.search-clear:hover {
  background: var(--mint);
  color: var(--green);
}

@media (max-width: 520px) {
  .contract-form .form-section,
  .contract-form .field-grid,
  .wizard-form .wizard-field-grid {
    width: 100%;
  }

  .placeholder-summary-actions {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 800px) {
  .template-version-upload-panel,
  .template-version-upload-grid { grid-template-columns: 1fr; }
  .template-version-upload-grid .template-auto-markup { grid-column: auto; }
  .template-version-upload-actions { align-items: stretch; flex-direction: column; }
  .template-version-upload-actions .button { width: 100%; }
  .template-version-history-panel { padding: 18px; }
  .template-versions-table { border: 0; border-radius: 0; }
  .template-versions-table table,
  .template-versions-table tbody,
  .template-versions-table tr,
  .template-versions-table td { display: block; min-width: 0; width: 100%; }
  .template-versions-table thead { display: none; }
  .template-versions-table tr {
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
  }
  .template-versions-table tr:last-child { margin-bottom: 0; }
  .template-versions-table td {
    display: grid;
    grid-template-columns: minmax(112px, 34%) minmax(0, 1fr);
    gap: 10px;
    padding: 9px 2px;
    border-bottom: 1px solid #e8ecf2;
  }
  .template-versions-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .69rem;
    font-weight: 800;
    text-transform: uppercase;
  }
  .template-versions-table td:last-child { display: block; border-bottom: 0; padding-top: 13px; }
  .template-versions-table td:last-child::before { display: none; }
  .template-version-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .template-version-actions > a,
  .template-version-actions form,
  .template-version-actions .text-button { width: 100%; }
  .template-version-actions > a,
  .template-version-actions .text-button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    text-align: center;
  }
  .client-autofill-layout { grid-template-columns: 1fr; }
  .partner-card-drop { min-height: 190px; }
  .public-document-shell { padding: 12px; }
  .public-document-head { align-items: flex-start; flex-direction: column; padding: 20px; }
  .public-preview-panel { height: 70vh; min-height: 460px; }
  .registry-related-list {
    grid-template-columns: 1fr;
  }
  .related-document-grid {
    grid-template-columns: 1fr;
  }

  .contracts-table {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .contracts-table table,
  .contracts-table tbody,
  .contracts-table tr,
  .contracts-table td {
    display: block;
    min-width: 0;
    width: 100%;
  }

  .contracts-table thead {
    display: none;
  }

  .contracts-table tr {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    margin-bottom: 14px;
    padding: 14px;
  }

  .contracts-table .tree-child-row {
    margin-left: 18px;
    width: calc(100% - 18px);
    background: #f7f9fc;
  }

  .contracts-table td {
    display: grid;
    grid-template-columns: minmax(100px, 34%) 1fr;
    gap: 10px;
    padding: 9px 4px;
    border-bottom: 1px solid #e8ecf2;
  }

  .contracts-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
  }

  .contracts-table td:last-child {
    display: block;
    border-bottom: 0;
    padding-top: 14px;
  }

  .contracts-table td:last-child::before {
    display: none;
  }

  .contract-row-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contract-row-actions .button,
  .contract-row-actions form,
  .contract-row-actions form .button {
    width: 100%;
  }

  .search-primary-row,
  .search-date-row {
    grid-template-columns: 1fr;
  }

  .objectwork-search-primary-row .search-input-wrap { grid-column: auto; }

  .objectworks-table table { min-width: 0; }
  .objectworks-table .manufacturer-detail-row { padding: 0; border: 0; background: transparent; }
  .objectworks-table .manufacturer-detail-row > td { display: block; padding: 0; border: 0; }
  .objectworks-table .manufacturer-detail-row > td::before { display: none; }

  .document-download-actions {
    flex-wrap: wrap;
  }

  .document-edit-action {
    margin-left: 0;
  }

  .document-head-actions {
    justify-content: flex-start;
  }
}

.auth-page {
  background: #000000;
}

.auth-intro {
  background:
    radial-gradient(circle at 12% 88%, rgba(124, 179, 225, 0.32), transparent 36%),
    linear-gradient(140deg, #000000 0%, #172d4e 62%, #437cd3 145%);
}

.brand-light .brand-mark {
  background: #ffffff;
  color: #437cd3;
}

.brand-light small,
.auth-trust {
  color: #cfd6e2;
}

.auth-copy .eyebrow {
  color: #7cb3e1;
}

.auth-copy > p:last-child {
  color: #dce5f2;
}

.auth-trust span::before {
  color: #7cb3e1;
}

.auth-center {
  background:
    radial-gradient(circle at 50% 0, rgba(67, 124, 211, 0.42), transparent 38%),
    #000000;
}

.client-search-panel {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(140px, .5fr) minmax(160px, .6fr) minmax(170px, .65fr) minmax(145px, .5fr) auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
  padding: 14px;
}

.dadata-lookup {
  margin: 18px 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f5f9ff;
}
.client-autofill-layout {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(190px, 1fr);
  gap: 16px;
  align-items: stretch;
  margin: 18px 0;
}
.client-autofill-layout .dadata-lookup { height: 100%; margin: 0; }
.contract-party-selector { display: block; width: 100%; margin: 18px 0; }
.contract-party-selector label { width: 100%; }
.contract-party-selector em { display: block; margin-top: 6px; color: var(--danger); font-style: normal; font-size: .78rem; }
.contract-party-selector.is-loading { opacity: .72; transition: opacity .15s ease; }
.contract-party-selector.is-loading select { cursor: progress; }
.contract-party-switch-error { margin: -8px 0 18px; }

.company-email-choice { margin-top: 18px; }
.company-email-input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: stretch; }
.company-email-input-row .button { white-space: nowrap; }
.company-email-account-note { display: block; margin-top: 8px; color: var(--muted); }
.compact-dialog { width: min(520px, calc(100vw - 32px)); border: 0; border-radius: 18px; padding: 24px; }
.compact-dialog::backdrop { background: rgba(0, 0, 0, .5); }
.dialog-head, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-actions { justify-content: flex-end; margin-top: 20px; }
.template-fields-spoiler > summary { display: flex; justify-content: space-between; gap: 16px; align-items: center; cursor: pointer; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.template-fields-spoiler[open] > summary { margin-bottom: 18px; }
.personal-placeholder-system { padding: 18px 20px; }
.personal-source-picker { margin: 20px 0; padding: 18px; }
.personal-source-picker label { display: grid; gap: 8px; }

@media (max-width: 720px) {
  .client-autofill-layout { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; }
  .client-autofill-layout > *, .client-autofill-layout .dadata-lookup, .client-autofill-layout .partner-card-upload { min-width: 0; width: 100%; }
  .company-email-input-row { grid-template-columns: minmax(0, 1fr); }
  .company-email-input-row .button { width: 100%; white-space: normal; }
}
.partner-card-upload { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.partner-card-drop {
  width: 100%;
  min-height: 100%;
  padding: 20px 14px;
  border: 2px dashed #a9c1e4;
  border-radius: 18px;
  background: #f5f9ff;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-align: center;
}
.partner-card-drop:hover,.partner-card-drop.dragover { border-color: #437cd3; background: #eaf2fd; }
.partner-card-plus { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: #437cd3; color: #fff; font-size: 2rem; line-height: 1; }
.partner-card-drop small { color: var(--muted); font-size: .73rem; font-weight: 500; }
.partner-card-progress { color: var(--muted); font-size: .78rem; }
.partner-card-upload .message { margin: 0; font-size: .78rem; }
.company-email-choice {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 2px solid var(--line);
}
.company-email-choice label { max-width: 720px; }
.field-label-text { display: inline-flex; flex-direction: row; align-items: baseline; gap: 3px; }
.field-label-text .required-mark { color: var(--danger); }
.placeholder-editor-form p:has(> input[type="checkbox"]) {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  gap: 8px 10px;
}
.placeholder-editor-form p:has(> input[type="checkbox"]) > label { grid-column: 2; grid-row: 1; display: block; }
.placeholder-editor-form p:has(> input[type="checkbox"]) > input[type="checkbox"] { grid-column: 1; grid-row: 1; width: 19px; height: 19px; margin: 2px 0 0; }
.placeholder-editor-form p:has(> input[type="checkbox"]) > .helptext,
.placeholder-editor-form p:has(> input[type="checkbox"]) > .errorlist { grid-column: 2; }
.template-field-form p:has(> input[type="checkbox"]) {
  display:grid; grid-template-columns:22px minmax(0,1fr); align-items:start; gap:8px 10px;
}
.template-field-form p:has(> input[type="checkbox"])>label { grid-column:2; grid-row:1; display:block; }
.template-field-form p:has(> input[type="checkbox"])>input[type="checkbox"] { grid-column:1; grid-row:1; width:19px; height:19px; margin:2px 0 0; }
.template-field-form p:has(> input[type="checkbox"])>.helptext,
.template-field-form p:has(> input[type="checkbox"])>.errorlist { grid-column:2; }
.field-settings-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:18px 20px;
}
.settings-control { min-width:0; }
.settings-control>label:not(.check) { display:block; margin-bottom:7px; font-weight:700; }
.settings-control input:not([type="checkbox"]),
.settings-control select,
.settings-control textarea { width:100%; }
.settings-control .check { margin-top:7px; }
.settings-control .helptext,
.settings-master-control .helptext { display:block; margin-top:7px; color:var(--muted); font-size:.78rem; line-height:1.45; }
.field-settings-card {
  min-width:0;
  margin:4px 0;
  padding:18px 20px 20px;
  border:1px solid #bfd0e7;
  border-radius:16px;
  background:#f3f7fc;
}
.field-settings-card legend { padding:0 7px; font-weight:800; color:var(--ink); }
.settings-master-control>.check { font-weight:800; }
.settings-dependent-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin-top:17px; }
.settings-subordinate-controls { display:grid; gap:11px; margin:14px 0 0 29px; padding-left:15px; border-left:2px solid #b6c9e3; }
.subordinate-check { font-size:.86rem; font-weight:650; color:#405067; }
.field-validation-grid { margin-top:4px; }
.personal-source-settings-card { background:#f5f9ff; }
@media (max-width:720px) {
  .field-settings-grid,.settings-dependent-grid { grid-template-columns:minmax(0,1fr); }
  .field-settings-card { padding:15px 14px 17px; }
  .settings-subordinate-controls { margin-left:10px; }
}
.dadata-lookup-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.dadata-lookup-heading h3 { margin:0 0 6px; }
.dadata-lookup-heading p { margin:0; }
.dadata-lookup-controls { display:grid; grid-template-columns:minmax(220px, 420px) auto; align-items:end; gap:12px; margin:16px 0 10px; }
.dadata-lookup-controls label { margin:0; }
.dadata-lookup .message { margin:10px 0; }
.dadata-unfilled-field {
  background:rgba(184, 52, 40, .12) !important;
  border-color:rgba(184, 52, 40, .72) !important;
  box-shadow:0 0 0 2px rgba(184, 52, 40, .08);
}
.dadata-unfilled-field:focus {
  background:var(--surface, #fff) !important;
  border-color:var(--brand-blue, #437cd3) !important;
  box-shadow:0 0 0 3px rgba(67, 124, 211, .14);
}
.contract-number-attention {
  background: rgba(166, 124, 0, .14) !important;
  border-color: rgba(143, 105, 0, .72) !important;
  box-shadow: 0 0 0 2px rgba(143, 105, 0, .08);
}
.contract-number-attention:focus {
  background: var(--surface, #fff) !important;
  border-color: var(--brand-blue, #437cd3) !important;
  box-shadow: 0 0 0 3px rgba(67, 124, 211, .14);
}
.field-highlight-red { background:rgba(184,52,40,.12)!important; border-color:rgba(184,52,40,.72)!important; box-shadow:0 0 0 2px rgba(184,52,40,.08); }
.field-highlight-yellow { background:rgba(166,124,0,.14)!important; border-color:rgba(143,105,0,.72)!important; box-shadow:0 0 0 2px rgba(143,105,0,.08); }
.field-highlight-orange { background:rgba(230,126,34,.15)!important; border-color:rgba(211,84,0,.72)!important; box-shadow:0 0 0 2px rgba(230,126,34,.08); }
.field-highlight-light-blue { background:rgba(67,124,211,.12)!important; border-color:rgba(67,124,211,.62)!important; box-shadow:0 0 0 2px rgba(67,124,211,.08); }
.field-highlight-green { background:rgba(39,174,96,.13)!important; border-color:rgba(30,132,73,.68)!important; box-shadow:0 0 0 2px rgba(39,174,96,.08); }
[class*="field-highlight-"]:focus { background:var(--surface,#fff)!important; border-color:var(--brand-blue,#437cd3)!important; box-shadow:0 0 0 3px rgba(67,124,211,.14); }
.dadata-usage-summary { display:grid; grid-template-columns:repeat(2,minmax(180px,280px)); gap:12px; margin-top:18px; }
.dadata-usage-summary>div:not(.notice) { padding:14px 16px; border:1px solid var(--line); border-radius:14px; background:var(--soft-blue); }
.dadata-usage-summary span,.dadata-usage-summary strong { display:block; }
.dadata-usage-summary strong { margin-top:4px; font-size:1.45rem; }
.dadata-usage-summary small,.dadata-usage-summary .notice { grid-column:1/-1; }

.clients-table {
  overflow: visible;
}

.clients-table table {
  min-width: 0;
  table-layout: fixed;
}

.clients-table th:nth-child(2) { width: 21%; }
.clients-table th:nth-child(3) { width: 10%; }
.clients-table th:nth-child(4) { width: 15%; }
.clients-table th:nth-child(5) { width: 15%; }
.clients-table th:nth-child(6) { width: 14%; }
.clients-table th:nth-child(7) { width: 12%; }
.clients-table th:nth-child(8) { width: 13%; }
.clients-table td { overflow-wrap: anywhere; }

.client-name-link {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.client-name-link:hover {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.company-email-admin-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.company-email-admin-field legend {
  margin-bottom: 10px;
  font-weight: 700;
}

.company-email-admin-options {
  display: grid;
  gap: 8px;
}

.company-email-admin-options .check {
  margin: 0;
}

.client-directions,
.client-legal-entities {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.client-directions span {
  padding: 3px 7px;
  border-radius: 7px;
  background: var(--mint);
  color: var(--green);
  font-size: .68rem;
  font-weight: 750;
}

.client-legal-entities span {
  padding: 3px 7px;
  border-radius: 7px;
  background: var(--soft-blue);
  color: var(--blue);
  font-size: .68rem;
  font-weight: 750;
}

.client-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.download-menu {
  position: relative;
}

.download-menu > summary {
  list-style: none;
  cursor: pointer;
}

.download-menu > summary::-webkit-details-marker { display: none; }

.download-menu > div {
  position: absolute;
  z-index: 8;
  top: calc(100% + 7px);
  right: 0;
  min-width: 170px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  box-shadow: var(--shadow);
}

.download-menu > div a {
  display: block;
  padding: 9px 11px;
  border-radius: 7px;
  color: var(--ink);
  font-weight: 700;
}

.download-menu > div a:hover { background: var(--mint); color: var(--green); }

.client-card-panel { width: 100%; }

.client-delete-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 20px;
}

.client-delete-panel p { margin-bottom: 0; color: var(--muted); }

.client-basic-fields ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.client-basic-fields li label {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: start;
}

.client-basic-fields input[type="checkbox"] { width: 18px; height: 18px; }

.client-picker {
  margin: 20px 0 24px;
  padding: 18px;
  border: 1px solid #cdd9e8;
  border-radius: 14px;
  background: #f7f9fc;
}

.client-picker-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.client-picker-head h3 { margin-bottom: 3px; }
.client-picker-head p { margin-bottom: 0; color: var(--muted); font-size: .82rem; }

.client-picker-filters {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(150px, .45fr) minmax(180px, .55fr) auto;
  gap: 8px;
}

.client-picker-selected {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #e8f1fa;
  color: #295e88;
}

.client-picker-selected span { font-size: .75rem; }

.client-picker-results {
  display: grid;
  gap: 6px;
  max-height: 196px;
  overflow-y: auto;
  margin-top: 10px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

/* Objectwork chooser: deliberately distinct from ordinary related-document cards. */
.existing-objectwork-card {
  border-color: #8fb2e5;
  background: linear-gradient(145deg, #eaf2fd 0%, #f7faff 100%);
  box-shadow: 0 10px 28px rgba(67, 124, 211, .12);
}
.existing-objectwork-card .document-glyph { border-color: #437cd3; }
.existing-objectwork-card .document-glyph span { background: #437cd3; }
.objectwork-template-empty { margin-bottom: 18px; }
.objectwork-template-empty .empty-state { padding: 24px; }
.objectwork-template-empty .empty-state p { margin-bottom: 0; }

/*
 * Reversible compact numbering experiment for the document generation form.
 * Remove this block and the compact-step-layout class to restore the previous layout.
 */
.contract-form.compact-step-layout .form-section {
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
}
.contract-form.compact-step-layout .step-marker {
  width: 28px;
  height: 28px;
  font-size: .78rem;
}
.contract-form.compact-step-layout .section-copy { min-width: 0; }

@media (min-width: 721px) {
  .contract-form.compact-step-layout .form-section { padding-left: 8px; }
}

@media (max-width: 720px) {
  .contract-form.compact-step-layout .form-section { grid-template-columns: 1fr; }
  .contract-form.compact-step-layout .step-marker { margin-bottom: -8px; }
  .inline-filter-check { width: 100%; max-width: 100%; }
  .inline-filter-check span { min-width: 0; white-space: normal; }
}

.client-picker-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.client-picker-result:hover { background: var(--mint); }
.client-picker-result span { color: var(--muted); font-size: .72rem; }
.client-picker-result-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 2px; }
.client-picker-caption { padding: 5px 8px 3px; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }

.section-heading-actions,
.intake-status-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.section-heading-actions h2 { margin-bottom: 0; }
.intake-send-button { flex: 0 0 auto; }
.inline-filter-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 9px;
  width: max-content;
  margin-top: 10px;
  font-size: .82rem;
}
.inline-filter-check input { width: 18px; height: 18px; accent-color: var(--blue); }
.contract-own-filter { grid-column: 1 / -1; margin: 0; }
.intake-status-panel > div:first-child { min-width: 0; }
.intake-status-panel p { margin-bottom: 4px; color: var(--muted); }
.intake-status-panel small { color: var(--muted); }
.intake-settings-block {
  margin: 6px 0;
  padding: 16px;
  border: 1px solid #cdd9e8;
  border-radius: 13px;
  background: #f7f9fc;
}
.intake-settings-block h3 { margin-bottom: 4px; }

.client-intake-page { background: #f3f5f8; }
.client-intake-shell { width: min(1040px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 80px; }
.client-intake-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.client-intake-form { padding: clamp(24px, 4vw, 46px); }
.client-intake-form > h1 { margin-bottom: 10px; }
.client-intake-form .field-grid { margin-top: 28px; }
.client-intake-form em { color: var(--danger); font-size: .78rem; font-style: normal; }
.client-intake-submit { display: flex; justify-content: flex-end; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }

.bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-height: 48px;
  margin: 14px 0 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.bulk-toolbar > span { margin-right: auto; color: var(--muted); font-size: .8rem; }
.bulk-title-cell, .bulk-select { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.bulk-title-cell > span { display: flex; min-width: 0; flex-direction: column; }
.bulk-title-cell > input, .bulk-select > input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--blue);
}
.bulk-select-head { align-items: center; }
.bulk-checkbox-placeholder { display: inline-block; flex: 0 0 18px; width: 18px; }

col.bulk-check-column,
th.bulk-check-cell,
td.bulk-check-cell {
  width: 15px !important;
  min-width: 15px !important;
  max-width: 15px !important;
}

th.bulk-check-cell,
td.bulk-check-cell {
  padding: 0 !important;
  text-align: center;
  vertical-align: middle;
  overflow: visible;
}

.bulk-check-cell input[type="checkbox"] {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin: 0;
  vertical-align: middle;
  accent-color: var(--blue);
  transform: translateX(8px);
}

.admin-contracts-table table {
  width: 100%;
  table-layout: fixed;
}

.client-detail-head h1 {
  font-size: 1.2rem;
}

.legal-entity-form > p:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legal-entity-form > p:has(input[type="checkbox"]) > label {
  order: 2;
  display: inline;
  margin: 0;
}

.legal-entity-form > p:has(input[type="checkbox"]) > input[type="checkbox"] {
  order: 1;
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin: 0;
}

@media (min-width: 801px) and (max-width: 1180px) {
  .search-primary-row,
  .search-date-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .client-search-panel { grid-template-columns: 1fr 1fr 1fr; }
  .client-picker-filters { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .registry-documents-head { align-items: stretch; flex-direction: column; }
  .registry-documents-tools { align-items: stretch; flex: none; flex-direction: column; width: 100%; }
  .registry-export-button { width: 100%; }
  .registry-template-filter { flex-basis: auto; width: 100%; }
  .registry-contracts-table table, .registry-contracts-table tbody, .registry-contracts-table tr, .registry-contracts-table td { display: block; width: 100%; }
  .registry-contracts-table thead { display: none; }
  .registry-contracts-table tr { padding: 14px; border-bottom: 1px solid var(--line); }
  .registry-contracts-table td { display: grid; grid-template-columns: minmax(105px, 32%) 1fr; gap: 10px; padding: 8px 4px; border: 0; }
  .registry-contracts-table td::before { content: attr(data-label); color: var(--muted); font-size: .7rem; font-weight: 800; text-transform: uppercase; }
  .registry-contracts-table td:first-child { display: block; padding-bottom: 2px; }
  .registry-contracts-table td:first-child::before { display: none; }
  .registry-contracts-table .tree-child-row { margin: 0 14px 14px; padding-left: 12px; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 12px; }
  .registry-contracts-table .tree-child-row td:first-child { display: none; }
  .registry-contracts-table .tree-title { min-width: 0; }
  .clients-table { border: 0; background: transparent; }
  .clients-table table, .clients-table tbody, .clients-table tr, .clients-table td { display: block; width: 100%; }
  .clients-table thead { display: none; }
  .clients-table tr { margin-bottom: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
  .clients-table td { display: grid; grid-template-columns: minmax(105px, 32%) 1fr; gap: 10px; padding: 9px 4px; border-bottom: 1px solid #e8ecf2; }
  .clients-table td::before { content: attr(data-label); color: var(--muted); font-size: .7rem; font-weight: 800; text-transform: uppercase; }
  .clients-table td:last-child { display: block; border-bottom: 0; }
  .clients-table td:last-child::before { display: none; }
  .clients-table tr { position: relative; }
  .clients-table td.bulk-check-cell {
    position: absolute;
    z-index: 2;
    top: 24px;
    left: 14px;
    display: block;
  }
  .clients-table td.bulk-record-title { padding-left: 28px; }
  .admin-contracts-table { border: 0; background: transparent; }
  .admin-contracts-table table,
  .admin-contracts-table tbody,
  .admin-contracts-table tr,
  .admin-contracts-table td { display: block; min-width: 0; width: 100%; }
  .admin-contracts-table thead { display: none; }
  .admin-contracts-table tr { position: relative; margin-bottom: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
  .admin-contracts-table td { display: grid; grid-template-columns: minmax(110px, 34%) minmax(0, 1fr); gap: 10px; padding: 9px 4px; border-bottom: 1px solid #e8ecf2; }
  .admin-contracts-table td::before { content: attr(data-label); color: var(--muted); font-size: .7rem; font-weight: 800; text-transform: uppercase; }
  .admin-contracts-table td.bulk-check-cell { position: absolute; z-index: 2; top: 22px; left: 14px; display: block; border: 0; }
  .admin-contracts-table td:nth-child(2) { padding-left: 28px; }
  .admin-contracts-table td:last-child { border-bottom: 0; }
}

@media (max-width: 800px) {
  .client-name-link { font-size: 14px; }
  .contracts-table tr { position: relative; }
  .contracts-table .tree-title { min-width: 0; width: 100%; }
  .contracts-table .tree-title > span:last-child { min-width: 0; overflow-wrap: anywhere; }
  .contracts-table td.bulk-check-cell {
    position: absolute;
    z-index: 2;
    top: 25px;
    left: 14px;
    display: block;
  }
  .contracts-table .tree-child-row td.bulk-check-cell { display: none; }
  .contracts-table td.bulk-record-title { padding-left: 28px; }
}

@media (max-width: 650px) {
  .client-detail-head h1 { font-size: 1.05rem; }
  .client-search-panel, .client-picker-filters { grid-template-columns: 1fr; }
  .client-detail-head .row-actions { width: 100%; }
  .client-detail-head .row-actions > * { flex: 1; }
  .client-delete-panel, .client-picker-head { align-items: stretch; flex-direction: column; }
  .download-menu > div { left: 0; right: auto; }
  .bulk-toolbar { align-items: stretch; flex-direction: column; }
  .bulk-toolbar > span { margin-right: 0; }
  .client-picker-result { align-items: stretch; flex-direction: column; }
  .section-heading-actions, .intake-status-panel { align-items: stretch; flex-direction: column; }
  .intake-send-button { width: 100%; }
  .client-intake-shell { width: 100%; padding: 0 0 88px; }
  .client-intake-head { padding: 14px 16px; margin: 0; background: #fff; border-bottom: 1px solid var(--line); }
  .client-intake-head .secure-label { display: none; }
  .client-intake-form { border: 0; border-radius: 0; padding: 24px 16px 110px; }
  .client-intake-submit { position: fixed; z-index: 20; right: 0; bottom: 0; left: 0; margin: 0; padding: 12px 16px; background: #fff; box-shadow: 0 -8px 24px rgba(26,45,70,.13); }
  .client-intake-submit .button { width: 100%; }
}

/* Полноэкранный мастер создания основных документов. */
.wizard-page .topbar,
.wizard-page .sidebar,
.wizard-page .mobile-nav { display: none; }
.wizard-page .app-shell { display: block; min-height: 100vh; }
.wizard-page .main { min-height: 100vh; padding: 0; }
.wizard-page .messages { max-width: 1180px; margin: 12px auto 0; }
.wizard-shell {
  min-height: 100vh;
  padding: 0 36px 54px;
  background:
    radial-gradient(circle at 92% 8%, rgba(67,124,211,.14), transparent 28%),
    linear-gradient(180deg, #f8fafe 0%, var(--paper) 70%);
}
.wizard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1280px;
  min-height: 88px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}
.wizard-brand { display: inline-flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none; }
.wizard-brand > span:last-child { display: grid; gap: 2px; }
.wizard-brand strong { font-size: 1.05rem; }
.wizard-brand small { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; }
.wizard-start,
.wizard-form,
.wizard-progress,
.wizard-errors,
.wizard-complete { width: min(1180px, 100%); margin-right: auto; margin-left: auto; }
.wizard-start { padding-top: clamp(42px, 7vw, 90px); }
.wizard-intro { max-width: 760px; margin-bottom: 30px; }
.wizard-intro h1,
.wizard-step-heading h1,
.wizard-complete h1 { margin: 6px 0 12px; font-size: clamp(1.65rem, 3.2vw, 2.8rem); line-height: 1.05; }
.wizard-intro > p:last-child,
.wizard-step-heading > p:last-child,
.wizard-complete > p { max-width: 760px; color: var(--muted); }
.wizard-card {
  padding: clamp(22px, 3vw, 36px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--white);
  box-shadow: 0 14px 36px rgba(25,55,95,.08);
}
.wizard-card-heading { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 28px; }
.wizard-card-heading.compact { margin-bottom: 22px; }
.wizard-card-heading h2 { margin: 2px 0 7px; font-size: 1.2rem; }
.wizard-card-heading p { margin: 0; color: var(--muted); }
.wizard-number,
.wizard-success-mark {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--mint);
  color: var(--green-dark);
  font-weight: 900;
}
.wizard-start-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 22px; }
.wizard-start-card .wizard-navigation { margin-top: 30px; }
.wizard-progress {
  position: sticky;
  z-index: 25;
  top: 0;
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 6px;
  padding: 16px 0;
  background: rgba(248,250,254,.94);
  backdrop-filter: blur(12px);
}
.wizard-progress button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}
.wizard-progress button::after { content: ""; position: absolute; right: 0; bottom: -4px; left: 0; height: 3px; border-radius: 4px; background: #dce3ee; }
.wizard-progress button span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #e8edf5; font-weight: 900; }
.wizard-progress button.active,
.wizard-progress button.complete { color: var(--ink); }
.wizard-progress button.active::after,
.wizard-progress button.complete::after { background: var(--green); }
.wizard-progress button.active span,
.wizard-progress button.complete span { background: var(--green); color: #fff; }
.wizard-progress button:disabled { cursor: default; }
.wizard-errors { margin-top: 18px; }
.wizard-form { padding-top: 24px; }
.wizard-step[hidden] { display: none !important; }
.wizard-step-heading { margin: 10px 0 28px; }
.wizard-field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px 22px; }
.wizard-field-grid.single { grid-template-columns: 1fr; }
.wizard-field,
.wizard-start-grid > label { display: grid; align-content: start; gap: 8px; }
.wizard-field.wide { grid-column: 1 / -1; }
.wizard-field small { color: var(--muted); }
.wizard-field em { color: #a32c22; font-style: normal; }
.wizard-card + .wizard-card { margin-top: 22px; }
.wizard-data-columns,
.wizard-review-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 22px; }
.wizard-data-columns .wizard-card + .wizard-card,
.wizard-review-grid .wizard-card + .wizard-card { margin-top: 0; }
.wizard-navigation { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 28px; }
.wizard-confirm { display: flex; flex-direction: column; }
.wizard-confirm .check { margin-top: auto; }
.wizard-complete-shell { display: flex; flex-direction: column; }
.wizard-complete { padding: clamp(48px, 8vw, 96px) 0 30px; text-align: center; }
.wizard-success-mark { width: 66px; height: 66px; margin: 0 auto 18px; background: var(--green); color: #fff; font-size: 2rem; }
.wizard-complete > p { margin-right: auto; margin-left: auto; }
.wizard-result-card { max-width: 900px; margin: 34px auto 0; text-align: left; }
.wizard-result-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.wizard-complete-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px; margin-top: 26px; }
.legal-entity-default-template-list { display: grid; gap: 10px; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.legal-entity-default-template-list legend { padding: 0 6px; font-weight: 800; }
.legal-entity-default-template-list > .check { display: flex; align-items: center; gap: 9px; margin: 0; }

@media (max-width: 760px) {
  .dadata-lookup-heading { flex-direction:column; }
  .dadata-lookup-controls { grid-template-columns:1fr; }
  .dadata-lookup-controls .button { width:100%; }
  .dadata-usage-summary { grid-template-columns:1fr; }
  .wizard-shell { padding-right: 16px; padding-bottom: 36px; padding-left: 16px; }
  .wizard-topbar { min-height: 74px; }
  .wizard-brand small { display: none; }
  .wizard-topbar > .button { padding: 10px 12px; font-size: .74rem; }
  .wizard-progress { gap: 2px; }
  .wizard-progress button { justify-content: center; padding: 8px 2px; }
  .wizard-progress button strong { display: none; }
  .wizard-start-grid,
  .wizard-field-grid,
  .wizard-data-columns,
  .wizard-review-grid { grid-template-columns: 1fr; }
  .wizard-card { padding: 20px 16px; border-radius: 17px; }
  .wizard-navigation { align-items: stretch; flex-direction: column-reverse; }
  .wizard-navigation .button { width: 100%; }
  .wizard-result-actions { display: grid; grid-template-columns: 1fr; }
  .wizard-result-actions .button { width: 100%; }
}

.template-card.required-template-highlight {
  border-color: #df8a00;
  background: #fff9e9;
  box-shadow: 0 0 0 4px rgba(223,138,0,.18), 0 16px 34px rgba(104,67,0,.12);
  outline: none;
}
.template-prerequisite-hint {
  display: block;
  margin: 0 0 12px;
  color: #8a5700;
  font-weight: 800;
}

.profile-contact-settings-form { padding: 18px 20px; }
.profile-contact-settings-form fieldset { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.profile-contact-settings-form fieldset ul { display: grid; gap: 10px; margin: 10px 0 0; padding: 0; list-style: none; }
.profile-contact-placeholder-list { display: grid; gap: 8px; }
.profile-contact-placeholder-list > div { display: grid; grid-template-columns: minmax(180px,auto) 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.profile-contact-document-fields { grid-column: 1 / -1; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.profile-contact-document-fields > p { color: var(--muted); }
.profile-contact-document-fields input[readonly] { background: var(--surface-muted); color: var(--muted); cursor: not-allowed; }
@media (max-width: 760px) {
  .profile-contact-placeholder-list > div { grid-template-columns: 1fr; }
  .profile-contact-placeholder-list .button { width: 100%; }
}
