/* =========================================================
   皓逸智能灯具 · 进销存  —  UI
   ========================================================= */
:root {
  --ink: #151b24;
  --ink-2: #2b3545;
  --muted: #6b7686;
  --muted-2: #98a2b3;
  --line: #e7eaf0;
  --line-2: #eef1f5;
  --bg: #f4f5f7;
  --card: #ffffff;
  --brand: #c8871f;
  --brand-2: #e8ad4d;
  --brand-soft: #fdf5e6;
  --green: #17936a;
  --green-soft: #e8f7f1;
  --red: #d9453d;
  --red-soft: #fdeeee;
  --blue: #2f6fdd;
  --blue-soft: #edf3fe;
  --purple: #7357d8;
  --purple-soft: #f1eefc;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 27, 36, .04), 0 8px 24px -12px rgba(20, 27, 36, .18);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", Menlo, Consolas, "Roboto Mono", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
::selection { background: #f6dcae; }

/* ---------- boot ---------- */
.boot { display: flex; align-items: center; justify-content: center; height: 100%; }
.boot-logo { animation: pulse 1.4s ease-in-out infinite; }
.lamp-mark {
  display: inline-block; width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #ffe9bd, #d99a2b 70%);
  box-shadow: 0 0 0 10px rgba(217, 154, 43, .12), 0 0 40px rgba(217, 154, 43, .45);
}
@keyframes pulse { 0%, 100% { opacity: .55; transform: scale(.96); } 50% { opacity: 1; transform: scale(1); } }

/* ---------- login ---------- */
.login {
  display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; background: #0e141d;
}
.login-visual {
  position: relative; overflow: hidden; padding: 56px 60px;
  background:
    radial-gradient(720px 500px at 12% 8%, rgba(232, 173, 77, .28), transparent 62%),
    radial-gradient(600px 420px at 88% 92%, rgba(90, 130, 220, .22), transparent 60%),
    linear-gradient(150deg, #101823 0%, #0b1119 58%, #0d1520 100%);
  color: #f6f1e6; display: flex; flex-direction: column; justify-content: space-between;
}
.login-visual::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: 26px 26px; opacity: .5; pointer-events: none;
}
.login-brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.login-brand .mark {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(145deg, #f2c97d, #c8871f); box-shadow: 0 8px 24px rgba(200, 135, 31, .35);
}
.login-brand .mark svg { width: 22px; height: 22px; }
.login-brand b { font-size: 16px; letter-spacing: .5px; font-weight: 600; }
.login-brand small { display: block; color: #9aa6b6; font-size: 11px; letter-spacing: 2px; margin-top: 2px; }
.login-hero { position: relative; z-index: 1; max-width: 520px; }
.login-hero h1 { font-size: 40px; line-height: 1.28; letter-spacing: .5px; font-weight: 600; }
.login-hero h1 em { font-style: normal; color: #f0c274; }
.login-hero p { color: #a6b1c0; margin-top: 18px; font-size: 14.5px; line-height: 1.9; }
.login-feats { display: flex; gap: 26px; margin-top: 40px; flex-wrap: wrap; }
.login-feat { display: flex; gap: 10px; align-items: flex-start; }
.login-feat i {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: rgba(240, 194, 116, .12); color: #f0c274; font-style: normal; font-size: 14px;
}
.login-feat span { color: #c9d1dc; font-size: 12.5px; line-height: 1.6; }
.login-feat b { display: block; color: #eef2f7; font-size: 13px; margin-bottom: 2px; font-weight: 500; }
.login-foot { position: relative; z-index: 1; color: #5f6b7c; font-size: 12px; letter-spacing: .4px; }

.login-form-wrap {
  display: flex; align-items: center; justify-content: center; padding: 40px;
  background: #fbfaf7;
}
.login-card { width: 100%; max-width: 368px; }
.login-card h2 { font-size: 24px; font-weight: 600; letter-spacing: .3px; }
.login-card .sub { color: var(--muted); margin: 8px 0 30px; font-size: 13px; }
.login-card .field { margin-bottom: 18px; }
.login-card .field label { font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; display: block; font-weight: 500; }
.login-card .input { height: 44px; }
.login-error {
  background: var(--red-soft); color: #a92f29; border-radius: 10px; padding: 10px 12px;
  font-size: 12.5px; margin-bottom: 16px; display: none;
}
.login-error.show { display: block; }
.login-hint { margin-top: 22px; background: #fff; border: 1px dashed #e2d9c6; border-radius: 12px; padding: 12px 14px; }
.login-hint b { font-size: 12px; color: #8a6a2f; font-weight: 600; letter-spacing: .5px; }
.login-hint .rows { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 14px; margin-top: 8px; }
.login-hint .rows div { font-size: 12px; color: var(--muted); }
.login-hint code { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); background: #f5f2ec; padding: 1px 5px; border-radius: 4px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 234px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #121a25 0%, #0f1620 100%);
  color: #c6cfdb; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, .04);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 22px 20px 20px; }
.brand .mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: linear-gradient(145deg, #f2c97d, #c8871f); display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(200, 135, 31, .3);
}
.brand .mark svg { width: 19px; height: 19px; }
.brand b { color: #f4f7fb; font-size: 15px; letter-spacing: .4px; display: block; font-weight: 600; }
.brand small { color: #6d7b8d; font-size: 9.5px; letter-spacing: 2.2px; text-transform: uppercase; }
.nav { flex: 1; padding: 6px 12px; overflow-y: auto; }
.nav-label { font-size: 10px; letter-spacing: 1.6px; color: #4e5b6d; padding: 16px 10px 8px; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: #9facbe; cursor: pointer; margin-bottom: 2px; font-size: 13.5px; position: relative;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 17px; height: 17px; opacity: .8; flex: none; }
.nav-item:hover { background: rgba(255, 255, 255, .05); color: #e7edf5; }
.nav-item.active { background: linear-gradient(90deg, rgba(232, 173, 77, .17), rgba(232, 173, 77, .04)); color: #f4d9a5; }
.nav-item.active svg { opacity: 1; color: #e8ad4d; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px;
  background: #e8ad4d; border-radius: 0 3px 3px 0;
}
.nav-badge { margin-left: auto; background: #d9453d; color: #fff; font-size: 10px; border-radius: 20px; padding: 1px 6px; }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, .05); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(145deg, #35455c, #222d3d); color: #e8d3ab; font-size: 12.5px; font-weight: 600;
}
.sidebar-user b { display: block; color: #e6ecf4; font-size: 12.5px; font-weight: 500; }
.sidebar-user small { color: #718095; font-size: 11px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; display: flex; align-items: center; gap: 16px; padding: 0 28px;
  background: rgba(255, 255, 255, .86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30;
}
.topbar .crumb { font-size: 12px; color: var(--muted-2); letter-spacing: .4px; }
.topbar .crumb b { color: var(--ink); font-weight: 600; font-size: 14px; letter-spacing: 0; }
.topbar .spacer { flex: 1; }
.topbar .clock { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 8px 5px 5px; border-radius: 30px; cursor: pointer; position: relative; }
.user-chip:hover { background: #f4f5f8; }
.user-chip .avatar { width: 30px; height: 30px; background: linear-gradient(145deg, #f3d9a9, #c8871f); color: #3a2a0e; }
.user-chip .meta b { display: block; font-size: 12.5px; font-weight: 500; line-height: 1.25; }
.user-chip .meta small { color: var(--muted); font-size: 10.5px; }
.user-menu {
  position: absolute; right: 0; top: 48px; min-width: 172px; background: #fff; border-radius: 12px;
  box-shadow: 0 12px 40px -8px rgba(15, 23, 36, .22); border: 1px solid var(--line); padding: 6px;
  display: none; z-index: 50;
}
.user-menu.open { display: block; }
.user-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; border: 0; background: none;
  border-radius: 8px; cursor: pointer; color: var(--ink-2); font-size: 13px; text-align: left;
}
.user-menu button:hover { background: #f5f6f8; }
.user-menu button.danger { color: var(--red); }
.menu-hr { height: 1px; background: var(--line); margin: 5px 4px; }

.content { padding: 24px 28px 44px; max-width: 1560px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { font-size: 22px; letter-spacing: .3px; font-weight: 600; }
.page-sub { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- cards / grid ---------- */
.card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 12px; }
.card-head h3 { font-size: 14.5px; font-weight: 600; letter-spacing: .2px; }
.card-head .sub { color: var(--muted-2); font-size: 11.5px; }
.card-head .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-body { padding: 0 18px 18px; }
.card-body.pad { padding: 16px 18px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.col-span-2 { grid-column: span 2; }
.mt-16 { margin-top: 16px; }
.mt-8 { margin-top: 8px; }
.hidden { display: none !important; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 14px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; right: -22px; top: -26px; width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 173, 77, .13), transparent 70%);
}
.kpi-label { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.kpi-label .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-2); }
.kpi-value { font-size: 26px; font-weight: 600; letter-spacing: -.4px; margin-top: 10px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.kpi-foot { margin-top: 8px; font-size: 11.5px; color: var(--muted-2); display: flex; gap: 8px; align-items: center; }
.trend-up { color: var(--green); }
.trend-down { color: var(--red); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer;
  font-size: 13px; font-weight: 500; white-space: nowrap; transition: all .15s;
}
.btn:hover { border-color: #d3d8e0; background: #fbfbfc; }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn-primary {
  background: linear-gradient(180deg, #d59a37, #c8871f); border-color: #c8871f; color: #fff;
  box-shadow: 0 4px 12px -4px rgba(200, 135, 31, .55);
}
.btn-primary:hover { background: linear-gradient(180deg, #dda643, #cf8d22); border-color: #cf8d22; }
.btn-dark { background: #1d2634; border-color: #1d2634; color: #fff; }
.btn-dark:hover { background: #26313f; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f2f4f7; color: var(--ink-2); }
.btn-danger { color: var(--red); border-color: #f0d3d1; background: #fff; }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12px; border-radius: 7px; }
.btn-xs { height: 24px; padding: 0 7px; font-size: 11.5px; border-radius: 6px; }
.btn-block { width: 100%; height: 42px; font-size: 14px; }
.link-btn { border: 0; background: none; color: var(--blue); cursor: pointer; padding: 0; font-size: 12.5px; }
.link-btn:hover { text-decoration: underline; }
.link-danger { color: var(--red); }

/* ---------- forms ---------- */
.input, .select, textarea.input {
  height: 34px; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; background: #fff;
  outline: none; transition: border .15s, box-shadow .15s; width: 100%; color: var(--ink);
}
.input:focus, .select:focus, textarea.input:focus { border-color: #e3b367; box-shadow: 0 0 0 3px rgba(232, 173, 77, .16); }
.input::placeholder { color: #b0b8c4; }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.6; }
.select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7686' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.input-search { position: relative; }
.input-search .input { padding-left: 32px; }
.input-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted-2); }
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
.field > label .req { color: var(--red); margin-left: 2px; }
.field .hint { font-size: 11px; color: var(--muted-2); margin-top: 5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid .span-2 { grid-column: span 2; }
.form-section-title { font-size: 12px; letter-spacing: .8px; color: var(--muted-2); text-transform: uppercase; margin: 18px 0 10px; padding-top: 14px; border-top: 1px dashed var(--line); }
.form-section-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: #c8871f; cursor: pointer; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.toolbar .grow { flex: 1; }
.toolbar .input-search { width: 240px; }
.segmented { display: inline-flex; background: #f2f4f7; border-radius: 9px; padding: 3px; gap: 2px; }
.segmented button {
  border: 0; background: none; padding: 6px 12px; border-radius: 7px; font-size: 12.5px; color: var(--muted);
  cursor: pointer; font-weight: 500; white-space: nowrap;
}
.segmented button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(20, 27, 36, .1); }

/* ---------- table ---------- */
.table-wrap { overflow: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 11.5px; letter-spacing: .4px;
  padding: 11px 12px; border-bottom: 1px solid var(--line); background: #fbfbfc; white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:hover td { background: #fdfbf7; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .center { text-align: center; }
.table .mono { font-family: var(--mono); font-size: 12px; }
.table td.num { white-space: nowrap; }
.table .muted { color: var(--muted-2); }
.table .strong { font-weight: 600; }
.name-cell b { display: block; font-weight: 500; color: var(--ink); }
.name-cell small { color: var(--muted-2); font-size: 11px; font-family: var(--mono); font-weight: 400; }
.table .name-cell b { display: block; font-weight: 500; color: var(--ink); }
.table .name-cell small { color: var(--muted-2); font-size: 11px; font-family: var(--mono); }
.table tr.clickable { cursor: pointer; }
.table tr.row-warn td { background: #fffbf3; }
.table .row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.table-sm td, .table-sm th { padding: 8px 10px; }

.empty { padding: 56px 20px; text-align: center; color: var(--muted-2); font-size: 13px; }
.empty svg { width: 44px; height: 44px; opacity: .3; display: block; margin: 0 auto 10px; }

.pager { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line-2); }
.pager .info { color: var(--muted-2); font-size: 12px; }
.pager .pages { margin-left: auto; display: flex; gap: 4px; }
.pager .pg {
  min-width: 30px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 8px;
  cursor: pointer; font-size: 12.5px; color: var(--ink-2); padding: 0 6px;
}
.pager .pg:hover:not(:disabled) { border-color: #d8b071; }
.pager .pg.active { background: #1d2634; border-color: #1d2634; color: #fff; }
.pager .pg:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- tags ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap; line-height: 1.6;
}
.tag-gray { background: #f1f3f6; color: #626d7d; }
.tag-green { background: var(--green-soft); color: var(--green); }
.tag-amber { background: var(--brand-soft); color: #a5721a; }
.tag-red { background: var(--red-soft); color: var(--red); }
.tag-blue { background: var(--blue-soft); color: var(--blue); }
.tag-purple { background: var(--purple-soft); color: var(--purple); }
.tag-outline { background: #fff; border: 1px solid var(--line); color: var(--muted); }
.dot-badge { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------- charts ---------- */
.chart { width: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: #eef1f5; stroke-width: 1; }
.chart .axis-label { fill: #98a2b3; font-size: 10.5px; font-family: var(--font); }
.chart .area { fill: url(#areaGrad); }
.chart .line { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chart .point { fill: #fff; stroke-width: 2; }
.chart .bar { rx: 3; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 5px; }
.chart-tip {
  position: fixed; pointer-events: none; background: #1b2430; color: #fff; font-size: 11.5px; padding: 6px 9px;
  border-radius: 7px; z-index: 90; white-space: nowrap; opacity: 0; transition: opacity .12s;
}
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut-center { font-size: 11px; fill: var(--muted); }
.donut-value { font-size: 17px; font-weight: 600; fill: var(--ink); }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16, 23, 33, .46); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 20px 40px;
  overflow-y: auto; animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: #fff; border-radius: 16px; width: 560px; max-width: 100%; box-shadow: 0 30px 80px -20px rgba(10, 16, 26, .45);
  animation: rise .18s cubic-bezier(.2, .8, .3, 1);
}
@keyframes rise { from { transform: translateY(10px); opacity: .6; } }
.modal-lg { width: 860px; }
.modal-xl { width: 1040px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 12px; }
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-head .sub { color: var(--muted-2); font-size: 12px; }
.modal-head .close { margin-left: auto; }
.modal-body { padding: 8px 22px 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line-2); background: #fcfcfd; border-radius: 0 0 16px 16px; }

/* ---------- toast ---------- */
.toast-root { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #1b2430; color: #fff; padding: 9px 16px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 10px 30px -8px rgba(10, 16, 26, .4); animation: drop .2s ease;
}
.toast.ok { background: #177a58; }
.toast.err { background: #b83a32; }
@keyframes drop { from { transform: translateY(-8px); opacity: 0; } }

/* ---------- category tree ---------- */
.cat-tree { max-height: calc(100vh - 260px); overflow: auto; padding: 8px; }
.tree-node { user-select: none; }
.tree-row {
  display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 8px; cursor: pointer;
  font-size: 13px; color: var(--ink-2);
}
.tree-row:hover { background: #f6f7f9; }
.tree-row.active { background: var(--brand-soft); color: #8f6012; font-weight: 500; }
.tree-row .caret { width: 12px; height: 12px; color: var(--muted-2); transition: transform .15s; flex: none; }
.tree-row .caret.open { transform: rotate(90deg); }
.tree-row .cnt { margin-left: auto; font-size: 10.5px; color: var(--muted-2); font-family: var(--mono); }
.tree-children { padding-left: 14px; border-left: 1px dashed #e9ecf1; margin-left: 13px; }
.cat-side { width: 260px; flex: none; }

/* ---------- misc ---------- */
.split { display: flex; gap: 16px; align-items: flex-start; }
.flex1 { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.nowrap { white-space: nowrap; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.right { text-align: right; }
.mono { font-family: var(--mono); }
.divider { height: 1px; background: var(--line-2); margin: 14px 0; }
.notice {
  background: var(--brand-soft); border: 1px solid #f2e2c4; color: #7a5a18; border-radius: 10px;
  padding: 10px 12px; font-size: 12.5px; line-height: 1.6; display: flex; gap: 8px; align-items: flex-start;
}
.notice.blue { background: var(--blue-soft); border-color: #dbe7fb; color: #27548f; }
.notice.red { background: var(--red-soft); border-color: #f5d6d4; color: #96322c; }
.notice svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.stat-inline { display: flex; gap: 22px; flex-wrap: wrap; }
.stat-inline .s b { display: block; font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-inline .s span { font-size: 11.5px; color: var(--muted-2); }
.tabs-line { display: flex; gap: 22px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.tabs-line button {
  border: 0; background: none; padding: 13px 0 11px; font-size: 13.5px; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; font-weight: 500; margin-bottom: -1px;
}
.tabs-line button.active { color: var(--ink); border-bottom-color: var(--brand); }
.tabs-line button:hover { color: var(--ink-2); }
.tab-pane { padding: 18px; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line-2); background: #fcfcfd; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 20px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-size: 12.5px; cursor: pointer;
  font-weight: 500; transition: all .14s; white-space: nowrap;
}
.cat-chip em { font-style: normal; font-size: 10.5px; color: var(--muted-2); background: #f1f3f6; border-radius: 10px; padding: 1px 6px; }
.cat-chip:hover { border-color: #e0bd83; color: var(--ink); }
.cat-chip.active { background: #1d2634; border-color: #1d2634; color: #fff; }
.cat-chip.active em { background: rgba(255, 255, 255, .18); color: #fff; }
@media (max-width: 620px) {
  .cat-chips { flex-wrap: nowrap; overflow-x: auto; padding: 10px 14px; }
  .cat-chip { flex: none; }
}
.avatar-lg { width: 46px; height: 46px; font-size: 16px; }
.qty-input { width: 78px; height: 30px; text-align: center; padding: 0 4px; }
.price-input { width: 96px; height: 30px; text-align: right; padding: 0 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #f6f7f9; border-radius: 8px; padding: 5px 9px; font-size: 12px; color: var(--ink-2); border: 1px solid var(--line-2); }
.print-sheet { background: #fff; }
.preview-frame { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 22px; max-height: 60vh; overflow: auto; }
.label-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.label-card { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 190px; text-align: center; }
.label-card img { width: 100%; height: 54px; object-fit: contain; display: block; }
.label-card .nm { font-size: 11px; margin-top: 5px; line-height: 1.35; height: 30px; overflow: hidden; }
.label-card .pr { font-size: 11px; color: var(--muted); margin-top: 2px; }
.perm-grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.perm-grid th, .perm-grid td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); text-align: center; }
.perm-grid th:first-child, .perm-grid td:first-child { text-align: left; }
.perm-grid thead th { background: #fbfbfc; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.perm-grid tbody tr:hover { background: #fcfcfe; }
.hamburger { display: none; }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 240px; z-index: 80;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .sidebar.open { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .4); }
  .hamburger { display: inline-flex; }
  .content { padding: 18px 16px 40px; }
  .topbar { padding: 0 14px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .split { flex-direction: column; }
  .cat-side { width: 100%; }
}
@media (max-width: 620px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .toolbar .input-search { width: 100%; }
  .page-title { font-size: 19px; }
}

@media print {
  .sidebar, .topbar, .page-head .actions, .toolbar, .pager, .no-print { display: none !important; }
  .content { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; }
}

/* 打印单据预览（弹窗内） */
.preview-frame .doc { font-size: 12px; color: #1a2230; }
.preview-frame .doc-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #1d2634; padding-bottom: 12px; }
.preview-frame .logo { font-size: 17px; font-weight: 700; letter-spacing: 1px; }
.preview-frame .doc-title { text-align: right; }
.preview-frame .doc-title h1 { margin: 0; font-size: 19px; letter-spacing: 2px; font-weight: 600; }
.preview-frame .sm { font-size: 10px; color: #7b8494; margin-top: 3px; font-weight: 400; letter-spacing: 0; }
.preview-frame .doc-meta { display: flex; flex-wrap: wrap; gap: 6px 28px; margin: 14px 0 12px; font-size: 11.5px; }
.preview-frame .doc-meta span { color: #8b95a5; margin-right: 6px; }
.preview-frame .doc-table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.preview-frame .doc-table th { background: #f5f6f8; font-weight: 500; color: #4a5566; font-size: 10.5px; padding: 6px 7px; border: 1px solid #e3e7ed; text-align: left; }
.preview-frame .doc-table td { padding: 6px 7px; border: 1px solid #e9edf2; vertical-align: top; }
.preview-frame .doc-table .r, .preview-frame .doc-table th.r { text-align: right; }
.preview-frame .doc-totals { margin-top: 10px; margin-left: auto; width: 250px; font-size: 12px; }
.preview-frame .doc-totals div { display: flex; justify-content: space-between; padding: 4px 2px; border-bottom: 1px dashed #e8ecf1; }
.preview-frame .doc-totals .big { font-size: 14.5px; font-weight: 600; border-bottom: 0; border-top: 1.5px solid #1d2634; margin-top: 3px; padding-top: 7px; }
.preview-frame .doc-note { margin-top: 12px; color: #5a6577; font-size: 11px; line-height: 1.8; }
.preview-frame .doc-terms { margin-top: 16px; font-size: 10.5px; color: #7b8494; line-height: 1.9; border-top: 1px solid #e9edf2; padding-top: 9px; }
.preview-frame .doc-terms b { color: #4a5566; }
.preview-frame .doc-sign { display: flex; justify-content: space-between; margin-top: 34px; font-size: 11px; color: #4a5566; }

/* 工作台 / 条码页自适应 */
.dash-charts { grid-template-columns: 1.6fr 1fr; }
.barcode-side { width: 390px; flex: none; }
@media (max-width: 1080px) {
  .dash-charts { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .barcode-side { width: 100%; }
  .label-grid { justify-content: center; }
}
@media (max-width: 620px) {
  .topbar .clock { display: none; }
  .kpi-value { font-size: 23px; }
}

@media (max-width: 820px) {
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table-wrap table.table { min-width: 720px; }
  .table-wrap table.table-sm { min-width: 480px; }
  .table-wrap table.table th, .table-wrap table.table td { white-space: nowrap; }
  .table-wrap table.table .name-cell b { white-space: nowrap; }
  .pager { flex-wrap: wrap; gap: 6px; }
  .pager .pages { margin-left: auto; }
  .toolbar { padding: 12px 14px; }
  .toolbar .input-search { width: 100%; }
  .toolbar .select, .toolbar .input[type=date] { flex: 1 1 42%; width: auto !important; min-width: 0; }
  .modal { border-radius: 14px; }
  .modal-backdrop { padding: 3vh 10px 20px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; }
  .page-head .actions { width: 100%; }
  .stat-inline { gap: 14px; }
}
