.legal-layout-card,
.legal-active-card,
.legal-collection-card { padding: 12px 14px; border: 1px solid #dbe2ec; border-radius: 8px; background: #fff; }
.legal-layout-card { border-color: #ef9dc7; background: #fff8fc; }
.legal-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.legal-section-heading > div { min-width: 0; flex: 1; }
.legal-section-heading h3,
.legal-section-heading p { margin: 0; }
.legal-section-heading h3 { color: #202635; font-size: 13px; font-weight: 700; line-height: 1.3; }
.legal-section-heading p { margin-top: 3px; color: #7c8798; font-size: 9px; line-height: 1.45; }
.legal-section-heading > span,
.legal-section-heading div > span { color: #75839a; font-size: 8px; font-weight: 800; white-space: nowrap; }

.legal-page-visual { display: grid; grid-template-columns: 28px minmax(0, 1fr); min-height: 128px; overflow: hidden; border: 1px solid #dfe5ed; border-radius: 6px; background: #fff; }
.legal-page-numbers { display: flex; flex-direction: column; justify-content: space-around; padding: 10px 0; border-right: 1px solid #e4e9f0; background: #f0f4f8; color: #77869a; font-size: 7px; font-weight: 750; text-align: center; }
.legal-page-copy { display: grid; align-content: center; gap: 8px; padding: 16px 18px; }
.legal-page-copy i { display: block; width: 88%; height: 3px; border-radius: 3px; background: #c4cfdb; }
.legal-page-copy i.is-short { width: 54%; }
.legal-page-copy i.is-medium { width: 70%; }
.legal-page-copy i.is-field { width: 68%; height: 13px; border: 1px solid #eb168b; border-radius: 3px; background: #fde8f4; }
.legal-fact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin-top: 9px; border: 1px solid #e0e6ef; border-radius: 6px; background: #e0e6ef; }
.legal-fact-grid div { display: grid; gap: 2px; padding: 8px 10px; background: #fff; }
.legal-fact-grid span { color: #78869a; font-size: 8px; }
.legal-fact-grid strong { font-size: 9px; line-height: 1.35; }
.legal-layout-note { margin: 9px 0 0; color: #748196; font-size: 8px; line-height: 1.45; }

.legal-active-card { min-height: 92px; overflow: hidden; }
.legal-active-card:not(.is-empty) { border-color: #f06aaa; box-shadow: 0 10px 30px rgba(26, 40, 61, .08); }
.legal-active-empty { display: flex; align-items: center; gap: 10px; min-height: 68px; }
.legal-active-empty div { display: grid; gap: 2px; }
.legal-active-empty strong { color: #202635; font-size: 11px; }
.legal-active-empty small { color: #77859a; font-size: 9px; line-height: 1.4; }
.legal-empty-field { position: relative; width: 40px; height: 27px; flex: 0 0 40px; border: 1px solid #ec168c; border-radius: 5px; background: #fdeaf4; }
.legal-empty-field::after { position: absolute; top: 6px; left: 8px; width: 22px; height: 2px; background: #ec168c; box-shadow: 0 6px #ec168c; content: ""; opacity: .5; }
.legal-section-heading--active { align-items: center; }
.legal-section-heading--active h3 { margin-top: 2px; font-size: 15px; }
.legal-field-range { display: grid; grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr) 22px minmax(0, 1fr); align-items: center; gap: 5px; margin-bottom: 9px; padding: 9px; border: 1px solid #e1e7ef; border-radius: 6px; background: #f9fbfd; }
.legal-field-range div { display: grid; gap: 2px; text-align: center; }
.legal-field-range span { color: #7a8799; font-size: 7px; }
.legal-field-range strong { color: #253a51; font-size: 12px; }
.legal-field-range i { border-top: 1px dashed #91a5ba; }
.legal-field-preview { min-height: 39px; margin-bottom: 9px; padding: 8px 10px; border-radius: 6px; background: #fff2f8; box-shadow: inset 3px 0 #ec168c; color: #293d54; font-size: 9px; font-weight: 650; line-height: 1.45; overflow-wrap: anywhere; }
.legal-field-preview.is-empty { color: #7e8998; font-style: italic; font-weight: 500; }
.legal-property-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid #e0e6ef; border-radius: 6px; background: #e0e6ef; }
.legal-property-grid div { display: grid; min-width: 0; gap: 2px; padding: 8px 10px; background: #f9fbfd; }
.legal-property-grid span { color: #78869a; font-size: 8px; }
.legal-property-grid strong { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.legal-active-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }

.legal-field-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 7px; }
.legal-field-list > p { margin: 0; color: #7b889b; font-size: 9px; }
.legal-field-list-item { display: grid; grid-template-columns: 31px minmax(0, 1fr); align-items: center; gap: 8px; min-width: 0; padding: 8px 9px; border: 1px solid #e1e7ef; border-radius: 6px; background: #f9fbfd; color: #18263a; text-align: left; }
.legal-field-list-item:hover,
.legal-field-list-item:focus-visible,
.legal-field-list-item.is-active { border-color: #ec168c; background: #fff4fa; outline: 0; }
.legal-field-list-item__number { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 5px; background: #fde5f2; color: #b50f68; font-size: 9px; font-weight: 800; }
.legal-field-list-item > span:last-child { display: grid; min-width: 0; gap: 2px; }
.legal-field-list-item strong,
.legal-field-list-item small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legal-field-list-item strong { font-size: 10px; }
.legal-field-list-item small { color: #77859a; font-size: 8px; }

.legal-field-overlay { position: absolute; z-index: 30; display: flex; align-items: center; gap: 5px; max-width: calc(100% - 16px); padding: 5px; color: #242529; background: #fff; border: 1px solid #d9dee5; border-top: 2px solid var(--tx-pink); border-radius: 6px; box-shadow: 0 8px 22px rgba(36, 37, 41, .18); }
.legal-field-overlay[hidden] { display: none; }
.legal-field-overlay__name { min-width: 0; max-width: 150px; padding: 0 7px; overflow: hidden; color: #687386; font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.legal-field-overlay button { padding: 5px 9px; color: #a70f62; background: transparent; border: 1px solid #d89abd; border-radius: 999px; font: inherit; font-size: 10px; font-weight: 650; white-space: nowrap; }
.legal-field-overlay button:hover,
.legal-field-overlay button:focus-visible { color: #fff; background: var(--tx-pink); outline: 0; }

@media (max-width: 620px) {
    .legal-field-range { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .legal-field-range i { display: none; }
    .legal-fact-grid,
    .legal-property-grid { grid-template-columns: 1fr; }
}
