/* ============ 基础 ============ */
:root {
  --bg: #f3f6f4;
  --card: #ffffff;
  --ink: #13251f;
  --ink-2: #31463f;
  --muted: #6d8079;
  --muted-2: #94a49d;
  --line: #e4ebe7;
  --line-2: #d5e0da;
  --brand: #0e7a5f;
  --brand-dark: #0a5a46;
  --brand-soft: #e8f4ef;
  --danger: #c94545;
  --danger-soft: #fdeeee;
  --warn: #b26a12;
  --warn-soft: #fdf3e3;
  --info: #2b6cb0;
  --shadow: 0 1px 2px rgba(16, 40, 32, .04), 0 8px 24px -16px rgba(16, 40, 32, .18);
  --shadow-lg: 0 24px 60px -20px rgba(10, 40, 30, .35);
  --r: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
::selection { background: #bfe6d7; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.spacer { flex: 1; }

/* ============ 启动加载 ============ */
.boot-loading {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; background: radial-gradient(1200px 600px at 50% 0%, #e9f5ef 0%, var(--bg) 60%);
}
.boot-logo svg { width: 64px; height: 64px; filter: drop-shadow(0 12px 24px rgba(14, 122, 95, .25)); }
.boot-text { font-weight: 700; letter-spacing: .18em; color: var(--brand-dark); }
.boot-bar { width: 120px; height: 3px; border-radius: 3px; background: #d8e8e1; overflow: hidden; }
.boot-bar span { display: block; width: 40%; height: 100%; border-radius: 3px; background: var(--brand); animation: boot 1s ease-in-out infinite; }
@keyframes boot { 0% { transform: translateX(-110%); } 100% { transform: translateX(320%); } }

/* ============ 登录 ============ */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: var(--bg); }
.auth-brand {
  position: relative; overflow: hidden; padding: 56px 60px; display: flex; flex-direction: column;
  background: radial-gradient(900px 500px at 10% 0%, #177a60 0%, #0b4a3b 55%, #07352b 100%);
  color: #eafff7;
}
.auth-brand::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.14) 1px, transparent 1px);
  background-size: 22px 22px; opacity: .35; mask-image: linear-gradient(160deg, #000, transparent 70%);
}
.auth-brand::after {
  content: ""; position: absolute; width: 520px; height: 520px; right: -180px; bottom: -200px;
  border-radius: 50%; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 0 0 80px rgba(255,255,255,.03), 0 0 0 160px rgba(255,255,255,.02);
}
.auth-brand > * { position: relative; z-index: 1; }
.auth-logo { display: flex; align-items: center; gap: 12px; font-size: 19px; font-weight: 700; letter-spacing: .06em; }
.auth-logo .mark { width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); display: grid; place-items: center; }
.auth-logo .mark svg { width: 26px; height: 26px; }
.auth-hero { margin-top: auto; margin-bottom: auto; padding: 48px 0; }
.auth-eyebrow { font-size: 12px; letter-spacing: .28em; text-transform: uppercase; color: #7fd8be; margin-bottom: 18px; }
.auth-hero h1 { font-size: clamp(30px, 3.4vw, 46px); line-height: 1.22; letter-spacing: -.01em; font-weight: 700; }
.auth-hero h1 em { font-style: normal; color: #7fe0c2; }
.auth-hero p { margin-top: 18px; color: #b7d9cd; max-width: 460px; font-size: 15px; line-height: 1.8; }
.auth-features { display: grid; gap: 14px; margin-top: 36px; }
.auth-feature { display: flex; align-items: flex-start; gap: 12px; color: #d7efe6; font-size: 13.5px; }
.auth-feature .ico { flex: none; width: 24px; height: 24px; border-radius: 7px; background: rgba(127,224,194,.14); color: #7fe0c2; display: grid; place-items: center; margin-top: 1px; }
.auth-feature .ico svg { width: 14px; height: 14px; }
.auth-foot { font-size: 12px; color: #7fa99b; letter-spacing: .04em; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 32px; }
.auth-card { width: 100%; max-width: 404px; }
.auth-card h2 { font-size: 26px; letter-spacing: -.01em; }
.auth-card .sub { color: var(--muted); margin-top: 8px; font-size: 13.5px; }
.auth-tabs { display: flex; gap: 4px; background: #e9efec; border-radius: 12px; padding: 4px; margin: 26px 0 22px; }
.auth-tabs button { flex: 1; height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; transition: .18s; }
.auth-tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(16,40,32,.1); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-hint { margin-top: 18px; padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); color: #236b56; font-size: 12.5px; line-height: 1.7; }
.auth-hint b { color: var(--brand-dark); }
.auth-switch-note { margin-top: 16px; text-align: center; color: var(--muted); font-size: 13px; }
.auth-switch-note button { border: 0; background: none; color: var(--brand); font-weight: 600; padding: 0 4px; }
.auth-success { text-align: center; padding: 30px 0; }
.auth-success .big { width: 66px; height: 66px; margin: 0 auto 18px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.auth-success .big svg { width: 32px; height: 32px; }

/* ============ 布局 ============ */
.layout { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 40; display: flex; flex-direction: column;
  background: radial-gradient(700px 360px at 0% 0%, #14614d 0%, #0b4236 48%, #09382e 100%);
  color: #d9ece5; padding: 20px 14px 16px;
}
.sidebar .brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 22px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(145deg, #17a983, #0c7359); display: grid; place-items: center; box-shadow: 0 6px 16px -6px rgba(0,0,0,.55); flex: none; }
.brand-mark svg { width: 23px; height: 23px; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: .08em; color: #fff; line-height: 1.2; }
.brand-sub { font-size: 10.5px; color: #8fbfae; letter-spacing: .16em; margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-group-label { font-size: 10.5px; letter-spacing: .18em; color: #6f9f8e; padding: 16px 12px 7px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; height: 42px; padding: 0 12px; border-radius: 10px;
  color: #b9d6cb; border: 0; background: transparent; width: 100%; text-align: left; font-size: 13.5px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; opacity: .9; flex: none; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.13); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.nav-item .badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #f0b44c; color: #3b2604; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding-top: 12px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.side-user .avatar { width: 34px; height: 34px; }
.side-user .nm { font-size: 13px; color: #fff; font-weight: 600; line-height: 1.3; }
.side-user .rl { font-size: 11px; color: #8fbfae; }
.side-actions { display: flex; gap: 2px; margin-top: 2px; }
.side-actions button { flex: 1; height: 32px; border: 0; border-radius: 8px; background: transparent; color: #9dc4b6; font-size: 12px; display: flex; align-items: center; justify-content: center; gap: 5px; }
.side-actions button:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-actions svg { width: 14px; height: 14px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 66px; flex: none;
  display: flex; align-items: center; gap: 14px; padding: 0 28px;
  background: rgba(255,255,255,.86); backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.topbar-title h1 { font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; }
.topbar-title p { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.mobile-brand { display: none; align-items: center; gap: 8px; font-weight: 700; color: var(--brand-dark); letter-spacing: .05em; }
.mobile-brand .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
.mobile-brand .brand-mark svg { width: 18px; height: 18px; }
.sync-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: 999px;
  background: #eef4f1; color: #527065; font-size: 11.5px; white-space: nowrap; border: 1px solid transparent;
}
.sync-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #9fb3aa; }
.sync-pill.online { background: #e9f6f0; color: #1c7158; }
.sync-pill.online .dot { background: #17a476; box-shadow: 0 0 0 3px rgba(23,164,118,.14); animation: pulse 2.4s infinite; }
.sync-pill.offline { background: var(--warn-soft); color: #8a5a13; }
.sync-pill.offline .dot { background: #d39534; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 3px rgba(23,164,118,.14); } 50% { box-shadow: 0 0 0 5px rgba(23,164,118,.05); } }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: linear-gradient(145deg, #d9efe6, #b9e0d1); color: #0d5c47; font-size: 13px; border: 0; flex: none;
}
.avatar-btn { padding: 0; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.avatar-menu {
  position: fixed; top: 60px; right: 22px; width: 240px; z-index: 90; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 8px; animation: pop .14s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.avatar-menu .who { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.avatar-menu .who .nm { font-weight: 700; font-size: 14px; }
.avatar-menu .who .rl { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.avatar-menu button { width: 100%; display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border: 0; border-radius: 9px; background: none; text-align: left; font-size: 13px; color: var(--ink-2); }
.avatar-menu button:hover { background: #f2f6f4; }
.avatar-menu button.danger { color: var(--danger); }
.avatar-menu svg { width: 16px; height: 16px; }
.avatar-menu .sep { height: 1px; background: var(--line); margin: 6px 4px; }

.content { width: 100%; max-width: 1360px; margin: 0 auto; padding: 24px 28px 56px; flex: 1; }
.tabbar { display: none; }

/* ============ 通用组件 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px;
  border-radius: 10px; border: 1px solid var(--line-2); background: #fff; color: var(--ink-2);
  font-weight: 600; font-size: 13px; white-space: nowrap; transition: .16s; text-decoration: none;
}
.btn:hover { border-color: #b9cbc3; background: #fbfdfc; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: linear-gradient(180deg, #11866a, #0c6a53); border-color: transparent; color: #fff; box-shadow: 0 6px 14px -8px rgba(10,90,70,.8); }
.btn.primary:hover { background: linear-gradient(180deg, #139476, #0d735a); }
.btn.soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-dark); }
.btn.soft:hover { background: #dcf0e8; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: #eef4f1; color: var(--ink); }
.btn.danger { color: var(--danger); border-color: #f0cccc; background: #fffafa; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.icon { width: 36px; padding: 0; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn .spin { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.field .hint { font-size: 11.5px; color: var(--muted-2); }
.input, .select, .textarea {
  width: 100%; height: 41px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff;
  padding: 0 12px; font-size: 14px; color: var(--ink); transition: border .15s, box-shadow .15s; appearance: none;
}
.select { 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='%236d8079' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.textarea { height: auto; min-height: 74px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,122,95,.11); }
.input:disabled { background: #f4f7f5; color: var(--muted); }
.input::placeholder, .textarea::placeholder { color: #abbab3; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { position: relative; flex: 1 1 220px; max-width: 340px; }
.toolbar .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted-2); pointer-events: none; }
.toolbar .search .input { padding-left: 36px; }
.toolbar .select { width: auto; min-width: 118px; }
.toolbar .spacer { flex: 1; }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.toolbar .check { height: 38px; padding: 0 4px; white-space: nowrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; }
.panel-head h3 { font-size: 14px; font-weight: 700; letter-spacing: .01em; }
.panel-head .more { margin-left: auto; font-size: 12px; color: var(--muted); }
.panel-body { padding: 4px 18px 18px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 11px; font-weight: 600; line-height: 1; white-space: nowrap; background: #eef3f1; color: #5b7167;
}
.chip .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.chip.green { background: var(--brand-soft); color: #0b6b53; }
.chip.amber { background: var(--warn-soft); color: var(--warn); }
.chip.red { background: var(--danger-soft); color: var(--danger); }
.chip.blue { background: #eaf2fb; color: #2f66a4; }
.chip.gray { background: #eef1f0; color: #66766f; }

.loading { display: grid; place-items: center; padding: 70px 20px; color: var(--muted); gap: 12px; }
.loading .ring { width: 26px; height: 26px; border: 2.5px solid #dce8e2; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 54px 20px; color: var(--muted); text-align: center; }
.empty .eico { width: 46px; height: 46px; border-radius: 14px; background: #eef4f1; display: grid; place-items: center; color: #9db3a9; margin-bottom: 4px; }
.empty .eico svg { width: 22px; height: 22px; }
.empty b { color: var(--ink-2); font-size: 14px; }
.empty p { font-size: 12.5px; max-width: 320px; }
.empty .btn { margin-top: 8px; }

/* ============ 仪表盘 ============ */
.hero { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.hero h2 { font-size: 25px; letter-spacing: -.02em; line-height: 1.25; }
.hero h2 span { color: var(--brand); }
.hero .sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
.hero-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 16px 14px; box-shadow: var(--shadow); overflow: hidden; }
.stat .top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.stat .ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: #eef4f1; color: #4b6c60; }
.stat .ico svg { width: 15px; height: 15px; }
.stat .val { font-size: 27px; font-weight: 700; letter-spacing: -.02em; margin-top: 10px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .val small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.stat .foot { font-size: 11.5px; color: var(--muted-2); margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.stat.accent { background: linear-gradient(150deg, #0f7d61, #0a5a46); border-color: transparent; color: #fff; }
.stat.accent .top, .stat.accent .foot { color: #b9ded1; }
.stat.accent .ico { background: rgba(255,255,255,.13); color: #d8f5e9; }
.stat.accent .val small { color: #a9d3c5; }
.stat.warn .ico { background: var(--warn-soft); color: var(--warn); }
.stat.warn .val { color: #a45f0d; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.bars { display: flex; flex-direction: column; gap: 13px; padding-top: 4px; }
.bar-row { display: grid; grid-template-columns: 116px 1fr 62px; align-items: center; gap: 12px; }
.bar-row .lbl { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .track { height: 8px; border-radius: 4px; background: #eef3f0; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #159f7d, #0d7359); transition: width .5s ease; }
.bar-row .val { font-size: 12px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.low-list { display: flex; flex-direction: column; }
.low-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.low-item:last-child { border-bottom: 0; }
.low-item .nm { font-size: 13px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.low-item .cat { font-size: 11px; color: var(--muted-2); }
.low-item .st { margin-left: auto; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.low-item .st.bad { color: var(--danger); }
.low-item .st.warn { color: var(--warn); }
.activity { display: flex; flex-direction: column; }
.act-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.act-item:last-child { border-bottom: 0; }
.act-item .dot { flex: none; width: 30px; height: 30px; border-radius: 9px; background: #eef4f1; color: #4c7264; display: grid; place-items: center; margin-top: 1px; }
.act-item .dot svg { width: 15px; height: 15px; }
.act-item .tx { min-width: 0; flex: 1; }
.act-item .tx .a { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.act-item .tx .d { font-size: 12px; color: var(--muted); margin-top: 1px; overflow-wrap: anywhere; }
.act-item .tm { font-size: 11px; color: var(--muted-2); white-space: nowrap; margin-top: 2px; }

/* ============ 表格 ============ */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.table-scroll { overflow-x: auto; }
.table { min-width: 0; }
.table .thead, .table .tr { display: grid; grid-template-columns: var(--cols); align-items: center; gap: 10px; }
.table .thead { padding: 11px 18px; background: #f7faf8; border-bottom: 1px solid var(--line); font-size: 11px; letter-spacing: .06em; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.table .tr { padding: 12px 18px; border-bottom: 1px solid #edf2ef; transition: background .12s; }
.table .tr:last-child { border-bottom: 0; }
.table .tr:hover { background: #fbfdfc; }
.table .cell { min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.table .cell.name { font-weight: 600; color: var(--ink); }
.table .cell.name .sub { display: flex; gap: 6px; align-items: center; font-weight: 400; color: var(--muted-2); font-size: 11px; margin-top: 2px; }
.table .cell.num { font-variant-numeric: tabular-nums; }
.table .cell.right { text-align: right; }
.table .cell.actions { display: flex; gap: 4px; justify-content: flex-end; }
.table .cell .thumb { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; border: 1px solid var(--line); }
.table .cell .unit { color: var(--muted); font-size: 11.5px; }
.cols-inv { --cols: minmax(190px, 1.7fr) 116px 96px 52px 74px 68px 68px 92px 66px; }
.cols-flow { --cols: 104px minmax(180px, 1.6fr) 110px 54px 74px 110px 92px 84px 132px; }
.stock-num { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.stock-num.low { color: var(--warn); }
.stock-num.zero { color: var(--danger); }
.stock-num.ok { color: var(--ink); }
.sub-stock { font-size: 11px; color: var(--muted); margin-left: 4px; font-weight: 400; }
.table-foot { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-top: 1px solid var(--line); background: #fbfcfb; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.table-foot b { color: var(--ink-2); font-weight: 600; }

/* 采购订单卡片 */
.order-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.order-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 16px 17px 14px; display: flex; flex-direction: column; gap: 9px; transition: .16s; }
.order-card:hover { border-color: #cadbd3; box-shadow: 0 10px 30px -18px rgba(16,40,32,.3); }
.order-top { display: flex; align-items: center; gap: 8px; }
.order-no { font-weight: 700; font-size: 13.5px; letter-spacing: .01em; }
.order-date { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.order-lines { display: flex; flex-direction: column; gap: 3px; }
.order-line { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.order-line .q { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.order-line .q b { color: var(--ink); font-weight: 600; }
.order-meta { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; border-top: 1px dashed var(--line); padding-top: 9px; margin-top: 2px; }
.order-meta .amt { margin-left: auto; color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.order-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 2px; }
.order-more { font-size: 11.5px; color: var(--muted-2); padding-left: 2px; }

/* ============ 弹窗 ============ */
.modal-root.open { position: relative; z-index: 100; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(9, 27, 21, .46); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 24px 16px; z-index: 100; animation: fade .16s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 48px); background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: rise .2s cubic-bezier(.2,.8,.2,1); overflow: hidden; }
.modal.lg { max-width: 760px; }
.modal.sm { max-width: 420px; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); flex: none; }
.modal-head h3 { font-size: 17px; letter-spacing: -.01em; }
.modal-head .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.modal-close { margin-left: auto; width: 32px; height: 32px; border-radius: 8px; border: 0; background: #f2f6f4; color: var(--muted); display: grid; place-items: center; flex: none; }
.modal-close:hover { background: #e8efeb; color: var(--ink); }
.modal-close svg { width: 16px; height: 16px; }
.modal-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px calc(16px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: #fcfdfc; flex: none; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; display: flex; gap: 8px; align-items: center; flex: none; white-space: nowrap; }
.form-section { border-top: 1px dashed var(--line); margin-top: 18px; padding-top: 16px; }
.form-section:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.form-section-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.form-section-title .spacer { flex: 1; }
.alert { display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px; border-radius: 10px; font-size: 12.5px; background: var(--brand-soft); color: #236b56; margin-bottom: 14px; line-height: 1.6; }
.alert.warn { background: var(--warn-soft); color: #8a5a13; }
.alert.red { background: var(--danger-soft); color: #9c3636; }
.alert svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.alert b { font-weight: 700; }

/* 采购行 */
.p-line { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: #fbfdfc; position: relative; }
.p-line .line-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.p-line .line-top .idx { font-size: 11px; color: var(--muted); background: #eef3f0; border-radius: 6px; padding: 2px 7px; font-weight: 600; }
.p-line .line-top .btn { margin-left: auto; }
.p-line .line-fields { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.p-line .new-fields { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.p-line .field { gap: 4px; }
.p-line .field label { font-size: 10.5px; }
.p-line .input, .p-line .select { height: 36px; font-size: 13px; }
.p-line .select { padding-right: 28px; background-position: right 10px center; }
.p-total { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 8px 2px 0; font-size: 13px; color: var(--muted); }
.p-total b { color: var(--ink); font-size: 17px; font-variant-numeric: tabular-nums; }
.auto-no-row { display: flex; align-items: center; gap: 10px; }
.auto-no-row .input { flex: 1; }

/* 详情 */
.detail-lines { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.detail-line { display: grid; grid-template-columns: minmax(0, 1.5fr) 64px 70px 70px 60px; gap: 8px; padding: 9px 12px; font-size: 12.5px; border-bottom: 1px solid var(--line); align-items: center; }
.detail-line:last-child { border-bottom: 0; }
.detail-line.head { background: #f7faf8; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.detail-line .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-line .r { text-align: right; font-variant-numeric: tabular-nums; }
.detail-summary { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 14px; padding: 12px 14px; border-radius: 12px; background: #f7faf8; }
.detail-summary .it .k { font-size: 11px; color: var(--muted); }
.detail-summary .it .v { font-size: 15px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.detail-summary .it .v.green { color: var(--brand); }
.line-check { display: flex; align-items: center; gap: 8px; }
.line-check input { width: 16px; height: 16px; accent-color: var(--brand); }
.line-check.done span { color: var(--muted); }

/* 图片选择 */
.photo-picker { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.photo-picker .preview { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line-2); background: #f4f7f5; }
.photo-picker .upload-btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border-radius: 9px; border: 1px dashed var(--line-2); background: #fbfdfc; color: var(--ink-2); font-size: 12.5px; }
.photo-picker .upload-btn:hover { border-color: var(--brand); color: var(--brand); }
.photo-picker .upload-btn svg { width: 15px; height: 15px; }
.photo-picker input[type=file] { display: none; }
.photo-picker .clear { border: 0; background: none; color: var(--danger); font-size: 12px; }

/* 成员 */
.pending-list { display: flex; flex-direction: column; gap: 10px; }
.pending-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid #f0dfc2; background: linear-gradient(180deg, #fffaf1, #fff); border-radius: 12px; flex-wrap: wrap; }
.pending-card .avatar { background: #f7e7c8; color: #8a5a13; }
.pending-card .info { min-width: 0; flex: 1 1 220px; }
.pending-card .info .nm { font-weight: 700; font-size: 13.5px; }
.pending-card .info .meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.pending-card .note { font-size: 12px; color: #7a6135; background: #fdf4e3; border-radius: 8px; padding: 6px 9px; margin-top: 6px; display: inline-block; }
.pending-card .acts { display: flex; gap: 6px; }
.table .name-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.table .name-cell > div { min-width: 0; }
.table .name-cell .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-table .avatar { width: 32px; height: 32px; font-size: 12px; }
.perm-groups { display: flex; flex-direction: column; gap: 14px; }
.perm-group { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.perm-group .gt { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .08em; margin-bottom: 8px; }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.perm-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.perm-item input { width: 16px; height: 16px; accent-color: var(--brand); }
.preset-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.preset-row .btn.active { background: var(--brand-soft); border-color: #bfe3d6; color: var(--brand-dark); }

/* 设置 */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.profile-row { display: flex; align-items: center; gap: 14px; padding-bottom: 14px; border-bottom: 1px dashed var(--line); margin-bottom: 14px; }
.profile-row .avatar { width: 52px; height: 52px; font-size: 18px; }
.profile-row .nm { font-size: 17px; font-weight: 700; }
.profile-row .rl { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; font-size: 12.5px; }
.kv .k { color: var(--muted); }
.kv .v { color: var(--ink-2); text-align: right; }

/* 提示条 */
.toast-root { position: fixed; z-index: 200; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 420px); }
.toast { display: flex; align-items: center; gap: 9px; background: #102d25; color: #ecf8f3; padding: 10px 15px; border-radius: 11px; box-shadow: var(--shadow-lg); font-size: 13px; animation: toastIn .22s ease; max-width: 100%; }
.toast.err { background: #5c2323; }
.toast.ok { background: #0d5c47; }
.toast .t-ico { flex: none; width: 18px; height: 18px; }
.toast svg { width: 18px; height: 18px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
body.modal-open .toast-root { bottom: 24px; }

/* ============ 响应式 ============ */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-brand { display: flex; }
  .topbar { padding: 0 16px; height: 60px; }
  .topbar-title h1 { font-size: 15px; }
  .topbar-title p { display: none; }
  .content { padding: 18px 16px calc(92px + var(--safe-b)); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: rgba(255,255,255,.94); backdrop-filter: blur(16px); border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + var(--safe-b)); justify-content: space-around;
  }
  .tab-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 0 3px; border: 0; background: none; color: #81948c; font-size: 10px; border-radius: 10px; position: relative; }
  .tab-item svg { width: 21px; height: 21px; }
  .tab-item.active { color: var(--brand); font-weight: 600; }
  .tab-item.active::before { content: ""; position: absolute; top: -6px; width: 20px; height: 2.5px; border-radius: 2px; background: var(--brand); }
  .tab-item .badge { position: absolute; top: 1px; right: calc(50% - 18px); min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px; background: #e8a33c; color: #fff; font-size: 9px; font-weight: 700; display: grid; place-items: center; }
  .hero-actions { width: 100%; margin-left: 0; }
  .modal { max-height: calc(100dvh - 32px); }
}
@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 26px 22px 22px; min-height: auto; }
  .auth-hero { padding: 26px 0 0; margin: 0; }
  .auth-hero h1 { font-size: 27px; }
  .auth-hero p { font-size: 13px; margin-top: 10px; }
  .auth-features, .auth-foot { display: none; }
  .auth-panel { padding: 26px 20px 40px; align-items: flex-start; }
  .auth-card { max-width: 100%; }
  .auth-card h2 { font-size: 22px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 13px 13px 11px; }
  .stat .val { font-size: 22px; }
  .stat .top { font-size: 11px; }
  .hero h2 { font-size: 21px; }
  .hero .sub { font-size: 12px; }
  .toolbar { gap: 8px; }
  .toolbar .search { max-width: none; flex-basis: 100%; }
  .toolbar .select { flex: 1 1 110px; }
  .toolbar .spacer { display: none; }
  .toolbar-actions { margin-left: auto; }
  .perm-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .order-grid { grid-template-columns: 1fr; }
  .table-scroll { overflow: visible; }
  .table { min-width: 0; }
  .table .thead { display: none; }
  .table .tr {
    display: flex; flex-wrap: wrap; align-items: flex-start; gap: 2px 14px;
    padding: 13px 15px; position: relative;
  }
  .table .cell { display: flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--ink-2); }
  .table .cell::before { content: attr(data-label); font-size: 10.5px; color: var(--muted-2); white-space: nowrap; }
  .table .cell.name { display: block; width: 100%; font-size: 14px; padding-right: 84px; }
  .table .cell.name::before { display: none; }
  .table .cell.name .sub { flex-wrap: wrap; }
  .table .cell.unit, .table .cell.vendor { display: none; }
  .table .cell.actions { position: absolute; right: 12px; top: 11px; padding: 0; }
  .table .cell.actions::before { display: none; }
  .table .cell .thumb { width: 26px; height: 26px; }
  .cols-flow .cell:nth-child(3), .cols-flow .cell:nth-child(4) { display: none; }
  .cols-inv .cell[data-label="品类"] { display: none; }
  .cols-inv .cell.stock-main { order: -1; }
  .table-foot { padding: 10px 15px; }
  .pending-card { align-items: flex-start; }
  .pending-card .acts { width: 100%; justify-content: flex-end; }
  .detail-line { grid-template-columns: minmax(0, 1.4fr) 52px 62px 62px 48px; font-size: 11.5px; padding: 8px; }
  .detail-line.head { display: none; }
  .p-line .line-fields { grid-template-columns: 1fr 1fr 1fr; }
  .p-line .new-fields { grid-template-columns: 1fr 1fr; }
  .p-line .new-fields .full { grid-column: 1 / -1; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { max-width: none; max-height: 92dvh; border-radius: 18px 18px 0 0; animation: sheet .24s cubic-bezier(.2,.8,.2,1); }
  .modal.lg, .modal.sm { max-width: none; }
  @keyframes sheet { from { transform: translateY(100%); } }
  .modal-foot { position: sticky; bottom: 0; }
  .topbar-right .sync-pill span.txt { display: none; }
  .sync-pill { padding: 0 6px; background: transparent; border: 0; }
  .sync-pill.online { background: transparent; }
  .sync-pill.offline { background: var(--warn-soft); }
  .sync-pill .dot { width: 9px; height: 9px; }
  .toast-root { bottom: calc(86px + var(--safe-b)); }
  .avatar-menu { right: 12px; top: 56px; }
  .settings-grid { gap: 14px; }
  .dash-grid { gap: 14px; }
  .bar-row { grid-template-columns: 96px 1fr 52px; }
}
@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat .val { font-size: 20px; }
  .content { padding-left: 12px; padding-right: 12px; }
  .topbar { padding: 0 12px; }
  .topbar-title h1 { font-size: 14px; }
  .order-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============ 补充 ============ */
.m-stock { display: none; }
.table .thead .right { text-align: right; }
.table .tr.clickable { cursor: pointer; }
.table .cell .thumb { cursor: zoom-in; }
.detail-lines.no-price .detail-line { grid-template-columns: minmax(0, 1.6fr) 64px 72px; }
.detail-lines.no-price .detail-line.head > div:last-child { text-align: right; }
@media (max-width: 760px) {
  .m-stock {
    display: inline-flex; align-items: baseline; gap: 1px; position: absolute; right: 14px; top: 13px;
    font-size: 19px; font-weight: 700; color: var(--ink); letter-spacing: -.02em;
  }
  .m-stock small { font-size: 10px; font-weight: 400; color: var(--muted); margin-left: 2px; }
  .m-stock.low { color: var(--warn); }
  .m-stock.zero { color: var(--danger); }
  .cols-inv .cell.stock-main { display: none; }
  .table .cell.actions { display: none; }
  .table .cell.name { padding-right: 84px; }
  .detail-lines.no-price .detail-line { grid-template-columns: minmax(0, 1.5fr) 58px 64px; }
  /* 流水表在手机上也要能编辑/作废 */
  .cols-flow .cell.actions { display: flex; position: static; width: 100%; justify-content: flex-end; padding: 0; margin-top: 4px; }
  .cols-flow .cell.actions::before { display: none; }
}

/* 作废记录：保留可追溯，视觉上弱化 */
.table .tr.voided { opacity: .62; background: #fafbfa; }
.table .tr.voided .cell.name > div:first-child { text-decoration: line-through; }
.order-card.voided { opacity: .7; }

/* ============ 库存导入预览 ============ */
.imp-preview { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; max-height: 320px; overflow-y: auto; }
.imp-summary { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 12px; background: #f6faf8; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); position: sticky; top: 0; }
.imp-summary b { color: var(--ink); }
.imp-summary .imp-err b { color: var(--danger); }
.imp-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.6fr) 70px 56px; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid #f0f4f2; font-size: 12.5px; }
.imp-row:last-child { border-bottom: 0; }
.imp-name { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-qty { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .imp-row { grid-template-columns: minmax(0, 1fr) 64px 50px; }
  .imp-row .muted { display: none; }
}
