.com-order-editor {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 1rem;
  font-family: inherit;
}

.com-order-editor[hidden] {
  display: none !important;
}

.com-order-editor *,
.com-order-editor *::before,
.com-order-editor *::after {
  box-sizing: border-box;
}

.com-order-editor-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
}

.com-order-editor-dialog {
  position: relative;
  width: min(100%, 700px);
  max-height: min(92vh, 880px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

.com-order-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid #e8edf3;
}

.com-order-editor-head h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  color: #0f172a;
}

.com-order-editor-close {
  border: 0;
  background: #f1f5f9;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
}

.com-order-editor-body {
  overflow: auto;
  padding: 1rem 1.35rem 1.25rem;
  background: #f4f7fb;
}

.com-order-editor-foot {
  display: grid;
  gap: 0.75rem;
  padding: 1rem 1.35rem 1.15rem;
  border-top: 1px solid #e8edf3;
  background: #fff;
}

.com-order-editor-note {
  display: grid;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #64748b;
}

.com-order-editor-note-input,
.com-order-editor-select {
  width: 100%;
  border: 1px solid #d7e0ea;
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  font: inherit;
  background: #fff;
  color: #0f172a;
}

.com-order-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.com-order-editor-btn {
  border: 0;
  border-radius: 12px;
  padding: 0.65rem 1.05rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.com-order-editor-btn--primary {
  background: #ff8500;
  color: #fff;
}

.com-order-editor-btn--ghost {
  background: #fff;
  border: 1px solid #d7e0ea;
  color: #334155;
}

.com-order-editor-btn--danger {
  background: #fef2f2;
  color: #b91c1c;
  margin-right: auto;
}

.com-order-editor-items {
  display: grid;
  gap: 0.85rem;
}

.com-order-editor-item {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1rem;
  background: #fff;
}

.com-order-editor-item-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.75rem;
  align-items: center;
}

.com-order-editor-item-name {
  display: block;
  font-size: 1rem;
  color: #0f172a;
}

.com-order-editor-item-cat {
  display: block;
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 0.15rem;
}

.com-order-editor-qty {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.15rem;
}

.com-order-editor-qty-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 700;
  color: #334155;
  line-height: 1;
}

.com-order-editor-qty-btn:hover {
  background: #fff7ed;
  color: #c2410c;
}

.com-order-editor-qty-value {
  min-width: 2.2rem;
  text-align: center;
  font-weight: 800;
  font-size: 0.88rem;
  color: #0f172a;
}

.com-order-editor-remove-item {
  border: 0;
  background: transparent;
  color: #dc2626;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
}

.com-order-editor-unit-select {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.85rem;
}

.com-order-editor-unit-select label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #64748b;
}

.com-order-editor-tabs {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.com-order-editor-tab {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.62rem 0.75rem;
  background: #f8fafc;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
}

.com-order-editor-tab.is-active {
  background: #fff7ed;
  border-color: #fdba74;
  color: #c2410c;
}

.com-order-editor-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  margin-left: 0.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  font-size: 0.72rem;
}

.com-order-editor-tab.is-active .com-order-editor-tab-count {
  background: #ffedd5;
}

.com-order-editor-section {
  margin-top: 0.65rem;
  padding: 0.75rem;
  border: 1px solid #e8edf3;
  border-radius: 14px;
  background: #fafbfd;
}

.com-order-editor-checks {
  display: grid;
  gap: 0.45rem;
}

.com-order-editor-check {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}

.com-order-editor-check input {
  width: 18px;
  height: 18px;
  accent-color: #ff8500;
  margin: 0;
}

.com-order-editor-check-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
}

.com-order-editor-check-price {
  font-size: 0.78rem;
  font-weight: 700;
  color: #c2410c;
}

.com-order-editor-check--supp.is-active {
  border-color: #fdba74;
  background: #fff7ed;
}

.com-order-editor-check--ing.is-included {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.com-order-editor-check--ing.is-excluded {
  border-color: #fecaca;
  background: #fef2f2;
}

.com-order-editor-check--ing.is-excluded .com-order-editor-check-label {
  text-decoration: line-through;
  color: #94a3b8;
}

.com-order-editor-check-state {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.com-order-editor-check--ing.is-excluded .com-order-editor-check-state {
  color: #dc2626;
}

.com-order-editor-empty {
  margin: 0;
  font-size: 0.84rem;
  color: #94a3b8;
  text-align: center;
  padding: 0.5rem;
}

.com-order-editor-add-product {
  display: grid;
  gap: 0.4rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed #dbe4f0;
}

.com-order-editor-add-product label {
  font-size: 0.82rem;
  font-weight: 800;
  color: #334155;
}

.com-order-editor-loading {
  margin: 0;
  color: #64748b;
}

body.com-order-editor-open {
  overflow: hidden;
}

.com-order-card-actions {
  display: flex;
  gap: 0.45rem;
  padding: 0.65rem 0.85rem 0.85rem;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.com-order-card-action {
  border: 0;
  border-radius: 999px;
  padding: 0.42rem 0.8rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.com-order-card-action--edit {
  background: #eff6ff;
  color: #1d4ed8;
}

.com-order-card-action--delete {
  background: #fee2e2;
  color: #b91c1c;
}

.com-order-changelog {
  margin-top: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.com-order-changelog-title {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.com-order-changelog-entry {
  font-size: 0.78rem;
  color: #334155;
  padding: 0.35rem 0;
  border-top: 1px solid #e5e7eb;
}

.com-order-changelog-entry:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.com-order-card.is-cancelled {
  opacity: 0.72;
}
