:root {
  --bg: #F6F4EF;
  --card: #FFFFFF;
  --line: #E4E0D6;
  --text: #23281F;
  --text2: #7C8175;
  --primary: #2E6B4F;
  --primary-d: #235039;
  --accent: #D97B34;
  --danger: #B4453C;
  --side: #1F3128;
}

* { box-sizing: border-box; }

/* 关键：.login-wrap/.layout/.modal 都写了 display:flex，
   作者样式优先级高于浏览器对 hidden 属性的默认样式，会把 hidden 顶掉。
   这一条保证 hidden 永远生效（登录页/主界面/弹窗的显隐全靠它）。 */
[hidden] { display: none !important; }

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

a { color: inherit; text-decoration: none; cursor: pointer; }
h1, h2, h3 { margin: 0; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #1F3128 0%, #2E6B4F 100%);
  padding: 24px;
}
.login-card {
  width: 340px; background: #fff; border-radius: 16px; padding: 32px 28px 26px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.login-logo {
  width: 48px; height: 48px; border-radius: 12px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 600;
  margin-bottom: 16px;
}
.login-card h1 { font-size: 20px; font-weight: 600; }
.login-sub { color: var(--text2); margin: 4px 0 22px; font-size: 13px; }
.login-card label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 14px; }
.login-card input {
  display: block; width: 100%; margin-top: 6px; height: 42px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px; font-size: 14px; color: var(--text);
  background: #FCFBF8;
}
.login-card input:focus { outline: none; border-color: var(--primary); background: #fff; }
.login-msg { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 10px; }

/* ---------------- 布局 ---------------- */
.layout { display: flex; min-height: 100vh; }
.side {
  width: 200px; flex: none; background: var(--side); color: #E7EDE8;
  display: flex; flex-direction: column; padding: 18px 0;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 20px 20px; }
.brand-dot {
  width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600;
}
.brand-text { font-size: 15px; font-weight: 500; }
#nav { display: flex; flex-direction: column; }
#nav a {
  padding: 11px 20px; font-size: 14px; color: #B9C7BE; border-left: 3px solid transparent;
}
#nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
#nav a.on { background: rgba(255, 255, 255, .1); color: #fff; border-left-color: #7FC79F; font-weight: 500; }
.side-foot { margin-top: auto; padding: 16px 20px 0; display: flex; flex-direction: column; gap: 10px; }
.side-foot .link { font-size: 13px; color: #8FA398; }
.side-foot .link:hover { color: #fff; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; flex: none; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
}
.topbar h2 { font-size: 17px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.muted { color: var(--text2); font-size: 13px; }
.view { padding: 22px 24px 60px; }

/* ---------------- 通用 ---------------- */
.btn {
  height: 38px; padding: 0 18px; border-radius: 9px; border: 1px solid transparent;
  font-size: 14px; cursor: pointer; background: #EFECE4; color: var(--text);
  font-family: inherit;
}
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.ghost { background: #fff; border-color: var(--line); }
.btn.danger { background: #FBEAE8; color: var(--danger); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; border-radius: 7px; }
.btn.gold { background: var(--accent); color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn {
  border: none; background: transparent; font-size: 16px; cursor: pointer; color: var(--text2);
  width: 30px; height: 30px; border-radius: 8px;
}
.icon-btn:hover { background: #F1EFE8; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 15px; font-weight: 600; }
.pad { padding: 18px; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.stat .k { color: var(--text2); font-size: 13px; }
.stat .v { font-size: 26px; font-weight: 600; margin-top: 8px; line-height: 1.1; }
.stat .v small { font-size: 14px; font-weight: 400; color: var(--text2); margin-left: 2px; }
.stat.hi .v { color: var(--accent); }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
th { background: #FAF9F5; color: var(--text2); font-weight: 500; font-size: 13px; white-space: nowrap; }
tbody tr:hover { background: #FCFBF7; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.acts { white-space: nowrap; text-align: right; }
.table-wrap { overflow-x: auto; }

.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px;
  background: #EFECE4; color: var(--text2);
}
.pill.pending { background: #FBEDE1; color: #8A4B15; }
.pill.paid { background: #E4F1E8; color: #235039; }
.pill.finished { background: #E7EDF5; color: #2F4C6B; }
.pill.cancelled { background: #F1EFEA; color: #8B8A83; }
.pill.off { background: #F1EFEA; color: #93918A; }
.pill.on { background: #E4F1E8; color: #235039; }

.thumb {
  width: 56px; height: 44px; border-radius: 8px; object-fit: cover;
  background: #EFECE4; display: block;
}

/* 订单列表里"直接改状态"的下拉 */
.stsel {
  height: 30px; border: 1px solid var(--line); border-radius: 7px;
  padding: 0 6px; font-size: 13px; background: #fff; color: var(--text);
  font-family: inherit; cursor: pointer;
}
.stsel:hover { border-color: var(--primary); }
.stsel[disabled] { opacity: .45; cursor: wait; }

/* ---- 本地图片选择器（.imgpick）----
   label 包一个隐藏的 file input：这样"选择图片"长得像按钮，
   又不用 JS 去 click() 一个 input（有些浏览器会拦）。 */
.imgpick { display: block; }
.pvrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; min-height: 4px; }
.pvthumb { position: relative; width: 104px; height: 78px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: #EFECE4; flex: 0 0 auto; }
.pvthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pvdel {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; line-height: 20px;
  border: 0; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 14px;
  cursor: pointer; padding: 0; text-align: center;
}
.pvdel:hover { background: var(--danger); }
.pvempty { color: var(--text2); font-size: 13px; align-self: center; }
.pvbtns { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.filebtn { cursor: pointer; display: inline-flex; align-items: center; }
.pvstatus { font-size: 12px; }
.pvstatus.err { color: var(--danger); }
.muted-txt { color: var(--text2); font-size: 13px; }
.empty { padding: 60px 0; text-align: center; color: var(--text2); }
.row-2 { display: flex; align-items: center; gap: 10px; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type=text], .toolbar select {
  height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px;
  font-size: 14px; background: #fff; font-family: inherit; color: var(--text);
}
.toolbar input[type=text] { width: 240px; }
.toolbar .spacer { flex: 1; }

/* ---------------- 弹窗 ---------------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(24, 28, 22, .45); }
.modal-box {
  position: relative; width: 620px; max-width: calc(100vw - 32px); max-height: calc(100vh - 60px);
  background: #fff; border-radius: 16px; display: flex; flex-direction: column;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .3);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 16px 20px; border-top: 1px solid var(--line);
}
.modal-foot .err { flex: 1; color: var(--danger); font-size: 13px; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field { display: flex; flex-direction: column; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 13px; color: var(--text2); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; font-size: 14px;
  font-family: inherit; background: #FCFBF8; color: var(--text); width: 100%;
}
.field textarea { min-height: 82px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--primary); background: #fff;
}
.field .hint { font-size: 12px; color: #A8ACA2; margin-top: 5px; }
.field .chk { display: flex; align-items: center; gap: 8px; height: 38px; }
.field .chk input { width: auto; }

.detail dl { display: grid; grid-template-columns: 100px 1fr; gap: 9px 14px; margin: 0; }
.detail dt { color: var(--text2); font-size: 13px; }
.detail dd { margin: 0; }
.detail .item {
  display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.detail .item:last-child { border-bottom: none; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: #23301F; color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 14px; z-index: 99; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.toast.err { background: #7A2C26; }

@media (max-width: 720px) {
  .side { width: 60px; }
  .brand-text, .side-foot { display: none; }
  #nav a { padding: 12px 0; text-align: center; font-size: 12px; }
  .fields { grid-template-columns: 1fr; }
}
