:root {
  --accent: #df6430;
  --accent-dark: #c45122;
  --bg: #f7f7f5;
  --card: #fff;
  --ink: #2d2c2a;
  --muted: #85817b;
  --line: #e7e4df;
  --soft: #f4f2ee;
  --green: #5a7a4c;
  --red: #bd4a35;
  --mono: ui-monospace, Menlo, Consolas, monospace;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.wrap {
  width: min(860px, 100% - 28px);
  margin: 0 auto;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-light {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.btn-light:hover {
  background: #fbfaf8;
}

.btn-danger {
  border-color: #ecc9c0;
  background: #fff;
  color: var(--red);
}

.btn-sm {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.link-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

/* login */
.login-wrap {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  width: min(340px, 100%);
  padding: 26px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.login-card h1 {
  margin: 0 0 3px;
  font-size: 22px;
}

.login-card p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
}

.login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dedad3;
  border-radius: 8px;
  outline: none;
  font-size: 14px;
}

.login-card input:focus {
  border-color: #dda283;
  box-shadow: 0 0 0 3px rgba(223, 100, 48, 0.08);
}

.login-card .btn {
  width: 100%;
  margin-top: 10px;
}

.login-card .muted {
  display: inline-block;
  margin-top: 12px;
}

.login-error {
  min-height: 18px;
  margin-top: 8px;
  color: var(--red);
  font-size: 11.5px;
}

/* header */
.admin-top {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}

.admin-top-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 54px;
}

.admin-top-inner b {
  font-size: 15px;
}

.admin-top nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.admin-top nav button {
  padding: 6px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
}

.admin-top nav button.active {
  background: #fdf1ea;
  color: var(--accent-dark);
  font-weight: 600;
}

.admin-main {
  padding: 24px 0 50px;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-head h1 {
  margin: 0;
  font-size: 24px;
}

/* order list */
#orderList {
  display: grid;
  gap: 9px;
}

.order-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.order-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.order-no {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
}

.order-time {
  margin-left: auto;
  color: var(--muted);
  font-size: 10.5px;
}

.pill {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
}

.pill.amber {
  background: #fdf3e2;
  color: #a86a1b;
}

.pill.blue {
  background: #eaf1f7;
  color: #3f6f91;
}

.pill.green {
  background: #edf3e8;
  color: #4f7a48;
}

.pill.indigo {
  background: #ececf5;
  color: #55548c;
}

.pill.gray {
  background: #f1efeb;
  color: #7d746b;
}

.pill.red {
  background: #fbece8;
  color: #b04a34;
}

.order-cust {
  margin-top: 6px;
  font-size: 13px;
}

.order-cust span {
  margin-left: 6px;
  color: var(--muted);
}

.order-addr {
  margin-top: 1px;
  color: #6f6a63;
  font-size: 11.5px;
  word-break: break-all;
}

.order-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.order-meta {
  flex: 1;
  color: var(--muted);
  font-size: 11.5px;
}

.order-meta b {
  color: var(--accent);
  font-size: 15px;
}

.empty {
  padding: 30px 20px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 14px;
  overflow: auto;
  background: rgba(30, 28, 25, 0.42);
}

.modal-box {
  position: relative;
  width: min(620px, 100%);
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: 20px;
  border-radius: 12px;
  background: #fff;
}

.close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: var(--soft);
  color: #777;
  font-size: 15px;
}

.detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-right: 28px;
}

.detail-head .no {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
}

.detail-rows {
  display: grid;
  gap: 5px;
  margin: 12px 0;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.detail-row b {
  color: var(--ink);
  font-weight: 500;
  text-align: right;
  word-break: break-all;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.ship-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.ship-form input[type="text"] {
  padding: 9px 11px;
  border: 1px solid #dedad3;
  border-radius: 8px;
  outline: none;
  font-size: 13px;
}

.ship-photo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ship-photo-preview {
  max-width: 100px;
  max-height: 100px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-ship-photo {
  display: block;
  max-width: 220px;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-note {
  color: #6f6a63;
  font-size: 12px;
  white-space: pre-wrap;
}

/* qr */
.qr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.qr-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: center;
}

.qr-card h2 {
  margin: 0 0 10px;
  font-size: 16px;
}

.qr-card img {
  width: 190px;
  max-width: 100%;
  aspect-ratio: 1;
}

.qr-url {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 10px;
  word-break: break-all;
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 90;
  max-width: 86vw;
  padding: 9px 15px;
  border-radius: 8px;
  background: #2d2c2a;
  color: #fff;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(8px);
  transition: 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 620px) {
  .qr-grid {
    grid-template-columns: 1fr;
  }

  .admin-top-inner {
    gap: 8px;
  }

  .admin-top-inner b {
    font-size: 13px;
  }

  .admin-top nav button {
    padding: 6px 9px;
  }

  .modal-box {
    padding: 16px;
  }
}
