.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
}

/* ---------------- Sidebar ---------------- */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(201, 138, 75, .16), transparent 52%),
    linear-gradient(180deg, #121b22 0%, #0d151a 100%);
  color: #d9dee1;
  z-index: 40;
  transition: width .28s var(--ease);
  border-right: 1px solid rgba(255, 255, 255, .05);
}
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .35;
  background-image: repeating-linear-gradient(115deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 9px);
  mask-image: linear-gradient(180deg, rgba(0,0,0,.9), transparent 65%);
}
.brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  position: relative;
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #2a1a0b;
  font-size: 21px;
  background: linear-gradient(145deg, #ecc794, #c98a4b);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 6px 18px rgba(201,138,75,.32);
  flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { color: #f6f2ea; font-size: 16px; letter-spacing: .08em; font-weight: 700; }
.brand-text em { font-style: normal; font-size: 10px; letter-spacing: .22em; color: rgba(227, 178, 122, .75); margin-top: 3px; }
.sidebar-collapse {
  margin-left: auto;
  width: 28px; height: 28px;
  border: 1px solid rgba(255,255,255,.12);
  background: transparent;
  color: rgba(255,255,255,.45);
  border-radius: 8px;
  display: grid; place-items: center;
}
.sidebar-collapse:hover { color: #fff; border-color: rgba(255,255,255,.3); }
.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 12px 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.18) transparent;
}
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); }
.nav-home {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: 11px;
  color: rgba(235, 239, 241, .76);
  font-size: 13.5px;
  letter-spacing: .02em;
  margin-bottom: 12px;
  position: relative;
  border: 1px solid transparent;
}
.nav-home .icon { font-size: 17px; color: var(--kraft-2); }
.nav-home:hover { background: rgba(255,255,255,.055); color: #fff; }
.nav-home.active {
  background: linear-gradient(90deg, rgba(201,138,75,.24), rgba(201,138,75,.05));
  border-color: rgba(201,138,75,.28);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--kraft);
}
.nav-pulse {
  margin-left: auto;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--kraft-2);
  box-shadow: 0 0 0 4px rgba(227,178,122,.14);
}
.nav-group { margin-bottom: 2px; }
.nav-group-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  background: transparent;
  border: 0;
  color: rgba(226, 232, 235, .62);
  border-radius: 9px;
  text-align: left;
  font-size: 12.5px;
  letter-spacing: .03em;
}
.nav-group-head:hover { color: #fff; background: rgba(255,255,255,.04); }
.nav-group-icon { display: grid; place-items: center; width: 20px; color: rgba(227,178,122,.6); font-size: 15px; }
.nav-group-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-group-count {
  font-family: var(--font-num);
  font-size: 10.5px;
  color: rgba(255,255,255,.38);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 99px;
  padding: 0 6px;
  line-height: 16px;
}
.nav-chevron { font-size: 12px; transition: transform .25s ease; opacity: .55; }
.nav-group.is-open .nav-chevron { transform: rotate(180deg); }
.nav-group-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .32s var(--ease), padding .32s var(--ease);
}
.nav-group.is-open .nav-group-body { max-height: 420px; padding: 2px 0 8px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8.5px 11px 8.5px 41px;
  font-size: 13px;
  color: rgba(225, 231, 234, .62);
  border-radius: 8px;
  position: relative;
  margin: 1px 0 1px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .18s, background .18s, padding .18s;
}
.nav-link .icon { font-size: 15px; opacity: .66; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-link:hover .icon { opacity: 1; color: var(--kraft-2); }
.nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(201,138,75,.2), rgba(201,138,75,.03));
  padding-left: 45px;
}
.nav-link.active::before {
  content: "";
  position: absolute;
  left: 26px; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--kraft-2);
  box-shadow: 0 0 0 4px rgba(227,178,122,.14);
}
.nav-link.active .icon { color: var(--kraft-2); opacity: 1; }
.sidebar-foot {
  padding: 14px 18px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
  background: rgba(0,0,0,.15);
}
.company-stamp {
  display: flex; align-items: flex-start; gap: 8px;
  color: rgba(236, 240, 242, .54);
  font-size: 11px; line-height: 1.45;
}
.company-stamp .icon { font-size: 13px; margin-top: 2px; color: var(--kraft); }
.version-line { margin-top: 8px; font-size: 10px; letter-spacing: .08em; color: rgba(255,255,255,.28); }
.version-line b { color: rgba(227,178,122,.62); font-weight: 600; }
.sidebar.is-collapsed { width: 84px; }
.sidebar.is-collapsed .brand-text, .sidebar.is-collapsed .nav-group-title,
.sidebar.is-collapsed .nav-group-count, .sidebar.is-collapsed .nav-chevron,
.sidebar.is-collapsed .nav-link span, .sidebar.is-collapsed .nav-home span,
.sidebar.is-collapsed .nav-home .nav-pulse, .sidebar.is-collapsed .company-stamp span,
.sidebar.is-collapsed .version-line, .sidebar.is-collapsed .sidebar-collapse { display: none; }
.sidebar.is-collapsed .brand { justify-content: center; padding: 0; }
.sidebar.is-collapsed .nav-group-head { justify-content: center; padding: 10px 0; }
.sidebar.is-collapsed .nav-link { justify-content: center; padding: 10px 0; }
.sidebar.is-collapsed .nav-link.active::before { display: none; }
.sidebar.is-collapsed .nav-group-body { display: none; }
.sidebar.is-collapsed .nav-home { justify-content: center; }

/* ---------------- Main / topbar ---------------- */
.main-shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h);
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 26px;
  background: rgba(243, 239, 232, .82);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid rgba(18, 26, 32, .07);
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.breadcrumb { display: flex; align-items: center; gap: 9px; font-size: 12.5px; white-space: nowrap; }
.crumb-module { color: var(--muted); letter-spacing: .03em; }
.crumb-sep { color: rgba(18,26,32,.22); }
.crumb-current { color: var(--ink); font-weight: 600; }
.topbar-center { flex: 1; display: flex; justify-content: center; }
.global-search {
  width: min(440px, 100%);
  height: 38px;
  border-radius: 10px;
  background: rgba(255,255,255,.68);
  border: 1px solid rgba(18,26,32,.09);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  position: relative;
  transition: box-shadow .2s, border-color .2s, background .2s;
}
.global-search:focus-within { background: #fff; border-color: rgba(201,138,75,.5); box-shadow: 0 0 0 4px rgba(201,138,75,.12); }
.global-search .icon { color: var(--muted); font-size: 15px; }
.global-search input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 12.5px; min-width: 0; }
.global-search kbd {
  font-family: var(--font-num);
  font-size: 10px; color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}
.search-pop {
  position: absolute;
  top: 46px; left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: none;
  max-height: 340px;
  overflow: auto;
  z-index: 60;
}
.search-pop.show { display: block; animation: popIn .18s var(--ease); }
.search-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; font-size: 12.5px; }
.search-item:hover { background: var(--surface-2); }
.search-item .icon { color: var(--kraft); }
.search-item small { margin-left: auto; color: var(--muted); font-size: 11px; }
.search-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.date-chip {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--ink-soft);
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(255,255,255,.5);
  white-space: nowrap;
}
.date-chip .icon { color: var(--kraft); }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  display: grid; place-items: center;
  position: relative;
}
.icon-btn:hover { background: rgba(255,255,255,.7); border-color: var(--line); color: var(--ink); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 3px rgba(223,90,50,.15); }
.mobile-menu { display: none; }
.user-menu { position: relative; }
.user-trigger {
  display: flex; align-items: center; gap: 9px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 4px 6px;
  color: var(--ink);
}
.user-trigger:hover { background: rgba(255,255,255,.7); border-color: var(--line); }
.avatar {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  color: #3a2410;
  font-weight: 700; font-size: 13px;
  background: linear-gradient(145deg, #f0d3a9, #d5a066);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.user-meta strong { font-size: 12.5px; font-weight: 600; }
.user-meta em { font-style: normal; font-size: 10px; color: var(--muted); margin-top: 2px; }
.user-trigger > .icon { font-size: 11px; color: var(--muted); }
.user-drop {
  position: absolute;
  right: 0; top: 48px;
  width: 200px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-md);
  padding: 7px;
  display: none;
  z-index: 70;
}
.user-drop.show { display: block; animation: popIn .18s var(--ease); }
.user-drop-head { padding: 10px 10px 11px; border-bottom: 1px solid var(--line); margin-bottom: 5px; display: flex; flex-direction: column; gap: 2px; }
.user-drop-head strong { font-size: 13px; }
.user-drop-head span { font-size: 11px; color: var(--muted); }
.user-drop a { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 8px; font-size: 12.5px; color: var(--ink-soft); }
.user-drop a:hover { background: var(--surface-2); color: var(--ink); }
.user-drop a .icon { color: var(--kraft); }

/* ---------------- Page ---------------- */
.page-main {
  flex: 1;
  padding: 26px 30px 44px;
  max-width: 1680px;
  width: 100%;
  margin: 0 auto;
  animation: pageIn .35s var(--ease);
}
.page-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--kraft);
  font-weight: 600;
}
.eyebrow em { font-style: normal; color: var(--muted); letter-spacing: .1em; font-weight: 500; margin-left: 2px; }
.eyebrow.light { color: var(--kraft-2); }
.eyebrow-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(201,138,75,.13); }
.page-hero h1 { font-size: clamp(24px, 2.2vw, 31px); letter-spacing: -.02em; font-weight: 700; margin-top: 8px; line-height: 1.2; }
.page-hero p { font-size: 13px; color: var(--ink-soft); margin-top: 7px; max-width: 760px; }
.page-hero-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }

/* 布局工具 */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 15px; margin-bottom: 18px; }
.content-row { display: grid; gap: 16px; margin-bottom: 16px; }
.split-2 { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.split-3 { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, .85fr); }
.section-gap { margin-top: 18px; }
.mb-16 { margin-bottom: 16px; }
.mt-12 { margin-top: 12px; }
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: translateY(-5px) scale(.98); } to { opacity: 1; transform: none; } }

@media (max-width: 1500px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1280px) {
  .topbar-center { display: none; }
  .split-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.mobile-open { transform: none; }
  .mobile-menu { display: grid; }
  .page-main { padding: 20px 18px 40px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-2, .split-3, .grid-4, .grid-3 { grid-template-columns: 1fr; }
}
