/* ============================================================
   应用外壳与业务页面样式
   ============================================================ */

/* ------------------------------ 布局 ------------------------------ */

.app {
  display: flex;
  min-height: 100vh;
}

.app-body {
  flex: 1;
  min-width: 0;
  margin-left: 236px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.22s ease;
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 22px 26px 34px;
}

/* ------------------------------ 侧边栏 ------------------------------ */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  width: 236px;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(560px 220px at 20% 0%, rgba(232, 86, 42, 0.18), transparent 70%),
    linear-gradient(180deg, #111c31 0%, #0c1524 60%, #0a1220 100%);
  color: #c8d2e2;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  transition: width 0.22s ease, transform 0.25s ease;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex: none;
}
.sidebar-brand .logo-cube {
  color: #ff8f62;
  background: rgba(255, 143, 98, 0.12);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  flex: none;
}
.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}
.brand-copy strong {
  font-size: 16px;
  letter-spacing: 1.5px;
  color: #f2f6fd;
}
.brand-copy span {
  font-size: 10.5px;
  letter-spacing: 1.4px;
  color: rgba(255, 255, 255, 0.42);
  margin-top: 2px;
}
.sidebar-close {
  display: none !important;
  margin-left: auto;
  color: rgba(255, 255, 255, 0.6);
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px 10px;
}
.nav::-webkit-scrollbar {
  width: 4px;
}
.nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border: 0;
}
.nav-group + .nav-group {
  margin-top: 14px;
}
.nav-group-title {
  display: block;
  padding: 6px 10px 7px;
  font-size: 10.5px;
  letter-spacing: 1.6px;
  color: rgba(255, 255, 255, 0.34);
  font-weight: 600;
  white-space: nowrap;
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 40px;
  padding: 0 11px;
  margin-bottom: 2px;
  border-radius: 9px;
  color: rgba(226, 236, 250, 0.72);
  font-size: 13.5px;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.nav-item.on {
  background: linear-gradient(90deg, rgba(232, 86, 42, 0.26), rgba(232, 86, 42, 0.08));
  color: #fff;
}
.nav-item.on::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #ff7a45;
}
.nav-icon {
  display: inline-flex;
  color: inherit;
  opacity: 0.82;
  flex: none;
}
.nav-item.on .nav-icon {
  opacity: 1;
  color: #ff9a6e;
}
.nav-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: rgba(255, 122, 69, 0.18);
  color: #ffa87f;
  font-size: 10.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-foot {
  flex: none;
  padding: 12px 12px 16px;
}
.engine-card {
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 11px;
  padding: 11px 12px;
}
.engine-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: #dfe8f6;
}
.engine-row strong {
  font-weight: 500;
}
.pulse {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34c795;
  box-shadow: 0 0 0 0 rgba(52, 199, 149, 0.6);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  70% {
    box-shadow: 0 0 0 7px rgba(52, 199, 149, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(52, 199, 149, 0);
  }
}
.engine-card p {
  margin: 4px 0 8px;
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.4);
}
.engine-meta {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.32);
  border-top: 1px dashed rgba(255, 255, 255, 0.09);
  padding-top: 7px;
}
.sidebar-version {
  text-align: center;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.26);
  margin-top: 10px;
  letter-spacing: 0.4px;
}

/* 收起状态 */
.app.collapsed .sidebar {
  width: 72px;
}
.app.collapsed .app-body {
  margin-left: 72px;
}
.app.collapsed .brand-copy,
.app.collapsed .nav-text,
.app.collapsed .nav-badge,
.app.collapsed .nav-group-title,
.app.collapsed .sidebar-foot,
.app.collapsed .sidebar-close {
  display: none !important;
}
.app.collapsed .sidebar-brand {
  justify-content: center;
  padding: 18px 10px;
}
.app.collapsed .nav-item {
  justify-content: center;
  padding: 0;
}
.app.collapsed .nav-item.on::before {
  left: -10px;
}

.sidebar-mask {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(8, 14, 24, 0.5);
  display: none;
}

/* ------------------------------ 顶栏 ------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 62px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .topbar {
    background: var(--surface);
  }
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  position: relative;
}
.icon-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}

.menu-btn {
  display: none;
}

.crumb {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--muted);
  min-width: 0;
  white-space: nowrap;
}
.crumb-home {
  color: var(--muted);
}
.crumb-sep {
  opacity: 0.5;
}
.crumb-current {
  color: var(--ink);
  font-weight: 600;
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.global-search {
  position: relative;
  display: flex;
  align-items: center;
  width: 268px;
  height: 36px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 9px;
  padding: 0 32px 0 33px;
  transition: all 0.16s ease;
}
.global-search:focus-within {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(232, 86, 42, 0.1);
}
.global-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12.5px;
  color: var(--ink);
}
.global-search input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}
.global-search input::-webkit-search-cancel-button {
  display: none;
}
.global-search .search-icon {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: var(--muted);
}
.global-search .search-icon svg {
  width: 15px;
  height: 15px;
}
.global-search kbd {
  position: absolute;
  right: 8px;
  top: 8px;
  min-width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
}

.top-create {
  height: 36px;
}
.top-create .btn-icon {
  width: 15px;
  height: 15px;
  display: inline-flex;
}

.notify-btn .dot {
  position: absolute;
  top: 7px;
  right: 7px;
  min-width: 7px;
  height: 7px;
  border-radius: 4px;
  background: var(--brand);
  box-shadow: 0 0 0 2px var(--surface);
}
.notify-btn .dot.has-count {
  min-width: 15px;
  height: 15px;
  top: 4px;
  right: 3px;
  padding: 0 3px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 8px 4px 4px;
  border-radius: 10px;
  cursor: pointer;
  outline: none;
  position: relative;
  border: 1px solid transparent;
}
.user:hover,
.user.open {
  background: var(--surface-2);
  border-color: var(--line);
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #ff8a5b, #d94a1e);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  box-shadow: 0 4px 10px -6px rgba(217, 74, 30, 0.9);
}
.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}
.user-meta strong {
  font-size: 12.5px;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}
.user-meta em {
  font-style: normal;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}
.chev {
  width: 12px;
  height: 12px;
  color: var(--muted);
}
.chev::before {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  margin: 2px 0 0 2px;
  border-right: 1.4px solid currentColor;
  border-bottom: 1.4px solid currentColor;
  transform: rotate(45deg);
}

/* ------------------------------ 浮层菜单 ------------------------------ */

.popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  animation: pop-in 0.14s ease;
}
.popover .pop-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  background: none;
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  text-align: left;
}
.popover .pop-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.popover .pop-item.danger {
  color: var(--danger);
}
.popover .pop-item svg {
  width: 15px;
  height: 15px;
  opacity: 0.75;
}
.popover .pop-sep {
  height: 1px;
  margin: 5px 4px;
  background: var(--line);
}
.popover .pop-head {
  padding: 8px 10px 7px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.4px;
}
.popover.notify {
  width: 320px;
  padding: 0;
  overflow: hidden;
}
.notify-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.notify-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.notify-item:last-child {
  border-bottom: 0;
}
.notify-item:hover {
  background: var(--surface-2);
}
.notify-ico {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.notify-item strong {
  display: block;
  font-size: 12.5px;
  color: var(--ink);
  font-weight: 500;
}
.notify-item em {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}
.notify-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

/* ------------------------------ 页脚 ------------------------------ */

.footer {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 26px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 11.5px;
  flex-wrap: wrap;
}
.footer .foot-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dot-ok {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

/* ------------------------------ 页头 ------------------------------ */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--brand);
  font-weight: 600;
  margin-bottom: 3px;
}
.page-head h1 {
  font-size: 23px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.page-head p {
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--muted);
}
.page-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ------------------------------ KPI ------------------------------ */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.kpi {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 17px;
  box-shadow: var(--shadow-sm);
}
.kpi::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--brand-soft);
  opacity: 0.7;
}
.kpi-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.kpi-label {
  font-size: 12.5px;
  color: var(--muted);
}
.kpi-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  color: var(--brand);
}
.kpi-icon svg {
  width: 16px;
  height: 16px;
}
.kpi-value {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  font-size: 25px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.3px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.kpi-value small {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  margin-left: 3px;
  font-family: var(--font);
}
.kpi-foot {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
  flex-wrap: wrap;
}
.kpi-foot .up {
  color: var(--success);
}
.kpi-foot .down {
  color: var(--danger);
}

/* ------------------------------ 图表 ------------------------------ */

.chart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(280px, 1fr);
  gap: 14px;
}
.chart-box {
  position: relative;
  width: 100%;
  height: 268px;
}
.chart-box canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.chart-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 11.5px;
  line-height: 1.6;
  white-space: nowrap;
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, -115%);
  opacity: 0;
  transition: opacity 0.12s ease;
}
.chart-tip.on {
  opacity: 1;
}
.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted);
}
.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.chart-legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--brand);
}

/* ------------------------------ 待办 / 快捷 ------------------------------ */

.todo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.todo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.16s ease;
}
.todo:hover {
  border-color: var(--brand-line);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.todo-ico {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.todo-ico svg {
  width: 19px;
  height: 19px;
}
.todo-info {
  flex: 1;
  min-width: 0;
}
.todo-info strong {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  font-family: var(--mono);
  line-height: 1.2;
}
.todo-info span {
  font-size: 11.5px;
  color: var(--muted);
}
.todo-arrow {
  color: var(--muted);
  opacity: 0.5;
  font-size: 16px;
}
.tone-brand {
  background: var(--brand-soft);
  color: var(--brand);
}
.tone-info {
  background: var(--info-soft);
  color: var(--info);
}
.tone-warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.tone-danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.tone-success {
  background: var(--success-soft);
  color: var(--success);
}
.tone-violet {
  background: var(--violet-soft);
  color: var(--violet);
}

/* ------------------------------ 仪表盘栅格 ------------------------------ */

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr);
  gap: 14px;
}
.dash-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.section-gap {
  margin-top: 14px;
}

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.rank-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}
.rank-no {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
}
.rank-item:nth-child(1) .rank-no {
  background: var(--brand);
  color: #fff;
}
.rank-item:nth-child(2) .rank-no {
  background: var(--brand-soft);
  color: var(--brand);
}
.rank-main {
  min-width: 0;
}
.rank-main strong {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-bar {
  height: 4px;
  border-radius: 3px;
  background: var(--surface-3);
  margin-top: 5px;
  overflow: hidden;
  width: 100%;
}
.rank-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--brand), #f6a06f);
}
.rank-val {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* ------------------------------ 筛选 ------------------------------ */

.filter-card {
  padding: 14px 16px;
  margin-bottom: 14px;
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 10px;
  align-items: end;
}
.filter-grid .field {
  gap: 5px;
}
.filter-grid.cols-4 {
  grid-template-columns: minmax(280px, 1.4fr) minmax(150px, 0.8fr) repeat(2, minmax(140px, 0.7fr)) auto;
}
@media (max-width: 1024px) {
  .filter-grid.cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.filter-grid .input,
.filter-grid .select {
  height: 36px;
  font-size: 12.5px;
}
.filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 2px;
}
.filter-actions .btn {
  height: 36px;
}
.range-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.range-group .input {
  padding: 0 8px;
}
.range-group span {
  color: var(--muted);
  font-size: 12px;
}

.summary-strip {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--muted);
}
.summary-strip strong {
  color: var(--ink);
  font-family: var(--mono);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.toolbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.selection-tip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 7px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 500;
}

/* ------------------------------ 详情 ------------------------------ */

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 20px;
}
.detail-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.detail-title h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  font-family: var(--mono);
  letter-spacing: -0.2px;
}
.detail-head .meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 7px;
  font-size: 12px;
  color: var(--muted);
}
.detail-head .meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.9fr);
  gap: 14px;
  align-items: start;
}
.detail-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.info-list {
  display: flex;
  flex-direction: column;
}
.info-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
}
.info-row:last-child {
  border-bottom: 0;
}
.info-row dt {
  color: var(--muted);
  margin: 0;
}
.info-row dd {
  margin: 0;
  color: var(--text);
  word-break: break-all;
}
.amount-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
}
.amount-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
}
.amount-row strong {
  color: var(--text);
  font-family: var(--mono);
  font-weight: 600;
}
.amount-row.total {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink);
}
.amount-row.total strong {
  font-size: 21px;
  color: var(--brand);
}

.discount-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.discount-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.discount-item .d-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text);
  min-width: 0;
}
.discount-item .d-tag {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--brand-soft);
  color: var(--brand);
  flex: none;
}
.discount-item em {
  font-style: normal;
  font-size: 11.5px;
  color: var(--muted);
}
.discount-item strong {
  color: var(--danger);
  font-family: var(--mono);
  font-size: 12.5px;
  white-space: nowrap;
}

.timeline {
  position: relative;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--line-strong);
}
.tl-item {
  position: relative;
}
.tl-item::before {
  content: "";
  position: absolute;
  left: -19px;
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--line-strong);
}
.tl-item.now::before {
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.tl-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--ink);
  font-weight: 500;
}
.tl-time {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  margin-top: 2px;
}
.tl-desc {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.6;
}
.tl-arrow {
  font-size: 11px;
  color: var(--muted);
}
.tl-arrow b {
  color: var(--text);
  font-weight: 500;
}

.bill-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bill {
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
}
.bill-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 13px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.bill-head .fno {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  font-weight: 600;
}
.bill-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--muted);
  flex-wrap: wrap;
}
.bill-items {
  padding: 8px 13px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.bill-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--text);
}
.bill-line span {
  color: var(--muted);
}

/* ------------------------------ 建单 ------------------------------ */

.order-form {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 340px;
  gap: 16px;
  align-items: start;
}
.sku-search {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.sku-list {
  max-height: 268px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 14px;
}
.sku-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.14s ease;
  background: var(--surface);
}
.sku-item:hover {
  border-color: var(--brand-line);
  background: var(--brand-soft);
}
.sku-thumb {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  flex: none;
  font-family: var(--mono);
}
.sku-item:hover .sku-thumb {
  background: #fff;
  color: var(--brand);
}
.sku-info {
  min-width: 0;
  flex: 1;
}
.sku-info strong {
  display: block;
  font-size: 12px;
  color: var(--ink);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sku-info span {
  font-size: 10.5px;
  color: var(--muted);
}
.sku-price {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--brand);
  font-weight: 600;
  white-space: nowrap;
}
.sku-add {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  font-size: 14px;
  line-height: 1;
}
.sku-item:hover .sku-add {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.line-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.line-table th {
  text-align: left;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
}
.line-table td {
  padding: 9px 6px;
  border-bottom: 1px dashed var(--line);
}
.qty-control {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}
.qty-control button {
  width: 24px;
  height: 26px;
  border: 0;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
}
.qty-control button:hover {
  background: var(--brand-soft);
  color: var(--brand);
}
.qty-control span {
  min-width: 30px;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
}
.checkout-panel {
  position: sticky;
  top: 76px;
}
.checkout-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 230px;
  overflow: auto;
  padding-right: 2px;
}
.checkout-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}
.checkout-line .l-name {
  color: var(--text);
  min-width: 0;
}
.checkout-line em {
  font-style: normal;
  display: block;
  font-size: 10.5px;
  color: var(--muted);
}
.checkout-line strong {
  color: var(--danger);
  font-family: var(--mono);
  white-space: nowrap;
}
.checkout-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.checkout-total span {
  font-size: 12.5px;
  color: var(--muted);
}
.checkout-total strong {
  font-family: var(--mono);
  font-size: 24px;
  color: var(--brand);
  font-weight: 700;
}
.checkout-note {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}
.form-section {
  padding: 14px 16px;
}
.form-section + .form-section {
  border-top: 1px solid var(--line);
}
.form-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 12px;
}
.form-section-title small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

/* ------------------------------ 履约 / 售后 ------------------------------ */

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.stat-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.stat-tile .tile-ico {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.stat-tile strong {
  display: block;
  font-family: var(--mono);
  font-size: 19px;
  color: var(--ink);
  line-height: 1.2;
}
.stat-tile span {
  font-size: 11.5px;
  color: var(--muted);
}

.logistics {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}
.logistics em {
  display: block;
  font-style: normal;
  font-size: 10.5px;
  color: var(--muted);
  font-family: var(--font);
}

/* ------------------------------ 打印 ------------------------------ */

.print-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.print-controls {
  position: sticky;
  top: 76px;
}
.paper-stage {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 18px;
  padding: 26px 18px;
  background:
    radial-gradient(circle at 20% 10%, rgba(232, 86, 42, 0.05), transparent 60%),
    var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  min-height: 520px;
}
.print-sheet {
  background: #fff;
  color: #1a1a1a;
  box-shadow: 0 16px 40px -20px rgba(16, 26, 46, 0.4);
  border: 1px solid #e6e6e6;
  border-radius: 4px;
  padding: 22px 20px;
  font-size: 12px;
  line-height: 1.7;
  width: 340px;
}
.print-sheet.shipping {
  width: 520px;
  font-size: 12.5px;
  padding: 28px 26px;
}
.print-sheet h2 {
  text-align: center;
  font-size: 17px;
  letter-spacing: 4px;
  font-weight: 700;
  color: #111;
}
.print-sub {
  text-align: center;
  font-size: 10.5px;
  color: #777;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.print-sep {
  border: 0;
  border-top: 1px dashed #c9c9c9;
  margin: 10px 0;
}
.print-meta {
  font-size: 11px;
  color: #444;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 10px;
}
.print-meta div {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.print-table th {
  text-align: left;
  font-weight: 600;
  color: #333;
  border-bottom: 1px solid #999;
  padding: 4px 0;
}
.print-table td {
  padding: 4px 0;
  border-bottom: 1px dotted #ddd;
  color: #222;
  vertical-align: top;
}
.print-table .r {
  text-align: right;
}
.print-sum {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: #333;
}
.print-sum div {
  display: flex;
  justify-content: space-between;
}
.print-sum .grand {
  font-size: 14px;
  font-weight: 700;
  color: #111;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid #999;
}
.print-foot {
  margin-top: 14px;
  text-align: center;
  font-size: 10px;
  color: #888;
  line-height: 1.7;
}
.print-address {
  font-size: 11.5px;
  line-height: 1.6;
  color: #222;
}
.print-sign {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #555;
}
.barcode {
  height: 34px;
  margin: 8px 0 2px;
  background-image: repeating-linear-gradient(90deg, #111 0 2px, transparent 2px 4px, #111 4px 5px, transparent 5px 9px);
  opacity: 0.85;
}
.barcode-num {
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: #333;
}

/* ------------------------------ 统计页 ------------------------------ */

.stats-lower {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.legend-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 10px;
}
.legend-inline span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--muted);
}
.legend-inline i {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  flex: none;
}
.legend-inline b {
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 600;
}
.legend-inline em {
  font-style: normal;
  font-size: 10.5px;
}
.share-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}
.share-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
}
.share-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}
@media (max-width: 960px) {
  .stats-lower {
    grid-template-columns: 1fr;
  }
}

@media print {
  .paper-stage {
    background: #fff;
    border: 0;
    padding: 0;
    min-height: 0;
    display: block;
  }
  .print-sheet + .print-sheet {
    page-break-before: always;
    margin-top: 0 !important;
  }
}

/* ------------------------------ 日志 ------------------------------ */

.log-type {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11.5px;
  background: var(--surface-3);
  color: var(--muted);
  white-space: nowrap;
}
.log-content {
  max-width: 620px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.log-detail {
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--text);
  word-break: break-all;
}
/* ------------------------------ 响应式 ------------------------------ */

@media (max-width: 1280px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chart-layout,
  .dash-grid {
    grid-template-columns: 1fr;
  }
  .order-form {
    grid-template-columns: 1fr;
  }
  .checkout-panel,
  .print-controls {
    position: static;
  }
  .print-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 20px 0 60px -30px rgba(0, 0, 0, 0.6);
  }
  .app.sidebar-open .sidebar {
    transform: translateX(0);
  }
  .app.sidebar-open .sidebar-mask {
    display: block;
  }
  .app-body,
  .app.collapsed .app-body {
    margin-left: 0;
  }
  .app.collapsed .sidebar {
    width: 236px;
  }
  .sidebar-close,
  .menu-btn {
    display: inline-flex !important;
  }
  .top-create span:not(.btn-icon) {
    display: none;
  }
  .top-create {
    width: 36px;
    padding: 0;
  }
  .global-search {
    width: 200px;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .detail-head {
    flex-direction: column;
  }
}

@media (max-width: 820px) {
  .app-main {
    padding: 16px 14px 24px;
  }
  .topbar {
    padding: 0 14px;
    gap: 8px;
  }
  .crumb,
  .user-meta,
  .global-search kbd {
    display: none;
  }
  .global-search {
    width: 150px;
    padding-right: 10px;
  }
  .footer {
    padding: 12px 14px;
  }
  .page-head h1 {
    font-size: 20px;
  }
  .stat-tiles,
  .todo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .span-2 {
    grid-column: span 1;
  }
  .sku-list {
    grid-template-columns: 1fr;
  }
  .table th,
  .table td {
    padding: 10px 9px;
  }
  .modal {
    width: 100%;
  }
  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .print-sheet.shipping {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .filter-grid.cols-4 {
    grid-template-columns: 1fr;
  }
  .filter-grid {
    grid-template-columns: 1fr;
  }
  .summary-strip {
    gap: 10px;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .pager {
    justify-content: center;
  }
}
