/* UI v2 - 自适应仪表盘风格（手机/电脑通用） */

:root {
  --bg: #f6f7fb;
  --text: #0f172a;
  --muted: rgba(2, 6, 23, 0.55);
  --border: rgba(15, 23, 42, 0.10);
  --border-strong: rgba(2, 6, 23, 0.14);
  --card: #ffffff;
  --brand: #1d4ed8;
  --brand-2: #8b5cf6;
  --radius: 16px;
  --sidebar-w: 208px;
  --sidebar-collapsed-w: 68px;
}

* { box-sizing: border-box; }

html {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 14px 22px;
}

/* 主内容区：与侧栏紧邻平铺全宽（不再 max-width 居中留白） */
.app-main > .container {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 12px 16px 22px;
  flex: 1;
  min-width: 0;
}

.card {
  min-width: 0;
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  margin-bottom: 14px;
}

/* —— 应用壳：左侧栏 + 顶栏（贴边平铺，无外圈间隙） —— */
.app-shell {
  display: flex;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  align-items: stretch;
}

.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  margin: 0;
  min-height: 100vh;
  background: var(--card);
  border-right: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 0;
  box-shadow: none;
  transition: width 0.22s ease, transform 0.22s ease;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 10px 8px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: rgba(2, 6, 23, 0.82);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.sidebar-link:hover {
  background: rgba(2, 6, 23, 0.05);
  border-color: rgba(15, 23, 42, 0.06);
}

.sidebar-link.is-active {
  background: linear-gradient(135deg, rgba(29, 78, 216, 0.14), rgba(139, 92, 246, 0.1));
  border-color: rgba(29, 78, 216, 0.22);
  color: var(--text);
}

.sidebar-link__ico {
  flex-shrink: 0;
  width: 1.5rem;
  text-align: center;
  font-size: 16px;
  line-height: 1;
}

.sidebar-link__txt {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.app-shell--collapsed .app-sidebar {
  width: var(--sidebar-collapsed-w);
}

.app-shell--collapsed .sidebar-link__txt {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell--collapsed .sidebar-link {
  justify-content: center;
  padding-left: 10px;
  padding-right: 10px;
}

.sidebar-bottom {
  margin-top: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(15, 23, 42, 0.07);
}

.sidebar-footer {
  padding: 0 10px;
  font-size: 11px;
  line-height: 1.45;
  color: rgba(15, 23, 42, 0.48);
}

.sidebar-footer__copy {
  margin: 0 0 6px;
}

.sidebar-footer__link {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: rgba(29, 78, 216, 0.9);
  text-decoration: none;
}

.sidebar-footer__link:hover {
  text-decoration: underline;
}

.app-shell--collapsed .sidebar-footer__copy {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell--collapsed .sidebar-footer {
  text-align: center;
  padding: 0 4px;
}

.app-shell--collapsed .sidebar-footer__link {
  font-size: 0;
  color: transparent;
}

.app-shell--collapsed .sidebar-footer__link::after {
  content: 'ℹ';
  font-size: 15px;
  line-height: 1;
  color: rgba(29, 78, 216, 0.95);
  display: block;
  padding: 4px 0;
}

.sidebar-collapse {
  flex-shrink: 0;
  margin-left: 10px;
  margin-right: 10px;
  margin-bottom: 12px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: rgba(2, 6, 23, 0.03);
  border-radius: 10px;
  padding: 8px 0;
  font-size: 16px;
  font-weight: 700;
  color: rgba(15, 23, 42, 0.65);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-collapse:hover {
  background: rgba(29, 78, 216, 0.08);
  color: #1d4ed8;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin: 0;
  border-radius: 0;
  background: var(--card);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.app-menu-btn {
  display: none;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
}

.app-menu-btn:hover {
  background: rgba(2, 6, 23, 0.05);
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.brand--topbar .brand-mark {
  font-size: 16px;
  padding: 7px 11px;
}

.brand-mark {
  font-weight: 800;
  letter-spacing: 0.3px;
  font-size: 18px;
  padding: 8px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(29, 78, 216, 0.14), rgba(139, 92, 246, 0.10));
  border: 1px solid rgba(29, 78, 216, 0.18);
}

.app-topbar-title {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-topbar-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-backdrop {
  display: none;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.06);
  text-decoration: none;
  color: rgba(2, 6, 23, 0.85);
}

/* 首页公告跑马灯 */
.home-announcement {
  margin-bottom: 14px;
  background: linear-gradient(90deg, rgba(29, 78, 216, 0.1), rgba(139, 92, 246, 0.08));
  border: 1px solid rgba(29, 78, 216, 0.18);
  border-radius: 12px;
  overflow: hidden;
}

.home-announcement__inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 8px 12px;
  min-height: 40px;
}

.home-announcement__label {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 800;
  color: #1d4ed8;
  letter-spacing: 0.06em;
}

.home-announcement__viewport {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
}

.home-announcement__track {
  display: inline-flex;
  width: max-content;
  animation: home-announcement-scroll 22s linear infinite;
}

.home-announcement__track:hover {
  animation-play-state: paused;
}

.home-announcement__text {
  display: inline-block;
  padding-right: 3rem;
  font-size: 13px;
  font-weight: 600;
  color: rgba(15, 23, 42, 0.88);
  white-space: nowrap;
}

@keyframes home-announcement-scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-announcement__track {
    animation: none;
    flex-wrap: wrap;
    white-space: normal;
  }

  .home-announcement__text {
    white-space: normal;
    padding-right: 0;
  }
}

.about-page .about-lead {
  font-size: 15px;
  line-height: 1.65;
  color: rgba(15, 23, 42, 0.78);
  margin: 0 0 14px;
}

.about-page .about-list {
  margin: 0;
  padding-left: 1.2rem;
  line-height: 1.7;
  color: rgba(15, 23, 42, 0.75);
}

/* 兼容旧模板：若仍有 .page-title */
.page-title {
  display: none;
}

.page-title h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0.2px;
}

@media (max-width: 900px) {
  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(var(--sidebar-w), 86vw);
    z-index: 101;
    transform: translateX(-100%);
    min-height: 0;
    box-shadow: 8px 0 32px rgba(15, 23, 42, 0.12);
  }

  .app-shell--drawer-open .app-sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(15, 23, 42, 0.12);
  }

  .app-shell--collapsed .app-sidebar {
    width: min(var(--sidebar-w), 86vw);
  }

  .sidebar-collapse {
    display: none;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.38);
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
  }

  .sidebar-backdrop[hidden] {
    display: none !important;
  }

  .app-menu-btn {
    display: inline-flex;
  }

  .app-shell--collapsed .sidebar-link__txt {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: nowrap;
  }

  .app-shell--collapsed .sidebar-link {
    justify-content: flex-start;
  }

  .app-topbar-title {
    font-size: 17px;
  }
}

/* 首页顶栏：手稿式两大操作块 */
.dash-top-actions {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 14px;
  align-items: stretch;
  margin-bottom: 14px;
}

.dash-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 108px;
  padding: 20px 16px;
  border-radius: 18px;
  text-decoration: none;
  color: #0f172a;
  border: 2px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dash-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
}

.dash-action--order {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.08), #fff);
  border-color: rgba(37, 99, 235, 0.22);
}

.dash-action--stock {
  border-width: 3px;
  font-weight: 800;
}

.dash-stock-hero--ok {
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.12), #fff);
  border-color: rgba(34, 197, 94, 0.35);
}

.dash-stock-hero--warn {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.2), #fff);
  border-color: rgba(217, 119, 6, 0.55);
  box-shadow: 0 6px 22px rgba(245, 158, 11, 0.2);
}

.dash-stock-hero--danger {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.18), #fff);
  border-color: rgba(220, 38, 38, 0.6);
  color: #7f1d1d;
  box-shadow: 0 8px 26px rgba(239, 68, 68, 0.18);
}

.dash-action__label {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.dash-action__sub {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.4;
}

.dash-stock-hero--danger .dash-action__sub {
  color: rgba(127, 29, 29, 0.85);
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 12px;
  align-items: stretch;
}

.hero-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 800;
  letter-spacing: 2px;
  padding: 24px 16px;
  min-height: 140px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.05), rgba(2, 6, 23, 0.02));
  border: 2px solid var(--border-strong);
  text-decoration: none;
  color: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hero-banner:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

/* 库存状态：方形模块（整体可点，不是一行文字链接） */
.hero-stock-tile {
  width: 100%;
  max-width: 168px;
  aspect-ratio: 1;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px 10px 12px;
  border-radius: 18px;
  text-decoration: none;
  color: inherit;
  border: 2px solid var(--border-strong);
  background: #fff;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.hero-stock-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.1);
}

.hero-stock-tile--ok {
  border-color: rgba(34, 197, 94, 0.4);
  background: linear-gradient(160deg, rgba(34, 197, 94, 0.16), rgba(255, 255, 255, 0.98));
}

.hero-stock-tile--warn {
  border-color: rgba(245, 158, 11, 0.55);
  background: linear-gradient(160deg, rgba(245, 158, 11, 0.22), rgba(255, 255, 255, 0.98));
}

.hero-stock-tile--danger {
  border-color: rgba(239, 68, 68, 0.55);
  background: linear-gradient(160deg, rgba(239, 68, 68, 0.2), rgba(255, 255, 255, 0.98));
  color: #7f1d1d;
}

.hero-stock-tile__glyph {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(15, 23, 42, 0.08);
  margin-bottom: 6px;
}

.hero-stock-tile--danger .hero-stock-tile__glyph {
  background: rgba(254, 226, 226, 0.95);
  border-color: rgba(185, 28, 28, 0.25);
}

.hero-stock-tile__big {
  font-size: 34px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.5px;
  margin: 2px 0 2px;
}

.hero-stock-tile__name {
  font-size: 14px;
  font-weight: 800;
  opacity: 0.92;
}

.hero-stock-tile__hint {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 2px;
  margin-bottom: 10px;
}

.hero-stock-tile--danger .hero-stock-tile__hint {
  color: rgba(127, 29, 29, 0.75);
}

.hero-stock-tile__btn {
  display: inline-block;
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  background: #1d4ed8;
  color: #fff;
  border: none;
  pointer-events: none;
}

.hero-stock-tile--danger .hero-stock-tile__btn {
  background: #b91c1c;
}

.hero-stock-tile--warn .hero-stock-tile__btn {
  background: #d97706;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.hero > .quick-actions {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  padding: 12px;
}

.qa-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(2, 6, 23, 0.02);
  color: var(--text);
  font-weight: 800;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.qa-btn:hover {
  background: rgba(29, 78, 216, 0.06);
  border-color: rgba(29, 78, 216, 0.2);
}

.qa-btn small {
  font-weight: 600;
  color: var(--muted);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.tiles--kpi-top {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.tile .value--profit {
  color: #047857;
}

.tile .value--loss {
  color: #b91c1c;
}

.tile--today-profit {
  border-color: rgba(5, 150, 105, 0.35);
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.08), #fff);
}

.text-muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.cell-profit {
  color: #047857;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cell-loss {
  color: #b91c1c;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.finance-period-hint {
  margin: 0 0 14px;
}

.finance-period-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
}

.finance-period-row .field-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}

.finance-period-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.finance-period-row select {
  min-width: 120px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  font-size: 14px;
}

.finance-period-subtitle {
  margin: 16px 0 10px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.finance-period-table {
  font-size: 14px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.text-center {
  text-align: center;
}

.tiles--kpi .tile--kpi {
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tiles--kpi .tile--kpi:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
}

.tile--kpi .meta .value--muted {
  font-size: 16px;
  color: var(--muted);
  font-weight: 700;
}

.tile {
  border-radius: var(--radius);
  background: #fff;
  border: 2px solid var(--border-strong);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.tile .ico {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(29, 78, 216, 0.12);
  border: 1px solid rgba(29, 78, 216, 0.18);
}

.tile .meta { min-width: 0; }

.tile .meta .label {
  font-size: 13px;
  color: var(--muted);
}

.tile .meta .value {
  font-size: 20px;
  font-weight: 900;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.split {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 12px;
  align-items: start;
}

.split--dashboard {
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.55fr);
  align-items: stretch;
}

/* 避免栅格里 Canvas 被压成一条：子项允许收缩并占满列宽 */
.split > .card,
.hero > .quick-actions {
  min-width: 0;
}

.card--flush {
  padding: 12px;
}

/* 手稿风：待办侧栏 */
.todo-sketch {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.todo-sketch__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.todo-sketch__title {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
}

.todo-sketch__chev {
  font-size: 14px;
  color: var(--muted);
}

.todo-sketch__row {
  display: grid;
  grid-template-columns: 18px 1fr auto 14px;
  align-items: center;
  gap: 8px 10px;
  padding: 14px 12px;
  margin: 0 -12px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.todo-sketch__row:last-child {
  border-bottom: none;
}

.todo-sketch__row:hover {
  background: rgba(29, 78, 216, 0.06);
}

.todo-sketch__row--alert {
  background: rgba(254, 243, 199, 0.35);
}

.todo-sketch__row--alert:hover {
  background: rgba(254, 243, 199, 0.55);
}

.todo-sketch__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(15, 23, 42, 0.25);
  background: #fff;
}

.todo-sketch__text {
  font-weight: 800;
  font-size: 14px;
}

.todo-sketch__note {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.todo-sketch__arrow {
  font-size: 18px;
  font-weight: 700;
  color: rgba(15, 23, 42, 0.35);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
}

.panel-title h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.2px;
}

.todo {
  display: grid;
  gap: 10px;
}

.todo-item {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.02);
  padding: 12px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.todo-item .dot {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(2, 6, 23, 0.35);
  background: #fff;
  flex: 0 0 auto;
}

.todo-item .text { min-width: 0; }

.todo-item .text strong {
  display: block;
  font-size: 14px;
}

.todo-item .text span {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

/* 兼容旧页面结构（总览块等） */
.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  padding: 12px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.02);
}

.stat .label {
  font-size: 13px;
  color: var(--muted);
}

.stat .value {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 800;
}

form { display: grid; gap: 10px; }

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

input, select, button {
  width: 100%;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  background: #fff;
  color: #111827;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 38px;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, #6b7280 50%),
    linear-gradient(135deg, #6b7280 50%, transparent 50%),
    linear-gradient(to right, #e5e7eb, #e5e7eb);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px),
    calc(100% - 34px) 50%;
  background-size: 6px 6px, 6px 6px, 1px 18px;
  background-repeat: no-repeat;
}

button {
  background: #1d4ed8;
  color: #fff;
  border: none;
  cursor: pointer;
  border-radius: 12px;
  font-weight: 800;
}

button:hover { background: #1e40af; }

.msg {
  padding: 10px;
  border-radius: 12px;
  margin-bottom: 10px;
  font-size: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.msg.success { background: #ecfdf3; color: #166534; }
.msg.error { background: #fef2f2; color: #991b1b; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}

th, td {
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  padding: 10px 8px;
}

th { color: #374151; background: #f9fafb; }
.text-right { text-align: right; }
.row-warning td { background: #fff7ed; }

.chart-wrap {
  width: 100%;
  min-height: 0;
}

.chart-wrap--svg {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  min-height: 0;
  padding: 10px 12px;
  box-sizing: border-box;
  background: #f1f5f9;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  line-height: 0;
}

.chart-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.chart-empty {
  margin: 0;
  padding: 24px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.erp-svg-chart {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 268px;
  display: block;
  margin: 0 auto;
}

.erp-chart-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.erp-chart-legend .lg {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.erp-chart-legend .lg::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 7px;
  vertical-align: -1px;
}

.lg-pur::before { background: linear-gradient(180deg, #7c3aed, #6d28d9); }
.lg-sale::before { background: linear-gradient(180deg, #0284c7, #0369a1); }
.lg-prof::before { background: linear-gradient(180deg, #0d9488, #0f766e); }
.lg-bar1::before { background: linear-gradient(180deg, #8b5cf6, #6d28d9); }
.lg-bar2::before { background: linear-gradient(180deg, #38bdf8, #0369a1); }
.lg-bar3::before { background: linear-gradient(180deg, #34d399, #047857); }
.lg-barp::before { background: linear-gradient(180deg, #34d399, #059669); }

td a {
  color: #1d4ed8;
  text-decoration: none;
}

td a:hover { text-decoration: underline; }

.pager {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* —— 图表模块（PHP 输出 SVG + 原有 legend 样式） —— */
.chart-board__intro h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.chart-board__intro p {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

.chart-board__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.chart-module {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  background: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%);
  overflow: hidden;
}

.card > .chart-module {
  width: 100%;
  min-width: 0;
}

.chart-module__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.chart-module__head--bare {
  justify-content: flex-start;
  align-items: center;
  padding: 12px 16px;
}

.chart-module__title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.chart-module__hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.chart-module__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.chart-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.05);
  color: rgba(2, 6, 23, 0.65);
  border: 1px solid rgba(15, 23, 42, 0.07);
}

.chart-tag--accent {
  background: rgba(29, 78, 216, 0.1);
  color: #1e40af;
  border-color: rgba(29, 78, 216, 0.22);
}

.chart-module__body {
  flex: 1 1 auto;
  padding: 8px 12px 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}

.chart-module__body .chart-wrap {
  width: 100%;
  min-width: 0;
}

/* 待办工作台模块 */
.card.task-board {
  padding: 18px 16px 16px;
}

.task-board__head {
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
}

.task-board__head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.task-board__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-module {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 14px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.09);
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.task-module:hover {
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.task-module--ok {
  border-color: rgba(34, 197, 94, 0.22);
  background: linear-gradient(145deg, rgba(34, 197, 94, 0.06) 0%, #fff 48%);
}

.task-module--warn {
  border-color: rgba(245, 158, 11, 0.35);
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.1) 0%, #fff 50%);
}

.task-module--danger {
  border-color: rgba(248, 113, 113, 0.45);
  background: linear-gradient(145deg, rgba(254, 202, 202, 0.35) 0%, #fff 50%);
}

.task-module--neutral {
  border-color: rgba(59, 130, 246, 0.22);
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.06) 0%, #fff 48%);
}

.task-module__icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: rgba(15, 23, 42, 0.55);
  background: rgba(2, 6, 23, 0.05);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.task-module__glyph {
  width: 22px;
  height: 22px;
  max-width: 22px;
  max-height: 22px;
  display: block;
  flex-shrink: 0;
}

.task-module__icon svg {
  width: 22px;
  height: 22px;
  max-width: 22px;
  max-height: 22px;
  display: block;
}

.task-module--ok .task-module__icon {
  color: #047857;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.2);
}

.task-module--warn .task-module__icon {
  color: #b45309;
  background: rgba(251, 191, 36, 0.2);
  border-color: rgba(217, 119, 6, 0.28);
}

.task-module--danger .task-module__icon {
  color: #b91c1c;
  background: rgba(252, 165, 165, 0.35);
  border-color: rgba(220, 38, 38, 0.3);
}

.task-module--neutral .task-module__icon {
  color: #1d4ed8;
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(37, 99, 235, 0.22);
}

.task-module__body {
  min-width: 0;
}

.task-module__text {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.task-module__title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.35;
}

.task-module__count {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.07);
  color: rgba(15, 23, 42, 0.72);
  font-variant-numeric: tabular-nums;
}

.task-module__count--soft {
  background: rgba(29, 78, 216, 0.1);
  color: #1e40af;
}

.task-module--danger .task-module__count:not(.task-module__count--soft) {
  background: rgba(254, 226, 226, 0.95);
  color: #991b1b;
}

.task-module--warn .task-module__count:not(.task-module__count--soft) {
  background: rgba(254, 243, 199, 0.95);
  color: #92400e;
}

.task-module--ok .task-module__count:not(.task-module__count--soft) {
  background: rgba(209, 250, 229, 0.9);
  color: #065f46;
}

.task-module__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 4px 14px rgba(37, 99, 235, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.task-module__action:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow:
    0 2px 4px rgba(15, 23, 42, 0.08),
    0 8px 22px rgba(37, 99, 235, 0.28);
}

.task-module__action:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.task-module__action:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

.task-module--ok .task-module__action {
  background: linear-gradient(180deg, #34d399 0%, #059669 100%);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 4px 14px rgba(5, 150, 105, 0.25);
}

.task-module--ok .task-module__action:hover {
  box-shadow:
    0 2px 4px rgba(15, 23, 42, 0.08),
    0 8px 22px rgba(5, 150, 105, 0.3);
}

.task-module--warn .task-module__action {
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 4px 14px rgba(217, 119, 6, 0.28);
}

.task-module--warn .task-module__action:hover {
  box-shadow:
    0 2px 4px rgba(15, 23, 42, 0.08),
    0 8px 22px rgba(180, 83, 9, 0.32);
}

.task-module--danger .task-module__action {
  background: linear-gradient(180deg, #f87171 0%, #dc2626 100%);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 4px 14px rgba(220, 38, 38, 0.28);
}

.task-module--danger .task-module__action:hover {
  box-shadow:
    0 2px 4px rgba(15, 23, 42, 0.08),
    0 8px 22px rgba(185, 28, 28, 0.32);
}

.task-module--neutral .task-module__action {
  background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 4px 14px rgba(37, 99, 235, 0.22);
}

.task-module--neutral .task-module__action:hover {
  box-shadow:
    0 2px 4px rgba(15, 23, 42, 0.08),
    0 8px 22px rgba(37, 99, 235, 0.28);
}

@media (max-width: 768px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-stock-tile {
    max-width: 220px;
    min-height: 168px;
  }

  .dash-top-actions {
    grid-template-columns: 1fr;
  }

  .split--dashboard {
    grid-template-columns: 1fr;
  }

  .hero-banner {
    min-height: 100px;
    font-size: 26px;
  }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles--kpi-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }

  .chart-module__head {
    flex-direction: column;
    align-items: stretch;
  }

  .chart-module__tags {
    justify-content: flex-start;
  }

  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-row { grid-template-columns: 1fr; }

  th, td {
    padding: 8px 6px;
    font-size: 13px;
  }

  .task-module {
    grid-template-columns: 42px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: start;
  }

  .task-module__icon {
    width: 42px;
    height: 42px;
    margin-top: 2px;
  }

  .task-module__action {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 42px;
  }

  .chart-wrap--svg {
    padding: 8px 10px;
  }

  .erp-svg-chart {
    max-height: 220px;
  }

}
