/* 前台算料页面样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background: #f0f2f5;
    color: #333;
    font-size: 14px;
}

/* 顶栏 */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    background: #1f2d3d; color: #fff; padding: 0 28px; height: 56px;
    position: sticky; top: 0; z-index: 10;
}
.topbar .brand { font-size: 18px; font-weight: bold; }
.topbar nav a {
    color: #b8c2cc; text-decoration: none; margin-left: 22px; padding: 6px 4px;
}
.topbar nav a:hover, .topbar nav a.active { color: #fff; border-bottom: 2px solid #4c8dff; }

/* 布局 */
.workspace {
    display: flex; flex-direction: column; gap: 16px;
    max-width: 95%; margin: 18px auto; padding: 0 18px;
}
.workspace [hidden] { display: none !important; }
.panel {
    background: #fff; border-radius: 10px; padding: 22px;
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
}
/* 创建订单：竖排卡片 */
.order-compact { width: 100%; max-width: 560px; margin: 30px auto; padding: 26px 30px; }
.order-compact h2 { font-size: 17px; margin-bottom: 16px; }
.order-compact .form-line { flex-direction: column; gap: 14px; margin-bottom: 0; }
.order-compact .form-line .field { min-width: 100%; }
.order-compact .field-btn label { display: none; }
.order-compact .btn-group { display: flex; gap: 8px; }
.order-compact .btn-group .btn { flex: 1; }
.btn-group { display: flex; gap: 6px; }
.panel h2 { font-size: 17px; margin-bottom: 14px; }
.panel h3 { font-size: 15px; margin: 18px 0 10px; }
.desc { color: #888; font-size: 13px; margin: 0 0 10px; }
.placeholder { color: #aaa; text-align: center; padding: 50px 0; font-size: 15px; }

/* 行内表单布局（同行显示的字段） */
.form-line {
    display: flex; flex-wrap: wrap; gap: 14px 18px; margin-bottom: 14px;
}
.form-line .field { flex: 1; min-width: 210px; }
.form-line .field-btn { flex: 0 0 auto; min-width: 0; }
.field label { display: block; margin-bottom: 6px; color: #444; font-size: 13px; }
.field label em { font-style: normal; color: #999; font-size: 12px; }
.field input[type=text], .field input[type=number], .field select {
    width: 100%; padding: 8px 10px; border: 1px solid #d5dbe3; border-radius: 6px;
    font-size: 14px; background: #fff; outline: none;
}
/* 打开订单弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-mask[hidden] { display: none !important; }
.modal { background: #fff; border-radius: 10px; padding: 18px 20px; width: 440px; max-width: 92vw; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.modal h3 { margin: 0 0 12px; font-size: 16px; }
.open-list { max-height: 300px; overflow: auto; display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.open-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid #e3e7ec; border-radius: 6px; font-size: 14px; }
.open-item .oi-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.open-item .oi-time { color: #999; font-size: 12px; white-space: nowrap; }
.oi-acts { display: flex; gap: 6px; }
.oi-btn { padding: 3px 12px; font-size: 12px; border: 1px solid #cdd6e4; background: #fff; border-radius: 5px; color: #2f6fed; cursor: pointer; white-space: nowrap; }
.oi-btn:hover { border-color: #2f6fed; background: #eef4ff; }
.oi-btn.del { color: #e03131; border-color: #f1c1c1; background: transparent; }
.oi-btn.del:hover { border-color: #e03131; background: #fff1f1; }
.oi-tag { font-style: normal; font-size: 11px; padding: 1px 6px; border-radius: 4px; margin-right: 6px; }
.oi-tag.file { background: #e8f2ff; color: #2f6fed; }
.oi-tag.ls { background: #f0f0f0; color: #888; }
.open-empty { color: #999; text-align: center; padding: 20px 0; font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.field input:focus, .field select:focus { border-color: #2f6fed; }
.field .fixed-input { background: #f5f6f8; color: #777; }
.badge {
    display: inline-block; background: #fff3e0; color: #e67e22; border: 1px solid #f5cba7;
    font-size: 11px; padding: 1px 6px; border-radius: 10px; vertical-align: 1px;
}
.req { color: #e74c3c; }
.form-actions { margin-top: 16px; display: flex; gap: 10px; }
.divider {
    text-align: center; color: #aaa; font-size: 13px; margin: 20px 0 14px;
    display: flex; align-items: center; gap: 12px;
}
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px dashed #d5dbe3; }

/* 开关控件 */
.switch-wrap { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.switch { position: relative; display: inline-block; width: 46px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute; cursor: pointer; inset: 0; background: #cfd6de;
    border-radius: 24px; transition: .2s;
}
.switch .slider::before {
    content: ''; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
    background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: #2f6fed; }
.switch input:checked + .slider::before { transform: translateX(22px); }
.switch-text { color: #888; font-size: 12px; }

/* 单选框组 */
.radio-group { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 0; }
.radio-item { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-size: 14px; }
.radio-item input { width: 15px; height: 15px; accent-color: #2f6fed; }

/* 按钮 */
.btn {
    display: inline-block; padding: 9px 22px; border: 1px solid #d5dbe3; border-radius: 6px;
    background: #fff; cursor: pointer; font-size: 14px; color: #444; white-space: nowrap;
}
.btn:hover { border-color: #9db9e8; }
.btn-primary { background: #2f6fed; border-color: #2f6fed; color: #fff; }
.btn-primary:hover { background: #1f5cd8; }
.btn-danger { color: #e03131; background: transparent; border-color: transparent; }
.btn-danger:hover { background: #fdecec; border-color: transparent; }
.btn-editing { color: #2f6fed; border-color: #9db9e8; background: #eef4ff; }
.btn-sm { padding: 4px 12px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* 订单信息栏（紧凑型） */
.order-bar {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 8px; padding: 8px 16px;
    background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.order-info { display: flex; flex-wrap: wrap; gap: 4px; }
.order-file-info { display: flex; flex-wrap: wrap; gap: 4px; }
.order-actions { display: flex; gap: 6px; }
.chip {
    display: inline-block; background: #f2f5f9; border-radius: 12px; padding: 3px 10px;
    font-size: 12px; color: #555;
}
.chip b { color: #222; }

/* 两栏布局 */
.work-grid {
    display: grid;
    grid-template-columns: minmax(320px, 420px) 1fr;
    gap: 16px;
    align-items: start;
}
.add-panel { position: sticky; top: 72px; max-height: calc(100vh - 90px); overflow-y: auto; }
.right-column { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.product-list-panel { min-height: 200px; }

/* 产品项（保留兼容） */
.item { border: 1px solid #e3e7ec; border-radius: 8px; margin-top: 10px; background: #fff; }
.item:first-child { margin-top: 4px; }
.item-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px; gap: 10px; flex-wrap: wrap;
}
.item-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }

/* 明细区（产品列表下方） */
.detail-section {
    overflow-x: auto;
}
.detail-section .data-table { min-width: 620px; }
.detail-item { padding: 14px 0; border-bottom: 1px solid #eef1f5; }
.detail-item:last-child { border-bottom: none; padding-bottom: 0; }
.detail-item:first-child { padding-top: 0; }
.detail-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.detail-toolbar h2 { margin: 0; }
.switch-all { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #555; cursor: pointer; user-select: none; }
.detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0; cursor: pointer; border-radius: 6px; padding: 4px 6px; transition: background .15s; }
.detail-header:hover { background: #f5f8fb; }
.detail-item.open .detail-header { margin-bottom: 14px; }
.detail-arrow { display: inline-block; width: 14px; color: #888; font-size: 12px; }
.detail-body > h3 { margin-top: 0; }
.detail-header h3 { margin: 0; font-size: 15px; }
.detail-params { display: flex; flex-wrap: wrap; gap: 5px; }
.detail-head-right { display: flex; align-items: center; gap: 10px; }

/* 产品表格 */
.room-table { width: 100%; border-collapse: collapse; }
.room-table th {
    background: #f5f7fa; padding: 8px 10px; text-align: left;
    font-size: 13px; color: #555; font-weight: 600;
    border-bottom: 2px solid #e3e7ec;
}
.room-table td {
    padding: 9px 10px; border-bottom: 1px solid #eef1f5; font-size: 13px;
}
.room-table tbody tr { cursor: pointer; transition: background .12s; }
.room-table tbody tr:hover { background: #f8fbff; }
.room-table tbody tr.selected { background: #eef4ff; box-shadow: inset 3px 0 0 #2f6fed; }
.room-table .row-actions { display: flex; gap: 4px; }

/* 明细区（保留兼容） */
.detail-panel { margin-top: 0; overflow-x: auto; }
.detail-panel .data-table { min-width: 720px; }

/* 订单文件保存状态 */
.save-status { font-size: 12px; color: #999; margin-left: 4px; }
.save-status.saved { color: #1a7f37; }
.save-status.unsaved { color: #b45309; font-weight: bold; }

/* 产品项（保留兼容） */
.item { border: 1px solid #e3e7ec; border-radius: 8px; margin-top: 10px; background: #fff; }
.item:first-child { margin-top: 4px; }
.item-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px; gap: 10px; flex-wrap: wrap;
}
.item-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.caret-btn {
    border: none; background: none; cursor: pointer; font-size: 13px; color: #2f6fed;
    padding: 2px 4px;
}
.param-echo-inline { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.chip-sm {
    display: inline-block; background: #f2f5f9; border-radius: 10px; padding: 2px 8px;
    font-size: 11px; color: #666;
}
.item-actions { display: flex; gap: 6px; }
.item-detail { padding: 0 14px 14px; overflow-x: auto; }
.item-detail .data-table { min-width: 620px; }

/* 表格 */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
    border: 1px solid #e3e7ec; padding: 8px 10px; text-align: center; font-size: 13px;
}
.data-table th { background: #f5f7fa; color: #555; font-weight: 600; }
.data-table tbody tr:nth-child(even) { background: #fafbfc; }

.footer { text-align: center; color: #aaa; font-size: 12px; padding: 26px 0; }

/* 响应式 */
@media (max-width: 1200px) {
    .work-grid { grid-template-columns: minmax(280px, 380px) 1fr; }
}
@media (max-width: 960px) {
    .work-grid { grid-template-columns: 1fr; }
    .add-panel { position: static; max-height: none; }
    .form-line .field { min-width: 100%; }
    .room-table { font-size: 12px; }
}
@media (max-width: 640px) {
    .workspace { padding: 0 10px; }
    .order-bar { flex-direction: column; align-items: flex-start; }
    .order-compact .field { min-width: 100%; }
}

/* 打印 */
@media print {
    body { background: #fff; }
    .no-print { display: none !important; }
    .workspace { margin: 0; padding: 0; max-width: none; }
    .work-grid { display: block; }
    .add-panel { box-shadow: none; }
    .detail-section { display: block !important; border-top: none; }
    .detail-body { display: block !important; }
    .product-list-panel { page-break-before: always; }
    .panel { box-shadow: none; border: none; }
    .room-table tbody tr.selected { box-shadow: none; }
    .data-table th { background: #eee !important; -webkit-print-color-adjust: exact; }
}
