/* 鹰巢科技 ERP 系统 - 全局样式 - 马尔斯绿主题 #008C8D */
:root {
    --primary: #008C8D;
    --primary-dark: #006D6E;
    --primary-light: #E0F5F5;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --bg: #f3f4f6;
    --bg-side: #06484A;
    --bg-side-hover: #0A5E60;
    --white: #ffffff;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== 登录页 ===== */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #004D4E 0%, #008C8D 50%, #00B4B5 100%);
    padding: 20px;
}
.login-box {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-mark {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, #008C8D, #006D6E);
    color: #fff;
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 700;
    margin: 0 auto 16px;
    letter-spacing: 2px;
}
.login-logo h1 { font-size: 20px; color: var(--text); }
.login-logo p { color: var(--text-secondary); margin-top: 4px; }

/* 横向 logo 排版（鹰巢图标 + 标题左右并排）*/
.login-logo.horizontal {
    display: flex; align-items: center; justify-content: center;
    gap: 14px; text-align: left;
}
.login-logo.horizontal .logo-mark {
    width: 48px; height: 48px;
    margin: 0;
    font-size: 17px; letter-spacing: 1px;
    border-radius: 12px;
}
.login-logo.horizontal h1 {
    font-size: 24px; font-weight: 700;
    color: var(--text); line-height: 1.2;
}
.login-form .form-group { margin-bottom: 18px; }
.login-form label { display: block; margin-bottom: 6px; font-weight: 500; color: var(--text); }
.login-form input {
    width: 100%; padding: 11px 14px;
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 14px; transition: border-color .2s;
}
.login-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.login-foot { text-align: center; margin-top: 16px; font-size: 13px; }

/* ===== 按钮 ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 9px 18px; border: 1px solid transparent; border-radius: var(--radius);
    font-size: 14px; cursor: pointer; transition: all .15s;
    font-weight: 500; gap: 6px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: #fff; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }

/* ===== 布局 ===== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px; background: var(--bg-side); color: #cbd5e1;
    display: flex; flex-direction: column; flex-shrink: 0;
    position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
    padding: 20px; display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand .logo-mark {
    width: 40px; height: 40px; background: var(--primary); color: #fff;
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px; letter-spacing: 1px;
}
.sidebar-brand h2 { color: #fff; font-size: 16px; }
.sidebar-brand span { font-size: 12px; color: #94a3b8; }
.sidebar-menu { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar-menu .menu-title { padding: 12px 20px 6px; font-size: 12px; color: #64748b; text-transform: uppercase; }
.sidebar-menu a.menu-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 20px; color: #cbd5e1; font-size: 14px;
    border-left: 3px solid transparent; transition: all .15s;
}
.sidebar-menu a.menu-item:hover { background: var(--bg-side-hover); color: #fff; text-decoration: none; }
.sidebar-menu a.menu-item.active { background: var(--bg-side-hover); color: #fff; border-left-color: var(--primary); }
.sidebar-menu a.menu-item .icon { width: 18px; text-align: center; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08); font-size: 13px; }
.sidebar-footer a { color: #cbd5e1; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    background: var(--white); padding: 0 24px; height: 60px;
    display: flex; align-items: center; justify-content: space-between;
    box-shadow: var(--shadow); position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 18px; }
.topbar .user-info { display: flex; align-items: center; gap: 12px; }
.topbar .user-info .avatar {
    width: 34px; height: 34px; background: var(--primary-light); color: var(--primary);
    border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.content { padding: 24px; flex: 1; }

/* ===== 卡片 ===== */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 16px; }
.card-body { padding: 20px; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: 6px; }
table.data-table { width: 100%; border-collapse: collapse; min-width: 3600px; }
table.data-table th, table.data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); border-right: 1px solid #f1f5f9; vertical-align: top; }
table.data-table th:last-child, table.data-table td:last-child { border-right: none; }
table.data-table th { background: #f9fafb; font-weight: 600; color: var(--text-secondary); font-size: 13px; position: sticky; top: 0; white-space: nowrap; }
table.data-table tbody tr:hover { background: #f9fafb; }
table.data-table td.wrap { white-space: normal; min-width: 220px; max-width: 320px; word-break: break-word; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}
.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }

/* ===== 提示 ===== */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ===== 分页 ===== */
.pagination { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text); font-size: 13px;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== 筛选栏 ===== */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filter-bar input, .filter-bar select { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; }

/* ===== 标签 ===== */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-gray { background: #f3f4f6; color: #6b7280; }
.badge-teal { background: #E0F5F5; color: #006D6E; }

/* ===== 弹窗 ===== */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 100; display: none; align-items: center; justify-content: center; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 12px; width: 90%; max-width: 700px; max-height: 90vh; overflow: auto; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 16px; }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { cursor: pointer; font-size: 22px; color: var(--text-secondary); background: none; border: none; }

/* ===== 详情 ===== */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; }
.detail-item { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.detail-item.full { grid-column: 1 / -1; }
.detail-item .label { color: var(--text-secondary); font-size: 12px; }
.detail-item .value { margin-top: 2px; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-brand h2, .sidebar-brand span, .sidebar-menu a.menu-item span:not(.icon), .sidebar-footer span { display: none; }
    .sidebar-menu a.menu-item { justify-content: center; padding: 12px 0; }
    .content { padding: 12px; }
    .detail-grid { grid-template-columns: 1fr; }
}

/* ===== 统计卡片 ===== */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.stat-card .num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .label { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }

.empty { text-align: center; color: var(--text-secondary); padding: 40px; }

/* ===== 智能对账 ===== */
.recon-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 4px; }
@media (max-width: 1100px) { .recon-grid { grid-template-columns: 1fr; } }
.recon-grid .pane { min-width: 0; }
table.data-table.recon-table { min-width: 860px; }
/* 左右表所有单元格单行显示（不换行），保证左右两表行高一致、逐行对齐比较；过宽时表格横向滚动 */
table.data-table.recon-table th,
table.data-table.recon-table td { white-space: nowrap; }
table.data-table.recon-table td.wrap { white-space: nowrap; min-width: 0; max-width: none; word-break: normal; }
td.diff-ok { background: #f0fdf4; color: #166534; }
td.diff-no { background: #fef2f2; color: #b91c1c; }
td.diff-ok strong, td.diff-no strong { font-weight: 700; }
#recon-stats .stat-card .num { font-size: 24px; }

/* ===== 顶栏用户下拉菜单 ===== */
.topbar .user-info { position: relative; cursor: pointer; user-select: none; }
.topbar .user-info .caret { color: var(--text-secondary); font-size: 11px; transition: transform .15s; }
.topbar .user-info.open .caret { transform: rotate(180deg); }
.user-dropdown {
    position: absolute; top: calc(100% + 14px); right: 0; min-width: 170px;
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0,0,0,.12); padding: 6px; display: none; z-index: 60;
}
.user-dropdown.show { display: block; }
.user-dropdown a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 8px;
    color: var(--text); font-size: 14px; text-decoration: none; white-space: nowrap;
}
.user-dropdown a:hover { background: #f3f4f6; }
.user-dropdown .divider { height: 1px; background: var(--border); margin: 6px 6px; }
.user-dropdown svg { width: 16px; height: 16px; flex: none; color: #4b5563; }

/* ===== 数据智能看板 ===== */
table.data-table.bi-table { min-width: 0; }
table.data-table.bi-table th, table.data-table.bi-table td { text-align: center; white-space: nowrap; padding: 7px 8px; font-size: 13px; }
table.data-table.bi-table th { vertical-align: middle; font-weight: 700; }
.bi-grp24 { background: #eff6ff !important; color: #1d4ed8; }
.bi-grp25 { background: #ecfdf5 !important; color: #047857; }
.bi-grp26 { background: #fff1f2 !important; color: #be123c; }
.bi-grpdiff { background: #fefce8 !important; color: #a16207; }
.bi-yoy { color: #2563eb; }
.bi-mom { color: #059669; }
td.bi-cell26 { background: #fff1f2; }
.bi-up { color: #16a34a; }
.bi-down { color: #dc2626; }
td.bi-pctonly { font-size: 12.5px; }
td.bi-good { color: #16a34a; }
td.bi-bad { color: #dc2626; }
tr.bi-total td { background: #dbeafe; font-weight: 600; }
/* ===== 平台表两层表头（2026-09 改造 · 第 4 版） =====
   列顺序：月份 | 总毛利 ‖ 店面 电商 总部（各 2 列） ‖ 各小项（各 2 列）
   【同组同色】大组汇总列与其所属小项列共用同一底色，一眼可辨归属；
   配色对齐其他看板的柔和基调，分隔线沿用基础样式的 1px，不再加粗。 */
.bi-plat .bi-grphead { font-weight: 700; color: var(--text-secondary); }
/* 组边界：仅用基础样式的 1px 分隔，避免视觉过重 */
.bi-plat .bi-subgrp { font-weight: 600; }
/* 组小计单元格：加粗，与普通小项区分 */
.bi-plat td.bi-grpsum { font-weight: 700; }

/* —— 三大组配色（组汇总列 + 组内小项列 共用）—— */
/* 小项列：对应组底色的浅一档 */
.bi-plat td.bi-grp-店面, .bi-plat th.bi-grp-店面 { background: #fdf2f8; }
.bi-plat td.bi-grp-电商, .bi-plat th.bi-grp-电商 { background: #eff6ff; }
.bi-plat td.bi-grp-总部, .bi-plat th.bi-grp-总部 { background: #f0fdf4; }
/* 大组汇总列：同色系稍深一档，突出层级（同时覆盖基础 th 的灰底） */
.bi-plat th.bi-grphead.bi-grp-店面 { background: #fce7f3 !important; color: #9d174d; }
.bi-plat th.bi-grphead.bi-grp-电商 { background: #dbeafe !important; color: #1e40af; }
.bi-plat th.bi-grphead.bi-grp-总部 { background: #dcfce7 !important; color: #166534; }

/* ===== 天毛利看板 ===== */
.bi-day-wrap { display: flex; gap: 18px; align-items: flex-start; }
.bi-day-wrap > div { flex: 1; min-width: 0; }
table.data-table.bi-day { min-width: 0; }
table.data-table.bi-day th, table.data-table.bi-day td { padding: 5px 7px; font-size: 12.5px; white-space: nowrap; }
.bi-day .wk { color: var(--text-secondary); }
.bi-day .wk-end { color: #dc2626; }
.bi-day .tag-holiday { color: #dc2626; font-weight: 700; margin-left: 3px; }
.bi-day .tag-jieqi { color: #059669; font-weight: 600; margin-left: 3px; }
.bi-day .tag-work { color: #ea580c; font-weight: 700; margin-left: 3px; }
tr.bi-hol td { background: #fef2f2; }
tr.bi-jieqi td { background: #f0fdf4; }
.bi-day-total {
    display: flex; flex-wrap: wrap; gap: 10px 28px; justify-content: center;
    margin-top: 12px; padding: 10px 14px;
    background: #dbeafe; border-radius: 8px; font-size: 13.5px;
}
@media (max-width: 1100px) { .bi-day-wrap { flex-direction: column; } }

/* ===== 销售平台占比看板 ===== */
table.data-table.bi-plat { min-width: 0; }
table.data-table.bi-plat th, table.data-table.bi-plat td { padding: 5px 7px; font-size: 12.5px; white-space: nowrap; }
.bi-pg-pink { background: #fff1f2 !important; color: #be123c; }
.bi-pg-blue { background: #eff6ff !important; color: #1d4ed8; }
.bi-pg-orange { background: #fff7ed !important; color: #c2410c; }
.bi-pg-green { background: #ecfdf5 !important; color: #047857; }
.bi-pg-plain { background: #f8fafc !important; color: #475569; }
th.bi-sub { font-weight: 600; font-size: 12px !important; }
th.bi-ptotalth, td.bi-ptotal { background: #e5e7eb !important; color: #374151; }

/* ===== 负毛利率看板 ===== */
table.data-table.bi-neg-tbl { min-width: 0; }
table.data-table.bi-neg-tbl th, table.data-table.bi-neg-tbl td { padding: 5px 7px; font-size: 12.5px; white-space: nowrap; }
/* 负毛利金额统一红字（与全局「涨红跌绿」区分：此处强调亏损，故固定红色） */
.bi-neg { color: #dc2626; font-weight: 600; }
tr.bi-empty td { color: var(--text-secondary); opacity: .55; }
.bi-neg-tfoot td { background: #f1f5f9; font-weight: 700; border-top: 2px solid #cbd5e1; }
