/* ==========================================================================
   宝之通增长中台 · 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: #111827;
    --sidebar-light: #0f172a;

    /* 色彩 · 页面 */
    --page-bg: #f8f9fb;
    --surface: #ffffff;
    --surface-soft: #f9fafb;
    --surface-muted: #f1f5f9;
    --surface-border: #e5e7eb;
    --border-strong: #d1d5db;

    /* 色彩 · 文字 */
    --text-main: #111827;
    --text-secondary: #374151;
    --text-muted: #6b7280;
    --text-faint: #9ca3af;

    /* 色彩 · 强调 */
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --accent-pressed: #1e40af;
    --accent-soft: #eff6ff;
    --accent-softer: #f5f8ff;
    --accent-line: #93c5fd;

    /* 色彩 · 语义 */
    --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: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* 阴影 */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);

    /* 焦点环 */
    --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;
}

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);
}
