/* ===================== Reset & Base ===================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
    color: #1e293b;
    background: #f8fafc;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input, textarea, select { font-family: inherit; font-size: 14px; outline: none; }

/* ===================== Variables ===================== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-hover: #f0f7ff;
    --accent: #f59e0b;
    --accent-dark: #d97706;
    --accent-light: #fffbeb;
    --success: #10b981;
    --success-light: #ecfdf5;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --warning-lighter: #fffbeb;
    --warning-dark: #92400e;
    --info: #3b82f6;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --sidebar-w: 240px;
    --topbar-h: 60px;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, .06), 0 2px 4px -2px rgba(15, 23, 42, .04);
    --shadow-lg: 0 10px 25px -3px rgba(15, 23, 42, .08), 0 4px 6px -4px rgba(15, 23, 42, .04);
    --transition: .18s cubic-bezier(.4, 0, .2, 1);
}

/* ===================== Layout ===================== */
.app { display: flex; height: 100vh; }

/* ===================== Sidebar ===================== */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 100;
    box-shadow: 1px 0 0 rgba(255,255,255,.04);
}
.sidebar-header {
    padding: 24px 20px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-header .logo {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, .3);
    flex-shrink: 0;
}
.sidebar-header h1 {
    font-size: 17px;
    color: #fff;
    font-weight: 700;
    letter-spacing: -.3px;
    line-height: 1.2;
}
.sidebar-header p {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
    letter-spacing: .5px;
}
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }
.nav-section-label {
    font-size: 11px; font-weight: 600; color: rgba(255,255,255,.3);
    text-transform: uppercase; letter-spacing: 1px;
    padding: 14px 14px 4px; margin-top: 4px;
}
.nav-section-label:first-child { margin-top: 0; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, .35);
}
.nav-icon { font-size: 17px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    font-weight: 600;
    line-height: 1.4;
}
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,.06); }
.storage-info {
    padding: 10px 14px;
    margin-bottom: 4px;
    background: rgba(255,255,255,.04);
    border-radius: 8px;
}
.storage-bar {
    height: 3px;
    background: rgba(255,255,255,.08);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}
.storage-fill { height: 100%; background: var(--primary); width: 100%; transition: width .3s; border-radius: 2px; }
.storage-text { font-size: 11px; color: #94a3b8; display: flex; align-items: center; gap: 6px; }
.storage-text.cloud { color: #34d399; }

/* ===================== Main Content ===================== */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ===================== Topbar ===================== */
.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    gap: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.page-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.page-title-en {
    font-size: 12px;
    color: var(--gray-400);
    font-weight: 400;
    margin-left: 4px;
}
.topbar-date { font-size: 13px; color: var(--gray-500); white-space: nowrap; }
.search-box { position: relative; }
.search-box input {
    width: 260px;
    padding: 7px 14px 7px 34px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 13px;
    transition: all var(--transition);
    background: var(--gray-50);
}
.search-box::before {
    content: '🔍';
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    opacity: .5;
    pointer-events: none;
}
.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: #fff;
}

/* ===================== Buttons ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
    border: 1px solid transparent;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,.3); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(245,158,11,.3); }
.btn-default { background: #fff; color: var(--gray-700); border-color: var(--gray-200); }
.btn-default:hover { background: var(--gray-50); border-color: var(--gray-300); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 14px; }
.btn-icon { padding: 6px 8px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ===================== Page Content ===================== */
.page-content { flex: 1; overflow-y: auto; padding: 24px; }
.page-content::-webkit-scrollbar { width: 8px; }
.page-content::-webkit-scrollbar-track { background: transparent; }
.page-content::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }
.page-content::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ===================== 单证系统 iframe ===================== */
.trade-docs-frame-wrap {
    position: relative; height: calc(100vh - 120px);
    margin: -24px; background: #fff; border-radius: 0;
}
.trade-docs-frame {
    width: 100%; height: 100%; border: none; display: block;
}
.trade-docs-loading {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; background: #f8fafc;
    z-index: 1; transition: opacity .3s;
}
.trade-docs-loading .empty-illustration { font-size: 48px; }
.trade-docs-loading h3 { color: var(--gray-500); }


/* ===================== Dashboard ===================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    margin-bottom: 12px;
}
.stat-card .stat-icon.bg-blue { background: var(--primary-light); color: var(--primary); }
.stat-card .stat-icon.bg-green { background: var(--success-light); color: var(--success); }
.stat-card .stat-icon.bg-orange { background: var(--accent-light); color: var(--accent); }
.stat-card .stat-icon.bg-red { background: var(--danger-light); color: var(--danger); }
.stat-card .stat-label { font-size: 13px; color: var(--gray-500); }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--gray-800); margin-top: 4px; line-height: 1.2; }
.stat-card .stat-sub { font-size: 12px; color: var(--gray-400); margin-top: 4px; }
.stat-card.highlight-blue { border-top: 3px solid var(--primary); }
.stat-card.highlight-green { border-top: 3px solid var(--success); }
.stat-card.highlight-orange { border-top: 3px solid var(--accent); }
.stat-card.highlight-red { border-top: 3px solid var(--danger); }
.stat-card.highlight-blue .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-card.highlight-green .stat-icon { background: var(--success-light); color: var(--success); }
.stat-card.highlight-orange .stat-icon { background: var(--accent-light); color: var(--accent); }
.stat-card.highlight-red .stat-icon { background: var(--danger-light); color: var(--danger); }

/* Dashboard empty state (inside cards) */
.dashboard-empty {
    text-align: center;
    padding: 32px 20px;
    color: var(--gray-400);
}
.dashboard-empty .de-icon {
    font-size: 36px;
    margin-bottom: 8px;
    opacity: .6;
}
.dashboard-empty p { font-size: 13px; }

/* Dashboard welcome (first-time user) */
.dashboard-welcome { max-width: 820px; margin: 0 auto; }
.welcome-hero {
    text-align: center;
    padding: 48px 32px 40px;
    background: linear-gradient(135deg, #fff 0%, var(--primary-light) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-100);
    margin-bottom: 24px;
}
.welcome-hero .welcome-icon {
    font-size: 56px;
    margin-bottom: 16px;
}
.welcome-hero h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 10px;
}
.welcome-hero p {
    font-size: 14px;
    color: var(--gray-500);
    line-height: 1.8;
    margin-bottom: 24px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}
.welcome-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.welcome-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.welcome-feature {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    border: 1px solid var(--gray-100);
    box-shadow: var(--shadow);
    text-align: center;
    transition: all var(--transition);
}
.welcome-feature:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.welcome-feature .wf-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    margin: 0 auto 14px;
}
.welcome-feature h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 6px;
}
.welcome-feature p {
    font-size: 13px;
    color: var(--gray-500);
    line-height: 1.6;
}

.dashboard-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.dashboard-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
}
.dashboard-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: var(--gray-800); display: flex; align-items: center; gap: 6px; }

/* Source distribution */
.source-list { display: flex; flex-direction: column; gap: 12px; }
.source-item { display: flex; align-items: center; gap: 12px; }
.source-item .source-label { width: 90px; font-size: 13px; color: var(--gray-600); }
.source-item .source-bar { flex: 1; height: 24px; background: var(--gray-100); border-radius: 6px; overflow: hidden; position: relative; }
.source-item .source-fill { height: 100%; border-radius: 6px; transition: width .5s; display: flex; align-items: center; padding: 0 10px; color: #fff; font-size: 12px; font-weight: 600; min-width: 32px; }
.source-fill.s-whatsapp { background: #25d366; }
.source-fill.s-form { background: var(--primary); }
.source-fill.s-self { background: var(--accent); }
.source-fill.s-referral { background: #8b5cf6; }
.source-fill.s-other { background: var(--gray-400); }

/* Follow-up reminders */
.reminder-list { display: flex; flex-direction: column; gap: 8px; }
.reminder-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--gray-50);
    border-left: 3px solid transparent;
    transition: all var(--transition);
    cursor: pointer;
}
.reminder-item:hover { background: var(--gray-100); transform: translateX(2px); }
.reminder-item.overdue { border-left-color: var(--danger); }
.reminder-item.today { border-left-color: var(--warning); }
.reminder-item.upcoming { border-left-color: var(--info); }
.reminder-item .reminder-info { flex: 1; min-width: 0; }
.reminder-item .reminder-name { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.reminder-item .reminder-note { font-size: 12px; color: var(--gray-400); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reminder-item .reminder-date { font-size: 12px; color: var(--gray-500); white-space: nowrap; }
.reminder-item .reminder-date.overdue { color: var(--danger); font-weight: 600; }

/* Recent activity */
.activity-list { display: flex; flex-direction: column; gap: 10px; }
.activity-item { display: flex; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--gray-100); }
.activity-item:last-child { border-bottom: none; padding-bottom: 0; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.activity-dot.stage-lead { background: #3b82f6; }
.activity-dot.stage-quote { background: #f59e0b; }
.activity-dot.stage-sample { background: #8b5cf6; }
.activity-dot.stage-negotiate { background: #ec4899; }
.activity-dot.stage-order { background: #10b981; }
.activity-dot.stage-after { background: #6b7280; }
.activity-info { flex: 1; min-width: 0; }
.activity-name { font-size: 13px; font-weight: 600; }
.activity-desc { font-size: 12px; color: var(--gray-500); margin-top: 1px; }
.activity-time { font-size: 11px; color: var(--gray-400); white-space: nowrap; }

/* ===================== Customer List ===================== */
.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}
.page-toolbar-left { display: flex; align-items: center; gap: 8px; }
.page-toolbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.customer-filters { display: flex; gap: 8px; align-items: center; }
.filter-select {
    padding: 6px 28px 6px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 13px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='%2364748b'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E") no-repeat right 8px center;
    background-size: 14px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    color: var(--gray-700);
    transition: all var(--transition);
}
.filter-select:hover { border-color: var(--gray-300); }
.filter-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.customer-count { font-size: 13px; color: var(--gray-500); }
.customer-count b { color: var(--gray-800); font-weight: 600; }

.customer-table {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    overflow: hidden;
}
.customer-table table { width: 100%; border-collapse: collapse; }
.customer-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .5px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}
.customer-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
    vertical-align: middle;
}
.customer-table tr:last-child td { border-bottom: none; }
.customer-table tbody tr { transition: background .15s; cursor: pointer; }
.customer-table tbody tr:hover { background: var(--gray-50); }

.customer-name-cell { font-weight: 600; color: var(--gray-800); }
.customer-name-cell .company-name { font-size: 12px; color: var(--gray-400); font-weight: 400; margin-top: 2px; }

/* Tags */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 4px;
}
.tag-source-whatsapp { background: #d1fae5; color: #065f46; }
.tag-source-form { background: #dbeafe; color: #1e40af; }
.tag-source-self { background: #fef3c7; color: #92400e; }
.tag-source-referral { background: #ede9fe; color: #5b21b6; }
.tag-source-other { background: var(--gray-100); color: var(--gray-600); }

/* Stage badges */
.stage-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.stage-lead { background: #dbeafe; color: #1e40af; }
.stage-quote { background: #fef3c7; color: #92400e; }
.stage-sample { background: #ede9fe; color: #5b21b6; }
.stage-negotiate { background: #fce7f3; color: #9f1239; }
.stage-order { background: #d1fae5; color: #065f46; }
.stage-after { background: var(--gray-100); color: var(--gray-600); }
.stage-lost { background: #fee2e2; color: #991b1b; }

/* ===================== Pipeline (Kanban) ===================== */
.pipeline-board {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    min-height: calc(100vh - var(--topbar-h) - 48px);
}
.pipeline-board::-webkit-scrollbar { height: 8px; }
.pipeline-board::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }
.pipeline-column {
    flex: 0 0 280px;
    background: var(--gray-100);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--topbar-h) - 48px);
}
.pipeline-column-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid transparent;
}
.pipeline-column-header.stage-lead { border-bottom-color: #3b82f6; }
.pipeline-column-header.stage-quote { border-bottom-color: #f59e0b; }
.pipeline-column-header.stage-sample { border-bottom-color: #8b5cf6; }
.pipeline-column-header.stage-negotiate { border-bottom-color: #ec4899; }
.pipeline-column-header.stage-order { border-bottom-color: #10b981; }
.pipeline-column-header.stage-after { border-bottom-color: #6b7280; }
.pipeline-column-header.stage-lost { border-bottom-color: #ef4444; }

.pipeline-column-title { font-size: 13px; font-weight: 700; color: var(--gray-800); display: flex; align-items: center; gap: 6px; }
.pipeline-column-count { font-size: 11px; color: var(--gray-500); background: #fff; padding: 1px 8px; border-radius: 10px; font-weight: 600; }

.pipeline-cards { flex: 1; padding: 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }

.pipeline-card {
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    border: 1px solid var(--gray-200);
    transition: all var(--transition);
}
.pipeline-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--gray-300); }
.pipeline-card.dragging { opacity: .4; transform: rotate(2deg) scale(.95); border: 2px dashed var(--primary); }
.pipeline-card .card-name { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.pipeline-card .card-name:hover { color: var(--primary); text-decoration: underline; }
.pipeline-card .card-company { font-size: 12px; color: var(--gray-400); margin-top: 2px; }
.pipeline-card .card-company:hover { color: var(--primary); }
.pipeline-card .card-meta { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.pipeline-card .card-product { font-size: 12px; color: var(--gray-500); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pipeline-card .card-date { font-size: 11px; color: var(--gray-400); margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.pipeline-card .card-date.overdue { color: var(--danger); font-weight: 600; }
.pipeline-card .card-actions { display: flex; gap: 4px; margin-top: 6px; }
.pipeline-card .card-stage-select { margin-top: 6px; }
.pipeline-card .card-stage-select select {
    width: 100%; font-size: 11px; padding: 3px 6px; border: 1px solid var(--gray-200);
    border-radius: 4px; background: var(--gray-50); color: var(--gray-600); cursor: pointer;
}
.pipeline-card .card-stage-select select:hover { border-color: var(--primary); background: #fff; }

/* 拖拽放置区视觉反馈 */
.pipeline-drop-hint {
    display: none; text-align: center; padding: 10px; font-size: 12px;
    color: var(--primary); font-weight: 600; border-top: 2px dashed transparent;
}
.pipeline-column.drag-over {
    background: #dbeafe !important;
    border: 2px dashed var(--primary);
    border-radius: var(--radius-lg);
}
.pipeline-column.drag-over .pipeline-drop-hint {
    display: block; border-top: 2px dashed var(--primary);
    background: #eff6ff;
}
.pipeline-column.drag-over .pipeline-cards {
    background: #eff6ff;
}

/* ===================== Follow-ups ===================== */
.followup-list { display: flex; flex-direction: column; gap: 12px; }
.followup-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    overflow: hidden;
    transition: all var(--transition);
}
.followup-card:hover { box-shadow: var(--shadow-md); }
.followup-card-header {
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-100);
}
.followup-card-header .fc-name { font-size: 15px; font-weight: 700; }
.followup-card-header .fc-stage { display: flex; align-items: center; gap: 8px; }
.followup-card-body { padding: 14px 18px; }

.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--gray-200); }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--gray-300);
}
.timeline-item .tl-date { font-size: 12px; color: var(--gray-400); }
.timeline-item .tl-content { font-size: 13px; color: var(--gray-700); margin-top: 2px; }
.timeline-item .tl-next { font-size: 12px; color: var(--accent-dark); margin-top: 4px; background: var(--accent-light); padding: 4px 8px; border-radius: 4px; display: inline-block; }
.timeline-item .tl-actions { margin-top: 6px; display: flex; gap: 6px; }

.dormant-section { margin-top: 24px; }
.dormant-section h3 { font-size: 15px; color: var(--danger); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.dormant-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.dormant-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 14px;
    border: 1px solid var(--gray-200);
    border-left: 3px solid var(--danger);
    transition: all var(--transition);
}
.dormant-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.dormant-card .dc-name { font-size: 14px; font-weight: 600; }
.dormant-card .dc-info { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.dormant-card .dc-days { font-size: 13px; color: var(--danger); font-weight: 600; margin-top: 6px; }

/* ===================== Forms ===================== */
.form-section { margin-bottom: 24px; }
.form-section-title { font-size: 14px; font-weight: 600; color: var(--gray-800); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--gray-200); }
.form-row { display: flex; gap: 16px; margin-bottom: 12px; }
.form-row.cols-2 > * { flex: 1; }
.form-row.cols-3 > * { flex: 1; }
.form-field { flex: 1; }
.form-field label { display: block; font-size: 12px; font-weight: 600; color: var(--gray-600); margin-bottom: 6px; }
.form-field label .label-en { font-weight: 400; color: var(--gray-400); }
.form-field input, .form-field textarea, .form-field select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 13px;
    transition: all var(--transition);
    background: #fff;
}
.form-field input:focus, .form-field textarea:focus, .form-field select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.form-field textarea { resize: vertical; min-height: 70px; }
.form-field .field-hint { font-size: 11px; color: var(--gray-400); margin-top: 4px; }
.form-field .parsed-highlight { background: var(--accent-light); border-color: var(--accent); }

/* ===================== Smart Input ===================== */
.smart-input-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--gray-200); }
.tab-btn {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--transition);
}
.tab-btn:hover { color: var(--gray-700); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.form-hint {
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 12px;
    padding: 10px 14px;
    background: var(--primary-light);
    border-radius: 6px;
    border-left: 3px solid var(--primary);
}

.paste-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    min-height: 140px;
    margin-bottom: 12px;
    transition: all var(--transition);
}
.paste-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 48px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--gray-50);
}
.upload-area:hover, .upload-area.dragover { border-color: var(--primary); background: var(--primary-light); }
.upload-icon { font-size: 48px; margin-bottom: 8px; }
.upload-area p { margin-top: 8px; font-size: 14px; color: var(--gray-700); }
.upload-hint { font-size: 12px !important; color: var(--gray-400) !important; margin-top: 4px !important; }

.ocr-progress { margin: 16px 0; }
.ocr-progress-bar { height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.ocr-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary) 0%, #60a5fa 100%); width: 0%; transition: width .3s; }
#ocrProgressText { font-size: 13px; color: var(--gray-500); }

.ocr-preview { margin-top: 16px; }
.ocr-preview-img { max-width: 100%; max-height: 200px; border-radius: 6px; border: 1px solid var(--gray-200); margin-bottom: 10px; }

.parsed-result { margin-top: 24px; border-top: 2px solid var(--accent); padding-top: 20px; }
.parsed-result-title { font-size: 15px; font-weight: 700; color: var(--success); margin-bottom: 14px; display: flex; align-items: center; gap: 6px; }

/* ===================== Modal ===================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-overlay.show { display: flex; }
.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalIn .25s cubic-bezier(.4, 0, .2, 1);
}
@keyframes modalIn { from { opacity: 0; transform: scale(.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-lg { max-width: 800px; }
.modal-header {
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-100);
}
.modal-header h2 { font-size: 17px; font-weight: 600; color: var(--gray-800); }
.modal-close {
    width: 28px; height: 28px;
    font-size: 20px;
    color: var(--gray-400);
    background: none;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
    transition: all var(--transition);
}
.modal-close:hover { color: var(--gray-700); background: var(--gray-100); }
.modal-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.modal-footer { padding: 14px 24px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--gray-100); background: var(--gray-50); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ===================== Toast ===================== */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    box-shadow: var(--shadow-lg);
    animation: toastIn .3s ease;
    max-width: 360px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ===================== Empty State ===================== */
.empty-state {
    text-align: center;
    padding: 80px 24px;
    color: var(--gray-500);
    background: #fff;
    border-radius: var(--radius-lg);
    border: 2px dashed var(--gray-200);
}
.empty-state .empty-illustration {
    width: 120px; height: 120px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, var(--primary-light) 0%, #f0f9ff 100%);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 56px;
    box-shadow: 0 8px 24px rgba(37, 99, 235, .08);
}
.empty-state h3 { font-size: 18px; color: var(--gray-800); margin-bottom: 8px; font-weight: 600; }
.empty-state p { font-size: 14px; color: var(--gray-500); margin-bottom: 24px; max-width: 360px; margin-left: auto; margin-right: auto; line-height: 1.6; }
.empty-state .empty-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.empty-state .empty-tip {
    margin-top: 20px;
    font-size: 12px;
    color: var(--gray-400);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* ===================== Customer Detail ===================== */
.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}
.detail-header h2 { font-size: 20px; }
.detail-header .detail-company { font-size: 14px; color: var(--gray-500); margin-top: 2px; }
.detail-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.detail-info-item { padding: 12px 14px; background: #fff; border-radius: 6px; border: 1px solid var(--gray-200); }
.detail-info-item .di-label { font-size: 11px; color: var(--gray-400); text-transform: uppercase; letter-spacing: .5px; }
.detail-info-item .di-value { font-size: 14px; color: var(--gray-800); margin-top: 4px; word-break: break-all; }
.detail-info-item .di-value a { color: var(--primary); }

/* ===================== Responsive ===================== */
@media (max-width: 900px) {
    .dashboard-grid { grid-template-columns: 1fr 1fr; }
    .dashboard-row { grid-template-columns: 1fr; }
    .detail-info-grid { grid-template-columns: 1fr; }
    .search-box input { width: 180px; }
    .welcome-features { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .sidebar { width: 64px; }
    .sidebar-header { padding: 16px 12px; justify-content: center; }
    .sidebar-header .logo { margin: 0; }
    .sidebar-header h1, .sidebar-header p, .nav-text, .storage-info, .nav-badge { display: none; }
    .nav-item { justify-content: center; padding: 10px; }
    .page-content { padding: 16px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .topbar { padding: 0 12px; }
    .page-title { font-size: 14px; }
    .search-box { display: none; }
    .topbar-date { display: none; }
}

/* ===================== Login Screen ===================== */
.login-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
}
.login-screen.show {
    opacity: 1;
    pointer-events: auto;
}
.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 48px 40px;
    width: 380px;
    max-width: 90vw;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .15);
    text-align: center;
    animation: loginCardIn .4s cubic-bezier(.4, 0, .2, 1);
}
@keyframes loginCardIn {
    from { opacity: 0; transform: translateY(20px) scale(.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-logo {
    width: 72px; height: 72px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
    border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 36px;
    box-shadow: 0 8px 24px rgba(37, 99, 235, .25);
}
.login-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}
.login-subtitle {
    font-size: 14px;
    color: var(--gray-400);
    margin-bottom: 32px;
}
.login-form {
    text-align: left;
}
.login-field {
    margin-bottom: 18px;
}
.login-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
}
.login-field input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 14px;
    transition: border-color .2s, box-shadow .2s;
    background: var(--gray-50);
}
.login-field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
    background: #fff;
}
.login-error {
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 12px;
    min-height: 18px;
    text-align: left;
}
.btn-login {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
    color: #fff;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 2px;
    transition: transform .15s, box-shadow .2s;
    margin-top: 4px;
}
.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, .3);
}
.btn-login:active {
    transform: translateY(0);
}
.login-switch {
    display: block;
    text-align: center;
    margin-top: 18px;
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    transition: opacity .2s;
}
.login-switch:hover {
    opacity: .7;
}
.login-hint {
    margin-top: 16px;
    padding: 12px;
    background: var(--success-light);
    color: var(--success);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}

/* ===================== User Info in Sidebar ===================== */
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: var(--gray-50);
    border-radius: 8px;
    font-size: 12px;
}
.user-avatar {
    font-size: 16px;
}
.user-email {
    color: var(--gray-600);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* ===================== Trade Orders (单证系统关联订单) ===================== */
.trade-orders-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.trade-order-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 12px 16px;
    transition: var(--transition);
}

.trade-order-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.trade-order-done {
    opacity: .65;
    background: var(--gray-50);
}

.trade-order-done:hover {
    opacity: 1;
}

.trade-order-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.trade-order-no {
    font-weight: 700;
    font-size: 14px;
    color: var(--primary);
}

.trade-order-date {
    font-size: 12px;
    color: var(--gray-400);
}

.trade-order-meta {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.trade-tag {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--gray-100);
    color: var(--gray-600);
}

.trade-tag-amount {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
}

.trade-tag-status {
    background: var(--accent-light);
    color: var(--accent-dark);
}

/* 进度条 */
.trade-progress {
    position: relative;
    height: 24px;
    margin: 6px 0 2px;
}

.trade-dots {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 2;
}

.trade-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--gray-300);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: transparent;
    flex-shrink: 0;
    transition: var(--transition);
}

.trade-dot-done {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.trade-dot-current {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, .2);
    animation: trade-pulse 1.8s infinite;
}

@keyframes trade-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(245, 158, 11, .2); }
    50% { box-shadow: 0 0 0 8px rgba(245, 158, 11, .06); }
}

.trade-line {
    position: absolute;
    top: 50%;
    left: 10px;
    right: 10px;
    height: 2px;
    background: var(--gray-200);
    transform: translateY(-50%);
    z-index: 1;
}

.trade-line-fill {
    position: absolute;
    top: 50%;
    left: 10px;
    height: 2px;
    background: var(--success);
    transform: translateY(-50%);
    z-index: 1;
    transition: width .4s ease;
    max-width: calc(100% - 20px);
}

.trade-step-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.trade-step-label {
    font-size: 10px;
    color: var(--gray-400);
    text-align: center;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trade-step-label.current {
    color: var(--accent);
    font-weight: 700;
}

@media (max-width: 768px) {
    .trade-step-labels { display: none; }
}

/* ===================== 账号管理 ===================== */
.btn-ghost {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
    cursor: pointer;
}
.btn-ghost:hover { background: var(--gray-50); }

.user-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--primary-light, #eff6ff);
    color: var(--primary);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.user-admin-badge {
    display: inline-block;
    padding: 1px 6px;
    background: rgba(255,255,255,.15);
    color: #fff;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 4px;
}

.admin-user-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.admin-user-table th {
    text-align: left;
    padding: 8px 10px;
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
    font-weight: 600;
    color: var(--gray-600);
    font-size: 12px;
    white-space: nowrap;
}
.admin-user-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}
.admin-user-table tr:hover td { background: var(--gray-50); }

.admin-actions {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
}
.admin-actions .btn-sm { padding: 3px 8px; font-size: 11px; }
