/* ===== Inbound Portal 全局增强样式（配合 app.js） ===== */

/* ---------- 可搜索下拉 ---------- */
.ss { position: relative; width: 100%; min-width: 110px; }
.ss-native {
    position: absolute !important; inset: 0; width: 100% !important; height: 100% !important;
    opacity: 0 !important; pointer-events: none !important; margin: 0 !important;
}
.ss-btn {
    width: 100%; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    background-color: #fff; cursor: pointer; line-height: 1.5;
}
.ss-btn:disabled { background-color: #f4f4f8; cursor: not-allowed; }
.ss-btn.ss-placeholder { color: #8a8698; }
.ss.open .ss-btn { border-color: var(--brand); }
.ss-panel {
    position: fixed; z-index: 2000; background: #fff; border: 1px solid #e2e0ea;
    border-radius: 10px; box-shadow: 0 10px 28px rgba(40, 40, 90, .16); padding: 6px;
    display: none;
}
.ss-panel.show { display: block; animation: ssIn .12s ease-out; }
@keyframes ssIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.ss-input { margin-bottom: 6px; }
.ss-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.ss-list li {
    padding: 6px 10px; border-radius: 7px; cursor: pointer; font-size: 13.5px; color: #3a3a4a;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ss-list li.active { background: var(--brand-050); color: var(--brand); }
.ss-list li.selected { font-weight: 600; }
.ss-list li.selected::after { content: " ✓"; color: var(--brand); }
.ss-list li.disabled { color: #bbb; cursor: not-allowed; }
.ss-list li.ss-empty { color: #9a9aac; cursor: default; text-align: center; }

/* ---------- 筛选栏 ---------- */
.filter-bar { row-gap: 8px !important; }
.filter-bar .form-control, .filter-bar .ss { min-width: 140px; }
.filter-bar input[type=search] { min-width: 200px; }
.filter-bar .btn { white-space: nowrap; }

/* 搜索命中高亮 */
.table mark { background: #fff1b8; color: inherit; padding: 0 1px; border-radius: 3px; }

/* ---------- 分页条 ---------- */
.pager-bar {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
    gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid #f2f1f7;
}
.pager-info { color: #8a8698; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.pager-info b { color: #2a2733; }
.pager-size { width: auto !important; padding-right: 2rem; font-size: 12.5px; }
.pager-jump { display: flex; align-items: center; gap: 6px; color: #8a8698; font-size: 13px; margin: 0; }
.pager-jump input { width: 64px; }
.pagination .page-item.disabled .page-link { color: #c5c3d0; background: #fff; }

/* ---------- 表格 ---------- */
tr[data-href] { cursor: pointer; }
.table tbody td[colspan].text-center.text-muted::before {
    content: "📭"; display: block; font-size: 28px; opacity: .55; margin-bottom: 4px;
}

/* ---------- 按钮：提交中 ---------- */
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after {
    content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px;
    border: 2px solid rgba(0, 0, 0, .25); border-top-color: #fff; border-radius: 50%;
    animation: spin .7s linear infinite;
}
.btn-outline-primary.is-busy::after, .btn-outline-secondary.is-busy::after,
.btn-outline-success.is-busy::after, .btn-outline-danger.is-busy::after { border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

/* 键盘可达性：可见焦点环 */
.btn:focus-visible, .ss-btn:focus-visible, a:focus-visible {
    outline: 2px solid var(--brand-hover); outline-offset: 2px; box-shadow: none;
}

/* ---------- 顶栏菜单按钮（仅移动端，用于打开侧栏抽屉） ---------- */
.sb-toggle {
    border: 0; background: transparent; font-size: 20px; color: #525b69; width: 48px; height: 100%;
    display: none; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.sb-toggle:hover { background: #f6f6f6; }

.sidebar { transition: transform .18s; }
.sidebar .nav-link { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 移动端：侧栏抽屉 ---------- */
.sb-mask { display: none; }
@media (max-width: 991.98px) {
    :root { --side-w: 220px; }
    .sb-toggle { display: flex; }
    .top-header .logo { width: auto; padding: 0 12px; }
    .top-header .page-title { display: none; }
    .sidebar { transform: translateX(-100%); box-shadow: 4px 0 20px rgba(0, 0, 0, .25); }
    body.sb-open .sidebar { transform: none; }
    body.sb-open .sb-mask {
        display: block; position: fixed; inset: var(--header-h) 0 0 0; background: rgba(15, 18, 30, .35); z-index: 1010;
    }
    .main-content { margin-left: 0 !important; padding: 12px; }
    .filter-bar input[type=search], .filter-bar .form-control, .filter-bar .ss { max-width: none !important; flex: 1 1 100%; }
}

/* ---------- 回到顶部 ---------- */
.back-top {
    position: fixed; right: 22px; bottom: 26px; width: 40px; height: 40px; border-radius: 50%;
    border: 0; background: var(--brand); color: #fff; font-size: 18px; font-weight: 700;
    box-shadow: 0 6px 18px rgba(81, 86, 190, .35); opacity: 0; pointer-events: none;
    transition: opacity .2s, transform .2s; transform: translateY(8px); z-index: 1040;
}
.back-top.show { opacity: .9; pointer-events: auto; transform: none; }
.back-top:hover { opacity: 1; }

/* ---------- 提示条 ---------- */
.main-content > .alert { box-shadow: 0 4px 14px rgba(40, 40, 90, .06); }

/* 深色侧栏：细滚动条 */
.sidebar { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.14) transparent; }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28); }

/* bootstrap 的 .card 默认纵向 flex，统计卡需横排 */
.card.stat-card { flex-direction: row; }

/* =====================================================================
 * 工作台 Dashboard
 * ===================================================================== */
.db { --tone-brand: #5156be; --tone-blue: #1e88e5; --tone-amber: #f59e0b; --tone-green: #22a36b;
      --tone-cyan: #0891b2; --tone-violet: #8b5cf6; --tone-red: #e5484d; --tone-gray: #9ca3af; }
.db .tone-brand, .db .tone-primary { --c: var(--tone-brand); }
.db .tone-blue { --c: var(--tone-blue); }
.db .tone-info, .db .tone-cyan { --c: var(--tone-cyan); }
.db .tone-amber, .db .tone-warning { --c: var(--tone-amber); }
.db .tone-green, .db .tone-success { --c: var(--tone-green); }
.db .tone-violet { --c: var(--tone-violet); }
.db .tone-red, .db .tone-danger { --c: var(--tone-red); }
.db .tone-gray { --c: var(--tone-gray); }

/* 欢迎横幅 */
.db-hero {
    position: relative; overflow: hidden; border-radius: 18px; padding: 26px 30px; margin-bottom: 18px; color: #fff;
    background:
        radial-gradient(900px 300px at 85% -40%, rgba(255,255,255,.18), transparent 60%),
        linear-gradient(115deg, #13315c 0%, #1e5aa8 48%, #5156be 100%);
    box-shadow: 0 12px 30px rgba(30, 60, 140, .22);
}
.db-hero::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 60px; opacity: .22;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 60' preserveAspectRatio='none'%3E%3Cpath d='M0 30 Q150 0 300 30 T600 30 T900 30 T1200 30 V60 H0Z' fill='white'/%3E%3C/svg%3E") no-repeat bottom / 100% 100%;
}
.db-hero-text { position: relative; z-index: 1; max-width: 760px; }
.db-hero-date { font-size: 13px; opacity: .8; letter-spacing: .5px; }
.db-hero h2 { font-size: 24px; font-weight: 700; margin: 6px 0 4px; }
.db-hero p { margin: 0 0 16px; opacity: .88; font-size: 14px; }
.db-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.db-act {
    display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
    color: #fff; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); backdrop-filter: blur(4px);
    transition: background .15s, transform .15s;
}
.db-act:hover { color: #fff; background: rgba(255,255,255,.26); transform: translateY(-1px); }
.db-act.primary { background: #fff; color: #1e3f8f; border-color: #fff; }
.db-act.primary:hover { color: #1e3f8f; background: #f0f4ff; }
.db-hero-mark {
    position: absolute; right: 34px; top: 50%; transform: translateY(-50%); width: 132px; height: 132px;
    border-radius: 50%; background: #fff; padding: 10px; opacity: .95; box-shadow: 0 10px 30px rgba(0,0,0,.2);
}

/* 指标卡 */
.db-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
@media (min-width: 1200px) { .db-kpis { grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); } }
.db-kpi {
    position: relative; display: flex; align-items: center; gap: 14px; padding: 18px 16px; border-radius: 14px;
    background: #fff; border: 1px solid var(--card-border); box-shadow: var(--card-shadow); color: inherit;
    transition: transform .15s, box-shadow .15s, border-color .15s; overflow: hidden;
}
.db-kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); opacity: .85; }
.db-kpi:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(40,40,90,.10); color: inherit; }
.db-kpi-ic {
    width: 46px; height: 46px; border-radius: 12px; flex: none; display: flex; align-items: center; justify-content: center;
    color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff);
}
.db-kpi-val { font-size: 26px; font-weight: 700; color: #1f2233; line-height: 1.1; }
.db-kpi-lbl { font-size: 13px; color: #8a8698; margin-top: 2px; }
.db-kpi-sub { font-size: 12px; color: var(--c); margin-top: 2px; font-weight: 600; }
.db-kpi-go { position: absolute; right: 12px; top: 12px; color: #c9c7d6; transition: color .15s, transform .15s; }
.db-kpi:hover .db-kpi-go { color: var(--c); transform: translateX(2px); }

/* 通用卡片头 */
.db-card { padding: 0 !important; }
.db-card-h {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
    padding: 14px 20px; border-bottom: 1px solid #f2f1f7; font-weight: 600; color: #2a2733; font-size: 15px;
}
.db-more { font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.db-count { background: var(--tone-red); color: #fff; border-radius: 10px; font-size: 12px; padding: 1px 8px; font-weight: 600; }

/* 流程管道 */
.db-pipe { display: flex; align-items: flex-start; padding: 24px 20px 20px; overflow-x: auto; }
.db-pipe-step { flex: none; width: 108px; text-align: center; color: inherit; }
.db-pipe-step:hover { color: inherit; }
.db-pipe-n {
    width: 58px; height: 58px; margin: 0 auto 10px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700; color: #b3b1c2; background: #f5f4fa; border: 2px solid #ebeaf3; transition: .15s;
}
.db-pipe-step.has .db-pipe-n { color: #fff; background: linear-gradient(135deg, #7267ef, #5156be); border-color: transparent; box-shadow: 0 6px 16px rgba(81,86,190,.28); }
.db-pipe-step:last-child.has .db-pipe-n { background: linear-gradient(135deg, #34d399, #22a36b); box-shadow: 0 6px 16px rgba(34,163,107,.28); }
.db-pipe-step:hover .db-pipe-n { transform: scale(1.06); }
.db-pipe-l { font-size: 12.5px; color: #6b6b7b; line-height: 1.35; }
.db-pipe-line { flex: 1; min-width: 24px; height: 2px; margin-top: 29px; background: repeating-linear-gradient(90deg, #d9d7e6 0 6px, transparent 6px 11px); }

/* 趋势图 */
.db-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; font-weight: 500; color: #6b6b7b; }
.db-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.db-legend b { color: #2a2733; margin-left: 3px; }
.db-chart { width: 100%; height: auto; display: block; padding: 10px 14px 6px; }

/* 待办 */
.db-todos { padding: 6px 10px 10px; }
.db-todo { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; color: #3a3a4a; transition: background .12s; }
.db-todo:hover { background: #f7f6fc; color: #3a3a4a; }
.db-todo-ic { width: 32px; height: 32px; border-radius: 9px; flex: none; display: flex; align-items: center; justify-content: center; color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); }
.db-todo-t { flex: 1; font-size: 13.5px; }
.db-todo-n { min-width: 30px; text-align: center; font-weight: 700; font-size: 13px; padding: 2px 8px; border-radius: 10px; color: #fff; background: var(--tone-brand); }
.db-todo.done { opacity: .55; }
.db-todo.done .db-todo-n { background: transparent; color: var(--tone-green); }

/* 系统状态 */
.db-sys { padding: 8px 16px 12px; }
.db-sys-row { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed #efeef5; }
.db-sys-row:last-child { border-bottom: 0; }
.db-sys-ic { width: 32px; height: 32px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; color: var(--c); background: color-mix(in srgb, var(--c) 13%, #fff); }
.db-sys-t { font-size: 13.5px; font-weight: 600; color: #2a2733; }
.db-sys-s { font-size: 12.5px; color: #8a8698; margin-top: 2px; }

/* 最近动态 */
.db-feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 0 22px; padding: 6px 12px 10px; }
.db-feed-i { display: flex; align-items: center; gap: 12px; padding: 11px 8px; border-bottom: 1px solid #f4f3f9; color: #3a3a4a; border-radius: 8px; }
.db-feed-i:hover { background: #f9f8fd; color: #3a3a4a; }
.db-feed-ic { width: 30px; height: 30px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; color: var(--c); background: color-mix(in srgb, var(--c) 13%, #fff); }
.db-feed-b { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.db-feed-t { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-feed-t b { color: #2a2733; margin-left: 4px; }
.db-feed-s { font-size: 12px; color: #9a98ab; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-feed-time { font-size: 12px; color: #a9a7b8; white-space: nowrap; }

@media (max-width: 767.98px) {
    .db-hero { padding: 20px 18px; }
    .db-hero-mark { display: none; }
    .db-hero h2 { font-size: 20px; }
    .db-feed { grid-template-columns: 1fr; }
}

/* flex 行里的按钮不随旁边换行的筛选栏被拉高（未指定 align-items 的容器默认 stretch） */
.d-flex:not([class*="align-items-"]) > .btn,
.d-flex:not([class*="align-items-"]) > .dropdown {
    align-self: flex-start;
}

/* 按钮文字不换行（窄屏时"编辑""新建 SKU"会被挤成两行，按钮变高） */
.btn { white-space: nowrap; }
