.xch-app {
  --dark: #132a40;
  --line: #d6e1eb;
  --muted: #62758a;
  color: var(--dark);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  width: 100%;
  max-width: none;
  container-type: inline-size;
  margin: 18px 0;
  overflow: hidden;
  border: 1px solid #d5e0ea;
  border-radius: 12px;
  background: #f2f6fa;
  box-shadow: 0 8px 28px #12314b12;
}
.xch-app * { box-sizing: border-box; }
.xch-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  color: #fff;
  background: linear-gradient(105deg, #104a82, #1c6bad);
}
.xch-top > div:first-child { display: flex; align-items: center; gap: 18px; min-width: 220px; }
.xch-top strong { font-size: 20px; white-space: nowrap; }
.xch-top strong small { font-size: 10px; font-weight: 500; opacity: .75; }
.xch-top > div:first-child span { opacity: .82; }
.xch-top-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.xch-app button, .xch-app select, .xch-app input, .xch-app a.xch-auth { font: inherit; }
.xch-app button, .xch-app select, .xch-auth {
  padding: 8px 11px;
  border: 1px solid #cad8e5;
  border-radius: 7px;
  color: #17334d;
  background: #fff;
  cursor: pointer;
  text-decoration: none;
}
.xch-app button:hover, .xch-auth:hover { border-color: #2b78bd; color: #0d5b9e; }
.xch-app button:disabled { opacity: .5; cursor: not-allowed; }
.xch-container { min-width: 175px; }
.xch-pack-mode { min-width: 170px; }
.xch-top .xch-auto { color: #075a9d; background: #eaf4ff; border-color: #bed8f2; font-weight: 650; }
.xch-top .xch-save { color: #fff; background: #168443; border-color: #168443; font-weight: 650; }
.xch-layout { display: grid; grid-template-columns: minmax(220px, 270px) minmax(420px, 1fr) minmax(210px, 265px); min-height: 680px; }
.xch-panel { padding: 16px; overflow: auto; border-right: 1px solid var(--line); background: #fff; }
.xch-details { border-right: 0; border-left: 1px solid var(--line); }
.xch-panel h2 { margin: 0 0 6px; font-size: 17px; }
.xch-panel h3 { margin: 22px 0 10px; font-size: 15px; }
.xch-help { margin: 0 0 14px; color: var(--muted); font-size: 12px; }
.xch-order-priority { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 12px; color: #284760; font-size: 12px; }
.xch-order-priority input { width: auto; flex: none; margin: 2px 0 0; }
.xch-product { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #e8eef4; }
.xch-product[draggable="true"] { cursor: grab; }
.xch-product.is-dragging { opacity: .42; }
.xch-drag-handle { flex: none; color: #8296a8; cursor: grab; font-size: 19px; line-height: 1; }
.xch-swatch { width: 29px; height: 29px; flex: none; border: 1px solid #afbecb; border-radius: 5px; box-shadow: inset 0 0 0 3px #ffffff70; }
.xch-product-info { min-width: 0; flex: 1; }
.xch-product-info strong, .xch-product-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xch-product-info strong { font-size: 13px; }
.xch-product-info small { color: var(--muted); font-size: 11px; }
.xch-place { padding: 6px 7px !important; font-size: 11px !important; white-space: nowrap; }
.xch-edit { padding: 6px 7px !important; font-size: 11px !important; }
.xch-add { width: 100%; margin-top: 12px; color: #fff !important; background: #0e65b5 !important; border-color: #0e65b5 !important; font-weight: 650 !important; }
.xch-stage { display: flex; min-width: 0; flex-direction: column; background: #eaf1f8; }
.xch-stage-title { display: flex; flex-direction: column; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); background: #fff; }
.xch-stage-title strong { font-size: 16px; }
.xch-stage-title span { color: var(--muted); font-size: 12px; }
.xch-canvas { position: relative; height: 540px; min-height: 380px; touch-action: none; }
.xch-canvas canvas { display: block; width: 100%; height: 100%; cursor: grab; outline: none; }
.xch-canvas canvas:active { cursor: grabbing; }
.xch-controls { display: flex; flex-wrap: wrap; gap: 7px; padding: 10px 12px; border-top: 1px solid var(--line); background: #fff; }
.xch-controls button { padding: 7px 9px; font-size: 12px; }
.xch-controls button.active { color: #fff; background: #0e65b5; border-color: #0e65b5; }
.xch-status { min-height: 36px; padding: 8px 13px; color: #285675; background: #f4f9fd; border-top: 1px solid #e1eaf2; font-size: 12px; }
.xch-status[data-kind="error"] { color: #9a2635; background: #fff2f3; }
.xch-pack-progress { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid #e1eaf2; background: #fff; font-size: 12px; }
.xch-pack-progress[hidden] { display: none; }
.xch-pack-progress progress { width: min(220px, 35%); height: 10px; accent-color: #168443; }
.xch-pack-progress span { flex: 1; color: var(--muted); }
.xch-pack-cancel { padding: 5px 9px !important; color: #9a2635 !important; border-color: #e7bcc1 !important; }
.xch-app.is-packing .xch-canvas { pointer-events: none; }
.xch-details label { display: block; margin: 12px 0; font-size: 12px; font-weight: 650; }
.xch-details input { display: block; width: 100%; margin-top: 5px; padding: 8px; border: 1px solid #cbd8e4; border-radius: 6px; }
.xch-selected { min-height: 42px; padding: 11px; border: 1px solid #e1e9f0; border-radius: 7px; background: #f3f7fb; font-size: 12px; }
.xch-summary { margin-top: 16px; }
.xch-stat { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0; font-size: 12px; }
.xch-stat span, .xch-summary small { color: var(--muted); }
.xch-stat strong { font-size: 13px; }
.xch-progress { height: 8px; overflow: hidden; border-radius: 9px; background: #e4edf4; }
.xch-progress i { display: block; height: 100%; border-radius: 9px; background: #1ba05b; }
.xch-project-link { display: block; width: 100%; margin: 5px 0; overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; font-size: 12px !important; }
.xch-projects { color: var(--muted); font-size: 12px; }
.xch-summary small { font-size: 11px; }
.xch-app :focus-visible { outline: 2px solid #2484d2; outline-offset: 2px; }
.xch-product-dialog { width: min(440px, calc(100vw - 28px)); max-height: calc(100vh - 28px); padding: 0; overflow: auto; border: 1px solid #cbd8e4; border-radius: 12px; color: var(--dark); box-shadow: 0 18px 60px #102f4b40; }
.xch-product-dialog::backdrop { background: #10243c80; }
.xch-product-edit-form { padding: 22px; }
.xch-product-edit-form h2 { margin: 0 0 16px; font-size: 19px; }
.xch-product-edit-form label { display: block; margin: 12px 0; font-size: 12px; font-weight: 650; }
.xch-product-edit-form input { display: block; width: 100%; margin-top: 5px; padding: 9px 10px; border: 1px solid #cbd8e4; border-radius: 6px; font: inherit; }
.xch-product-edit-form .xch-color-field input[type="color"] { height: 42px; padding: 4px; cursor: pointer; }
.xch-edit-dimensions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.xch-edit-note { color: var(--muted); font-size: 12px; }
.xch-edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.xch-edit-confirm { color: #fff !important; background: #0e65b5 !important; border-color: #0e65b5 !important; }
@container (max-width: 1050px) {
  .xch-layout { grid-template-columns: 220px minmax(0, 1fr); }
  .xch-details { display: grid; grid-column: 1 / -1; grid-template-columns: 1fr 1fr; gap: 10px; border-top: 1px solid var(--line); border-left: 0; }
  .xch-details h2 { grid-column: 1 / -1; }
  .xch-details label { margin: 0; }
  .xch-summary { margin-top: 0; }
  .xch-canvas { height: 500px; }
}
@container (max-width: 680px) {
  .xch-app { margin: 8px 0; border-radius: 7px; }
  .xch-top { align-items: flex-start; flex-direction: column; }
  .xch-top > div:first-child { display: block; }
  .xch-top > div:first-child span { display: block; font-size: 12px; }
  .xch-top-actions { width: 100%; }
  .xch-layout { display: flex; flex-direction: column; }
  .xch-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .xch-stage { order: -1; }
  .xch-canvas { height: 390px; min-height: 340px; }
  .xch-details { display: block; }
  .xch-details label { margin: 12px 0; }
  .xch-details h2 { margin-bottom: 8px; }
  .xch-pack-progress { flex-wrap: wrap; }
  .xch-pack-progress progress { width: 100%; }
}
