/* ==========================================================================
   亦派物料中心 · 后台样式
   基调：暖白底 + 松绿主色，密度偏高，信息优先
   ========================================================================== */

:root {
  --bg: #f4f4ef;
  --paper: #ffffff;
  --ink: #171a18;
  --ink2: #5a625c;
  --ink3: #8d948e;
  --line: #e3e3da;
  --line2: #eef0e8;
  --accent: #2c5f45;
  --accent2: #3f7f5c;
  --accent-soft: #e9f0ea;
  --warn: #a8641f;
  --warn-soft: #fbf0e2;
  --danger: #a13a35;
  --danger-soft: #fbebea;
  --r: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.55 -apple-system, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

.ico { width: 17px; height: 17px; flex: none; }

/* ------------------------------------------------------------------ 框架 */

.app { display: flex; min-height: 100vh; }

.side {
  width: 232px;
  flex: none;
  background: var(--paper);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line2);
  text-decoration: none;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; flex: none;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 600;
  letter-spacing: 0;
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-txt b { font-size: 14px; font-weight: 600; white-space: nowrap; }
.brand-txt i { font-style: normal; font-size: 9.5px; letter-spacing: .12em; color: var(--ink3); margin-top: 2px; }

.nav { padding: 10px 10px 2px; overflow-y: auto; flex: 1; }
.nav-grp {
  font-size: 10.5px; letter-spacing: .12em; color: var(--ink3);
  padding: 14px 10px 6px; text-transform: uppercase;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--ink2); font-size: 13.5px;
  position: relative;
}
.nav a:hover { background: #f7f7f2; color: var(--ink); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.on::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}

.side-foot { border-top: 1px solid var(--line2); padding: 12px 18px 14px; }
.who { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.who b { font-size: 13px; font-weight: 600; }
.who span { font-size: 11px; color: var(--ink3); }
.who-acts { margin-top: 6px; display: flex; gap: 14px; font-size: 12px; }
.who-acts a { color: var(--ink3); }
.who-acts a:hover { color: var(--accent); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.top {
  height: 64px; flex: none;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 244, 239, .86);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.ttl { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.ttl h1 { font-size: 17px; }
.ttl span { font-size: 12px; color: var(--ink3); white-space: nowrap; }
.acts { display: flex; gap: 8px; align-items: center; }

.body { padding: 22px 28px 44px; }

/* ------------------------------------------------------------------ 卡片 */

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card-h {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--line2);
}
.card-h h2 { font-size: 13.5px; }
.card-h .hint { font-size: 12px; color: var(--ink3); }
.card-b { padding: 16px; }
.card-b.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }

/* ------------------------------------------------------------------ 统计块 */

.stat {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r);
  padding: 15px 16px; display: flex; flex-direction: column; gap: 6px;
}
.stat .k { font-size: 12px; color: var(--ink3); display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 27px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.stat .v small { font-size: 12px; font-weight: 400; color: var(--ink3); margin-left: 4px; }
.stat.alert { border-color: #edc9b4; background: #fdf7f1; }
.stat.alert .v { color: var(--warn); }

/* ------------------------------------------------------------------ 表格 */

.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-weight: 500; font-size: 11.5px; letter-spacing: .04em;
  color: var(--ink3); padding: 10px 14px; background: #fafaf5;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td {
  padding: 11px 14px; border-bottom: 1px solid var(--line2);
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fbfbf6; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .nowrap { white-space: nowrap; }
/* 单元格内单行省略：配合 title 悬停看全文，避免长名称把行高撑成两行 */
.tbl .ell1 {
  display: block; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.tbl .ell1.w-140 { max-width: 140px; }
.tbl .ell1.w-120 { max-width: 120px; }
.tbl .ell1.w-220 { max-width: 220px; }
.tbl .muted { color: var(--ink3); font-size: 12.5px; }
.tbl td .sub { color: var(--ink3); font-size: 11.5px; margin-top: 2px; }
.tbl .act { white-space: nowrap; text-align: right; }
.tbl .act a, .tbl .act button { font-size: 12.5px; margin-left: 10px; }

.tbl-wrap { overflow-x: auto; }
.tbl.nowrap-cell td, .tbl.nowrap-cell th { white-space: nowrap; }
.tbl.fixed { table-layout: fixed; min-width: 720px; }

/* 网格里的卡片不该吃 .card + .card 的上间距 */
.grid > .card + .card { margin-top: 0; }

.cell-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.cell-main > div { min-width: 0; }
img.thumb {
  width: 42px; height: 42px; flex: none; border-radius: 7px;
  object-fit: cover; border: 1px solid var(--line2); background: #f2f3ec; display: block;
}
img.thumb.lg { width: 74px; height: 74px; border-radius: 9px; }

/* ------------------------------------------------------------------ 徽标 */

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px; font-size: 11.5px; line-height: 1.7;
  background: #f1f2ec; color: var(--ink2); white-space: nowrap;
}
.pill-ok { background: var(--accent-soft); color: var(--accent); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-mute { background: #f2f2ee; color: var(--ink3); }
.pill-line { background: transparent; border: 1px solid var(--line); color: var(--ink2); }

/* ------------------------------------------------------------------ 按钮 */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 13px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font-size: 13px; font-family: inherit; cursor: pointer; white-space: nowrap;
  transition: .15s;
}
.btn:hover { border-color: #cfd2c7; text-decoration: none; }
.btn-pri { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-pri:hover { background: #24513b; border-color: #24513b; color: #fff; }
.btn-gh { background: transparent; }
.btn-sm { height: 27px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-danger { color: var(--danger); border-color: #eccfcb; }
.btn-danger:hover { background: var(--danger-soft); border-color: #e0b4ae; }
.btn-link {
  background: none; border: 0; padding: 0; height: auto; color: var(--accent);
  font-size: 12.5px; cursor: pointer; font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }

/* ------------------------------------------------------------------ 表单 */

.fld { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.fld > label { font-size: 12.5px; color: var(--ink2); }
.fld > label .req { color: var(--danger); margin-left: 2px; }
.fld .tip { font-size: 11.5px; color: var(--ink3); }

.inp, .sel, .ta {
  width: 100%; height: 34px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); font: inherit; font-size: 13.5px;
  outline: none; transition: .15s;
}
.ta { height: auto; padding: 9px 10px; min-height: 84px; resize: vertical; line-height: 1.6; }
.inp:focus, .sel:focus, .ta:focus { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(63, 127, 92, .12); }
.inp::placeholder, .ta::placeholder { color: #b3b9b1; }
.sel {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238d948e' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.inp-sm, .sel-sm { height: 29px; font-size: 12.5px; padding: 0 8px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }

.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink2); cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); }

.filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--line2); background: #fff;
}
.filters .inp, .filters .sel { width: auto; min-width: 150px; }
.filters .grow { flex: 1; min-width: 200px; }
.filters .spacer { flex: 1; }

.form-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-top: 1px solid var(--line2); background: #fbfbf6;
}
.form-foot .spacer { flex: 1; }

/* ------------------------------------------------------------------ 进度条 */

.bar { height: 7px; border-radius: 6px; background: #f0f1e9; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: var(--accent2); }
.bar-row { display: grid; grid-template-columns: 84px 1fr 40px; gap: 10px; align-items: center; font-size: 12.5px; }
.bar-row + .bar-row { margin-top: 9px; }
.bar-row .nm { color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .vl { text-align: right; color: var(--ink3); font-size: 12px; }

/* ------------------------------------------------------------------ 列表条目 */

.li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line2); }
.li:last-child { border-bottom: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .nm { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .mt { font-size: 11.5px; color: var(--ink3); margin-top: 2px; }

.kv { display: grid; grid-template-columns: 96px 1fr; gap: 9px 12px; font-size: 13px; }
.kv dt { color: var(--ink3); font-size: 12.5px; }
.kv dd { margin: 0; word-break: break-word; }
.kv dd.mono { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ 图集 */

.gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.gal figure { margin: 0; position: relative; }
.gal img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line2); display: block; }
.gal .del { position: absolute; top: 5px; right: 5px; background: rgba(255,255,255,.92); border-radius: 6px; padding: 1px 5px; font-size: 11px; color: var(--danger); }
.img-main { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; border: 1px solid var(--line2); display: block; background: #f2f3ec; }
.gal .main { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; border: 1px solid var(--line2); display: block; }
.gal-thumbs { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.gal-thumbs img { width: 58px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line2); cursor: pointer; }

.img-empty {
  border: 1px dashed #d9dbd0; border-radius: 10px; min-height: 200px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  color: var(--ink3); font-size: 12.5px; background: #fafaf5;
}
.img-empty img { width: 32px; height: 32px; opacity: .75; }

/* ------------------------------------------------------------------ 空态 / 分页 */

.empty { padding: 44px 20px; text-align: center; color: var(--ink3); font-size: 13px; }
.empty b { display: block; color: var(--ink2); font-size: 14px; margin-bottom: 6px; font-weight: 500; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line2); font-size: 12.5px; color: var(--ink3); }
.pager .pgs { display: flex; gap: 4px; }
.pager a, .pager span.cur {
  min-width: 28px; height: 28px; padding: 0 8px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); color: var(--ink2); background: #fff;
}
.pager span.cur { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ------------------------------------------------------------------ 提示条 */

.msg {
  padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px;
  border: 1px solid #cfe3d6; background: var(--accent-soft); color: #1f4a35;
}
.msg.err { border-color: #eccfc9; background: var(--danger-soft); color: #8c2f2a; }

.hint-line { font-size: 12.5px; color: var(--ink3); margin: -4px 0 14px; }
.sec-title { font-size: 12px; letter-spacing: .08em; color: var(--ink3); text-transform: uppercase; margin: 22px 0 10px; }
.sec-title:first-child { margin-top: 0; }

/* ------------------------------------------------------------------ 登录页 */

.login-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1fr 460px;
  background: var(--bg);
}
.login-side {
  background: linear-gradient(160deg, #22331f 0%, #2c5f45 55%, #3f7f5c 100%);
  color: #eef3ec; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-side::after {
  content: ""; position: absolute; right: -120px; bottom: -140px;
  width: 420px; height: 420px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.16);
}
.login-side h2 { font-size: 26px; font-weight: 500; line-height: 1.45; letter-spacing: 0; }
.login-side p { color: rgba(238,243,236,.62); font-size: 13px; margin: 14px 0 0; max-width: 380px; }
.login-side .mk { font-size: 11px; letter-spacing: .22em; color: rgba(238,243,236,.5); }
.login-form {
  background: var(--paper); padding: 56px 48px; display: flex; flex-direction: column; justify-content: center;
}
.login-form h1 { font-size: 20px; margin-bottom: 6px; }
.login-form .sub { color: var(--ink3); font-size: 13px; margin-bottom: 26px; }
.login-form .inp { height: 38px; }
.login-form .btn { height: 38px; width: 100%; margin-top: 6px; }
.login-foot { margin-top: 26px; font-size: 11.5px; color: var(--ink3); }

/* ------------------------------------------------------------------ 响应式 */

@media (max-width: 1080px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-2-1, .g-1-2, .g3 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .app { flex-direction: column; }
  .side {
    width: 100%; height: auto; position: static;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 12px 16px; border-bottom: 0; }
  .brand-mark { width: 30px; height: 30px; font-size: 15px; }
  .nav { display: flex; overflow-x: auto; padding: 0 8px 10px; gap: 2px; }
  .nav-grp { display: none; }
  .nav a { white-space: nowrap; padding: 7px 10px; }
  .nav a.on::before { display: none; }
  .side-foot { display: none; }
  .top { height: auto; padding: 12px 16px; flex-wrap: wrap; gap: 8px; position: static; }
  .body { padding: 16px 16px 40px; }
  .g2, .g4, .row2, .row3 { grid-template-columns: minmax(0, 1fr); }
  .login-wrap { grid-template-columns: 1fr; }
  .login-side { display: none; }
  .login-form { padding: 40px 26px; }
  .tbl th, .tbl td { padding: 10px; }
}
