:root {
  --brand: #d9362b;
  --brand-2: #e8483a;
  --brand-soft: #fdecea;
  --ink: #1f2329;
  --muted: #8b9099;
  --line: #eceef1;
  --bg: #f4f5f7;
  --green: #1f9151;
  --amber: #c9770c;
  --violet: #2b5fc0;
  --red: #e8483a;
  --shadow: 0 6rpx 24px rgba(31, 35, 41, .06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; }
.hide { display: none !important; }
.muted { color: var(--muted); font-size: 12px; }
code { background: #f3f5f9; padding: 2px 6px; border-radius: 5px; font-size: 12px; color: #d9362b; }

/* ---------- 通用控件 ---------- */
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #e3e8f0; border-radius: 10px;
  font-size: 13px; color: var(--ink); background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(217, 54, 43, .1); }
input::placeholder, textarea::placeholder { color: #b6bac1; }
textarea { resize: vertical; line-height: 1.6; }
label { display: block; font-size: 12px; color: #5a6068; margin-bottom: 6px; font-weight: 600; }
.field { margin-bottom: 14px; }
.field input, .field select { margin-bottom: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.combo { display: flex; gap: 8px; }
.combo select.preset { width: 44%; flex-shrink: 0; }
.combo input, .combo select.combo-alt { flex: 1; width: auto; min-width: 0; }
.combo input.locked { background: #f4f5f7; color: #8b9099; cursor: not-allowed; }
.field-hint { margin-top: 6px; font-size: 11px; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 18px; cursor: pointer;
  font-size: 13px; font-weight: 600; transition: transform .12s, box-shadow .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff; box-shadow: 0 6px 16px rgba(217, 54, 43, .22); }
.btn.primary:hover { box-shadow: 0 8px 20px rgba(217, 54, 43, .3); }
.btn.ghost { background: #fff; color: #5a6068; border-color: #e3e8f0; }
.btn.ghost:hover { color: var(--brand); border-color: var(--brand-2); background: #fff7f6; }
.btn.sm { padding: 8px 14px; font-size: 12px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn.danger { color: var(--red); }
.link { color: var(--brand); font-size: 12px; cursor: pointer; background: none; border: none; font-weight: 600; }
.link:hover { text-decoration: underline; }
.icon-btn { background: none; border: none; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; }
.w180 { width: 180px; } .w220 { width: 220px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; margin: 6px 0 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.check.inline { margin: 0; }
.sub-title { font-size: 13px; font-weight: 700; margin: 18px 0 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.hint-box { margin-top: 14px; background: #f8fafc; border: 1px dashed #e3e8f0; border-radius: 10px; padding: 12px 14px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.contract { background: #1f2329; color: #d7e0f0; border-radius: 10px; padding: 14px; font-size: 11.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-all; max-height: 230px; overflow: auto; font-family: Consolas, monospace; }

/* ---------- 登录：红色品牌区 + 白色圆角卡片 ---------- */
.login-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 70px 20px 60px; background: linear-gradient(180deg, #e8483a 0%, #d9362b 300px, #f4f5f7 300px); }
.login-brand { text-align: center; color: #fff; margin-bottom: 42px; }
.login-logo { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 18px; background: #fff; color: #d9362b; font-size: 32px; font-weight: 800; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 22px rgba(120, 20, 10, .2); }
.login-brand h1 { font-size: 28px; font-weight: 800; letter-spacing: 2px; }
.login-brand p { font-size: 13px; opacity: .9; margin-top: 8px; }
.login-card { width: 400px; max-width: 100%; background: #fff; border-radius: 18px; padding: 34px 36px 30px; box-shadow: 0 18px 50px rgba(31,35,41,.14); }
.lc-title { font-size: 18px; font-weight: 800; }
.lc-sub { color: var(--muted); font-size: 12px; margin: 8px 0 26px; }
.login-card .btn { margin-top: 12px; padding: 14px; font-size: 15px; border-radius: 28px; }
.demo-hint { margin-top: 24px; background: #fff3e0; border: 1px solid #f3ddb0; color: #c9770c; font-size: 12px; line-height: 1.8; padding: 14px 16px; border-radius: 10px; }
.demo-hint b { display: block; margin-bottom: 4px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 232px; flex-shrink: 0; background: #1f2329; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: #d9362b; color: #fff; font-size: 19px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.brand b { font-size: 16px; display: block; color: #fff; }
.brand small { color: #8b9099; font-size: 11px; }
.side-nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav-group { font-size: 11px; color: #6b7078; font-weight: 700; padding: 16px 12px 8px; letter-spacing: 1px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #c3c8d0; cursor: pointer; font-size: 13px; margin-bottom: 2px; border-left: 3px solid transparent; }
.side-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-nav a.on { background: rgba(217,54,43,.18); color: #fff; font-weight: 700; border-left-color: #e8483a; }
.ni { width: 18px; text-align: center; font-size: 15px; opacity: .9; }
.nav-badge { margin-left: auto; background: rgba(255,255,255,.12); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 700; }
.nav-dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: #e8483a; display: none; }
.side-foot { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); }
.side-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #8b9099; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(31,145,81,.16); }
.content { flex: 1; min-width: 0; }
.topbar { height: 72px; background: linear-gradient(135deg, #e8483a, #d9362b); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 10; box-shadow: 0 4px 16px rgba(217,54,43,.16); }
.topbar h2 { font-size: 18px; color: #fff; }
.topbar p, .topbar .muted { color: rgba(255,255,255,.86); }
.top-actions { display: flex; align-items: center; gap: 14px; }
.user-chip { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.3); padding: 8px 14px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.topbar .btn.ghost { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.35); }
.topbar .btn.ghost:hover { background: rgba(255,255,255,.24); color: #fff; }
.main { padding: 24px 28px 48px; }

/* ---------- 卡片 / 统计 ---------- */
.card { background: #fff; border-radius: 16px; padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card.narrow { max-width: 640px; }
.card.accent-card { background: linear-gradient(135deg, #fff7f6, #fff); border: 1px solid #f7cdc9; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { font-size: 15px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.stat-card { background: #fff; border-radius: 16px; padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat-card::after { content: ''; position: absolute; right: -18px; top: -18px; width: 74px; height: 74px; border-radius: 50%; background: var(--brand-soft); opacity: .8; }
.stat-card .label { color: var(--muted); font-size: 12px; position: relative; z-index: 1; }
.stat-card .value { font-size: 28px; font-weight: 800; margin-top: 8px; position: relative; z-index: 1; }
.stat-card .foot { margin-top: 6px; font-size: 11px; color: var(--muted); position: relative; z-index: 1; }
.stat-card.warn .value { color: var(--amber); }
.stat-card.danger .value { color: var(--red); }
.stat-card.ok .value { color: var(--green); }
.pill { background: var(--brand-soft); color: var(--brand); padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; }

/* ---------- 表格 / 列表 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; text-align: left; font-size: 12.5px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; background: #fafbfd; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fff7f6; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input, .toolbar select { width: auto; }
.tag { display: inline-block; padding: 4px 10px; border-radius: 8px; font-size: 11px; font-weight: 700; color: #fff; background: #8b9099; }
.tag.pending_pay, .tag.paid { background: var(--brand); }
.tag.delivering { background: var(--violet); }
.tag.confirmed, .tag.success, .tag.ready, .tag.on { background: var(--green); }
.tag.cancelled, .tag.failed, .tag.off { background: #9aa3b2; }
.tag.queued, .tag.configured, .tag.warn { background: var(--amber); }
.tag.missing { background: var(--red); }
.thumb { width: 44px; height: 44px; border-radius: 10px; background: var(--brand-soft) center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--brand); font-weight: 800; flex-shrink: 0; }
.cell-title { font-weight: 700; }
.cell-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.mini-list { font-size: 12.5px; }
.mini-list.scroll { max-height: 280px; overflow-y: auto; }
.mini-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.mini-item:last-child { border-bottom: none; }
.mini-item .mi-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-item .mi-sub { color: var(--muted); font-size: 11px; margin-top: 3px; }
.empty-row { text-align: center; color: var(--muted); padding: 32px 0 !important; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.check-item { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.check-item.missing { border-color: #ffd9d9; background: #fffafa; }
.check-item .ci-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.check-item .ci-title { font-weight: 700; font-size: 13px; }
.check-item p { color: var(--muted); font-size: 11.5px; line-height: 1.7; margin: 8px 0; }
.check-item .todo { color: #d9362b; font-size: 11.5px; background: var(--brand-soft); padding: 8px 10px; border-radius: 8px; }
.ready-list .ready-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.ready-list .ready-row:last-child { border: none; }
.bar { height: 6px; border-radius: 6px; background: #f0f2f6; flex: 1; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--brand-2), var(--brand)); }

/* ---------- 弹层 ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(20, 26, 38, .5); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; backdrop-filter: blur(2px); }
.modal { background: #fff; border-radius: 18px; width: 460px; max-width: 100%; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.2); }
.modal.wide { width: 680px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.up-block { margin-top: 6px; }
.up-row { display: flex; gap: 16px; align-items: center; }
.up-preview { width: 88px; height: 88px; border-radius: 12px; background: #f4f6fb center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: #b6bac1; font-size: 12px; flex-shrink: 0; border: 1px dashed #dfe4ee; }
.timeline { border-left: 2px solid var(--brand-soft); margin-left: 8px; padding-left: 18px; }
.tl-item { position: relative; padding-bottom: 14px; font-size: 12.5px; }
.tl-item::before { content: ''; position: absolute; left: -24px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--brand-soft); }
.tl-item .tl-sub { color: var(--muted); font-size: 11px; margin-top: 3px; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; font-size: 12.5px; }
.kv-grid .kv { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }

/* ---------- 提示 ---------- */
#toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); background: #1f2329; color: #fff; padding: 12px 22px; border-radius: 10px; display: none; z-index: 99; box-shadow: 0 10px 30px rgba(0,0,0,.2); font-size: 13px; }
#errbar { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; padding: 12px 22px; border-radius: 10px; display: none; z-index: 100; max-width: 80%; word-break: break-all; box-shadow: 0 10px 30px rgba(239,68,68,.25); font-size: 13px; }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; border-right: none; border-bottom: 1px solid var(--line); }
  .brand { padding: 14px 16px; }
  .side-nav { display: flex; overflow-x: auto; padding: 8px; gap: 4px; }
  .nav-group, .side-foot { display: none; }
  .side-nav a { flex-shrink: 0; margin: 0; }
  .topbar { padding: 0 16px; height: 62px; }
  .main { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
}

/* 嘟嘟牛品牌图标 */
.login-logo img { width: 58px; height: 58px; display: block; object-fit: contain; }
.brand-mark { background: #fff; }
.brand-mark img { width: 34px; height: 34px; display: block; object-fit: contain; }
