:root {
    --primary: #1677ff;
    --primary-hover: #4096ff;
    --success: #52c41a;
    --danger: #ff4d4f;
    --text-main: #000000e0;
    --text-sec: #000000a6;
    --bg-color: #f0f2f5;
    --border-color: #d9d9d9;
    --border-light: #f0f0f0;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; padding: 0; font-family: var(--font-family); background: var(--bg-color); color: var(--text-main); font-size: 14px; overflow: hidden;}
input, select, textarea, button { font-family: inherit; font-size: 14px; outline: none; }

.header { height: 56px; background: #001529; color: #fff; display: flex; justify-content: space-between; align-items: center; padding: 0 24px; box-shadow: 0 1px 4px rgba(0,21,41,0.08); z-index: 100; position: relative;}
.logo { font-size: 18px; font-weight: 600; letter-spacing: 1px; margin-right: 40px;}
.header-left { display: flex; align-items: center; }
.header-right { display: flex; align-items: center; gap: 20px; }
.sys-switch { color: #ffffffa6; cursor: pointer; transition: color 0.3s; }
.sys-switch:hover { color: #fff; }
.divider { color: #ffffff40; margin: 0 4px; }
.user-info { display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; background: var(--primary); border-radius: 50%; text-align: center; line-height: 30px; font-weight: 500; }
.user-label { color: rgba(255,255,255,0.65); font-size: 13px; }

.role-switch-wrapper { display: flex; align-items: center; gap: 8px; }
.role-label { color: rgba(255,255,255,0.65); font-size: 13px; }
.role-selector { background: rgba(255, 255, 255, 0.15); border: 1px solid rgba(255, 255, 255, 0.3); color: #fff; padding: 6px 12px; border-radius: 6px; outline: none; cursor: pointer; font-size: 14px; transition: all 0.3s; }
.role-selector:hover { background: rgba(255, 255, 255, 0.25); }
.role-selector option { color: #333; }

.main-layout { display: flex; height: calc(100vh - 56px); }
.sidebar { width: 220px; background: #001529; color: #a6adb4; overflow-y: auto; display: flex; flex-direction: column;}
.nav-item { padding: 14px 24px; cursor: pointer; transition: all 0.3s; display: flex; flex-direction: column;}
.nav-item-title { display: flex; justify-content: space-between; align-items: center; width: 100%;}
.nav-item:hover, .nav-item-title:hover { color: #fff; }
.nav-item.active { background: #1677ff; color: #fff; }
.sub-nav { background: #000c17; display: none;}
.sub-item { padding: 10px 24px 10px 48px; cursor: pointer; transition: color 0.3s; display: flex; justify-content: space-between; align-items: center;}
.sub-item:hover { color: #fff; }
.sub-item.active { color: #fff; background: #1677ff; }
.sub-badge { background: transparent; color: inherit; padding: 0; font-size: 13px;}
.active-badge { color: #fff; font-weight: 600;}

.content { flex: 1; padding: 24px; overflow-y: auto; background-color: var(--bg-color);}
.breadcrumb { color: var(--text-sec); margin-bottom: 20px; font-size: 14px; }
.breadcrumb a { color: var(--text-main); text-decoration: none; cursor: pointer; transition: color 0.3s; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .current { color: var(--text-sec); font-weight: 400;}

.workbench-module-tabs { display: flex; border-bottom: 1px solid var(--border-color); margin-bottom: 0; background: #fff; padding: 0 24px; border-radius: 8px 8px 0 0;}
.wb-tab { padding: 16px 24px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--text-main); font-size: 14px; transition: all 0.3s; margin-bottom: -1px;}
.wb-tab:hover { color: var(--primary); }
.wb-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

.card { background: #fff; border-radius: 8px; padding: 24px; margin-bottom: 24px; box-shadow: 0 1px 2px 0 rgba(0,0,0,0.03), 0 1px 6px -1px rgba(0,0,0,0.02); }
.card-nopad { padding: 0; overflow-x: auto;}

.input-box { border: 1px solid var(--border-color); border-radius: 6px; padding: 4px 11px; height: 32px; width: 100%; transition: all 0.3s; background: #fff; }
.input-box:focus, .input-box:hover { border-color: var(--primary); outline: 0; }
.input-box:focus { box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.1); }
.input-box[readonly], .input-box:disabled { background: #f5f5f5; cursor: not-allowed; color: var(--text-sec); border-color: var(--border-light); }

.input-group { display: flex; align-items: center; width: 100%; }
.input-group .input-box { border-top-right-radius: 0; border-bottom-right-radius: 0; flex: 1; }
.input-group .addon { background: #fafafa; border: 1px solid var(--border-color); border-left: none; padding: 0 11px; height: 32px; line-height: 30px; border-top-right-radius: 6px; border-bottom-right-radius: 6px; color: var(--text-sec); white-space: nowrap; }
textarea.input-box { height: auto; min-height: 80px; resize: vertical; padding: 8px 11px; }

.btn { display: inline-flex; align-items: center; justify-content: center; font-weight: 400; white-space: nowrap; cursor: pointer; transition: all .2s; height: 32px; padding: 4px 15px; font-size: 14px; border-radius: 6px; background: #fff; border: 1px solid var(--border-color); color: var(--text-main); }
.btn:hover { color: var(--primary); border-color: var(--primary); }
.btn-primary { color: #fff; background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { color: #fff; background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #ff7875; border-color: #ff7875; }
.btn-success { color: #fff; background: var(--success); border-color: var(--success); }
.btn-success:hover { background: #73d13d; border-color: #73d13d; }
.btn-reset { margin: 0 8px; }
.btn-icon { padding: 4px 8px; border-radius: 6px; font-size: 16px; line-height: 1; }
.btn:disabled { color: rgba(0,0,0,.25); background: #f5f5f5; border-color: #d9d9d9; cursor: not-allowed; }

.filter-row { display: flex; align-items: center; gap: 24px; margin-bottom: 16px; flex-wrap: wrap;}
.filter-item { display: flex; align-items: center; gap: 12px; }
.filter-item label { color: var(--text-main); white-space: nowrap;}
.filter-actions { flex: 1; text-align: right; display: flex; justify-content: flex-end; align-items: center;}

.table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; min-width: 1200px;}
.table th { background: #fafafa; padding: 16px; border-bottom: 1px solid var(--border-light); color: var(--text-main); font-weight: 500; white-space: nowrap;}
.table td { padding: 16px; border-bottom: 1px solid var(--border-light); transition: background 0.3s; white-space: nowrap;}
.table tr:hover td { background: #fafafa; }
.link-text { color: var(--primary); cursor: pointer; text-decoration: none; transition: color 0.3s; font-weight:500;}
.link-text:hover { color: var(--primary-hover); text-decoration: underline;}

.tag { padding: 2px 8px; border-radius: 4px; font-size: 12px; white-space: nowrap; border: 1px solid; display: inline-block;}
.tag-node { background: #e6f4ff; color: var(--primary); border-color: #91caff; }
.tag-status { background: #fffbe6; color: #faad14; border-color: #ffe58f; }
.tag-gray { background: #fafafa; color: #595959; border-color: #d9d9d9; }
.tag-green { background: #f6ffed; color: #52c41a; border-color: #b7eb8f; }
.tag-device { color: #52c41a; background: #f6ffed; border: 1px solid #b7eb8f; padding: 2px 6px; border-radius: 4px; font-size: 12px;}

.action-menu { position: absolute; background: #fff; border-radius: 8px; box-shadow: 0 6px 16px 0 rgba(0,0,0,0.08); padding: 4px 0; min-width: 100px; display: none; z-index: 1000; border: 1px solid var(--border-light);}
.menu-item { padding: 8px 16px; cursor: pointer; transition: background 0.3s; color: var(--text-main); text-align: center;}
.menu-item:hover { background: #f5f5f5; color: var(--primary); }
.text-danger { color: var(--danger); }
.text-danger:hover { background: #fff1f0; color: var(--danger); }

.section-title { font-size: 16px; font-weight: 600; margin: 0 0 20px 0; display: flex; align-items: center;}
.section-title::before { content: ''; display: inline-block; width: 4px; height: 16px; background: var(--primary); border-radius: 2px; margin-right: 8px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-bottom: 32px;}
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group > label { color: var(--text-main); }
.req { display: flex; align-items: center; white-space: nowrap; }
.req::before { content: '*'; color: var(--danger); font-family: SimSun, sans-serif; margin-right: 4px; font-size: 14px; line-height: 1; margin-top: 3px;}

.sku-tabs { display: flex; gap: 16px; border-bottom: 1px solid var(--border-light); margin-bottom: 24px; padding-bottom: 12px;}
.sku-tab { cursor: pointer; padding: 6px 20px; border: 1px solid var(--border-color); background: #fff; color: var(--text-main); font-size: 14px; border-radius: 16px; transition: all 0.3s; }
.sku-tab:hover { border-color: var(--primary); color: var(--primary); }
.sku-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 500; box-shadow: 0 2px 4px rgba(22, 119, 255, 0.2);}

.sku-cards { display: flex; gap: 16px; margin-bottom: 32px;}
.sku-card { border: 1px solid var(--border-color); padding: 16px; width: 220px; cursor: pointer; border-radius: 8px; transition: all 0.3s; background: #fff;}
.sku-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,0.09); }
.sku-card.active { border-color: var(--primary); background: #e6f4ff; }
.sku-name { font-weight: 600; margin-bottom: 8px; font-size: 16px;}
.sku-desc { color: var(--text-sec); font-size: 12px; }

.dynamic-wrapper { overflow-x: auto; margin-bottom: 32px; border: 1px solid var(--border-light); border-radius: 8px; }
.dt-header { display: grid; gap: 12px; padding: 12px 16px; background: #fafafa; border-bottom: 1px solid var(--border-light); color: var(--text-main); font-weight: 500; align-items: center; }
.dt-row { display: grid; gap: 12px; padding: 16px; border-bottom: 1px solid var(--border-light); align-items: center; transition: background 0.3s; }
.dt-row:hover { background: #fafafa; }
.dt-row:last-child { border-bottom: none; }
.biz-grid { grid-template-columns: 120px 110px 120px 110px minmax(140px, 1fr) 110px 130px 130px 70px 80px; min-width: 1100px;}
.res-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr 80px; min-width: 600px;}
.biz-grid-readonly { grid-template-columns: repeat(9, 1fr); min-width: 1000px;}
.res-grid-readonly { grid-template-columns: repeat(4, 1fr); min-width: 500px;}
.align-center { text-align: center; }
.row-actions { text-align: center; display: flex; gap: 8px; justify-content: center; }

.switch-wrapper { display: flex; justify-content: center; width: 100%;}
.switch-input { display: none; }
.switch-label { position: relative; display: inline-block; width: 44px; height: 22px; line-height: 22px; background-color: #00000040; border-radius: 100px; cursor: pointer; transition: all .2s; margin: 0; }
.switch-label::after { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background-color: #fff; border-radius: 18px; box-shadow: 0 2px 4px 0 rgba(0,35,11,.2); transition: all .2s ease-in-out; content: ""; }
.switch-input:checked + .switch-label { background-color: var(--primary); }
.switch-input:checked + .switch-label::after { left: calc(100% - 20px); }

.bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px;}
.bottom-card { border: 1px solid var(--border-light); border-radius: 8px; overflow: hidden; }
.bc-header { background: #fafafa; padding: 12px 16px; font-weight: 500; border-bottom: 1px solid var(--border-light); }
.bc-body { padding: 16px; background: #fff;}
.upload-tip { color: var(--text-sec); margin-bottom: 12px; font-size: 12px; }
.upload-area { width: 104px; height: 104px; border: 1px dashed var(--border-color); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #fafafa; cursor: pointer; transition: border-color 0.3s; gap: 8px; color: var(--text-sec); }
.upload-area:hover { border-color: var(--primary); color: var(--primary);}
.upload-icon { font-size: 24px; font-weight: 300; line-height: 1;}
.textarea-fix { height: 104px; resize: none; }
.form-footer { border-top: 1px solid var(--border-light); padding-top: 24px; text-align: right; margin-top: 16px; }

.detail-header-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border-light); }
.title-group { display: flex; align-items: center; gap: 12px; }
.title-group h2 { margin: 0; font-size: 18px; font-weight: 600; color: var(--text-main); }
.detail-actions { display: flex; gap: 12px; }
.highlight-bg { background: #fafafa; border-radius: 6px; border: 1px solid var(--border-light); padding: 20px; margin-bottom: 32px; }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 24px; }
.info-item { display: flex; font-size: 14px; }
.info-item label { color: var(--text-sec); width: 80px; flex-shrink: 0; }

.timeline { padding: 0 0 10px 8px; }
.timeline-item { position: relative; padding-left: 24px; padding-bottom: 24px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ''; position: absolute; left: 0; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid #e6f4ff; z-index: 2;}
.timeline-item::after { content: ''; position: absolute; left: 4px; top: 14px; bottom: 0; width: 2px; background: var(--border-light); z-index: 1;}
.timeline-item:last-child::after { display: none; }
.tl-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.tl-user { font-weight: 600; color: var(--text-main); }
.tl-action { color: var(--primary); font-weight: 500; background: #e6f4ff; padding: 2px 8px; border-radius: 4px; font-size: 12px;}
.tl-time { color: var(--text-sec); font-size: 12px; }
.tl-body { background: #fafafa; padding: 12px 16px; border-radius: 6px; border: 1px solid var(--border-light); color: var(--text-main); line-height: 1.5; font-size: 13px;}

.drawer-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 2000; display: none; justify-content: flex-end; }
.drawer-panel { background: #fff; width: 900px; height: 100vh; box-shadow: -6px 0 16px 0 rgba(0,0,0,0.08); display: flex; flex-direction: column; transform: translateX(100%); animation: slideInRight 0.3s forwards; }
@keyframes slideInRight { to { transform: translateX(0); } }
.drawer-header { padding: 16px 24px; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; font-size: 18px; font-weight: 600; }
.drawer-close { cursor: pointer; color: var(--text-sec); font-size: 24px; line-height: 1; transition: color 0.3s;}
.drawer-close:hover { color: var(--danger); }
.drawer-body { flex: 1; padding: 24px; overflow-y: auto; background: #fff;}
.drawer-footer { padding: 16px 24px; border-top: 1px solid var(--border-light); text-align: right; background: #fff; display: flex; justify-content: flex-end; gap: 12px; align-items: center;}

.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 2500; display: none; align-items: center; justify-content: center; }
.modal-box { background: #fff; border-radius: 8px; box-shadow: 0 6px 16px 0 rgba(0,0,0,0.08); display: flex; flex-direction: column; overflow: hidden; animation: modalFadeIn 0.2s ease-out; }
@keyframes modalFadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.modal-header { padding: 16px 24px; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; font-size: 16px; font-weight: 600; }
.modal-close { cursor: pointer; color: var(--text-sec); font-size: 20px; line-height: 1; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 24px; max-height: 70vh; overflow-y: auto; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-light); text-align: right; background: #fafafa; display: flex; justify-content: flex-end; gap: 8px; }
.modal-form-item { margin-bottom: 16px; }
.modal-form-item:last-child { margin-bottom: 0; }
.modal-form-item label { display: block; margin-bottom: 8px; color: var(--text-main); font-weight: 500;}

.formal-form-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px 20px; margin-bottom: 16px; }
.formal-form-grid .full-row { grid-column: span 4; }
.formal-form-grid .half-row { grid-column: span 2; }
.upload-formal { border: 1px dashed var(--border-color); background: #fafafa; border-radius: 6px; padding: 30px; text-align: center; cursor: pointer; transition: 0.3s; margin-top: 8px; color: var(--text-sec);}
.upload-formal:hover { border-color: var(--primary); color: var(--primary); }