* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
       background: #f4f6f9; color: #1f2937; font-size: 14px; }
.hidden { display: none !important; }
.muted { color: #6b7280; }
.small-text { font-size: 12px; }
.err { color: #dc2626; min-height: 18px; margin: 6px 0; font-size: 13px; }

/* 登录 */
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 340px; }
.login-card h1 { font-size: 20px; margin-bottom: 16px; text-align: center; }
.field { margin-bottom: 12px; }
.field label { display: block; margin-bottom: 4px; color: #374151; }
.field input { width: 100%; padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; }

.card { background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.btn { border: 1px solid #d1d5db; background: #fff; padding: 7px 14px; border-radius: 6px;
       cursor: pointer; font-size: 14px; }
.btn:hover { background: #f3f4f6; }
.btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn.danger { color: #dc2626; border-color: #fca5a5; }
.btn.wide { width: 100%; margin-top: 8px; }

/* 头部 */
header { display: flex; align-items: center; gap: 18px; background: #fff; padding: 10px 18px;
         box-shadow: 0 1px 3px rgba(0,0,0,.08); position: sticky; top: 0; z-index: 20; }
.brand { font-weight: 700; font-size: 16px; }
nav#tabs { display: flex; gap: 4px; flex: 1; }
nav#tabs button { border: none; background: none; padding: 8px 14px; cursor: pointer;
                  border-radius: 6px; font-size: 14px; color: #374151; }
nav#tabs button.active { background: #2563eb; color: #fff; }
.header-right { display: flex; align-items: center; gap: 8px; }

/* 横幅 */
.banner { padding: 9px 18px; font-weight: 600; }
.banner.red { background: #fee2e2; color: #b91c1c; }
.banner.orange { background: #ffedd5; color: #c2410c; }
.banner.blue { background: #dbeafe; color: #1d4ed8; font-weight: 400; }

main { padding: 18px; max-width: 1280px; margin: 0 auto; }
h2 { font-size: 16px; margin: 6px 0 12px; }
h3 { font-size: 14px; margin-bottom: 8px; }
.pill { background: #2563eb; color: #fff; border-radius: 10px; padding: 1px 9px; font-size: 13px; }

/* 待办布局(首页 = 待办在上 + 订单汇总在下) */
.todo-flex { display: flex; gap: 18px; align-items: flex-start; }
#orders-block { margin-top: 26px; }
#orders-block h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.resend-text { width: 100%; min-height: 110px; padding: 10px; border: 1px solid #d1d5db;
               border-radius: 8px; font-size: 14px; line-height: 1.7; resize: vertical; }
.btn.go { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn.refund { background: #dc2626; border-color: #dc2626; color: #fff; }
.split { display: flex; gap: 18px; flex: 1; flex-wrap: wrap; }
.split .col { flex: 1; min-width: 380px; }
#online-panel { width: 210px; background: #fff; border-radius: 10px; padding: 12px;
                box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.agent-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #d1d5db; }
.dot.on { background: #16a34a; }

.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: #fff; border-radius: 10px; padding: 12px 14px; box-shadow: 0 1px 3px rgba(0,0,0,.08);
        border-left: 4px solid #2563eb; }
.item.red { border-left-color: #dc2626; background: #fff5f5; }
.item.new-flag { outline: 2px solid #fbbf24; }
.item .row1 { display: flex; justify-content: space-between; gap: 8px; }
.item .title { font-weight: 600; }
.item .age { color: #6b7280; font-size: 13px; white-space: nowrap; }
.item.red .age { color: #dc2626; font-weight: 700; }
.item .meta { color: #4b5563; margin-top: 6px; font-size: 13px; line-height: 1.6; word-break: break-all; }
.badge { display: inline-block; font-size: 11px; border-radius: 4px; padding: 1px 6px;
         background: #e5e7eb; color: #374151; margin-left: 6px; vertical-align: 1px; }
.badge.bf { background: #fef3c7; color: #92400e; }
.empty { color: #9ca3af; text-align: center; padding: 30px 0; }

/* 表格 */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden;
        box-shadow: 0 1px 3px rgba(0,0,0,.08); }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid #f0f2f5; font-size: 13px; }
th { background: #f9fafb; color: #374151; white-space: nowrap; }
tr:last-child td { border-bottom: none; }

.form-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.form-inline input, .form-inline select { padding: 7px 10px; border: 1px solid #d1d5db; border-radius: 6px; }

/* 设置表单 */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.settings-grid .card label { display: flex; justify-content: space-between; align-items: center;
                             padding: 5px 0; gap: 10px; }
.settings-grid input[type=number], .settings-grid input[type=text] {
  width: 90px; padding: 5px 8px; border: 1px solid #d1d5db; border-radius: 6px; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
              display: flex; align-items: center; justify-content: center; }
.modal { background: #fff; border-radius: 12px; padding: 22px; width: 460px; max-width: 92vw;
         max-height: 80vh; overflow: auto; }
.modal h2 { margin-bottom: 12px; }
.modal .m-item { padding: 8px 10px; border-radius: 8px; background: #fef2f2; margin-bottom: 8px;
                 border-left: 3px solid #dc2626; font-size: 13px; line-height: 1.6; }
.temp-pw { font-size: 26px; font-family: ui-monospace, Menlo, monospace; text-align: center;
           letter-spacing: 2px; background: #f3f4f6; border-radius: 8px; padding: 14px; margin: 12px 0; }

/* 订单汇总宽表 */
.wide-table { overflow-x: auto; }
.wide-table table { min-width: 1150px; }
.wide-table td { vertical-align: top; }
.st-ok { color: #1a7f37; font-weight: 600; }
.st-bad { color: #c00000; font-weight: 600; }
.cdk-cell { font-family: ui-monospace, Menlo, monospace; font-size: 12px; max-width: 140px;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .row1 .ops { white-space: nowrap; }

/* 客户备注弹层 */
.remark-list { max-height: 260px; overflow-y: auto; margin: 8px 0 10px; }
.remark-item { border-bottom: 1px dashed #e5e7eb; padding: 8px 0; }
.remark-item:last-child { border-bottom: 0; }
.remark-text { white-space: pre-wrap; word-break: break-word; color: #1f2328; }
.remark-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.remark-meta .remark-edit { margin-left: auto; }
