/* ===== LN2-CBMS 全局样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #1565c0; --primary-dark: #0d47a1; --primary-light: #e3f2fd;
  --bg: #f4f6f9; --card: #fff; --border: #dde3ea; --text: #263238; --text2: #607d8b;
  --green: #2e7d32; --orange: #ef6c00; --red: #c62828;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
}
html, body { height: 100%; }
body { font-family: "Microsoft YaHei", "PingFang SC", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
#app { height: 100%; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 13px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; outline: none; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(21,101,192,.12); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c3ccd6; border-radius: 4px; }

/* ===== 按钮体系 ===== */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text); font-size: 13px; transition: all .15s; white-space: nowrap; }
.btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--red); border-color: #ffcdd2; }
.btn.danger:hover { background: #ffebee; border-color: var(--red); }
.btn.warn { color: var(--orange); }
.btn.sm { padding: 4px 9px; font-size: 12px; border-radius: 5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; justify-content: center; }

/* ===== 登录页 ===== */
.login-wrap { min-height: 100%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0d47a1 0%, #1976d2 50%, #0288d1 100%); }
.login-card { width: 380px; background: #fff; border-radius: 14px; padding: 38px 36px 30px; box-shadow: 0 18px 50px rgba(0,0,0,.3); }
.login-card .logo { text-align: center; font-size: 42px; }
.login-card h1 { text-align: center; font-size: 19px; margin: 8px 0 4px; }
.login-card .sub { text-align: center; color: var(--text2); font-size: 12px; margin-bottom: 26px; }
.login-card .field { margin-bottom: 16px; }
.login-card label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; }
.login-card input { width: 100%; padding: 10px 12px; }
.login-card .btn { width: 100%; padding: 11px; font-size: 15px; margin-top: 6px; }
.login-tip { margin-top: 16px; text-align: center; color: var(--text2); font-size: 12px; }

/* ===== 应用框架 ===== */
.app-shell { display: flex; flex-direction: column; height: 100%; }
.topbar { height: 54px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 16px; gap: 14px; flex: none; z-index: 20; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: bold; color: var(--primary); white-space: nowrap; }
.brand .ic { font-size: 22px; }
.global-search { flex: 1; max-width: 520px; display: flex; }
.global-search input { flex: 1; border-radius: 6px 0 0 6px; border-right: none; }
.global-search .btn { border-radius: 0 6px 6px 0; }
.scan-ind { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text2); padding: 5px 10px; border: 1px dashed var(--border); border-radius: 20px; white-space: nowrap; }
.scan-ind .dot { width: 8px; height: 8px; border-radius: 50%; background: #90a4ae; }
.scan-ind.on .dot { background: var(--green); animation: pulse 2s infinite; }
.scan-ind.busy .dot { background: var(--orange); }
@keyframes pulse { 50% { opacity: .35; } }
.nav-menu { display: flex; gap: 4px; margin-left: auto; }
.nav-menu a { padding: 7px 13px; border-radius: 6px; color: var(--text2); text-decoration: none; font-size: 13px; }
.nav-menu a.router-link-active, .nav-menu a:hover { background: var(--primary-light); color: var(--primary); }
.user-zone { display: flex; align-items: center; gap: 10px; padding-left: 12px; border-left: 1px solid var(--border); }
.user-zone .uname { font-size: 13px; }
.user-zone .role { font-size: 11px; color: #fff; background: var(--primary); border-radius: 4px; padding: 1px 6px; }
.view-container { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

/* ===== 主界面（三栏） ===== */
.main-layout { display: flex; flex: 1; overflow: hidden; }
.sidebar { width: 232px; flex: none; background: #fff; border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.tank-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border-bottom: 1px solid var(--border); }
.tank-tab { padding: 5px 12px; border-radius: 16px; border: 1px solid var(--border); background: #fff; font-size: 13px; color: var(--text2); }
.tank-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.rack-list { flex: 1; overflow-y: auto; padding: 6px 8px 12px; }
.rack-item { margin-bottom: 2px; }
.rack-head { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.rack-head:hover { background: var(--bg); }
.rack-head .arr { color: var(--text2); font-size: 10px; transition: transform .15s; width: 10px; }
.rack-head.open .arr { transform: rotate(90deg); }
.rack-head .cnt { margin-left: auto; font-size: 11px; color: var(--text2); background: var(--bg); border-radius: 10px; padding: 1px 8px; }
.layer-list { padding-left: 16px; }
.layer-row { padding: 4px 6px; border-radius: 6px; }
.layer-row:hover { background: var(--bg); }
.layer-row .lr-head { display: flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 3px 4px; color: var(--text2); }
.layer-row .lr-head .cnt { font-size: 11px; }
.box-chips { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 4px 6px 18px; }
.box-chip { font-size: 12px; padding: 3px 10px; border-radius: 5px; border: 1px solid var(--border); background: #fff; position: relative; }
.box-chip:hover { border-color: var(--primary); }
.box-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.box-chip.full { border-style: dashed; color: var(--text2); }
.box-chip .mini { font-size: 10px; opacity: .8; margin-left: 3px; }
.box-chip.add { border-style: dashed; color: var(--text2); }

/* 中部网格区 */
.grid-area { flex: 1; display: flex; flex-direction: column; overflow: auto; padding: 14px 18px; min-width: 0; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text2); margin-bottom: 10px; flex-wrap: wrap; }
.crumbs b { color: var(--text); font-size: 14px; }
.crumbs .sep { color: #b0bec5; }
.crumbs .crumb-btn { cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.crumbs .crumb-btn:hover { background: var(--primary-light); color: var(--primary); }
.mode-banner { padding: 8px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.mode-banner.move { background: #fff3e0; color: var(--orange); border: 1px solid #ffe0b2; }
.mode-banner.swap { background: #ede7f6; color: #5e35b1; border: 1px solid #d1c4e9; }
.grid-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.grid-toolbar .spacer { flex: 1; }
.occ-stat { font-size: 12px; color: var(--text2); }

.box-grid-wrap { display: inline-block; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px; box-shadow: var(--shadow); }
.grid-corner { width: 26px; }
.grid-col-head, .grid-row-head { color: var(--text2); font-size: 12px; text-align: center; }
.box-grid { display: grid; gap: 3px; }
.cell { width: 52px; height: 52px; border: 1px solid var(--border); border-radius: 5px; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; position: relative; overflow: hidden; transition: transform .08s; }
.cell:hover { border-color: var(--primary); transform: scale(1.06); z-index: 2; }
.cell .nm { font-size: 10.5px; font-weight: 600; line-height: 1.15; max-width: 100%; padding: 0 2px; }
.cell .dt { font-size: 9px; opacity: .75; }
.cell.empty { background: repeating-linear-gradient(45deg, #fafbfc, #fafbfc 6px, #f3f5f8 6px, #f3f5f8 12px); }
.cell.stored { color: #fff; border: none; }
.cell.taken { opacity: .55; }
.cell.taken .nm { text-decoration: line-through; }
.cell.ghost { background: repeating-linear-gradient(45deg, #fff, #fff 6px, #f5f5f5 6px, #f5f5f5 12px) !important; color: #888 !important; }
.cell.selected { outline: 3px solid var(--primary); outline-offset: 1px; z-index: 3; }
.cell.flash { animation: flashcell .5s ease-in-out 6; z-index: 4; }
@keyframes flashcell { 50% { outline: 4px solid var(--red); transform: scale(1.12); box-shadow: 0 0 18px rgba(198,40,40,.65); } }
.cell.badge::after { content: "取"; position: absolute; top: 1px; right: 2px; font-size: 9px; background: var(--red); color: #fff; border-radius: 3px; padding: 0 3px; }

.legend-bar { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text2); }
.legend-bar .lg { display: inline-flex; align-items: center; gap: 4px; }
.legend-bar .sw { width: 12px; height: 12px; border-radius: 3px; }

/* 右侧详情面板 */
.detail-panel { width: 300px; flex: none; background: #fff; border-left: 1px solid var(--border); overflow-y: auto; padding: 14px; }
.dp-title { font-size: 13px; color: var(--text2); display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.dp-pos { font-size: 15px; font-weight: bold; color: var(--primary); background: var(--primary-light); padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; word-break: break-all; }
.kv { display: grid; grid-template-columns: 68px 1fr; gap: 5px 8px; font-size: 13px; margin-bottom: 12px; }
.kv .k { color: var(--text2); }
.kv .v { word-break: break-all; }
.status-tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 10px; color: #fff; }
.status-tag.stored { background: var(--green); } .status-tag.taken { background: var(--orange); }
.status-tag.used { background: #616161; } .status-tag.discarded { background: #9e9e9e; }
.dp-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dp-empty { color: var(--text2); font-size: 13px; text-align: center; padding: 26px 8px; }
.dp-hint { color: var(--text2); font-size: 12px; line-height: 1.7; background: var(--bg); border-radius: 8px; padding: 10px; margin-top: 10px; }

/* ===== 模态框 ===== */
.modal-mask { position: fixed; inset: 0; background: rgba(38,50,56,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal { background: #fff; border-radius: 12px; width: 560px; max-width: 96vw; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: 860px; }
.modal-head { display: flex; align-items: center; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 15px; flex: 1; }
.modal-close { border: none; background: none; font-size: 20px; color: var(--text2); line-height: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 13px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 14px; }
.form-item label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 5px; }
.form-item input, .form-item select { width: 100%; }
.form-item input[type="text"] { min-width: 0; }
.name-preview { grid-column: 1 / -1; background: #0d47a1; color: #fff; border-radius: 8px; padding: 10px 14px; }
.name-preview .lb { font-size: 11px; opacity: .75; margin-bottom: 3px; display: flex; justify-content: space-between; }
.name-preview .nm { font-size: 17px; font-weight: bold; font-family: Consolas, monospace; letter-spacing: .5px; word-break: break-all; }
.name-preview .nm.err { font-size: 13px; color: #ffcc80; }
.type-radio { display: flex; gap: 6px; flex-wrap: wrap; }
.type-radio .tr { padding: 6px 14px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: #fff; }
.type-radio .tr.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.parse-box { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; background: var(--bg); padding: 8px 10px; border-radius: 8px; }
.parse-box input { flex: 1; }
.form-full { grid-column: 1 / -1; }
.checkbox-row { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text2); }

/* ===== 表格与通用页 ===== */
.page { padding: 18px 22px; overflow-y: auto; flex: 1; }
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h2 { font-size: 17px; }
.page-head .spacer { flex: 1; }
.card { background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; padding: 9px 12px; background: #f7f9fb; color: var(--text2); font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 8px 12px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
.tbl tr:hover td { background: #f8fafd; }
.tbl tr.clickable { cursor: pointer; }
.tbl .mono { font-family: Consolas, monospace; }
.tbl .pos-cell { color: var(--primary); }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding: 10px; font-size: 13px; color: var(--text2); }
.empty-tip { text-align: center; color: var(--text2); padding: 42px 0; font-size: 13px; }
.badge { font-size: 11px; padding: 1px 8px; border-radius: 10px; background: var(--bg); color: var(--text2); }

/* 搜索页 */
.search-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.search-bar input { flex: 1; font-size: 14px; padding: 10px 14px; }
.filters { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.filters .frow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.filters .frow + .frow { margin-top: 10px; }
.filters label { color: var(--text2); }
.filters select, .filters input { padding: 5px 8px; }
.batch-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--primary-light); border-radius: 8px; margin-bottom: 10px; font-size: 13px; }

/* 仪表盘 */
.dash-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.dcard { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); }
.dcard .num { font-size: 26px; font-weight: bold; color: var(--primary); }
.dcard .lbl { font-size: 12px; color: var(--text2); margin-top: 2px; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dash-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.dash-card h3 { font-size: 14px; margin-bottom: 12px; }
.hm-tank { margin-bottom: 12px; }
.hm-tank .tn { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.hm-wrap { display: flex; gap: 10px; flex-wrap: wrap; }
.hm-rack .rl { font-size: 11px; color: var(--text2); text-align: center; margin-bottom: 3px; }
.hm-layers { display: flex; flex-direction: column; gap: 3px; }
.hm-cell { width: 34px; height: 16px; border-radius: 3px; font-size: 9px; color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.hbar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 12px; }
.hbar-row .lb { width: 70px; text-align: right; color: var(--text2); flex: none; }
.hbar-row .bar { height: 16px; border-radius: 4px; background: var(--primary); min-width: 2px; }
.hbar-row .n { color: var(--text2); }
.mt-row { display: flex; align-items: flex-end; gap: 5px; height: 90px; padding-top: 6px; }
.mt-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; height: 100%; }
.mt-col .bar { width: 70%; background: #90caf9; border-radius: 3px 3px 0 0; }
.mt-col .bar.t { background: #ffcc80; }
.mt-col .ml { font-size: 9px; color: var(--text2); transform: scale(.85); white-space: nowrap; }

/* 管理页 tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs .tab { padding: 8px 18px; font-size: 14px; color: var(--text2); border: none; background: none; border-bottom: 2px solid transparent; border-radius: 6px 6px 0 0; }
.tabs .tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.color-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.color-row input[type="color"] { width: 34px; height: 26px; padding: 1px; border-radius: 4px; cursor: pointer; }
.color-row .cn { width: 90px; }
.import-report { max-height: 260px; overflow-y: auto; background: #fff8f0; border: 1px solid #ffe0b2; border-radius: 8px; padding: 10px 14px; font-size: 12.5px; margin-top: 10px; }
.import-report .er { color: var(--red); padding: 2px 0; }
.import-report .ok { color: var(--green); }

/* toast */
.toast-wrap { position: fixed; top: 66px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #37474f; color: #fff; padding: 11px 16px; border-radius: 8px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 420px; animation: slidein .2s; word-break: break-all; }
.toast.success { background: var(--green); } .toast.error { background: var(--red); }
.toast.warn { background: var(--orange); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }

@media (max-width: 1100px) {
  .detail-panel { width: 250px; }
  .dash-grid { grid-template-columns: 1fr; }
}

/* ===== 2.3 归还模式横幅（黄绿色调） ===== */
.mode-banner.return { background: #f1f8e9; color: #558b2f; border: 1px solid #dcedc8; }

/* ===== 2.6 同源弱提示 ===== */
.same-hint { grid-column: 1 / -1; font-size: 12px; color: var(--text2); background: var(--bg); border-radius: 6px; padding: 6px 10px; }

/* ===== 2.12 扫码指示器可点击（打开测试面板） ===== */
.scan-ind { cursor: pointer; transition: border-color .15s, color .15s; }
.scan-ind:hover { border-color: var(--primary); color: var(--primary); }

/* ===== 2.12 扫码测试面板：按键流展示 ===== */
.scan-test-keys { font-family: Consolas, monospace; font-size: 13px; background: var(--bg); border-radius: 8px; padding: 10px 12px; min-height: 64px; max-height: 180px; overflow-y: auto; word-break: break-all; line-height: 2; }
.scan-test-keys .gap-mark { color: var(--red); font-weight: bold; }
.scan-test-keys i { font-style: normal; color: var(--text2); font-size: 11px; }
.scan-test-done { margin-top: 10px; padding: 8px 12px; background: var(--primary-light); border-radius: 8px; font-family: Consolas, monospace; font-size: 14px; word-break: break-all; }
