/* ================================================================
   山姆代购进销存系统 - 后台样式
   ================================================================ */

/* 基础重置 */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    max-width: 100%;
    overflow-x: hidden;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background: #f5f6fa;
}
a { color: #1a73e8; text-decoration: none; }
a:hover { color: #1557b0; text-decoration: underline; }

/* ==================== 整体布局 ==================== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* 左侧侧边栏 */
.sidebar {
    width: 220px;
    background: #1e2a3a;
    color: #cfd8e3;
    flex-shrink: 0;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    transition: width .2s ease, transform .25s ease;
}

.sidebar .logo {
    padding: 16px 16px;
    font-size: 15px;
    font-weight: bold;
    color: #fff;
    border-bottom: 1px solid #2c3e50;
    background: #172233;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}
.sidebar .logo a {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    color: #fff;
    text-decoration: none;
}
.sidebar .logo i {
    font-size: 18px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}
body.sidebar-collapsed .sidebar .logo {
    padding: 16px 0;
    justify-content: center;
}
body.sidebar-collapsed .sidebar .logo a {
    justify-content: center;
}
body.sidebar-collapsed .sidebar .logo i {
    margin: 0 auto;
    font-size: 20px;
    text-align: center;
}
.sidebar .logo small {
    display: block;
    font-size: 11px;
    font-weight: normal;
    color: #7f8c9a;
    margin-top: 2px;
}

/* 主内容区 */
.main-col {
    flex: 1;
    margin-left: 220px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .2s ease;
    min-width: 0;
    padding-top: 50px;
}

/* 顶部导航 */
.topbar {
    background: #fff;
    padding: 10px 16px;
    border-bottom: 1px solid #e8eaed;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
    position: fixed;
    top: 0;
    left: 220px;
    right: 0;
    z-index: 50;
    min-height: 50px;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.topbar .title {
    font-size: 15px;
    color: #333;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topbar .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    position: relative;
}
.user-icon { color: #555; white-space: nowrap; }
.btn-logout {
    padding: 6px 12px;
    background: #f8f9fa;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    color: #555;
    cursor: pointer;
    white-space: nowrap;
}
.btn-logout:hover { background: #e8eaed; text-decoration: none; }

/* 顶部导航上的按钮（汉堡/侧边栏收起按钮） */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid #e8eaed;
    background: #fff;
    color: #555;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
    transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover {
    background: #f5f6fa;
    color: #1a73e8;
    border-color: #cfd8e3;
}
/* 在桌面端隐藏汉堡按钮，在移动端隐藏侧边栏收起按钮 —— 由下面的 @media 决定 */
.hamburger { display: none; }
.sidebar-toggle { display: inline-flex; }

/* 侧边栏蒙版（移动端点击空白处关闭菜单） */
.sidebar-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 90;
}

/* 主内容区 */
.content {
    padding: 16px;
    padding-bottom: 60px;
    flex: 1;
    min-width: 0;
}

/* 底部 */
.footer {
    padding: 12px;
    text-align: center;
    color: #999;
    font-size: 12px;
    background: #fff;
    border-top: 1px solid #e8eaed;
    position: fixed;
    bottom: 0;
    left: 220px;
    right: 0;
    z-index: 99;
}

/* ==================== 左侧菜单导航 ==================== */
.nav {
    padding: 8px 0;
}

.nav-group {
    margin-bottom: 2px;
}

.nav-title {
    padding: 10px 16px;
    font-size: 13px;
    color: #cfd8e3;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: background .2s;
    user-select: none;
    white-space: nowrap;
}
.nav-title:hover {
    background: #2c3e50;
    color: #fff;
}
.nav-title > i:first-child {
    margin-right: 8px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}
.nav-title .nav-title-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-title .caretright {
    transition: transform .2s;
    font-size: 11px;
    opacity: .6;
    flex-shrink: 0;
}
.nav-group.open .nav-title .caretright { transform: rotate(180deg); }

/* 子菜单 */
.nav-group ul {
    list-style: none;
    background: #172233;
    display: none;
    padding: 4px 0;
}
.nav-group.open ul { display: block; }

.nav-group ul li a {
    display: block;
    padding: 10px 16px 10px 46px;
    color: #9aa7b6;
    font-size: 13px;
    transition: background .15s, color .15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-group ul li a:hover {
    background: #2c3e50;
    color: #fff;
    text-decoration: none;
}

/* 选中项 - 关键！必须清晰明显 */
.nav-group ul li.active a {
    background: #1a73e8;
    color: #ffffff !important;
    font-weight: 500;
    border-left: 3px solid #64b5f6;
    padding-left: 43px;
}
.nav-group ul li.active a:hover {
    background: #1557b0;
    color: #ffffff !important;
}

/* ==================== 侧边栏折叠态（桌面端）：只显示图标 ==================== */
body.sidebar-collapsed .sidebar {
    width: 64px;
}
body.sidebar-collapsed .main-col {
    margin-left: 64px;
}
body.sidebar-collapsed .topbar {
    left: 64px;
}
body.sidebar-collapsed .footer {
    left: 64px;
}
/* 侧边栏收起时，零售页面布局适配 */
body.sidebar-collapsed .retail-layout {
    width: calc(100% - 64px);
}
body.sidebar-collapsed .logo-text,
body.sidebar-collapsed .nav-title-text,
body.sidebar-collapsed .nav-title .caretright,
body.sidebar-collapsed .nav-group ul {
    display: none;
}
body.sidebar-collapsed .nav-title {
    justify-content: center;
    align-items: center;
    padding: 14px 0;
    text-align: center;
    position: relative;
}
body.sidebar-collapsed .nav-title > i:first-child {
    margin-right: 0;
    margin-left: 0;
    font-size: 16px;
    text-align: center;
}
body.sidebar-collapsed .nav-group.open .nav-title {
    background: #2c3e50;
}
/* 折叠态：tooltip / 二级菜单面板均通过 JS 以 position:fixed 方式注入，
   因此保留原有 overflow-y:auto (可纵向滚动)，但不打开 overflow-x: visible，
   避免浏览器把 visible 与 auto 混用时自动降级为 auto，从而产生横向滚动条 */
/* 折叠态时的 tooltip（JS 动态插入） —— 外观与深色二级菜单一致 */
.nav-title-tooltip {
    position: fixed;
    background: #1e2a3a;
    color: #fff;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 200;
    box-shadow: 2px 2px 10px rgba(0,0,0,.3);
    border: 1px solid #2c3e50;
    pointer-events: none;
}
.nav-title-tooltip::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 50%;
    transform: translateY(-50%);
    width: 0; height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 7px solid #1e2a3a;
    filter: drop-shadow(-1px 0 0 #2c3e50);
}
/* 折叠态通过点击图标弹出的二级菜单（右侧浮动面板） —— 采用侧边栏配色 */
body.sidebar-collapsed .nav-submenu-popup {
    position: fixed;
    display: block;
    min-width: 180px;
    background: #1e2a3a;
    color: #cfd8e3;
    border: 1px solid #2c3e50;
    border-radius: 6px;
    padding: 6px 0;
    margin: 0;
    list-style: none;
    box-shadow: 2px 2px 14px rgba(0,0,0,.35);
    z-index: 9999;
}
body.sidebar-collapsed .nav-submenu-popup::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 18px;
    width: 0; height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 6px solid #1e2a3a;
    filter: drop-shadow(-1px 0 0 #2c3e50);
}
body.sidebar-collapsed .nav-submenu-popup li {
    list-style: none;
}
body.sidebar-collapsed .nav-submenu-popup li a {
    display: block;
    padding: 8px 16px;
    color: #cfd8e3;
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
}
body.sidebar-collapsed .nav-submenu-popup li a:hover {
    background: #2c3e50;
    color: #ffffff;
}
body.sidebar-collapsed .nav-submenu-popup li.active a {
    background: #1a73e8;
    color: #ffffff;
    font-weight: 500;
}

/* ==================== 卡片 ==================== */
.card {
    background: #fff;
    border: 1px solid #e4e7ed;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    margin-bottom: 15px;
    width: 100%;
    box-sizing: border-box;
}
.card-header {
    padding: 15px 20px;
    width: 100%;
    border-bottom: 1px solid #e8eaed;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-title {
    font-size: 15px;
    font-weight: 500;
    color: #111;
}
.card-tools { font-size: 13px; }
.card-body { padding: 20px; box-sizing: border-box; }

/* 确保图表 canvas 不溢出父容器 */
.card-body canvas {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box;
}
#saleChart, #purchaseChart {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    box-sizing: border-box;
}

/* ==================== 统计卡片 / 网格布局 ==================== */
/* 顶部数字卡片：根据宽度纯自适应，容纳不下自动换行（不限制每行最大列数） */
.card-grid-8,
.card-grid-5 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}
/* 底部大卡片（表格/报表）：每行最多 3 个，自适应占满 */
.card-grid-4,
.card-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}
/* 宽屏（>=1100px）：底部大卡片每行最多 3 个 */
@media (min-width: 1100px) {
    .card-grid-4,
    .card-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}
/* 中间行：两张图表卡（等宽） */
.card-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}
/* 窄屏：图表卡降为 1 列 */
@media (max-width: 992px) {
    .card-grid-2 {
        grid-template-columns: 1fr;
    }
}
/* 超窄屏（<600px）：所有网格降为 1 列 */
@media (max-width: 600px) {
    .card-grid-8,
    .card-grid-5,
    .card-grid-4,
    .card-grid-3 {
        grid-template-columns: 1fr;
    }
}
.stat-card {
    background: #fff;
    border: 1px solid #e4e7ed;
    border-radius: 8px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    min-width: 0;
    box-sizing: border-box;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    flex-shrink: 0;
}
.stat-card.blue   .stat-icon { background: #1a73e8; }
.stat-card.green  .stat-icon { background: #28a745; }
.stat-card.orange .stat-icon { background: #f39c12; }
.stat-card.purple .stat-icon { background: #9c27b0; }
.stat-card.red    .stat-icon { background: #dc3545; }
.stat-content { flex: 1; }
.stat-title { font-size: 13px; color: #999; margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 700; color: #333; margin-bottom: 4px; }
.stat-sub   { font-size: 12px; color: #999; }

/* 区块标题：用于区分汇总/销售/代购等不同数据段 */
.card-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    padding: 15px 5px 10px 5px;
    margin-top: 10px;
    border-bottom: 1px solid #e4e7ed;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 15px;
    justify-items: stretch;
}
@media (max-width: 992px) {
    .stat-grid-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
    .stat-grid-5 { grid-template-columns: repeat(2, 1fr); }
}
.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.stat-card.blue   .stat-icon { background: rgba(26,115,232,.12); color: #1a73e8; }
.stat-card.orange .stat-icon { background: rgba(255,152,0,.12);  color: #ff9800; }
.stat-card.green  .stat-icon { background: rgba(76,175,80,.12);  color: #4caf50; }
.stat-card.purple .stat-icon { background: rgba(156,39,176,.12); color: #9c27b0; }
.stat-card.red    .stat-icon { background: rgba(231,76,60,.12);  color: #e74c3c; }
.stat-card.cyan   .stat-icon { background: rgba(0,188,212,.12);  color: #00bcd4; }

.stat-card .stat-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.stat-card .stat-title {
    font-size: 12px;
    color: #888;
    margin-bottom: 2px;
    white-space: nowrap;
}
.stat-card .stat-value {
    font-size: 18px;
    font-weight: bold;
    color: #111;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stat-card .stat-sub {
    font-size: 11px;
    color: #aaa;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== 按钮 ==================== */
.btn {
    display: inline-block;
    padding: 7px 14px;
    font-size: 13px;
    background: #fff;
    color: #555;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1.4;
    transition: all .15s;
}
.btn:hover {
    background: #f5f6fa;
    border-color: #1a73e8;
    color: #1a73e8;
    text-decoration: none;
}
.btn.primary {
    background: #1a73e8;
    color: #fff !important;
    border-color: #1a73e8;
}
.btn.primary:hover {
    background: #1557b0;
    border-color: #1557b0;
    color: #fff !important;
}
.btn.danger {
    background: #fff;
    color: #e74c3c;
    border-color: #f5c6cb;
}
.btn.danger:hover {
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
}
.btn.success {
    background: #4caf50;
    color: #fff;
    border-color: #4caf50;
}
.btn.success:hover {
    background: #388e3c;
    border-color: #388e3c;
    color: #fff;
}
.btn.small { padding: 4px 10px; font-size: 12px; }

/* ==================== 表格 ==================== */
.table-wrap {
    overflow-x: auto;
}
.table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
}
.table th, .table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #f0f2f5;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.table th {
    background: #fafbfc;
    color: #666;
    font-weight: 500;
    border-bottom: 1px solid #e8eaed;
}
.table tr:last-child td { border-bottom: none; }
.table td.actions { white-space: nowrap; }
.table td.actions .btn { margin-right: 5px; }
.table td[style*="text-align:right"], .table th[style*="text-align:right"] { text-align: right; }

/* 卡片内的表格更紧凑 */
.card-body .table { width: 100%; }
.card-body .table th, .card-body .table td { padding: 6px 8px; font-size: 12px; }

/* 分页 */
.pagination-wrap {
    margin: 15px 0;
    padding: 10px 15px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    background: #fafbfc;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 6px 6px;
    font-size: 13px;
    color: #555;
}
.pagination-wrap .pg-info {
    color: #666;
    margin-right: 8px;
}
.pagination-wrap .pg-info b {
    color: #1a73e8;
    font-weight: 600;
    margin: 0 2px;
}
.pagination-wrap .pg-btn, .pagination-wrap .pg-num {
    display: inline-block;
    padding: 5px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 13px;
    color: #555;
    background: #fff;
    text-decoration: none;
    cursor: pointer;
    min-width: 32px;
    text-align: center;
    transition: all 0.15s;
}
.pagination-wrap .pg-btn:hover:not(.disabled),
.pagination-wrap .pg-num:hover:not(.active) {
    background: #f0f5ff;
    text-decoration: none;
    border-color: #1a73e8;
    color: #1a73e8;
}
.pagination-wrap .pg-num.active {
    background: #1a73e8;
    color: #fff;
    border-color: #1a73e8;
    font-weight: 600;
}
.pagination-wrap .pg-btn.disabled {
    color: #ccc;
    background: #f8f9fa;
    cursor: not-allowed;
    border-color: #e5e7eb;
}
.pagination-wrap .pg-size {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding-left: 10px;
    border-left: 1px solid #e5e7eb;
}
.pagination-wrap .pg-size label {
    font-size: 13px;
    color: #666;
    font-weight: normal;
}
.pagination-wrap .pg-size select {
    padding: 4px 8px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: #fff;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    min-width: 60px;
}
.pagination-wrap .pg-size select:hover {
    border-color: #1a73e8;
}
.pagination-wrap .pg-size select:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26,115,232,0.1);
}

/* ==================== 表单 ==================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 15px;
    padding: 20px;
}
.form-item {
    display: flex;
    flex-direction: column;
}
.form-item label {
    font-size: 13px;
    color: #555;
    margin-bottom: 6px;
    font-weight: 500;
}
.form-item input[type="text"],
.form-item input[type="number"],
.form-item input[type="email"],
.form-item input[type="password"],
.form-item input[type="date"],
.form-item select,
.form-item textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color .15s;
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26,115,232,.15);
}
.form-actions {
    padding: 15px 20px 20px;
    border-top: 1px solid #e8eaed;
}
.form-actions .btn { margin-right: 8px; }

/* ==================== 搜索/筛选栏 ==================== */
.search-bar {
    background: #fff;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,.03);
}
.search-bar input[type="text"],
.search-bar input[type="date"],
.search-bar select,
.search-bar .ac-input {
    padding: 6px 10px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
}
.search-bar label { font-size: 13px; color: #555; }
.search-bar input.ac-input { width: 220px !important; flex-shrink: 0; }

/* ==================== 提示消息 ==================== */
.alert {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 13px;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error, .alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ==================== 详细信息页 ==================== */
.detail-list {
    padding: 20px;
}
.detail-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px dashed #e8eaed;
    font-size: 13px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .label {
    width: 120px;
    color: #777;
    flex-shrink: 0;
}
.detail-row .value {
    color: #333;
    flex: 1;
}

/* ==================== 统计/汇总行 ==================== */
.summary-row {
    padding: 12px 20px;
    background: #f8f9fa;
    font-size: 13px;
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}
.summary-row strong { color: #e74c3c; font-size: 15px; }

/* ==================== 图表区 ==================== */
.chart-container {
    background: #fff;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    margin-bottom: 15px;
}
.chart-container h3 {
    font-size: 14px;
    margin-bottom: 10px;
    color: #333;
}

/* ==================== 登录页 ==================== */
.login-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a73e8 0%, #2c3e50 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-box {
    background: #fff;
    border-radius: 8px;
    padding: 35px 30px;
    width: 360px;
    box-shadow: 0 10px 30px rgba(0,0,0,.15);
}
.login-box h1 {
    text-align: center;
    font-size: 20px;
    margin-bottom: 25px;
    color: #1a73e8;
}
.login-box .form-item { margin-bottom: 15px; }
.login-box .form-item input {
    padding: 10px 12px;
    font-size: 14px;
}
.login-box .btn.primary {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    margin-top: 10px;
}
.login-box .tip {
    text-align: center;
    color: #999;
    font-size: 12px;
    margin-top: 15px;
}

/* 另一种登录页风格（login-card 风格） */
.login-body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a73e8 0%, #2c3e50 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.login-card {
    background: #fff;
    border-radius: 10px;
    padding: 40px 35px;
    width: 380px;
    box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.login-logo {
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    color: #1a73e8;
    margin-bottom: 6px;
}
.login-logo i { margin-right: 8px; }
.login-title {
    text-align: center;
    font-size: 15px;
    color: #666;
    margin-bottom: 25px;
}
.login-card .form-item { margin-bottom: 15px; }
.login-card .form-item label {
    display: block;
    font-size: 13px;
    color: #555;
    margin-bottom: 6px;
}
.login-card .form-item input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: inherit;
}
.login-card .form-item input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26,115,232,.15);
}
.login-card .btn.primary.full {
    width: 100%;
    padding: 11px;
    font-size: 14px;
    margin-top: 12px;
}
.login-card .form-item-check {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}
.login-card .form-item-check input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}
.login-card .form-item-check label {
    margin: 0;
    font-size: 13px;
    color: #555;
    cursor: pointer;
}
.login-tip {
    text-align: center;
    color: #999;
    font-size: 12px;
    margin-top: 18px;
}

/* ==================== 工具类 ==================== */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-success { color: #4caf50; }
.text-danger { color: #e74c3c; }
.text-warning { color: #ff9800; }
.text-primary { color: #1a73e8; }
.mb-5 { margin-bottom: 5px; }
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.mt-10 { margin-top: 10px; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* 小标签 */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 10px;
    background: #e8eaed;
    color: #555;
}
.badge.success { background: #d4edda; color: #155724; }
.badge.danger  { background: #f8d7da; color: #721c24; }
.badge.warning { background: #fff3cd; color: #856404; }
.badge.info    { background: #d1ecf1; color: #0c5460; }

/* 状态标签（报表中使用） */
.tag {
    display: inline-block;
    padding: 3px 10px;
    font-size: 12px;
    border-radius: 4px;
    font-weight: 500;
}
.tag.green  { background: #d4edda; color: #155724; }
.tag.orange { background: #fff3cd; color: #856404; }
.tag.red    { background: #f8d7da; color: #721c24; }

/* 通用输入框（顶部筛选等位置使用） */
.form-input {
    padding: 6px 10px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    font-family: inherit;
    transition: border-color .15s;
}
.form-input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26,115,232,.15);
}

/* ==================== 系统配置页样式 ==================== */
.config-group {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 6px;
    padding: 20px 24px 8px;
    margin-bottom: 20px;
}
.config-group-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: -5px 0 18px;
    padding-bottom: 12px;
    border-bottom: 1px dashed #e8eaed;
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-hint {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
    line-height: 1.6;
}

/* ==================== Toast 浮层提示 ==================== */
.jxc-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    color: #fff;
    z-index: 99999;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 80%;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.jxc-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.jxc-toast-info { background: #1890ff; }
.jxc-toast-success { background: #52c41a; }
.jxc-toast-error { background: #f5222d; }
.jxc-toast-warning { background: #faad14; }

/* ==================== 响应式：移动端（< 768px） ==================== */
@media (max-width: 767px) {
    /* 移动端默认隐藏侧边栏，通过汉堡按钮滑出 */
    .sidebar {
        transform: translateX(-100%);
        width: 240px;
        z-index: 110;
        box-shadow: 2px 0 12px rgba(0,0,0,.15);
    }
    .main-col {
        margin-left: 0;
    }
    body.sidebar-mobile-open .sidebar {
        transform: translateX(0);
    }
    body.sidebar-mobile-open .sidebar-mask {
        display: block;
    }

    /* 顶部导航调整：显示汉堡按钮，隐藏"侧边栏收起"按钮 */
    .topbar {
        padding: 8px 12px;
        min-height: 48px;
        left: 0;
    }
    .footer {
        left: 0;
    }
    .hamburger { display: inline-flex; }
    .sidebar-toggle { display: none; }
    .common-features-btn { display: none !important; }
    .common-features-btn-mobile { display: inline-flex !important; }
    .common-features-dropdown {
        left: auto !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 280px !important;
    }

    .topbar .title { font-size: 14px; }
    .user-icon { font-size: 12px; }
    .btn-logout {
        padding: 5px 8px;
        font-size: 12px;
    }

    /* 内容区内边距更小 */
    .content { padding: 12px; }

    /* 卡片头部：换行允许 */
    .card-header {
        padding: 12px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .card-body { padding: 12px; }

    /* 表格：横向滚动，避免整页横向滚动条 */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px;
    }
    .table th, .table td {
        padding: 8px 10px;
        font-size: 12px;
    }

    /* 统计卡片网格：单列（card-grid-8/5/4/3 的响应式由顶部统一规则处理） */
    .card-grid-2 {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* 搜索筛选栏：纵向排列 */
    .search-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .search-bar input[type="text"],
    .search-bar input[type="date"],
    .search-bar select {
        width: 100%;
    }

    /* 表单 */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px;
    }

    /* 详情列表：标题和值分行显示 */
    .detail-row {
        flex-direction: column;
        gap: 4px;
        padding: 10px 0;
    }
    .detail-row .label {
        width: auto;
        font-size: 12px;
        color: #888;
    }
    .detail-row .value {
        font-size: 14px;
    }

    /* 分页 */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* 汇总行 */
    .summary-row {
        padding: 10px 12px;
        gap: 12px;
        font-size: 12px;
    }
}

/* ==================== 自动联想/搜索选择组件 ==================== */
.ac-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 13px;
    background: #fff !important;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
    font-family: inherit;
}
.ac-input:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
    background: #fff !important;
}

.ac-dropdown {
    position: fixed !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    border: 1px solid #d9d9d9 !important;
    border-radius: 4px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    z-index: 99999 !important;
}
.ac-dropdown ul {
    list-style: none !important;
    margin: 0 !important;
    padding: 4px 0 !important;
    background: #fff !important;
}
.ac-dropdown li {
    padding: 8px 12px !important;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.5;
    color: #333 !important;
    border-bottom: 1px solid #f0f0f0 !important;
    transition: background-color 0.08s, color 0.08s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ac-dropdown li:last-child {
    border-bottom: none !important;
}
.ac-dropdown li:hover,
.ac-dropdown li.ac-selected {
    background-color: #1a73e8 !important;
    color: #ffffff !important;
    background: #1a73e8 !important;
}
.ac-dropdown li:hover .ac-highlight,
.ac-dropdown li.ac-selected .ac-highlight {
    color: #ffe066 !important;
    background: transparent !important;
}
.ac-highlight {
    color: #1a73e8;
    font-weight: bold;
    background: #fff7c2;
    padding: 0 2px;
    border-radius: 2px;
}
.ac-empty {
    padding: 12px;
    color: #999;
    font-size: 13px;
    text-align: center;
    background: #fff !important;
}
.ac-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px !important;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.5;
    color: #333 !important;
    border-bottom: 1px solid #f0f0f0 !important;
    transition: background-color 0.08s, color 0.08s;
    white-space: nowrap;
    overflow: hidden;
}
.ac-item:hover,
.ac-item.ac-selected {
    background-color: #1a73e8 !important;
    color: #ffffff !important;
}
.ac-item:hover .ac-highlight,
.ac-item.ac-selected .ac-highlight {
    color: #ffe066 !important;
    background: transparent !important;
}
.ac-name {
    font-weight: 500;
    color: inherit;
}
.ac-details {
    display: flex;
    gap: 8px;
    margin-left: 8px;
    flex-shrink: 0;
}
.ac-meta {
    font-size: 12px;
    color: #666;
    font-family: monospace;
}
.ac-item:hover .ac-meta,
.ac-item.ac-selected .ac-meta {
    color: rgba(255, 255, 255, 0.8);
}
.ac-code {
    color: #1a73e8;
}
.ac-item:hover .ac-code,
.ac-item.ac-selected .ac-code {
    color: #ffe066;
}
.ac-phone {
    color: #999;
}
.ac-barcode {
    color: #1a73e8;
}
.ac-item:hover .ac-barcode,
.ac-item.ac-selected .ac-barcode {
    color: #ffe066;
}
.ac-spec {
    color: #666;
}
.ac-price {
    color: #dc3545;
}
.ac-item:hover .ac-price,
.ac-item.ac-selected .ac-price {
    color: #ff9800;
}
.ac-stock {
    color: #28a745;
}
.ac-item:hover .ac-stock,
.ac-item.ac-selected .ac-stock {
    color: #81c784;
}
.ac-level-tag {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    background: #f0f0f0;
    color: #666;
    margin-left: 8px;
    flex-shrink: 0;
}
.ac-item:hover .ac-level-tag,
.ac-item.ac-selected .ac-level-tag {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.ac-info-container {
    padding: 8px;
    background: #e8f5e9;
    border-radius: 4px;
    margin-top: 8px;
    font-size: 13px;
}

.ac-info-label {
    color: #2e7d32;
    font-weight: bold;
}

.ac-info-name {
    color: #333;
}

.ac-info-code {
    color: #666;
    font-family: monospace;
    margin-left: 8px;
}

.ac-info-level {
    color: #1976d2;
    margin-left: 8px;
}

.ac-info-clear {
    margin-left: 12px;
    color: #dc3545;
    font-size: 12px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
}

.ac-info-clear:hover {
    text-decoration: underline;
}

/* ==================== 全局表单控件统一样式 ==================== */
select {
    font-family: inherit;
    transition: border-color 0.15s;
}
select:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}

/* 表格内的输入框/选择框统一外观 */
table input[type="text"],
table input[type="number"],
table input[type="date"],
table input[type="email"],
table input[type="password"],
table select,
table textarea {
    padding: 6px 10px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    font-family: inherit;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
table input:focus,
table select:focus,
table textarea:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}

/* 搜索筛选区域内的输入框/选择框统一外观 */
.search-form input[type="text"],
.search-form input[type="number"],
.search-form input[type="date"],
.search-form select {
    padding: 6px 10px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    font-family: inherit;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.search-form input:focus,
.search-form select:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}

/* 通用原生 select 和 原生 input 统一（确保非 form-item 区域的原生控件也有基本一致的外观） */
input[type="text"].form-native,
input[type="number"].form-native,
input[type="date"].form-native,
input[type="email"].form-native,
input[type="password"].form-native,
select.form-native,
textarea.form-native {
    padding: 8px 10px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    font-family: inherit;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
input[type="text"].form-native:focus,
input[type="number"].form-native:focus,
input[type="date"].form-native:focus,
select.form-native:focus,
textarea.form-native:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}

/* ================================================================
   购物车风格采购单（purchase/add）
   ================================================================ */
.purchase-cart-layout {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 16px;
    margin: 16px;
}
@media (max-width: 1100px) {
    .purchase-cart-layout { grid-template-columns: 1fr; }
}

/* ---------- 商品库（左侧） ---------- */
.purchase-product-panel { padding-bottom: 16px; }

.purchase-filter-bar {
    padding: 12px 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    border-bottom: 1px solid #e5e5e5;
    background: #fafafa;
}
.purchase-filter-bar #product-search-input {
    width: 100%;
    min-width: 300px;
    padding: 14px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 18px;
    background: #fff;
    transition: border-color 0.15s;
}
.purchase-filter-bar #product-search-input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}
.btn-reset-search {
    width: 48px;
    padding: 14px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 18px;
    background: #fff;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.btn-reset-search:hover {
    background: #f5f5f5;
    border-color: #1a73e8;
    color: #1a73e8;
}
.btn-reset-search:active {
    background: #eee;
}
.product-count { color: #666; font-size: 13px; white-space: nowrap; }
.product-count b { color: #1a73e8; font-weight: 600; }

/* "显示散装商品"复选框 —— 放在"共xx件"后面的视觉一致 */
.piece-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;

    border-radius: 6px;
    transition: all 0.15s;
}
.piece-checkbox-label:hover {
    border-color: #1a73e8;
    color: #1a73e8;
}
.piece-checkbox-label input[type="checkbox"] {

    height: 14px;
    margin: 0;
    padding: 0;
    vertical-align: middle;
    cursor: pointer;
}
.purchase-filter-bar .btn-text {
    white-space: nowrap;
    padding: 5px 12px;
    font-size: 13px;
}
/* ---------- 分页条 ---------- */
.product-pager {
    padding: 20px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    border-top: 1px solid #e5e5e5;
    font-size: 13px;
    color: #555;
    flex-shrink: 0;
}
.product-pager > span:first-child {
    margin-right: 4px;
    color: #666;
}
.product-pager > span:first-child b {
    color: #1a73e8;
    font-weight: 600;
}
.product-pager button {
    min-width: 32px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 6px;
    color: #555;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    transition: all 0.15s;
    box-sizing: border-box;
}
.product-pager button:hover:not([disabled]):not(.active) {
    border-color: #1a73e8;
    color: #1a73e8;
}
.product-pager button[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}
.product-pager button.active {
    background: #1a73e8;
    border-color: #1a73e8;
    color: #fff;
    font-weight: 600;
}
.product-pager input[type="number"] {
    width: 58px;
    height: 30px;
    padding: 0 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
    background: #fff;
}
.product-pager input[type="number"]:focus {
    outline: none;
    border-color: #1a73e8;
}
.product-pager #pager-jump-btn {
    min-width: 52px;
}

.floor-filter {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 10px 20px;
    border-bottom: 1px solid #e5e5e5;
    background: #fff;
}
.filter-btn {
    padding: 5px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: #fff;
    color: #666;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}
.filter-btn:hover {
    border-color: #1a73e8;
    color: #1a73e8;
    background: #f0f6ff;
}
.filter-btn.active {
    background: #1a73e8;
    color: #fff;
    border-color: #1a73e8;
}
.filter-btn.extra { opacity: 0.75; font-style: italic; }

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    padding: 16px 20px;
}
.product-card {
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    background: #fff;
    padding: 12px;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
}
.product-card:hover {
    border-color: #1a73e8;
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.1);
    transform: translateY(-2px);
}
.product-card-head { margin-bottom: 8px; }
.product-name {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    line-height: 1.4;
    margin-bottom: 2px;
}
.product-code {
    font-size: 12px;
    color: #999;
}
.product-meta {
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    font-size: 12px;
    color: #666;
}
.product-meta > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #f5f5f5;
    border-radius: 12px;
}
.loc-badge {
    background: #e8f0fe !important;
    color: #1a73e8 !important;
}
.loc-badge .muted { color: #999; }
.exp-badge {
    background: #fff4e5 !important;
    color: #e67e22 !important;
}
.product-card-foot {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px dashed #eee;
}
.product-price {
    font-size: 13px;
    color: #666;
}
.product-price b {
    color: #e74c3c;
    font-size: 16px;
    margin-left: 4px;
}
.plus-btn {
    padding: 6px 14px;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}
.plus-btn:hover { background: #1557b0; }
.plus-btn.in-cart {
    background: #52c41a;
}
.plus-btn.in-cart:hover { background: #389e0d; }

.product-empty {
    padding: 60px 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}
.product-empty i.fa { font-size: 48px; opacity: 0.4; }

/* ---------- 购物车清单（右侧） ---------- */
.purchase-cart-panel {
    position: sticky;
    top: 16px;
    align-self: start;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
/* 让 form 本身也成为 flex 容器，接管剩余空间分配；否则 form 默认 block 会整体溢出 */
.purchase-cart-panel form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
    overflow: hidden;
}
/* 让卡片头部不被压缩 */
.purchase-cart-panel > .card-header { flex-shrink: 0; }
/* 汇总/供应商/提交按钮：不参与剩余空间分配，固定高度，始终可见 */
.purchase-cart-panel .cart-summary,
.purchase-cart-panel .cart-supplier,
.purchase-cart-panel .cart-submit {
    flex-shrink: 0;
}
@media (max-width: 1100px) {
    .purchase-cart-panel { position: static; max-height: none; overflow: visible; }
    .purchase-cart-panel form { display: block; overflow: visible; }
    .purchase-cart-panel .cart-list { max-height: none; overflow: visible; }
}
@media (max-width: 720px) {
    /* 手机端：为整页滚动留出底部按钮空间，避免最后一条被按钮栏覆盖 */
    .purchase-cart-layout.pc-split { padding-bottom: 84px; }
    .purchase-cart-panel .cart-submit.two-btns {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 90;
        background: #fff;
        border-top: 1px solid #e5e5e5;
        border-radius: 0;
        box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
        padding: 10px 12px;
        display: flex;
        gap: 8px;
    }
    .purchase-cart-panel .cart-submit.two-btns .btn { flex: 1; margin: 0; }
}

.cart-list {
    flex: 1 1 auto;
    min-height: 120px;
    overflow-y: auto;
    padding: 12px 16px;
    -webkit-overflow-scrolling: touch;
}
.cart-empty {
    text-align: center;
    color: #999;
    padding: 40px 20px;
}
.cart-empty i.fa {
    font-size: 48px;
    opacity: 0.35;
    margin-bottom: 10px;
}
.cart-empty p { font-size: 15px; margin: 8px 0; color: #666; }
.cart-empty small { font-size: 12px; }

.cart-item {
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    background: #fff;
}
.cart-item-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}
.cart-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    line-height: 1.4;
    flex: 1;
    padding-right: 8px;
}
.cart-item-name small {
    color: #999;
    font-weight: normal;
    font-size: 12px;
    margin-left: 4px;
}
.cart-remove {
    background: transparent;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s;
}
.cart-remove:hover { background: #fde8e8; }

.cart-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}
.cart-item-meta > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #f5f5f5;
    border-radius: 12px;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.qty-control {
    display: inline-flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}
.qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    color: #555;
    transition: background 0.15s;
}
.qty-btn:hover { background: #e0e0e0; color: #222; }
.qty-btn.minus { border-right: 1px solid #ddd; }
.qty-btn.plus { border-left: 1px solid #ddd; }
.qty-input {
    width: 56px;
    height: 28px;
    border: none;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #222;
    background: #fff;
}
.qty-input:focus { outline: none; background: #f0f6ff; }

.price-input-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #666;
}
.price-input {
    width: 80px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-align: right;
    font-size: 13px;
}
.price-input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}

.cart-subtotal {
    font-size: 13px;
    color: #666;
    margin-left: auto;
}
.cart-subtotal b {
    color: #e74c3c;
    font-size: 15px;
    font-weight: 600;
}

.cart-item-extra {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #e5e5e5;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #666;
}
.cart-item-extra input {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
}
.req { color: #dc3545; }

/* ---------- 汇总区 ---------- */
.cart-summary {
    padding: 10px 16px;
    border-top: 1px solid #e5e5e5;
    background: #fafafa;
}
/* 紧凑汇总行：默认只显示一行（种类/数量 + 总计），折叠其他 */
.sum-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-size: 13px;
    color: #666;
}
.sum-compact {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    padding: 4px 0;
}
.sum-compact b { color: #1a73e8; font-weight: 700; margin: 0 2px; }
.sum-total-inline b { color: #e74c3c; font-size: 16px; font-weight: 700; }
.sum-total {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px dashed #ddd;
    font-size: 15px;
    font-weight: bold;
    color: #1a73e8;
}
.sum-row input {
    width: 90px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: right;
    font-size: 13px;
}

/* 折叠按钮：放在汇总区下方 */
.sum-toggle-wrap {
    margin-top: 4px;
    text-align: center;
}
.sum-toggle {
    background: transparent;
    border: none;
    color: #1a73e8;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 4px;
}
.sum-toggle:hover { background: rgba(26, 115, 232, 0.08); }
.sum-toggle i { margin-left: 4px; font-size: 11px; }
.sum-toggle.open i { transform: rotate(180deg); }

/* "更多选项"展开区 —— 默认 JS 里 display:none; 展开后 block */
.sum-extra, .supplier-extra {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px dashed #e5e5e5;
}

/* ---------- 供应商信息 ---------- */
.cart-supplier {
    padding: 10px 16px;
    border-top: 1px solid #e5e5e5;
    background: #fff;
}
.form-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}
.form-row:last-child { margin-bottom: 0; }
.form-row label {
    display: block;
    font-size: 13px;
    color: #555;
    margin-bottom: 6px;
    font-weight: 500;
}
.form-row select,
.form-row input[type="text"],
.form-row input[type="number"],
.form-row input[type="email"],
.form-row input[type="password"],
.form-row input[type="date"],
.form-row textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color .15s;
}
.form-row select:focus,
.form-row input:focus,
.form-row textarea:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26,115,232,.15);
}
.form-row textarea { resize: vertical; }

/* ---------- 提交按钮 ---------- */
.cart-submit {
    padding: 12px 16px;
    border-top: 1px solid #e5e5e5;
    background: #fff;
    border-radius: 0 0 8px 8px;
}
.cart-submit .btn {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
}

/* 清空购物车 / 文本按钮 */
.btn-text-danger {
    padding: 4px 10px;
    border: 1px solid #dc3545;
    color: #dc3545;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}
.btn-text-danger:hover { background: #dc3545; color: #fff; }
.btn-text {
    padding: 4px 10px;
    border: 1px solid #ccc;
    color: #555;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}
.btn-text:hover { background: #f0f0f0; color: #222; }
.btn.secondary {
    background: #fff;
    color: #555;
    border: 1px solid #ccc;
}
.btn.secondary:hover { background: #f0f0f0; color: #222; }

/* ============ 楼层筛选区可折叠 ============ */
.floor-filter-collapsible {
    max-height: 0;
    overflow: hidden;
    padding: 0 20px;
    transition: max-height 0.25s ease, padding 0.25s ease;
}
.floor-filter-collapsible.floor-filter-open {
    max-height: 600px;
    padding: 10px 20px;
    border-bottom: 1px solid #eee;
}

/* ============ 搜索栏小调整 ============ */
.purchase-filter-bar {
    padding: 12px 20px 12px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.purchase-filter-bar input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}
.purchase-filter-bar input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}
.product-count { color: #666; font-size: 13px; }
.product-count b { color: #1a73e8; font-weight: 600; }

/* ============ 两列布局的栅格 ============ */
.purchase-cart-layout.pc-split {
    display: flex;
    gap: 16px;
    margin: 16px;
    padding-bottom: 40px;
}
.purchase-product-panel { 
    position: fixed;
    left: 240px;
    width: calc(53% - 20px);
    margin-bottom: 0;
    z-index: 40;
}
/* 侧边栏收起时，商品库面板的left也要调整 */
body.sidebar-collapsed .purchase-product-panel {
    left: 88px;  /* 64px侧边栏宽度 + 24px间距 */
}
/* 侧边栏收起时，购物车面板保持相对宽度和边距 */
body.sidebar-collapsed .purchase-cart-panel {
    left: calc(53% + 50px);
    width: calc(45% - 20px);  /* 固定宽度，不随main-col变宽 */
}
.purchase-cart-panel {
    top: 0px;
    left: calc(53% + 140px);
    width: calc(40% - 20px);
    max-height: none !important;
    display: block !important;
    overflow: visible !important;
    position: relative;
}
.purchase-cart-panel form {
    display: block !important;
    overflow: visible !important;
}
.cart-list { 
    padding: 12px 16px; 
    min-height: 120px;
}
.two-btns { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid #e5e5e5; }
.two-btns .btn { flex: 1; padding: 10px; font-size: 14px; }

/* ============ 详情页 ============ */
.info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px 20px;
    padding: 8px 0 0;
    font-size: 13px;
    color: #444;
}
.info-grid > div { padding: 6px 0; }
.purchase-view-pc, .purchase-view-cart { margin-top: 16px; }

/* ============ 响应式：手机/平板 ============ */
@media (max-width: 900px) {
    .info-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
    /* 商品库与购物车改单列，购物车优先显示在上方 */
    .purchase-cart-layout.pc-split {
        display: flex;
        flex-direction: column;
        margin: 10px;
        gap: 10px;
        min-height: auto;
    }
    .purchase-product-panel { 
        position: static;
        width: 100%;
        max-width: none;
        max-height: none;
        overflow-y: visible;
        z-index: auto;
    }
    .purchase-cart-panel {
        position: static;
        width: 100%;
        max-height: none;
        overflow-y: visible;
    }
    .cart-list { max-height: 60vh; }

    /* 楼层筛选默认不显示，点击按钮后显示 */
    .floor-filter {
        max-height: 0;
        overflow: hidden;
        padding: 0 20px;
        transition: max-height 0.25s ease, padding 0.25s ease;
    }
    .floor-filter.floor-filter-open {
        max-height: 600px;
        padding: 10px 20px;
    }
    .purchase-filter-bar { padding: 10px 14px; }
    .product-grid {
        grid-template-columns: 1fr 1fr;
        padding: 10px 14px;
        gap: 8px;
    }
    .product-card { padding: 10px; }
    .product-name { font-size: 13px; }
    .product-code { font-size: 11px; }
    .product-meta > span { font-size: 11px; padding: 1px 6px; }
    .plus-btn { padding: 5px 8px; font-size: 12px; }

    /* 购物车条目的小屏优化 */
    .cart-item { padding: 10px; }
    .cart-item-name { font-size: 13px; }
    .cart-item-meta { font-size: 11px; }
    .cart-item-controls { gap: 6px; flex-wrap: wrap; }
    .qty-input { width: 50px; }
    .price-input-wrap label { font-size: 11px; }
    .price-input { width: 72px; padding: 3px 6px; }
    .cart-subtotal { font-size: 12px; width: 100%; text-align: right; }

    .info-grid { grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 12px; }

    /* 列表页小屏 */
    table.table td, table.table th { padding: 6px 8px; font-size: 12px; }
}

/* ============================================================
   零售收银台（POS）
   ============================================================ */
.retail-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 12px;
    min-height: calc(100vh - 60px);
}
.retail-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.retail-left .card {
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
/* 扫码输入框 */
#retail-barcode {
    width: 100%;
    font-size: 18px !important;
    padding: 16px !important;
    border: 2px solid #1a73e8;
    border-radius: 6px;
    box-sizing: border-box;
}
#retail-barcode:focus {
    outline: none;
    border-color: #f57c00;
    box-shadow: 0 0 0 3px rgba(245,124,0,0.15);
}
/* 商品库（卡片网格） */
.product-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 90px;
}
.product-card:hover {
    border-color: #1a73e8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    background: #f5faff;
}
.product-card:active {
    transform: translateY(0);
}
.product-card-name {
    font-weight: bold;
    font-size: 13px;
    line-height: 1.4;
    color: #333;
}
.product-card-code {
    font-size: 11px;
    color: #888;
}
.product-card-price {
    font-size: 16px;
    font-weight: bold;
    color: #d32f2f;
    margin-top: auto;
}
.product-card-stock {
    font-size: 13px;
    color: #555;
    font-weight: 500;
}
.stock-tag {
    font-size: 13px;
    color: #555;
    font-weight: 500;
}
.stock-tag i {
    color: #888;
    margin-right: 3px;
}
.product-card-stock.low { color: #d32f2f; font-weight: bold; }

/* 购物车列表 */
.cart-item {
    padding: 12px;
    border-bottom: 1px solid #eee;
}
.cart-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}
.cart-item-name {
    font-weight: bold;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: space-between;
}
.qty-select {
    width: 80px !important;
    padding: 4px !important;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.item-subtotal {
    font-size: 15px;
    font-weight: bold;
    color: #1a73e8;
    min-width: 80px;
    text-align: right;
}
.remove-btn {
    background: none;
    border: none;
    color: #c62828;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
}
.remove-btn:hover { opacity: 0.7; }

/* 结算区 */
.cart-summary {
    padding: 16px;
    background: #fafafa;
    border-bottom: 1px solid #eee;
}
.sum-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 14px;
}
.sum-total {
    border-top: 2px solid #1a73e8;
    padding-top: 12px;
    margin-top: 8px;
    font-size: 18px !important;
    font-weight: bold !important;
    color: #1a73e8;
}
.cart-submit {
    padding: 16px;
}
/* 客户/付款/账户选择 */
.retail-form-group {
    margin-bottom: 10px;
}
.retail-form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    color: #555;
    font-weight: 500;
}
.retail-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    box-sizing: border-box;
    font-size: 14px;
}
.retail-select:focus {
    outline: none;
    border-color: #1a73e8;
}
.btn-retail-submit {
    width: 100%;
    padding: 14px;
    font-size: 18px;
    background: #f57c00;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
    margin-top: 12px;
}
.btn-retail-submit:hover { background: #e65100; }
.btn-retail-submit:active { background: #bf360c; }

/* 挂起按钮样式（文本按钮） */
.btn-text {
    background: transparent;
    border: 1px solid #ddd;
    color: #555;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}
.btn-text:hover { background: #f5f5f5; border-color: #bbb; }

.btn-text-danger {
    background: transparent;
    border: 1px solid #ffcdd2;
    color: #c62828;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}
.btn-text-danger:hover { background: #ffebee; }

/* 挂起列表弹窗 */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.modal-box {
    background: #fff;
    border-radius: 8px;
    min-width: 420px;
    max-width: 560px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
.modal-title {
    padding: 14px 18px;
    background: #fafafa;
    border-bottom: 1px solid #eee;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 28px;
    height: 28px;
}
.modal-close:hover { color: #333; }
.modal-body { padding: 12px 0; }
.modal-footer { font-size: 12px; color: #888; text-align: center; padding: 10px 16px; background: #fafafa; }

/* 挂起列表条目 */
.suspended-item {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    border-bottom: 1px solid #f0f0f0;
}
.suspended-item:last-child { border-bottom: none; }
.suspended-item:hover { background: #fafafa; }

/* 小屏适配 */
@media (max-width: 1024px) {
    .retail-layout { grid-template-columns: 1fr; }
    .modal-box { min-width: 90vw; max-width: 94vw; }
}
@media (max-width: 420px) {
    .product-grid { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr; }
    .two-btns { flex-direction: column; gap: 8px; }
}

/* ============ 常用功能菜单样式 ============ */
.common-feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    transition: background .15s, color .15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.common-feature-item:hover {
    background: #2c3e50;
    color: #fff;
    text-decoration: none;
}
.common-feature-item i {
    width: 16px;
    text-align: center;
    color: #1a73e8;
    flex-shrink: 0;
}
.common-feature-item:hover i {
    color: #64b5f6;
}


