/* ============================================================
   V9 cart-in-dock. The cart's legacy DOM (cart-items / cart-footer / rows /
   method picker / splits) renders inside the workspace dock now — this bridge
   re-skins it to obsidian and re-lays it for the dock width. On phone the dock
   is already full-screen, so the cart gets the whole screen (fixes the old
   cramped drawer). Scoped under .v9-cart-panel; dies with the legacy cart CSS
   in Stage C.
   ============================================================ */

/* Single-scroll: the dock body scrolls the whole cart. The panel min-fills the
   body so items flex-grow to push the footer to the bottom when the cart is
   short; when it's long, the body scrolls (the cart's own footer can exceed a
   phone viewport, so a pinned footer would starve the items). */
.v9-cart-panel {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  font-family: var(--v9-font-ui);
  color: var(--v9-text);
}
.v9-cart-head { flex: 0 0 auto; padding: var(--v9-space-2) var(--v9-space-3) 0; }
.v9-cart-head .t-eyebrow {
  font: 500 var(--v9-text-xs) var(--v9-font-mono);
  letter-spacing: var(--v9-track-eyebrow);
  text-transform: uppercase;
  color: var(--v9-text-faint);
}
.v9-cart-panel .cart-addendum-banner {
  flex: 0 0 auto;
  margin: var(--v9-space-2) var(--v9-space-3) 0;
  padding: var(--v9-space-2) var(--v9-space-3);
  display: flex;
  align-items: center;
  gap: var(--v9-space-3);
  border: 1px solid color-mix(in srgb, var(--v9-warn) 45%, var(--v9-line));
  border-left: 3px solid var(--v9-warn);
  border-radius: var(--v9-r-sm);
  background: color-mix(in srgb, var(--v9-warn) 6%, var(--v9-surface));
}
.v9-cart-panel .cart-addendum-copy { font-size: var(--v9-text-sm); color: var(--v9-text-mute); }
.v9-cart-panel .cart-addendum-cancel {
  margin-left: auto; flex: 0 0 auto;
  background: transparent; border: 1px solid var(--v9-line-strong);
  color: var(--v9-text); border-radius: var(--v9-r-sm);
  padding: 0.2rem 0.6rem; font: 500 var(--v9-text-xs) var(--v9-font-ui); cursor: pointer;
}

/* ---------- items ---------- */
.v9-cart-panel .cart-items {
  flex: 1 1 auto;       /* grow to push footer down when the cart is short */
  padding: var(--v9-space-2) var(--v9-space-3);
}
.v9-cart-panel .cart-item-row {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr) auto;
  grid-template-areas:
    "art info remove"
    "art qty  total";
  gap: 0.25rem var(--v9-space-3);
  align-items: center;
  padding: var(--v9-space-3) 0;
  border-bottom: 1px solid var(--v9-line);
}
.v9-cart-panel .cart-item-art {
  grid-area: art;
  width: 2.6rem; height: 3.4rem;
  border-radius: var(--v9-r-sm);
  overflow: hidden; background: var(--v9-raised);
}
.v9-cart-panel .cart-item-art img { width: 100%; height: 100%; object-fit: cover; }
.v9-cart-panel .cart-item-info { grid-area: info; min-width: 0; display: grid; gap: 2px; }
.v9-cart-panel .cart-item-name {
  font: 500 var(--v9-text-sm) var(--v9-font-ui); color: var(--v9-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.v9-cart-panel .cart-item-code {
  font: 500 var(--v9-text-xs) var(--v9-font-mono); color: var(--v9-text-faint);
}
/* Per-line unit price stays editable (booth price negotiation). Compact. */
.v9-cart-panel .cart-item-price {
  display: flex; align-items: center; gap: var(--v9-space-2);
  font-size: var(--v9-text-xs); color: var(--v9-text-faint);
}
.v9-cart-panel .cart-item-price > span { white-space: nowrap; }
.v9-cart-panel .cart-line-price-input {
  width: 5rem; min-height: 1.6rem; padding: 0 0.4rem;
  border: 1px solid var(--v9-line-strong); border-radius: var(--v9-r-sm);
  background: var(--v9-bg); color: var(--v9-text);
  font: 500 var(--v9-text-xs) var(--v9-font-mono);
}
.v9-cart-panel .cart-line-price-input:focus-visible {
  outline: none; border-color: var(--v9-accent); box-shadow: var(--v9-focus-glow);
}
.v9-cart-panel .cart-item-qty {
  grid-area: qty;
  display: inline-flex; align-items: center; gap: var(--v9-space-1);
}
.v9-cart-panel .cart-item-qty .btn {
  width: 1.5rem; height: 1.5rem; min-height: 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--v9-line-strong); border-radius: var(--v9-r-sm);
  background: transparent; color: var(--v9-text); font-size: 0.9rem;
}
.v9-cart-panel .cart-item-qty .btn:hover { background: var(--v9-hover); }
.v9-cart-panel .cart-item-qty-value {
  min-width: 1.4rem; text-align: center;
  font: 500 var(--v9-text-sm) var(--v9-font-mono);
}
.v9-cart-panel .cart-item-total {
  grid-area: total; justify-self: end;
  font: 600 var(--v9-text-sm) var(--v9-font-mono); color: var(--v9-text);
}
.v9-cart-panel .cart-item-remove {
  grid-area: remove; justify-self: end;
  width: 1.5rem; height: 1.5rem; min-height: 0; padding: 0;
  background: transparent; border: 0; color: var(--v9-text-faint);
  font-size: 1rem; cursor: pointer; border-radius: var(--v9-r-sm);
}
.v9-cart-panel .cart-item-remove:hover { color: var(--v9-neg); background: var(--v9-hover); }

/* ---------- footer (totals + method + checkout) ---------- */
.v9-cart-panel .cart-footer {
  flex: 0 0 auto;
  padding: var(--v9-space-3);
  border-top: 1px solid var(--v9-line);
  background: var(--v9-surface);
  display: grid;
  gap: var(--v9-space-2);
}
.v9-cart-panel .cart-mode-helper {
  margin: 0; font-size: var(--v9-text-xs); color: var(--v9-text-faint);
}
.v9-cart-panel .cart-totals-row {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: var(--v9-text-sm); color: var(--v9-text-mute);
}
.v9-cart-panel .cart-totals-row span:last-child { font-family: var(--v9-font-mono); color: var(--v9-text); }
.v9-cart-panel .cart-totals-row.strong {
  font-weight: 600; color: var(--v9-text); font-size: var(--v9-text-md);
  padding-top: var(--v9-space-2); border-top: 1px solid var(--v9-line);
}
.v9-cart-panel .cart-totals-row.strong span:last-child { color: var(--v9-accent); }
.v9-cart-panel .input {
  min-height: 2rem; padding: 0 var(--v9-space-2);
  border: 1px solid var(--v9-line-strong); border-radius: var(--v9-r-sm);
  background: var(--v9-bg); color: var(--v9-text);
  font: 400 var(--v9-text-sm) var(--v9-font-ui);
}
.v9-cart-panel .input:focus-visible { outline: none; border-color: var(--v9-accent); box-shadow: var(--v9-focus-glow); }
.v9-cart-panel .cart-agreed-total-group label { font-size: var(--v9-text-xs); color: var(--v9-text-faint); }
.v9-cart-panel .cart-agreed-total-control { display: flex; gap: var(--v9-space-2); }
.v9-cart-panel .cart-agreed-total-control .input { flex: 1; }
.v9-cart-panel .cart-agreed-reset {
  flex: 0 0 auto; background: transparent; border: 1px solid var(--v9-line-strong);
  color: var(--v9-text); border-radius: var(--v9-r-sm); padding: 0 0.7rem; cursor: pointer;
  font: 500 var(--v9-text-xs) var(--v9-font-ui);
}
.v9-cart-panel .cart-agreed-reset:disabled { opacity: 0.4; cursor: default; }
.v9-cart-panel .cart-test-toggle {
  display: flex; align-items: center; gap: var(--v9-space-2);
  font-size: var(--v9-text-sm); color: var(--v9-text-mute);
}

/* method picker */
.v9-cart-panel .checkout-method-picker { display: grid; gap: var(--v9-space-2); }
.v9-cart-panel .checkout-method-picker-label {
  font: 500 var(--v9-text-xs) var(--v9-font-mono); letter-spacing: var(--v9-track-eyebrow);
  text-transform: uppercase; color: var(--v9-text-faint);
}
.v9-cart-panel .checkout-method-options { display: flex; flex-wrap: wrap; gap: var(--v9-space-2); }
.v9-cart-panel .checkout-method-option {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.7rem; border: 1px solid var(--v9-line-strong);
  border-radius: var(--v9-r-pill); background: transparent;
  color: var(--v9-text-mute); font: 500 var(--v9-text-sm) var(--v9-font-ui); cursor: pointer;
}
.v9-cart-panel .checkout-method-option.is-selected {
  border-color: var(--v9-accent); color: var(--v9-accent);
  background: color-mix(in srgb, var(--v9-accent) 8%, transparent);
}
.v9-cart-panel .checkout-method-option input { accent-color: var(--v9-accent); }
.v9-cart-panel .test-mode-tag {
  font: 600 0.6rem var(--v9-font-mono); text-transform: uppercase;
  color: var(--v9-warn); border: 1px solid color-mix(in srgb, var(--v9-warn) 45%, transparent);
  border-radius: var(--v9-r-pill); padding: 0 0.35rem;
}

/* split payments */
.v9-cart-panel .cart-split-head { display: flex; justify-content: space-between; align-items: baseline; }
.v9-cart-panel .cart-split-summary.tone-warning { color: var(--v9-warn); }
.v9-cart-panel .cart-split-summary.tone-positive { color: var(--v9-pos); }
.v9-cart-panel .cart-split-paid { font-size: var(--v9-text-xs); color: var(--v9-text-faint); }
.v9-cart-panel .cart-split-payments .input,
.v9-cart-panel .cart-split-payments select { font-size: var(--v9-text-sm); }

/* THE checkout button — the one yellow action in the cart. */
.v9-cart-panel .cart-footer .btn-primary {
  width: 100%; margin-top: var(--v9-space-2) !important;
  min-height: 2.4rem; border: 0; border-radius: var(--v9-r-sm);
  background: var(--v9-accent); color: var(--v9-accent-ink);
  font: 600 var(--v9-text-md) var(--v9-font-ui); cursor: pointer;
}
.v9-cart-panel .cart-footer .btn-primary:hover { background: var(--v9-accent-press); }
.v9-cart-panel .cart-footer .btn-primary:disabled { opacity: 0.45; cursor: default; }

/* empty state */
.v9-cart-panel .cart-items > p,
.v9-cart-panel .cart-empty {
  color: var(--v9-text-mute) !important;
  font-size: var(--v9-text-sm);
  padding: var(--v9-space-12) var(--v9-space-4);
  text-align: center;
}

/* ============================================================
   Calm-summary footer (2026-06-13): compact selectors + reveals.
   Footer is a flex column; closed v9-collapse bodies are ~0px so they
   don't add visual weight. (v9-collapse-body animates via motion.css.)
   ============================================================ */
.v9-cart-panel .cart-footer { display: flex; flex-direction: column; gap: var(--v9-space-3); }

/* ---- payment selector ---- */
.v9-cart-panel .cart-pay-trigger {
  display: flex; align-items: center; gap: var(--v9-space-2);
  width: 100%; padding: var(--v9-space-2) var(--v9-space-3);
  border: 1px solid var(--v9-line-strong); border-radius: var(--v9-r-sm);
  background: var(--v9-bg); color: var(--v9-text); cursor: pointer;
  font: 500 var(--v9-text-sm) var(--v9-font-ui);
}
.v9-cart-panel .cart-pay-trigger:hover { background: var(--v9-hover); }
.v9-cart-panel .cart-pay-pre {
  font: 500 var(--v9-text-xs) var(--v9-font-mono); letter-spacing: var(--v9-track-eyebrow);
  text-transform: uppercase; color: var(--v9-text-faint);
}
.v9-cart-panel .cart-pay-value { font-weight: 600; color: var(--v9-text); }
.v9-cart-panel .cart-pay-chevron {
  margin-left: auto; color: var(--v9-text-faint);
  transition: transform var(--v9-t-std) var(--v9-ease);
}
.v9-cart-panel .cart-pay-trigger.is-open .cart-pay-chevron { transform: rotate(90deg); color: var(--v9-accent); }
.v9-cart-panel .cart-pay-options-inner { padding-top: var(--v9-space-2); }
/* the picker's own "Customer pays with" label is redundant under the trigger */
.v9-cart-panel .cart-pay-options .checkout-method-picker-label { display: none; }

/* ---- split reveal ---- */
.v9-cart-panel .cart-split-inner { padding-top: var(--v9-space-2); }

/* ---- totals + inline haggle ---- */
.v9-cart-panel .cart-totals-area { display: grid; gap: var(--v9-space-1); }
.v9-cart-panel .cart-subtotal-line {
  display: flex; align-items: baseline; gap: var(--v9-space-2);
  font-size: var(--v9-text-xs); color: var(--v9-text-faint);
}
.v9-cart-panel .cart-subtotal-line > span:first-child {
  text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--v9-font-mono);
}
.v9-cart-panel .cart-subtotal-adj { margin-left: auto; color: var(--v9-warn); font-family: var(--v9-font-mono); }
.v9-cart-panel .cart-total-row { display: flex; align-items: baseline; gap: var(--v9-space-3); }
.v9-cart-panel .cart-total-label {
  font: 500 var(--v9-text-xs) var(--v9-font-mono); letter-spacing: var(--v9-track-eyebrow);
  text-transform: uppercase; color: var(--v9-text-faint);
}
.v9-cart-panel .cart-total-row > span:not(.cart-total-label) {
  font: 600 var(--v9-text-lg) var(--v9-font-mono);
  color: var(--v9-accent); font-variant-numeric: tabular-nums;
}
.v9-cart-panel .cart-adjust-toggle {
  margin-left: auto; background: transparent; border: 0; cursor: pointer;
  color: var(--v9-text-mute); font: 500 var(--v9-text-sm) var(--v9-font-ui);
  text-decoration: underline; text-underline-offset: 3px;
}
.v9-cart-panel .cart-adjust-toggle:hover,
.v9-cart-panel .cart-adjust-toggle.is-open { color: var(--v9-accent); }
.v9-cart-panel .cart-adjust-inner { padding-top: var(--v9-space-2); display: grid; gap: var(--v9-space-1); }
.v9-cart-panel .cart-adjust-label {
  font: 500 var(--v9-text-xs) var(--v9-font-mono); letter-spacing: var(--v9-track-eyebrow);
  text-transform: uppercase; color: var(--v9-text-faint);
}

/* ---- more options disclosure ---- */
.v9-cart-panel .cart-more-toggle {
  display: flex; align-items: center; gap: var(--v9-space-2);
  background: transparent; border: 0; color: var(--v9-text-mute); cursor: pointer;
  padding: var(--v9-space-1) 0; font: 500 var(--v9-text-sm) var(--v9-font-ui);
}
.v9-cart-panel .cart-more-toggle:hover { color: var(--v9-text); }
.v9-cart-panel .cart-more-chevron { color: var(--v9-text-faint); transition: transform var(--v9-t-std) var(--v9-ease); }
.v9-cart-panel .cart-more-toggle.is-open .cart-more-chevron { transform: rotate(90deg); color: var(--v9-accent); }
.v9-cart-panel .cart-more-inner { padding-top: var(--v9-space-2); }
