:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #e3e8ee;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2f7d4f;
  --primary-dark: #256340;
  --primary-soft: #eaf4ee;
  --blue: #2563eb;
  --warn: #b45309;
  --warn-soft: #fff7ed;
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  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;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #f1f3f5;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  color: #334155;
  word-break: break-all;
}
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ============ 登录页 ============ */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 10% -10%, #e6f1e9 0%, transparent 55%),
    radial-gradient(900px 500px at 110% 110%, #e8eefb 0%, transparent 50%),
    var(--bg);
}
.login-wrap { width: 100%; max-width: 460px; padding: 24px; }
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 26px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #4e9c6d);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; letter-spacing: .5px;
}
.brand h1 { font-size: 18px; }
.brand-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; color: #374151; margin-bottom: 6px; font-weight: 500; }
.field .sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 6px; }

input[type=text], input[type=password], input[type=date], select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47,125,79,.12);
}
input[readonly] { background: #f8fafc; color: #475569; }
select[multiple] { padding: 6px; height: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn.primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #f0c9c4; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.block { width: 100%; padding: 11px; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.alert {
  background: var(--danger-soft);
  border: 1px solid #f5c6c0;
  color: #a02c1f;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}
.hint { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line); font-size: 12px; color: #475569; }
.hint p { margin: 0 0 8px; }

/* ============ 主框架 ============ */
.topbar {
  height: 58px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .left { display: flex; align-items: center; gap: 10px; }
.topbar .mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #4e9c6d);
  color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.topbar h1 { font-size: 15px; }
.topbar .right { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }

.layout { max-width: 1280px; margin: 0 auto; padding: 20px 24px 60px; }

.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 10px 16px; cursor: pointer; font-size: 14px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; user-select: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 15px; }
.panel-head .desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.panel-body { padding: 18px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ============ 表格 ============ */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 12px;
  padding: 9px 12px; background: #fafbfc; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.tbl td { padding: 11px 12px; border-bottom: 1px solid #f1f4f7; vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:hover td { background: #fcfdfe; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: #475569; }

.tag {
  display: inline-block; padding: 1px 8px; border-radius: 20px;
  font-size: 12px; line-height: 19px; white-space: nowrap;
}
.tag.ok { background: var(--primary-soft); color: var(--primary-dark); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.err { background: var(--danger-soft); color: var(--danger); }
.tag.gray { background: #f1f3f5; color: #54636f; }
.tag.blue { background: #eef3fe; color: var(--blue); }

/* ============ 上传控件 ============ */
.upload-box {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}
.upload-box.drag { border-color: var(--primary); background: var(--primary-soft); }
.upload-box input[type=file] { display: block; width: 100%; font-size: 13px; }
.filelist { margin-top: 8px; font-size: 12px; color: #475569; }
.filelist div { padding: 2px 0; }

.progress {
  height: 6px; background: #eef1f4; border-radius: 4px; overflow: hidden; margin-top: 8px;
}
.progress > i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }

.log {
  background: #0f172a; color: #cbd5e1; border-radius: 8px; padding: 12px 14px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px;
  line-height: 1.65; max-height: 320px; overflow: auto; white-space: pre-wrap;
  word-break: break-all;
}

.checkrow { display: flex; gap: 22px; flex-wrap: wrap; padding: 4px 0; }
.checkrow label { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; cursor: pointer; }
.checkrow input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--primary); }

.steps { font-size: 13px; }
.steps .step { display: flex; gap: 10px; padding: 5px 0; color: var(--muted); }
.steps .step .dot {
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid #cbd5e1;
  flex: none; margin-top: 3px; font-size: 10px; text-align: center; line-height: 14px;
}
.steps .step.done { color: var(--text); }
.steps .step.done .dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.steps .step.active { color: var(--text); font-weight: 500; }
.steps .step.active .dot { border-color: var(--primary); background: var(--primary-soft); }

.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.img-card {
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff;
}
.img-card img { width: 100%; height: 160px; object-fit: contain; background: #f8fafc; display: block; }
.img-card .cap { padding: 7px 10px; font-size: 12px; color: #475569; display: flex; justify-content: space-between; }

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

.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 860px;
  max-height: 86vh; overflow: auto; box-shadow: 0 20px 50px rgba(15,23,42,.25);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff;
}
.modal-body { padding: 20px; }
.close-x { cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; background: none; border: 0; }

.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 100;
  background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 8px;
  font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.2); opacity: 0;
  transform: translateY(8px); transition: all .2s; max-width: 420px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { background: #b3261e; }
.toast.ok { background: #22653f; }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.steps .step.error { color: var(--danger); }
.steps .step.error .dot { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
