/* 妫水农耕 · 运营后台样式（延续品牌墨绿 + 米白，后台取向更克制） */
:root {
  --brand: #2f6b4f;
  --brand-deep: #245539;
  --brand-soft: #eaf1ec;
  --clay: #c86b3c;
  --bg: #f5f6f4;
  --panel: #ffffff;
  --line: #e4e7e3;
  --line-soft: #eff1ee;
  --text: #1e2420;
  --text-2: #5c6560;
  --text-3: #8b938e;
  --red: #c0392b;
  --amber: #b8791f;
  --blue: #2a6f9e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(30, 36, 32, 0.04), 0 6px 20px rgba(30, 36, 32, 0.05);
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", "DIN Alternate", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d3d8d4; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 登录页 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at 15% -10%, #e7efe9 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 100%, #f3ece4 0%, transparent 55%),
    var(--bg);
  padding: 24px;
}
.login-card {
  width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px 30px 26px;
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--brand);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; letter-spacing: 1px;
}
.login-title { font-size: 19px; font-weight: 700; letter-spacing: 0.5px; }
.login-sub { color: var(--text-3); font-size: 12px; margin: 4px 0 22px; letter-spacing: 0.4px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { height: auto; padding: 9px 11px; resize: vertical; min-height: 74px; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 107, 79, 0.1); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-size: 13px; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: #fafbfa; border-color: #d6dbd7; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.btn-danger { color: var(--red); border-color: #f0d9d5; background: #fdf6f5; }
.btn-danger:hover { background: #fbeae7; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; height: 40px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.login-tip { margin-top: 14px; font-size: 12px; color: var(--text-3); text-align: center; }

/* ---------------- 框架 ---------------- */
.layout { display: flex; min-height: 100vh; }
.side {
  width: 210px; flex: 0 0 210px; background: #1f3a2e; color: #cfdcd4;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand {
  height: 60px; display: flex; align-items: center; gap: 9px; padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.side-mark {
  width: 28px; height: 28px; border-radius: 8px; background: #e8f0ea; color: #1f3a2e;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800;
}
.side-name { font-size: 14px; font-weight: 600; color: #fff; letter-spacing: 0.5px; }
.side-env { font-size: 10px; color: #8ea99b; margin-left: auto; }
.nav { padding: 10px 8px; overflow-y: auto; flex: 1; }
.nav-group { font-size: 10px; letter-spacing: 1.2px; color: #7d9589; padding: 14px 12px 6px; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 11px;
  border-radius: 8px; cursor: pointer; font-size: 13px; color: #cfdcd4; margin-bottom: 2px;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.on { background: #2f6b4f; color: #fff; }
.nav-item .dot { width: 5px; height: 5px; border-radius: 50%; background: #8ea99b; }
.nav-item.on .dot { background: #ffd9a8; }
.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #c86b3c; color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center;
}
.side-foot { padding: 12px 14px; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 12px; color: #8ea99b; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center;
  padding: 0 22px; gap: 14px; position: sticky; top: 0; z-index: 20;
}
.page-title { font-size: 16px; font-weight: 600; }
.page-sub { font-size: 12px; color: var(--text-3); margin-left: 10px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
}
.content { padding: 20px 22px 60px; }

/* ---------------- 卡片 / 指标 ---------------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft);
}
.card-title { font-size: 14px; font-weight: 600; }
.card-extra { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.grid-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 14px; box-shadow: var(--shadow); }
.kpi-label { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 26px; font-weight: 700; margin: 8px 0 4px; font-family: var(--mono); letter-spacing: -0.5px; }
.kpi-value small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.kpi-foot { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.up { color: #2f8a5b; }
.down { color: var(--red); }

.grid-2 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------------- 待办 ---------------- */
.todo { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.todo:last-child { border-bottom: 0; }
.todo:hover { background: #fafbfa; }
.todo-ico {
  width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; background: var(--brand-soft); color: var(--brand);
}
.todo-ico.warn { background: #fdf2e3; color: var(--amber); }
.todo-ico.danger { background: #fbeae7; color: var(--red); }
.todo-main { flex: 1; min-width: 0; }
.todo-t { font-size: 13px; font-weight: 500; }
.todo-d { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.todo-n { font-family: var(--mono); font-size: 18px; font-weight: 700; }
.todo-arrow { color: var(--text-3); font-size: 12px; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
.tb th {
  text-align: left; font-weight: 500; color: var(--text-3); font-size: 12px;
  padding: 10px 12px; background: #fafbfa; border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
.tb td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tb tbody tr:hover { background: #fbfcfb; }
.tb tbody tr:last-child td { border-bottom: 0; }
.tb .num { font-family: var(--mono); }
.tb .right { text-align: right; }
.tb .center { text-align: center; }
.tb .muted { color: var(--text-3); }
.tb .nowrap { white-space: nowrap; }
.tb-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-sel { width: 34px; }

.thumb { width: 38px; height: 38px; border-radius: 7px; object-fit: cover; background: #f0f2ef; border: 1px solid var(--line-soft); }
.pname { display: flex; align-items: center; gap: 9px; min-width: 0; }
.pname-main { min-width: 0; }
.pname-t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.pname-s { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ---------------- 徽标 ---------------- */
.tag {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px;
  font-size: 11px; line-height: 1; white-space: nowrap;
}
.tag-green { background: var(--brand-soft); color: var(--brand); }
.tag-amber { background: #fdf2e3; color: var(--amber); }
.tag-red { background: #fbeae7; color: var(--red); }
.tag-blue { background: #eaf2f8; color: var(--blue); }
.tag-gray { background: #f0f2ef; color: var(--text-2); }
.tag-clay { background: #fbeee6; color: var(--clay); }
.dot-live { width: 6px; height: 6px; border-radius: 50%; background: #43a06c; display: inline-block; margin-right: 5px; }

/* ---------------- 工具条 ---------------- */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.toolbar .spacer { flex: 1; }
.search { position: relative; }
.search .input { width: 220px; height: 34px; padding-left: 30px; }
.search::before {
  content: ""; position: absolute; left: 10px; top: 10px; width: 12px; height: 12px;
  border: 1.6px solid var(--text-3); border-radius: 50%;
}
.search::after {
  content: ""; position: absolute; left: 20px; top: 21px; width: 5px; height: 1.6px;
  background: var(--text-3); transform: rotate(45deg);
}
.seg { display: inline-flex; background: #f2f4f1; border-radius: 8px; padding: 2px; gap: 2px; }
.seg-item {
  height: 28px; padding: 0 11px; border-radius: 6px; display: flex; align-items: center;
  font-size: 12px; color: var(--text-2); cursor: pointer; white-space: nowrap;
}
.seg-item.on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); font-weight: 500; }
.seg-item .n { margin-left: 4px; font-family: var(--mono); color: var(--text-3); font-size: 11px; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--text-3); }

/* ---------------- 抽屉 / 弹层 ---------------- */
.mask { position: fixed; inset: 0; background: rgba(20, 26, 22, 0.36); z-index: 60; animation: fade 0.16s ease; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 560px; max-width: 94vw; background: #fff;
  z-index: 61; display: flex; flex-direction: column; box-shadow: -8px 0 32px rgba(20, 26, 22, 0.14);
  animation: slide 0.2s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.drawer.wide { width: 720px; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.drawer-title { font-size: 15px; font-weight: 600; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px; }
.drawer-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: #fcfdfc; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-2);
}
.icon-btn:hover { background: #f7f9f7; }
.modal {
  position: fixed; left: 50%; top: 12vh; transform: translateX(-50%); width: 460px; max-width: 94vw;
  background: #fff; border-radius: 12px; z-index: 61; box-shadow: 0 20px 60px rgba(20, 26, 22, 0.2);
  animation: pop 0.16s ease;
}
.modal.wide { width: 620px; }
/* 配送单预览：容纳 210mm 纸宽，超出则横向滚动 */
.modal.print-modal { width: 900px; }
.modal.print-modal .modal-body { max-height: 74vh; overflow: auto; }
.modal-head { padding: 16px 18px 6px; font-size: 15px; font-weight: 600; }
.modal-body { padding: 8px 18px 4px; max-height: 62vh; overflow-y: auto; }
.modal-foot { padding: 14px 18px 16px; display: flex; gap: 8px; justify-content: flex-end; }

@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0.6; } }
@keyframes pop { from { transform: translateX(-50%) scale(0.97); opacity: 0; } }

/* ---------------- Toast ---------------- */
.toasts { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #1f3a2e; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(20, 26, 22, 0.22); animation: pop2 0.18s ease;
}
.toast.err { background: #a5382c; }
@keyframes pop2 { from { transform: translateY(-6px); opacity: 0; } }

/* ---------------- 表单 ---------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 5px; }
.hint { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 28px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--line); background: #fff;
  font-size: 12px; display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
}
.chip.on { background: var(--brand-soft); border-color: #c9dfd2; color: var(--brand); font-weight: 500; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { display: none; }
.switch i { position: absolute; inset: 0; background: #d8ddd9; border-radius: 12px; transition: 0.18s; }
.switch i::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: 0.18s; }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(16px); }

/* ---------------- 图片上传 ---------------- */
.uploader { display: flex; gap: 10px; flex-wrap: wrap; }
.up-box {
  width: 84px; height: 84px; border-radius: 9px; border: 1px dashed #cfd6d0; background: #fafbfa;
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 3px;
  color: var(--text-3); font-size: 11px; cursor: pointer;
}
.up-box:hover { border-color: var(--brand); color: var(--brand); }
.up-item { position: relative; width: 84px; height: 84px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); }
.up-item img { width: 100%; height: 100%; object-fit: cover; }
.up-del {
  position: absolute; right: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: rgba(20, 26, 22, 0.62); color: #fff; font-size: 12px; display: flex;
  align-items: center; justify-content: center; cursor: pointer; border: 0;
}

/* ---------------- 图表 ---------------- */
.chart-box { padding: 8px 4px 0; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-3); padding: 0 12px 8px; }
.chart-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 5px; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.bar-name { width: 120px; color: var(--text-2); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 8px; background: #f0f2ef; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 4px; }
.bar-fill.clay { background: var(--clay); }
.bar-val { width: 92px; text-align: right; font-family: var(--mono); color: var(--text-2); }

/* ---------------- 打印单 ---------------- */
.print-sheet {
  width: 210mm; min-height: 297mm; padding: 14mm 12mm; background: #fff; color: #111;
  margin: 0 auto; box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12); font-size: 12px; line-height: 1.5;
}
.ps-head { display: flex; align-items: flex-start; border-bottom: 2px solid #111; padding-bottom: 8px; }
.ps-title { font-size: 20px; font-weight: 700; letter-spacing: 2px; }
.ps-sub { font-size: 11px; color: #444; margin-top: 3px; }
.ps-meta { margin-left: auto; text-align: right; font-size: 11px; color: #333; line-height: 1.7; }
.ps-base { display: flex; gap: 24px; padding: 8px 0; border-bottom: 1px dashed #999; font-size: 12px; }
.ps-sec { margin-top: 12px; font-size: 12px; }
.ps-sec h4 { margin: 0 0 6px; font-size: 12px; letter-spacing: 1px; }
.ps-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.ps-table th, .ps-table td { border: 1px solid #333; padding: 5px 6px; }
.ps-table th { background: #f0f0f0; text-align: left; font-weight: 600; }
.ps-table td.n { text-align: right; font-family: var(--mono); }
.ps-order { margin-bottom: 10px; border: 1px solid #333; }
.ps-order-head { display: flex; gap: 12px; background: #f6f6f6; padding: 5px 7px; font-size: 11.5px; border-bottom: 1px solid #333; }
.ps-order-head b { font-family: var(--mono); }
.ps-order-body { padding: 4px 7px 6px; }
.ps-order-body .addr { color: #333; margin-bottom: 3px; }
.ps-foot { margin-top: 16px; display: flex; justify-content: space-between; align-items: flex-end; font-size: 11px; color: #333; }
.sign { margin-top: 26px; display: flex; gap: 40px; }
.sign span { border-top: 1px solid #333; padding-top: 4px; width: 150px; text-align: center; }

/* ---------------- 打印模式 ---------------- */
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff !important; }
  .side, .topbar, .toolbar, .pager, .drawer-head, .drawer-foot, .modal-foot, .toasts, .no-print { display: none !important; }
  .mask, .drawer, .modal { position: static !important; inset: auto !important; width: auto !important; background: #fff !important; box-shadow: none !important; animation: none !important; transform: none !important; max-width: none !important; overflow: visible !important; }
  .drawer-body, .modal-body { padding: 0 !important; overflow: visible !important; max-height: none !important; }
  .print-sheet { box-shadow: none; margin: 0; width: auto; min-height: auto; padding: 12mm; page-break-after: always; }
  .print-sheet:last-child { page-break-after: auto; }
}

/* ---------------- 空态 / 加载 ---------------- */
.empty { padding: 46px 20px; text-align: center; color: var(--text-3); font-size: 13px; }
.empty b { display: block; color: var(--text-2); font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.skeleton { height: 14px; border-radius: 4px; background: linear-gradient(90deg, #f0f2ef 25%, #f7f8f6 37%, #f0f2ef 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) {
  .grid-kpi { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .side { width: 186px; flex-basis: 186px; }
  .content { padding: 14px; }
  .search .input { width: 150px; }
  .form-grid { grid-template-columns: 1fr; }
}
