/* DistributionPoint: local composition; shared fields and widget hooks stay intact. */
.distributionpoint-page { color: var(--mkp-foreground); }
.distributionpoint-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}
.distributionpoint-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -.6px;
}
.distributionpoint-header p {
    margin: 4px 0 0;
    color: var(--mkp-muted-foreground);
    font-size: 14px;
    line-height: 1.5;
}
.distributionpoint-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}
.distributionpoint-actions,
.distributionpoint-form-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}
.distributionpoint-form-actions { margin-top: 16px; }
.distributionpoint-audit { margin-top: 12px; }

/* The shared partial stays in DOM order: identity, address, commercial terms.
   Only its presentation wrappers flatten into this page's two-column grid. */
.distributionpoint-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
#distributionpoint-person,
#distributionpoint-person > .card-body,
#distributionpoint-person .admin-person-fields { display: contents; }
#distributionpoint-person .admin-person-fields > :is(.col-xl-8, .col-xl-4) {
    position: relative;
    width: 100%;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 16px;
    border: 1px solid var(--mkp-border);
    border-radius: var(--mkp-radius-lg);
    background: var(--mkp-surface);
    box-shadow: var(--mkp-shadow);
}
#distributionpoint-person .admin-person-fields > .col-xl-8 { grid-column: 1; grid-row: 1 / 3; }
#distributionpoint-person .admin-person-fields > .col-xl-4 { grid-column: 2; grid-row: 1; }
#distributionpoint-settings { grid-column: 2; grid-row: 2; margin: 0; }
.distributionpoint-field-title,
.distributionpoint-section-header h2 {
    margin: 0;
    color: var(--mkp-foreground);
    font-size: 16px;
    line-height: 24px;
    font-weight: 600;
}
.distributionpoint-field-title { margin-bottom: 16px; }
.distributionpoint-section-header { padding: 16px 16px 0; }
#distributionpoint-settings > .card-body { padding: 12px 16px 16px; }
/* Keep name fields on the same left edge as the remaining identity fields.
   The existing photo is a compact identity cue beside the section heading. */
#distributionpoint-person .col-xl-8 > .row.g-0 > .col-md-auto {
    position: absolute;
    top: 8px;
    right: 12px;
}
#distributionpoint-person .col-xl-8 > .row.g-0 > .col-md-auto > div { padding: 0 !important; margin: 0 !important; }
#distributionpoint-person .col-xl-8 > .row.g-0 img { width: 36px; height: 36px; object-fit: cover; }
#distributionpoint-person .col-xl-8 > .row.g-0 > .col-md { width: 100%; flex: 0 0 100%; }
#distributionpoint-person .row { --bs-gutter-x: 16px; row-gap: 10px; }
#distributionpoint-person .mb-3 { margin-bottom: 10px !important; }
#distributionpoint-person .admin-person-fields > div > .mb-3:last-child { margin-bottom: 0 !important; }
/* Pair short values by actual available width; full names keep an entire row. */
#distributionpoint-person .admin-person-fields > div > .mb-3.row > [class*="col-md-"] {
    flex: 1 0 min(100%, 180px);
    width: auto;
    min-width: 0;
}
#distributionpoint-person .admin-person-fields > div > .mb-3.row > .col-md-12,
#distributionpoint-person .admin-person-fields > .col-xl-8 > .company > .col-md-6 {
    flex: 0 0 100%;
    width: 100%;
}
#distributionpoint-settings .row { --bs-gutter-x: 12px; }
#distributionpoint-settings .row > .col-lg-6 { width: 100%; }
#distributionpoint-settings .row > .col-lg-3 { width: 50%; }
#distributionpoint-settings .row > .col-md-6 { width: 50%; }
.distributionpoint-inactive { padding-bottom: 6px; }

/* Search and export share a single compact toolbar above the data. */
.distributionpoint-list-card > .card-body { padding: 0; }
.distributionpoint-search { width: min(100%, 440px); margin-right: auto; }
.distributionpoint-grid { min-width: 0; }
.distributionpoint-grid .k-grid { border: 0; }
.distributionpoint-grid .k-grid-toolbar { display: flex; gap: 12px; padding: 12px; }
.distributionpoint-grid .k-grid td { padding-block: 4px; }
.distributionpoint-grid .btn-group { white-space: nowrap; gap: 2px; }
.distributionpoint-grid .btn-group > .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
    width: 28px;
    height: 28px;
    padding: 0;
    border-color: transparent;
    border-radius: var(--mkp-radius-sm) !important;
    background: transparent;
    box-shadow: none;
}
.distributionpoint-grid .btn-group > .btn:is(:hover, :focus-visible) {
    background: var(--mkp-muted);
    border-color: var(--mkp-border);
}
.distributionpoint-empty { padding: 40px 16px; text-align: center; }
.distributionpoint-empty strong { display: block; font-weight: 600; margin-bottom: 6px; }
.distributionpoint-empty span { color: var(--mkp-muted-foreground); }
@media (max-width: 1199.98px) {
    .distributionpoint-header { align-items: flex-start; flex-wrap: wrap; }
    .distributionpoint-actions { justify-content: flex-start; }
    .distributionpoint-form-grid { grid-template-columns: minmax(0, 1fr); }
    #distributionpoint-person .admin-person-fields > .col-xl-8,
    #distributionpoint-person .admin-person-fields > .col-xl-4,
    #distributionpoint-settings { grid-column: 1; grid-row: auto; }
}
@media (max-width: 767.98px) {
    .distributionpoint-header { gap: 12px; }
    .distributionpoint-header h1 { font-size: 22px; }
    .distributionpoint-actions { width: 100%; }
    .distributionpoint-actions .btn { flex: 1 1 auto; }
    #distributionpoint-person .admin-person-fields > div > .mb-3.row > [class*="col-md-"],
    #distributionpoint-settings .row > [class*="col-"] { flex: 0 0 100%; width: 100%; }
    .distributionpoint-search { width: 100%; }
    .distributionpoint-grid .k-grid-toolbar { flex-wrap: wrap; }
}
/* Explicit local density and spans win over the shared nested-row heuristics. */
.distributionpoint-page { --mkp-control-height: 32px; --mkp-label-gap: 4px; }
#distributionpoint-person .form-control,
#distributionpoint-person .form-select,
#distributionpoint-settings .form-select { padding-block: 5px; }
#distributionpoint-person .k-datepicker.form-control { padding: 0; }
#distributionpoint-person .admin-person-fields > .col-xl-8 > .mb-3.row.company > .col-md-6 {
    flex: 0 0 100%;
    width: 100%;
}
#distributionpoint-person .admin-person-fields > .col-xl-8 > .mb-3.row.company > .col-md-3 {
    flex: 1 0 min(100%, 180px);
}
#distributionpoint-person .mb-3 .row + .row { margin-top: 8px; }
#distributionpoint-person .row { row-gap: 8px; }
#distributionpoint-person .mb-3 { margin-bottom: 8px !important; }
#distributionpoint-person .admin-person-fields > .col-xl-4 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 16px;
    row-gap: 8px;
}
#distributionpoint-person .col-xl-4 > .distributionpoint-field-title { grid-column: 1 / -1; margin-bottom: 8px; }
#distributionpoint-person .col-xl-4 > .mb-3 { margin-bottom: 0 !important; }
#distributionpoint-person .col-xl-4 > .row:has(#Person_Address_Street),
#distributionpoint-person .col-xl-4 > .row:has(#Person_Address_Country_select) { grid-column: 1 / -1; }
#distributionpoint-person .admin-person-fields > .col-xl-4 > .row:has(#Person_Address_Country_select) > [class*="col-md-"] {
    flex: 1 0 min(100%, 125px);
}
#distributionpoint-settings .row > .col-lg-6 { flex: 0 0 100%; width: 100%; }
#distributionpoint-settings .row > .col-lg-3 { flex: 1 0 min(100%, 180px); width: auto; }
#distributionpoint-settings .form-label { flex-grow: 0; }
#distributionpoint-settings .mb-3 { margin-bottom: 8px !important; }
#Grid { --mkp-grid-cell-y: 1.5px; }
#Grid.mkp-grid-bounded-direct { max-height: none; }
#Grid .k-grid-table > tbody > tr > td { line-height: 18px; }
#Grid .btn-group > .btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    padding: 0;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}
#Grid .btn-group > .btn:is(:hover, :focus-visible) { border-color: var(--mkp-border); background: var(--mkp-muted); }
@media (max-width: 767.98px) {
    #distributionpoint-person .admin-person-fields > .col-xl-4 { grid-template-columns: minmax(0, 1fr); }
    #distributionpoint-person .admin-person-fields > .col-xl-4 > .row:has(#Person_Address_Country_select) > [class*="col-md-"],
    #distributionpoint-settings .row > .col-lg-3 { flex: 0 0 100%; width: 100%; }
}
/* Keep the photo beside the heading at every breakpoint. */
#distributionpoint-person .col-xl-8 > .row.g-0 > .col-md-auto { width: auto; }
@media (min-width: 768px) {
    #distributionpoint-person .admin-person-fields > .col-xl-4 { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
    #distributionpoint-person .admin-person-fields > .col-xl-4 > .row:has(#Person_Address_Country_select) > .col-md-4 { flex: 1 0 80px; }
    #distributionpoint-person .admin-person-fields > .col-xl-4 > .row:has(#Person_Address_Country_select) > .col-md-4:first-child { flex: 0 0 165px; }
}
#Grid .k-grid-table > thead > tr > th { padding-block: 2px; height: 36px; }

.distributionpoint-field-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#distributionpoint-person .distributionpoint-field-title img { width: 32px; height: 32px; object-fit: cover; }
