/* Applepool BOT v3.1 样式 */
.apb-app { max-width: 860px; margin: 0 auto; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: #333; }
.apb-header { background: linear-gradient(135deg, #1a2a4a, #2d4a7a); color: #fff; border-radius: 12px 12px 0 0; padding: 20px; }
.apb-header-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.apb-header h2 { margin: 0; font-size: 20px; }
.apb-userinfo { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.apb-vip-badge { background: rgba(255,255,255,.15); padding: 3px 10px; border-radius: 20px; }
.apb-points b { color: #ffd700; }

.apb-tabs { display: flex; gap: 8px; margin-top: 16px; }
.apb-tab { flex: 1; padding: 10px; border: none; border-radius: 8px; background: rgba(255,255,255,.12); color: #fff; font-size: 15px; cursor: pointer; }
.apb-tab.active { background: #ffd700; color: #1a2a4a; font-weight: 700; }
.apb-tab:disabled { opacity: .5; cursor: not-allowed; }

.apb-mode { display: none; padding: 20px; background: #fff; border: 1px solid #e5e5e5; border-top: none; border-radius: 0 0 12px 12px; }
.apb-mode.active { display: block; }

.apb-input-row { display: flex; gap: 10px; margin-bottom: 12px; }
#apb-stock-input { flex: 1; padding: 10px 14px; border: 2px solid #e5e5e5; border-radius: 8px; font-size: 15px; }
#apb-stock-input:focus { border-color: #2d4a7a; outline: none; }

.apb-btn { padding: 8px 18px; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; text-decoration: none; display: inline-block; }
.apb-btn-primary { background: #2d4a7a; color: #fff; }
.apb-btn-primary:hover { background: #1a2a4a; }
.apb-btn-simple { background: #f5a623; color: #fff; font-weight: 600; }
.apb-btn-simple:disabled { background: #ccc; cursor: not-allowed; }
.apb-btn-mini { padding: 3px 10px; font-size: 12px; background: #eee; color: #333; }

.apb-stock-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.apb-stock-item { background: #f0f4fa; border: 2px solid transparent; padding: 6px 12px; border-radius: 20px; cursor: pointer; font-size: 14px; }
.apb-stock-item.active { border-color: #2d4a7a; background: #2d4a7a; color: #fff; }
.apb-stock-del { margin-left: 6px; opacity: .6; }
.apb-empty { color: #999; font-size: 13px; }

.apb-action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0; }
.apb-action { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 8px; border: 2px solid #e5e5e5; border-radius: 12px; background: #fff; cursor: pointer; transition: all .2s; }
.apb-action:hover { border-color: #2d4a7a; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(45,74,122,.15); }
.apb-action-icon { font-size: 28px; }
.apb-action-name { font-size: 15px; font-weight: 600; }
.apb-action-cost { font-size: 12px; color: #f5a623; }

.apb-simple-row { display: flex; align-items: center; justify-content: space-between; background: #fff8ec; border: 1px dashed #f5a623; border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; }
.apb-simple-tip { font-size: 13px; color: #8a6d3b; }

.apb-result { margin-top: 8px; }
.apb-loading { display: flex; align-items: center; gap: 10px; background: #f0f4fa; border-radius: 8px; padding: 12px 16px; margin-bottom: 12px; font-size: 14px; color: #2d4a7a; }
.apb-spinner { width: 18px; height: 18px; border: 3px solid #c5d3e8; border-top-color: #2d4a7a; border-radius: 50%; animation: apb-spin 1s linear infinite; }
@keyframes apb-spin { to { transform: rotate(360deg); } }

.apb-report-wrap { border: 1px solid #e5e5e5; border-radius: 10px; overflow: hidden; }
.apb-report-toolbar { display: flex; justify-content: space-between; gap: 8px; padding: 10px; background: #f8f9fa; border-bottom: 1px solid #e5e5e5; }
.apb-report-frame { width: 100%; height: 600px; border: none; }

.apb-verify-placeholder { text-align: center; padding: 60px 20px; color: #888; }
.apb-disclaimer { font-size: 12px; color: #999; text-align: center; padding: 12px; }

.apb-lockscreen { max-width: 480px; margin: 60px auto; text-align: center; }
.apb-lock-box { background: #fff; border: 1px solid #e5e5e5; border-radius: 16px; padding: 48px 32px; box-shadow: 0 8px 30px rgba(0,0,0,.06); }
.apb-lock-icon { font-size: 48px; margin-bottom: 16px; }
.apb-lock-box h3 { margin: 0 0 12px; font-size: 22px; }
.apb-lock-box p { color: #666; margin-bottom: 24px; }

.apb-toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-20px); background: rgba(0,0,0,.85); color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 14px; z-index: 99999; opacity: 0; transition: all .3s; pointer-events: none; }
.apb-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.apb-tracking { margin-top: 16px; border: 1px solid #e5e5e5; border-radius: 10px; padding: 14px; }
.apb-tracking h4 { margin: 0 0 10px; }
.apb-tracking-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed #eee; font-size: 14px; }

@media (max-width: 600px) {
    .apb-action-grid { grid-template-columns: repeat(2, 1fr); }
    .apb-report-frame { height: 450px; }
}

/* ============ v3.2 统一报告 ============ */
.apb-batch-row { margin: 16px 0 6px; }
.apb-btn-batch { display: flex; align-items: center; gap: 12px; width: 100%; padding: 18px 20px; border: 2px solid #2d4a7a; border-radius: 14px; background: linear-gradient(135deg, #2d4a7a, #3a6bb8); color: #fff; cursor: pointer; transition: all .2s; }
.apb-btn-batch:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(45,74,122,.35); }
.apb-batch-icon { font-size: 30px; }
.apb-batch-title { font-size: 18px; font-weight: 700; }
.apb-batch-desc { font-size: 13px; opacity: .85; flex: 1; text-align: left; }
.apb-batch-cost { font-size: 14px; font-weight: 700; background: rgba(255,255,255,.2); padding: 4px 12px; border-radius: 20px; }

.apb-batch-progress { display: flex; gap: 10px; margin: 12px 0 16px; }
.apb-bp-item { flex: 1; text-align: center; font-size: 13px; color: #999; padding: 10px 6px; background: #f5f5f5; border-radius: 10px; border: 1px solid #e5e5e5; }
.apb-bp-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #ccc; margin-right: 6px; vertical-align: middle; }
.apb-bp-item.done { color: #2e7d32; background: #e8f5e9; border-color: #a5d6a7; }
.apb-bp-item.done .apb-bp-dot { background: #4caf50; }
.apb-bp-item.failed { color: #c62828; background: #fdecea; border-color: #ef9a9a; }
.apb-bp-item.failed .apb-bp-dot { background: #f44336; }
.apb-bp-item.skipped { opacity: .7; }

/* 可选按钮（锁定态） */
.apb-action[disabled] { cursor: not-allowed; opacity: .55; background: #fafafa; }
.apb-action[disabled]:hover { transform: none; box-shadow: none; border-color: #e5e5e5; }
.apb-action-lock { font-size: 14px; }
.apb-action[disabled] .apb-action-cost { color: #aaa; }

#apb-unlock-tip { font-size: 12px; color: #8a6d3b; background: #fff8ec; border: 1px dashed #f5a623; border-radius: 8px; padding: 8px 12px; margin-bottom: 16px; }

/* ============ v3.2 三份报告切换Tab ============ */
.apb-rtabs { display: flex; gap: 6px; padding: 10px 10px 0; background: #f8f9fa; border-bottom: 1px solid #e5e5e5; }
.apb-rtab { padding: 8px 16px; border: 1px solid #e5e5e5; border-bottom: none; border-radius: 8px 8px 0 0; background: #f1f3f5; cursor: pointer; font-size: 14px; font-weight: 600; color: #666; transition: all .2s; }
.apb-rtab.active { background: #fff; color: #2d4a7a; border-color: #2d4a7a; }
.apb-rtab:hover { color: #2d4a7a; }
.apb-rtab-badge { font-size: 11px; background: #f5a623; color: #fff; padding: 1px 6px; border-radius: 10px; margin-left: 4px; }
.apb-rtab-pane { display: none; }
.apb-rtab-pane.active { display: block; }
.apb-cached-report { padding: 30px 24px; text-align: center; background: #fff8ec; min-height: 200px; }
.apb-cached-title { font-size: 15px; color: #8a6d3b; font-weight: 600; margin-bottom: 12px; }
.apb-cached-summary { font-size: 13px; color: #666; line-height: 1.8; max-width: 640px; margin: 0 auto 20px; text-align: left; }

/* ============ v3.2 三份报告查看按钮 ============ */
.apb-bp-item { cursor: pointer; border: 1px solid #e5e5e5; background: #f5f5f5; transition: all .2s; display: flex; align-items: center; justify-content: center; gap: 6px; }
.apb-bp-item:hover { border-color: #2d4a7a; }
.apb-bp-item.pending { cursor: default; }
.apb-bp-item.pending:hover { border-color: #e5e5e5; }
.apb-bp-item.ready { background: #e8f5e9; border-color: #a5d6a7; color: #2e7d32; }
.apb-bp-item.ready:hover { transform: translateY(-2px); box-shadow: 0 3px 10px rgba(46,125,50,.2); }
.apb-bp-status { font-size: 11px; background: rgba(0,0,0,.06); padding: 1px 8px; border-radius: 10px; }
.apb-bp-item.ready .apb-bp-status { background: #4caf50; color: #fff; }
.apb-bp-item.done .apb-bp-status { background: #4caf50; color: #fff; }
.apb-bp-item.failed .apb-bp-status { background: #f44336; color: #fff; }
.apb-report-title { font-size: 14px; font-weight: 600; color: #333; }

/* ============ v3.2 历史报告 ============ */
.apb-history-row { margin: 4px 0 12px; }
.apb-btn-history { border: 1px dashed #2d4a7a; background: #f0f4fa; color: #2d4a7a; padding: 8px 18px; border-radius: 8px; cursor: pointer; font-size: 13px; transition: all .2s; }
.apb-btn-history:hover { background: #2d4a7a; color: #fff; }
.apb-history-list { margin-top: 10px; border: 1px solid #e5e5e5; border-radius: 10px; background: #fff; overflow: hidden; }
.apb-history-title { padding: 10px 14px; background: #f8f9fa; font-size: 13px; font-weight: 600; color: #333; border-bottom: 1px solid #e5e5e5; }
.apb-history-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px dashed #eee; cursor: pointer; font-size: 13px; transition: background .15s; }
.apb-history-item:hover { background: #f0f4fa; }
.apb-history-item:last-child { border-bottom: none; }
.apb-history-type { font-weight: 600; color: #2d4a7a; min-width: 90px; }
.apb-history-time { color: #999; flex: 1; font-size: 12px; }
.apb-history-open { color: #2d4a7a; text-decoration: none; font-size: 12px; }
.apb-history-empty { padding: 20px; text-align: center; color: #999; font-size: 13px; }

/* ============ v3.2 侧边栏 + 报告中心 ============ */
.apb-body { display: flex; gap: 16px; margin-top: 14px; align-items: flex-start; }
.apb-sidebar { flex: 0 0 220px; background: #fff; border: 1px solid #e5e5e5; border-radius: 12px; padding: 12px; position: sticky; top: 10px; max-height: 70vh; overflow-y: auto; }
.apb-sidebar-title { font-size: 15px; font-weight: 700; color: #2d4a7a; margin-bottom: 4px; }
.apb-sidebar-sub { font-size: 11px; color: #999; margin-bottom: 10px; }
.apb-sidebar-item { padding: 10px 12px; border: 1px solid #eee; border-radius: 8px; margin-bottom: 8px; cursor: pointer; transition: all .2s; }
.apb-sidebar-item:hover { border-color: #2d4a7a; background: #f0f4fa; transform: translateX(2px); }
.apb-sidebar-time { font-size: 11px; color: #999; margin-bottom: 4px; }
.apb-sidebar-name { font-size: 14px; font-weight: 600; color: #333; }
.apb-sidebar-code { font-size: 11px; color: #2d4a7a; font-weight: 400; }
.apb-sidebar-meta { font-size: 11px; color: #f5a623; margin-top: 3px; }
.apb-sidebar-empty { text-align: center; color: #aaa; font-size: 12px; padding: 20px 8px; line-height: 1.8; }
.apb-main { flex: 1; min-width: 0; }

.apb-stock-reports { border: 1px solid #e5e5e5; border-radius: 10px; margin: 12px 0; background: #fff; }
.apb-sr-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #f8f9fa; border-bottom: 1px solid #e5e5e5; font-weight: 700; color: #333; }
.apb-sr-day { padding: 10px 14px; border-bottom: 1px dashed #eee; }
.apb-sr-day:last-child { border-bottom: none; }
.apb-sr-day-title { font-size: 13px; font-weight: 700; color: #2d4a7a; margin-bottom: 8px; }
.apb-sr-item { padding: 8px 12px; border: 1px solid #eee; border-radius: 8px; margin-bottom: 8px; background: #fafbfc; }
.apb-sr-time { font-size: 13px; font-weight: 600; color: #333; }
.apb-sr-warn { font-size: 12px; color: #c62828; background: #fdecea; border: 1px solid #ef9a9a; border-radius: 6px; padding: 5px 10px; margin: 6px 0; }
.apb-sr-actions { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.apb-sr-type { font-size: 12px; color: #666; background: #eee; padding: 2px 10px; border-radius: 10px; }
.apb-sr-link { font-size: 12px; color: #2d4a7a; text-decoration: none; }
.apb-sr-loading, .apb-sr-empty { text-align: center; color: #999; padding: 24px; font-size: 13px; }

@media (max-width: 768px) {
    .apb-body { flex-direction: column; }
    .apb-sidebar { flex: none; width: 100%; position: static; max-height: none; }
}

/* ============ v3.2 报告中心（独立全屏页面） ============ */
.apb-reports-app { min-height: 80vh; display: flex; flex-direction: column; }
.apb-reports-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; background: #fff; border-bottom: 1px solid #e5e5e5; }
.apb-reports-header h2 { margin: 0; font-size: 20px; color: #2d4a7a; }
.apb-reports-actions { display: flex; gap: 8px; }
.apb-reports-body { display: flex; flex: 1; min-height: 70vh; }
.apb-reports-side { flex: 0 0 260px; border-right: 1px solid #e5e5e5; background: #f8f9fa; padding: 14px; overflow-y: auto; max-height: calc(100vh - 140px); }
.apb-reports-side-title { font-size: 15px; font-weight: 700; color: #2d4a7a; margin-bottom: 12px; }
.apb-reports-stock { padding: 12px 14px; border: 1px solid #eee; border-radius: 8px; margin-bottom: 8px; background: #fff; cursor: pointer; transition: all .2s; }
.apb-reports-stock:hover { border-color: #2d4a7a; }
.apb-reports-stock.active { border-color: #2d4a7a; background: #eef3fb; box-shadow: 0 2px 8px rgba(45,74,122,.15); }
.apb-reports-stock-name { font-size: 15px; font-weight: 600; color: #333; }
.apb-reports-stock-meta { font-size: 11px; color: #999; margin-top: 4px; }
.apb-reports-main { flex: 1; background: #fff; padding: 20px; overflow-y: auto; max-height: calc(100vh - 140px); }
.apb-reports-detail-head { font-size: 17px; font-weight: 700; color: #2d4a7a; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid #2d4a7a; }
.apb-sr-item { padding: 14px 16px; border: 1px solid #eee; border-radius: 8px; margin-bottom: 10px; background: #fafbfc; }
.apb-sr-time { font-size: 14px; font-weight: 600; color: #333; }
.apb-sr-warn { font-size: 12px; color: #c62828; background: #fdecea; border: 1px solid #ef9a9a; border-radius: 6px; padding: 6px 10px; margin: 8px 0; }
.apb-sr-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.apb-sr-type { font-size: 12px; color: #666; background: #eee; padding: 3px 12px; border-radius: 10px; }
.apb-sr-view { font-size: 13px; }

@media (max-width: 768px) {
    .apb-reports-body { flex-direction: column; }
    .apb-reports-side { flex: none; width: 100%; max-height: 220px; border-right: none; border-bottom: 1px solid #e5e5e5; }
    .apb-reports-main { max-height: none; }
}

/* ============ v3.2 日期分组 ============ */
.apb-sidebar-day { font-size: 11px; font-weight: 700; color: #2d4a7a; padding: 10px 4px 6px; border-bottom: 1px solid #e8edf4; margin-top: 4px; }
.apb-sidebar-day:first-child { margin-top: 0; }
.apb-reports-day { font-size: 12px; font-weight: 700; color: #2d4a7a; padding: 10px 4px 6px; border-bottom: 1px solid #e8edf4; margin-top: 4px; }
.apb-reports-day:first-child { margin-top: 0; }

/* ============ v3.3 Applepool·AI 面板（第一页按钮布局） ============ */
.apb-panel { background: #ffffff; border-radius: 20px; padding: 20px 16px; box-shadow: 0 6px 20px rgba(0,0,0,.08); margin: 14px 0; }
.apb-panel-head { text-align: center; margin-bottom: 16px; }
.apb-panel-title { font-size: clamp(1.1rem, 3.5vw, 1.3rem); font-weight: 700; color: #1a202c; }
.apb-panel-sub { font-size: 0.85rem; color: #718096; margin-top: 4px; }

/* 📊 基础报告复合按钮 */
.apb-btn-base { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; padding: 16px 20px; background: #ffffff; border: 2px solid #e2e8f0; border-radius: 16px; cursor: pointer; transition: all .2s; }
.apb-btn-base:hover { border-color: #2d4a7a; box-shadow: 0 4px 16px rgba(45,74,122,.15); }
.apb-btn-base:active { transform: scale(.96); }
.apb-base-row { display: flex; align-items: center; gap: 8px; }
.apb-base-icon { font-size: 1.4rem; }
.apb-base-title { font-size: clamp(1rem, 3.5vw, 1.15rem); font-weight: 700; color: #1a202c; }
.apb-base-subs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.apb-sub-tag { padding: 4px 14px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }
.tag-val { background: #dbeafe; color: #1e40af; }
.tag-kline { background: #d1fae5; color: #065f46; }
.tag-risk { background: #fee2e2; color: #991b1b; }

/* 📄 行动速查 / 📉 指标策略（胶囊按钮） */
.apb-btn-pill { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 13px 20px; margin-top: 12px; background: rgba(255,255,255,.55); border: 1px solid rgba(255,255,255,.35); border-radius: 999px; cursor: pointer; color: #ffffff; font-size: 0.95rem; font-weight: 600; transition: all .2s; backdrop-filter: blur(4px); }
.apb-btn-pill:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.apb-btn-pill:disabled { opacity: .5; cursor: not-allowed; }
.apb-pill-icon { font-size: 1.1rem; }
.apb-pill-lock { font-size: 0.85rem; opacity: .8; }

/* 📚 报告中心（金色按钮） */
.apb-btn-center { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 13px 20px; margin-top: 12px; background: #f6ad55; border: none; border-radius: 999px; color: #2d3748; font-size: 0.95rem; font-weight: 700; text-decoration: none; transition: all .2s; }
.apb-btn-center:hover { background: #f39c3d; transform: translateY(-2px); box-shadow: 0 4px 14px rgba(246,173,85,.4); }
.apb-pill-arrow { font-size: 1.2rem; font-weight: 700; }

.apb-panel-tip { text-align: center; font-size: 0.75rem; color: #8a6d3b; background: #fff8ec; border: 1px dashed #f5a623; border-radius: 8px; padding: 6px 10px; margin-top: 14px; }

/* 面板深色背景适配（Applepool·AI 面板在白底卡片上，胶囊按钮需深色底） */
.apb-panel { background: linear-gradient(160deg, #1e3a5f 0%, #2d4a7a 60%, #3a6bb8 100%); }
.apb-panel-title { color: #ffffff; }
.apb-panel-sub { color: rgba(255,255,255,.7); }
.apb-btn-base { background: #ffffff; border: none; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.apb-btn-pill { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); color: #ffffff; }
.apb-btn-pill:disabled { background: rgba(255,255,255,.08); }
.apb-panel-tip { background: rgba(255,255,255,.12); border: 1px dashed rgba(255,255,255,.4); color: rgba(255,255,255,.8); }

/* ============ v3.3 响应式适配（按设计图） ============ */
/* 桌面端：三按钮横向排列 */
@media (min-width: 769px) {
    .apb-btn-pill, .apb-btn-center { width: calc(33.333% - 8px); margin-top: 14px; }
    .apb-btn-pill, .apb-btn-center { display: inline-flex; }
    .apb-panel { padding: 24px 28px; }
    .apb-sub-tag { font-size: 0.82rem; padding: 5px 16px; }
    .apb-base-subs { gap: 10px; }
}

/* 手机端：按钮宽度90%，最大340px，居中 */
@media (max-width: 768px) {
    .apb-panel { width: 90%; max-width: 340px; margin: 14px auto; }
    .apb-panel .apb-btn-base,
    .apb-panel .apb-btn-pill,
    .apb-panel .apb-btn-center { width: 100%; }
    .apb-base-subs { gap: 6px; }
    .apb-sub-tag { padding: 4px 10px; font-size: 0.75rem; }
    .apb-panel-head { margin-bottom: 14px; }
}
