:root {
  --bg: #eef3e7;
  --bg-deep: #e3ebdc;
  --paper: #fffdf7;
  --paper-soft: #f8f8f0;
  --ink: #17332c;
  --ink-2: #41564d;
  --muted: #748078;
  --line: #d4ddcc;
  --line-strong: #bccbb3;
  --green: #4d7b5e;
  --green-dark: #315843;
  --green-soft: #dfe9dc;
  --green-pale: #edf4e9;
  --amber: #9b6b3c;
  --amber-soft: #f2e7d6;
  --danger: #a3483d;
  --danger-soft: #f7e7e3;
  --shadow: 0 20px 50px rgba(31, 64, 48, 0.08);
  --shadow-small: 0 8px 24px rgba(31, 64, 48, 0.07);
  --radius: 14px;
  --radius-small: 9px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --serif: "Songti SC", "STSong", "SimSun", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(rgba(38, 76, 56, .055) .7px, transparent .7px) 0 0 / 18px 18px,
    linear-gradient(135deg, #f2f5ec 0%, var(--bg) 48%, #e8efe2 100%);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: 4px;
  z-index: 30;
  background: linear-gradient(90deg, var(--green-dark) 0 68%, var(--amber) 68%);
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { letter-spacing: -.035em; }
code { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.danger { color: var(--danger) !important; }

input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  color: var(--ink);
  background: #fff;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
textarea { resize: vertical; min-height: 84px; }
input::placeholder, textarea::placeholder { color: #a2aaa4; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(77, 123, 94, .12);
  background: #fffefb;
}
label { display: block; margin-bottom: 6px; color: var(--ink-2); font-size: 13px; font-weight: 600; }

.btn {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { color: #fff; background: var(--green); box-shadow: 0 7px 18px rgba(49, 88, 67, .18); }
.btn-primary:hover { background: var(--green-dark); box-shadow: 0 9px 24px rgba(49, 88, 67, .24); }
.btn-ghost { color: var(--ink-2); border-color: var(--line); background: rgba(255,255,255,.48); }
.btn-ghost:hover { border-color: var(--line-strong); background: #fff; }
.btn-danger { color: #fff; background: var(--danger); }
.btn-danger:hover { background: #87382f; }
.btn-block { width: 100%; }
.btn-plus { font-size: 20px; font-weight: 400; line-height: .8; }
.text-button { padding: 0; border: 0; color: var(--muted); background: none; cursor: pointer; font-size: 12px; }
.text-button:hover { color: var(--danger); }

.eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .18em;
}

.flash-stack { display: grid; gap: 8px; margin-bottom: 18px; }
.flash {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--paper);
  box-shadow: var(--shadow-small);
  font-size: 13px;
  line-height: 1.6;
}
.flash-success { border-color: #bfd2bd; background: #edf5e9; color: #315b40; }
.flash-error { border-color: #e4c1bb; background: var(--danger-soft); color: #823b32; }
.flash-info { border-color: #d9ceb6; background: #faf4e8; color: #76582f; }

/* PC 外壳 */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 4px auto 0 0;
  z-index: 20;
  display: flex;
  width: 236px;
  flex-direction: column;
  padding: 28px 20px 20px;
  border-right: 1px solid rgba(188, 203, 179, .7);
  background: rgba(246, 248, 240, .82);
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; }
.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--green);
  border-radius: 50%;
  color: var(--green-dark);
  background: var(--green-pale);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
}
.brand strong { display: block; font-size: 17px; letter-spacing: -.02em; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; font-weight: 700; letter-spacing: .13em; }
.brand.compact { padding: 0; }
.brand.compact .brand-mark { width: 32px; height: 32px; font-size: 15px; }
.brand.compact strong { font-size: 16px; }
.side-nav { display: grid; gap: 5px; margin-top: 36px; }
.side-nav a {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.side-nav a svg { width: 18px; height: 18px; color: var(--muted); }
.side-nav a:hover { background: rgba(255,255,255,.65); }
.side-nav a.active { border-color: #cad8c2; color: var(--green-dark); background: #e7efe1; }
.side-nav a.active svg { color: var(--green); }
.sidebar-foot { display: grid; gap: 16px; margin-top: auto; padding: 18px 8px 2px; border-top: 1px solid var(--line); }
.access-badge { display: flex; align-items: center; gap: 9px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #69a579; box-shadow: 0 0 0 4px rgba(105,165,121,.12); }
.access-badge strong, .access-badge small { display: block; }
.access-badge strong { font-size: 12px; }
.access-badge small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.main { min-height: 100vh; margin-left: 236px; padding: 46px clamp(28px, 4.5vw, 70px) 60px; }
.content { width: min(1180px, 100%); margin: 0 auto; }
.mobile-header, .mobile-nav { display: none; }

/* 页头与搜索 */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.page-head h1 { margin-bottom: 9px; font-family: var(--serif); font-size: clamp(34px, 4vw, 53px); font-weight: 700; line-height: 1.08; }
.page-head p { max-width: 610px; margin-bottom: 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.dashboard-head h1 { max-width: 640px; }
.head-actions { display: flex; flex: 0 0 auto; gap: 9px; }
.hero-search {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
  padding: 9px 9px 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: rgba(255,253,247,.82);
  box-shadow: 0 14px 40px rgba(37,74,54,.06);
}
.hero-search svg { flex: 0 0 auto; color: var(--green); }
.hero-search input { min-height: 42px; padding: 0; border: 0; box-shadow: none; background: transparent; font-size: 16px; }
.hero-search input:focus { box-shadow: none; }
.hero-search .btn { min-width: 92px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 42px; }
.stat-card {
  position: relative;
  overflow: hidden;
  padding: 20px 22px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,253,247,.7);
}
.stat-card::after { content: ""; position: absolute; right: -26px; bottom: -42px; width: 110px; height: 110px; border: 1px solid rgba(77,123,94,.12); border-radius: 50%; }
.stat-card.accent { color: #f6fbf2; border-color: var(--green); background: var(--green-dark); }
.stat-card.accent::after { border-color: rgba(255,255,255,.15); }
.stat-label { display: block; margin-bottom: 14px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.stat-card.accent .stat-label, .stat-card.accent small { color: rgba(255,255,255,.65); }
.stat-card strong { display: block; margin-bottom: 3px; font-family: var(--serif); font-size: 38px; line-height: 1; }
.stat-card small { color: var(--muted); font-size: 11px; }
.section-block { margin-top: 10px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-family: var(--serif); font-size: 26px; }
.section-head p { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.section-count { color: var(--muted); font-size: 12px; }
.box-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.box-card {
  position: relative;
  display: flex;
  min-height: 190px;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,253,247,.77);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.box-card:hover { transform: translateY(-3px); border-color: var(--line-strong); background: var(--paper); box-shadow: var(--shadow); }
.box-card-top, .box-card-foot { display: flex; align-items: center; justify-content: space-between; }
.box-index { color: var(--muted); font-family: var(--serif); font-size: 13px; }
.box-arrow { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--line); border-radius: 50%; font-size: 13px; transition: background .16s ease, color .16s ease; }
.box-card:hover .box-arrow { color: #fff; background: var(--green); }
.box-card-main { margin: auto 0; }
.box-card h3 { margin: 14px 0 6px; font-family: var(--serif); font-size: 28px; word-break: break-all; }
.box-card-main p { margin: 0; color: var(--muted); font-size: 12px; }
.box-card-foot { padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.mini-qr { display: inline-grid; width: 28px; height: 28px; place-items: center; border-radius: 5px; color: var(--green-dark); background: var(--green-soft); font-size: 8px; font-weight: 800; letter-spacing: .06em; }

/* 空状态 */
.empty-state { display: grid; place-items: center; padding: 58px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); text-align: center; background: rgba(255,253,247,.52); }
.empty-state.compact { padding: 38px 20px; }
.empty-icon { display: grid; width: 52px; height: 52px; margin-bottom: 16px; place-items: center; border: 1px solid var(--green); border-radius: 50%; color: var(--green-dark); background: var(--green-pale); font-family: var(--serif); font-size: 19px; }
.empty-state h1, .empty-state h3 { margin-bottom: 8px; font-family: var(--serif); font-size: 25px; }
.empty-state p { max-width: 430px; margin-bottom: 20px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.error-state { min-height: 58vh; }

/* 箱子详情 */
.breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; color: var(--muted); font-size: 12px; }
.breadcrumb a:hover { color: var(--green); }
.breadcrumb strong { color: var(--ink-2); }
.box-head { align-items: center; }
.box-title-block h1 { word-break: break-all; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 22px; align-items: start; }
.detail-main { display: grid; gap: 22px; min-width: 0; }
.item-groups { display: grid; gap: 18px; }
.item-group { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.item-group > header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); background: #f7f8f1; }
.item-group h2 { margin: 0; font-size: 16px; }
.item-group header span { color: var(--muted); font-size: 11px; }
.item-table-wrap { overflow-x: auto; }
.item-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.item-table th { padding: 10px 13px; color: var(--muted); background: rgba(248,248,240,.6); font-size: 10px; font-weight: 700; text-align: left; letter-spacing: .05em; }
.item-table td { padding: 13px; border-top: 1px solid #e8ece3; vertical-align: top; }
.item-table tbody tr:first-child td { border-top: 0; }
.item-table tbody tr:hover { background: #fbfcf7; }
.item-table td strong { font-size: 13px; }
.tag { display: inline-flex; padding: 4px 7px; border-radius: 5px; color: var(--green-dark); background: var(--green-soft); font-size: 10px; white-space: nowrap; }
.quantity { font-family: var(--serif); font-size: 17px; font-weight: 700; }
.meta-line { display: block; margin-bottom: 2px; color: var(--ink-2); line-height: 1.5; }
.meta-line.serial { color: var(--amber); }
.note-cell { display: block; max-width: 240px; color: var(--muted); line-height: 1.55; }
.action-col { width: 132px; }
.row-actions { white-space: nowrap; }
.icon-text-button { padding: 3px 5px; border: 0; color: var(--green); background: none; cursor: pointer; font-size: 11px; }
.icon-text-button:hover { text-decoration: underline; }
.detail-aside { position: sticky; top: 24px; display: grid; gap: 14px; }
.qr-card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-small); }
.compact-head { align-items: flex-start; margin-bottom: 15px; }
.compact-head h2 { font-size: 21px; }
.qr-live { padding: 4px 7px; border-radius: 20px; color: #376246; background: var(--green-soft); font-size: 9px; font-weight: 800; }
.qr-frame { display: grid; padding: 16px; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fffefb; }
.qr-frame img { display: block; width: 100%; max-width: 210px; height: auto; }
.qr-caption { margin: 14px 0; color: var(--ink-2); font-size: 12px; line-height: 1.65; }
.qr-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.qr-actions .btn { padding-inline: 10px; font-size: 11px; }
.qr-tip { margin: 13px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.manage-card { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,253,247,.7); }
.manage-card summary { cursor: pointer; color: var(--ink-2); font-size: 12px; font-weight: 700; }
.manage-link { display: block; width: 100%; margin-top: 12px; padding: 0; border: 0; background: none; color: var(--green); cursor: pointer; font-size: 11px; text-align: left; }
.manage-link.danger { color: var(--danger); }

/* 批量录入 */
.add-panel { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-small); scroll-margin-top: 20px; }
.item-rows { display: grid; gap: 10px; }
.item-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(170px, 1.5fr) minmax(150px, 1.2fr) 70px 70px minmax(100px, .9fr) minmax(130px, 1fr) minmax(150px, 1.2fr);
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcf7;
}
.item-row label { font-size: 10px; }
.item-row input, .item-row select { min-height: 40px; padding: 8px 9px; font-size: 12px; }
.remove-row { position: absolute; top: -7px; right: -7px; display: grid; width: 24px; height: 24px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: var(--paper); cursor: pointer; }
.remove-row:hover { color: #fff; border-color: var(--danger); background: var(--danger); }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--line); }
.form-foot p { margin: 0; color: var(--muted); font-size: 11px; }
.form-hint { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

/* 搜索页 */
.search-panel { margin-bottom: 32px; padding: 15px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,253,247,.74); }
.search-main { display: flex; align-items: center; gap: 10px; }
.search-main > svg { margin-left: 5px; color: var(--green); }
.search-main input { border: 0; background: transparent; font-size: 16px; box-shadow: none; }
.search-main input:focus { box-shadow: none; }
.search-main .btn { min-width: 100px; }
.filter-row { display: flex; align-items: flex-end; gap: 10px; margin-top: 12px; padding: 12px 4px 0; border-top: 1px solid var(--line); }
.filter-row label { min-width: 170px; margin: 0; font-size: 10px; }
.filter-row select { min-height: 39px; margin-top: 4px; }
.filter-reset { margin: 0 0 11px auto; color: var(--muted); font-size: 11px; }
.filter-reset:hover { color: var(--green); }
.result-list { display: grid; gap: 14px; }
.result-box { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.result-box-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 18px; border-bottom: 1px solid var(--line); background: #f7f8f2; }
.result-box-head:hover h3 { color: var(--green); }
.result-label { color: var(--muted); font-size: 9px; letter-spacing: .1em; }
.result-box-head h3 { margin: 4px 0 0; font-family: var(--serif); font-size: 23px; }
.result-meta { display: flex; align-items: center; gap: 13px; color: var(--muted); font-size: 10px; }
.result-meta b { color: var(--green); font-size: 11px; }
.result-items { display: grid; }
.result-item { display: grid; grid-template-columns: minmax(150px, .8fr) 90px minmax(220px, 1.5fr); gap: 16px; padding: 13px 18px; border-top: 1px solid #e8ece3; align-items: center; }
.result-item:first-child { border-top: 0; }
.result-item-main strong, .result-item-main span { display: block; }
.result-item-main strong { font-size: 13px; }
.result-item-main span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.result-item-quantity { font-family: var(--serif); font-size: 19px; font-weight: 700; }
.result-item-quantity small { color: var(--muted); font-family: var(--font); font-size: 10px; font-weight: 400; }
.result-item-meta { display: flex; flex-wrap: wrap; gap: 4px 13px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.search-guide { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 34px; }
.search-guide > div { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,253,247,.58); }
.guide-number { display: block; margin-bottom: 22px; color: var(--green); font-family: var(--serif); font-size: 13px; }
.search-guide h3 { margin-bottom: 8px; font-size: 15px; }
.search-guide p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }

/* 分类 */
.category-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.category-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.category-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px; border-bottom: 1px solid var(--line); background: #f7f8f2; }
.category-index { color: var(--green); font-family: var(--serif); font-size: 11px; }
.category-card h2 { margin: 5px 0 3px; font-family: var(--serif); font-size: 23px; }
.category-card header p { margin: 0; color: var(--muted); font-size: 10px; }
.category-actions, .category-child-actions { display: flex; gap: 4px; }
.mini-button { display: grid; width: 27px; height: 27px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 5px; color: var(--ink-2); background: rgba(255,255,255,.7); cursor: pointer; font-size: 10px; }
.mini-button:hover { border-color: var(--green); color: var(--green-dark); }
.mini-button.danger:hover { border-color: var(--danger); color: var(--danger); }
.category-children { display: grid; }
.category-child { display: flex; min-height: 46px; align-items: center; gap: 9px; padding: 8px 18px; border-top: 1px solid #e8ece3; }
.category-child:first-child { border-top: 0; }
.category-child strong { font-size: 12px; }
.category-dot { width: 5px; height: 5px; flex: 0 0 auto; border-radius: 50%; background: #8faf92; }
.category-child-actions { margin-left: auto; opacity: .3; transition: opacity .16s ease; }
.category-child:hover .category-child-actions { opacity: 1; }
.category-empty { margin: 0; padding: 18px; color: var(--muted); font-size: 11px; }

/* 审计 */
.audit-panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.audit-table-wrap { overflow-x: auto; }
.audit-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.audit-table th { padding: 11px 13px; color: var(--muted); background: #f7f8f2; font-size: 9px; text-align: left; letter-spacing: .07em; }
.audit-table td { padding: 12px 13px; border-top: 1px solid #e8ece3; vertical-align: top; }
.audit-table time { color: var(--ink-2); white-space: nowrap; }
.audit-action { display: inline-flex; padding: 4px 6px; border-radius: 4px; color: var(--green-dark); background: var(--green-soft); white-space: nowrap; font-size: 9px; font-weight: 700; }
.audit-summary { display: block; max-width: 360px; color: var(--ink-2); line-height: 1.55; }
.audit-table code { color: var(--muted); }

/* 弹窗和通用表单 */
.modal { width: min(520px, calc(100vw - 28px)); max-height: calc(100vh - 36px); padding: 0; overflow: auto; border: 1px solid var(--line-strong); border-radius: 15px; color: var(--ink); background: var(--paper); box-shadow: 0 28px 90px rgba(20,44,33,.22); }
.modal::backdrop { background: rgba(24, 46, 36, .36); backdrop-filter: blur(3px); }
.modal-card { padding: 24px; }
.modal-card.wide { width: 100%; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.modal-head h2 { margin: 0; font-family: var(--serif); font-size: 29px; }
.icon-button { display: grid; width: 31px; height: 31px; flex: 0 0 auto; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: #fff; cursor: pointer; font-size: 18px; }
.icon-button:hover { color: var(--danger); border-color: #dbb9b3; }
.modal-copy { margin-bottom: 18px; color: var(--ink-2); font-size: 13px; line-height: 1.7; }
.modal-copy.warning { padding: 11px 12px; border: 1px solid #e4c2bb; border-radius: 8px; color: #7e3d34; background: var(--danger-soft); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.modal-card > label:not(:first-of-type), .modal-card > input + label, .modal-card > select + label { margin-top: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid .span-2 { grid-column: span 2; }

/* 登录 */
.guest-shell { display: grid; min-height: 100vh; place-items: center; padding: 28px; }
.login-layout { display: grid; width: min(930px, 100%); grid-template-columns: 1.15fr .85fr; gap: 50px; align-items: center; }
.login-intro h1 { margin: 12px 0 21px; font-family: var(--serif); font-size: clamp(43px, 5.5vw, 70px); line-height: 1.08; }
.login-intro > p { max-width: 460px; color: var(--muted); font-size: 14px; line-height: 1.85; }
.login-points { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 30px; }
.login-points span { padding: 7px 10px; border: 1px solid var(--line); border-radius: 20px; color: var(--ink-2); background: rgba(255,255,255,.42); font-size: 10px; }
.login-card { padding: 34px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); box-shadow: var(--shadow); }
.login-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.brand-mark.large { width: 48px; height: 48px; font-size: 22px; }
.login-card h2 { margin: 0 0 3px; font-family: var(--serif); font-size: 27px; }
.login-card-head p { margin: 0; color: var(--muted); font-size: 10px; }
.login-card .btn { margin-top: 16px; }

/* 手机端 */
@media (max-width: 1100px) {
  .box-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item-row { grid-template-columns: minmax(150px, 1.4fr) minmax(140px, 1.2fr) 66px 66px minmax(100px, 1fr); }
  .item-row .field-note { grid-column: span 2; }
}

@media (max-width: 900px) {
  .sidebar { width: 205px; padding-inline: 14px; }
  .main { margin-left: 205px; padding: 34px 22px 50px; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-aside { position: static; grid-template-columns: 1fr 1fr; }
  .category-grid { grid-template-columns: 1fr; }
  .item-row { grid-template-columns: 1fr 1fr 70px 70px; }
  .item-row .field-name, .item-row .field-note { grid-column: span 2; }
  .item-row .field:nth-of-type(5), .item-row .field:nth-of-type(6) { grid-column: span 2; }
  .login-layout { grid-template-columns: 1fr; width: min(520px, 100%); gap: 28px; }
  .login-intro h1 { font-size: 47px; }
  .login-intro > p { margin-bottom: 0; }
}

@media (max-width: 720px) {
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 16px 14px 30px; }
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    padding: 6px 2px 10px;
    border-bottom: 1px solid rgba(188,203,179,.55);
  }
  .mobile-context { max-width: 46%; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 25;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(188,203,179,.8);
    background: rgba(252,252,246,.94);
    backdrop-filter: blur(18px);
  }
  .mobile-nav a, .mobile-nav button {
    display: grid;
    min-height: 48px;
    place-items: center;
    gap: 1px;
    padding: 3px;
    border: 0;
    color: var(--muted);
    background: none;
    font-size: 9px;
  }
  .mobile-nav svg { width: 19px; height: 19px; }
  .mobile-nav .active { color: var(--green-dark); }
  .mobile-scan-mark { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid var(--green); border-radius: 50%; color: #fff; background: var(--green); font-size: 20px; line-height: 1; }
  .content { width: 100%; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 16px; margin-bottom: 22px; }
  .page-head h1 { font-size: 38px; }
  .page-head p { font-size: 12px; }
  .desktop-only { display: none !important; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .hero-search { padding: 7px 7px 7px 12px; }
  .hero-search input { font-size: 14px; }
  .hero-search .btn { min-width: 68px; padding-inline: 12px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 32px; }
  .stat-card { padding: 16px; }
  .stat-card:last-child { grid-column: span 2; }
  .stat-card strong { font-size: 31px; }
  .box-grid { grid-template-columns: 1fr; gap: 10px; }
  .box-card { min-height: 154px; }
  .box-card h3 { font-size: 24px; }
  .section-head { align-items: flex-start; }
  .section-head h2 { font-size: 23px; }
  .detail-aside { grid-template-columns: 1fr; }
  .item-table thead { display: none; }
  .item-table, .item-table tbody, .item-table tr, .item-table td { display: block; width: 100%; }
  .item-table tr { padding: 13px 14px; border-top: 1px solid #e4e9df; }
  .item-table tbody tr:first-child { border-top: 0; }
  .item-table td { padding: 4px 0; border: 0; }
  .item-table td::before { content: attr(data-label); display: inline-block; min-width: 58px; color: var(--muted); font-size: 9px; }
  .item-table td[data-label="物品"]::before, .item-table td[data-label="操作"]::before { display: none; }
  .item-table td[data-label="物品"] { margin-bottom: 5px; }
  .note-cell { max-width: none; display: inline; }
  .row-actions { display: flex; gap: 11px; margin-top: 7px; padding-top: 8px !important; border-top: 1px dashed var(--line) !important; }
  .row-actions .icon-text-button { font-size: 11px; }
  .add-panel { padding: 17px 14px; }
  .item-row { grid-template-columns: 1fr 1fr; gap: 9px; padding: 13px 12px; }
  .item-row .field-name, .item-row .field-note, .item-row .field:nth-of-type(2) { grid-column: span 2; }
  .item-row .field:nth-of-type(5), .item-row .field:nth-of-type(6) { grid-column: span 1; }
  .form-foot { align-items: flex-start; flex-direction: column; }
  .form-foot .btn { width: 100%; }
  .search-main { gap: 7px; }
  .search-main input { font-size: 14px; }
  .search-main .btn { min-width: 72px; }
  .filter-row { display: grid; grid-template-columns: 1fr 1fr; }
  .filter-row label { min-width: 0; }
  .filter-reset { grid-column: span 2; margin: 2px 0 0; text-align: right; }
  .result-box-head { align-items: flex-start; flex-direction: column; }
  .result-meta { width: 100%; justify-content: space-between; }
  .result-item { grid-template-columns: 1fr auto; gap: 8px; }
  .result-item-main { grid-column: span 1; }
  .result-item-meta { grid-column: span 2; }
  .search-guide { grid-template-columns: 1fr; }
  .search-guide > div { padding: 18px; }
  .guide-number { margin-bottom: 12px; }
  .category-card > header { padding: 15px; }
  .category-child { padding-inline: 15px; }
  .category-child-actions { opacity: 1; }
  .audit-table thead { display: none; }
  .audit-table, .audit-table tbody, .audit-table tr, .audit-table td { display: block; width: 100%; }
  .audit-table tr { padding: 12px 14px; border-top: 1px solid #e4e9df; }
  .audit-table tbody tr:first-child { border-top: 0; }
  .audit-table td { padding: 4px 0; border: 0; }
  .audit-table td::before { content: attr(data-label); display: inline-block; min-width: 54px; color: var(--muted); font-size: 9px; }
  .audit-summary { display: inline; max-width: none; }
  .modal { width: calc(100vw - 20px); max-height: calc(100vh - 24px); }
  .modal-card { padding: 20px 17px; }
  .modal-head h2 { font-size: 25px; }
  .modal-actions .btn { flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .guest-shell { padding: 18px; }
  .login-intro h1 { font-size: 40px; }
  .login-card { padding: 25px 20px; }
  .login-points { margin-top: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
