/* CRM_CONTRACT_MANAGEMENT_STYLE_V111 */
.contract-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(37,99,235,.08), rgba(15,23,42,.03));
}
.contract-flow span {
  padding: 7px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 750;
}
.contract-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 12px;
  margin-top: 14px;
}
.contract-kpi {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel, #fff);
  box-shadow: 0 7px 22px rgba(15,23,42,.05);
}
.contract-kpi small { color: var(--muted); }
.contract-kpi strong { font-size: clamp(22px, 2vw, 32px); }
.contract-type-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.contract-editor-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 330px);
  gap: 14px;
  align-items: start;
}
.contract-editor-main,
.contract-editor-side {
  min-width: 0;
}
.contract-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 9px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
}
.contract-editor-toolbar button,
.contract-editor-toolbar select {
  min-height: 34px;
  padding: 5px 9px;
  font-size: 12px;
}
.contract-content-editor {
  min-height: 620px;
  padding: clamp(18px, 4vw, 46px);
  border: 1px solid var(--line);
  border-radius: 0 0 14px 14px;
  background: #fff;
  color: #111827;
  line-height: 1.65;
  outline: none;
  overflow-wrap: anywhere;
}
.contract-content-editor:focus { box-shadow: inset 0 0 0 2px rgba(37,99,235,.18); }
.contract-content-editor h1,
.contract-content-editor h2 { text-align: center; }
.contract-content-editor table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}
.contract-content-editor th,
.contract-content-editor td {
  border: 1px solid #cbd5e1;
  padding: 7px;
  vertical-align: top;
}
.contract-meta-card,
.contract-document-card,
.contract-version-card {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel, #fff);
  margin-bottom: 10px;
}
.contract-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.contract-meta-grid div { min-width: 0; }
.contract-meta-grid small { display: block; color: var(--muted); }
.contract-meta-grid b { overflow-wrap: anywhere; }
.contract-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.contract-doc-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.contract-doc-hash {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  word-break: break-all;
  color: var(--muted);
}
.contract-document-status {
  font-size: 11px;
  color: var(--muted);
}
.contract-template-preview {
  max-height: 240px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.contract-empty-note {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}
.contract-expiring { color: #b45309; font-weight: 800; }
.contract-expired { color: #b91c1c; font-weight: 800; }
.contract-file-input {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
}
@media (max-width: 980px) {
  .contract-editor-shell { grid-template-columns: 1fr; }
  .contract-editor-side { order: -1; }
  .contract-content-editor { min-height: 480px; }
}
@media (max-width: 600px) {
  .contract-flow { align-items: stretch; }
  .contract-flow span { flex: 1 1 130px; text-align: center; }
  .contract-editor-toolbar { position: static; }
  .contract-content-editor { min-height: 420px; padding: 16px; font-size: 14px; }
  .contract-meta-grid { grid-template-columns: 1fr; }
  .contract-actions > button { flex: 1 1 140px; }
}

/* CRM_CONTRACT_ADDENDUM_AND_FRAMEWORK_LINK_STYLE_V111 */
.contract-addendum-upload {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  font-weight: 700;
}
.contract-addendum-upload input[type="file"] {
  width: min(210px, 44vw);
  min-height: 38px;
  padding: 4px;
}
.contract-addendum-upload button {
  white-space: nowrap;
}
@media (max-width: 680px) {
  .contract-addendum-upload {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }
  .contract-addendum-upload input[type="file"],
  .contract-addendum-upload button {
    width: 100%;
  }
}
