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

body {
    font-family: -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.navbar {
    background: #1a73e8;
    color: #fff;
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 56px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.navbar .brand {
    font-size: 18px;
    font-weight: 600;
    margin-right: 40px;
    text-decoration: none;
    color: #fff;
}
.navbar a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 16px 16px;
    font-size: 14px;
    transition: color 0.2s;
}
.navbar a:hover, .navbar a.active {
    color: #fff;
    border-bottom: 2px solid #fff;
}

.container {
    max-width: 1100px;
    margin: 24px auto;
    padding: 0 16px;
}

.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 24px;
    margin-bottom: 20px;
}
.card h2 {
    font-size: 18px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}
.tab-btn {
    padding: 10px 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 15px;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab-btn.active {
    color: #1a73e8;
    border-bottom-color: #1a73e8;
    font-weight: 500;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Forms */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #555;
}
.form-group input, .form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}
.form-group input[type="checkbox"], .form-group input[type="radio"] {
    width: auto;
    margin-right: 6px;
    vertical-align: middle;
}
.form-group input:focus {
    border-color: #1a73e8;
    outline: none;
    box-shadow: 0 0 0 2px rgba(26,115,232,0.15);
}
.form-row {
    display: flex;
    gap: 16px;
}
.form-row .form-group { flex: 1; }

.btn {
    display: inline-block;
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.btn-primary { background: #1a73e8; color: #fff; }
.btn-primary:hover { background: #1557b0; }
.btn-success { background: #34a853; color: #fff; }
.btn-success:hover { background: #2d8f47; }
.btn-danger { background: #ea4335; color: #fff; }
.btn-danger:hover { background: #c5221f; }
.btn-secondary { background: #f1f3f4; color: #333; }
.btn-secondary:hover { background: #e0e0e0; }
.btn-sm { padding: 4px 12px; font-size: 13px; }

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success { background: #e6f4ea; color: #1e7e34; border: 1px solid #b7e1cd; }
.alert-error { background: #fce8e6; color: #c5221f; border: 1px solid #f5c6c2; }
.alert-warning { background: #fef7e0; color: #b06000; border: 1px solid #fde293; }

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}
th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    font-size: 13px;
}
tr:hover { background: #f8f9fa; }

/* File upload */
.file-upload {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}
.file-upload:hover { border-color: #1a73e8; }
.file-upload input[type="file"] { display: none; }
.file-upload .label {
    color: #666;
    font-size: 14px;
}
.file-upload .label strong { color: #1a73e8; }

/* Search results dropdown */
.search-results {
    position: absolute;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    width: 100%;
}
.search-results .item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}
.search-results .item:hover { background: #e8f0fe; }
.search-results .item .no { color: #1a73e8; font-weight: 500; }
.search-results .item .name { margin-left: 8px; }
.search-results .empty { padding: 12px; color: #999; text-align: center; }

/* Badge */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}
.badge-active { background: #e6f4ea; color: #1e7e34; }
.badge-inactive { background: #f1f3f4; color: #999; }

/* Result summary */
.summary-cards {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}
.summary-card {
    flex: 1;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}
.summary-card .value {
    font-size: 28px;
    font-weight: 700;
    color: #1a73e8;
}
.summary-card .label {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    width: 500px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
}
.modal h3 {
    margin-bottom: 16px;
    font-size: 16px;
}

.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }

/* ---- 品类 Tabs ---- */
.tab-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}
.tab-btn {
    padding: 8px 20px;
    border-radius: 6px 6px 0 0;
    text-decoration: none;
    color: #555;
    background: #f5f5f5;
    margin-bottom: -2px;
    font-size: 14px;
    transition: background 0.15s;
}
.tab-btn:hover { background: #e8e8e8; color: #333; }
.tab-btn.active {
    background: #fff;
    color: #1a73e8;
    border: 2px solid #e0e0e0;
    border-bottom: 2px solid #fff;
    font-weight: 600;
}

/* ---- 阶梯价格编辑器 ---- */
.price-tiers {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px;
    margin: 12px 0;
}
.tier-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 6px;
    font-size: 13px;
}
.tier-table th {
    text-align: left;
    padding: 4px 8px;
    color: #666;
    font-weight: 500;
    border-bottom: 1px solid #ddd;
}
.tier-table td { padding: 4px 8px; }
.tier-table input {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

/* ---- 供应商分区（编辑弹窗） ---- */
.supplier-block {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 12px;
    background: #fafafa;
}
.supplier-block-header {
    font-weight: 600;
    font-size: 13px;
    color: #1a73e8;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e8e8e8;
}

/* ---- 列表中的供应商摘要 ---- */
.supplier-summary {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 4px 0;
    font-size: 12px;
    border-bottom: 1px dashed #eee;
}
.supplier-summary:last-child { border-bottom: none; }
.sup-name { font-weight: 600; color: #333; }
.sup-contact { color: #888; }
.sup-tiers { color: #1a73e8; font-size: 11px; }

/* ==================== 升级后新增样式 ==================== */

/* 导航右侧 + 用户下拉 */
.navbar { justify-content: flex-start; }
.nav-right { margin-left: auto; position: relative; }
.user-menu { position: relative; }
.user-menu-btn {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}
.user-menu-btn:hover { background: rgba(255,255,255,0.22); }
.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 180px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    overflow: hidden;
    z-index: 100;
}
.user-dropdown.open { display: block; }
.user-dropdown a {
    display: block;
    padding: 10px 16px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    border-bottom: none;
}
.user-dropdown a:hover { background: #f0f4f9; color: #1a73e8; border-bottom: none; }
.user-dropdown .divider { height: 1px; background: #eee; }
.badge {
    background: #ff6b35; color: #fff;
    padding: 1px 6px; border-radius: 3px;
    font-size: 11px; margin-left: 4px;
}

/* 子导航 */
.subnav { display: flex; margin-left: 24px; }
.subnav a {
    color: rgba(255,255,255,0.82);
    text-decoration: none;
    padding: 16px 14px;
    font-size: 14px;
}
.subnav a:hover, .subnav a.active {
    color: #fff;
    border-bottom: 2px solid #fff;
}

/* 登录页（未登录无 56px 导航栏，需撑满整个视口） */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    /* 负边距：纵向抵消 .container 的 24px 上下外边距，横向突破 1100px 最大宽度铺满视口 */
    margin: -24px calc(50% - 50vw) -24px;
    padding: 24px;
}
.login-card {
    background: #fff;
    padding: 36px 32px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%; max-width: 380px;
}
.login-card h2 { margin-bottom: 4px; text-align: center; }
.login-sub { color: #888; text-align: center; margin-bottom: 24px; font-size: 14px; }
.btn-block { width: 100%; margin-top: 8px; }

/* 九宫格 */
.home-hero { margin-bottom: 24px; }
.home-hero h1 { font-size: 22px; margin-bottom: 4px; }
.home-hero p { color: #666; }
.grid-modules {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.module-card {
    background: #fff;
    border-radius: 10px;
    padding: 24px 20px;
    text-decoration: none;
    color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.15s, box-shadow 0.15s;
    display: block;
    border: 1px solid transparent;
}
.module-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26,115,232,0.18);
    border-color: #1a73e8;
}
.module-icon { font-size: 40px; margin-bottom: 8px; }
.module-name { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.module-desc { color: #888; font-size: 13px; }
.module-card.admin-card { background: linear-gradient(135deg, #fff 0%, #fef5ea 100%); }

/* 权限模块勾选 */
.module-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
    margin-top: 6px;
}
.module-checkbox {
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}
.module-checkbox:hover { border-color: #1a73e8; }
.module-checkbox.disabled { color: #bbb; background: #fafafa; cursor: not-allowed; }

/* 模块授权分组（用户表单） */
.module-group {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 8px;
    padding: 0 10px 10px;
}
.module-group > summary {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 2px;
    user-select: none;
}
.module-group-title { font-weight: 600; }
.module-group-all {
    margin-left: auto;
    font-size: 13px;
    font-weight: normal;
    color: #555;
    cursor: pointer;
}
.module-group-subtitle {
    font-size: 13px;
    color: #888;
    margin: 6px 2px 2px;
}
.module-group-disabled > summary { color: #999; }

/* 表格通用 */
.data-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.data-table th, .data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    text-align: left;
    font-size: 14px;
}
.data-table th { background: #f8f9fa; font-weight: 600; }
.tag {
    display: inline-block;
    padding: 2px 8px;
    background: #eef2f7;
    border-radius: 4px;
    font-size: 12px;
    margin-right: 4px;
}
.tag-green { background: #e6f4ea; color: #137333; }
.tag-grey { background: #eee; color: #888; }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn-danger { background: #d93025; color: #fff; border: none; }
.hint { color: #888; font-size: 13px; margin-bottom: 8px; }
