* {
  box-sizing: border-box;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  background: #f4f5f7;
  color: #222;
}
.hidden {
  display: none !important;
}
.panel {
  max-width: 400px;
  margin: 60px auto;
  padding: 32px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}
.panel h1 {
  margin: 0 0 8px;
  font-size: 22px;
}
.muted {
  color: #666;
  font-size: 14px;
  margin: 0 0 20px;
}
label {
  display: block;
  margin: 12px 0 6px;
  font-size: 14px;
}
input[type="text"],
input[type="password"],
input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
}
button {
  margin-top: 16px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: #da291c;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
button.secondary {
  background: #1976d2;
}
button.secondary:disabled {
  background: #999;
  cursor: not-allowed;
}
button.danger {
  background: #999;
  font-size: 13px;
  margin-left: 8px;
}
button.primary {
  background: #1976d2;
}
button.primary:disabled,
button.btn-muted {
  background: #bdbdbd !important;
  color: #fff;
  cursor: not-allowed;
}
button.danger.on {
  background: #d32f2f;
}
button.small {
  margin-top: 0;
  padding: 6px 12px;
  font-size: 13px;
}
.cat-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.cat-toolbar-blk {
  justify-content: space-between;
  width: 100%;
}
.cat-toolbar-blk button {
  margin-left: 0;
}
.cat-toolbar-promos {
  justify-content: space-between;
  width: 100%;
  align-items: center;
}
.cat-toolbar-promos button {
  margin-left: 0;
}
.toolbar-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
/* 「家政服务」「家政用品」各为独立 Tab，每页一张目录卡片 */
.tab-catalog-pane .catalog-card {
  margin-bottom: 0;
}
.catalog-card {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
#catalogCardService {
  border-left: 4px solid #da291c;
}
#catalogCardSupply {
  border-left: 4px solid #6a1b9a;
}
.catalog-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}
.catalog-card-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}
.catalog-card-desc {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.45;
}
.catalog-card .cat-block {
  margin-bottom: 0;
}
.cat-block {
  margin-bottom: 28px;
}
.cat-block h3 {
  margin: 0 0 8px;
  font-size: 16px;
}
.thumb-btn {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: 1px dashed #bbb;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  background: #fafafa;
  flex-shrink: 0;
}
.thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb-btn .ph {
  font-size: 11px;
  color: #888;
  line-height: 46px;
  text-align: center;
}
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal .box {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  max-width: 420px;
  width: 100%;
}
.modal .box h3 {
  margin: 0 0 12px;
}
.row-check {
  width: 36px;
  text-align: center;
}
/* drag-sort handle */
.row-drag-hd {
  width: 28px;
}
.row-drag {
  width: 28px;
  text-align: center;
  cursor: grab;
  user-select: none;
  font-size: 16px;
  color: #999;
}
.row-drag:active { cursor: grabbing; }
tr.drag-active {
  opacity: 0.4;
  background: #e8f0fe;
}
tr.drag-over {
  border-top: 2px solid #1a73e8;
}
.err {
  color: #c00;
  font-size: 14px;
  min-height: 20px;
}
header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
}
header #who {
  color: #666;
  font-size: 14px;
  flex: 1;
}
nav {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
}
nav .tab {
  margin: 0;
  background: #eee;
  color: #333;
}
nav .tab.on {
  background: #da291c;
  color: #fff;
}
.tab-body {
  padding: 20px;
  max-width: 1800px;
  margin: 0 auto;
}
.tab-body h2 {
  margin-top: 0;
}
.table-wrap {
  overflow: auto;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e5e5e5;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
}
th {
  background: #fafafa;
  font-weight: 600;
}
tr:last-child td {
  border-bottom: none;
}

.order-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.order-card {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.order-card.order-card--cancelled {
  opacity: 0.9;
  border-color: #bdbdbd;
  background: #fafafa;
}

.order-card.order-card--cancelled .toolbar select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f0f0f0;
  color: #757575;
}

.order-card .row-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.order-card .badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.order-card .badge.service {
  background: #e3f2fd;
  color: #1565c0;
}

.order-card .badge.supply {
  background: #f3e5f5;
  color: #6a1b9a;
}

.order-card .badge.state {
  background: #fff3e0;
  color: #e65100;
}

.order-card .badge.state.done {
  background: #e8f5e9;
  color: #2e7d32;
}

.order-card .oid {
  font-size: 13px;
  color: #888;
  word-break: break-all;
}

.order-card .grid {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 6px 12px;
  font-size: 14px;
  margin-bottom: 12px;
}

.order-card .grid .k {
  color: #888;
}

.order-card .grid .v {
  color: #222;
  word-break: break-word;
}

.order-card .items-brief {
  font-size: 13px;
  color: #555;
  line-height: 1.45;
}
.order-card .prev-master {
  font-size: 13px;
  color: #e65100;
  margin-top: 6px;
  padding: 4px 10px;
  background: #fff3e0;
  border-radius: 6px;
  display: inline-block;
}

.order-card .tag-warn {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  background: #fff8e1;
  color: #f57f17;
  border-radius: 6px;
  font-size: 12px;
}

.order-card .toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eee;
}

.order-card .toolbar label {
  margin: 0;
  font-size: 13px;
  color: #555;
}

.order-card select {
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  min-width: 200px;
}

.order-card .toolbar button {
  margin: 0;
  padding: 8px 14px;
  font-size: 14px;
}

.order-card .toolbar button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.order-card .toolbar .grow {
  flex: 1;
  min-width: 80px;
}

.order-card .supply-print-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 0;
}

.order-card .supply-print-row button {
  margin: 0;
}

.customer-cards {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 8px;
}
.customer-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}
.customer-card .row-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.customer-card .badge.wx {
  background: #1565c0;
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
}
.customer-card .badge.phone-only {
  background: #6d4c41;
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
}
.customer-card .badge.member {
  background: #f9a825;
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
}
input.no-spin::-webkit-outer-spin-button,
input.no-spin::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input.no-spin {
  -moz-appearance: textfield;
}
.customer-card .oid.mono {
  font-size: 12px;
  color: #888;
  word-break: break-all;
}
.customer-card .cust-readonly {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px 12px;
  font-size: 14px;
  margin-bottom: 8px;
  align-items: start;
}
.customer-card .cust-readonly .k {
  color: #666;
  font-weight: 500;
}
.customer-card .cust-readonly .v {
  color: #222;
  word-break: break-word;
}
.customer-card .cust-readonly .v.nick .placeholder {
  color: #999;
  font-style: italic;
}
.customer-card .cust-contact-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.customer-card .cust-contact-row .k {
  color: #666;
  font-weight: 500;
  min-width: 56px;
  flex-shrink: 0;
}
.customer-card .contact-sel {
  flex: 1;
  min-width: 180px;
  max-width: 420px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
}
.customer-card .btn-del-contact {
  padding: 5px 14px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: #fff;
  background: #e53935;
  white-space: nowrap;
  transition: opacity .2s;
}
.customer-card .btn-del-contact.disabled {
  background: #bbb;
  cursor: not-allowed;
  opacity: .6;
}
.customer-card .cust-orders {
  margin: 14px 0 8px;
  font-size: 14px;
}
.customer-card .cust-no-ord {
  margin: 8px 0 4px;
}
.customer-card table.cust-ord-t {
  font-size: 13px;
}
.customer-card table.cust-ord-t th,
.customer-card table.cust-ord-t td {
  vertical-align: top;
}
.customer-card .cust-remark-wrap {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #eee;
}
.customer-card .cust-remark-wrap label {
  display: block;
  font-size: 13px;
  color: #555;
  margin-bottom: 6px;
}
.customer-card textarea.admin-remark {
  width: 100%;
  max-width: 720px;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
  resize: vertical;
  margin-bottom: 8px;
  box-sizing: border-box;
}
.customer-card .btn-save-remark {
  margin-top: 0;
}

td input[type="number"],
td input[type="text"] {
  width: 100%;
  max-width: 120px;
}
td .mini {
  max-width: 220px;
}
.row-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
}
.row-inline input {
  flex: 1;
  min-width: 120px;
}

.orders-toolbar {
  margin: 12px 0 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.orders-toolbar button {
  margin-top: 0;
}
.orders-filter {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 13px;
}
.orders-filter .filter-label {
  font-weight: 500;
  color: #555;
  margin-right: 2px;
}
.orders-filter label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  margin: 0;
  font-size: 13px;
  white-space: nowrap;
  user-select: none;
}
.orders-filter input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.manual-order-box {
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}
.manual-order-box label {
  display: block;
  margin: 10px 0 4px;
  font-size: 14px;
}
.manual-order-box input[type="text"],
.manual-order-box input[type="date"],
.manual-order-box input[type="time"],
.manual-order-box textarea {
  width: 100%;
  box-sizing: border-box;
}
.mo-row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.manual-svc-list {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fafafa;
}
.mo-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  font-size: 14px;
}
.mo-line:last-child {
  border-bottom: none;
}
.mo-line .mo-ch {
  flex-shrink: 0;
}
.mo-line .mo-name {
  font-weight: 500;
  min-width: 120px;
}
.mo-line .mo-meta {
  color: #666;
  font-size: 13px;
  flex: 1;
}
.mo-line .mo-qty {
  width: 56px;
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 6px;
}
.modal-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.order-card .badge.manual {
  background: #6a1b9a;
  color: #fff;
}

.order-card .badge.member {
  background: linear-gradient(135deg, #f7d06e, #ffa726);
  color: #5d4037;
  font-weight: 600;
}

.master-add-panel {
  background: #fff;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}
.master-add-panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
}
.master-add-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin-bottom: 12px;
}
.master-add-grid label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: #555;
  gap: 4px;
}
.master-add-grid label.span2 {
  grid-column: span 2;
}
.master-add-grid input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
}
.master-add-panel .small {
  margin-top: 0;
}

.master-cards {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.master-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}
.master-card.inactive {
  opacity: 0.92;
  border: 1px dashed #ccc;
}
.master-card .row-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.master-row-top {
  width: 100%;
}
.master-row-top .grow {
  flex: 1;
  min-width: 8px;
}
.master-card .badge.on {
  background: #2e7d32;
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
}
.master-card .badge.off {
  background: #757575;
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
}
.master-fields-ro {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin-bottom: 12px;
}

/* === Product Intros === */
.pi-subtabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 2px solid #eee;
}
.pi-subtab {
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: #666;
  font-size: 15px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin: 0;
  margin-bottom: -2px;
}
.pi-subtab.on {
  color: #da291c;
  font-weight: 600;
  border-bottom-color: #da291c;
}
.pi-subtab:hover {
  color: #da291c;
}

/* service sub-tabs */
.svc-subtabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 2px solid #eee;
}
.svc-subtab {
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: #666;
  font-size: 15px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin: 0;
  margin-bottom: -2px;
}
.svc-subtab.on {
  color: #da291c;
  font-weight: 600;
  border-bottom-color: #da291c;
}
.svc-subtab:hover {
  color: #da291c;
}
.svc-sub-pane.hidden {
  display: none;
}

/* order sub-tabs */
.ord-subtabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 2px solid #eee;
}
.ord-subtab {
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: #666;
  font-size: 15px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin: 0;
  margin-bottom: -2px;
}
.ord-subtab.on {
  color: #da291c;
  font-weight: 600;
  border-bottom-color: #da291c;
}
.ord-subtab:hover {
  color: #da291c;
}
.ord-sub-pane.hidden {
  display: none;
}
.pi-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.pi-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}
.pi-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.pi-id {
  font-family: monospace;
  font-size: 13px;
  color: #888;
  background: #f0f0f0;
  padding: 2px 8px;
  border-radius: 4px;
}
.pi-name {
  font-size: 16px;
}
.pi-block {
  font-size: 13px;
  color: #999;
}
.pi-desc-wrap {
  margin-bottom: 14px;
}
.pi-desc-wrap label {
  font-size: 13px;
  color: #666;
  margin-bottom: 4px;
}
textarea.pi-desc {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  resize: vertical;
  box-sizing: border-box;
}
.pi-save-desc {
  margin-top: 6px !important;
}
.pi-save-muted {
  background: #ccc !important;
  color: #fff !important;
  cursor: default;
}
.pi-save-active {
  background: #1976d2 !important;
  color: #fff !important;
  cursor: pointer;
}
.pi-images-wrap label {
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
}
.pi-images {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.pi-img-item {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #eee;
}
.pi-img-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pi-img-actions {
  position: absolute;
  top: 2px;
  right: 2px;
  display: flex;
  gap: 4px;
}
.pi-img-actions button {
  margin: 0;
  padding: 2px 6px;
  font-size: 12px;
  border-radius: 4px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  cursor: pointer;
  min-width: auto;
}
.pi-img-actions button:hover {
  background: rgba(0,0,0,0.8);
}
.pi-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pi-upload-row input[type="file"] {
  font-size: 13px;
}
.pi-upload-btn {
  margin-top: 0 !important;
}
.master-fields-ro .mf-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.master-fields-ro .mf-cell.mf-span2 {
  grid-column: span 2;
}
.master-fields-ro .mf-k {
  font-size: 12px;
  color: #888;
}
.master-fields-ro .mf-v {
  font-size: 14px;
  color: #222;
  word-break: break-word;
  line-height: 1.4;
}
.master-ord-h {
  margin: 8px 0 8px;
  font-size: 15px;
}
.master-ord-t {
  font-size: 13px;
}
.master-ord-t th,
.master-ord-t td {
  vertical-align: top;
}
