/* Shipment system integration layer v3.21.0
   Brand neutral: uses the host site's --primary/--accent variables. */

body.admin-body {
    --ship-surface: #fff;
    --ship-soft: #f7f9fc;
    --ship-line: rgba(15, 35, 58, .12);
    --ship-text: #142235;
    --ship-muted: #66758a;
    --ship-shadow: 0 16px 44px rgba(15, 35, 58, .09);
}

body.admin-body .admin-content { min-width: 0; overflow-x: clip; }
body.admin-body .page-actions,
body.admin-body .easy-page-actions { gap: 18px; align-items: flex-start; }
body.admin-body .page-actions > div:first-child,
body.admin-body .easy-page-actions > div:first-child { min-width: 0; }
body.admin-body .page-actions h1,
body.admin-body .easy-page-actions h1 { overflow-wrap: anywhere; }
body.admin-body .shipment-document-actions { display: flex; flex-wrap: wrap; gap: 9px; }

body.admin-body .shipment-admin-tabs {
    position: sticky;
    top: 78px;
    z-index: 20;
    display: flex;
    gap: 8px;
    padding: 8px;
    margin: 0 0 18px;
    border: 1px solid var(--ship-line);
    border-radius: 16px;
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(14px);
    box-shadow: 0 8px 30px rgba(15,35,58,.06);
    overflow-x: auto;
    scrollbar-width: thin;
}
body.admin-body .shipment-admin-tabs a {
    flex: 0 0 auto;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    border-radius: 11px;
    color: var(--ship-text);
    font-weight: 750;
    text-decoration: none;
    white-space: nowrap;
}
body.admin-body .shipment-admin-tabs a:hover,
body.admin-body .shipment-admin-tabs a.is-active { background: color-mix(in srgb, var(--primary) 10%, #fff); color: var(--primary); }

body.admin-body .movement-workspace,
body.admin-body .easy-full-details,
body.admin-body .easy-history-card,
body.admin-body .shipment-record-grid > .admin-card,
body.admin-body .admin-record-movement {
    border: 1px solid var(--ship-line);
    box-shadow: var(--ship-shadow);
}

body.admin-body .easy-movement-workspace > header,
body.admin-body .easy-history-card > header,
body.admin-body .admin-record-movement > header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

body.admin-body .easy-movement-grid,
body.admin-body .admin-form-grid,
body.admin-body .easy-route-quick-row {
    min-width: 0;
}
body.admin-body .easy-movement-grid > label,
body.admin-body .admin-form-grid > label,
body.admin-body .easy-route-quick-row > label { min-width: 0; }
body.admin-body input,
body.admin-body select,
body.admin-body textarea { max-width: 100%; }

body.admin-body .movement-map-preview {
    margin: 16px 0;
    padding: 14px;
    border: 1px solid var(--ship-line);
    border-radius: 18px;
    background: linear-gradient(180deg, #fff, var(--ship-soft));
    overflow: hidden;
}
body.admin-body .movement-map-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
body.admin-body .movement-map-preview-head > div { min-width: 0; }
body.admin-body .movement-map-preview-head b { display: block; color: var(--ship-text); font-size: 15px; }
body.admin-body .movement-map-preview-head small { display: block; margin-top: 2px; color: var(--ship-muted); }
body.admin-body .movement-mini-map {
    width: 100%;
    min-height: 330px;
    height: min(42vh, 440px);
    border-radius: 14px;
    background: #e9eef3;
    overflow: hidden;
    isolation: isolate;
}
body.admin-body .movement-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 10px;
    color: var(--ship-muted);
    font-size: 12px;
    font-weight: 700;
}
body.admin-body .movement-map-legend span { display: inline-flex; align-items: center; gap: 6px; }
body.admin-body .movement-map-legend i { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
body.admin-body .movement-map-legend i.current { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
body.admin-body .movement-map-legend i.destination { background: #1f8b5b; }

body.admin-body .event-location-status-card {
    display: grid;
    grid-template-columns: auto minmax(0,1fr) auto;
    align-items: center;
    gap: 11px;
}
body.admin-body .event-location-status-card > div { min-width: 0; }
body.admin-body .easy-movement-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    padding: 12px 14px;
    border: 1px solid var(--ship-line);
    border-radius: 14px;
    background: var(--ship-soft);
}
body.admin-body .movement-public-note { flex: 1 1 360px; min-width: 0; }
body.admin-body .movement-public-note b,
body.admin-body .movement-public-note small { display: block; }
body.admin-body .movement-public-note b { color: var(--ship-text); }
body.admin-body .movement-public-note small { margin-top: 2px; color: var(--ship-muted); line-height: 1.45; }

body.admin-body .easy-full-details > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    cursor: pointer;
}
body.admin-body .easy-full-details > summary span { min-width: 0; }
body.admin-body .easy-full-details[open] > summary { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--ship-line); }
body.admin-body .form-sections { min-width: 0; }
body.admin-body .form-section { overflow: visible; }
body.admin-body .form-section > header { align-items: flex-start; }

body.admin-body .easy-route-location-grid,
body.admin-body .route-location-grid { align-items: stretch; }
body.admin-body .route-location-card { min-width: 0; overflow: hidden; }
body.admin-body .route-location-heading > div { min-width: 0; }
body.admin-body .route-location-heading h3,
body.admin-body .route-location-heading p { overflow-wrap: anywhere; }
body.admin-body .location-fields { min-width: 0; }
body.admin-body .location-map-workspace { min-width: 0; overflow: hidden; border-radius: 18px; }
body.admin-body .location-map-canvas,
body.admin-body [data-admin-map] {
    width: 100%;
    min-height: 390px;
    height: min(54vh, 560px);
    background: #e9eef3;
}
body.admin-body .location-map-toolbar { gap: 10px; flex-wrap: wrap; }
body.admin-body .location-map-toolbar > div:first-child { min-width: 220px; flex: 1 1 360px; }
body.admin-body .location-map-focus { display: flex; flex-wrap: wrap; gap: 6px; }
body.admin-body .leaflet-container { font-family: inherit; z-index: 1; }
body.admin-body .leaflet-control-container .leaflet-top,
body.admin-body .leaflet-control-container .leaflet-bottom { z-index: 400; }

body.admin-body .shipment-image-field { align-content: start; }
body.admin-body .shipment-image-preview {
    display: grid;
    grid-template-columns: minmax(120px, 180px) minmax(0,1fr);
    gap: 12px;
    align-items: center;
    margin-top: 9px;
    padding: 10px;
    border: 1px solid var(--ship-line);
    border-radius: 14px;
    background: var(--ship-soft);
}
body.admin-body .shipment-image-preview img,
body.admin-body .shipment-record-media img {
    width: 100%;
    max-width: 220px;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 11px;
    border: 1px solid var(--ship-line);
    background: #fff;
}
body.admin-body .remove-image-check { margin: 0; }
body.admin-body .delivery-history-field input[readonly] { background: #eef2f6; color: #526176; cursor: not-allowed; }
body.admin-body .delivery-history-field small { display: block; margin-top: 5px; color: var(--ship-muted); line-height: 1.4; }

body.admin-body .sticky-save.shipment-save-actions {
    position: sticky;
    bottom: 12px;
    z-index: 12;
    gap: 12px;
    border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--ship-line));
    box-shadow: 0 14px 36px rgba(15,35,58,.13);
}
body.admin-body .shipment-save-actions > div { display: flex; flex-wrap: wrap; gap: 8px; }

body.admin-body .admin-timeline { min-width: 0; }
body.admin-body .admin-timeline article {
    grid-template-columns: minmax(84px, 110px) 18px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
}
body.admin-body .admin-timeline article > div:nth-of-type(2) { min-width: 0; }
body.admin-body .admin-timeline h3,
body.admin-body .admin-timeline p { overflow-wrap: anywhere; }
body.admin-body .admin-timeline form button { white-space: nowrap; }

body.admin-body .shipment-record-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 16px;
}
body.admin-body .shipment-record-grid.shipment-record-grid-wide { grid-template-columns: repeat(3, minmax(0,1fr)); }
body.admin-body .record-list > div { min-width: 0; }
body.admin-body .record-list dd { overflow-wrap: anywhere; }
body.admin-body .record-list dd small { display: block; margin-top: 3px; color: var(--ship-muted); }
body.admin-body .shipment-record-media {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 12px;
    margin-top: 14px;
}
body.admin-body .shipment-record-media figure { margin: 0; }
body.admin-body .shipment-record-media figcaption { margin-top: 6px; color: var(--ship-muted); font-size: 12px; }
body.admin-body .shipment-record-flags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
body.admin-body .shipment-record-flags span { padding: 6px 9px; border-radius: 999px; background: var(--ship-soft); border: 1px solid var(--ship-line); font-size: 12px; font-weight: 700; }

/* Public tracking package/history reinforcement. */
.tracking-result .track28-package-copy dl { grid-template-columns: repeat(2, minmax(0,1fr)); }
.tracking-result .track28-package-copy dl > div { min-width: 0; }
.tracking-result .tracking-package-extra { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-top: 10px; }
.tracking-result .tracking-package-extra span { padding: 9px 10px; border-radius: 10px; background: rgba(255,255,255,.72); border: 1px solid rgba(15,35,58,.1); }
.tracking-result .tracking-package-extra small,
.tracking-result .tracking-package-extra b { display: block; }
.tracking-result .tracking-package-extra small { opacity: .7; font-size: 11px; }
.tracking-result .tracking-package-extra b { margin-top: 2px; overflow-wrap: anywhere; }

@media (max-width: 1100px) {
    body.admin-body .shipment-record-grid.shipment-record-grid-wide { grid-template-columns: repeat(2, minmax(0,1fr)); }
    body.admin-body .movement-mini-map { min-height: 300px; }
}

@media (max-width: 820px) {
    body.admin-body .shipment-admin-tabs { top: 66px; margin-inline: -4px; }
    body.admin-body .page-actions,
    body.admin-body .easy-page-actions,
    body.admin-body .easy-movement-workspace > header,
    body.admin-body .easy-history-card > header,
    body.admin-body .admin-record-movement > header { flex-direction: column; align-items: stretch; }
    body.admin-body .shipment-document-actions > * { flex: 1 1 150px; justify-content: center; }
    body.admin-body .movement-map-preview-head { align-items: flex-start; }
    body.admin-body .movement-mini-map,
    body.admin-body .location-map-canvas,
    body.admin-body [data-admin-map] { min-height: 300px; height: 42vh; }
    body.admin-body .shipment-record-grid,
    body.admin-body .shipment-record-grid.shipment-record-grid-wide { grid-template-columns: 1fr; }
    body.admin-body .admin-timeline article { grid-template-columns: 80px 14px minmax(0,1fr); }
    body.admin-body .admin-timeline article form { grid-column: 3; justify-self: start; }
    .tracking-result .tracking-package-extra { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 560px) {
    body.admin-body .admin-content { padding-left: 12px; padding-right: 12px; }
    body.admin-body .shipment-admin-tabs { top: 58px; border-radius: 12px; }
    body.admin-body .shipment-admin-tabs a { min-height: 36px; padding: 7px 10px; font-size: 12px; }
    body.admin-body .event-location-status-card { grid-template-columns: auto minmax(0,1fr); }
    body.admin-body .event-location-status-card > button { grid-column: 1 / -1; width: 100%; }
    body.admin-body .movement-map-preview { padding: 9px; border-radius: 14px; }
    body.admin-body .movement-map-preview-head { flex-direction: column; }
    body.admin-body .movement-map-preview-head button { width: 100%; }
    body.admin-body .movement-mini-map,
    body.admin-body .location-map-canvas,
    body.admin-body [data-admin-map] { min-height: 270px; height: 38vh; border-radius: 10px; }
    body.admin-body .shipment-image-preview { grid-template-columns: 1fr; }
    body.admin-body .shipment-image-preview img { max-width: none; }
    body.admin-body .sticky-save.shipment-save-actions { position: static; }
    body.admin-body .shipment-save-actions > div,
    body.admin-body .shipment-save-actions button { width: 100%; }
    body.admin-body .admin-timeline article { grid-template-columns: 1fr; border-left: 3px solid color-mix(in srgb, var(--primary) 35%, transparent); padding-left: 12px; }
    body.admin-body .admin-timeline article > i { display: none; }
    body.admin-body .admin-timeline article form { grid-column: auto; }
    body.admin-body .shipment-record-media { grid-template-columns: 1fr; }
    .tracking-result .track28-package-copy dl,
    .tracking-result .tracking-package-extra { grid-template-columns: 1fr; }
}
