/* ==================== 全局重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}

body {
    background: #f0f2f5;
    font-size: 14px;
    color: #333;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ==================== 顶部标题区域 ==================== */
.topbar {
    height: 60px;
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.topbar .logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar .logo h1 {
    color: #fff;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 2px;
}

.topbar .logo .icon {
    font-size: 28px;
}

.topbar .user-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar .user-area .welcome {
    color: rgba(255,255,255,0.9);
    font-size: 14px;
}

.topbar .user-area .username {
    color: #fff;
    font-weight: 600;
    font-size: 15px;
}

.topbar .user-area .logout-btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 13px;
    transition: background 0.3s;
}

.topbar .user-area .logout-btn:hover {
    background: rgba(255,255,255,0.35);
}

/* ==================== 左侧菜单 ==================== */
.sidebar {
    width: 220px;
    background: #001529;
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 40px;
    overflow-y: auto;
    transition: width 0.3s;
    z-index: 999;
}

.sidebar .menu-group {
    margin-bottom: 4px;
}

.sidebar .menu-title {
    padding: 14px 20px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.3s;
    letter-spacing: 1px;
}

.sidebar .menu-title:hover {
    background: #1a73e8;
}

.sidebar .menu-title .arrow {
    font-size: 12px;
    transition: transform 0.3s;
}

.sidebar .menu-title.expanded .arrow {
    transform: rotate(90deg);
}

.sidebar .submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    background: #000c17;
}

.sidebar .submenu.expanded {
    max-height: 500px;
}

.sidebar .submenu a {
    display: block;
    padding: 11px 20px 11px 40px;
    color: rgba(255,255,255,0.65);
    font-size: 13px;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar .submenu a:hover {
    color: #fff;
    background: rgba(26,115,232,0.15);
    border-left-color: #1a73e8;
}

.sidebar .submenu a.active {
    color: #fff;
    background: #1a73e8;
    border-left-color: #fff;
}

/* ==================== 主内容区域 ==================== */
.main-content {
    margin-left: 220px;
    margin-top: 60px;
    margin-bottom: 40px;
    padding: 20px;
    min-height: calc(100vh - 100px);
    transition: margin-left 0.3s;
}

/* 面包屑导航 */
.breadcrumb {
    background: #fff;
    padding: 12px 20px;
    border-radius: 6px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    font-size: 14px;
    color: #666;
}

.breadcrumb strong {
    color: #1a73e8;
}

/* 内容盒子 */
.content-box {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    padding: 24px;
    min-height: 300px;
}

.content-box h3 {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f2f5;
    color: #333;
}

.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #999;
    font-size: 16px;
    border: 2px dashed #e8e8e8;
    border-radius: 8px;
    background: #fafafa;
}

/* ==================== 底部声明 ==================== */
.footer {
    height: 40px;
    background: #fff;
    border-top: 1px solid #e8e8e8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #999;
    position: fixed;
    bottom: 0;
    left: 220px;
    right: 0;
    z-index: 998;
    transition: left 0.3s;
}

/* ==================== 响应式布局 ==================== */
@media (max-width: 768px) {
    .sidebar {
        width: 0;
        overflow: hidden;
    }

    .sidebar.mobile-open {
        width: 220px;
    }

    .main-content {
        margin-left: 0;
    }

    .footer {
        left: 0;
    }

    .topbar .logo h1 {
        font-size: 16px;
    }

    .topbar .user-area .welcome {
        display: none;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 12px;
    }

    .content-box {
        padding: 16px;
    }

    .topbar {
        padding: 0 12px;
    }
}

/* ==================== 表单表格 ==================== */
.form-table {
    margin-top: 16px;
}

.form-table table {
    width: 100%;
    max-width: 640px;
    border-collapse: collapse;
}

.form-table td {
    padding: 10px 8px;
    vertical-align: middle;
}

.form-table td.label {
    width: 120px;
    text-align: right;
    font-weight: 500;
    color: #444;
    white-space: nowrap;
}

.form-table input[type="text"],
.form-table input[type="number"],
.form-table textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.form-table textarea {
    resize: vertical;
    min-height: 80px;
}

.form-table input:focus,
.form-table textarea:focus {
    outline: none;
    border-color: #2563eb;
}

.submit-btn,
.reset-btn {
    padding: 9px 28px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    margin-right: 12px;
}

.submit-btn {
    background: #2563eb;
    color: #fff;
}

.submit-btn:hover {
    background: #1d4ed8;
}

.reset-btn {
    background: #e2e8f0;
    color: #333;
}

.reset-btn:hover {
    background: #cbd5e1;
}

.error-msg {
    background: #fee;
    color: #c33;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.error-msg ul {
    margin-left: 20px;
}

.success-msg {
    background: #efe;
    color: #2e7d32;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.success-msg a {
    color: #2563eb;
    margin-left: 8px;
}

/* ==================== 搜索栏 ==================== */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-bar input[type="text"] {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    width: 240px;
}

.add-btn {
    padding: 9px 18px;
    background: #22c55e;
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    margin-left: auto;
}

.add-btn:hover {
    background: #16a34a;
}

/* ==================== 数据表格 ==================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-top: 8px;
}

.data-table th,
.data-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #e8e8e8;
}

.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.data-table th a {
    color: #333;
}

.data-table th a:hover {
    color: #2563eb;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table .addr-cell {
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-tip {
    text-align: center;
    color: #999;
    padding: 40px 0;
}

/* 操作按钮 */
.action-cell {
    white-space: nowrap;
}

.btn-edit,
.btn-delete {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
    margin-right: 6px;
}

.btn-edit {
    background: #2563eb;
    color: #fff;
}

.btn-edit:hover {
    background: #1d4ed8;
}

.btn-delete {
    background: #ef4444;
    color: #fff;
}

.btn-delete:hover {
    background: #dc2626;
}

/* 响应式 */
@media (max-width: 768px) {
    .data-table {
        font-size: 13px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 6px;
    }

    .search-bar input[type="text"] {
        width: 100%;
    }

    .add-btn {
        margin-left: 0;
        width: 100%;
        text-align: center;
    }
}

/* ==================== 下拉选择 ==================== */
select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    min-width: 180px;
}

select:focus {
    outline: none;
    border-color: #2563eb;
}

/* 表格内操作按钮换行处理 */
.data-table .action-cell {
    white-space: nowrap;
    min-width: 100px;
}

/* 数字对齐 */
.data-table td:nth-child(5),
.data-table td:nth-child(6),
.data-table td:nth-child(7),
.data-table td:nth-child(8) {
    text-align: right;
    padding-right: 20px;
}

/* 商品列表表格 */
.goods-table-wrap {
    margin-top: 18px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.data-table.goods-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 14px;
}

.data-table.goods-table th,
.data-table.goods-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
    color: #111827;
}

.data-table.goods-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}

.data-table.goods-table tr:last-child td {
    border-bottom: none;
}

.data-table.goods-table tr:hover td {
    background: #f8fafc;
}

/* 列宽分配 */
.data-table.goods-table th:nth-child(1),
.data-table.goods-table td:nth-child(1) { width: 14%; text-align: left; }

.data-table.goods-table th:nth-child(2),
.data-table.goods-table td:nth-child(2) { width: 12%; text-align: left; }

.data-table.goods-table th:nth-child(3),
.data-table.goods-table td:nth-child(3) { width: 10%; text-align: left; }

.data-table.goods-table th:nth-child(4),
.data-table.goods-table td:nth-child(4) { width: 7%; text-align: center; }

.data-table.goods-table th:nth-child(5),
.data-table.goods-table td:nth-child(5) { width: 9%; text-align: right; }

.data-table.goods-table th:nth-child(6),
.data-table.goods-table td:nth-child(6) { width: 9%; text-align: right; }

.data-table.goods-table th:nth-child(7),
.data-table.goods-table td:nth-child(7) { width: 8%; text-align: right; }

.data-table.goods-table th:nth-child(8),
.data-table.goods-table td:nth-child(8) { width: 8%; text-align: center; }

.data-table.goods-table th:nth-child(9),
.data-table.goods-table td:nth-child(9) { width: 13%; text-align: center; }

/* 操作按钮区 */
.data-table.goods-table .action-cell {
    white-space: nowrap;
}

.data-table.goods-table .action-cell a {
    display: inline-block;
    margin: 0 3px;
}

/* 搜索区分隔线/间距 */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 16px;
    margin-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.search-bar input[type="text"],
.search-bar select {
    height: 36px;
    padding: 0 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}

.search-bar input[type="text"] {
    width: 220px;
}

.search-bar select {
    min-width: 160px;
}

.search-bar button {
    height: 36px;
    padding: 0 18px;
    border: none;
    border-radius: 6px;
    background: #2563eb;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.search-bar button:hover {
    background: #1d4ed8;
}