/* 莉莉格系统 · 全局样式。规范见 doc/设计规范.md，色值只用 tokens.css 里的变量 */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--c-font); font-size: 14px; color: var(--c-text); background: var(--c-bg); line-height: 1.55;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; line-height: 1.3; margin: 0; color: var(--c-ink); font-weight: 700; }
h3 { font-size: 16px; margin: 0 0 16px; color: var(--c-ink); }
.sub { color: var(--c-text-2); margin: 2px 0 12px; font-size: 13px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; letter-spacing: -.1px; }
[hidden] { display: none !important; }
/* 优雅可爱的楷体只给「看的字」：标题、系统名、导航、按钮、统计卡、弹窗标题；表格 / 数据仍用黑体，密集数字好读 */
h1, h3, .logo, .nav1 a, .nav2 a, .btn, .chip, .tabs a, .stat .l, .modal header, .page-head .sub, .toast, .empty, .bulkbar,
.dropdown a, .pop button, .field label, .alert { font-family: var(--c-font-display); letter-spacing: -.02em; }  /* 楷体字面偏松，略收紧 */

/* ---------- 顶栏（一级导航）：白底 + 底部覆盆子 → 腮红 → 薰衣草细彩条 ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.94); color: var(--c-ink);
  border-bottom: 3px solid transparent; border-image: linear-gradient(90deg, var(--c-brand) 0%, var(--c-blush) 70%, var(--c-lavender-base) 100%) 1;
  backdrop-filter: saturate(1.2) blur(6px); }
.topbar-in { max-width: 1440px; margin: 0 auto; height: var(--c-header-h); padding: 0 32px; display: flex; align-items: center; gap: 28px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--c-ink); white-space: nowrap; letter-spacing: .5px; }
.logo:hover { text-decoration: none; }
.brand-mark { width: 32px; height: 32px; object-fit: contain; flex: none; }
.nav1 { display: flex; align-items: center; gap: 6px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav1::-webkit-scrollbar { display: none; }
.nav1 a { display: flex; align-items: center; height: 34px; padding: 0 16px; border-radius: var(--c-radius-pill); color: var(--c-text-2); font-weight: 600; font-size: 14px; white-space: nowrap; }
.nav1 a:hover { background: var(--c-primary-50); color: var(--c-primary); text-decoration: none; }
.nav1 a.active { background: var(--c-brand); color: #fff; box-shadow: 0 4px 12px rgba(216,92,133,.3); }
.user { position: relative; flex: none; }
.user > button { display: flex; align-items: center; gap: 8px; background: var(--c-bg); color: var(--c-ink); border: 0;
  border-radius: var(--c-radius-pill); padding: 4px 12px 4px 4px; cursor: pointer; font: inherit; }
.user > button:hover { background: var(--c-primary-50); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--c-lavender); color: var(--c-lavender-ink); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.caret { font-size: 10px; opacity: .7; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; color: var(--c-text); border-radius: var(--c-radius-card);
  box-shadow: 0 8px 24px rgba(101,51,77,.18); min-width: 200px; padding: 6px 0; display: none; }
.dropdown.open { display: block; }
.dropdown .meta { padding: 10px 16px 12px; border-bottom: 1px solid var(--c-border); margin-bottom: 4px; display: grid; gap: 2px; }
.dropdown .meta span { color: var(--c-text-2); font-size: 12px; }
.dropdown a { display: block; padding: 8px 16px; color: var(--c-text); }
.dropdown a:hover { background: var(--c-primary-50); text-decoration: none; }

/* ---------- 二级栏 ---------- */
.nav2 { position: sticky; top: calc(var(--c-header-h) + 3px); z-index: 20; background: #FFFBF6; border-bottom: 1px solid var(--c-border); }
.nav2-in { max-width: 1440px; margin: 0 auto; padding: 0 20px; display: flex; gap: 4px; height: 40px; overflow-x: auto; scrollbar-width: none; }
.nav2-in::-webkit-scrollbar { display: none; }
.nav2-in { align-items: center; }
.nav2 a { display: flex; align-items: center; height: 28px; padding: 0 12px; font-size: 13px; border-radius: var(--c-radius-pill); color: var(--c-text-2); font-weight: 600; white-space: nowrap; }
.nav2 a:hover { color: var(--c-primary); text-decoration: none; }
.nav2 a.active { color: var(--c-primary); background: var(--c-primary-50); }

/* ---------- 内容区 ---------- */
.main { max-width: 1440px; margin: 0 auto; padding: 16px 24px 32px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head > div:first-child { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }  /* 标题和说明同一行 */
.page-head .sub { margin: 0; }
.page-head .grow { flex: 1; }

.card { background: var(--c-surface); border-radius: var(--c-radius-card); border: 1px solid var(--c-border); box-shadow: 0 1px 2px rgba(101,51,77,.04); padding: 16px; margin-bottom: 12px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .toolbar { padding: 10px 16px; margin: 0; border-bottom: 1px solid var(--c-border); }
.card.flush > .pager { padding: 8px 16px; margin: 0; border-top: 1px solid var(--c-border); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.toolbar .grow { flex: 1; }
.search { position: relative; }
.search input { padding-left: 30px; width: 240px; }
.search::before { content: ""; position: absolute; left: 11px; top: 50%; width: 11px; height: 11px; margin-top: -8px;
  border: 2px solid var(--c-text-2); border-radius: 50%; }
.search::after { content: ""; position: absolute; left: 22px; top: 50%; width: 2px; height: 6px; margin-top: 2px; background: var(--c-text-2); transform: rotate(-45deg); }

/* 批量操作条：勾选后出现 */
.bulkbar { display: flex; align-items: center; gap: 8px; padding: 6px 16px; background: var(--c-primary-50); border-bottom: 1px solid #F2D3E0; color: var(--c-ink); font-weight: 600; }
.bulkbar .grow { flex: 1; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid #F4EAEE; vertical-align: middle; }
th { background: #FCF7F9; color: var(--c-text-2); font-weight: 600; font-size: 12px; white-space: nowrap; letter-spacing: .3px; }
td { white-space: nowrap; }
tbody tr:hover td { background: #FDF8FA; }
tbody tr:last-child td { border-bottom: 0; }
td.wrap, th.wrap { white-space: normal; }
td.num, th.num { text-align: right; }
.col-check { width: 44px; padding-right: 0; }
.cell-main { font-weight: 600; color: var(--c-text); }
.cell-sub { font-size: 12px; color: var(--c-text-2); margin-top: 2px; }
.muted { color: #B5A3AC; }
/* 操作列固定在右侧，不会被横向滚动挤掉 */
.col-ops { position: sticky; right: 0; background: #fff; text-align: right; box-shadow: -10px 0 10px -10px rgba(101,51,77,.12); }
th.col-ops { background: #FCF7F9; }
tbody tr:hover td.col-ops { background: #FDF8FA; }
.ops { display: inline-flex; align-items: center; gap: 14px; }
.ops a, .ops button.link { cursor: pointer; font-weight: 600; }
.ops a.danger { color: var(--c-danger); }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--c-primary); }
button.link:hover { text-decoration: underline; }
.empty { text-align: center; color: var(--c-text-2); padding: 56px 0 !important; white-space: normal; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 14px; color: var(--c-text-2); font-size: 13px; }

/* 行内弹出菜单（fixed，不被滚动容器裁剪） */
.pop { position: fixed; z-index: 60; background: #fff; border-radius: 8px; box-shadow: 0 8px 24px rgba(101,51,77,.18); padding: 6px 0; min-width: 132px; }
.pop button { display: block; width: 100%; text-align: left; padding: 8px 16px; background: none; border: 0; font: inherit; color: var(--c-text); cursor: pointer; white-space: nowrap; }
.pop button:hover { background: var(--c-primary-50); }
.pop button.danger { color: var(--c-danger); }

/* ---------- 统计卡 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { border-radius: var(--c-radius-card); padding: 12px 16px; background: var(--c-primary-50); color: var(--c-primary-dark); }
.stat:nth-child(5n+2) { background: #FBDDE7; color: var(--c-ink); }
.stat:nth-child(5n+3) { background: var(--c-cream); color: var(--c-cream-ink); }
.stat:nth-child(5n+4) { background: var(--c-berry); color: var(--c-berry-ink); }
.stat:nth-child(5n+5) { background: var(--c-lavender); color: var(--c-lavender-ink); }  /* 薰衣草只占一张，约 5% */
.stat .n { font-size: 26px; font-weight: 800; line-height: 1.2; }
.stat .l { margin-top: 4px; font-weight: 600; opacity: .85; }

/* ---------- 徽标 ---------- */
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--c-radius-pill); font-size: 12px; font-weight: 600; margin: 1px 4px 1px 0; white-space: nowrap; }
.tag.ok { background: var(--c-success-bg); color: var(--c-success); }
.tag.off { background: var(--c-danger-bg); color: var(--c-danger); }
.tag.warn { background: var(--c-warning-bg); color: var(--c-warning); }
.tag.info { background: var(--c-primary-50); color: var(--c-primary); }
.tag.spark { background: var(--c-cream); color: var(--c-cream-ink); }
.tag.lavender { background: var(--c-lavender); color: var(--c-lavender-ink); }
.tag.gray { background: #F3ECEF; color: var(--c-text-2); }

/* ---------- 表单 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; border-radius: var(--c-radius-pill); padding: 0 16px;
  font: inherit; font-weight: 700; cursor: pointer; border: 1px solid var(--c-primary); background: #fff; color: var(--c-primary); white-space: nowrap; }
.btn:hover { background: var(--c-primary-50); }
.btn.primary { background: var(--c-primary); color: #fff; }
.btn.primary:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); }
.btn.danger { border-color: var(--c-danger); color: var(--c-danger); }
.btn.danger:hover { background: var(--c-danger-bg); }
.btn.sm { height: 28px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea { font: inherit; color: var(--c-text); border: 1px solid #EBCBD6; border-radius: var(--c-radius-input); padding: 0 10px; height: 32px; background: #fff; }
textarea { height: auto; padding: 8px 10px; resize: vertical; }
input[type=checkbox] { width: 16px; height: 16px; padding: 0; accent-color: var(--c-primary); }
input:hover, select:hover, textarea:hover { border-color: #B79AA8; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(194,65,111,.2); outline-offset: 0; border-color: var(--c-primary); }
input:disabled { background: #F8F2F5; color: var(--c-text-2); }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13px; color: var(--c-ink); margin-bottom: 6px; font-weight: 600; }
.field label .req { color: var(--c-danger); }
.field input, .field select, .field textarea { width: 100%; }
.field input[type=checkbox] { width: 16px; }
.field .hint { font-size: 12px; color: var(--c-text-2); margin-top: 4px; }
.check { display: inline-flex !important; align-items: center; gap: 8px; cursor: pointer; font-weight: normal !important; }
.pw-row { display: flex; gap: 8px; }
.pw-row input { flex: 1; }

/* ---------- 弹窗 / 提示 ---------- */
.mask { position: fixed; inset: 0; background: rgba(101,51,77,.45); display: flex; align-items: flex-start; justify-content: center;
  padding: 64px 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 20px; width: 680px; max-width: 100%; box-shadow: 0 20px 60px rgba(101,51,77,.3); }
.modal.sm { width: 440px; }
.modal header { padding: 14px 20px; border-bottom: 1px solid var(--c-border); font-weight: 700; color: var(--c-ink); font-size: 17px; }
.modal .body { padding: 18px 20px; }
.modal footer { padding: 10px 20px; border-top: 1px solid var(--c-border); display: flex; justify-content: flex-end; gap: 10px; background: #FFF7FA; border-radius: 0 0 20px 20px; }
.toast { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); padding: 10px 22px; border-radius: var(--c-radius-pill);
  color: #fff; background: var(--c-ink); z-index: 99; box-shadow: 0 8px 24px rgba(101,51,77,.2); font-weight: 600; }
.toast.err { background: var(--c-danger); }
.toast.ok { background: var(--c-success); }
.alert { padding: 7px 12px; border-radius: 8px; margin-bottom: 10px; font-size: 13px; white-space: pre-line; line-height: 1.6; }
.alert.info { background: var(--c-primary-50); color: var(--c-ink); }
.alert.warn { background: var(--c-warning-bg); color: var(--c-warning); }
.alert.err { background: var(--c-danger-bg); color: var(--c-danger); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--c-border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 16px; white-space: nowrap; color: var(--c-text-2); border-bottom: 3px solid transparent; cursor: pointer; font-weight: 600; }
.tabs a.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }
.tabs a:hover { text-decoration: none; color: var(--c-primary); }

/* ---------- 款式库 ---------- */
.thumb { width: 40px; height: 52px; object-fit: cover; border-radius: 6px; background: #F7ECF1; display: block; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.tile { background: #fff; border-radius: var(--c-radius-card); border: 1px solid #F1E4EA; overflow: hidden; transition: box-shadow .15s, transform .15s; }
.tile:hover { box-shadow: 0 8px 24px rgba(101,51,77,.12); transform: translateY(-2px); }
.tile .img { aspect-ratio: 3/4; background: #F7ECF1 center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--c-text-2); font-size: 13px; }
.tile .info { padding: 12px 14px; font-size: 13px; }
.tile .units { font-size: 22px; font-weight: 800; color: var(--c-ink); }
.tile.zero .units { color: #C9B6BF; }
.tile .name { font-weight: 600; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .code { font-size: 12px; color: var(--c-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr.bad td { background: var(--c-danger-bg) !important; }
td input, td select { width: 100%; min-width: 90px; height: 32px; }
td input[type=checkbox], th input[type=checkbox] { width: 16px; min-width: 0; height: 16px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 32px; }
.bars span { width: 8px; background: var(--c-primary); border-radius: 2px 2px 0 0; min-height: 2px; }
.bars span.zero { background: var(--c-border); }
th.sort { cursor: pointer; user-select: none; }
th.sort:hover { color: var(--c-primary); }
.rate-hi { color: var(--c-danger); font-weight: 700; }
.rate-lo { color: var(--c-success); font-weight: 700; }

@media (max-width: 768px) {
  .topbar-in { padding: 0 16px; gap: 12px; }
  .logo span { display: none; }
  .nav1 a { padding: 0 12px; font-size: 14px; height: 34px; }
  .uname, .caret { display: none; }
  .user > button { padding: 4px; }
  .nav2-in { padding: 0 8px; }
  .main { padding: 12px 12px 32px; }
  .form { grid-template-columns: 1fr; }
  .search { flex: 1 1 100%; min-width: 0; }
  .search input { width: 100%; }
  .toolbar > select { flex: 1 1 0; min-width: 0; }
  .col-ops { position: static; box-shadow: none; }  /* 窄屏不固定操作列，避免盖住内容 */
}
