/* 医美药业 · 商城管理端样式
 * 面向电脑浏览器，最小推荐宽度 1180px
 */

:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #e3e8ee;
  --line-soft: #eef2f6;
  --text: #1f2933;
  --text-2: #4a5563;
  --muted: #7b8794;
  --brand: #12645c;
  --brand-dark: #0d4f48;
  --brand-soft: #e7f2f0;
  --ok: #2f855a;
  --ok-soft: #e6f4ec;
  --warn: #b7791f;
  --warn-soft: #fdf3e2;
  --danger: #c0392b;
  --danger-soft: #fdeceb;
  --info: #2b6cb0;
  --info-soft: #e8f1fa;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 12px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ================= 登录 ================= */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0d4f48 0%, #12645c 45%, #1b7d72 100%);
  padding: 24px;
}

.login-card {
  width: 380px;
  background: #fff;
  border-radius: 16px;
  padding: 36px 32px 30px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .22);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.login-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.5px;
}

.login-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .2px;
}

.login-sub {
  color: var(--muted);
  font-size: 12.5px;
  margin: 2px 0 24px;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 12.5px;
  color: var(--text-2);
  margin-bottom: 6px;
  font-weight: 500;
}

.field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  transition: border-color .15s, box-shadow .15s;
}

.field input:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(18, 100, 92, .12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13.5px;
  transition: all .15s;
  white-space: nowrap;
  flex: 0 0 auto;
}

.btn:hover { border-color: #cfd8e3; background: #fafbfc; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

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

.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

.btn-danger { color: var(--danger); border-color: #f0cbc6; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); }

.btn-block { width: 100%; height: 44px; font-size: 15px; }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }

.login-err {
  margin-top: 14px;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  display: none;
}

.login-err.show { display: block; }

.login-foot {
  margin-top: 22px;
  text-align: center;
  font-size: 11.5px;
  color: #9aa5b1;
}

/* ================= 布局 ================= */
.app {
  display: flex;
  min-height: 100vh;
}

.side {
  width: 216px;
  flex: 0 0 216px;
  background: #0f2f2b;
  color: #cfe3df;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-brand {
  padding: 20px 18px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.side-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #1b7d72;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}

.side-brand-txt { line-height: 1.25; }
.side-brand-txt b { display: block; color: #fff; font-size: 14px; }
.side-brand-txt span { font-size: 11px; color: #7fa39d; }

.nav { padding: 12px 10px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  color: #b9d2cd;
  margin-bottom: 3px;
  transition: background .12s, color .12s;
  user-select: none;
}

.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: #1b7d72; color: #fff; font-weight: 500; }

.nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .55;
  flex: 0 0 6px;
}

.side-foot {
  padding: 14px 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  font-size: 11.5px;
  color: #6f938d;
  line-height: 1.7;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 58px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 22px;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  letter-spacing: .2px;
}

.topbar .spacer { flex: 1; }

.who {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.who b { color: var(--text); font-weight: 600; }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.content { padding: 20px 22px 40px; }

/* ================= 卡片 ================= */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.card-label {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.3px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.card-value small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 2px; }

.card-sub {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted);
}

.card.accent { background: linear-gradient(160deg, #12645c, #1b7d72); border-color: transparent; }
.card.accent .card-label, .card.accent .card-sub { color: #bfdcd6; }
.card.accent .card-value { color: #fff; }
.card.accent .card-value small { color: #bfdcd6; }

/* ================= 面板 ================= */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}

.panel-head h2 {
  font-size: 14.5px;
  font-weight: 600;
  margin: 0;
}

.panel-head .spacer { flex: 1; }

.panel-body { padding: 0; }
.panel-body.pad { padding: 18px; }

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

.search {
  height: 34px;
  width: 240px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.search:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(18, 100, 92, .1);
}

.select {
  height: 34px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M1 1l4 4 4-4' stroke='%237b8794' stroke-width='1.4' fill='none' stroke-linecap='round'/></svg>") no-repeat right 10px center;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.select:focus { outline: none; border-color: var(--brand); }

/* ================= 表格 ================= */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  padding: 10px 14px;
  background: #f8fafb;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .2px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafcfc; }

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

.cell-strong { font-weight: 500; }
.cell-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.cell-wrap { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.row-actions { display: flex; gap: 6px; flex-wrap: nowrap; }

.empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.empty b { display: block; color: var(--text-2); margin-bottom: 4px; font-size: 14px; }

/* 状态徽标 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: 11px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.tag::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.tag-pending { background: var(--warn-soft); color: var(--warn); }
.tag-paid { background: var(--info-soft); color: var(--info); }
.tag-shipped { background: var(--brand-soft); color: var(--brand); }
.tag-completed { background: var(--ok-soft); color: var(--ok); }
.tag-canceled { background: #f1f3f5; color: #8a94a0; }
.tag-on { background: var(--ok-soft); color: var(--ok); }
.tag-off { background: #f1f3f5; color: #8a94a0; }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }

/* 分页 */
.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
  color: var(--muted);
}

.pager .spacer { flex: 1; }

/* 库存警示 */
.stock-low { color: var(--danger); font-weight: 600; }
.stock-ok { color: var(--text); }

/* ================= 弹窗 ================= */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 32, 45, .42);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  z-index: 100;
  overflow-y: auto;
  animation: fade .14s ease-out;
}

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { transform: translateY(-8px); opacity: .6 } to { transform: none; opacity: 1 } }

.modal {
  width: 640px;
  max-width: 100%;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .26);
  animation: pop .16s ease-out;
  overflow: hidden;
}

.modal.wide { width: 820px; }

.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-head .spacer { flex: 1; }

.modal-close {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
}

.modal-close:hover { background: #f1f3f5; color: var(--text); }

.modal-body {
  padding: 20px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
  background: #fafbfc;
}

/* 表单栅格 */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.span2 { grid-column: span 2; }

.form-row { margin-bottom: 14px; }
.form-row:last-child { margin-bottom: 0; }

.form-row > label {
  display: block;
  font-size: 12.5px;
  color: var(--text-2);
  margin-bottom: 5px;
  font-weight: 500;
}

.form-row > label .req { color: var(--danger); margin-left: 2px; }

.form-row input[type="text"],
.form-row input[type="number"],
.form-row input[type="date"],
.form-row select,
.form-row textarea {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  transition: border-color .15s, box-shadow .15s;
}

.form-row textarea {
  height: auto;
  min-height: 76px;
  padding: 9px 10px;
  resize: vertical;
  line-height: 1.6;
}

.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(18, 100, 92, .1);
}

.form-row .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

.section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .5px;
  text-transform: uppercase;
  margin: 20px 0 10px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.section-title:first-child { margin-top: 0; padding-top: 0; border-top: none; }

/* 详情信息 */
.kv {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px 12px;
  font-size: 13px;
  max-width: 680px;
}
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); word-break: break-all; }

.detail-block {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: #fcfdfd;
}

.detail-block h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-block h4 .spacer { flex: 1; }

.mini-table { width: 100%; font-size: 12.5px; }
.mini-table td { padding: 6px 0; border-bottom: 1px dashed var(--line-soft); }
.mini-table tr:last-child td { border-bottom: none; }
.mini-table td.r { text-align: right; }

/* 提示条 */
.notice {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 9px;
  font-size: 13px;
  margin-bottom: 14px;
  line-height: 1.65;
}

.notice-warn { background: var(--warn-soft); color: #8a5a12; }
.notice-info { background: var(--info-soft); color: #245b8f; }
.notice-ok { background: var(--ok-soft); color: #256b49; }
.notice-danger { background: var(--danger-soft); color: #96271c; }

/* Toast */
.toast-host {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  padding: 10px 18px;
  border-radius: 9px;
  background: rgba(31, 41, 51, .94);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  animation: pop .16s ease-out;
  max-width: 460px;
  text-align: center;
}

.toast.ok { background: #2f7d5b; }
.toast.err { background: #a93226; }

/* 加载 */
.loading {
  padding: 48px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -3px;
  margin-right: 8px;
}

@keyframes spin { to { transform: rotate(360deg) } }

.skeleton {
  background: linear-gradient(90deg, #f1f4f6 25%, #e8edf0 37%, #f1f4f6 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  border-radius: 6px;
}

@keyframes shimmer { from { background-position: 100% 50% } to { background-position: 0 50% } }

/* 窄屏兜底 */
@media (max-width: 900px) {
  .side { width: 64px; flex: 0 0 64px; }
  .side-brand-txt, .nav-item span:not(.nav-dot), .side-foot { display: none; }
  .nav-item { justify-content: center; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .content { padding: 14px; }
}
