* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, "Microsoft YaHei", Arial, sans-serif;
    background: #f2f3f5;
    color: #303133;
    font-size: 14px;
}
a { color: #d33; text-decoration: none; }

/* ---------- 登录 ---------- */
.login-wrap {
    height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #2b3040, #464d61);
}
.login-box {
    width: 340px; background: #fff; padding: 34px 30px; border-radius: 6px;
    box-shadow: 0 8px 30px rgba(0,0,0,.25);
}
.login-box h1 { font-size: 19px; text-align: center; margin-bottom: 4px; }
.login-box .sub { text-align: center; color: #909399; font-size: 12px; margin-bottom: 22px; }

/* ---------- 布局 ---------- */
.topbar {
    height: 52px; background: #2b3040; color: #fff; display: flex;
    align-items: center; padding: 0 18px; justify-content: space-between;
}
.topbar .logo { font-size: 16px; font-weight: bold; }
.topbar .logo span { color: #e6a23c; }
.topbar .right { font-size: 13px; color: #c8ccd4; }
.topbar .right a { color: #ffd04b; margin-left: 12px; }

/* 角色标签 */
.rtag {
    display: inline-block; padding: 1px 7px; border-radius: 3px; font-size: 11px;
    margin-left: 6px; vertical-align: middle;
}
.rtag.ra { background: #d33; color: #fff; }
.rtag.rs { background: #eef1f6; color: #5f6572; }
td .rtag { margin-left: 0; }

.nav { background: #fff; border-bottom: 1px solid #e4e7ed; padding: 0 18px; display: flex; }
.nav a {
    padding: 12px 18px; color: #606266; font-size: 14px; border-bottom: 2px solid transparent;
}
.nav a:hover { color: #d33; }
.nav a.on { color: #d33; border-bottom-color: #d33; font-weight: bold; }

.container { padding: 16px 18px 40px; }

/* ---------- 卡片 / 统计 ---------- */
.card { background: #fff; border-radius: 4px; padding: 16px; margin-bottom: 14px; }
.card h3 { font-size: 15px; margin-bottom: 14px; padding-left: 8px; border-left: 3px solid #d33; }

.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.stat {
    flex: 1; min-width: 150px; background: #fff; border-radius: 4px; padding: 16px 18px;
    border-left: 4px solid #409eff;
}
.stat.g { border-left-color: #67c23a; }
.stat.o { border-left-color: #e6a23c; }
.stat.r { border-left-color: #f56c6c; }
.stat .t { color: #909399; font-size: 12px; margin-bottom: 8px; }
.stat .v { font-size: 22px; font-weight: bold; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.fi { display: flex; flex-direction: column; }
.fi.full { grid-column: 1 / -1; }
label { font-size: 13px; color: #606266; margin-bottom: 6px; }
label i { color: #f56c6c; font-style: normal; }
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=datetime-local], select, textarea {
    height: 34px; border: 1px solid #dcdfe6; border-radius: 4px; padding: 0 10px;
    font-size: 14px; outline: none; width: 100%; font-family: inherit;
}
textarea { height: 62px; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #d33; }
input[readonly] { background: #f5f7fa; color: #606266; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    height: 36px; padding: 0 18px; border: 1px solid transparent; border-radius: 6px;
    cursor: pointer; font-size: 14px; font-family: inherit; line-height: 1;
    background: #d33; color: #fff; white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
    transition: all .15s ease;
    text-decoration: none; vertical-align: middle;
}
.btn:hover  { background: #e04747; box-shadow: 0 3px 8px rgba(221,51,51,.3); transform: translateY(-1px); }
.btn:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(0,0,0,.1); }

.btn.green  { background: #52a03a; }
.btn.green:hover  { background: #61b647; box-shadow: 0 3px 8px rgba(82,160,58,.3); }
.btn.blue   { background: #3a7fd5; }
.btn.blue:hover   { background: #4b8fe3; box-shadow: 0 3px 8px rgba(58,127,213,.3); }
.btn.orange { background: #e08e28; }
.btn.orange:hover { background: #ef9f3b; box-shadow: 0 3px 8px rgba(224,142,40,.3); }

/* 次要按钮：描边风格 */
.btn.gray {
    background: #fff; color: #5f6572; border-color: #d3d7de;
}
.btn.gray:hover {
    background: #f7f8fa; color: #303133; border-color: #b8bec9;
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
}

.btn.block { width: 100%; height: 40px; font-size: 15px; }
.btn.sm    { height: 28px; padding: 0 11px; font-size: 12px; border-radius: 5px; gap: 3px; }
.btn.lg    { height: 40px; padding: 0 26px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* 按钮组间距 */
.btn-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
td .btn.sm { margin-right: 4px; }
td .btn.sm:last-child { margin-right: 0; }

/* ---------- 表格 ---------- */
.tbl-box { background: #fff; border-radius: 4px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1100px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid #ebeef5; white-space: nowrap; }
th { background: #fafafa; color: #606266; font-weight: normal; font-size: 13px; }
tbody tr:hover { background: #fafcff; }
td.num { font-family: Consolas, monospace; }
.money { color: #f56c6c; font-weight: bold; }
.money.g { color: #67c23a; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 12px; }
.tag.s0 { background: #fdf6ec; color: #e6a23c; }
.tag.s1 { background: #f0f9eb; color: #67c23a; }
.tag.s2 { background: #fef0f0; color: #f56c6c; }

.filter { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filter .fi { min-width: 130px; }

.page { padding: 14px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.page a, .page span.cur {
    padding: 5px 11px; border: 1px solid #dcdfe6; border-radius: 3px; color: #606266; font-size: 13px;
}
.page span.cur { background: #d33; color: #fff; border-color: #d33; }
.page .info { color: #909399; font-size: 13px; margin-left: auto; }

.msg { padding: 9px 12px; border-radius: 4px; margin-bottom: 12px; font-size: 13px; }
.msg.err { background: #fef0f0; color: #f56c6c; }
.msg.ok  { background: #f0f9eb; color: #67c23a; }
.empty { text-align: center; padding: 50px 0; color: #909399; }

.vimg { width: 34px; height: 34px; object-fit: cover; border-radius: 3px; cursor: pointer; border: 1px solid #eee; }
.mask {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.75); z-index: 99;
    align-items: center; justify-content: center;
}
.mask img { max-width: 88%; max-height: 88%; }

@media (max-width: 768px) {
    .nav { overflow-x: auto; }
    .nav a { padding: 12px 12px; white-space: nowrap; }
    .container { padding: 12px 10px 30px; }
}

/* ---------- 粘贴截图区 ---------- */
.paste-zone {
    border: 2px dashed #d3d7de; border-radius: 6px; background: #fafbfc;
    padding: 16px; text-align: center; cursor: pointer; transition: all .18s;
    min-height: 92px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 6px;
}
.paste-zone:hover, .paste-zone.hot { border-color: #d33; background: #fff5f5; }
.paste-zone.has { border-style: solid; border-color: #52a03a; background: #f6fbf4; padding: 10px; }
.paste-zone .pz-tip { color: #909399; font-size: 13px; }
.paste-zone .pz-tip b { color: #d33; }
.paste-zone input[type=file] { display: none; }

/* 多图缩略图列表 */
.vlist { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; width: 100%; }
.vitem {
    position: relative; width: 96px; border: 1px solid #e4e7ed; border-radius: 5px;
    overflow: hidden; background: #fff;
}
.vitem img {
    width: 100%; height: 76px; object-fit: cover; display: block; cursor: zoom-in;
}
.vitem .vmeta {
    font-size: 11px; color: #909399; text-align: center; padding: 2px 0;
    background: #fafafa; border-top: 1px solid #f0f0f0;
}
.vitem .vdel {
    position: absolute; right: 2px; top: 2px; width: 18px; height: 18px; line-height: 16px;
    text-align: center; background: rgba(0,0,0,.55); color: #fff; border-radius: 50%;
    font-size: 14px; text-decoration: none;
}
.vitem .vdel:hover { background: #f56c6c; }

/* 列表页凭证角标 */
.vbadge { position: relative; display: inline-block; }
.vbadge b {
    position: absolute; right: -6px; top: -5px; background: #d33; color: #fff;
    font-size: 10px; border-radius: 8px; padding: 0 4px; line-height: 14px; min-width: 14px;
    text-align: center;
}

/* ---------- 备注时间线 ---------- */
.notes { margin: 0; padding: 0; list-style: none; }
.notes li {
    position: relative; padding: 0 0 12px 16px; border-left: 2px solid #ebeef5;
}
.notes li:last-child { border-left-color: transparent; padding-bottom: 0; }
.notes li:before {
    content: ''; position: absolute; left: -5px; top: 4px; width: 8px; height: 8px;
    border-radius: 50%; background: #d33;
}
.notes li:not(:first-child):before { background: #c0c4cc; }
.notes .n-meta { font-size: 12px; color: #909399; margin-bottom: 3px; }
.notes .n-txt  { font-size: 13px; color: #303133; white-space: pre-wrap; word-break: break-all; }
.notes-empty { color: #c0c4cc; font-size: 13px; }

/* 三级分类联动：始终并排一行 */
.cascade { display: flex; gap: 8px; align-items: center; }
.cascade > select { flex: 1 1 0; min-width: 0; }
/* 手机上也不换行，靠横向压缩 */
@media (max-width: 620px) {
    .cascade { gap: 6px; }
    .cascade > select { font-size: 13px; padding: 0 6px; }
}

/* 只读信息表 */
.info-tbl th { background: #fafafa; width: 110px; color: #606266; font-weight: normal; }
.info-tbl td { color: #303133; }

/* 勾选框 / 单选 */
input[type=checkbox], input[type=radio] {
    width: 15px; height: 15px; cursor: pointer; accent-color: #d33; vertical-align: middle;
}
tbody tr:has(.ckRow:checked), tbody tr:has(.ck:checked) { background: #fff8f8; }

/* ============ 订单卡片 ============ */
.ocards { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 12px; }
@media (max-width: 900px) { .ocards { grid-template-columns: 1fr; } }

.ocard {
    background: #fff; border-radius: 6px; border: 1px solid #e9ebef;
    border-left: 4px solid #e0e3e8; overflow: hidden; transition: box-shadow .15s;
}
.ocard:hover { box-shadow: 0 3px 12px rgba(0,0,0,.08); }
.ocard.st0 { border-left-color: #e08e28; }
.ocard.st1 { border-left-color: #52a03a; }
.ocard.st2 { border-left-color: #f56c6c; }
.ocard.picked { border-color: #d33; background: #fffafa; }

/* 卡片头 */
.oc-head {
    display: flex; align-items: center; gap: 8px; padding: 10px 12px;
    background: #fafbfc; border-bottom: 1px solid #eef0f3; flex-wrap: wrap;
}
.oc-no {
    font-family: Consolas, monospace; font-size: 14px; font-weight: bold; color: #303133;
}
.oc-head .spacer { margin-left: auto; }

/* 商品名 */
.oc-goods { padding: 10px 12px 6px; }
.oc-goods .g-name { font-size: 15px; color: #303133; font-weight: bold; line-height: 1.4; }
.oc-goods .g-cat  { font-size: 12px; color: #909399; margin-top: 3px; }
.oc-goods .g-cat b { color: #606266; font-weight: normal; }

/* 金额行 */
.oc-money {
    display: flex; gap: 0; padding: 8px 12px; margin: 6px 12px 0;
    background: #fafbfc; border-radius: 5px;
}
.oc-money > div { flex: 1; text-align: center; position: relative; }
.oc-money > div + div:before {
    content: ''; position: absolute; left: 0; top: 15%; height: 70%; width: 1px; background: #e9ebef;
}
.oc-money .m-t { font-size: 11px; color: #909399; margin-bottom: 3px; }
.oc-money .m-v { font-size: 15px; font-weight: bold; }
.oc-money .m-v.a { color: #303133; }
.oc-money .m-v.c { color: #909399; }
.oc-money .m-v.p { color: #52a03a; }
.oc-money .m-v.dim { color: #c8ccd4; font-weight: normal; }

/* 明细行 */
.oc-body { padding: 10px 12px 4px; }
.oc-row { display: flex; gap: 8px; font-size: 13px; padding: 3px 0; align-items: flex-start; }
.oc-row .k { color: #909399; flex: 0 0 62px; }
.oc-row .v { color: #303133; flex: 1; min-width: 0; word-break: break-all; }
.oc-row .v.dim { color: #c0c4cc; }

/* 卡片脚 */
.oc-foot {
    display: flex; align-items: center; gap: 6px; padding: 9px 12px;
    border-top: 1px solid #f2f4f7; flex-wrap: wrap;
}
.oc-foot .t { font-size: 12px; color: #909399; }
.oc-foot .acts { margin-left: auto; display: flex; gap: 5px; }

/* 卡片里的凭证缩略图 */
.oc-imgs { display: flex; gap: 5px; flex-wrap: wrap; }
.oc-imgs img {
    width: 40px; height: 40px; object-fit: cover; border-radius: 4px;
    border: 1px solid #e4e7ed; cursor: zoom-in;
}
.oc-imgs .more {
    width: 40px; height: 40px; border-radius: 4px; background: #f2f4f7; color: #909399;
    font-size: 12px; display: flex; align-items: center; justify-content: center;
}

/* 视图切换 */
.view-sw { display: flex; gap: 0; border: 1px solid #d3d7de; border-radius: 6px; overflow: hidden; }
.view-sw a {
    padding: 0 14px; height: 34px; line-height: 34px; font-size: 13px; color: #5f6572;
    background: #fff; text-decoration: none;
}
.view-sw a + a { border-left: 1px solid #d3d7de; }
.view-sw a.on { background: #d33; color: #fff; }
