.text-order-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(73, 157, 255, .42);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(22, 119, 255, .13), rgba(255, 255, 255, .025));
}

.text-order-head,
.text-order-export-bar,
.text-order-controls,
.text-order-price-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.text-order-head > div:first-child > span {
  display: inline-flex;
  margin-bottom: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 10px;
  font-weight: 900;
}

.text-order-head strong {
  display: block;
  color: var(--text-strong);
  font-size: 16px;
  font-weight: 900;
}

.text-order-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

.text-order-actions,
.text-order-export-bar > div {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.text-order-controls {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.text-order-controls label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.text-order-controls select {
  min-height: 34px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-solid);
  font: inherit;
}

.text-order-ledger-count {
  margin-left: auto;
  color: var(--primary);
  font-size: 12px;
  font-weight: 850;
}

.text-order-input {
  width: 100%;
  min-height: 178px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  background: rgba(2, 8, 18, .28);
  font: 500 13px/1.6 "Microsoft YaHei", sans-serif;
  resize: vertical;
  outline: none;
}

.text-order-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

body.theme-light .text-order-input {
  background: #fff;
}

.text-order-empty {
  display: grid;
  gap: 4px;
  min-height: 78px;
  place-content: center;
  text-align: center;
  color: var(--muted);
}

.text-order-empty strong {
  color: var(--text-strong);
  font-size: 14px;
}

.text-order-empty span {
  font-size: 12px;
}

.text-order-summary {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 8px;
}

.text-order-summary > div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, .035);
}

.text-order-summary span,
.text-order-summary strong {
  display: block;
}

.text-order-summary span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.text-order-summary strong {
  margin-top: 4px;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-order-price-line {
  justify-content: flex-start;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.text-order-status,
.text-order-issues span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
}

.text-order-status.is-ready {
  color: #3ddc97;
  background: rgba(61, 220, 151, .13);
}

.text-order-status.is-review,
.text-order-issues span {
  color: #ffb84d;
  background: rgba(255, 184, 77, .13);
}

.text-order-issues {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.text-order-error {
  padding: 9px 10px;
  border: 1px solid rgba(255, 92, 115, .35);
  border-radius: 8px;
  color: #ff8295;
  background: rgba(255, 92, 115, .09);
  font-size: 12px;
  font-weight: 800;
}

.text-order-preview-wrap {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
}

.text-order-preview {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.text-order-preview th,
.text-order-preview td {
  max-width: 180px;
  padding: 7px 9px;
  border-right: 1px solid var(--border);
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-order-preview th {
  position: sticky;
  top: 0;
  color: #fff;
  background: #1677ff;
  font-weight: 850;
}

.text-order-preview td {
  color: var(--text);
  background: rgba(255, 255, 255, .025);
}

.text-order-export-bar {
  padding-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 760px) {
  .text-order-head,
  .text-order-export-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .text-order-actions,
  .text-order-export-bar > div {
    width: 100%;
  }

  .text-order-actions button,
  .text-order-export-bar button {
    flex: 1 1 0;
    justify-content: center;
  }

  .text-order-summary {
    grid-template-columns: 1fr 1fr;
  }

  .text-order-ledger-count {
    width: 100%;
    margin-left: 0;
  }
}
