/*
 * B01 Orders Page — 搜索栏 + 左右布局 + 订单卡片
 */

/* ===================================================================
   容器 & 顶栏（sticky 固定）
   =================================================================== */

.admin-orders-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.orders-toolbar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: 26px;
  padding: 16px 22px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  flex-shrink: 0;
  margin-bottom: 20px;
}

.orders-search-box {
  flex: 2;
  min-width: 0;
}

.orders-search-input {
  width: 100%;
  height: 40px;
  padding: 0 18px;
  border: 1px solid #e5e5ea;
  border-radius: 12px;
  font-size: 14px;
  color: #25372f;
  background: #fff;
  outline: none;
  box-sizing: border-box;
}

.orders-search-input::placeholder {
  color: #aeaeb2;
}

.orders-search-input:focus {
  border-color: #c7c7cc;
}

.orders-filter-wrap {
  flex-shrink: 0;
}

.orders-filter-select {
  appearance: none;
  -webkit-appearance: none;
  height: 40px;
  padding: 0 32px 0 14px;
  border: 1px solid #e5e5ea;
  border-radius: 12px;
  font-size: 13px;
  color: #455c4e;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 12px center;
  background-size: 12px 12px;
  cursor: pointer;
  outline: none;
  white-space: nowrap;
  box-sizing: border-box;
}

.orders-filter-select:focus {
  border-color: #c7c7cc;
}

.orders-refresh-btn {
  height: 40px;
  padding: 0 24px;
  border: none;
  border-radius: 12px;
  background: #355944;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 40px;
}

.orders-refresh-btn:active {
  opacity: 0.85;
}

.orders-markall-btn {
  height: 40px;
  padding: 0 20px;
  border: 1px solid #d2d2d7;
  border-radius: 12px;
  background: #f4f7f3;
  color: #25372f;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 38px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.orders-markall-btn:hover {
  background: #fff;
  border-color: #a0a0a5;
}

.orders-markall-btn:active {
  opacity: 0.85;
}

.orders-markall-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ===================================================================
   左右主布局
   =================================================================== */

.orders-main-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr);
  gap: 24px;
  min-height: 0;
  overflow: hidden;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

/* ---- 左侧卡片列（填满 Grid 左轨） ---- */
.orders-card-column {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* ---- 右侧详情列（填满 Grid 右轨） ---- */
.orders-detail-column {
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.orders-detail-panel {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  border-radius: 26px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}

/* ---- 订单列表区域 ---- */
.orders-list-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---- 空状态 ---- */
.orders-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: #aeaeb2;
  font-size: 14px;
  gap: 8px;
}
.orders-error-detail {
  font-size: 12px;
  color: #ff3b30;
  max-width: 320px;
  text-align: center;
  word-break: break-all;
}

/* ===================================================================
   订单卡片
   =================================================================== */

.order-card {
  background: #fff;
  border-radius: 30px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  overflow: hidden;
  flex-shrink: 0;
  width: 100%;
}

/* ---- 交易关闭状态卡片 ---- */
.order-card--closed {
  pointer-events: none;
  opacity: 0.58;
  filter: grayscale(0.35);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.04);
}

/* ---- 选中态卡片 ---- */
.order-card {
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
  border: 2px solid transparent;
}
.order-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.order-card--selected {
  border-color: #355944;
  box-shadow: 0 2px 16px rgba(0,0,0,0.12);
}
.order-card--closed {
  cursor: default;
}
.order-card--closed:hover {
  box-shadow: 0 0 0 1px rgba(0,0,0,0.04);
}

/* ---- A. 顶部基础信息栏 ---- */
.oc-header {
  display: grid;
  grid-template-columns: max-content max-content max-content minmax(220px, 1fr) max-content;
  column-gap: 32px;
  align-items: center;
  height: 60px;
  padding: 0 40px;
  background: #FAFDEB;
  border-bottom: 1px solid #E3E3E3;
  font-size: 13px;
  color: #111111;
  font-weight: 500;
}

.oc-header--read {
  background: #E6E6E6;
}

/* 配送端已完成交付订单卡片表头：灰色（覆盖浅绿未读，仅改顶部状态区颜色） */
.oc-header--done {
  background: #E6E6E6;
}

.oc-hdr-date,
.oc-hdr-period,
.oc-hdr-source,
.oc-hdr-id,
.oc-hdr-time {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  font-family: inherit;
}

.oc-hdr-id {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.oc-hdr-closed-badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  background: #f0f0f0;
  color: #8e8e93;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.oc-hdr-time {
  white-space: nowrap;
}

/* ---- B. 中部主体区域：商品61.5% | 竖线 | 联系人14.5% | 竖线 | 配送10% | 竖线 | 操作14% ---- */
.oc-body {
  display: grid;
  grid-template-columns: minmax(0, 61.5fr) 1px minmax(150px, 14.5fr) 1px minmax(100px, 10fr) 1px minmax(150px, 14fr);
}

/* ---- 竖向分隔线 ---- */
.oc-col-sep {
  background: #E3E3E3;
}

/* ---- 商品区域 61.5% ---- */
.oc-product-area {
  min-width: 0;
  padding: 0 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.oc-product-row {
  display: grid;
  grid-template-columns: 36fr 46fr 18fr;
  align-items: center;
  min-height: 90px;
}

.oc-product-name {
  font-size: 14px;
  font-weight: 600;
  color: #111;
  line-height: 1.4;
  padding-right: 12px;
}

.oc-product-spec {
  font-size: 14px;
  font-weight: 600;
  color: #111;
  line-height: 1.4;
  padding-right: 12px;
}

.oc-product-qty {
  font-size: 14px;
  font-weight: 500;
  color: #455c4e;
  text-align: right;
}

/* ---- 商品之间横线（仅在商品区域内，不跨越其他列） ---- */
.oc-product-divider {
  height: 1px;
  background: #E3E3E3;
  margin: 0;
}

/* ---- 联系人区域 14.5%（跨越所有商品行） ---- */
.oc-contact-area {
  min-width: 0;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

.oc-contact-entry {
  line-height: 1.5;
}

.oc-contact-name {
  font-size: 13.5px;
  font-weight: 500;
  color: #25372f;
}

.oc-contact-phone {
  font-size: 12.5px;
  color: #6e6e73;
  margin-top: 1px;
}

/* ---- 配送区域 10%（跨越所有商品行） ---- */
.oc-delivery-area {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
}

.oc-delivery-text {
  font-size: 13.5px;
  font-weight: 500;
  color: #455c4e;
}

/* ---- 操作区域 14%（跨越所有商品行，竖向排列） ---- */
.oc-action-area {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px 12px;
}

.oc-btn {
  width: 120px;
  height: 38px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease, background 0.15s ease;
  white-space: nowrap;
  line-height: 1;
  box-sizing: border-box;
  flex-shrink: 0;
}

.oc-btn-print {
  background: #fff;
  color: #455c4e;
  border: 1px solid #d1d1d6;
}

.oc-btn-print:hover {
  background: #f4f7f3;
}

.oc-btn-print:active {
  opacity: 0.8;
}

.oc-btn-dispatch {
  background: #355944;
  color: #fff;
  border: none;
}

.oc-btn-dispatch:hover {
  background: #455c4e;
}

.oc-btn-dispatch:active {
  opacity: 0.85;
}

.oc-btn-closed {
  width: auto;
  padding: 0 14px;
  background: transparent;
  color: #aeaeb2;
  border: 1px solid #e5e5ea;
  cursor: default;
}

.oc-btn-dispatched {
  width: auto;
  padding: 0 14px;
  background: #E8F5E9;
  color: #2E7D32;
  border: 1px solid #A5D6A7;
  cursor: default;
}

/* ---- 配送端完成交付按钮（订单列表 / 日历看板）：
   黑色可点「完成交付」→ 服务端成功后原地替换为黑色禁用；
   灰色禁用（production_delivery 生产未完成，不可提前交付）。 ---- */
.oc-btn-delivery {
  width: auto;
  padding: 0 14px;
  background: #355944;
  color: #fff;
  border: none;
}

.oc-btn-delivery:hover {
  background: #455c4e;
}

.oc-btn-delivery:active {
  opacity: 0.85;
}

.oc-btn-delivery:disabled,
.oc-btn-delivery:disabled:hover {
  background: #355944;
  color: #fff;
  cursor: default;
  opacity: 0.7;
}

.oc-btn-delivery--wait,
.oc-btn-delivery--wait:hover,
.oc-btn-delivery--wait:disabled,
.oc-btn-delivery--wait:disabled:hover {
  background: #edf3ec;
  color: #8e8e93;
  border: 1px solid #d1d1d6;
  cursor: default;
  opacity: 1;
}

/* ---- 客服端订单卡片内部状态（只读显示，非按钮） ---- */
.oc-status {
  width: 120px;
  min-height: 38px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1;
  box-sizing: border-box;
  flex-shrink: 0;
}

/* 待派发 / 待生产 / 待交付：简洁中性色状态框 */
.oc-status--pending {
  background: #f4f7f3;
  color: #455c4e;
  border: 1px solid #d1d1d6;
}

/* 生产中：轻强调（中性蓝） */
.oc-status--producing {
  background: #eef3fb;
  color: #34518c;
  border: 1px solid #c5d4e8;
}

/* 已完成：轻度完成态 */
.oc-status--done {
  background: #E8F5E9;
  color: #2E7D32;
  border: 1px solid #A5D6A7;
}

/* 交易关闭：沿用现有关闭视觉 */
.oc-status--closed {
  background: transparent;
  color: #aeaeb2;
  border: 1px solid #e5e5ea;
}

/* ---- 客服派发路线选择 ---- */
.oc-dispatch-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.oc-dispatch-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.oc-dispatch-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  font-size: 13px;
  color: #455c4e;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.oc-dispatch-option input {
  display: none;
}

.oc-dispatch-radio {
  width: 14px;
  height: 14px;
  border: 1.5px solid #c7c7cc;
  border-radius: 50%;
  flex-shrink: 0;
  box-sizing: border-box;
  transition: border-color 0.15s ease, border-width 0.15s ease;
}

.oc-dispatch-option--active {
  border-color: #355944;
  background: #f4f7f3;
}

.oc-dispatch-option--active .oc-dispatch-radio {
  border-color: #355944;
  border-width: 5px;
}

.oc-dispatch-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.oc-dispatch-actions .oc-btn {
  width: auto;
  padding: 0 12px;
  height: 32px;
  font-size: 12px;
  border-radius: 8px;
}

.oc-btn-dispatch-confirm {
  background: #355944;
  color: #fff;
  border: none;
}

.oc-btn-dispatch-confirm:hover {
  background: #455c4e;
}

.oc-btn-dispatch-cancel {
  background: #fff;
  color: #455c4e;
  border: 1px solid #d1d1d6;
}

.oc-btn-dispatch-cancel:hover {
  background: #f4f7f3;
}

/* ---- 空占位 ---- */
.oc-empty {
  color: #c7c7cc;
  font-size: 13px;
}

/* ===================================================================
   C. 底部备注区
   =================================================================== */

.oc-notes {
  border-top: 1px solid #E3E3E3;
  padding: 20px 40px 24px;
}

.oc-note {
  font-size: 13px;
  line-height: 1.7;
}

.oc-note + .oc-note {
  margin-top: 6px;
}

.oc-note-label {
  color: #888;
}

.oc-note-value {
  color: #25372f;
}

.oc-note-em .oc-note-value {
  color: #FF5A36;
}

/* ===================================================================
   D. 右侧备注详情面板
   =================================================================== */

.dp-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  color: #aeaeb2;
  font-size: 14px;
  padding: 24px;
}

.dp-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #FFFFFF;
}

.dp-section {
  padding: 20px 24px;
}

/* 顾客备注区域 — 固定顶部，不参与滚动 */
.dp-section--customer {
  flex-shrink: 0;
}

/* 内部备注流水区域 — 自动填充剩余空间，独立滚动 */
.dp-section--memo {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dp-section-title {
  font-size: 12px;
  font-weight: 600;
  color: #8e8e93;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.dp-customer-note {
  font-size: 14px;
  line-height: 1.6;
  color: #25372f;
}

.dp-note-none {
  color: #aeaeb2;
  font-size: 13px;
}

.dp-divider {
  height: 1px;
  background: #E3E3E3;
  margin: 0 24px;
  flex-shrink: 0;
}

/* ---- 内部备注流水 ---- */

.dp-memo-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.dp-memo-entry {
  padding: 0;
}

.dp-memo-meta {
  font-size: 11px;
  color: #8e8e93;
  margin-bottom: 4px;
  font-weight: 500;
}

.dp-memo-value {
  font-size: 14px;
  line-height: 1.6;
  color: #25372f;
  word-break: break-all;
}

/* 最新一条内部备注 — 橙红色（必须在 .dp-memo-value 之后以覆盖其 color） */
.dp-memo-value.dp-note-em {
  color: #FF5A36;
}

/* 顾客备注内容内的橙红色强调 */
.dp-customer-note .dp-note-em {
  color: #FF5A36;
}

.dp-memo-sep {
  height: 1px;
  background: #f0f0f0;
  margin: 14px 0;
  flex-shrink: 0;
}

.dp-memo-empty {
  font-size: 13px;
  color: #aeaeb2;
  padding: 8px 0;
}

.dp-memo-loading {
  font-size: 13px;
  color: #aeaeb2;
  padding: 8px 0;
}

/* ---- 输入区域（固定在底部，不参与滚动）---- */

.dp-input-section {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.dp-input {
  width: 100%;
  border: 1px solid #e5e5ea;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  color: #25372f;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  min-height: 72px;
}

.dp-input:focus {
  border-color: #c7c7cc;
}

.dp-input::placeholder {
  color: #aeaeb2;
}

.dp-save-btn {
  align-self: flex-end;
  height: 36px;
  padding: 0 24px;
  border: none;
  border-radius: 10px;
  background: #355944;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  line-height: 36px;
}

.dp-save-btn:active {
  opacity: 0.85;
}

.dp-save-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
