/* ========== 工作台 v1.3.28+ 视觉：复用全局青色霓虹毛玻璃体系 ========== */
/* 设计原则：工作台不另立风格，直接对齐 main.css 的 .card / .metric 玻璃配方
   (backdrop-filter: blur(12px) + 青色高光)，避免与其他页面割裂。
   布局 / 响应式断点 / 文本溢出防护保持不变。配色仅用系统青色，无蓝紫。 */

/* 工作台不铺彩色光块，保持与全局一致的纯黑底毛玻璃 */
.page--dash { position: relative; }

/* ---- 工具栏：场景 + 周期 合并一行 ---- */
.dash-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: var(--space); }
.dash-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 0; }
.dash-bar--right { margin-left: auto; }
.dash-bar .tab {
    font-size: 13.5px; padding: 8px 15px; border-radius: 999px;
    border: 1px solid var(--c-border);
    background: var(--c-surface-2);
    -webkit-backdrop-filter: blur(10px) saturate(140%); backdrop-filter: blur(10px) saturate(140%);
    color: var(--c-text-soft);
    cursor: pointer; font-weight: 600; transition: color .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}
.dash-bar .tab:hover { color: var(--c-text); border-color: hsla(189,100%,50%,.45); transform: translateY(-1px); }
.dash-bar .tab.is-active {
    color: var(--on-primary); background: linear-gradient(135deg, var(--c-primary-fill), var(--c-info));
    border-color: transparent; box-shadow: var(--glow-sm); font-weight: 700;
}

/* ---- 自定义周期：起止日期选择（与财务页 .fin-range 视觉一致） ---- */
.dash-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dash-range input[type=date] {
    padding: 6px 10px; border: 1px solid var(--c-border); border-radius: var(--radius-sm);
    background: var(--c-surface); color: var(--c-text); font-size: 13px;
}
.dash-range .muted { color: var(--c-text-soft); }
.dash-range .btn { margin-left: 2px; }

/* ---- 周期空数据提示（v1.3.73）：跨月后本月 0 单，得说清楚是没单不是坏了 ---- */
.dash-emptyhint {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin-bottom: var(--space);
    padding: 10px 14px; border-radius: var(--radius);
    border: 1px solid var(--c-border);
    border-left: 3px solid var(--c-primary);
    background: var(--c-surface-2);
    -webkit-backdrop-filter: blur(10px) saturate(140%); backdrop-filter: blur(10px) saturate(140%);
    color: var(--c-text-soft); font-size: 13px;
}
.dash-emptyhint[hidden] { display: none; }
.dash-emptyhint .icon { width: 16px; height: 16px; flex: none; color: var(--c-primary); }
.dash-emptyhint__text { flex: 1; min-width: 200px; line-height: 1.6; }
.dash-emptyhint .btn { margin-left: auto; flex: none; }

/* ---- KPI 指标横条（4 列自适应） ---- */
.dash-kpi { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: var(--space); }
@media (max-width: 1100px) { .dash-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px)  { .dash-kpi { grid-template-columns: 1fr; } }

/* 复用全局 .card / .metric 玻璃配方（由 main.css 统一主题着色，含浅色白底），此处仅叠加图标布局 */
.dash-kpi .metric {
    position: relative; overflow: hidden;
    display: flex; align-items: center; gap: 14px;
    padding: 16px 18px; border-radius: var(--radius);
    border: 1px solid var(--c-border); box-shadow: var(--shadow);
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.dash-kpi .metric:hover { transform: translateY(-2px); border-color: hsla(189,100%,50%,.3); box-shadow: var(--glow); }
.dash-kpi .metric__icon {
    width: 46px; height: 46px; border-radius: 13px; flex: none;
    display: grid; place-items: center;
    box-shadow: inset 0 1px 0 hsla(0,0%,100%,.18);
    border: 1px solid var(--c-border);
}
.dash-kpi .metric__icon .icon { width: 22px; height: 22px; }
.dash-kpi .metric__body { min-width: 0; flex: 1; }
.dash-kpi .metric__value {
    font-size: 23px; font-weight: 800; line-height: 1.15; letter-spacing: -.3px;
    font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-kpi .metric__label { font-size: 12.5px; color: var(--c-text-soft); margin-top: 3px; }

/* KPI 图标语义着色（全部青色系，与全局一致；无蓝紫） */
.metric--blue   .metric__icon { background: var(--c-primary-soft); color: var(--c-primary); }
.metric--purple .metric__icon { background: hsla(174,70%,45%,.18); color: hsl(174,70%,58%); }
.metric--green  .metric__icon { background: rgba(22,163,74,.16); color: var(--c-success); }
.metric--red    .metric__icon { background: rgba(239,68,68,.16); color: var(--c-danger); }
.metric--amber  .metric__icon { background: rgba(245,158,11,.16); color: var(--c-warning); }
.metric--gray   .metric__icon { background: var(--c-surface-2); color: var(--c-text-soft); border: 1px solid var(--c-border); box-shadow: none; }

/* ---- 12 列主栅格 ---- */
.dash-grid { display: grid; gap: var(--space); grid-template-columns: repeat(12, minmax(0, 1fr)); }

/* 复用全局 .card 玻璃配方（由 main.css 统一主题着色，含浅色白底），此处仅叠加布局 */
.dash-card {
    position: relative; min-width: 0;
    display: flex; flex-direction: column;
    border: 1px solid var(--c-border); border-radius: var(--radius);
    padding: 18px; box-shadow: var(--shadow);
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.dash-card:hover { transform: translateY(-2px); border-color: hsla(189,100%,50%,.3); box-shadow: var(--glow); }
.dash-card > :last-child { margin-bottom: 0; }
.dash-card--span-3  { grid-column: span 3; }
.dash-card--span-4  { grid-column: span 4; }
.dash-card--span-6  { grid-column: span 6; }
.dash-card--span-8  { grid-column: span 8; }
.dash-card--span-12 { grid-column: span 12; }

/* ---- Widget 头部（左侧青色强调色块） ---- */
.dash-card__head { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.dash-card__head::before { content: ""; width: 4px; height: 15px; border-radius: 2px; flex: none; background: linear-gradient(var(--c-primary-fill), var(--c-info)); box-shadow: 0 0 8px hsla(189,100%,50%,.6); }
.dash-card__title { font-weight: 700; font-size: 14.5px; color: var(--c-text); margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-card__more { margin-left: auto; font-size: 12.5px; color: var(--c-primary); font-weight: 600; text-decoration: none; flex: none; }
.dash-card__more:hover { opacity: .8; }

/* ---- 内部小元件：统一半透明玻璃片，与卡片和谐（无蓝紫） ---- */
.dash-todo { display: flex; flex-direction: column; gap: 6px; }
.dash-todo__item { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: var(--radius-sm); color: var(--c-text); font-size: 13.5px; background: var(--c-surface-2); border: 1px solid var(--c-border); text-decoration: none; transition: background .15s ease, transform .15s ease, border-color .15s ease; }
.dash-todo__item:hover { background: var(--c-primary-soft); border-color: hsla(189,100%,50%,.3); transform: translateX(2px); }
.dash-todo__item--warn { border-left: 3px solid var(--c-danger); }
.dash-todo__icon { width: 18px; height: 18px; flex: none; color: var(--c-text-soft); }
.dash-todo__text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-todo__count { font-weight: 700; font-size: 16px; color: var(--c-primary); flex: none; font-variant-numeric: tabular-nums; }
.dash-todo__foot { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--c-border); text-align: right; font-size: 12px; color: var(--c-text-soft); }
.dash-todo__warn { color: var(--c-danger); font-weight: 700; }

/* ---- 状态卡片（采购/售后计数） ---- */
.dash-status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 8px; }
.dash-status-card { text-align: center; padding: 12px 6px; border-radius: var(--radius-sm); background: var(--c-surface-2); border: 1px solid var(--c-border); transition: border-color .15s ease, transform .15s ease, background .15s ease; }
.dash-status-card:hover { border-color: hsla(189,100%,50%,.3); background: var(--c-primary-soft); transform: translateY(-2px); }
.dash-status-card__count { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.dash-status-card__label { font-size: 11.5px; color: var(--c-text-soft); margin-top: 2px; }

/* ---- 订单流水线 ---- */
.dash-pipeline { display: flex; gap: 6px; align-items: flex-end; height: 150px; padding-top: 6px; }
.dash-pipeline__step { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 0; }
.dash-pipeline__bar { width: 100%; border-radius: 4px 4px 0 0; min-height: 4px; transition: height .4s ease; box-shadow: inset 0 1px 0 hsla(0,0%,100%,.25), 0 0 12px hsla(189,100%,50%,.25); border-top: 1px solid hsla(0,0%,100%,.25); background: var(--c-primary-fill); }
.dash-pipeline__count { font-size: 12.5px; font-weight: 700; margin-bottom: 2px; font-variant-numeric: tabular-nums; }
.dash-pipeline__label { font-size: 11px; color: var(--c-text-soft); margin-top: 6px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; max-width: 100%; }
@media (max-width: 1100px) {
    .dash-pipeline__label { writing-mode: vertical-lr; text-orientation: mixed; height: 38px; margin-top: 4px; }
}

/* ---- 小图容器 ---- */
.dash-trend-wrap { width: 100%; height: 190px; position: relative; }
.dash-trend-wrap canvas { width: 100% !important; height: 100% !important; display: block; }
.dash-dist-chart { width: 100%; height: 150px; }
.dash-dist-chart canvas { width: 100% !important; }

/* ---- 配置模板速选 ---- */
.dash-tmpl { display: flex; flex-direction: column; gap: 6px; }
.dash-tmpl__item { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: var(--radius-sm); color: var(--c-text); text-decoration: none; font-size: 13px; background: var(--c-surface-2); border: 1px solid var(--c-border); transition: background .15s ease, transform .15s ease, border-color .15s ease; }
.dash-tmpl__item:hover { background: var(--c-primary-soft); border-color: hsla(189,100%,50%,.3); transform: translateX(2px); }
.dash-tmpl__item span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-tmpl__price { margin-left: auto; font-weight: 700; color: var(--c-primary); font-size: 13px; flex: none; font-variant-numeric: tabular-nums; }

/* ---- 快捷入口 ---- */
.dash-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 6px; }
.dash-link { display: flex; align-items: center; gap: 6px; padding: 9px 10px; border-radius: var(--radius-sm); border: 1px solid var(--c-border); color: var(--c-text); font-size: 12.5px; font-weight: 600; text-decoration: none; background: var(--c-surface-2); transition: border-color .15s ease, color .15s ease, background .15s ease, transform .15s ease; }
.dash-link:hover { border-color: var(--c-primary); color: var(--c-primary); background: var(--c-primary-soft); transform: translateY(-2px); }
.dash-link .icon { width: 16px; height: 16px; flex: none; color: var(--c-primary); }
.dash-link span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- 操作留痕行 ---- */
.dash-ops { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.dash-ops__item { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: var(--radius-sm); transition: background .15s ease; }
.dash-ops__item:hover { background: var(--c-surface-2); }
.dash-ops__avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--c-primary-soft); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--c-primary); flex: none; overflow: hidden; border: 1px solid var(--c-border); }
.dash-ops__avatar img { width: 100%; height: 100%; object-fit: cover; }
.dash-ops__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dash-ops__title { font-weight: 600; color: var(--c-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-ops__time { color: var(--c-text-soft); font-size: 11.5px; }

/* ---- 最近订单表（横向滚动包裹，防溢出） ---- */
.dash-orders .table-wrap { border-radius: var(--radius-sm); background: var(--c-surface-2); border: 1px solid var(--c-border); }
.dash-orders .table { font-size: 13px; background: transparent; }
.dash-orders .table th { background: var(--c-surface); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.dash-orders .table th:first-child, .dash-orders .table td:first-child { position: sticky; left: 0; background: var(--c-surface); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }

/* ---- KPI 环比（v1.3.67）---- */
/* 涨跌配色遵循国内习惯：涨 = 红，跌 = 绿 */
.metric__delta { display: inline-flex; align-items: center; gap: 2px; margin-top: 4px; font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.metric__delta--up   { color: var(--c-danger); }
.metric__delta--down { color: var(--c-success); }
.metric__delta--flat { color: var(--c-text-soft); }
.metric__delta--new  { color: var(--c-info); }
.metric__delta--none { color: var(--c-text-soft); font-weight: 600; }
.dash-kpi__note { grid-column: 1 / -1; font-size: 12px; color: var(--c-text-soft); margin-top: -4px; }
.dash-kpi__note b { color: var(--c-text); font-weight: 700; }

/* ---- 卡片副标题（口径说明）---- */
.dash-card__note { font-size: 11.5px; color: var(--c-text-soft); margin: -8px 0 10px; padding-left: 13px; }

/* ---- 风险预警（v1.3.67）---- */
.dash-risk { display: flex; flex-direction: column; gap: 6px; }
.dash-risk__item { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: var(--radius-sm); background: var(--c-surface-2); border: 1px solid var(--c-border); border-left: 3px solid var(--c-border); color: var(--c-text); font-size: 13.5px; text-decoration: none; transition: background .15s ease, transform .15s ease; }
.dash-risk__item:hover { background: var(--c-primary-soft); transform: translateX(2px); }
.dash-risk__item--danger { border-left-color: var(--c-danger); }
.dash-risk__item--warn   { border-left-color: var(--c-warning); }
.dash-risk__item--ok     { border-left-color: var(--c-success); }
.dash-risk__icon { width: 18px; height: 18px; flex: none; color: var(--c-text-soft); }
.dash-risk__item--danger .dash-risk__icon { color: var(--c-danger); }
.dash-risk__item--warn .dash-risk__icon   { color: var(--c-warning); }
.dash-risk__item--ok .dash-risk__icon     { color: var(--c-success); }
.dash-risk__text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-risk__count { font-weight: 800; font-size: 16px; flex: none; font-variant-numeric: tabular-nums; }
.dash-risk__item--danger .dash-risk__count { color: var(--c-danger); }
.dash-risk__item--warn .dash-risk__count   { color: var(--c-warning); }
.dash-risk__item--ok .dash-risk__count     { color: var(--c-success); }
.dash-risk__foot { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--c-border); font-size: 11.5px; color: var(--c-text-soft); }

/* ---- 状态卡副信息（金额 / 比率）---- */
.dash-status-card__sub { font-size: 11px; color: var(--c-text-soft); margin-top: 2px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- 数据看板：汇总条 + 口径提示（v1.3.67）---- */
.ana-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 10px; margin-bottom: 14px; }
.ana-note { font-size: 12px; color: var(--c-text-soft); margin: 8px 0 0; line-height: 1.6; }
.ana-note--warn { color: var(--c-warning); }
/* 预测结论：一句话讲清「会怎样、值不值得信」，比普通注脚大一级，左侧主色引导条 */
.ana-note--lead { font-size: 13.5px; color: var(--c-text); margin: 0 0 12px; padding: 10px 12px;
                  border-left: 2px solid var(--c-primary); background: var(--nav-panel, transparent);
                  border-radius: 0 8px 8px 0; line-height: 1.65; }
.ana-empty { color: var(--c-text-soft); font-size: 13px; padding: 16px 0; text-align: center; }

/* ---- 预测 v1.3.72：生成时间横幅 + 手动激活空态 ---- */
/* 时间横幅放预测结果最顶上：留存结果可能已放几天，必须一眼看出「这是什么时候算的」 */
.fc-stamp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
            padding: 8px 12px; margin: 0 0 12px; border-radius: 8px;
            border: 1px solid var(--c-border); background: var(--nav-panel, transparent);
            font-size: 12px; line-height: 1.5; }
.fc-stamp__time { color: var(--c-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.fc-stamp__params { color: var(--c-text-soft); }
.fc-stamp--stale { border-color: var(--c-warning); }
.fc-stamp__warn { flex-basis: 100%; color: var(--c-warning); font-weight: 600; }
/* 未预测空态：告诉用户为什么不自动跑（烧 token）+ 大按钮启动 */
.fc-idle { text-align: center; padding: 44px 16px; border: 1px dashed var(--c-border);
           border-radius: 10px; margin-top: 24px; }
.fc-idle__title { font-size: 15px; font-weight: 600; color: var(--c-text); margin-bottom: 10px; }
.fc-idle__text { font-size: 12.5px; color: var(--c-text-soft); max-width: 460px; margin: 0 auto 6px; line-height: 1.7; }
.fc-idle__text--warn { color: var(--c-warning); }
.fc-idle .btn { margin-top: 14px; }
/* 预测图悬浮提示：绝对定位在画布容器内，不跟随滚动；pointer-events:none 防挡住下一次 hover */
.fc-tip { position: absolute; display: none; pointer-events: none; z-index: 5;
          min-width: 110px; padding: 7px 10px; border-radius: 8px;
          border: 1px solid var(--c-border); background: var(--nav-panel, #fff);
          box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
          font-size: 12px; line-height: 1.5; color: var(--c-text); white-space: nowrap; }
.fc-tip__period { display: block; font-weight: 600; margin-bottom: 2px; font-variant-numeric: tabular-nums; }
.fc-tip__row { display: block; color: var(--c-text-soft); }
.fc-tip__row b { color: var(--c-text); font-variant-numeric: tabular-nums; }
.fc-tip__row--range { font-size: 11.5px; }

/* ---- 空态 / loading ---- */
.dash-empty { color: var(--c-text-soft); font-size: 13px; padding: 12px 0; text-align: center; }
.dash-empty--ok { color: var(--c-success); }

/* ---- 响应式栅格断点 ---- */
@media (max-width: 1024px) {
    .dash-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .dash-card--span-3, .dash-card--span-4 { grid-column: span 3; }
    .dash-card--span-6, .dash-card--span-8, .dash-card--span-12 { grid-column: span 6; }
}
@media (max-width: 640px) {
    .dash-grid { grid-template-columns: 1fr; }
    .dash-card--span-3, .dash-card--span-4, .dash-card--span-6, .dash-card--span-8, .dash-card--span-12 { grid-column: span 1; }
}

/* 尊重系统的「减少动态 / 降低透明度」偏好 */
@media (prefers-reduced-motion: reduce) {
    .dash-kpi .metric, .dash-card, .dash-bar .tab, .dash-todo__item, .dash-status-card,
    .dash-tmpl__item, .dash-link, .dash-ops__item:hover, .dash-orders .table-wrap,
    .dash-orders .table th, .dash-orders .table th:first-child, .dash-orders .table td:first-child {
        -webkit-backdrop-filter: none; backdrop-filter: none;
    }
}
