:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #e4e7ec;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #15803d;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; }
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
.shell { max-width: 1060px; margin: 0 auto; padding: 28px 20px 56px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.brand h1 { margin: 0 0 4px; font-size: 25px; letter-spacing: -.02em; }
.brand p { margin: 0; color: var(--muted); font-size: 13px; }
.btn { border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 9px; min-height: 42px; padding: 9px 16px; font-weight: 600; transition: background .15s, border-color .15s; }
.btn:hover { background: #f8fafc; }
.btn-primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { color: var(--danger); border-color: #fecaca; background: #fff; }
.btn-success { color: #fff; background: var(--success); border-color: var(--success); }
.search-row { display: flex; gap: 10px; margin-bottom: 16px; }
.search-box { position: relative; flex: 1; }
.search-box input { width: 100%; min-height: 48px; padding: 11px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; outline: none; }
.search-box input:focus, input:focus, select:focus, textarea:focus { border-color: #93b4ff; box-shadow: 0 0 0 3px #dbe8ff; outline: none; }
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 1px 14px; scrollbar-width: none; }
.chip { white-space: nowrap; border: 1px solid var(--line); background: #fff; color: #475467; border-radius: 999px; padding: 7px 13px; }
.chip.active { background: #eaf1ff; border-color: #b7ceff; color: #1748ad; font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 18px; box-shadow: 0 2px 8px rgba(16,24,40,.04); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.repair-no { margin: 0; font-size: 18px; letter-spacing: .02em; }
.product { margin: 0 0 3px; font-size: 16px; font-weight: 700; }
.sku { margin: 0 0 14px; color: var(--muted); }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin-bottom: 16px; }
.meta-item span, .label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.meta-item strong { font-weight: 500; overflow-wrap: anywhere; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 13px; border-top: 1px solid #f0f1f3; }
.updated { color: var(--muted); font-size: 12px; }
.status { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.status.waiting { background: #f2f4f7; color: #475467; }
.status.shipping, .status.received { background: #eaf1ff; color: #1d4ed8; }
.status.repairing, .status.returning { background: #fff1d6; color: #b54708; }
.status.done { background: #dcfae6; color: #067647; }
.status.void { background: #f2f4f7; color: #98a2b3; text-decoration: line-through; }
.empty { grid-column: 1/-1; text-align: center; padding: 62px 20px; color: var(--muted); background: #fff; border: 1px dashed #d0d5dd; border-radius: 11px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 20px; color: var(--muted); }
.modal { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(15,23,42,.38); }
.modal.open { display: flex; }
.modal-panel { width: min(720px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: #fff; border-radius: 12px; box-shadow: 0 24px 60px rgba(0,0,0,.2); }
.modal-sm { width: min(420px, 100%); }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 19px; }
.icon-btn { border: 0; background: transparent; color: var(--muted); font-size: 24px; line-height: 1; padding: 4px; }
.modal-body { padding: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--line); }
.section-title { margin: 22px 0 12px; font-size: 14px; }
.section-title:first-child { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field.full { grid-column: 1/-1; }
.field label { display: block; margin-bottom: 6px; color: #344054; font-size: 13px; font-weight: 600; }
.required::after { content: ' *'; color: var(--danger); }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #d0d5dd; border-radius: 8px; padding: 10px 11px; background: #fff; }
.field textarea { min-height: 84px; resize: vertical; }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.detail-section { padding: 15px 0; border-bottom: 1px solid #f0f1f3; }
.detail-section:last-child { border: 0; }
.detail-section h3 { margin: 0 0 11px; font-size: 14px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 18px; }
.detail-item span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.detail-item div { white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-item.full { grid-column: 1/-1; }
.notice { padding: 13px 14px; border-radius: 8px; background: #f0f6ff; color: #264d99; line-height: 1.7; white-space: pre-wrap; }
.flow-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.toast-root { position: fixed; right: 18px; top: 18px; z-index: 100; display: grid; gap: 8px; }
.toast { transform: translateY(-8px); opacity: 0; min-width: 220px; max-width: 360px; padding: 12px 15px; border-radius: 9px; background: #172033; color: white; box-shadow: 0 10px 28px rgba(0,0,0,.2); transition: .2s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: #b42318; }
.success-box { text-align: center; padding: 5px 0 10px; }
.success-box h3 { color: var(--success); font-size: 21px; margin: 0 0 8px; }
.success-no { font-size: 24px; font-weight: 800; margin: 8px 0 20px; }
.confirm-message { margin: 0; line-height: 1.7; }
@media (max-width: 700px) {
  .shell { padding: 20px 14px 40px; }
  .topbar { align-items: flex-start; }
  .brand h1 { font-size: 22px; }
  .cards { grid-template-columns: 1fr; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .field.full, .detail-item.full { grid-column: auto; }
  .meta-grid { grid-template-columns: 1fr 1fr; }
  .modal { padding: 0; align-items: flex-end; }
  .modal-panel { width: 100%; max-height: 94vh; border-radius: 14px 14px 0 0; }
  .modal-actions { position: sticky; bottom: 0; background: #fff; }
  .modal-actions .btn { flex: 1; }
  .search-row { flex-direction: column; }
  .search-row > .btn { width: 100%; }
}
@media (max-width: 380px) {
  .topbar { flex-direction: column; }
  .topbar > .btn { width: 100%; }
  .meta-grid { grid-template-columns: 1fr; }
}
