﻿/* ============ 上和中梁客户管理系统 全局样式 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif; background: #f0f2f5; color: #333; font-size: 14px; }
a { color: #2b6cb0; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- 顶部导航 ---- */
.navbar { background: #1a3a5c; color: #fff; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.navbar .inner { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; padding: 0 16px; height: 56px; }
.navbar .logo { font-size: 17px; font-weight: 700; margin-right: 28px; white-space: nowrap; }
.navbar .logo span { color: #7fb8e8; }
.navbar nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.navbar nav a { color: #cfe0f0; padding: 6px 12px; border-radius: 6px; white-space: nowrap; font-size: 14px; }
.navbar nav a:hover { color: #fff; background: rgba(255,255,255,.12); text-decoration: none; }
.navbar nav a.active { color: #fff; background: #2b6cb0; }
.navbar .user { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.navbar .user .role-tag { background: rgba(255,255,255,.18); padding: 2px 10px; border-radius: 20px; font-size: 12px; }
.navbar .user a { color: #cfe0f0; }
.navbar .user a:hover { color: #fff; }
.nav-toggle { display: none; background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 4px 6px; margin-left: 6px; line-height: 1; }

/* ---- 主容器 ---- */
.container { max-width: 1400px; margin: 16px auto; padding: 0 16px; }

/* ---- 卡片 ---- */
.card { background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.08); padding: 16px; margin-bottom: 16px; }
.card h2 { font-size: 16px; margin-bottom: 12px; color: #1a3a5c; }
.card h3 { font-size: 14px; margin-bottom: 10px; color: #444; }

/* ---- 统计卡片 ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border-radius: 10px; padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.08); text-align: center; display: block; text-decoration: none; color: inherit; transition: transform .12s, box-shadow .12s; }
a.stat:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.stat .num { font-size: 30px; font-weight: 700; color: #1a3a5c; }
.stat .label { margin-top: 6px; color: #666; font-size: 13px; }
.stat.blue .num { color: #2b6cb0; }
.stat.green .num { color: #2f855a; }
.stat.orange .num { color: #dd6b20; }
.stat.red .num { color: #c53030; }

/* ---- 表格 ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1100px; }
th { background: #eef2f7; color: #1f3a5c; text-align: left; padding: 10px 8px; font-size: 13px; font-weight: 600; border-bottom: 2px solid #d3dce8; white-space: nowrap; }
td { padding: 9px 8px; border-bottom: 1px solid #e8eef4; font-size: 13px; white-space: nowrap; color: #333; }
tbody tr:nth-child(even) td { background: #fafbfd; }
tr:hover td { background: #f0f5fa; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; border: 1px solid rgba(0,0,0,.08); line-height: 1.6; }
.tag-A { background: #fed7d7; color: #9b2c2c; }
.tag-B { background: #fefcbf; color: #975a16; }
.tag-C { background: #e9d8fd; color: #553c9a; }
.tag-D { background: #e2e8f0; color: #4a5568; }
.tag-ok { background: #c6f6d5; color: #22543d; }
.tag-blue { background: #dbeafe; color: #1e40af; }
.tag-wait { background: #bee3f8; color: #2a4365; }
.tag-gray { background: #e2e8f0; color: #4a5568; }

/* ---- 按钮 ---- */
.region-picker { display: flex; gap: 8px; }
.region-picker select { flex: 1; min-width: 0; }
@media (max-width: 600px){ .region-picker { flex-direction: column; } }
.btn { display: inline-block; padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; line-height: 1.5; background: #2b6cb0; color: #fff; white-space: nowrap; text-align: center; text-decoration: none; vertical-align: middle; }
.btn:hover { background: #2c5282; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.green { background: #38a169; }
.btn.green:hover { background: #2f855a; }
.btn.orange { background: #dd6b20; }
.btn.orange:hover { background: #c05621; }
.btn.gray { background: #718096; }
.btn.gray:hover { background: #4a5568; }
.btn.blue { background: #2b6cb0; }
.btn.blue:hover { background: #234e8f; }
.btn.purple { background: #805ad5; }
.btn.purple:hover { background: #6b46c1; }
.btn.red { background: #e53e3e; }
.btn.red:hover { background: #c53030; }
.btn.sm { padding: 5px 10px; font-size: 13px; line-height: 1.4; }
.btn.link { background: none; color: #2b6cb0; padding: 0; }
.btn.link:hover { text-decoration: underline; }

/* 表格操作列按钮间距 */
td form { display: inline-block; }
td form + form { margin-left: 5px; }

/* ---- 表单 ---- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.form-item label { display: block; font-size: 13px; color: #555; margin-bottom: 4px; }
.form-item label .req { color: #e53e3e; }
.form-item input, .form-item select, .form-item textarea { width: 100%; padding: 8px 10px; border: 1px solid #b9c4d0; border-radius: 6px; font-size: 14px; color: #222; background: #fff; }
.form-item input:hover, .form-item select:hover, .form-item textarea:hover { border-color: #93a5b8; }
.form-item input:focus, .form-item select:focus, .form-item textarea:focus { outline: none; border-color: #2b6cb0; box-shadow: 0 0 0 3px rgba(43,108,176,.15); }
.form-item textarea { resize: vertical; min-height: 60px; }
.form-actions { margin-top: 16px; display: flex; gap: 12px; }

/* ---- 搜索栏 ---- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { padding: 8px 10px; border: 1px solid #cbd5e0; border-radius: 6px; font-size: 14px; }
.toolbar input[type=text] { width: 220px; }

/* ---- 提醒条 ---- */
.flash { padding: 10px 16px; border-radius: 6px; margin-bottom: 12px; font-size: 14px; }
.flash.ok { background: #c6f6d5; color: #22543d; border: 1px solid #9ae6b4; }
.flash.error { background: #fed7d7; color: #9b2c2c; border: 1px solid #feb2b2; }

/* ---- 详情页 ---- */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 16px; }
.detail-grid .item { padding: 8px 10px; background: #f7fafc; border-radius: 6px; }
.detail-grid .item .k { font-size: 12px; color: #888; }
.detail-grid .item .v { font-size: 14px; margin-top: 2px; color: #222; }
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: #e2e8f0; }
.timeline .item { position: relative; padding: 8px 0 12px; }
.timeline .item::before { content: ''; position: absolute; left: -18px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: #2b6cb0; border: 2px solid #fff; box-shadow: 0 0 0 2px #2b6cb0; }
.timeline .item .meta { font-size: 12px; color: #888; margin-bottom: 4px; }
.timeline .item .content { background: #f7fafc; padding: 8px 12px; border-radius: 6px; font-size: 14px; }

/* ---- 分页 ---- */
.pagination { display: flex; gap: 6px; margin-top: 14px; align-items: center; flex-wrap: wrap; }
.pagination a, .pagination span { display: inline-block; padding: 6px 12px; border: 1px solid #cbd5e0; border-radius: 6px; font-size: 13px; color: #2b6cb0; }
.pagination .cur { background: #2b6cb0; color: #fff; border-color: #2b6cb0; }

/* ---- 登录页 ---- */
.login-body { background: linear-gradient(135deg, #1a3a5c 0%, #2b6cb0 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { background: #fff; border-radius: 12px; padding: 36px 32px; width: 380px; max-width: 92vw; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.login-box h1 { font-size: 20px; text-align: center; color: #1a3a5c; margin-bottom: 4px; }
.login-box .sub { text-align: center; color: #888; font-size: 13px; margin-bottom: 24px; }
.login-box .form-item { margin-bottom: 16px; }
.login-box .btn { width: 100%; padding: 11px; font-size: 15px; }
.login-box .flash { margin-bottom: 16px; }

/* ---- 空状态 ---- */
.empty { text-align: center; color: #a0aec0; padding: 40px 0; font-size: 14px; }

/* ---- 转化漏斗 ---- */
.funnel .f-stage { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.funnel .f-bar { color: #fff; border-radius: 8px; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; min-width: 150px; gap: 10px; }
.funnel .f-name { font-weight: 600; white-space: nowrap; }
.funnel .f-num { font-size: 17px; font-weight: 700; }
.funnel .f-rate { color: #666; font-size: 12px; white-space: nowrap; }
.funnel .f-stage:nth-child(1) .f-bar { background: #2b6cb0; }
.funnel .f-stage:nth-child(2) .f-bar { background: #3b7db8; }
.funnel .f-stage:nth-child(3) .f-bar { background: #4a8ec0; }
.funnel .f-stage:nth-child(4) .f-bar { background: #5aa0c8; }
.funnel .f-stage:nth-child(5) .f-bar { background: #69b1d0; }
.funnel .f-stage:nth-child(6) .f-bar { background: #dd6b20; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #f7fafc; border-radius: 8px; padding: 14px; text-align: center; }
.kpi .k { font-size: 12px; color: #888; }
.kpi .v { font-size: 24px; font-weight: 700; color: #1a3a5c; margin-top: 4px; }

/* ---- 移动端适配 ---- */
@media (max-width: 768px) {
    /* 导航:汉堡菜单 */
    .navbar .inner { position: relative; height: 52px; padding: 0 10px; }
    .navbar .logo { font-size: 15px; margin-right: 8px; }
    .navbar .user { gap: 8px; font-size: 13px; }
    .navbar .user .role-tag { display: none; }
    .nav-toggle { display: block; }
    .navbar nav {
        display: none;
        position: absolute; top: 100%; left: 0; right: 0;
        background: #14304c; flex-direction: column;
        padding: 8px 10px; gap: 2px; z-index: 200;
        box-shadow: 0 8px 18px rgba(0,0,0,.28);
        max-height: 70vh; overflow-y: auto;
    }
    .navbar nav.open { display: flex; }
    .navbar nav a { padding: 13px 14px; font-size: 15px; border-radius: 8px; }

    .container { padding: 0 10px; margin: 10px auto; }
    .card { padding: 14px 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .stat { padding: 12px 6px; }
    .stat .num { font-size: 22px; }
    .stat .label { font-size: 12px; }
    .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }

    /* 表单单列,触控区变大 */
    .form-grid { grid-template-columns: 1fr; gap: 12px; }
    .form-item input, .form-item select, .form-item textarea { padding: 10px 11px; font-size: 15px; }
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; padding: 11px; }

    /* 工具/搜索栏竖排 */
    .toolbar { flex-direction: column; align-items: stretch !important; gap: 8px; }
    .toolbar .form-item { width: 100%; }
    .toolbar input, .toolbar select { width: 100%; padding: 10px 11px; }
    .toolbar input[type=text] { width: 100%; }
    .toolbar .btn { width: 100%; text-align: center; padding: 10px; }

    /* 看板内嵌两列改单列 */
    .container div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

    /* 表格横向滚动兜底 */
    .table-wrap { -webkit-overflow-scrolling: touch; }

    .btn { min-height: 38px; }
    .pagination { justify-content: center; }
}

/* ---- 卡片式表格(移动端) ---- */
@media (max-width: 768px) {
    table.cards { min-width: 0; }
    table.cards thead { display: none; }
    table.cards tr { display: block; background: #f7fafc; border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 12px; padding: 6px 10px; }
    table.cards td { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; white-space: normal; text-align: right; padding: 7px 2px; border-bottom: 1px dashed #e2e8f0; }
    table.cards td:last-child { border-bottom: none; }
    table.cards td::before { content: attr(data-label); font-weight: 600; color: #666; text-align: left; flex-shrink: 0; }
    table.cards td.col { flex-direction: column; align-items: flex-end; gap: 4px; }
    table.cards td.col::before { align-self: flex-start; }
}
