﻿:root {
  --bg: #efecf7;
  --card: #ffffff;
  --ink: #2d2a4a;
  --sub: #7d7a96;
  --line: #e5e1f0;
  --brand: #5b4bc4;
  --brand-dark: #473aa5;
  --green: #388e5c;
  --orange: #f0883a;
  --red: #e5484d;
  --yellow: #d9a514;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
input, select, textarea {
  font: inherit;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  width: 100%;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
textarea { resize: vertical; }
button { font: inherit; cursor: pointer; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}
.card-title {
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.tiny { font-size: 12px; color: var(--sub); font-weight: 400; }
.muted { color: var(--sub); }
.empty { color: var(--sub); text-align: center; padding: 18px 0; }
.req { color: var(--red); }
.opt-tag { color: var(--sub); font-size: 12px; font-weight: 400; }

.btn {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
}
.btn:active { background: var(--brand-dark); }
.btn.gray { background: #eeebf6; color: var(--ink); }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.danger { background: var(--red); }
.btn.sm { padding: 4px 10px; font-size: 13px; border-radius: 6px; }
.btn.block { display: block; width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.field { margin-bottom: 10px; }
.field-label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 4px; }
.row { display: flex; gap: 10px; }
.row .field { flex: 1; min-width: 0; }
@media (max-width: 560px) { .row { display: block; } }

.chip {
  display: inline-block;
  background: #eeebf6;
  color: var(--sub);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  margin-right: 4px;
}
.chip.green { background: #e6f7ee; color: var(--green); }
.chip.orange { background: #fdf1e6; color: var(--orange); }
.chip.red { background: #fdeaea; color: var(--red); }
.chip.yellow { background: #faf4dd; color: var(--yellow); }
.chip.blue { background: #e9e3f9; color: var(--brand); }

.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.list-item:last-child { border-bottom: none; }
.list-item .name { font-weight: 500; }
.list-item .meta { font-size: 12px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .qty { font-weight: 600; white-space: nowrap; }
.list-item .qty.zero { color: var(--red); }
.thumb {
  width: 42px; height: 42px;
  border-radius: 8px;
  background: #f1eef9 center/cover no-repeat;
  flex: 0 0 42px;
}
.thumb-blank {
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; opacity: 0.45;
  border: 1px dashed #c9c3dd;
}

.header-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.page-title { font-size: 18px; font-weight: 700; }
.back-link { color: var(--brand); cursor: pointer; margin-right: 8px; }
.kv { display: flex; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: none; }
.kv .k { flex: 0 0 76px; color: var(--sub); font-size: 13px; }
.kv .v { flex: 1; min-width: 0; word-break: break-all; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs .t {
  padding: 6px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 14px;
}
.tabs .t.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(45, 42, 74, .92);
  color: #fff;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all .2s;
  z-index: 300;
  max-width: 86vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .38);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
}
.mask.hidden { display: none; }
.mask-box {
  background: #fff;
  border-radius: 12px;
  padding: 22px 30px;
  text-align: center;
  max-width: 80vw;
}
.spinner {
  width: 30px; height: 30px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  margin: 0 auto 10px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; white-space: nowrap; }
th { background: #f6f4fb; }

.hidden-file { display: none; }
.hidden { display: none; }
.login-wrap.hidden { display: none; }

.progress { height: 8px; background: #eeebf6; border-radius: 999px; overflow: hidden; }
.progress .bar { height: 100%; background: var(--brand); border-radius: 999px; transition: width .3s; }

.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.82);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
}
.lightbox.show { display: flex; }
.lightbox img { max-width: 94vw; max-height: 88vh; border-radius: 8px; }
.lightbox .lb-close {
  position: absolute; top: 14px; right: 16px;
  color: #fff; font-size: 14px;
  background: rgba(255,255,255,.18);
  padding: 6px 14px; border-radius: 999px;
}

/* ---------- shell 甯冨眬锛氫晶鏍忥紙妗岄潰锛? 搴曟爮锛堢Щ鍔級 ---------- */
.shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  flex: 0 0 180px;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.brand { padding: 4px 8px 12px; }
.brand-title { font-weight: 700; font-size: 16px; }
.brand-sub { font-size: 12px; color: var(--sub); margin-top: 2px; }
.nav-item {
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink);
}
.nav-item.active { background: #e9e3f9; color: var(--brand); font-weight: 600; }
.sidebar-foot { margin-top: auto; font-size: 12px; color: var(--sub); padding: 8px; }
.main {
  flex: 1;
  min-width: 0;
  padding: 16px;
  padding-bottom: 80px;
  max-width: 860px;
}
.topbar { display: none; }
.tabbar { display: none; }
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .main { padding: 12px; padding-bottom: 76px; max-width: none; }
  .tabbar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: #fff;
    border-top: 1px solid var(--line);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tab {
    flex: 1;
    text-align: center;
    padding: 8px 0 6px;
    font-size: 11px;
    color: var(--sub);
    cursor: pointer;
  }
  .tab .ico { display: block; font-size: 20px; }
  .tab.active { color: var(--brand); }
  .topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    margin-bottom: 10px;
  }
  .topbar .sub { font-size: 12px; color: var(--sub); font-weight: 400; }
}

/* ---------- 鐧诲綍椤?---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card { width: 100%; max-width: 380px; }
.login-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.login-sub { color: var(--sub); font-size: 13px; margin-bottom: 16px; }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.code-row .btn { flex: 0 0 auto; white-space: nowrap; }

/* ---------- 骞抽潰鍥?---------- */
.plan {
  position: relative;
  width: 100%;
  padding-bottom: 62%;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 24px, rgba(0,0,0,.035) 25px),
    repeating-linear-gradient(90deg, transparent, transparent 24px, rgba(0,0,0,.035) 25px),
    #fcfbff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.plan .cab {
  position: absolute;
  background: #e9e3f9;
  border: 1.5px solid var(--brand);
  border-radius: 8px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  overflow: hidden;
}
.plan .cab .n {
  margin-left: 5px;
  background: var(--brand);
  color: #fff;
  border-radius: 999px;
  padding: 0 6px;
  font-size: 11px;
}
.plan .cab.dim { opacity: .45; }
.plan .cab.editable { cursor: move; border-style: dashed; }
.plan .cab.editable .grip {
  position: absolute;
  right: 2px; bottom: 2px;
  width: 12px; height: 12px;
  background:
    linear-gradient(135deg, transparent 50%, var(--brand) 50%);
  border-bottom-right-radius: 6px;
  cursor: nwse-resize;
}
.cab-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.cab-card {
  background: #f6f4fb;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
}
.cab-card .t { font-weight: 600; }
.cab-card .s { font-size: 12px; color: var(--sub); margin-top: 2px; }
.layer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.layer-card {
  background: #f6f4fb;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
}
.layer-card .t { font-weight: 600; }
.layer-card .s { font-size: 12px; color: var(--sub); margin-top: 2px; }

/* ---------- 宸ュ叿鏍?/ 缁熻 ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.tool {
  background: #f6f4fb;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 6px;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
}
.tool:active { background: #eeebf6; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 480px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat { text-align: center; padding: 8px 0; }
.stat .n { font-size: 22px; font-weight: 700; color: var(--brand); }
.stat .l { font-size: 12px; color: var(--sub); }

/* ---------- 鍏朵粬 ---------- */
.photo-block { margin: 10px 0 14px; }
.photo-frame {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  background: #f1eef9 center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.photo-frame img { width: 100%; height: 100%; object-fit: cover; }
.photo-frame.blank .ph-text { color: var(--sub); }
.photo-acts { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.photo-nav { display: flex; gap: 8px; margin-top: 10px; }
.out-list, .check-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-bottom: 1px dashed var(--line);
  cursor: pointer;
}
.check-row:last-child { border-bottom: none; }
.check-row input { width: 18px; height: 18px; flex: 0 0 18px; }
.locate-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  flex-wrap: wrap;
}
.locate-row:last-child { border-bottom: none; }
.locate-row .name { font-weight: 500; }
.locate-row .meta { font-size: 12px; color: var(--sub); }
/* 移动端：物资信息整行占满，三级归位下拉固定一行不换行 */
@media (max-width: 768px) {
  .locate-row > div:first-child { flex: 1 1 100%; min-width: 100%; }
  .locate-row select { flex: 1 1 auto; min-width: 0; }
  .locate-row .btn.sm { flex: 0 0 auto; }
}
tr.bad td { background: #fdeaea; }
