/* 前端 B 的页面专属样式（周报 / 统计 / 消息 / 设置 / 管理后台）。公共样式见 core.css */

/* 通用小工具（pg- 前缀，避免和 layout.css 冲突） */
.pg-nowrap { white-space: nowrap; }
.pg-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; letter-spacing: .02em; }
.pg-row-wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pg-row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pg-plain-list { margin: 0 0 14px; padding-left: 18px; color: var(--text-2); }
.pg-plain-list li + li { margin-top: 6px; }
.pg-narrow-form { max-width: 420px; }
.cell-badges { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.cell-note { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* 周报 */
.report-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.report-text { margin-top: 10px; min-height: 320px; background: var(--surface-2); }
.report-tip { margin-top: 8px; }
.report-stats .stat-value { font-size: 24px; }

/* 消息中心 */
.msg-toolbar { justify-content: space-between; }
.msg-toolbar .seg { max-width: 100%; overflow-x: auto; }
.msg-toolbar .seg button { white-space: nowrap; }
.msg-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.msg-item { display: flex; padding: 12px 14px; border-bottom: 1px solid var(--line); position: relative; }
.msg-item:last-child { border-bottom: 0; }
.msg-item.unread { background: var(--accent-soft); }
.msg-item.unread::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.msg-main { min-width: 0; flex: 1; }
.msg-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; }
.msg-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.msg-meta time { margin-left: auto; }
.msg-new { font-size: 12px; color: var(--accent-ink); font-weight: 600; }
.msg-text { white-space: pre-wrap; word-break: break-word; }
.msg-item:not(.unread) .msg-text { color: var(--text-2); }

/* 账号安全 */
.pg-kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; align-items: center; }
.pg-kv dt { color: var(--muted); font-size: 13px; }
.pg-kv dd { margin: 0; word-break: break-all; }
.pg-device { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; }

/* 推送设置 */
.push-current { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 14px; }
.push-current code { word-break: break-all; }
.pg-steps { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pg-steps li { display: flex; gap: 10px; align-items: flex-start; }
.step-no { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }

/* 每日提醒 */
.digest-sample { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--text-2); margin-top: 10px; }
.digest-sample-title { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

/* 会员激活 */
.plan-status { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.plan-name { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.redeem-row { display: flex; gap: 8px; }
.redeem-row input { flex: 1; min-width: 0; }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .plan-grid { grid-template-columns: minmax(0, 1fr); } }
.plan-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.plan-featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.plan-current { background: var(--surface-2); }
.plan-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.plan-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 6px; }
.plan-amount { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.plan-featured .plan-amount { color: var(--accent-ink); }
.plan-was { font-size: 12px; color: var(--muted); }
.plan-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.plan-points li { display: flex; gap: 6px; }
.plan-check { color: var(--success); font-weight: 700; flex: none; }
.plan-note { margin-top: 12px; }
.plan-buy { margin-top: 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.plan-buy .btn { text-decoration: none; }
.pg-danger-zone p { margin: 0 0 10px; }
.pg-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.pg-stack-sm { display: flex; flex-direction: column; gap: 8px; }
.pg-ops { display: inline-flex; gap: 6px; }
.pg-temp-pw { font-size: 24px; font-weight: 700; letter-spacing: 2px; text-align: center; padding: 14px; border-radius: 10px; background: var(--surface-2); user-select: all; }

/* 管理后台 */
.admin-links { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 14px; }
.code-cell { display: inline-flex; align-items: center; gap: 2px; }
.icon-sm { font-size: 13px; padding: 4px 6px; }
.codes-out { background: var(--surface-2); }

/* 网格里的卡片去掉自身下边距，间距统一交给 gap */
.pg-grid { margin-bottom: 16px; }
.pg-grid > .card, .pg-stack > .card:last-child { margin-bottom: 0; }
.pg-sessions { list-style: none; margin: 0; padding: 0; }
.pg-sessions li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pg-sessions li:first-child { padding-top: 0; }
.pg-sessions li:last-child { border-bottom: 0; padding-bottom: 0; }
.pg-sess-main { min-width: 0; }

/* 图表：core 的 SVG 按 600 宽缩放，窄容器里刻度字太小，这里把字放大（只作用于本组页面的图表卡片） */
@media (max-width: 600px) { .pg-chart .chart-tick { font-size: 19px; } }
.pg-grid-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 900px) { .pg-grid-wide { grid-template-columns: minmax(0, 1fr); } }
.pg-mini-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pg-mini-stats .stat-card { box-shadow: none; background: var(--surface-2); padding: 10px 12px; }
.pg-mini-stats .stat-value { font-size: 22px; }
@media (max-width: 600px) { .pg-chart-dense .chart-tick { font-size: 16px; } }
/* 历史周报：手机上整行可点，隐藏“查看周报”按钮列，免得横向滚动 */
@media (max-width: 600px) { .pg-hist .table th:last-child, .pg-hist .table td:last-child { display: none; } }
.pg-guide-seg { margin-bottom: 14px; }
.pg-guide-seg .seg button { white-space: nowrap; }
.redeem-row + .field-hint { display: block; margin-top: 8px; }
.field > .seg { align-self: flex-start; }

/* ---------- AI 助理 ---------- */
.ai-chat { display: flex; flex-direction: column; gap: 12px; }
.ai-log { display: flex; flex-direction: column; gap: 10px; min-height: 160px; max-height: 60vh; overflow-y: auto; padding: 4px 2px; }
.ai-msg { max-width: 85%; padding: 10px 12px; border-radius: var(--radius); white-space: pre-wrap; word-break: break-word; line-height: 1.6; }
.ai-msg-user { align-self: flex-end; background: var(--accent-soft); color: var(--text); }
.ai-msg-bot { align-self: flex-start; background: var(--surface-2); color: var(--text); }
.ai-msg-meta { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.ai-msg-err { align-self: flex-start; background: var(--warning-soft); }
.ai-input { display: flex; gap: 8px; align-items: flex-end; }
.ai-input textarea { flex: 1; min-height: 44px; resize: vertical; }
.ai-tips { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-foot { font-size: 12px; color: var(--muted); }
.ai-notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ai-notes li { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.ai-notes .ai-note-text { white-space: pre-wrap; word-break: break-word; flex: 1; }
.ai-stat { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.linklike { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-align: left; }
.ai-hit-text { white-space: pre-wrap; word-break: break-word; }

/* ---------- 手机 App（PWA 安装 + 网页推送） ---------- */
.app-ico { display: inline-flex; vertical-align: -3px; color: var(--accent); }
.app-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; min-height: 32px; }
.app-switch.is-disabled { cursor: not-allowed; opacity: .55; }
.app-switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.app-switch-track { position: relative; flex: none; width: 44px; height: 26px; border-radius: 13px; background: var(--line); transition: background .15s; }
.app-switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.app-switch-input:checked + .app-switch-track { background: var(--accent); }
.app-switch-input:checked + .app-switch-track::after { transform: translateX(18px); }
.app-switch-input:focus-visible + .app-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
