/* «Доставка и тарифы» (apps/admin/delivery.js). Shared Journey tokens only. */
#delivery .panel { margin-bottom:22px; }
#delivery .panel-head { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:baseline; gap:8px 16px; }
.delivery-banner p { margin:0 0 6px; }
.delivery-banner p:last-child { margin:0; }
.delivery-zone-fields, .delivery-resolve, .delivery-save { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:10px 18px; align-items:end; }
.delivery-zone-fields label, .delivery-resolve label, .delivery-save label { display:grid; gap:4px; font-size:var(--journey-type-caption-size); color:var(--journey-color-text-secondary); }
#delivery input:not([type=checkbox]), #delivery select { min-height:32px; padding:4px 8px; border:1px solid var(--journey-color-border, #DDDCD2); border-radius:8px; font:inherit; font-size:var(--journey-type-footnote-size); color:var(--journey-color-text-primary); background:#fff; width:100%; box-sizing:border-box; }
#delivery input:disabled, #delivery select:disabled { background:var(--journey-color-bg-subtle, #F4F3EE); }
.delivery-table td { vertical-align:top; min-width:110px; }
.delivery-table td:first-child { min-width:180px; }
.delivery-table td > * + * { margin-top:6px; }
.delivery-table small { display:block; font-size:var(--journey-type-caption-size); color:var(--journey-color-text-secondary); }
.delivery-table code { font-size:var(--journey-type-caption-size); }
.delivery-days { display:flex; gap:4px; align-items:center; }
.delivery-days input { width:56px !important; }
label.delivery-check { display:flex !important; grid-template-columns:none; align-items:center; gap:6px; font-size:var(--journey-type-caption-size); color:var(--journey-color-text-primary); }
tr.delivery-off td { opacity:.6; }
tr.delivery-placeholder td:first-child { box-shadow:inset 3px 0 0 var(--journey-color-status-warning-fg); }
.delivery-audit { margin:0; padding-left:18px; display:grid; gap:10px; font-size:var(--journey-type-footnote-size); }
.delivery-audit ul { margin:4px 0 0; padding-left:16px; color:var(--journey-color-text-secondary); font-size:var(--journey-type-caption-size); }
.delivery-resolve p, .delivery-save p { grid-column:1 / -1; margin:0; }

/* Zones are collapsible: the page stays short, a zone opens when it is edited. */
.delivery-zone-tools { display:flex; gap:20px; margin:0 0 10px; }
details.delivery-zone > summary { cursor:pointer; list-style:none; }
details.delivery-zone > summary::-webkit-details-marker { display:none; }
details.delivery-zone > summary h2::before { content:'▸'; display:inline-block; width:1.1em; color:var(--journey-color-text-secondary); transition:transform .15s ease; }
details.delivery-zone[open] > summary h2::before { transform:rotate(90deg); }
details.delivery-zone:not([open]) > summary { border-bottom:0; }
.delivery-zone-summary { white-space:nowrap; }
.delivery-zone-fields .remove-button { justify-self:start; }
/* Method names wrap instead of being cut off. */
#delivery textarea { width:100%; box-sizing:border-box; min-height:44px; padding:6px 8px; border:1px solid var(--journey-color-border, #DDDCD2); border-radius:8px; font:inherit; font-size:var(--journey-type-footnote-size); line-height:1.35; color:var(--journey-color-text-primary); background:#fff; resize:vertical; overflow-wrap:anywhere; }
#delivery textarea:disabled { background:var(--journey-color-bg-subtle, #F4F3EE); }
.delivery-table { width:100%; table-layout:fixed; }
.delivery-table th:nth-child(1) { width:22%; }
.delivery-table td { min-width:0; overflow-wrap:anywhere; }
.delivery-table td:first-child { min-width:0; }
/* Each method is a card at every width (product owner, 2026-11-11). One structure: a caption, and under it one 44 px line
   of controls — so every row of the card stands on one level. Row 1: the name and the service; row 2: the МойСклад
   service, the term and try-on; row 3: urgency and the status. The columns of the rows line up (5 + 7 of 12). */
.delivery-table thead { display:none; }
.delivery-table, .delivery-table tbody { display:block; }
.delivery-table tr { display:grid; grid-template-columns:repeat(12,minmax(0,1fr)); gap:16px 20px; align-items:start; padding:20px; border-bottom:1px solid var(--journey-color-border-subtle); }
.delivery-table td { display:flex; flex-wrap:wrap; align-items:center; gap:6px 12px; min-height:0; padding:0; border:0; grid-column:span 12; }
.delivery-table td > * + * { margin-top:0; }
.delivery-table td::before { content:attr(data-label); flex:0 0 100%; font-size:var(--journey-type-caption-size); letter-spacing:.04em; text-transform:uppercase; color:var(--journey-color-text-secondary); }
.delivery-table td > small, .delivery-table td > .delivery-price { flex:0 0 100%; }
.delivery-table td > select, .delivery-table td > textarea { flex:1 1 160px; min-width:0; width:auto !important; }
.delivery-table td:nth-child(2) > select:first-of-type { flex:2 1 220px; }
.delivery-table td > input:not([type=checkbox]) { flex:0 1 96px; min-width:0; width:auto !important; }
.delivery-table td > label.delivery-check { min-height:var(--field-height); }
.delivery-table td:first-child textarea { min-height:var(--field-height); height:var(--field-height); field-sizing:content; resize:vertical; }
.delivery-table td:last-child .remove-button { margin-left:auto; }
.delivery-days small { margin-left:4px; white-space:nowrap; }
tr.delivery-placeholder td:first-child { box-shadow:none; }
tr.delivery-placeholder { box-shadow:inset 3px 0 0 var(--journey-color-status-warning-fg); }
@media (min-width:1100px) {
  .delivery-table td:nth-child(1) { grid-column:span 5; }
  .delivery-table td:nth-child(2) { grid-column:span 7; }
  .delivery-table td:nth-child(3) { grid-column:span 5; }
  .delivery-table td:nth-child(4) { grid-column:span 3; }
  .delivery-table td:nth-child(5) { grid-column:span 4; }
  .delivery-table td:nth-child(6) { grid-column:span 5; }
  .delivery-table td:nth-child(7) { grid-column:span 7; }
}
@media (min-width:640px) and (max-width:1099.98px) {
  .delivery-table td:nth-child(4), .delivery-table td:nth-child(5), .delivery-table td:nth-child(6) { grid-column:span 4; }
}

/* Prices come from МойСклад: the linked service, its price read-only, where it came from, warnings. */
.delivery-price { display:block; font-size:15px; }
.delivery-table small.delivery-link-warning { color:var(--journey-color-status-warning-fg); font-weight:600; }
.delivery-warnings ul { margin:4px 0 0; padding-left:18px; font-size:13px; }
.delivery-services { width:100%; }
.delivery-services td { vertical-align:top; overflow-wrap:anywhere; }
.delivery-services small { display:block; font-size:11px; color:var(--journey-color-text-secondary); margin-top:4px; }
/* Zone fields: four fields in one row aligned by the fields, then «нужно заполнить» on the left and RemoveButton on the right. */
.delivery-zone-fields { grid-template-columns:repeat(4,minmax(0,1fr)); gap:var(--journey-spacing-16) 20px; }
.delivery-zone-fields .delivery-check { grid-column:1 / span 2; min-height:var(--field-height); }
.delivery-zone-fields .remove-button { grid-column:4; justify-self:end; }
@media (max-width:900px) {
  .delivery-zone-fields { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .delivery-zone-fields .delivery-check { grid-column:1; }
  .delivery-zone-fields .remove-button { grid-column:2; }
}
