:root{
  --navy:#1F4E79;
  --blue:#4472C4;
  --blue-soft:#EDF2F9;
  --line:#D6DCE4;
  --line-soft:#E8EDF3;
  --text:#262626;
  --muted:#7A8794;
  --bg:#F4F6F9;
  --white:#fff;
  --ok:#2E7D32;
  --danger:#C0392B;
  --hl:#FFF9E6;
  --radius:8px;
  --shadow:0 1px 2px rgba(16,36,58,.06),0 8px 24px rgba(16,36,58,.06);
}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;padding:0}
body{
  background:var(--bg);
  color:var(--text);
  font-family:"Microsoft YaHei","PingFang SC","Hiragino Sans GB",system-ui,-apple-system,"Segoe UI",sans-serif;
  font-size:14px;line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,p{margin:0}
button,input,select,textarea{font-family:inherit;font-size:inherit;color:inherit}

/* ---------- 顶栏 ---------- */
.topbar{
  background:var(--navy);
  color:#fff;
  padding:14px 24px;
  display:flex;align-items:center;justify-content:space-between;gap:20px;
  flex-wrap:wrap;
  box-shadow:0 2px 10px rgba(16,36,58,.18);
  position:sticky;top:0;z-index:50;
}
.brand{display:flex;align-items:center;gap:12px;min-width:0}
.logo{
  width:38px;height:38px;border-radius:9px;flex:0 0 auto;
  background:linear-gradient(135deg,#5B8FD6,#2C5F9E);
  display:flex;align-items:center;justify-content:center;
  font-size:19px;font-weight:700;letter-spacing:0;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.18);
}
.brand-text h1{font-size:16px;font-weight:600;letter-spacing:.3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.brand-text p{font-size:11px;opacity:.62;letter-spacing:.5px;margin-top:1px}

.tabs{display:flex;gap:4px;background:rgba(255,255,255,.10);padding:4px;border-radius:9px}
.tab{
  border:0;background:transparent;color:rgba(255,255,255,.78);
  padding:7px 16px;border-radius:6px;cursor:pointer;font-size:13.5px;
  transition:.16s;white-space:nowrap;display:flex;align-items:center;gap:6px;
}
.tab:hover{color:#fff;background:rgba(255,255,255,.08)}
.tab.active{background:#fff;color:var(--navy);font-weight:600;box-shadow:0 1px 4px rgba(0,0,0,.14)}
.badge{
  min-width:18px;height:18px;padding:0 5px;border-radius:9px;
  background:rgba(255,255,255,.22);color:#fff;
  font-size:11px;line-height:18px;text-align:center;font-weight:600;
}
.tab.active .badge{background:var(--blue);color:#fff}

/* ---------- 容器 ---------- */
.wrap{max-width:1360px;margin:0 auto;padding:20px 24px 60px}
.view{display:none;animation:fade .18s ease}
.view.active{display:block}
@keyframes fade{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}

/* ---------- 录入表 ---------- */
.sheet{
  background:#fff;border:1px solid var(--line-soft);border-radius:var(--radius);
  box-shadow:var(--shadow);overflow:hidden;max-width:1040px;margin:0 auto;
}
.sheet-title{
  background:var(--navy);color:#fff;padding:16px 20px;
  display:flex;align-items:baseline;justify-content:space-between;gap:16px;flex-wrap:wrap;
}
.sheet-title span{font-size:17px;font-weight:600;letter-spacing:.5px}
.sheet-title small{font-size:11.5px;opacity:.62;font-weight:400}

.sec-bar{
  background:var(--blue);color:#fff;font-size:12.5px;font-weight:600;
  letter-spacing:.4px;padding:7px 14px;
}

.grid{
  display:grid;
  grid-template-columns:150px minmax(0,1fr) 178px minmax(0,1fr);
  border-bottom:1px solid var(--line-soft);
}
.grid:last-child{border-bottom:0}
.flabel{
  background:var(--blue-soft);
  border-right:1px solid var(--line);
  border-bottom:1px solid var(--line);
  padding:10px 12px;
  font-size:12.5px;color:#3B4A5A;
  display:flex;align-items:center;gap:3px;
  min-height:44px;
}
.req{color:#D64541;font-style:normal;font-weight:700}
.finput{
  border:0;border-bottom:1px solid var(--line);border-right:1px solid var(--line);
  padding:9px 12px;background:#fff;width:100%;min-width:0;
  outline:none;transition:.14s;border-radius:0;
  min-height:44px;
}
.finput:last-child{border-right:0}
.finput:focus{background:#F6F9FF;box-shadow:inset 0 -2px 0 var(--blue)}
.finput::placeholder{color:#B4BEC9}
select.finput{appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237A8794' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center;padding-right:30px;cursor:pointer}
textarea.finput{resize:vertical;min-height:96px;line-height:1.6;padding-top:10px}
.span2{grid-column:span 2}
.span3{grid-column:span 3}
.span4{grid-column:span 4}

/* 复选框 */
.chk-wrap{display:flex;gap:34px;padding:12px 16px;border-bottom:1px solid var(--line);align-items:center;flex-wrap:wrap}
.chk{display:inline-flex;align-items:center;gap:9px;cursor:pointer;user-select:none;padding:2px 0}
.chk input{position:absolute;opacity:0;width:0;height:0}
.chk .box{
  width:18px;height:18px;border:1.6px solid #9BAAB8;border-radius:3px;
  background:#fff;flex:0 0 auto;position:relative;transition:.14s;
}
.chk .box::after{
  content:"";position:absolute;left:5px;top:1px;width:5px;height:10px;
  border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg) scale(0);
  transition:.14s;
}
.chk input:checked + .box{background:var(--blue);border-color:var(--blue)}
.chk input:checked + .box::after{transform:rotate(45deg) scale(1)}
.chk input:focus-visible + .box{box-shadow:0 0 0 3px rgba(68,114,196,.25)}
.chk-label{font-size:13.5px;line-height:1.4}

.chk-grid{grid-template-columns:1fr 1fr;gap:0}
.chk-grid .chk{
  padding:11px 16px;border-bottom:1px solid var(--line);border-right:1px solid var(--line);
  height:100%;margin:0;
}
.chk-grid .chk:nth-child(2n){border-right:0}

.actions{
  display:flex;align-items:center;gap:10px;
  padding:14px 20px;background:#FAFBFD;border-top:1px solid var(--line-soft);
  flex-wrap:wrap;
}
.hint{font-size:12px;color:var(--muted);margin-left:4px}
.hint.ok{color:var(--ok);font-weight:600}

/* ---------- 按钮 ---------- */
.btn{
  border:1px solid var(--line);background:#fff;color:#33465A;
  padding:8px 20px;border-radius:6px;cursor:pointer;
  font-size:13.5px;transition:.14s;white-space:nowrap;
}
.btn:hover:not(:disabled){border-color:#B7C4D3;background:#F7F9FC}
.btn:active:not(:disabled){transform:translateY(1px)}
.btn:disabled{opacity:.42;cursor:not-allowed}
.btn-primary{background:var(--blue);border-color:var(--blue);color:#fff;font-weight:600}
.btn-primary:hover:not(:disabled){background:#3A64B0;border-color:#3A64B0}
.btn-danger{color:var(--danger);border-color:#E3C3BE}
.btn-danger:hover:not(:disabled){background:#FDF2F0;border-color:#D9A9A2}
.btn-ghost{background:transparent}
.btn-sm{padding:6px 13px;font-size:12.5px}

/* ---------- 工具栏 ---------- */
.toolbar{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  flex-wrap:wrap;margin-bottom:10px;
}
.btn-group{display:flex;gap:6px;flex-wrap:wrap}
.toolbar-right{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.search{
  border:1px solid var(--line);border-radius:6px;padding:6px 12px;
  font-size:12.5px;width:210px;outline:none;background:#fff;transition:.14s;
}
.search:focus{border-color:var(--blue);box-shadow:0 0 0 3px rgba(68,114,196,.14)}
.notice{
  font-size:12px;color:var(--muted);margin:0 0 10px;padding-left:2px;
  border-left:2px solid var(--blue);padding:5px 10px;background:#F7F9FD;border-radius:0 4px 4px 0;
}
.notice.editing{color:#8A5B00;background:#FFF8E6;border-left-color:#E0A800}
.notice.err{color:#A3241A;background:#FDF2F0;border-left-color:#C0392B;font-weight:600}
.btn.saving{opacity:.75;cursor:wait}
.btn.on{background:#EAF0FA;border-color:#9DB6E4;color:#1F4E79}

/* ---------- 数据表 ---------- */
.table-wrap{
  background:#fff;border:1px solid var(--line-soft);border-radius:var(--radius);
  box-shadow:var(--shadow);overflow:auto;max-height:calc(100vh - 190px);
}
.dt{border-collapse:separate;border-spacing:0;width:max-content;min-width:100%;font-size:12.5px}
.dt thead th{
  position:sticky;top:0;z-index:20;
  background:var(--blue);color:#fff;font-weight:600;
  padding:9px 10px;text-align:left;vertical-align:middle;
  border-right:1px solid rgba(255,255,255,.16);
  white-space:normal;line-height:1.32;
  min-width:120px;
}
.dt thead th .en{display:block;font-size:12px}
.dt thead th .cn{display:block;font-size:10.5px;opacity:.78;margin-top:2px}
.dt thead th.col-idx{min-width:52px;text-align:center;left:0;z-index:22}
.dt thead th.col-model{left:52px;z-index:22}

.dt tbody td{
  padding:8px 10px;border-bottom:1px solid var(--line-soft);
  border-right:1px solid #F0F3F7;
  vertical-align:middle;background:#fff;
  max-width:280px;
}
.dt tbody tr:hover td{background:#F8FAFD}
.dt tbody tr.selected td{background:#EFF5FF}
.dt tbody tr.editing td{background:var(--hl)}
.dt tbody tr.editing:hover td{background:var(--hl)}
.dt td.col-idx{
  position:sticky;left:0;z-index:12;text-align:center;
  font-weight:600;color:var(--navy);background:#F7F9FC;
}
.dt td.col-model{
  position:sticky;left:52px;z-index:11;font-weight:600;
  color:#1B3350;background:#FCFDFF;white-space:nowrap;
}
.dt tbody tr.selected td.col-model{background:#E7EFFC}
.dt tbody tr.editing td.col-model{background:#FFF4D6}
.dt tbody tr:hover td.col-idx{background:#F2F6FB}
.dt td.flag{text-align:center;color:var(--blue);font-weight:700;min-width:0}
.dt td.comment{min-width:220px;white-space:normal;color:#5A6875}
.dt td .cell-input{
  width:100%;border:1px solid var(--blue);border-radius:4px;
  padding:5px 7px;font-size:12.5px;outline:none;background:#fff;
  min-width:90px;
}
.dt td .cell-input:focus{box-shadow:0 0 0 2px rgba(68,114,196,.18)}
.dt td .cell-check{width:16px;height:16px;accent-color:var(--blue);cursor:pointer}

.empty{padding:56px 20px;text-align:center;color:var(--muted);font-size:13px}

/* ---------- 移动端卡片 ---------- */
.cards{display:none;flex-direction:column;gap:12px}
.card{
  background:#fff;border:1px solid var(--line-soft);border-radius:var(--radius);
  box-shadow:var(--shadow);overflow:hidden;
}
.card.sel{outline:2px solid var(--blue);outline-offset:-2px}
.card.editing{outline:2px solid #E0A800;outline-offset:-2px}
.card-head{
  display:flex;align-items:center;gap:8px;
  padding:11px 14px;background:#F5F8FC;border-bottom:1px solid var(--line-soft);
}
.card-seq{
  width:24px;height:24px;border-radius:6px;background:var(--navy);color:#fff;
  font-size:12px;font-weight:700;display:flex;align-items:center;justify-content:center;flex:0 0 auto;
}
.card-model{font-weight:700;font-size:14px;color:#1B3350;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.card-cust{font-size:12px;color:var(--muted);flex:0 0 auto}
.card-body{padding:4px 14px 12px}
.card-row{display:flex;gap:10px;padding:7px 0;border-bottom:1px dashed #EEF2F6;font-size:12.5px}
.card-row:last-child{border-bottom:0}
.card-row dt{flex:0 0 96px;color:var(--muted);margin:0}
.card-row dd{flex:1;margin:0;color:#2C3A47;word-break:break-word}
.card-row input{width:100%;border:1px solid var(--line);border-radius:4px;padding:5px 8px;font-size:12.5px;outline:none}
.card-row input:focus{border-color:var(--blue)}
.card-flags{display:flex;flex-wrap:wrap;gap:5px;margin-top:8px}
.tag{background:#EAF0FA;color:#31558C;border-radius:4px;padding:2px 8px;font-size:11.5px}
.card-actions{display:flex;gap:8px;margin-top:10px}

/* ---------- 弹窗 & Toast ---------- */
.modal-mask{
  position:fixed;inset:0;background:rgba(16,32,48,.45);
  display:none;align-items:center;justify-content:center;z-index:100;padding:20px;
  backdrop-filter:blur(2px);
}
.modal-mask.show{display:flex}
.modal{
  background:#fff;border-radius:12px;padding:24px;width:100%;max-width:360px;
  box-shadow:0 20px 60px rgba(0,0,0,.24);
}
.modal h3{font-size:16px;margin-bottom:6px;color:var(--navy)}
.modal p{font-size:12.5px;color:var(--muted);margin-bottom:14px}
.modal .finput{border:1px solid var(--line);border-radius:6px;margin-bottom:14px}
/* 口令框：用 CSS 圆点掩码代替 type="password"，避免浏览器弹出「保存密码」询问 */
.masked{-webkit-text-security:disc;text-security:disc;letter-spacing:.14em}
.modal-actions{display:flex;justify-content:flex-end}
.gate-err{color:var(--danger);font-size:12px;min-height:16px;margin:8px 0 0}

.toast{
  position:fixed;left:50%;bottom:34px;transform:translate(-50%,16px);
  background:rgba(24,40,58,.94);color:#fff;padding:10px 20px;border-radius:8px;
  font-size:13px;opacity:0;pointer-events:none;transition:.24s;z-index:200;
  max-width:calc(100vw - 40px);text-align:center;
}
.toast.show{opacity:1;transform:translate(-50%,0)}
.toast.err{background:rgba(176,52,40,.96)}
.toast.ok{background:rgba(37,110,58,.96)}

/* ---------- 提示条 ---------- */
.noscript,.file-warn{
  background:#FFF4E5;color:#8A5300;border-bottom:1px solid #F0D3A6;
  padding:10px 20px;font-size:13px;text-align:center;
}
.file-warn a{color:#1F4E79;font-weight:600}

/* ---------- 响应式 ---------- */
@media (max-width:1000px){
  .grid{grid-template-columns:132px minmax(0,1fr) 150px minmax(0,1fr)}
}
@media (max-width:900px){
  .table-wrap{display:none}
  .cards{display:flex}
  .toolbar-right .search{width:100%}
  .toolbar-right{width:100%}
  .search{flex:1}
}
@media (max-width:760px){
  .topbar{padding:11px 14px;gap:10px}
  .brand-text h1{font-size:14px;white-space:normal}
  .brand-text p{display:none}
  .wrap{padding:12px 12px 40px}
  .grid{grid-template-columns:1fr}
  .flabel{border-right:0;padding:8px 12px;min-height:0;background:var(--blue-soft)}
  .finput{border-right:0;min-height:42px}
  .span2,.span3,.span4{grid-column:span 1}
  .chk-grid{grid-template-columns:1fr}
  .chk-grid .chk{border-right:0}
  .sheet-title span{font-size:15px}
  .sheet-title small{display:none}
  .tabs{width:100%}
  .tab{flex:1;justify-content:center}
  .table-wrap{max-height:none}
}
