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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
}

#app {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* 登录页面 */
.login-box {
    max-width: 400px;
    margin: 100px auto;
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.login-box h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.login-box form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-box input {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.login-box button {
    padding: 12px;
    background: #1890ff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.login-box button:hover {
    background: #40a9ff;
}

/* 主界面 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: white;
    border-radius: 8px;
    margin-bottom: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.permission-badge {
    padding: 4px 12px;
    background: #52c41a;
    color: white;
    border-radius: 12px;
    font-size: 12px;
}

.btn-small {
    padding: 6px 12px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.btn-small:hover {
    background: #e0e0e0;
}

.btn-primary {
    padding: 10px 20px;
    background: #1890ff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-primary:hover {
    background: #40a9ff;
}

.btn-primary:disabled {
    background: #d9d9d9;
    cursor: not-allowed;
}

/* 搜索框 */
.search-box {
    display: flex;
    gap: 10px;
    width: 100%;
}

.search-box input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.search-box button {
    padding: 10px 20px;
    background: #1890ff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

/* 单页集成布局 */
.main-layout {
    display: flex;
    gap: 15px;
    height: calc(100vh - 110px);
}

.left-panel {
    width: 64%;
    background: white;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.right-panel {
    width: 36%;
    background: white;
    border-radius: 8px;
    padding: 15px;
    overflow-y: auto;
}

.panel-header {
    padding: 15px;
    border-bottom: 1px solid #e8e8e8;
}

.materials-table-container {
    flex: 1;
    overflow: auto;
}

.materials-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.materials-table th {
    background: #fafafa;
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e8e8e8;
    position: sticky;
    top: 0;
    white-space: nowrap;
}

.materials-table td {
    padding: 8px;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.materials-table tr:hover {
    background: #f5f5f5;
    cursor: pointer;
}

.materials-table tr.selected {
    background: #e6f7ff;
}

/* 详情卡片 */
.detail-card {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    overflow: hidden;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #fafafa;
    border-bottom: 1px solid #e8e8e8;
}

.detail-header h4 {
    margin: 0;
    color: #1890ff;
    font-size: 16px;
}

.detail-actions {
    display: flex;
    gap: 8px;
}

.detail-content {
    padding: 15px;
}

.detail-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.detail-section h5 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 14px;
    padding-left: 8px;
    border-left: 3px solid #1890ff;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-item label {
    color: #666;
    font-size: 12px;
    min-width: 60px;
}

.detail-item span {
    color: #333;
    font-weight: 500;
}

.detail-item input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 12px;
}

.inventory-edit {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inventory-edit input {
    width: 100px;
    padding: 6px 8px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
}

/* 后整理工序区 */
.processes-box {
    border: 1px dashed #d9d9d9;
    border-radius: 4px;
    padding: 10px;
    background: #fafafa;
}

.process-item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.process-item-row input {
    padding: 5px 8px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 12px;
}

.process-item-row .p-name {
    flex: 1;
}

.process-item-row .p-cost {
    width: 90px;
}

/* 报价计算 */
.quote-form-inline {
    background: #fafafa;
    padding: 12px;
    border-radius: 4px;
}

.quote-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.quote-row label {
    font-size: 12px;
    color: #666;
}

.quote-row input {
    width: 70px;
    padding: 5px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 12px;
}

/* 标签预览 */
.label-preview-inline {
    display: flex;
    justify-content: center;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 4px;
}

.label-options-inline {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    align-items: center;
}

.empty-state {
    text-align: center;
    padding: 50px;
    color: #999;
}

/* === Hua Yue 风格标签 === */
.label-huayue {
    width: 340px;
    height: 227px;
    border: 2px solid #000;
    padding: 6px 10px;
    background: #fff;
    font-family: Arial, 'Microsoft YaHei', sans-serif;
    font-size: 11px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    color: #000;
}

.label-huayue .bc-row {
    text-align: center;
    margin-bottom: 2px;
}

.label-huayue .bc-row svg {
    height: 36px;
    width: 100%;
}

.label-huayue .bc-num {
    font-family: 'Courier New', monospace;
    font-size: 10px;
    letter-spacing: 1px;
    text-align: center;
}

.label-huayue .company {
    text-align: center;
    font-weight: bold;
    font-size: 13px;
    border-top: 1px solid #000;
    border-bottom: 1px solid #000;
    padding: 3px 0;
    margin: 3px 0;
}
.label-huayue .company.no-line {
    border-top: none;
}

.label-huayue table {
    width: 100%;
    flex: 1;
    border-collapse: collapse;
}

.label-huayue table td {
    padding: 1px 4px;
    line-height: 17px;
    border-bottom: 1px dotted #bbb;
    vertical-align: middle;
}

.label-huayue table td.k {
    font-weight: bold;
    text-align: left;
    width: 42%;
}

.label-huayue table td.v {
    text-align: right;
    font-weight: 600;
}

.label-huayue .foot {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-top: 3px;
    border-top: 1px solid #000;
    margin-top: 2px;
}

.label-huayue .foot .loc {
    font-size: 9px;
    color: #333;
}

.label-huayue .foot .qr img {
    width: 38px;
    height: 38px;
    display: block;
}

/* === 弹窗 === */
.modal-overlay {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: #fff;
    border-radius: 8px;
    width: 600px;
    max-width: 92%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e8e8e8;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #1890ff;
}

.modal-close {
    font-size: 22px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-body h5 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 14px;
    padding-left: 8px;
    border-left: 3px solid #1890ff;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-field label {
    font-size: 12px;
    color: #666;
}

.form-field input {
    padding: 8px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 13px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #e8e8e8;
}

/* 用户管理 */
.user-mgmt-toolbar {
    margin-bottom: 15px;
}
.user-table {
    width: 100%;
    border-collapse: collapse;
}
.user-table th, .user-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    text-align: left;
    font-size: 13px;
}
.user-table th {
    background: #fafafa;
    font-weight: 600;
    color: #666;
}
.user-table .btn-small {
    margin-right: 5px;
}

/* 打印样式 */
@media print {
    body * {
        visibility: hidden;
    }
    #print-area, #print-area * {
        visibility: visible;
    }
    #print-area {
        position: absolute;
        left: 0;
        top: 0;
        display: block !important;
    }
}
