:root {
  --bg: #f2f5fa;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --ink: #16233a;
  --ink-2: #33425c;
  --muted: #74829a;
  --line: #e3e9f2;
  --line-strong: #d4dce9;
  --navy: #0f1a2f;
  --navy-2: #142540;
  --navy-3: #1b3154;
  --primary: #2f6fed;
  --primary-2: #1f5bd7;
  --primary-soft: #e9f0ff;
  --teal: #0e9f8a;
  --teal-soft: #e2f7f3;
  --amber: #c9820d;
  --amber-soft: #fff4dc;
  --red: #d34a4a;
  --red-soft: #fdecec;
  --violet: #7253d8;
  --violet-soft: #f0ecff;
  --green: #16875f;
  --green-soft: #e4f6ee;
  --gray-soft: #eef2f7;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 8px rgba(18, 35, 60, .05);
  --shadow: 0 12px 32px rgba(18, 35, 60, .08);
  --shadow-lg: 0 24px 70px rgba(12, 24, 44, .18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
svg { display: block; }
::selection { background: rgba(47, 111, 237, .18); }

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background:
    radial-gradient(900px 600px at 8% 8%, rgba(47, 111, 237, .12), transparent 60%),
    radial-gradient(800px 600px at 92% 92%, rgba(14, 159, 138, .11), transparent 60%),
    #eef3fa;
}
.login-shell {
  width: min(1180px, 100%);
  min-height: min(720px, calc(100vh - 56px));
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 36px 100px rgba(15, 29, 52, .2);
  background: #fff;
  position: relative;
}
.login-brand {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #0c172b 0%, #10233f 52%, #123252 100%);
  color: #fff;
  padding: 54px 56px;
  display: flex;
  align-items: center;
}
.login-brand-inner { position: relative; z-index: 3; max-width: 520px; }
.brand-lockup { display: flex; align-items: center; gap: 14px; margin-bottom: 58px; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 14px;
  display: grid; place-items: center;
  font-size: 25px; font-weight: 800;
  background: linear-gradient(135deg, #2f6fed, #0e9f8a);
  box-shadow: 0 12px 30px rgba(47, 111, 237, .35);
}
.brand-name { font-size: 21px; font-weight: 800; letter-spacing: .14em; }
.brand-cn { font-size: 12px; color: rgba(255, 255, 255, .62); letter-spacing: .08em; margin-top: 2px; }
.login-brand h1 {
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.28;
  margin: 0 0 20px;
  letter-spacing: -.02em;
  font-weight: 700;
}
.login-lead { color: rgba(255, 255, 255, .68); font-size: 14px; line-height: 1.85; margin: 0 0 30px; }
.feature-list { list-style: none; padding: 0; margin: 0 0 48px; display: grid; gap: 13px; }
.feature-list li { display: flex; align-items: center; gap: 11px; color: rgba(255, 255, 255, .82); font-size: 13.5px; }
.feature-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #35d0b6;
  box-shadow: 0 0 0 4px rgba(53, 208, 182, .14);
  flex: none;
}
.login-brand-footer { display: flex; gap: 10px; flex-wrap: wrap; }
.login-brand-footer span {
  font-size: 11px; color: rgba(255, 255, 255, .68);
  padding: 6px 11px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .13);
  background: rgba(255, 255, 255, .05);
}
.login-orbit {
  position: absolute; border-radius: 50%;
  border: 1px solid rgba(103, 169, 255, .16);
  pointer-events: none;
}
.orbit-a { width: 520px; height: 520px; right: -210px; top: -150px; }
.orbit-b { width: 360px; height: 360px; right: -80px; bottom: -190px; border-color: rgba(53, 208, 182, .18); }
.login-grid {
  position: absolute; inset: 0; pointer-events: none; opacity: .28;
  background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(140deg, #000, transparent 75%);
}
.login-panel {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 54px 60px;
}
.login-form-wrap { width: 100%; max-width: 380px; }
.login-eyebrow { font-size: 10px; letter-spacing: .22em; font-weight: 700; color: var(--primary); margin-bottom: 14px; }
.login-panel h2 { font-size: 28px; margin: 0 0 10px; letter-spacing: -.02em; }
.login-sub { color: var(--muted); font-size: 13px; margin: 0 0 32px; line-height: 1.7; }
.login-panel .field { margin-bottom: 18px; }
.login-panel .btn { margin-top: 6px; }
.login-hint { color: var(--muted); font-size: 12px; text-align: center; margin: 18px 0 0; }
.login-security {
  display: flex; gap: 12px; margin-top: 34px; padding: 15px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px;
}
.security-icon {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  display: grid; place-items: center;
  color: var(--teal); background: var(--teal-soft);
}
.security-title { font-size: 12px; font-weight: 700; margin-bottom: 3px; }
.security-text { font-size: 11.5px; color: var(--muted); line-height: 1.6; }

/* ---------- Login captcha ---------- */
.captcha { margin: 2px 0 16px; }
.captcha-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.captcha-title { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.captcha-refresh {
  border: 0; background: none; padding: 2px 0; cursor: pointer;
  color: var(--primary); font-size: 11.5px; font-family: inherit;
}
.captcha-refresh:hover { text-decoration: underline; }
.captcha-stage {
  position: relative; height: 48px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 10px;
  background: linear-gradient(135deg, #eaf0fb, #dfe9f7);
}
.captcha-stage::before {
  content: ""; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(45deg, rgba(47, 111, 237, .06) 0 8px, transparent 8px 16px);
}
.captcha-gap {
  position: absolute; top: 2px; left: 2px; width: 44px; height: 44px;
  box-sizing: border-box; border-radius: 8px;
  border: 2px dashed rgba(47, 111, 237, .5);
  background: rgba(255, 255, 255, .38);
}
.captcha-piece {
  position: absolute; top: 2px; left: 2px; width: 44px; height: 44px;
  box-sizing: border-box; border-radius: 8px;
  background: linear-gradient(135deg, #2f6fed, #0e9f8a);
  box-shadow: 0 4px 12px rgba(47, 111, 237, .35);
  will-change: left;
}
.captcha-track {
  position: relative; height: 40px; margin-top: 10px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2); overflow: hidden;
  user-select: none; touch-action: none; cursor: grab;
}
.captcha-track:active { cursor: grabbing; }
.captcha-fill {
  position: absolute; top: 0; bottom: 0; left: 0; width: 0;
  background: rgba(47, 111, 237, .12);
}
.captcha-handle {
  position: absolute; top: 50%; left: 3px; transform: translateY(-50%);
  width: 44px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: #fff; color: var(--primary);
  border: 1px solid var(--line-strong);
  box-shadow: 0 2px 8px rgba(15, 26, 47, .14);
  cursor: grab; touch-action: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.captcha-handle:active { cursor: grabbing; }
.captcha-handle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.captcha-hint {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 11.5px; color: var(--muted); pointer-events: none;
}
.captcha.captcha-ok .captcha-piece { background: linear-gradient(135deg, #16a34a, #0e9f8a); }
.captcha.captcha-ok .captcha-fill { background: rgba(22, 163, 74, .14); }
.captcha.captcha-ok .captcha-handle { background: #16a34a; border-color: #16a34a; color: #fff; }
.captcha.captcha-ok .captcha-hint { color: #16a34a; font-weight: 600; }
.captcha.captcha-error .captcha-handle { animation: captcha-shake .3s ease; }
@keyframes captcha-shake {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  25% { transform: translateY(-50%) translateX(-4px); }
  75% { transform: translateY(-50%) translateX(4px); }
}

/* ---------- App shell ---------- */
.app-body { background: var(--bg); min-height: 100vh; }
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 252px; z-index: 40;
  background: linear-gradient(180deg, var(--navy) 0%, #101d34 100%);
  color: #dfe7f5;
  display: flex; flex-direction: column;
  transition: transform .22s ease, width .22s ease;
}
.sidebar-brand {
  height: 78px; display: flex; align-items: center; gap: 12px;
  padding: 0 22px; border-bottom: 1px solid rgba(255, 255, 255, .07);
  flex: none;
}
@media (min-width: 901px) {
  .app-shell.sidebar-collapsed .sidebar { width: 72px; }
  .app-shell.sidebar-collapsed .app-main { margin-left: 72px; }
  .app-shell.sidebar-collapsed .sidebar-brand { padding: 0; justify-content: center; }
  .app-shell.sidebar-collapsed .sidebar-brand > div:last-child { display: none; }
  .app-shell.sidebar-collapsed .sidebar-nav { padding: 18px 10px; overflow-x: hidden; }
  .app-shell.sidebar-collapsed .nav-group { margin-bottom: 8px; }
  .app-shell.sidebar-collapsed .nav-group-title,
  .app-shell.sidebar-collapsed .nav-item > span:not(.nav-icon),
  .app-shell.sidebar-collapsed .sidebar-footer { display: none; }
  .app-shell.sidebar-collapsed .nav-item { justify-content: center; padding: 11px 0; }
  .app-shell.sidebar-collapsed .nav-item.active::before { left: -10px; }
  .app-shell.sidebar-collapsed .nav-icon { width: 20px; height: 20px; }
}
.sidebar-brand .brand-mark { width: 37px; height: 37px; border-radius: 11px; font-size: 19px; box-shadow: none; }
.sidebar-brand-name { font-size: 16px; font-weight: 800; letter-spacing: .13em; }
.sidebar-brand-sub { font-size: 10px; color: rgba(223, 231, 245, .48); letter-spacing: .08em; }
.sidebar-nav { padding: 18px 12px; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: rgba(223, 231, 245, .26) transparent; }
.sidebar-nav::-webkit-scrollbar { width: 8px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(223, 231, 245, .24); border-radius: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(223, 231, 245, .38); }
.nav-group { margin-bottom: 20px; }
.nav-group-title {
  font-size: 10px; letter-spacing: .16em; color: rgba(223, 231, 245, .38);
  padding: 0 11px; margin-bottom: 7px; font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 11px; margin-bottom: 2px;
  color: rgba(223, 231, 245, .74);
  border-radius: 9px; font-size: 13px; font-weight: 500;
  transition: background .15s ease, color .15s ease;
  position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: rgba(66, 133, 255, .18); color: #fff; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0; background: #5b9bff;
}
.nav-icon { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; line-height: 1; border-radius: 999px;
  background: #e5484d; color: #fff;
}
.sidebar-footer {
  padding: 12px 14px 16px; border-top: 1px solid rgba(255, 255, 255, .07);
  flex: none;
}
.footer-system {
  display: flex; align-items: center; gap: 4px; padding: 8px 7px 8px 10px;
  border: 1px solid rgba(255, 255, 255, .1); border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.footer-system:hover {
  background: rgba(78, 140, 255, .16);
  border-color: rgba(120, 170, 255, .45);
  transform: translateY(-1px);
}
.footer-system-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: inherit;
}
.footer-system-icon {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #3f7cff, #7a5cff);
  box-shadow: 0 6px 16px rgba(63, 124, 255, .35);
}
.footer-system-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.footer-system-text strong { font-size: 12.5px; font-weight: 800; letter-spacing: .08em; color: #eaf0ff; }
.footer-system-text span { font-size: 10px; color: rgba(223, 231, 245, .52); white-space: nowrap; }
.footer-system-arrow {
  flex: none; width: 28px; height: 28px; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 8px; background: transparent;
  color: rgba(223, 231, 245, .5); cursor: pointer;
  transition: color .18s ease, background .18s ease, border-color .18s ease;
}
.footer-system-arrow:hover {
  color: #fff; background: rgba(229, 72, 77, .3); border-color: rgba(229, 72, 77, .55);
}

.password-wrap { display: block; position: relative; }
.field > .password-wrap { margin-bottom: 0; font-weight: 400; }
.password-wrap > input { width: 100%; padding-right: 38px; }
.password-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; padding: 0; display: grid; place-items: center;
  border: none; border-radius: 7px; background: transparent; color: #8492a6;
  cursor: pointer; transition: color .16s ease, background .16s ease;
}
.password-eye:hover { color: #2563eb; background: rgba(37, 99, 235, .09); }
.password-eye .eye-off { display: none; }
.password-eye.revealed .eye-on { display: none; }
.password-eye.revealed .eye-off { display: inline-flex; }

.trend-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.trend-body { padding: 4px 12px 12px; }
.trend-wrap { position: relative; }
.trend-svg { display: block; width: 100%; height: auto; }
.trend-grid-line { stroke: rgba(20, 40, 80, .08); stroke-width: 1; }
.trend-axis { fill: #8492a6; font-size: 10px; }
.trend-guide { stroke: #98a6bb; stroke-width: 1; stroke-dasharray: 4 4; }
.trend-dot { stroke: #fff; stroke-width: 1.5; }
.trend-tip {
  position: absolute; top: 2px; transform: none; z-index: 3;
  background: #0f1b2d; color: #fff; border-radius: 8px; padding: 7px 10px;
  font-size: 11px; line-height: 1.6; pointer-events: none; white-space: nowrap;
  box-shadow: 0 8px 24px rgba(9, 20, 40, .28);
}
.trend-tip-date { color: rgba(255, 255, 255, .6); margin-bottom: 3px; }
.trend-tip-row { display: flex; align-items: center; gap: 6px; }
.trend-tip-row i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.trend-tip-row b { margin-left: auto; padding-left: 16px; font-weight: 700; }
.trend-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11px; color: #64748b; }
.trend-legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }
@media (max-width: 1100px) { .trend-grid { grid-template-columns: 1fr; } }

.app-main { margin-left: 252px; min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .22s ease; }
.topbar {
  position: sticky; top: 0; z-index: 36;
  height: 78px; padding: 0 28px;
  display: flex; align-items: center; gap: 18px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.page-head { min-width: 0; }
.page-head h1 { font-size: 19px; margin: 0; letter-spacing: -.01em; white-space: nowrap; }
.page-head p { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.scope-select { min-width: 170px; height: 38px; }
.user-chip {
  display: flex; align-items: center; gap: 9px; height: 40px;
  padding: 0 11px 0 6px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink); transition: border-color .15s ease, background .15s ease;
}
.user-chip:hover { border-color: var(--line-strong); background: #fff; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #2f6fed, #0e9f8a);
  color: #fff; display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
}
.user-chip-name { font-size: 12px; font-weight: 600; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-role { font-size: 9.5px; color: var(--muted); }
.user-chip-wrap { position: relative; display: inline-flex; flex: none; }
.user-chip { flex: none; }
.user-chip .avatar { flex: 0 0 28px; min-width: 28px; min-height: 28px; aspect-ratio: 1 / 1; }
.view { padding: 26px 28px 48px; flex: 1; max-width: 1680px; width: 100%; margin: 0 auto; }
.menu-btn { display: none; }
.mobile-overlay {
  position: fixed; inset: 0; z-index: 35;
  background: rgba(10, 20, 38, .42);
  backdrop-filter: blur(2px);
}
.mobile-overlay[hidden] { display: none; }

/* ---------- Common ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px;
  border-radius: 9px; border: 1px solid transparent;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #3d7bf5, var(--primary-2));
  color: #fff; box-shadow: 0 6px 16px rgba(47, 111, 237, .24);
}
.btn-primary:hover { box-shadow: 0 8px 20px rgba(47, 111, 237, .32); }
.btn-secondary { background: #fff; border-color: var(--line-strong); color: var(--ink-2); }
.btn-secondary:hover { border-color: #b9c6da; background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--gray-soft); }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: #f5caca; }
.btn-danger:hover { background: #fbdcdc; }
.btn-success { background: var(--green-soft); color: var(--green); border-color: #bfe8d6; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 11.5px; border-radius: 7px; }
.btn-lg { height: 46px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn.is-loading .btn-label { opacity: .8; }
.btn.is-loading::after {
  content: ""; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
.icon-btn {
  width: 38px; height: 38px; border-radius: 9px;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-2); }
.link-btn {
  background: none; border: 0; padding: 0; color: var(--primary);
  font-size: 12px; font-weight: 600;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--red); }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.mono { font-family: var(--mono); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 700; }
.error-text { color: var(--red); }
.success-text { color: var(--green); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 14px;
  padding: 17px 20px; border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.card-head h3 { font-size: 14px; margin: 0; }
.card-head .muted { font-size: 11.5px; }
.card-head-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }

.page-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 12px 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 26, 47, .04);
}
.page-toolbar .toolbar-spacer { flex: 1; }
.page-toolbar .btn-primary { box-shadow: 0 2px 8px rgba(47, 111, 237, .22); }
.search-box { position: relative; }
.search-box svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.search-box input[type="text"] { padding-left: 38px; padding-right: 12px; min-width: 230px; }
.filter-select { min-width: 128px; }
.filter-inline { display: flex; align-items: center; gap: 10px; flex: 1 1 340px; min-width: 280px; max-width: 520px; }
.filter-inline .search-box { flex: 1 1 auto; min-width: 0; }
.filter-inline .search-box input[type="text"] { width: 100%; min-width: 0; }
.filter-inline .filter-select { flex: 0 0 118px; min-width: 118px; }
.combo { position: relative; }
.combo-list {
  margin-top: 6px; padding: 4px; max-height: 200px; overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
}
.combo-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); gap: 10px;
  align-items: center; width: 100%; text-align: left; padding: 8px 10px;
  border: 0; border-radius: 7px; background: transparent;
}
.combo-item:hover, .combo-item:focus-visible { background: var(--surface-2); }
.combo-code { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--primary); white-space: nowrap; }
.combo-main { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-sub { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.combo-empty { padding: 10px 12px; font-size: 12px; color: var(--muted); }
.copy-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; margin-left: 4px; padding: 0;
  border: 0; border-radius: 4px; background: transparent; color: var(--muted);
  vertical-align: -3px; cursor: pointer;
}
.copy-btn:hover { background: var(--surface-2); color: var(--primary); }
.filter-date { width: 142px; }
.date-range { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.date-range input[type="date"] { width: 140px; }
.product-tabs { margin-bottom: 10px; overflow-x: auto; padding: 6px 6px 2px 2px; }
.product-tabs .tabs { flex: none; }
.adjust-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px minmax(0, 1fr) 44px; gap: 8px; align-items: center; margin-bottom: 8px; }
.adjust-row select, .adjust-row input { height: 36px; }
@media (max-width: 640px) {
  .adjust-row { grid-template-columns: 1fr 90px; }
  .adjust-row input[name="itemNote"] { grid-column: 1 / -1; }
  .adjust-row [data-adjust-remove] { justify-self: end; }
}
.check-inline { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
.check-inline input { width: 15px; height: 15px; accent-color: var(--primary); }

.field { display: block; }
.field > span { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field .req { color: var(--red); margin-left: 2px; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="datetime-local"], input[type="email"], select, textarea {
  width: 100%; height: 38px; padding: 0 11px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: #fff; color: var(--ink); outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { height: auto; min-height: 80px; padding: 9px 11px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, .12);
}
input::placeholder, textarea::placeholder { color: #a6b1c2; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
select {
  appearance: none;
  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='%2374829a' stroke-width='2.2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
  padding-right: 30px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid.compact .field > span { margin-bottom: 4px; font-size: 11px; }
.form-grid.compact textarea { min-height: 56px; }
.form-section { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line); }
.form-section-title {
  font-size: 11px; letter-spacing: .12em; color: var(--muted);
  font-weight: 700; margin-bottom: 13px;
}
.input-hint { font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.form-error {
  display: none; padding: 9px 12px; border-radius: 8px;
  background: var(--red-soft); color: var(--red); font-size: 12px;
  border: 1px solid #f5caca; margin-bottom: 12px;
}
.form-error.visible { display: block; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }

/* ---------- KPI / dashboard ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 17px 18px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; right: -34px; top: -42px;
  width: 110px; height: 110px; border-radius: 50%;
  background: var(--kpi-glow, rgba(47, 111, 237, .07));
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-label { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.kpi-icon {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center; color: var(--kpi-color, var(--primary));
  background: var(--kpi-bg, var(--primary-soft));
}
.kpi-value { font-size: 27px; font-weight: 750; letter-spacing: -.03em; margin-top: 10px; line-height: 1.15; }
.kpi-meta { font-size: 11px; color: var(--muted); margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.kpi.warn { --kpi-color: var(--amber); --kpi-bg: var(--amber-soft); --kpi-glow: rgba(201, 130, 13, .08); }
.kpi.danger { --kpi-color: var(--red); --kpi-bg: var(--red-soft); --kpi-glow: rgba(211, 74, 74, .08); }
.kpi.good { --kpi-color: var(--teal); --kpi-bg: var(--teal-soft); --kpi-glow: rgba(14, 159, 138, .08); }
.kpi.violet { --kpi-color: var(--violet); --kpi-bg: var(--violet-soft); --kpi-glow: rgba(114, 83, 216, .08); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 18px; margin-bottom: 18px; }
.stack { display: grid; gap: 18px; }
.section-head { display: flex; align-items: center; gap: 10px; margin: 0; }
.section-head h2 { font-size: 15px; margin: 0; }
.section-head .muted { font-size: 11.5px; }
.section-head .spacer { flex: 1; }
.quick-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 18px; }
.quick-action {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 9px;
  background: #fff; border: 1px solid var(--line-strong); color: var(--ink-2);
  font-size: 12px; font-weight: 600;
}
.quick-action:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.quick-action svg { color: var(--primary); }

/* ---------- Table ---------- */
.table-wrap { width: 100%; overflow: auto; }
table.data { width: 100%; border-collapse: collapse; min-width: 720px; }
table.data th {
  text-align: left; font-size: 10.5px; letter-spacing: .04em;
  color: var(--muted); font-weight: 700; text-transform: uppercase;
  background: var(--surface-2); padding: 10px 13px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
table.data td {
  padding: 11px 13px; border-bottom: 1px solid var(--line);
  vertical-align: middle; font-size: 12.5px;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fafcff; }
table.data td.actions { white-space: nowrap; }
table.data:has(td.actions) th:last-child,
table.data:has(td.actions) td.actions {
  position: sticky; right: 0; width: 1%; white-space: nowrap;
}
table.data:has(td.actions) td.actions {
  background: #fff; z-index: 2;
  box-shadow: -6px 0 8px -8px rgba(15, 26, 47, .18);
}
table.data:has(td.actions) th:last-child {
  background: var(--surface-2); z-index: 4;
  box-shadow: -6px 0 8px -8px rgba(15, 26, 47, .18);
}
table.data:has(td.actions) tbody tr:hover td.actions { background: #fafcff; }
.table-actions { display: flex; align-items: center; gap: 9px; }
.cell-main { font-weight: 600; color: var(--ink); }
.cell-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.cell-clip { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amount { font-variant-numeric: tabular-nums; font-weight: 650; }
.amount.negative { color: var(--red); }
.amount.positive { color: var(--green); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-pending { background: var(--amber-soft); color: var(--amber); }
.badge-cancel { background: #fff1e6; color: #c2671a; }
.badge-cancelled { background: var(--gray-soft); color: #7b879b; }
.badge-shipped { background: var(--green-soft); color: var(--green); }
.badge-exception { background: var(--red-soft); color: var(--red); }
.badge-draft { background: var(--gray-soft); color: #68758a; }
.badge-confirmed { background: var(--primary-soft); color: var(--primary); }
.badge-paid { background: var(--teal-soft); color: var(--teal); }
.badge-active { background: var(--green-soft); color: var(--green); }
.badge-disabled { background: var(--gray-soft); color: #7b879b; }
.badge-blue { background: var(--primary-soft); color: var(--primary); }
.badge-warn { background: var(--amber-soft); color: var(--amber); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-no-dot::before { display: none; }

.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap;
}
.pager-info { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.pager-btns { display: flex; align-items: center; flex-wrap: nowrap; gap: 6px; margin-left: auto; }
.pager-btn {
  min-width: 30px; height: 30px; padding: 0 9px; white-space: nowrap; flex: 0 0 auto;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 7px; font-size: 11.5px;
}
.pager-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager-btn:disabled { opacity: .4; cursor: not-allowed; }
.pager-size {
  width: auto; min-width: 58px; height: 30px; padding: 0 8px; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: 7px;
  background: #fff; color: var(--ink-2); font-size: 11.5px;
}
.pager-size-label { font-size: 11.5px; color: var(--muted); align-self: center; white-space: nowrap; flex: 0 0 auto; }
.check-col { width: 34px; text-align: center; }
.check-col input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.courier-cell { min-width: 190px; }
.inline-input {
  display: block; width: 100%; height: 27px; margin-bottom: 4px; padding: 0 7px;
  border: 1px solid var(--line); border-radius: 6px; font-size: 11.5px; background: #fff;
}
.inline-input:focus { outline: none; border-color: var(--primary); }

.empty-state { padding: 52px 24px; text-align: center; color: var(--muted); }
.empty-icon {
  width: 52px; height: 52px; margin: 0 auto 13px; border-radius: 15px;
  display: grid; place-items: center; color: #a3b0c4; background: var(--surface-2);
  border: 1px dashed var(--line-strong);
}
.empty-state h4 { margin: 0 0 5px; color: var(--ink-2); font-size: 13.5px; }
.empty-state p { margin: 0; font-size: 12px; }
.loading-state { padding: 60px; display: grid; place-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid var(--line); border-top-color: var(--primary);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(11, 22, 40, .45);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fadeIn .16s ease;
}
.modal {
  width: min(720px, 100%); max-height: min(90vh, 920px);
  background: #fff; border-radius: 18px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
  animation: modalIn .18s ease;
}
.modal.modal-lg { width: min(980px, 100%); }
.modal.modal-sm { width: min(480px, 100%); }
.modal-head {
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; flex: none;
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .modal-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.modal-close {
  margin-left: auto; width: 32px; height: 32px;
  display: grid; place-items: center; border-radius: 8px;
  border: 0; background: var(--surface-2); color: var(--muted);
}
.modal-close:hover { background: var(--gray-soft); color: var(--ink); }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot {
  padding: 15px 22px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 9px;
  background: var(--surface-2); flex: none;
}
.modal-foot .left { margin-right: auto; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } }

/* ---------- Toast ---------- */
.toast-root {
  position: fixed; right: 22px; bottom: 22px; z-index: 200;
  display: flex; flex-direction: column; gap: 9px; max-width: 380px;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: 11px;
  background: #16233a; color: #fff;
  box-shadow: 0 16px 40px rgba(10, 20, 36, .28);
  font-size: 12.5px; line-height: 1.5;
  animation: toastIn .2s ease;
}
.toast.success { background: #0d6b52; }
.toast.error { background: #a53030; }
.toast.warn { background: #8a5a07; }
.toast-icon { flex: none; margin-top: 1px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Detail / misc ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 20px; }
.detail-item { min-width: 0; }
.detail-label { font-size: 10.5px; color: var(--muted); margin-bottom: 3px; }
.detail-value { font-size: 12.5px; color: var(--ink); word-break: break-word; }
.detail-value.pre { white-space: pre-wrap; }
.detail-section { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--line); }
.section-label { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; color: var(--muted); margin-bottom: 12px; }
.summary-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; margin-bottom: 18px;
}
.summary-cell { background: #fff; padding: 13px 15px; }
.summary-cell .label { font-size: 10.5px; color: var(--muted); }
.summary-cell .value { font-size: 17px; font-weight: 700; margin-top: 3px; }
.alert-banner {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 15px; border-radius: 10px;
  background: var(--amber-soft); border: 1px solid #f2d49a;
  color: #7a5306; font-size: 12px; margin-bottom: 16px;
}
.alert-banner.red { background: var(--red-soft); border-color: #f2c4c4; color: #8f2f2f; }
.alert-banner.blue { background: var(--primary-soft); border-color: #c9d9fa; color: #234f9e; }
.alert-banner svg { flex: none; margin-top: 1px; }
.alert-banner .spacer { flex: 1; }
.import-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0; }
.import-stat {
  padding: 12px; border-radius: 10px; background: var(--surface-2);
  border: 1px solid var(--line); text-align: center;
}
.import-stat .v { font-size: 20px; font-weight: 750; }
.import-stat .l { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.error-list { max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
.error-row { display: flex; gap: 10px; padding: 8px 11px; border-bottom: 1px solid var(--line); font-size: 11.5px; }
.error-row:last-child { border-bottom: 0; }
.error-row .row-no { color: var(--muted); min-width: 56px; }
.perm-groups { display: grid; gap: 16px; }
.perm-group { border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; }
.perm-group-title { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 9px; letter-spacing: .06em; }
.perm-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.perm-item { display: flex; align-items: flex-start; gap: 7px; font-size: 12px; color: var(--ink-2); }
.perm-item input { width: 15px; height: 15px; margin-top: 1px; accent-color: var(--primary); }
.profile-block { display: flex; align-items: center; gap: 13px; padding: 14px; background: var(--surface-2); border-radius: 12px; margin-bottom: 18px; }
.profile-block .avatar { width: 44px; height: 44px; font-size: 15px; }
.profile-name { font-size: 14px; font-weight: 700; }
.profile-meta { font-size: 11.5px; color: var(--muted); }
.tabs { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.tab { position: relative; padding: 7px 14px; border-radius: 7px; border: 0; background: transparent; color: #5b6b85; font-size: 12px; font-weight: 600; transition: background .15s ease, color .15s ease, box-shadow .15s ease; }
.tab-badge {
  position: absolute; top: -5px; right: -4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9.5px; font-weight: 700; line-height: 1; color: #fff;
  background: #e5484d; border-radius: 999px;
  border: 1px solid #fff; box-shadow: 0 1px 3px rgba(15, 26, 47, .18);
}
.tab:hover { background: rgba(47, 111, 237, .08); color: var(--primary); }
.tab.active { background: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(47, 111, 237, .28); }
.tab.active:hover { background: var(--primary); color: #fff; }
.tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.info-note { font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.money { font-variant-numeric: tabular-nums; }
.hint-row { display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: var(--muted); }
.scope-pill { font-size: 10.5px; color: var(--primary); background: var(--primary-soft); padding: 2px 7px; border-radius: 999px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .dash-grid { grid-template-columns: 1fr; }
  .login-brand { padding: 44px 40px; }
  .login-panel { padding: 44px 40px; }
}
@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; min-height: auto; }
  .login-brand { padding: 34px 30px 30px; }
  .login-brand h1 { font-size: 27px; }
  .brand-lockup { margin-bottom: 26px; }
  .login-lead { margin-bottom: 18px; }
  .feature-list { margin-bottom: 20px; }
  .login-form-wrap { max-width: none; }
  .login-panel { padding: 34px 30px; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .menu-btn { display: grid; }
  .topbar { padding: 0 16px; height: 68px; }
  .view { padding: 18px 16px 40px; }
  .page-head h1 { font-size: 16px; }
  .page-head p { display: none; }
  .scope-select { min-width: 130px; max-width: 160px; }
  .user-chip-name, .user-chip-role { display: none; }
  .user-chip { padding: 0 5px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .form-grid.compact { grid-template-columns: 1fr 1fr; }
  .form-grid.compact .span-2 { grid-column: span 2; }
  .detail-grid { grid-template-columns: 1fr; }
  .perm-list { grid-template-columns: 1fr; }
  .import-summary { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .login-body { padding: 0; }
  .login-shell { border-radius: 0; min-height: 100vh; }
  .login-brand { display: none; }
  .login-panel { min-height: 100vh; padding: 40px 24px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 22px; }
  .toolbar-spacer { display: none; }
  .search-box input { min-width: 0; width: 100%; }
  .page-toolbar > * { flex: 1 1 auto; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { max-height: 94vh; border-radius: 18px 18px 0 0; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .form-grid.compact { grid-template-columns: 1fr; }
  .form-grid.compact .span-2 { grid-column: auto; }
}

@media print {
  .sidebar, .topbar, .page-toolbar, .btn, .modal-close { display: none !important; }
  .app-main { margin-left: 0; }
  .view { padding: 0; }
  .modal-backdrop { position: static; background: none; padding: 0; }
  .modal { box-shadow: none; max-height: none; width: 100%; }
  .modal-foot { display: none; }
}
