/* 宠伴 · 商家/运营桌面后台壳（非 App 窄屏） */
:root {
  --ink: #1a2421;
  --ink-soft: #5a6a63;
  --moss: #1f3d34;
  --moss-mid: #2f5c4c;
  --line: #e6ebe8;
  --paper: #f3f5f4;
  --cream: #ffffff;
  --accent: #c45c26;
  --accent-soft: #fff4ec;
  --side: #17241f;
  --side-text: #c5d2cb;
  --side-active: #fffaf3;
  --shadow: 0 1px 2px rgba(23, 36, 31, 0.06), 0 8px 24px rgba(23, 36, 31, 0.04);
  --radius: 12px;
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --display: "Fraunces", "Noto Serif SC", "Songti SC", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
[hidden] { display: none !important; }
body.admin-body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--moss-mid); }
code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.92em;
  background: rgba(23, 36, 31, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* —— 登录门 —— */
.admin-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  background:
    radial-gradient(700px 360px at 10% 0%, rgba(111, 155, 122, 0.18), transparent 55%),
    radial-gradient(600px 320px at 90% 100%, rgba(196, 92, 38, 0.1), transparent 50%),
    var(--paper);
}
.admin-gate-card {
  width: min(420px, 100%);
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.75rem 1.6rem 1.5rem;
  box-shadow: var(--shadow);
}
.admin-gate-card h1 {
  margin: 0 0 0.35rem;
  font-family: var(--display);
  font-size: 1.65rem;
  color: var(--moss);
}
.admin-gate-links {
  margin-top: 1rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.admin-gate-links a { margin-right: 0.65rem; }

/* —— 壳 —— */
.admin-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}
.admin-side {
  background: var(--side);
  color: var(--side-text);
  padding: 1.1rem 0.85rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.admin-brand {
  padding: 0.35rem 0.65rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.admin-brand .eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.65;
}
.admin-brand strong {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--display);
  font-size: 1.2rem;
  color: #fff;
  font-weight: 600;
}
.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}
.admin-nav .chip,
.admin-nav button.chip {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
}
.admin-nav .chip:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.admin-nav .chip.is-active {
  background: rgba(255, 250, 243, 0.12);
  color: var(--side-active);
  font-weight: 700;
}
.admin-side-foot {
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.admin-side-foot a,
.admin-side-foot .linkish {
  color: var(--side-text);
  text-decoration: none;
  font-size: 0.86rem;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
}
.admin-side-foot a:hover { color: #fff; background: rgba(255,255,255,0.06); }

.admin-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}
.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.95rem 1.5rem;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.admin-top h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.25rem;
  color: var(--moss);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.admin-top-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  align-items: center;
}
.admin-content {
  padding: 1.25rem 1.5rem 2.5rem;
  max-width: 1280px;
  width: 100%;
}
.admin-hint {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* —— 通用控件 —— */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.btn:hover { border-color: rgba(31, 61, 52, 0.28); }
.btn-primary {
  background: var(--moss);
  border-color: var(--moss);
  color: #fff;
}
.btn-primary:hover { background: var(--moss-mid); border-color: var(--moss-mid); }
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-soft);
}
.btn-ghost:hover { background: rgba(23, 36, 31, 0.06); color: var(--ink); }
.btn-outline {
  background: #fff;
  border-color: var(--line);
}
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.82rem; }
.btn-block { width: 100%; }

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
}
.chip.is-active {
  background: var(--moss);
  border-color: var(--moss);
  color: #fff;
  font-weight: 600;
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.form-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.form-card h3 { margin: 0; font-size: 1rem; color: var(--moss); }
.form-card label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.form-card input,
.form-card textarea,
.form-card select,
.desk-tools input[type="search"],
.toolbar input[type="search"],
.shop-edit input,
.shop-edit select {
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  background: #fff;
}
.form-note {
  margin: 0;
  font-size: 0.86rem;
  color: var(--ink-soft);
  font-weight: 400;
  line-height: 1.55;
}
.alert {
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  margin: 0 0 1rem;
  font-size: 0.88rem;
}
.alert-info {
  background: #eef6f1;
  color: #24503f;
  border: 1px solid #cfe3d7;
}

.stats,
.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow);
}
.stat span {
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.stat strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ink);
}
.stat.hot strong { color: var(--accent); }

.desk-tools,
.toolbar {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 0.9rem;
}
.desk-tools input[type="search"],
.toolbar input[type="search"] {
  flex: 1;
  min-width: 200px;
}

.order-list { display: flex; flex-direction: column; gap: 0.65rem; }
.order-card,
.svc-card,
.cs-card,
.shop-edit {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1.05rem;
  box-shadow: var(--shadow);
}
.order-card h3,
.svc-card h3,
.cs-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}
.order-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.order-type {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--moss-mid);
}
.order-status {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: #fff4ec;
  color: var(--accent);
}
.order-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 0.25rem;
}
.order-meta strong { color: var(--accent); font-size: 1rem; }
.order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}
.order-extra {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 0.4rem;
  line-height: 1.45;
}
.empty-hint,
.empty-state {
  text-align: center;
  color: var(--ink-soft);
  padding: 2rem 1rem;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty-state h3 { margin: 0.4rem 0; color: var(--ink); }
.empty-illus { font-size: 2rem; }
.reject-note { color: #b45309; font-size: 0.8rem; margin-top: 0.25rem; }
.pack-list {
  white-space: pre-wrap;
  font-size: 0.86rem;
  background: #fff;
  border: 1px solid var(--line);
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 0.65rem;
}

.conn {
  font-size: 0.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #e8ecea;
  color: #374151;
  font-weight: 600;
}
.conn.ok { background: #d1fae5; color: #065f46; }
.conn.warn { background: #fef3c7; color: #92400e; }
.kind-pill {
  font-size: 0.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #e0e7ff;
  color: #3730a3;
  font-weight: 700;
}
.kind-pill.medical { background: #fee2e2; color: #991b1b; }

.toast-bar {
  position: sticky;
  top: 64px;
  z-index: 15;
  display: none;
  margin-bottom: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  font-size: 0.88rem;
}
.toast-bar.show { display: block; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 0.75rem;
  text-align: left;
  vertical-align: top;
}
th {
  background: #f8faf9;
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 700;
}
tr:last-child td { border-bottom: 0; }
.preview { max-width: 120px; max-height: 90px; border-radius: 8px; }
.reason { color: #b45309; font-size: 0.8rem; }
.cap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.4rem 0.75rem;
  margin: 0.65rem 0;
}
.cap-grid label {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.86rem;
  cursor: pointer;
  font-weight: 400;
}
.shop-edit .row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0.5rem 0;
  align-items: center;
}
.shop-edit .hint { font-size: 0.8rem; color: var(--ink-soft); margin: 0 0 0.5rem; }
.msgs {
  background: #f8fafc;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  max-height: 140px;
  overflow: auto;
}
.msgs div { margin: 0.25rem 0; }
.badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: #e5e7eb;
}
.badge.open { background: #ffedd5; color: #9a3412; }
.badge.replied { background: #dbeafe; color: #1e40af; }
.badge.closed { background: #e5e7eb; color: #4b5563; }
.badge.hidden { background: #fee2e2; color: #991b1b; }
.count-bars { display: grid; gap: 0.4rem; margin-top: 0.5rem; }
.count-row {
  display: grid;
  grid-template-columns: 140px 1fr 40px;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.86rem;
}
.count-bar { height: 8px; background: #fed7aa; border-radius: 4px; }
.count-bar > i { display: block; height: 100%; background: #ea580c; border-radius: 4px; }

.panel-grid-2 {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

@media (max-width: 960px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .admin-nav { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .admin-brand { border: 0; padding: 0.25rem 0.5rem; }
  .admin-side-foot { border: 0; flex-direction: row; width: 100%; }
  .stats, .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-grid-2 { grid-template-columns: 1fr; }
}

/* 打单弹层 */
.m-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(23, 36, 31, 0.45);
}
.m-modal[hidden] { display: none !important; }
.m-modal-card {
  width: min(420px, 100%);
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem 1.2rem 1.1rem;
  box-shadow: var(--shadow);
}
.m-modal-card h3 { margin: 0 0 0.35rem; font-family: var(--display); color: var(--moss); }
.m-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}
.ship-manual {
  margin-top: 0.65rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.ship-manual summary { cursor: pointer; margin-bottom: 0.4rem; }
.ship-sub {
  margin: 0.85rem 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--moss);
}
.ship-result {
  margin: 0.5rem 0 0;
  padding: 0.75rem 0.85rem;
  background: var(--accent-soft);
  border-radius: 8px;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.45;
}
.m-modal-card label { display: block; margin-top: 0.45rem; }
.m-modal-card input,
.m-modal-card select {
  width: 100%;
  margin-top: 0.25rem;
}

@media print {
  .admin-side, .admin-top-actions, .desk-tools, .order-actions, .admin-hint,
  #deskHint, .stats, #newOrderToast, #btnPrintPack, .toast-bar, .m-modal { display: none !important; }
  .admin-shell { display: block; }
  .order-card { break-inside: avoid; }
}
