/* 全局样式（Bootstrap 5 基础上的少量定制） */
body {
    min-height: 100vh;
}

.auth-card {
    max-width: 420px;
    margin: 3rem auto;
}

/* ===== 认证页（登录/注册/找回）美化外壳 · 磐息守拙朱砂品牌色 ===== */
body.auth-page {
    background: radial-gradient(1200px 600px at 15% -10%, #2b3242 0%, #1b202b 45%, #141821 100%);
    min-height: 100vh;
}
.auth-main {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    width: 100%;
}
.auth-shell {
    width: 100%;
    max-width: 880px;
    display: grid;
    grid-template-columns: 340px 1fr;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .38);
}
.auth-brand {
    background: linear-gradient(160deg, #b02418 0%, #8c1a11 55%, #6f150e 100%);
    color: #fff;
    padding: 2.6rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
}
.auth-brand::after {
    content: '';
    position: absolute;
    inset: 14px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 10px;
    pointer-events: none;
}
.auth-brand-logo {
    width: 84px;
    height: 84px;
    border-radius: 16px;
    background: #fff;
    padding: 6px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .25);
    margin-bottom: 1.1rem;
}
.auth-brand-name {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: .28em;
    text-indent: .28em;
    margin: 0;
}
.auth-brand-rule {
    width: 46px;
    height: 3px;
    background: rgba(255, 255, 255, .85);
    border-radius: 2px;
    margin: 1rem 0;
}
.auth-brand-slogan {
    font-size: 1.05rem;
    letter-spacing: .12em;
    margin: 0 0 .5rem;
    opacity: .96;
}
.auth-brand-desc {
    /* .75rem ≈ 整句 21em 宽约 253px，可单行容纳于品牌栏可用宽度（约 276px），避免尾行掉字 */
    font-size: .75rem;
    line-height: 1.7;
    opacity: .8;
    margin: 0;
}
.auth-form {
    padding: 2.8rem 2.6rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.auth-form-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: .25rem;
}
.auth-form-sub {
    color: #8a9099;
    font-size: .9rem;
    margin-bottom: 1.6rem;
}
.auth-input .input-group-text {
    background: #f6f7f9;
    border-right: 0;
    color: #b02418;
}
.auth-input .form-control {
    border-left: 0;
    padding-left: .35rem;
}
.auth-input .form-control:focus {
    border-left: 0;
    box-shadow: none;
}
.auth-input:focus-within {
    border-radius: .375rem;
    box-shadow: 0 0 0 .2rem rgba(176, 36, 24, .12);
}
.auth-input .form-control,
.auth-input .input-group-text {
    border-color: #dfe3e8;
}
.auth-eye {
    border-left: 0;
    color: #8a9099;
}
/* 获取验证码按钮（input-group 尾部）与品牌色统一 */
.auth-code-btn {
    background: #f6f7f9;
    border: 1px solid #dfe3e8;
    border-left: 0;
    color: #b02418;
    font-size: .9rem;
    white-space: nowrap;
}
.auth-code-btn:hover:not(:disabled) { background: #eef0f3; color: #8c1a11; }
.auth-code-btn:disabled { color: #adb5bd; }

.auth-submit {
    background: linear-gradient(160deg, #b02418, #8c1a11);
    border: 0;
    color: #fff;
    font-weight: 600;
    letter-spacing: .3em;
    text-indent: .3em;
    padding: .7rem 1rem;
    border-radius: .5rem;
    transition: filter .15s ease, transform .05s ease;
}
.auth-submit:hover { color: #fff; filter: brightness(1.08); }
.auth-submit:active { transform: translateY(1px); }
.auth-links a { color: #b02418; text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }
/* hCaptcha 组件：窄容器内不撑破布局 */
.auth-hcaptcha { display: flex; justify-content: center; }
.auth-hcaptcha .h-captcha { transform-origin: top left; }
@media (max-width: 339.98px) {
    .auth-hcaptcha .h-captcha { transform: scale(.85); }
}

@media (max-width: 767.98px) {
    .auth-shell { grid-template-columns: 1fr; max-width: 420px; }
    .auth-brand { padding: 1.8rem 1.5rem; }
    .auth-brand-logo { width: 64px; height: 64px; }
    .auth-brand-name { font-size: 1.6rem; }
    .auth-form { padding: 2rem 1.5rem; }
}


.table-sticky-head th {
    position: sticky;
    top: 0;
    background: #fff;
}

.num-cell {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* 可排序表头 */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:after { content: ' \2195'; color: #adb5bd; font-size: .8em; }

/* 股票联想下拉 */
.suggest-box {
    position: absolute; z-index: 1050; max-height: 260px; overflow-y: auto;
    background: #fff; border: 1px solid #dee2e6; border-radius: .375rem;
    display: none; width: 100%; box-shadow: 0 .5rem 1rem rgba(0,0,0,.15);
}

/* 图表容器 */
.chart-box { width: 100%; height: 320px; }

/* 状态圆点（如回测买卖信号列表：红=卖出、绿=买入），颜色由内联 style 指定 */
.dh-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* 导航二级菜单（Bootstrap 5 无原生 submenu，配合 data-bs-display="static" 自管定位） */
.dropdown-submenu { position: relative; }
.dropdown-submenu > .dropdown-menu { top: 0; left: 100%; margin: 0; }
.dropdown-submenu > .dropdown-toggle::after { float: right; margin-top: .35em; }
/* 桌面端悬停即开；移动端仍靠点击 toggle */
@media (min-width: 992px) {
    .dropdown-submenu:hover > .dropdown-menu { display: block; }
}

/* 分红日历（月视图网格） */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-weight: 600; padding: 6px 0; color: #6c757d; }
.cal-dow.weekend { color: #b02a37; }
.cal-cell { min-height: 96px; border: 1px solid #ced4da; border-radius: 6px; padding: 4px 6px; background: #fff; }
.cal-cell.empty { background: transparent; border-color: transparent; min-height: 0; }
.cal-cell.today { border-color: #0d6efd; box-shadow: 0 0 0 1px #0d6efd inset; }
.cal-daynum { font-size: .8rem; font-weight: 600; color: #495057; }
.cal-daynum.weekend { color: #b02a37; }
.cal-evs { max-height: 140px; overflow-y: auto; }
.cal-ev { font-size: .72rem; line-height: 1.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev .cal-evdps { color: #198754; }
.cal-badge { font-size: .72rem; }

/* ===== 移动端全局适配（<768px）=====
   1) 表格→卡片：renderTable 自动生成 .dh-cards（charts.js drawMobileCards），隐藏原表格；
      个别页面有定制卡片（如持仓页）时表格标记 data-mobile-cards="off" 退出
   2) 筛选栏：card-body d-flex flex-wrap 内的搜索/下拉统一两列栅格，
      width 需 !important 覆盖各页历史内联宽度 */
.dh-cards { display: none; }
@media (max-width: 767.98px) {
    table.dh-table { display: none; }
    .dh-cards { display: block; }
    /* 控件直排（如持仓/关注池）：两列栅格 */
    .card-body.d-flex.flex-wrap > .form-control-sm,
    .card-body.d-flex.flex-wrap > .form-select-sm {
        flex: 1 1 calc(50% - .5rem); width: auto !important; min-width: 0;
    }
    /* div 包裹带标签（如分红方案/分红收入/买卖流水）：组占半行，控件撑满覆盖内联宽度 */
    .card-body.d-flex.flex-wrap > div { flex: 1 1 calc(50% - .5rem); min-width: 0; }
    .card-body.d-flex.flex-wrap > div > .form-control-sm,
    .card-body.d-flex.flex-wrap > div > .form-select-sm { width: 100% !important; }
    /* 组内并排双下拉（如分红方案排序双选）：换行各占整宽 */
    .card-body.d-flex.flex-wrap > div > .d-flex { flex-wrap: wrap; }
    .card-body.d-flex.flex-wrap > div > .d-flex > .form-select-sm { flex: 1 1 100%; width: auto !important; }
    .card-body.d-flex.flex-wrap > .btn { flex: 1 1 100%; }
}

/* ===== 移动端导航（<992px 汉堡折叠面板）=====
   折叠面板内的下拉改为内联手风琴：抵消 Popper 内联定位(!important)，
   借 Bootstrap 点击切换 .show 的既有行为实现展开/收起，无需额外 JS；
   二级菜单（收益分析）由右侧悬浮改为缩进内联，手机上可点 */
@media (max-width: 991.98px) {
    .navbar .navbar-collapse { max-height: calc(100vh - 3.5rem); overflow-y: auto; }
    /* 只抵消 Popper 悬浮定位并做深色皮肤，不接管 display：
       展开/收起由 Bootstrap 给菜单自身加/去 .dropdown-menu.show 原生驱动，
       若在此写 display:none 会因特异性压过 .dropdown-menu.show 导致永远展不开 */
    .navbar .dropdown > .dropdown-menu,
    .navbar .dropdown-submenu > .dropdown-menu {
        position: static !important; transform: none !important; inset: auto !important;
        float: none; width: 100%; min-width: 0; margin: 0; border: 0;
        border-radius: 0; background: transparent; box-shadow: none;
    }
    .navbar .dropdown-submenu { position: static; }
    .navbar .nav-link { padding-top: .65rem; padding-bottom: .65rem; }
    .navbar .dropdown-item { padding: .55rem 1.25rem; }
    /* 菜单融入深色折叠面板：默认 dropdown 深色字在透明底上不可见，统一改浅色 */
    .navbar .dropdown-menu > li > .dropdown-item,
    .navbar .dropdown-menu .dropdown-item { color: rgba(255,255,255,.78); background: transparent; }
    .navbar .dropdown-menu .dropdown-item:hover,
    .navbar .dropdown-menu .dropdown-item:focus { color: #fff; background: rgba(255,255,255,.08); }
    .navbar .dropdown-menu .dropdown-item.active { color: #ffc107; background: rgba(255,255,255,.06); }
    .navbar .dropdown-submenu > .dropdown-menu > li > .dropdown-item,
    .navbar .dropdown-submenu > .dropdown-menu .dropdown-item { padding-left: 2.4rem; }
    .navbar .dropdown-divider { margin: .25rem 0; border-top: 1px solid rgba(255,255,255,.18); }
}

/* 当前页所在导航分组高亮（桌面/移动通用） */
.navbar .nav-link.dh-nav-open { color: #ffc107 !important; }

/* ===== 除息派息日历移动端：7列月网格手机上不可用，改按日期分组列表 ===== */
.cal-mobile { display: none; }
@media (max-width: 767.98px) {
    .cal-desktop { display: none; }
    .cal-mobile { display: block; }
    /* 头部工具栏：标题独占行，筛选下拉两列，月份导航（◀ 输入 ▶）整行拉伸 */
    .cal-head { flex-wrap: wrap; gap: .5rem; }
    .cal-tools { flex: 1 1 100%; }
    .cal-tools > .form-select-sm { flex: 1 1 calc(50% - .5rem); width: auto !important; min-width: 0; }
    .cal-nav { flex: 1 1 100%; }
    .cal-nav #month { flex: 1 1 auto; width: auto !important; min-width: 0; }
}
