*{box-sizing:border-box;margin:0;padding:0}
body{font-family:system-ui,-apple-system,"Segoe UI","Microsoft YaHei",sans-serif;
  background:#f4f6f9;color:#1f2328;font-size:14px;line-height:1.6}
button{font-family:inherit;font-size:13px;cursor:pointer;border:none;background:none}
input,select,textarea{font-family:inherit;font-size:13px;color:#1f2328}

/* 登录 */
.login-wrap{display:flex;align-items:center;justify-content:center;min-height:100vh;background:#eef1f5}
.login-box{width:360px;background:#fff;border:1px solid #e1e5ea;border-radius:12px;padding:32px 28px}
.login-title{font-size:20px;font-weight:600;color:#1a4d8f;text-align:center}
.login-sub{font-size:12px;color:#6b7280;text-align:center;margin:6px 0 24px}
.field{margin-bottom:14px}
.field label{display:block;font-size:12px;color:#57606a;margin-bottom:5px}
.field input,.field select,.field textarea{width:100%;padding:8px 10px;border:1px solid #d5d9e0;
  border-radius:6px;background:#fff;outline:none}
.field input:focus,.field select:focus,.field textarea:focus{border-color:#2563eb}
.btn-primary{background:#1a5fb4;color:#fff;padding:8px 16px;border-radius:6px;font-weight:500}
.btn-primary:hover{background:#164d94}
.btn-primary.full{width:100%;padding:10px;margin-top:6px}
.btn-ghost{background:#fff;color:#57606a;border:1px solid #d5d9e0;padding:7px 14px;border-radius:6px}
.btn-ghost:hover{border-color:#9aa2ad;color:#1f2328}
.btn-sm{padding:4px 10px;border-radius:5px;font-size:12px;border:1px solid #d5d9e0;
  background:#fff;color:#374151;margin-right:5px}
.btn-sm:hover{border-color:#2563eb;color:#2563eb}
.btn-sm.danger:hover{border-color:#d1242f;color:#d1242f}
.btn-sm.ok:hover{border-color:#1a7f37;color:#1a7f37}
.imgprev{margin:4px 0 8px;min-height:24px}
.imgprev img{display:block}
.muted{color:#8b949e;font-size:12px}
.login-tip{margin-top:16px;font-size:11px;color:#8b949e;line-height:1.7;
  background:#f6f8fa;padding:10px;border-radius:6px;border:1px solid #eaeef2}
.err{color:#d1242f;font-size:12px;text-align:center;margin-top:10px;min-height:18px}

/* 布局 */
.topbar{height:52px;background:#fff;border-bottom:1px solid #e1e5ea;display:flex;
  align-items:center;justify-content:space-between;padding:0 20px;position:sticky;top:0;z-index:20}
.brand{font-size:16px;font-weight:600;color:#1a4d8f}
.top-right{display:flex;align-items:center;gap:12px}
.who{font-size:13px;color:#57606a}
.layout{display:flex;min-height:calc(100vh - 52px)}
.sidebar{width:180px;background:#fff;border-right:1px solid #e1e5ea;padding:12px 0;flex-shrink:0}
.nav-item{padding:9px 20px;font-size:13px;color:#57606a;cursor:pointer;border-left:3px solid transparent}
.nav-item:hover{background:#f4f6f9;color:#1f2328}
.nav-item.active{background:#eaf2fd;color:#1a4d8f;border-left-color:#1a5fb4;font-weight:500}
.content{flex:1;padding:20px;overflow-x:auto;min-width:0}

/* 卡片与表格 */
.page-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px;flex-wrap:wrap;gap:10px}
.page-title{font-size:17px;font-weight:600}
.page-desc{font-size:12px;color:#6b7280;margin-top:2px}
.card{background:#fff;border:1px solid #e1e5ea;border-radius:10px;padding:16px;margin-bottom:16px}
.card-title{font-size:14px;font-weight:600;margin-bottom:12px;display:flex;
  align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
table{width:100%;border-collapse:collapse;font-size:13px}
th{background:#f6f8fa;color:#57606a;font-weight:500;text-align:left;padding:9px 10px;
  border-bottom:1px solid #e1e5ea;white-space:nowrap;font-size:12px}
td{padding:9px 10px;border-bottom:1px solid #eef1f4;vertical-align:middle}
tr:hover td{background:#fafbfc}
.empty{text-align:center;color:#8b949e;padding:28px;font-size:13px}
.tbl-wrap{overflow-x:auto}

/* 标签 */
.tag{display:inline-block;padding:2px 8px;border-radius:10px;font-size:11px;font-weight:500;white-space:nowrap}
.t-blue{background:#e6f1fb;color:#185fa5}
.t-green{background:#eaf3de;color:#3b6d11}
.t-amber{background:#faeeda;color:#854f0b}
.t-red{background:#fcebeb;color:#a32d2d}
.t-gray{background:#f1efe8;color:#5f5e5a}
.t-purple{background:#eeedfe;color:#534ab7}

/* 统计卡 */
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px;margin-bottom:16px}
.stat{background:#fff;border:1px solid #e1e5ea;border-radius:10px;padding:14px 16px}
.stat .k{font-size:12px;color:#6b7280}
.stat .v{font-size:22px;font-weight:600;color:#1a4d8f;margin-top:4px;line-height:1.2}
.stat .v.warn{color:#b45309}
.stat .v.red{color:#c0392b}
.stat .v.green{color:#1a7f37}

/* 进度条 */
.bar{height:6px;background:#eef1f4;border-radius:3px;overflow:hidden;min-width:60px}
.bar i{display:block;height:100%;background:#1a5fb4;border-radius:3px}
.bar i.low{background:#d1242f}
.bar i.mid{background:#b45309}

/* 工具条 */
.toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:12px}
.toolbar input,.toolbar select{padding:6px 10px;border:1px solid #d5d9e0;border-radius:6px;background:#fff}
.hint{font-size:12px;color:#6b7280;background:#f6f8fa;border:1px solid #eaeef2;
  padding:8px 12px;border-radius:6px;margin-bottom:12px;line-height:1.7}

/* 弹窗 */
.modal-mask{position:fixed;inset:0;background:rgba(15,23,42,.45);z-index:100;
  display:flex;align-items:center;justify-content:center;padding:20px;overflow:auto}
.modal-box{background:#fff;border-radius:12px;width:560px;max-width:100%;max-height:88vh;
  display:flex;flex-direction:column}
.modal-box.wide{width:1000px}
.modal-head{padding:14px 18px;border-bottom:1px solid #e1e5ea;font-size:15px;font-weight:600;
  display:flex;justify-content:space-between;align-items:center}
.modal-close{font-size:22px;color:#8b949e;cursor:pointer;line-height:1}
.modal-close:hover{color:#1f2328}
.modal-body{padding:18px;overflow-y:auto;flex:1}
.modal-foot{padding:12px 18px;border-top:1px solid #e1e5ea;display:flex;justify-content:flex-end;gap:10px}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:0 14px}
.grid2 .field{margin-bottom:12px}

/* 大按钮: 车间平板/触屏主操作 */
.btn-lg{padding:11px 22px;font-size:15px;font-weight:500;border-radius:7px;
  border:1px solid #d5d9e0;background:#fff;color:#374151;margin-right:6px}
.btn-lg:hover{border-color:#2563eb;color:#2563eb}
.btn-lg.ok{background:#1a7f37;color:#fff;border-color:#1a7f37}
.btn-lg.ok:hover{background:#166b2e;color:#fff}
.btn-lg.warn{background:#b45309;color:#fff;border-color:#b45309}
.btn-lg.warn:hover{background:#92400e;color:#fff}
.btn-lg.danger{color:#c0392b;border-color:#e5c7c7}
.btn-lg.danger:hover{background:#c0392b;color:#fff;border-color:#c0392b}

/* 弹窗内输入放大, 便于触屏操作 */
.modal-body .field input,.modal-body .field select,.modal-body .field textarea{
  font-size:15px;padding:10px}
.modal-body .field label{font-size:13px}

/* 平板 / 小屏适配: 侧边栏改为顶部横向 */
@media (max-width:820px){
  .layout{flex-direction:column}
  .sidebar{width:100%;display:flex;overflow-x:auto;border-right:none;
    border-bottom:1px solid #e1e5ea;padding:0}
  .nav-item{padding:11px 16px;white-space:nowrap;border-left:none;
    border-bottom:2px solid transparent}
  .nav-item.active{border-left:none;border-bottom-color:#1a5fb4;background:#eaf2fd}
  .content{padding:12px}
  .grid2{grid-template-columns:1fr}
  .stats{grid-template-columns:repeat(auto-fit,minmax(120px,1fr))}
  .modal-box{width:100%;max-height:92vh}
}

/* 消息铃铛 */
.bell{position:relative;cursor:pointer;font-size:13px;color:#57606a;padding:6px 10px;
  border:1px solid #d5d9e0;border-radius:6px;user-select:none;white-space:nowrap}
.bell:hover{border-color:#2563eb;color:#2563eb}
.bell .dot{position:absolute;top:-6px;right:-6px;background:#d1242f;color:#fff;
  font-size:11px;min-width:18px;height:18px;line-height:18px;border-radius:9px;
  text-align:center;padding:0 5px;font-weight:600}
.msg-item{padding:10px 12px;border-bottom:1px solid #eef1f4;cursor:pointer}
.msg-item:hover{background:#fafbfc}
.msg-item.unread{background:#f0f6ff}
.msg-item .t{font-size:13px;font-weight:500;display:flex;justify-content:space-between;gap:8px}
.msg-item .c{font-size:12px;color:#57606a;margin-top:3px}
.msg-item .d{font-size:11px;color:#8b949e;margin-top:3px}
.lvl-urgent{color:#c0392b}
.lvl-warn{color:#b45309}
.lvl-info{color:#1a4d8f}
.badge{display:inline-block;padding:1px 7px;border-radius:9px;font-size:11px;font-weight:500}
.b-red{background:#fcebeb;color:#a32d2d}
.b-amber{background:#faeeda;color:#854f0b}
.b-green{background:#eaf3de;color:#3b6d11}
.b-gray{background:#f1efe8;color:#5f5e5a}

/* toast */
.toast{position:fixed;top:70px;left:50%;transform:translateX(-50%);
  background:#1f2328;color:#fff;padding:10px 20px;border-radius:8px;font-size:13px;z-index:200}
.toast.ok{background:#1a7f37}
.toast.err{background:#c0392b}

.tabs{display:flex;gap:4px;border-bottom:1px solid #e1e5ea;margin-bottom:14px}
.tab{padding:7px 14px;font-size:13px;color:#57606a;cursor:pointer;border-bottom:2px solid transparent}
.tab.active{color:#1a4d8f;border-bottom-color:#1a5fb4;font-weight:500}
.row-actions{white-space:nowrap}
.sort-tip{font-size:12px;color:#6b7280;margin-bottom:10px}
.score{font-weight:600;color:#1a4d8f}

/* 工作台任务卡 */
.task-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:12px;margin-top:12px}
.task-card{display:flex;align-items:center;gap:14px;padding:14px 16px;border-radius:10px;cursor:pointer}
.task-card:hover{opacity:.88}
.tc-num{font-size:26px;line-height:1;min-width:52px;text-align:center;font-weight:500}
.tc-body{flex:1;min-width:0}
.tc-title{font-size:14px;font-weight:500;margin-bottom:3px}
.tc-desc{font-size:12px;color:#57606a;line-height:1.55}
.tc-go{font-size:12px;color:#57606a;white-space:nowrap}

/* 列表搜索框(自动挂在卡片标题右侧) */
/* margin-left:auto 让搜索框独占右侧, 标题旁的按钮不会被 space-between 甩到中间 */
.tbl-flt{display:inline-flex;align-items:center;gap:8px;font-weight:400;margin-left:auto}
.tbl-flt input{border:1px solid #d8dee4;border-radius:6px;padding:4px 10px;font-size:12px;
  width:170px;outline:none;font-family:inherit;color:#1f2328}
.tbl-flt input:focus{border-color:#1a5fb4;box-shadow:0 0 0 2px rgba(26,95,180,.12)}
.tbl-flt .flt-n{font-size:11px;color:#6b7280;white-space:nowrap;min-width:52px}

/* 机台占用日历(工序排产) */
.gantt th,.gantt td{padding:3px 4px;text-align:center;font-size:11px;white-space:nowrap}
.gantt td:first-child,.gantt th:first-child{text-align:left;position:sticky;left:0;background:#fff;
  font-weight:500;min-width:78px}
.gcell{background:#e6f1fb;color:#185fa5;border-radius:4px;font-weight:500}
.gcell.busy{background:#fff3d1;color:#8a6100}
.gcell.over{background:#fcebeb;color:#a32d2d;font-weight:700}
