/* === 智能调价系统 - Excel风格客户端 === */
:root {
    --accent: #1a73e8;
    --accent-light: #e8f0fe;
    --green: #0f9d58;
    --green-light: #e6f4ea;
    --red: #d93025;
    --orange: #f9ab00;
    --border: #e0e0e0;
    --border-light: #f0f0f0;
    --bg: #ffffff;
    --bg-alt: #f8f9fa;
    --bg-header: #f1f3f4;
    --text: #202124;
    --text-secondary: #5f6368;
    --topbar-h: 42px;
    --stats-h: 38px;
    --filter-h: 46px;
    --tabbar-h: 34px;
    --panel-w: 360px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); overflow: hidden; height: 100vh; }

/* === Sticky Header === */
.sticky-header {
    position: sticky; top: 0; z-index: 100; background: var(--bg); flex-shrink: 0;
}
#mainLayout {
    display: flex; flex-direction: column; height: 100vh;
}

/* === 登录页 - 企业级分屏设计 === */
.login-split {
    height: 100vh; display: flex; overflow: hidden;
}

/* 左侧海报 */
.login-poster {
    flex: 1; position: relative; overflow: hidden;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 40%, #0c4a6e 100%);
    display: flex; align-items: center; justify-content: center;
    min-width: 0;
}
.poster-bg-shapes { position: absolute; inset: 0; overflow: hidden; }
.shape {
    position: absolute; border-radius: 50%; opacity: .08;
    background: linear-gradient(135deg, #38bdf8, #818cf8);
}
.shape-1 { width: 500px; height: 500px; top: -120px; left: -100px; animation: float-1 20s ease-in-out infinite; }
.shape-2 { width: 350px; height: 350px; bottom: -80px; right: -60px; animation: float-2 25s ease-in-out infinite; }
.shape-3 { width: 200px; height: 200px; top: 50%; left: 60%; animation: float-3 18s ease-in-out infinite; }
@keyframes float-1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(40px,30px)} }
@keyframes float-2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-30px,-40px)} }
@keyframes float-3 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-20px,25px)} }

.poster-content {
    position: relative; z-index: 2; padding: 60px 48px; max-width: 520px; width: 100%;
    display: flex; flex-direction: column; height: 100%;
    justify-content: center;
}

/* 品牌 */
.brand-icon { margin-bottom: 24px; }
.poster-title {
    font-size: 2.4rem; font-weight: 800; color: #fff; line-height: 1.15;
    letter-spacing: -.5px; margin-bottom: 12px;
}
.poster-subtitle {
    font-size: .95rem; color: rgba(255,255,255,.55); font-weight: 400;
    letter-spacing: .3px; margin-bottom: 48px;
}

/* 功能亮点 */
.poster-features { display: flex; flex-direction: column; gap: 20px; margin-bottom: 48px; }
.feature-item {
    display: flex; align-items: flex-start; gap: 14px;
}
.feature-icon {
    flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px;
    background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.1);
    display: flex; align-items: center; justify-content: center;
    color: #38bdf8;
}
.feature-text { display: flex; flex-direction: column; gap: 2px; padding-top: 2px; }
.feature-text strong { font-size: .88rem; color: #fff; font-weight: 600; }
.feature-text span { font-size: .78rem; color: rgba(255,255,255,.45); }

/* 底部公司 */
.poster-footer { margin-top: auto; padding-top: 32px; border-top: 1px solid rgba(255,255,255,.08); }
.company-name {
    font-size: 1.05rem; font-weight: 700; color: rgba(255,255,255,.85);
    letter-spacing: .5px;
}
.company-tagline { font-size: .78rem; color: rgba(255,255,255,.35); margin-top: 4px; }

/* 右侧登录 */
.login-form-side {
    width: 480px; flex-shrink: 0; background: #fff;
    display: flex; align-items: center; justify-content: center;
    padding: 48px;
}
.login-form-inner { width: 100%; max-width: 360px; }
.login-welcome h2 {
    font-size: 1.6rem; font-weight: 700; color: #111827; margin-bottom: 6px;
}
.login-welcome p {
    font-size: .88rem; color: #9ca3af; margin-bottom: 36px;
}
.form-group { margin-bottom: 20px; }
.form-group .form-label {
    font-size: .82rem; font-weight: 600; color: #374151; margin-bottom: 6px; display: block;
}
.input-wrap {
    position: relative; display: flex; align-items: center;
}
.input-icon {
    position: absolute; left: 14px; color: #9ca3af; pointer-events: none;
}
.login-input {
    width: 100%; padding: 12px 14px 12px 44px; border: 1.5px solid #e5e7eb;
    border-radius: 10px; font-size: .9rem; color: #111827; outline: none;
    transition: border-color .2s, box-shadow .2s; background: #f9fafb;
    font-family: inherit;
}
.login-input:focus {
    border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.1);
    background: #fff;
}
.login-input::placeholder { color: #d1d5db; }
.login-error {
    margin-bottom: 16px; padding: 10px 14px; border-radius: 8px;
    background: #fef2f2; border: 1px solid #fecaca; color: #dc2626;
    font-size: .82rem;
}
.login-submit {
    width: 100%; padding: 13px; border: none; border-radius: 10px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff;
    font-size: .95rem; font-weight: 600; cursor: pointer;
    transition: all .2s; letter-spacing: .3px; font-family: inherit;
}
.login-submit:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    box-shadow: 0 4px 14px rgba(37,99,235,.35);
    transform: translateY(-1px);
}
.login-submit:active { transform: translateY(0); }
.login-footer-text {
    text-align: center; margin-top: 32px;
    font-size: .75rem; color: #d1d5db;
}

/* 响应式：窄屏隐藏海报 */
@media (max-width: 900px) {
    .login-poster { display: none; }
    .login-form-side { width: 100%; }
}

/* === 顶部栏 === */
.topbar {
    height: var(--topbar-h); background: var(--bg); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
    user-select: none;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-weight: 700; font-size: .9rem; color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-btn {
    border: none; background: transparent; cursor: pointer; padding: 4px 10px;
    font-size: .78rem; color: var(--text-secondary); display: flex; align-items: center; gap: 4px;
    border-radius: 4px; transition: background .15s;
}
.topbar-btn:hover { background: var(--bg-alt); color: var(--text); }
.topbar-btn i { font-size: .9rem; }
.topbar-btn.primary { color: var(--accent); font-weight: 600; }
.topbar-user-dropdown { position: relative; }
.topbar-user-btn {
    border: none; background: transparent; cursor: pointer; padding: 4px 10px;
    font-size: .78rem; color: var(--text-secondary); display: flex; align-items: center;
    border-radius: 4px; transition: background .15s;
}
.topbar-user-btn:hover { background: var(--bg-alt); color: var(--text); }
.user-dropdown-menu {
    display: none; position: absolute; top: 100%; right: 0; margin-top: 4px;
    background: #fff; border: 1px solid var(--border); border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,.1); min-width: 140px; z-index: 999;
    overflow: hidden;
}
.user-dropdown-menu.show { display: block; }
.user-dropdown-menu a {
    display: flex; align-items: center; gap: 8px; padding: 9px 14px;
    font-size: .8rem; color: var(--text); text-decoration: none; white-space: nowrap;
}
.user-dropdown-menu a:hover { background: var(--bg-alt); }
.user-dropdown-menu a i { font-size: .9rem; color: var(--text-secondary); }
.topbar-gear {
    border: none; background: transparent; cursor: pointer; padding: 6px;
    font-size: 1.1rem; color: var(--text-secondary); border-radius: 4px; transition: all .15s;
}
.topbar-gear:hover { background: var(--bg-alt); color: var(--text); }

/* === 统计条 === */
.stats-bar {
    height: var(--stats-h); background: var(--bg-alt); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; padding: 0 16px; gap: 4px;
}
.stat-chip {
    display: flex; align-items: center; gap: 5px; padding: 3px 12px; font-size: .76rem;
    border-radius: 4px; cursor: default; color: var(--text-secondary); background: var(--bg);
    border: 1px solid var(--border-light);
}
.stat-chip .val { font-weight: 700; color: var(--text); }
.stat-chip.clickable { cursor: pointer; }
.stat-chip.clickable:hover { border-color: var(--accent); color: var(--accent); }
.stat-chip.accent { background: var(--accent-light); border-color: #c6dafc; }
.stat-chip.accent .val { color: var(--accent); }
.stat-chip.green { background: var(--green-light); border-color: #b7dfca; }
.stat-chip.green .val { color: var(--green); }
.stat-sync { margin-left: auto; font-size: .72rem; color: #999; }
.stat-refresh-btn {
    margin-left: auto; display: flex; align-items: center; gap: 4px;
    padding: 3px 14px; font-size: .76rem; font-weight: 600;
    border: 1px solid var(--accent); border-radius: 4px;
    background: var(--accent); color: #fff; cursor: pointer;
    transition: all .15s;
}
.stat-refresh-btn:hover { background: #2563eb; border-color: #2563eb; }
.stat-refresh-btn:disabled { opacity: .6; cursor: not-allowed; }
.stat-refresh-btn i { font-size: .8rem; }

/* === 筛选栏 === */
.filter-bar {
    height: var(--filter-h); background: var(--bg); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; padding: 0 12px; gap: 6px; overflow-x: auto;
}
.filter-bar select, .filter-bar input[type="text"] {
    height: 28px; font-size: .76rem; border: 1px solid var(--border); border-radius: 4px;
    padding: 0 8px; background: var(--bg); color: var(--text); outline: none;
    transition: border-color .15s;
}
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--accent); }
.filter-bar .filter-active { border-color: var(--accent) !important; box-shadow: 0 0 0 1px var(--accent); }
.filter-bar input[type="text"] { width: 140px; }
.filter-bar select { min-width: 70px; }
.filter-btn {
    border: 1px solid var(--border); background: var(--bg); border-radius: 4px;
    padding: 4px 10px; font-size: .76rem; cursor: pointer; color: var(--text-secondary);
    display: flex; align-items: center; gap: 3px; transition: all .15s; white-space: nowrap;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-sep { width: 1px; height: 20px; background: var(--border-light); margin: 0 2px; }

/* === 数据表格 (Excel风格) === */
.grid-wrap {
    flex: 1; overflow: auto;
}
.grid-table {
    width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .82rem;
}
.grid-table thead { position: sticky; top: 0; z-index: 10; }
.grid-table th {
    background: var(--bg-header); color: var(--text-secondary); font-weight: 600;
    font-size: .73rem; text-transform: uppercase; letter-spacing: .3px;
    padding: 7px 10px; border: 1px solid var(--border); border-top: none;
    cursor: pointer; white-space: nowrap; user-select: none;
}
.grid-table th:hover { background: #e4e7ea; }
.grid-table th .sort-icon { font-size: .6rem; margin-left: 2px; vertical-align: middle; }
.grid-table td {
    padding: 6px 10px; border: 1px solid var(--border-light); border-left: 1px solid var(--border);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.grid-table tbody tr:nth-child(even) td { background: #fafbfc; }
.grid-table tbody tr:hover td { background: #e8f0fe !important; }

/* 列宽 */
.col-sku { width: 200px; }
.col-code { width: 150px; }
.col-price { width: 100px; text-align: right; }
.col-best { width: 58px; text-align: center; }
.col-stock { width: 58px; text-align: center; }
.col-min { width: 100px; text-align: right; }
.col-toggle { width: 52px; text-align: center; }
.col-mode { width: 80px; text-align: center; }

/* 价格样式 */
.price-val { font-variant-numeric: tabular-nums; }
.price-at-min {
    color: #d63031; font-weight: 600; font-size: .82rem;
}
.price-credit-issue {
    color: #e17055; font-weight: 600; font-size: .82rem;
}
.price-tag {
    display: inline-block; font-size: .62rem; padding: 0 4px; border-radius: 2px;
    margin-left: 4px; vertical-align: middle; font-weight: 600; line-height: 1.4;
}
.price-tag.warn { background: #ffeaa7; color: #d35400; }
.price-tag.floor { background: #fab1a0; color: #c0392b; }
.sku-code { font-family: 'JetBrains Mono', 'Fira Code', monospace; color: var(--accent); font-size: .78rem; }
.badge-best { background: var(--green-light); color: var(--green); padding: 2px 8px; border-radius: 3px; font-size: .72rem; font-weight: 600; }
.badge-no { background: #fce4e4; color: var(--red); padding: 2px 8px; border-radius: 3px; font-size: .72rem; font-weight: 600; }
.lock-icon { cursor: pointer; font-size: .8rem; }
.lock-icon.locked { color: var(--orange); }
.lock-icon.unlocked { color: #ccc; }
.min-price-edit { cursor: pointer; text-decoration: underline; text-decoration-style: dashed; text-underline-offset: 2px; }
.min-price-locked {
    background: #fff3e0; padding: 1px 6px; border-radius: 3px; cursor: pointer; font-weight: 600; font-size: .78rem;
}

/* Toggle switch (mini) */
.mini-switch { width: 32px; height: 18px; cursor: pointer; }
.mini-switch:checked { background-color: var(--green); border-color: var(--green); }

/* Mini select */
.mini-select {
    font-size: .74rem; padding: 2px 4px; border: 1px solid var(--border-light); border-radius: 3px;
    background: transparent; outline: none; cursor: pointer;
}
.mini-select:focus { border-color: var(--accent); }

/* === 底部标签栏 (Excel Sheet Tabs) === */
.tab-bar {
    height: var(--tabbar-h); background: #e8eaed; border-bottom: 1px solid var(--border);
    display: flex; align-items: stretch; padding: 0; overflow-x: auto;
    flex-shrink: 0;
}
.tab-bar::-webkit-scrollbar { height: 3px; }
.tab-bar::-webkit-scrollbar-thumb { background: #bbb; border-radius: 2px; }
.sheet-tab {
    display: flex; align-items: center; gap: 4px; padding: 0 16px;
    font-size: .76rem; color: var(--text-secondary); cursor: pointer;
    border-right: 1px solid #d0d3d6; background: transparent;
    white-space: nowrap; user-select: none; transition: all .1s;
    border: none;
}
.sheet-tab:hover { background: rgba(255,255,255,.5); }
.sheet-tab.active {
    background: var(--bg); color: var(--text); font-weight: 600;
    border-bottom: 2px solid var(--green);
    box-shadow: 1px 0 0 var(--border);
}
.sheet-tab .platform-tag {
    font-size: .72rem; font-weight: 700; padding: 2px 5px; border-radius: 3px;
    letter-spacing: .3px; line-height: 1;
}
.platform-tag.cd { background: #bfdbfe; color: #1e3a8a; border: 1px solid #93c5fd; }
.platform-tag.bm { background: #1f2937; color: #f9fafb; border: 1px solid #374151; }
.platform-tag.pc { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.platform-tag.cf { background: #fecdd3; color: #9f1239; border: 1px solid #fda4af; }

/* 分页条 */
.paging-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 16px; background: var(--bg-alt); border-top: 1px solid var(--border-light);
    font-size: .76rem; color: var(--text-secondary);
}
.paging-bar button {
    border: 1px solid var(--border); background: var(--bg); border-radius: 3px;
    padding: 2px 8px; cursor: pointer; font-size: .76rem;
}
.paging-bar button:hover { border-color: var(--accent); color: var(--accent); }
.paging-bar button:disabled { opacity: .4; cursor: default; }

/* === 右侧面板 (Slide Panel) === */
.panel-overlay {
    position: fixed; top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(0,0,0,.15); z-index: 900; display: none;
}
.panel-overlay.show { display: block; }
.side-panel {
    position: fixed; top: 0; right: 0; bottom: 0; width: var(--panel-w);
    background: var(--bg); z-index: 950; box-shadow: -4px 0 20px rgba(0,0,0,.1);
    display: flex; flex-direction: column; transition: transform .25s ease;
    transform: translateX(100%);
}
.side-panel.show { transform: translateX(0); }

.panel-header {
    height: 48px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.panel-header h6 { font-weight: 700; font-size: .92rem; margin: 0; }
.panel-close { border: none; background: transparent; font-size: 1.1rem; cursor: pointer; color: #999; padding: 4px; }
.panel-close:hover { color: #333; }
.panel-tabs {
    display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; overflow-x: auto;
}
.panel-tab {
    padding: 10px 14px; font-size: .76rem; color: var(--text-secondary); cursor: pointer;
    border-bottom: 2px solid transparent; white-space: nowrap; background: transparent; border-top: none; border-left: none; border-right: none;
}
.panel-tab:hover { color: var(--text); }
.panel-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.panel-body { flex: 1; overflow-y: auto; padding: 16px; }

/* Panel内表格 */
.panel-table { width: 100%; font-size: .78rem; border-collapse: collapse; }
.panel-table th { background: var(--bg-alt); font-size: .7rem; padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border); }
.panel-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-light); }
.panel-table tr:hover td { background: var(--bg-alt); }

/* Panel内表单 */
.panel-form .form-label { font-size: .78rem; font-weight: 600; color: #555; }
.panel-form .form-control { font-size: .82rem; }
.panel-form .form-check-label { font-size: .82rem; }

/* Status badges */
.status-pending { background: #fff3cd; color: #856404; padding: 2px 6px; border-radius: 3px; font-size: .7rem; }
.status-approved { background: #d4edda; color: #155724; padding: 2px 6px; border-radius: 3px; font-size: .7rem; }
.status-rejected { background: #f8d7da; color: #721c24; padding: 2px 6px; border-radius: 3px; font-size: .7rem; }
.status-applied { background: #cce5ff; color: #004085; padding: 2px 6px; border-radius: 3px; font-size: .7rem; }
.status-blocked { background: #e2e3e5; color: #383d41; padding: 2px 6px; border-radius: 3px; font-size: .7rem; }

/* === Loading / Empty === */
.loading-msg { text-align: center; padding: 40px; color: #999; }
.spinner { width: 28px; height: 28px; border: 3px solid #eee; border-top-color: var(--accent); border-radius: 50%; animation: spin .6s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-msg { text-align: center; padding: 60px 20px; color: #bbb; font-size: .85rem; }

/* === 批量修改 Modal === */
.modal-header { border-bottom: 1px solid var(--border-light); }
.modal-footer { border-top: 1px solid var(--border-light); }
.modal-title { font-weight: 700; }

/* scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* === 启用/禁用确认弹窗 === */
.toggle-confirm-info { font-size: .85rem; }
.confirm-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 0; border-bottom: 1px solid #f0f0f0;
}
.confirm-row:last-child { border-bottom: none; }
.confirm-label { color: #888; font-size: .8rem; }
.confirm-val { font-weight: 600; color: var(--text); }
.confirm-val code { background: #f5f5f5; padding: 1px 6px; border-radius: 3px; font-size: .78rem; }
.confirm-warning {
    margin-top: 10px; padding: 8px 12px; border-radius: 6px;
    background: #fff5f5; border: 1px solid #fecaca; color: #dc2626;
    font-size: .8rem; line-height: 1.4;
}
.confirm-warning i { margin-right: 4px; }
