:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --border: #e4e8f0;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --success: #059669;
  --warn: #d97706;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; }

.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; flex: 0 0 220px; background: #111827; color: #cbd5e1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { font-size: 26px; font-weight: 800; letter-spacing: 2px; color: #fff; padding: 22px 22px 0; }
.brand span { color: #60a5fa; }
.brand-sub { font-size: 11px; color: #64748b; padding: 4px 22px 20px; letter-spacing: 1px; }
#nav { flex: 1; overflow-y: auto; padding: 0 12px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; margin: 2px 0; border-radius: 8px; cursor: pointer; color: #cbd5e1; transition: .15s; }
.nav-item:hover { background: #1f2937; color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-icon { width: 18px; text-align: center; opacity: .9; }
.nav-group-head { color: #e2e8f0; font-weight: 600; }
.nav-caret { margin-left: auto; font-size: 11px; opacity: .7; }
.nav-child { padding-left: 30px; font-size: 13px; }
.sidebar-foot { padding: 16px 20px 20px; border-top: 1px solid #1f2937; }
.platform-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.platform-tag { background: #1e3a8a; color: #bfdbfe; padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.version { font-size: 11px; color: #64748b; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; background: var(--panel); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 26px; position: sticky; top: 0; z-index: 10; }
.breadcrumb { font-size: 16px; font-weight: 600; }
.topinfo { color: var(--muted); font-size: 13px; }
.content { padding: 22px 26px 40px; flex: 1; }

.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.page-title { font-size: 20px; font-weight: 700; margin: 0; }
.page-desc { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 14px; display: flex; align-items: center; justify-content: space-between; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } .sidebar { width: 64px; flex-basis: 64px; } .brand-sub, .nav-item span:not(.nav-icon), .sidebar-foot { display: none; } }

.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 27px; font-weight: 750; margin-top: 8px; letter-spacing: -.5px; }
.stat-extra { color: var(--muted); font-size: 12px; margin-top: 6px; }
.stat-primary { color: var(--primary); }
.stat-success { color: var(--success); }
.stat-warn { color: var(--warn); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
th { color: var(--muted); font-weight: 600; background: #f8fafc; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover, th.sortable.active { color: var(--primary); }
.sort-arrow { font-size: 10px; margin-left: 2px; }
tr:hover td { background: #f9fbfd; }
.table-wrap { overflow-x: auto; }

.btn { border: 1px solid var(--border); background: var(--panel); color: var(--text); padding: 7px 14px; border-radius: 7px; cursor: pointer; transition: .15s; white-space: nowrap; }
.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.bd-preset.active, .bd-acc-filter.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.bd-preset.active:hover, .bd-acc-filter.active:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #374151; }
.field .hint { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 6px; }
input[type=text], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; background: #fff; color: var(--text); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
textarea { min-height: 72px; resize: vertical; }
.check-list { max-height: 160px; overflow-y: auto; border: 1px solid var(--border); border-radius: 7px; padding: 8px; background: #fff; }
.check-item { display: flex; align-items: center; gap: 7px; padding: 4px 2px; cursor: pointer; }
.check-item input { width: auto; }
.inline { display: flex; align-items: center; gap: 8px; }
.inline > * { flex: 1; }
.inline .fix { flex: 0 0 auto; }

.tag { display: inline-block; background: #eff6ff; color: #1d4ed8; padding: 2px 8px; border-radius: 5px; font-size: 11px; margin: 1px 3px 1px 0; }
.tag-green { background: #ecfdf5; color: #047857; }
.tag-red { background: #fef2f2; color: #b91c1c; }
.tag-gray { background: #f1f5f9; color: #475569; }
.tag-orange { background: #fffbeb; color: #b45309; }

.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-start; justify-content: center; z-index: 50; padding: 5vh 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: min(680px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); font-size: 16px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 20px; max-height: 70vh; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.close-x { cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; }

#toast-root { position: fixed; top: 74px; right: 22px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #111827; color: #fff; padding: 11px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: slide .2s ease; max-width: 360px; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--success); }
@keyframes slide { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

.progress { height: 8px; background: #e5e7eb; border-radius: 5px; overflow: hidden; margin: 8px 0; }
.progress > div { height: 100%; background: var(--primary); transition: width .3s; }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; }
.loading { text-align: center; color: var(--muted); padding: 50px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.bar-label { width: 80px; flex: 0 0 80px; color: var(--muted); font-size: 12px; }
.bar-track { flex: 1; background: #f1f5f9; border-radius: 4px; height: 18px; position: relative; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #60a5fa, #2563eb); border-radius: 4px; }
.bar-value { width: 90px; flex: 0 0 90px; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.material-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.material-item { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.material-item img { width: 100%; height: 92px; object-fit: contain; background: #f8fafc; display: block; }
.material-meta { padding: 8px; font-size: 12px; }
.material-meta .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-badge { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; background: #dbeafe; color: #1d4ed8; align-items: center; justify-content: center; font-weight: 700; margin-right: 8px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
/* 百度计划管理：列多，固定最小宽度并让数字列横向滚动，避免表头竖排。 */
.bd-plan-table { min-width: 1280px; }
.bd-plan-table th, .bd-plan-table td { white-space: nowrap; }
.bd-plan-table td.bd-plan-text { white-space: normal; min-width: 150px; }
.th-sort { border: 0; background: transparent; color: inherit; font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.th-sort:hover { color: var(--primary); }
.th-sort.active { color: var(--primary); }
.bd-batch-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 10px; border: 1px solid var(--primary); background: #eff6ff; border-radius: 6px; font-size: 13px; }
/* ROI 看表：每日明细列较多，固定最小宽度并允许横向滚动，数字不换行。 */
.roi-table { min-width: 900px; }
.roi-table th, .roi-table td { white-space: nowrap; }
