/* Official CDEK keeps its native fields and calculation inside the delivery dialog. */
.commerce-cart-checkout dialog.theobroma-official-cdek { width: min(680px, calc(100vw - 24px)); max-height: 90dvh; padding: 0; border: 1px solid #e8ded2; border-radius: 20px; background: #fbf8f3; color: #2f241e; }
.commerce-cart-checkout dialog.theobroma-official-cdek[open] { display: flex; flex-direction: column; }
.theobroma-official-cdek::backdrop { background: rgb(30 22 16 / 55%); }
.theobroma-official-content { padding: 24px; overflow-y: auto; }
.theobroma-official-cdek header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.theobroma-official-cdek header h3 { margin: 0; font-size: 24px; }
.theobroma-official-cdek [data-official-close] { border: 0; background: transparent; font-size: 28px; cursor: pointer; }
.theobroma-official-cdek [data-official-address] { display: grid; gap: 16px; }
.commerce-cart-checkout .theobroma-official-cdek .form-row { width: 100%; margin: 0; padding: 0; }
.theobroma-official-cdek footer { padding: 16px 24px; border-top: 1px solid #e8ded2; flex-shrink: 0; }
.theobroma-official-cdek footer button { padding: 12px 18px; border: 0; border-radius: 10px; background: #714727; color: #fff; font: inherit; cursor: pointer; }
.commerce-cart-checkout .theobroma-official-summary { align-items: center; }
@media (max-width: 480px) { .theobroma-official-content { padding: 18px; } .theobroma-official-summary { flex-wrap: wrap; } }
/* Compact recipient and delivery sections; address lives in the courier dialog. */
.commerce-cart-checkout #billing_country_field,
.commerce-cart-checkout #billing_city_field { display: none !important; }
.theobroma-delivery-destination { margin-bottom: 20px; }
.theobroma-delivery-destination select { width: 100%; min-height: 48px; padding: 12px; border: 1px solid var(--theobroma-line); border-radius: 8px; background: var(--theobroma-paper); color: var(--theobroma-ink); font: inherit; }
.commerce-cart-checkout .theobroma-payment-heading { font-size: 24px; font-weight: 500; margin: 24px 0 16px; text-transform: none; }
.commerce-cart-checkout .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper {
  display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px;
}
.commerce-cart-checkout .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper > * { grid-column: 1 / -1; min-width: 0; }
.commerce-cart-checkout .woocommerce-billing-fields #billing_first_name_field { grid-column: 1; }
.commerce-cart-checkout .woocommerce-billing-fields #billing_last_name_field { grid-column: 2; }
.commerce-cart-checkout .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper > .form-row {
  width: 100% !important; float: none !important; margin: 0 !important; padding: 0 !important;
}
.commerce-cart-checkout .theobroma-delivery-heading { margin: 18px 0 0; font-size: 24px; font-weight: 500; }
.commerce-cart-checkout #billing_city_field > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.commerce-cart-checkout .theobroma-delivery-selection { margin-top: 8px; }
.commerce-cart-checkout .theobroma-delivery-methods { margin-top: 0; }
@media (max-width: 380px) {
  .commerce-cart-checkout .woocommerce-billing-fields #billing_first_name_field,
  .commerce-cart-checkout .woocommerce-billing-fields #billing_last_name_field { grid-column: 1 / -1; }
}

body > div.cdek-map > div[class] { z-index: 10000020 !important; }
.commerce-cart-checkout .open-pvz-btn { background: transparent !important; border: 0 !important; text-align: left; }

:root {
  --theobroma-ink: #2f241e;
  --theobroma-muted: #74675f;
  --theobroma-paper: #fbf8f3;
  --theobroma-line: #e8ded2;
  --theobroma-accent: #9b6a3d;
  --theobroma-accent-dark: #714727;
}

.commerce-cart-checkout .theobroma-delivery-address[hidden] { display: none !important; }
.commerce-cart-checkout .woocommerce-checkout-review-order-table[hidden] { display: none !important; }

.theobroma-delivery-open {
  align-items: center;
  appearance: none;
  background: var(--theobroma-accent-dark);
  border: 1px solid var(--theobroma-accent-dark);
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: 600 .88rem/1.2 'Montserrat', sans-serif;
  justify-content: center;
  margin: 12px 0 0;
  min-height: 40px;
  padding: 9px 16px;
  text-decoration: none;
}
.theobroma-delivery-open:hover { background: #59361f; border-color: #59361f; color: #fff; }

/* The storefront hides the order summary table; expose only its shipping row. */
.commerce-cart-checkout .woocommerce-checkout-review-order-table {
  background: transparent !important;
  border: 0 !important;
  border-collapse: separate !important;
  box-shadow: none !important;
  display: table !important;
  margin: 14px 0 24px;
  width: 100%;
}
.commerce-cart-checkout .woocommerce-checkout-review-order-table > thead,
.commerce-cart-checkout .woocommerce-checkout-review-order-table > tbody,
.commerce-cart-checkout .woocommerce-checkout-review-order-table > tfoot > tr {
  display: none;
}
.commerce-cart-checkout .woocommerce-checkout-review-order-table > tfoot,
.commerce-cart-checkout .woocommerce-checkout-review-order-table > tfoot > .woocommerce-shipping-totals {
  display: table-row-group;
}
.commerce-cart-checkout .woocommerce-checkout-review-order-table > tfoot > .woocommerce-shipping-totals {
  background: transparent;
  color: var(--theobroma-ink);
  min-height: 0;
  position: static;
}
.commerce-cart-checkout .woocommerce-shipping-totals { display: table-row !important; }
.commerce-cart-checkout .woocommerce-shipping-totals > th,
.commerce-cart-checkout .woocommerce-shipping-totals > td {
  border: 0 !important;
  display: block;
  padding: 0 !important;
  text-align: left !important;
}
.commerce-cart-checkout .woocommerce-shipping-totals > th {
  display: none;
}
.commerce-cart-checkout .woocommerce-shipping-methods {
  display: grid;
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0 !important;
}
.commerce-cart-checkout .woocommerce-shipping-methods li {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--theobroma-ink);
  margin: 0 !important;
  padding: 0;
  position: relative;
}
.commerce-cart-checkout .woocommerce-shipping-methods li:has(> input[type="radio"]:checked) {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.commerce-cart-checkout .woocommerce-shipping-methods li > input[type="radio"] {
  accent-color: var(--theobroma-accent-dark);
  height: 18px;
  left: 0;
  margin: 0;
  position: absolute;
  top: 2px;
  width: 18px;
}
.commerce-cart-checkout .woocommerce-shipping-methods li > label {
  color: var(--theobroma-ink) !important;
  display: block !important;
  font: 500 1rem/1.45 'Montserrat', sans-serif !important;
  margin: 0 !important;
}
.commerce-cart-checkout .woocommerce-shipping-methods li:has(> input[type="radio"]) > label { padding-left: 28px; }
.commerce-cart-checkout .woocommerce-shipping-totals span {
  inset: auto;
  position: static;
  width: auto;
  zoom: 1;
}

.commerce-cart-checkout .theobroma-delivery-methods { margin: 2px 0 24px; }
.commerce-cart-checkout .theobroma-delivery-methods .woocommerce-shipping-methods { gap: 0; }
.commerce-cart-checkout .theobroma-delivery-methods .woocommerce-shipping-methods li {
  align-items: center;
  border-bottom: 1px solid var(--theobroma-line);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 0;
}
.commerce-cart-checkout .theobroma-delivery-methods .woocommerce-shipping-methods li > input[type="radio"] {
  flex: 0 0 18px;
  left: auto;
  position: static;
  top: auto;
}
.commerce-cart-checkout .theobroma-delivery-methods .woocommerce-shipping-methods li > label {
  flex: 1 1 180px;
  padding-left: 0;
}
.commerce-cart-checkout .theobroma-delivery-methods .theobroma-delivery-open {
  flex: 0 0 auto;
  margin: 0;
}
.commerce-cart-checkout .theobroma-delivery-methods .theobroma-delivery-open.is-confirmed {
  background: transparent;
  border-color: #c9a681;
  color: var(--theobroma-accent-dark);
}
.commerce-cart-checkout .theobroma-delivery-methods .theobroma-delivery-open.is-confirmed:hover {
  background: #f4eade;
  border-color: var(--theobroma-accent);
  color: var(--theobroma-accent-dark);
}
.theobroma-delivery-selection {
  align-items: flex-start;
  background: #f8f1e7;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(113, 71, 39, .13), 0 2px 8px rgba(67, 42, 25, .05);
  display: flex;
  flex: 0 0 100%;
  gap: 10px;
  order: 3;
  padding: 12px 14px;
}
.theobroma-delivery-selection-check {
  align-items: center;
  background: var(--theobroma-accent-dark);
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  flex: 0 0 22px;
  font: 700 .78rem/1 'Montserrat', sans-serif;
  height: 22px;
  justify-content: center;
  margin-top: 1px;
  width: 22px;
}
.theobroma-delivery-selection-copy { display: grid; gap: 2px; min-width: 0; }
.theobroma-delivery-selection-copy strong { color: var(--theobroma-accent-dark); font-size: .86rem; line-height: 1.35; }
.theobroma-delivery-selection-copy > span { color: var(--theobroma-ink); font-size: .9rem; line-height: 1.4; }
.theobroma-delivery-selection-copy small { color: var(--theobroma-muted); font-size: .82rem; line-height: 1.4; overflow-wrap: anywhere; }

.theobroma-delivery-dialog {
  background: var(--theobroma-paper);
  border: 1px solid rgba(90, 63, 45, .15);
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(46, 30, 21, .25);
  color: var(--theobroma-ink);
  max-height: min(820px, 92vh);
  max-width: 1000px;
  padding: 0;
  width: calc(100% - 32px);
}

.theobroma-delivery-dialog::backdrop {
  background: rgba(31, 24, 20, .55);
  backdrop-filter: blur(3px);
}

.theobroma-delivery-shell { display: flex; flex-direction: column; max-height: inherit; overflow: hidden; }
.theobroma-delivery-content { overflow-y: auto; min-height: 0; padding: 30px; }
.theobroma-delivery-dialog { overflow: hidden; }
.theobroma-delivery-header { align-items: flex-start; display: flex; justify-content: space-between; gap: 24px; }
.theobroma-delivery-header h2 { color: var(--theobroma-ink); font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.15; margin: 0; }
.theobroma-delivery-eyebrow { color: var(--theobroma-accent); font-size: .9rem; font-weight: 650; letter-spacing: 0; margin: 0 0 10px; text-transform: none; }
.theobroma-delivery-close { align-items: center; background: #fff; border: 1px solid var(--theobroma-line); border-radius: 50%; color: var(--theobroma-ink); cursor: pointer; display: inline-flex; flex: 0 0 42px; height: 42px; justify-content: center; padding: 0; position: relative; transition: background-color .18s ease, border-color .18s ease, transform .18s ease; }
.theobroma-delivery-close:hover { background: #f5ece2; border-color: #cbb09a; transform: rotate(3deg); }
.theobroma-delivery-close span,
.theobroma-delivery-search-clear span { display: block; height: 18px; position: relative; width: 18px; }
.theobroma-delivery-close span::before,
.theobroma-delivery-close span::after,
.theobroma-delivery-search-clear span::before,
.theobroma-delivery-search-clear span::after { background: currentColor; border-radius: 999px; content: ''; height: 2px; left: 2px; position: absolute; top: 8px; width: 14px; }
.theobroma-delivery-close span::before,
.theobroma-delivery-search-clear span::before { transform: rotate(45deg); }
.theobroma-delivery-close span::after,
.theobroma-delivery-search-clear span::after { transform: rotate(-45deg); }

.theobroma-delivery-tabs { background: #eee7df; border-radius: 12px; display: grid; gap: 4px; grid-template-columns: 1fr 1fr; margin: 28px 0 26px; padding: 4px; }
.theobroma-delivery-tabs button { background: transparent; border: 0; border-radius: 9px; color: var(--theobroma-muted); cursor: pointer; font: inherit; font-weight: 650; padding: 11px 14px; }
.theobroma-delivery-tabs button[aria-selected="true"] { background: #fff; box-shadow: 0 2px 8px rgba(50, 34, 25, .08); color: var(--theobroma-ink); }

.theobroma-delivery-search { display: block; margin-bottom: 20px; position: relative; }
.theobroma-delivery-search > label,
.theobroma-delivery-fields label > span { color: var(--theobroma-muted); display: block; font-size: .82rem; font-weight: 650; margin-bottom: 8px; }
.theobroma-delivery-search-control { display: block; position: relative; }
.theobroma-delivery-search input,
.theobroma-delivery-fields input { background: #fff; border: 1px solid var(--theobroma-line); border-radius: 10px; box-sizing: border-box; color: var(--theobroma-ink); font: inherit; min-height: 44px; padding: 9px 12px; width: 100%; }
.theobroma-delivery-dialog .theobroma-delivery-fields select {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  padding: 9px 40px 9px 12px;
  border: 1px solid var(--theobroma-line);
  border-radius: 10px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23714727' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px 16px;
  color: var(--theobroma-ink);
  font: inherit;
  line-height: normal;
  cursor: pointer;
}
.theobroma-delivery-search input { padding-right: 48px; }
.theobroma-delivery-search-clear { align-items: center; appearance: none; background: transparent; border: 0; border-radius: 50%; color: var(--theobroma-muted); cursor: pointer; display: inline-flex; height: 34px; justify-content: center; padding: 0; position: absolute; right: 7px; top: 50%; transform: translateY(-50%); width: 34px; }
.theobroma-delivery-search-clear:hover { background: #f4ece3; color: var(--theobroma-accent-dark); }
.theobroma-delivery-search-clear[hidden] { display: none; }
.theobroma-delivery-suggestions { background: #fff; border: 1px solid var(--theobroma-line); border-radius: 12px; box-shadow: 0 16px 38px rgba(46, 30, 21, .16); display: grid; left: 0; margin-top: 7px; max-height: 260px; overflow: auto; padding: 5px; position: absolute; right: 0; z-index: 12; }
.theobroma-delivery-suggestions[hidden] { display: none; }
.theobroma-delivery-suggestions button { background: transparent; border: 0; border-radius: 8px; color: var(--theobroma-ink); cursor: pointer; font: 500 .88rem/1.45 'Montserrat', sans-serif; padding: 10px 12px; text-align: left; }
.theobroma-delivery-suggestions button:hover{ background: #f7f0e7; }

.theobroma-delivery-grid { display: grid; gap: 18px; grid-template-columns: minmax(260px, 2fr) minmax(300px, 3fr); }
.theobroma-delivery-grid:has(.theobroma-delivery-map[hidden]) { grid-template-columns: minmax(0, 1fr); }
.theobroma-delivery-grid:has(.theobroma-delivery-map[hidden]) .theobroma-delivery-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.theobroma-delivery-list { display: grid; gap: 8px; max-height: 390px; overflow: auto; padding-right: 4px; }
.theobroma-delivery-point { background: #fff; border: 1px solid var(--theobroma-line); border-radius: 12px; color: var(--theobroma-ink); cursor: pointer; display: grid; font: inherit; gap: 4px; padding: 13px 14px; text-align: left; }
.theobroma-delivery-point:hover { border-color: #c8aa8e; }
.theobroma-delivery-point[aria-pressed="true"] { background: #f4eade; border-color: var(--theobroma-accent); box-shadow: inset 3px 0 0 var(--theobroma-accent); }
.theobroma-delivery-point span { color: var(--theobroma-muted); font-size: .9rem; }
.theobroma-delivery-point small { color: #8c7f76; }
.theobroma-delivery-map { position:relative; z-index:0; isolation:isolate; border-radius: 14px; min-height: 390px; overflow: hidden; }
.theobroma-delivery-fields { position:relative; z-index:3; }
.theobroma-delivery-search { z-index:2; }
.theobroma-delivery-content { isolation:isolate; }
.theobroma-delivery-dialog { max-height:min(820px,92dvh); }
@media (max-width:720px) { .theobroma-delivery-dialog { max-height:94dvh; } }
/* Leaflet attribution is kept in the DOM for license compliance, but does not compete with the map UI. */
.leaflet-control-attribution.leaflet-control { display: none; }
.theobroma-delivery-empty { color: var(--theobroma-muted); padding: 24px 10px; }

.theobroma-delivery-fields { display: grid; gap: 18px 16px; grid-template-columns: 1fr 1fr; }
.theobroma-delivery-fields .wide { grid-column: 1 / -1; }
.theobroma-delivery-status { color: var(--theobroma-muted); min-height: 1.5em; margin: 20px 0 0; }
.theobroma-delivery-status.is-error { color: #a23f35; }
.theobroma-delivery-footer { border-top: 1px solid var(--theobroma-line); background: var(--theobroma-paper); display: flex; align-items: center; gap: 16px; flex-shrink: 0; padding: 16px 30px; }
.theobroma-delivery-footer .theobroma-delivery-status { flex: 1; margin: 0; font-size: .88rem; overflow-wrap: anywhere; }
.theobroma-delivery-footer .button { flex-shrink: 0; }
.theobroma-delivery-footer .button[data-delivery-confirm] { background: var(--theobroma-accent-dark) !important; border: 1px solid var(--theobroma-accent-dark) !important; border-radius: 10px; box-shadow: none; color: #fff !important; font: 650 .9rem/1.2 'Montserrat', sans-serif; min-height: 46px; padding-inline: 24px; transition: background-color .18s ease, border-color .18s ease, transform .18s ease; }
.theobroma-delivery-footer .button[data-delivery-confirm]:hover { background: #59361f !important; border-color: #59361f !important; transform: translateY(-1px); }
.theobroma-delivery-footer .button[data-delivery-confirm]:disabled { cursor: wait; opacity: .65; transform: none; }

@media (max-width: 720px) {
  .theobroma-delivery-dialog { border-radius: 18px 18px 0 0; margin: auto 0 0; max-height: 94vh; max-height: 94dvh; width: 100%; }
  .theobroma-delivery-content { padding: 20px 16px; }
  .theobroma-delivery-footer { padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); flex-direction: column; align-items: stretch; gap: 8px; }
  .theobroma-delivery-footer .theobroma-delivery-status { max-height: 4.2em; overflow: auto; }
  .theobroma-delivery-grid { grid-template-columns: 1fr; }
  .theobroma-delivery-map { min-height: 260px; order: -1; }
  .theobroma-delivery-list { max-height: 300px; }
  .theobroma-delivery-grid:has(.theobroma-delivery-map[hidden]) .theobroma-delivery-list { grid-template-columns: 1fr; }
  .commerce-cart-checkout .theobroma-delivery-methods .theobroma-delivery-open { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .theobroma-delivery-dialog::backdrop { backdrop-filter: none; }
}
