/* ==========================================================================
   宝之通增长中台 · base.css — 设计 tokens / reset / 排版基础
   --------------------------------------------------------------------------
   设计原则:
   - 克制、专业、信息密度优先;不用大渐变、不用阴影堆叠。
   - 主色 blue (#2563eb),用于强调与状态;辅以中性灰/足够对比背景。
   - 8 倍数间距体系;统一圆角 6/8/10;字体大小 12/13/14/16/18。
   - 所有 class 名保留以兼容现有模板。
   ========================================================================== */

/* ----- Design Tokens ----- */
:root {
    /* 布局 */
    --sidebar-width: 240px;
    --topbar-height: 56px;

    /* 色彩 · 侧栏（深蓝黑，比纯灰黑更有品牌气质） */
    --sidebar-bg: #0d1426;
    --sidebar-light: #0a101f;

    /* 色彩 · 页面 */
    --page-bg: #f3f5fa;
    --surface: #ffffff;
    --surface-soft: #f8fafd;
    --surface-muted: #eef2f7;
    --surface-border: #e4e9f1;
    --border-strong: #cbd5e1;

    /* 色彩 · 文字 */
    --text-main: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-faint: #94a3b8;

    /* 色彩 · 强调（蓝→靛渐变品牌体系） */
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --accent-pressed: #1e40af;
    --accent-soft: #eff4ff;
    --accent-softer: #f6f9ff;
    --accent-line: #93c5fd;
    --brand-grad-from: #2563eb;
    --brand-grad-to: #4f46e5;
    --brand-gradient: linear-gradient(135deg, var(--brand-grad-from), var(--brand-grad-to));

    /* 色彩 · 语义 */
    --success: #059669;
    --success-dark: #047857;
    --success-darker: #065f46;
    --success-soft: #ecfdf5;
    --warning: #d97706;
    --warning-dark: #92400e;
    --warning-soft: #fffbeb;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --danger-light: #fca5a5;
    --danger-pressed: #991b1b;
    --info: #2563eb;
    --info-soft: #eff6ff;

    /* 间距 (4px 基数) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;

    /* 控件 */
    --control-height: 36px;
    --control-height-sm: 32px;
    --content-max-width: 1440px;

    /* 字号 */
    --fs-xs: 0.75rem;    /* 12px */
    --fs-sm: 0.8125rem;  /* 13px */
    --fs-base: 0.875rem; /* 14px */
    --fs-lg: 1rem;       /* 16px */
    --fs-xl: 1.125rem;   /* 18px */

    /* 行高 */
    --lh-tight: 1.35;
    --lh-base: 1.5;
    --lh-relaxed: 1.65;

    /* 动效 */
    --motion-fast: 100ms;
    --motion-base: 150ms;
    --motion-slow: 250ms;
    --easing: cubic-bezier(0.4, 0, 0.2, 1);

    /* 层级 */
    --z-base: 1;
    --z-sticky: 100;
    --z-overlay: 1000;
    --z-modal: 1050;
    --z-toast: 9000;

    /* 圆角 */
    --radius-xs: 5px;
    --radius-sm: 7px;
    --radius-md: 10px;
    --radius-lg: 14px;

    /* 阴影（冷调多层柔影，卡片浮起感更自然） */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 2px 8px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 2px 4px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 4px 8px rgba(15, 23, 42, 0.05), 0 16px 48px rgba(15, 23, 42, 0.14);
    --shadow-brand: 0 4px 14px rgba(37, 99, 235, 0.32);

    /* 焦点环 */
    --shadow-focus: 0 0 0 3px rgba(37, 99, 235, 0.2);

    /* 客户等级色 */
    --grade-a: var(--danger);
    --grade-b: var(--warning);
    --grade-c: var(--accent);
    --grade-x: #6b7280;

    /* 响应式断点 (与 Bootstrap 5 对齐) */
    --bp-sm: 480px;
    --bp-md: 768px;
    --bp-lg: 992px;
    --bp-xl: 1200px;
}

/* ----- Reset ----- */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Microsoft YaHei", "Helvetica Neue", sans-serif;
    font-size: var(--fs-base);
    line-height: var(--lh-base);
    color: var(--text-main);
    background: var(--page-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 数字默认等宽对齐：金额/计数列上下行数字纵向对齐，商务报表质感 */
body { font-variant-numeric: tabular-nums; }

a {
    color: var(--accent);
    text-decoration: none;
    text-underline-offset: 2px;
    transition: color var(--motion-fast) var(--easing);
}
a:hover { color: var(--accent-dark); }

/* ----- 滚动条 ----- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ----- 文本选中色 ----- */
::selection { background: var(--accent-soft); color: var(--accent-pressed); }
::-moz-selection { background: var(--accent-soft); color: var(--accent-pressed); }

/* ----- 焦点可见性 (无障碍) ----- */
:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
}

/* ----- 减少动效偏好 ----- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ----- CRM 工作区 design tokens（原 crm-tokens.css，合并减少请求数）----- */
:root {
    --crm-row-height: 44px;
    --crm-chip-height: 28px;
    --crm-toolbar-gap: 10px;
    --crm-shell-gap: 12px;
    --crm-flash-success-bg: var(--success-soft);
    --crm-flash-warning-bg: var(--warning-soft);
    --crm-inline-hint-bg: rgba(37, 99, 235, 0.06);
}
