* { box-sizing: border-box; }
body { margin: 0; font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
       background: #f4f6f9; color: #222; }
.hidden { display: none !important; }

/* 登录 */
#login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { width: 320px; background: #fff; padding: 32px 28px; border-radius: 10px;
             box-shadow: 0 6px 24px rgba(0,0,0,.1); text-align: center; }
.login-box h1 { font-size: 20px; margin: 0 0 20px; color: #1a5fb4; }
.login-box input { width: 100%; padding: 10px; margin-bottom: 12px; border: 1px solid #ccc;
                   border-radius: 6px; font-size: 14px; }
.btn-primary { background: #1a5fb4; color: #fff; border: none; padding: 10px 18px;
               border-radius: 6px; cursor: pointer; font-size: 14px; }
.btn-primary:hover { background: #15509a; }
.msg { margin-top: 10px; font-size: 13px; color: #c0392b; min-height: 18px; }

/* 顶部栏 */
header { display: flex; align-items: center; gap: 20px; background: #1a5fb4; color: #fff;
         padding: 0 20px; height: 52px; }
.brand { font-size: 16px; font-weight: bold; white-space: nowrap; cursor: pointer; }
nav { display: flex; gap: 4px; flex: 1; }
nav .tab { background: transparent; color: #dbe7f7; border: none; padding: 8px 14px;
           border-radius: 6px 6px 0 0; cursor: pointer; font-size: 14px; }
nav .tab.active { background: #f4f6f9; color: #1a5fb4; font-weight: bold; }
.user-box { display: flex; align-items: center; gap: 10px; font-size: 13px; position: relative; }
.user-name { white-space: nowrap; cursor: pointer; padding: 6px 10px; border-radius: 5px;
             background: rgba(255,255,255,.16); }
.user-name:hover { background: rgba(255,255,255,.32); }
.btn { background: #fff; color: #1a5fb4; border: 1px solid #1a5fb4; padding: 5px 12px;
       border-radius: 5px; cursor: pointer; font-size: 13px; }
.btn-danger { background: #fff; color: #c0392b; border: 1px solid #c0392b; padding: 5px 12px;
              border-radius: 5px; cursor: pointer; font-size: 13px; }
.btn-danger:hover { background: #c0392b; color: #fff; }
#user-label { white-space: nowrap; }

.dropdown { position: absolute; top: 42px; right: 0; background: #fff; border: 1px solid #e0e0e0;
            border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.16); min-width: 132px;
            z-index: 1000; overflow: hidden; }
.dropdown .dd-item { padding: 10px 16px; cursor: pointer; font-size: 13px; color: #333; }
.dropdown .dd-item:hover { background: #eef4fc; }

main { padding: 16px; }
.card { background: #fff; border-radius: 8px; padding: 16px; margin-bottom: 14px;
        box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.card h2 { margin: 0 0 12px; font-size: 15px; color: #333; }

/* 表单 */
.form-grid { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: center; }
.field { display: flex; align-items: center; gap: 6px; }
.field label { font-size: 13px; color: #555; min-width: 92px; text-align: right;
               white-space: nowrap; }
.field input, .field select { padding: 6px 8px; border: 1px solid #ccc; border-radius: 5px;
                             font-size: 13px; width: 110px; }
.field input.wide { width: 190px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid #eee; padding: 7px 8px; text-align: center; }
th { background: #f0f4fa; color: #444; }
tr:hover td { background: #fafcff; }
table.lclick td { cursor: pointer; }

.toolbar { display: flex; gap: 8px; margin-bottom: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input { padding: 6px 8px; border: 1px solid #ccc; border-radius: 5px; font-size: 13px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.tag.admin { background: #fdecea; color: #c0392b; }
.tag.manager { background: #eaf2fd; color: #1a5fb4; }
.tag.staff { background: #e8f8f0; color: #1e8449; }

textarea.result { width: 100%; min-height: 140px; font-family: inherit; font-size: 14px;
                  padding: 10px; border: 1px solid #ccc; border-radius: 6px; }
.danger { color: #c0392b; }
.muted { color: #888; font-size: 12px; }
.hint { color: #c0392b; font-size: 13px; margin-top: 6px; }

/* 弹窗 */
#modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45);
                 display: flex; align-items: center; justify-content: center; z-index: 999; }
.modal-box { background: #fff; border-radius: 10px; padding: 18px 22px;
             width: min(920px, 94vw); max-height: 90vh; display: flex;
             flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal-box h2 { margin: 0 0 10px; font-size: 17px; }
.modal-box h3 { margin: 14px 0 8px; font-size: 14px; color: #1a5fb4;
                border-left: 3px solid #1a5fb4; padding-left: 8px; }
.modal-scroll { overflow: auto; }
.modal-box table input { width: 90px; padding: 5px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; }

.inv-sum { font-size: 16px; font-weight: bold; color: #1a5fb4; }

/* 合同管理分组 */
.ct-group td { background: #eef2f8; font-weight: 600; cursor: pointer; }
.ct-group:hover td { background: #e6edf7; }
.ct-expand > td { padding: 0; background: #fbfcfe; }
.ct-sub { width: 100%; border-collapse: collapse; }
.ct-sub th { background: #f1f4f9; font-size: 12px; color: #667; }
.ct-sub td { font-size: 12px; cursor: pointer; }

/* 制作合同两栏布局 */
.mk-layout { display: flex; gap: 16px; min-height: 0; }
.mk-main { flex: 1; min-width: 0; }
.mk-side { width: 320px; min-width: 280px; border-left: 1px solid #eee; padding-left: 14px;
           display: flex; flex-direction: column; max-height: 78vh; }
.mk-side-title { font-size: 14px; font-weight: bold; color: #1a5fb4; margin-bottom: 8px; }
.mk-side-body { overflow: auto; flex: 1; min-height: 0; font-size: 12px; }
.mk-hist-item { padding: 8px; border: 1px solid #eef0f3; border-radius: 6px; margin-bottom: 8px; }
.mk-hist-btns { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.mk-hist-btns .btn { padding: 3px 10px; font-size: 12px; }

/* 审批截图（右侧） */
.mk-img-box { border: 1px dashed #bbb; border-radius: 6px; padding: 10px;
              min-height: 100px; cursor: pointer; background: #fafbfc; width: 100%; }
.mk-img-box:focus { outline: 2px solid #cfe0ff; }
.mk-img-box img { max-width: 100%; max-height: 200px; margin-top: 6px; }

/* 生产要求备注：竖排单列，可竖向拖高 */
.mk-notes { display: flex; flex-direction: column; gap: 8px; }
.mk-note-row { display: flex; align-items: flex-start; gap: 10px; }
.mk-note-row label { min-width: 132px; text-align: right; padding-top: 7px;
                     font-size: 13px; color: #555; flex: 0 0 auto; }
.mk-note-row textarea { flex: 1; min-width: 0; width: 100%; min-height: 46px;
                        resize: vertical; overflow: auto; padding: 6px 8px;
                        border: 1px solid #ccc; border-radius: 5px;
                        font-family: inherit; font-size: 13px; line-height: 1.5; }

/* 待产订单 */
#pd-table td { vertical-align: middle; }
#pd-table tr.pd-first td { border-top: 2px solid #dfe6f0; }
#pd-table td[rowspan] { background: #fafcff; }

/* 已安排 / 已排产 / 已成交 等置灰按钮 */
button.btn[disabled], button.btn-primary[disabled] {
  background: #e9edf2 !important; color: #98a4b3 !important; border-color: #e0e5ec !important;
  cursor: not-allowed; box-shadow: none !important; opacity: 1;
}

/* 选项卡关闭按钮 */
nav .tab .tab-x { margin-left: 6px; font-size: 16px; line-height: 1; opacity: .65; }
nav .tab .tab-x:hover { opacity: 1; }

/* 主页：九宫格 */
.home-wrap { min-height: calc(100vh - 90px); display: flex; flex-direction: column;
             align-items: center; justify-content: center; padding: 16px; }
.home-greet { font-size: 18px; color: #333; margin-bottom: 26px; }
.home-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
             width: 100%; max-width: 780px; }
.home-card { position: relative; min-height: 158px; background: #fff; border-radius: 14px;
             cursor: pointer; box-shadow: 0 3px 12px rgba(0,0,0,.07);
             border: 1px solid #eef0f3; display: flex; flex-direction: column;
             align-items: center; justify-content: center; text-align: center;
             padding: 18px; transition: transform .12s, box-shadow .12s; }
.home-card:hover { transform: translateY(-4px); box-shadow: 0 10px 24px rgba(26,95,180,.18); }
.home-card.home-soon { background: #fbfcfe; border-style: dashed; }
.home-card.home-soon .hc-title { color: #7f8ca3; }
.hc-soon { position: absolute; top: 8px; right: 8px; font-size: 11px; color: #8b97a8;
           background: #eef1f5; border-radius: 8px; padding: 1px 7px; }
.hc-title { font-size: 19px; font-weight: bold; color: #1a5fb4; margin-bottom: 10px; }
.hc-desc { font-size: 12px; color: #888; line-height: 1.6; }

/* 占位页 */
.placeholder-box { margin-top: 18px; padding: 46px 24px; text-align: center;
                   background: #fafbfd; border: 1px dashed #d7dee8; border-radius: 12px; }
.ph-icon { font-size: 42px; margin-bottom: 12px; }
.ph-title { font-size: 20px; font-weight: bold; color: #1a5fb4; margin-bottom: 8px; }
.ph-desc { font-size: 14px; color: #667; max-width: 460px; margin: 0 auto; line-height: 1.8; }
.ph-note { margin-top: 14px; font-size: 12px; color: #98a4b3; }
.ph-note code { background: #eef2f7; padding: 2px 6px; border-radius: 4px; }

@media (max-width: 760px) {
  .home-grid { grid-template-columns: repeat(2, 1fr); max-width: 520px; }
}
@media (max-width: 480px) {
  .home-grid { grid-template-columns: 1fr; max-width: 320px; }
}

