/* ============================================================
   RetailLib 策略页面专用样式（任务看板 + 策略制定表单）
   引入方式：仅 pages/strategies.html 与 pages/strategy-form.html
   色值严格沿用 main.css 品牌变量；周期色映射：
     L 大周期 → --brand-burgundy #80001E（勃艮第红）
     M 中周期 → --brand-orange   #FF9119（爱马仕橙）
     S 小周期 → --brand-slate    #29313C（青灰）
   ============================================================ */

/* ---------- 看板页通用布局 ---------- */
.board {
    padding: 3rem 0 var(--section-gap);
    min-height: calc(100vh - 72px);
    min-height: calc(100dvh - 72px);
}
.board-header {
    margin-bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.board-title {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 700;
    color: white;
    margin-top: 0.5rem;
    letter-spacing: -0.02em;
}
.board-desc {
    color: var(--brand-text-muted);
    margin-top: 0.6rem;
    font-size: 0.98rem;
}

/* ---------- 策略卡片网格 ---------- */
.strategies-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
.strategy-card {
    position: relative;
    background: var(--brand-bg-card);
    border: 1px solid var(--brand-border);
    border-radius: 1.4rem;
    padding: 1.2rem 1.4rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.9rem;
    cursor: pointer;
    height: auto;
}
/* 2026-08-15 统一 APP 形态：卡片垂直堆叠，无 hover 位移 */
.strategy-card:hover {
    border-color: rgba(212, 168, 75, 0.32);
}
.strategy-card-head {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    /* 避让右上角删除按钮（36px + right:0.7rem）：头部内容右端留出按钮区，防止「已开始」徽标被按钮盖住（2026-08-15） */
    padding-right: 2rem;
    flex-shrink: 0;
}
.strategy-symbol {
    font-size: 1.15rem;
    font-weight: 700;
    color: white;
}
.strategy-code {
    font-size: 0.85rem;
    color: var(--brand-text-muted);
}
.badge-started {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.7rem;
    border-radius: 9999px;
    color: var(--brand-amber);
    background: rgba(253, 196, 31, 0.12);
    border: 1px solid rgba(253, 196, 31, 0.32);
    flex-shrink: 0;
}
.strategy-target {
    font-size: 0.92rem;
    color: var(--brand-text);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
    min-width: 0;
    margin: 0;
}
/* 目标 + 持仓 同行（2026-08-20：持仓与目标显示平齐，卡片只读） */
.strategy-main-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}
.strategy-position {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: baseline;
    gap: 0.3rem;
    max-width: 42%;
}
.strategy-position-label {
    font-size: 0.72rem;
    color: var(--brand-text-muted);
    font-weight: 600;
    flex-shrink: 0;
}
.strategy-position-value {
    font-size: 0.92rem;
    color: var(--brand-text);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* 挂单组：固定两组，每组 = 已挂单勾选 + 挂单价格输入（2026-08-20 修订，卡片上直接交互，页面级记录） */
.strategy-pending-groups {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-left: 0.5rem;
    flex-wrap: wrap;
}
.strategy-pending-group {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}
.strategy-pending-box {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    cursor: pointer;
}
.strategy-pending-box .js-pending-check {
    width: 0.95rem;
    height: 0.95rem;
    accent-color: var(--brand-gold);
    cursor: pointer;
    flex-shrink: 0;
}
.strategy-pending-label {
    font-size: 0.72rem;
    color: var(--brand-text-muted);
    cursor: pointer;
}
.strategy-pending-price {
    width: 6.5rem;
    padding: 0.18rem 0.35rem;
    font-size: 0.78rem;
    color: var(--brand-text);
    background: var(--brand-bg-card);
    border: 1px solid var(--brand-border);
    border-radius: 4px;
    outline: none;
}
.strategy-pending-price:focus {
    border-color: var(--brand-gold);
}
.strategy-pending-price::placeholder {
    color: var(--brand-text-muted);
    opacity: 0.6;
}
.strategy-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    margin-top: auto;
    margin-left: 0;
    padding-top: 0.9rem;
    border-top: 1px solid var(--brand-border);
    flex-shrink: 0;
}
.strategy-meta-item {
    font-size: 0.82rem;
    color: var(--brand-text-muted);
    line-height: 1.5;
    text-align: left;
}
.strategy-meta-item strong {
    color: var(--brand-text);
    font-weight: 600;
    margin-right: 0.3rem;
}
/* 删除按钮：常显（2026-08-15 统一 APP 形态，触屏加大目标） */
.strategy-delete {
    position: absolute;
    top: 0.7rem;
    right: 0.7rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-text-muted);
    opacity: 1;
    transition: color 0.2s ease, background 0.2s ease;
    font-size: 1.15rem;
}
.strategy-delete:hover {
    color: var(--brand-red);
    background: rgba(235, 71, 67, 0.12);
}

/* ---------- 空状态 ---------- */
.empty-state {
    text-align: center;
    padding: 4rem 1.5rem;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: 1.6rem;
    color: var(--brand-text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.3rem;
    font-size: 0.98rem;
}
/* 空状态可点击「+」按钮（2026-08-14：替代原提示文案） */
.empty-add {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--brand-gold);
    color: #0B1219;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(212, 168, 75, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.empty-add:active {
    transform: scale(0.94);
    box-shadow: 0 6px 20px rgba(212, 168, 75, 0.3);
}

/* ---------- 悬浮新增按钮（已删除，2026-08-15） ----------
   原金色圆形 .fab 新增按钮由底部 Tab「策略(+)」主按钮取代，全端不再使用。 */

/* ============================================================
   策略制定表单
   ============================================================ */
.form-page {
    padding: 3rem 0 var(--section-gap);
    min-height: calc(100vh - 72px);
    min-height: calc(100dvh - 72px);
}
.form-header {
    margin-bottom: 2rem;
}
/* 2026-08-14：.form-back（← 返回任务看板）已随按钮删除 */
.form-title {
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    font-weight: 700;
    color: white;
    letter-spacing: -0.02em;
}

/* 表单区块（fieldset） */
.form-section {
    border: 1px solid var(--brand-border);
    border-radius: 1.4rem;
    padding: 1.6rem 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--brand-bg-card);
}
.form-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--brand-gold);
    padding: 0 0.5rem;
}
.form-subsection-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brand-text-muted);
    margin: 1.4rem 0 0.8rem;
    padding-top: 1.2rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
}
.form-field {
    position: relative; /* 品种/代码 搜索建议下拉的定位锚点（2026-08-14） */
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
/* 品种/代码 模糊搜索建议下拉（2026-08-14） */
.suggest-box {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.3rem;
    background: var(--brand-bg-card);
    border: 1px solid var(--brand-border);
    border-radius: 0.8rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    max-height: 220px;
    overflow-y: auto;
}
.suggest-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    width: 100%;
    padding: 0.5rem 0.7rem;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--brand-text);
    font: inherit;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
}
.suggest-item:hover,
.suggest-item:focus {
    background: rgba(255, 255, 255, 0.06);
    outline: none;
}
.suggest-symbol {
    font-weight: 600;
}
.suggest-code {
    font-size: 0.75rem;
    color: var(--brand-text-muted);
}
.form-label {
    font-size: 0.82rem;
    color: var(--brand-text-muted);
}
.form-input {
    width: 100%;
    padding: 0.72rem 1rem;
    border-radius: 0.8rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--brand-text);
    font: inherit;
    font-size: 0.92rem;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.form-input:focus {
    outline: none;
    border-color: var(--brand-gold);
    background: rgba(255, 255, 255, 0.06);
}
.form-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}
/* 自动增高输入框（2026-08-16）：宽度不变，高度随内容字符数伸缩 */
.form-input-auto {
    resize: none;
    overflow: hidden;
    min-height: 44px; /* 初始高度对齐单行 input */
    line-height: 1.6;
}

/* 计划开始时间：日期 + 小时并排（2026-08-16） */
.form-datetime-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}
.form-datetime-row .form-input {
    flex: 1 1 auto;
    min-width: 0;
}
.form-hour-select {
    flex: 0 0 6.6rem;
    /* 原生下拉弹层强制深色主题，选项文字可读（2026-08-16 修复） */
    color-scheme: dark;
}
.form-hour-select option {
    color: var(--brand-text);
    background-color: var(--brand-bg-card);
}

/* 周期形态输入行：徽标 + 周期形态 + 单维度分析 */
.cycle-group {
    display: grid;
    grid-template-columns: auto 1fr 1fr;
    gap: 0.8rem;
    align-items: center;
    margin-bottom: 0.8rem;
}
.cycle-badge {
    padding: 0.2rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}
.cycle-badge-L { background: var(--brand-burgundy); color: #fff; }
.cycle-badge-M { background: var(--brand-orange); color: #0B1219; }
.cycle-badge-S { background: var(--brand-slate); color: #E8EDF2; }

/* 周期文字色（价格计算结果强制规范）
   2026-08-14：L 红 / S 灰提亮——原勃艮第/青灰在深色背景上过暗看不清，
   改为与右侧结果一致的可读色（#EB4743 / #D4D4D4） */
.cycle-text-L { color: #EB4743; }
.cycle-text-M { color: var(--brand-orange); }
.cycle-text-S { color: #D4D4D4; }

/* 价格计算：左右两栏布局（左 L/M/S 三周期输入 / 右计算结果全部降序）
   2026-08-14：输入框收窄、右栏封顶 22rem；右栏 grid+absolute 精确贴合左列高度，
   彻底解决结果框与输入列高度差（此前 max-height 定值总是差几像素/偏高一截） */
.price-layout {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 22rem);
    gap: 1.2rem;
    align-items: start;
    max-width: 42rem;
}
/* 左侧：三周期价格输入（唯一参与流式布局项，定义行高） */
.price-input-col {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    min-width: 0;
}
.price-cycle-block {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--brand-border);
    border-radius: 1rem;
    padding: 0.9rem 1rem;
}
.price-cycle-title {
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
}
.price-cycle-inputs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.price-input-field {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.price-input-tag {
    width: 2rem;
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
}
/* 价格输入框收窄（form-input 默认 width:100%），2026-08-14 */
.price-input {
    width: 7.5rem;
}
/* 右侧：计算结果（三周期全部混合降序，从上到下垂直排列，超出滚动）
   2026-08-14：绝对定位精确填满第 2 列网格区域（高度 = 左列行高），
   无论结果多少都与输入列严格平齐，结果多时内部滚动 */
.price-results-col {
    grid-column: 2;
    grid-row: 1;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--brand-border);
    border-radius: 1rem;
    padding: 1rem 1.2rem;
    overflow-y: auto;
    min-width: 0;
}
.price-results-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--brand-text-muted);
    margin-bottom: 0.8rem;
}
.price-results-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.price-result-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    width: fit-content;
}
/* 结果周期色（2026-08-13 需求）：L 结果红 #EB4743、M 保持爱马仕橙、S 结果灰白 #D4D4D4 */
.price-results-list .cycle-text-L { color: #EB4743; }
.price-results-list .cycle-text-S { color: #D4D4D4; }
.price-result-source {
    font-size: 0.62rem;
    font-weight: 600;
    opacity: 0.55;
}
.price-results-empty {
    font-size: 0.8rem;
    color: var(--brand-text-muted);
}

/* ============================================================
   统一 APP 形态（2026-08-15）：全站无侧边栏，body.no-sidebar
   标记已不再需要（策略制定页保留 class 无副作用）。
   ============================================================ */

/* 表单操作 */
.form-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

/* 轻提示 */
.toast {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(-12px);
    background: var(--brand-bg-card);
    border: 1px solid rgba(212, 168, 75, 0.4);
    color: var(--brand-text);
    padding: 0.7rem 1.4rem;
    border-radius: 9999px;
    font-size: 0.88rem;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---------- 表单统一（2026-08-15 统一 APP 形态，单列） ---------- */
.form-grid {
    grid-template-columns: 1fr;
}
.price-layout {
    gap: 0.8rem;
}
.price-input {
    width: 6rem;
}
.cycle-group {
    grid-template-columns: 1fr;
}
.form-section {
    padding: 1.2rem 1rem;
}
@media (max-width: 480px) {
    .strategies-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   移动端 APP 布局补充（<1024px）
   ============================================================ */
/* ---------- 统一 APP 形态补充（2026-08-15，全端） ---------- */
/* 输入框字号 ≥16px，防 iOS 聚焦自动缩放（仅含底部 Tab 的零售页，不动管理后台） */
body:has(.app-tabbar) .form-input {
    font-size: 1rem;
}
/* 无 hover 位移 */
.tool-card:hover {
    transform: none;
}
/* 统一触控目标（仅零售页，管理后台按钮保持桌面态） */
body:has(.app-tabbar) .btn {
    min-height: 44px;
}

/* ============================================================
   「我的」页（pages/mine.html）
   ============================================================ */
.mine-card {
    max-width: 480px;
    margin: 0 auto;
    background: var(--brand-bg-card);
    border: 1px solid var(--brand-border);
    border-radius: 1.6rem;
    padding: 2.2rem 1.8rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
.mine-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(212, 168, 75, 0.12);
    border: 1px solid rgba(212, 168, 75, 0.25);
    color: var(--brand-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.3rem;
}
.mine-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}
.mine-desc {
    font-size: 0.9rem;
    color: var(--brand-text-muted);
    line-height: 1.7;
    max-width: 360px;
}
.mine-note {
    font-size: 0.78rem;
    color: var(--brand-text-muted);
    opacity: 0.75;
}

/* ============================================================
   「我的」页 动作区 / 改密表单 / 配额（2026-08-14）
   ============================================================ */
.mine-actions {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    width: 100%;
    max-width: 320px;
}
.mine-actions .btn {
    width: 100%;
}
.mine-quota {
    font-size: 0.85rem;
    color: var(--brand-text-muted);
    background: rgba(212, 168, 75, 0.08);
    border: 1px solid rgba(212, 168, 75, 0.2);
    border-radius: 0.8rem;
    padding: 0.6rem 1rem;
}
.mine-form {
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
.mine-form .form-label {
    display: block;
    text-align: left;
    font-size: 0.82rem;
    color: var(--brand-text-muted);
    margin-bottom: 0.35rem;
}

/* ============================================================
   游客空态（看板 / 个人中心）
   ============================================================ */
.empty-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
}
.empty-sub {
    font-size: 0.85rem;
    color: var(--brand-text-muted);
    line-height: 1.7;
    max-width: 320px;
    margin: 0 auto;
}
.empty-cta {
    margin-top: 0.6rem;
}

/* ============================================================
   免费会员配额条（看板顶部，2026-08-14）
   ============================================================ */
.quota-bar {
    max-width: 1200px;
    margin: 0 auto 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--brand-gold);
    background: rgba(212, 168, 75, 0.08);
    border: 1px solid rgba(212, 168, 75, 0.22);
    border-radius: 0.9rem;
    padding: 0.65rem 1rem;
    text-align: center;
}

/* ============================================================
   登录 / 注册 模态框（2026-08-14，移动端优先）
   ============================================================ */
.auth-modal-mask {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(5, 9, 14, 0.72);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.auth-modal {
    width: 100%;
    max-width: 380px;
    background: var(--brand-bg-card);
    border: 1px solid var(--brand-border);
    border-radius: 1.4rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    animation: auth-pop 0.22s ease-out;
}
@keyframes auth-pop {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
.auth-modal-head {
    padding: 1.2rem 1.4rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.auth-close {
    width: 30px;
    height: 30px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: var(--brand-text-muted);
    font-size: 1.1rem;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-close:active {
    background: rgba(255, 255, 255, 0.14);
}
.auth-tabs {
    display: flex;
    gap: 0.5rem;
}
.auth-modal-head .auth-tabs {
    flex: 1;
}
/* 「我的」页游客态内嵌登录框（2026-08-14） */
.mine-login-box {
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.mine-login-box .auth-field .form-input {
    font-size: 1rem; /* ≥16px 防 iOS 输入自动缩放 */
    width: 100%;
}
/* 注册展开区（确认密码 + 手机号）与「注册 / 返回登录」按钮 */
.mine-auth-extra {
    border-top: 1px dashed var(--brand-border);
    padding-top: 0.85rem;
}
.mine-auth-actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}
.auth-tab {
    flex: 1;
    padding: 0.55rem 0;
    border: 1px solid var(--brand-border);
    border-radius: 0.7rem;
    background: none;
    color: var(--brand-text-muted);
    font-size: 0.92rem;
    font-family: var(--font-family);
    cursor: pointer;
}
.auth-tab.active {
    color: var(--brand-gold);
    border-color: rgba(212, 168, 75, 0.5);
    background: rgba(212, 168, 75, 0.08);
    font-weight: 600;
}
.auth-body {
    padding: 1.1rem 1.4rem 1.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.auth-body .auth-field .form-input {
    font-size: 1rem; /* ≥16px 防 iOS 输入自动缩放 */
    width: 100%;
}
.auth-submit {
    width: 100%;
    min-height: 46px;
}
.auth-footer {
    border-top: 1px solid var(--brand-border);
    padding: 0.85rem 1.4rem 1.1rem;
}
.auth-footer .auth-guest {
    width: 100%;
}
/* ICP 备案号（合规） */
.footer-beian {
    margin-top: 0.8rem;
    padding: 0 1rem 1.2rem;
    text-align: center;
    font-size: 0.72rem;
    color: var(--brand-text-muted);
}
.footer-beian a {
    color: inherit;
    text-decoration: none;
}
.footer-beian a:hover {
    text-decoration: underline;
}
