/* LaunchDraw 商家后台。主色（靛蓝）只用在主按钮、当前菜单、最重要的数字；背景白和浅灰；状态色另配 */
:root {
  --primary: #4F46E5; --primary-deep: #4338CA; --primary-soft: #EEF2FF;
  --ink: #1F2329; --muted: #6B7280; --line: #E5E7EB; --bg: #F6F7F9; --card: #fff;
  --ok: #15803D; --ok-soft: #ECFDF3; --warn: #B45309; --warn-soft: #FFF7E6; --err: #B91C1C; --err-soft: #FEF2F2; --info-soft: #F3F4F6;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.35; }

/* 左侧导航 + 右侧内容，内容区随窗口铺满 */
.shell { display: flex; min-height: 100vh; }
.side { width: 220px; flex: none; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side .brand { padding: 20px 20px 4px; font-weight: 700; font-size: 16px; }
.side .brand small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.side .shop { margin: 8px 20px 12px; font-size: 12px; color: var(--muted); word-break: break-all; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.menu { display: flex; flex-direction: column; padding: 0 10px; gap: 2px; }
.menu a { color: var(--ink); padding: 8px 12px; border-radius: 6px; }
.menu a:hover { background: var(--bg); text-decoration: none; }
.menu a.on { background: var(--primary-soft); color: var(--primary-deep); font-weight: 600; }
.side-foot { margin-top: auto; padding: 16px 20px; border-top: 1px solid var(--line); font-size: 13px; }
.side-foot button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; font-size: 13px; }
.main { flex: 1; min-width: 0; padding: 24px 32px 48px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 20px 24px; margin-bottom: 16px; }
.card > h2 { font-size: 16px; margin-bottom: 4px; }
.card > .hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 6px; border: 1px solid #D0D3D6; background: #fff; color: var(--ink); font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: #9CA3AF; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-deep); }
.btn.danger { color: var(--err); border-color: #F3C4C4; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: default; }

.badge { display: inline-block; font-size: 12px; line-height: 20px; padding: 0 8px; border-radius: 10px; background: var(--info-soft); color: var(--muted); white-space: nowrap; }
.badge.open { background: var(--ok-soft); color: var(--ok); }
.badge.upcoming { background: var(--info-soft); color: #374151; }
.badge.closed, .badge.paying { background: var(--warn-soft); color: var(--warn); }
.badge.ended { background: var(--info-soft); color: var(--muted); }
.badge.cancelled { background: var(--err-soft); color: var(--err); }
.badge.won { background: var(--warn-soft); color: var(--warn); }
.badge.purchased { background: var(--ok-soft); color: var(--ok); }
.badge.expired, .badge.excluded { background: var(--err-soft); color: var(--err); }

.alert { border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.alert.err { background: var(--err-soft); color: var(--err); }
.alert.warn { background: var(--warn-soft); color: #7C4A03; }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.info { background: var(--primary-soft); color: #312E81; }
.alert .btn { margin-left: 8px; }

/* 数字卡片：宽屏一行六个，窄屏两列 / 一列 */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.kpi span { color: var(--muted); font-size: 13px; display: block; }
.kpi b { font-size: 24px; display: block; margin: 2px 0; font-variant-numeric: tabular-nums; }
.kpi b.key { color: var(--primary); }
.kpi small { color: var(--muted); font-size: 12px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.list { width: 100%; border-collapse: collapse; }
.list th, .list td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.list th { color: var(--muted); font-weight: 400; font-size: 13px; white-space: nowrap; background: #FAFAFB; }
.list td.nowrap { white-space: nowrap; }
.list td.num, .list th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list tr:hover td { background: #FAFAFB; }
.list .title { font-weight: 600; color: var(--ink); }
.prod { display: flex; gap: 10px; align-items: center; }
.prod img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); flex: none; background: var(--bg); }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs a { padding: 4px 12px; border-radius: 14px; color: var(--muted); border: 1px solid var(--line); background: #fff; font-size: 13px; }
.tabs a.on { color: var(--primary-deep); border-color: #C7D2FE; background: var(--primary-soft); }
.tabs a:hover { text-decoration: none; }

/* 表单 */
.field { margin-bottom: 16px; }
.field > label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .help { color: var(--muted); font-size: 12px; margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 20px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 20px; }
input[type=text], input[type=number], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; height: 38px; border: 1px solid #D0D3D6; border-radius: 6px; padding: 0 12px; font-size: 14px; background: #fff; color: var(--ink); font-family: inherit; }
textarea { height: auto; min-height: 80px; padding: 8px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[disabled], select[disabled] { background: var(--bg); color: var(--muted); }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.radio-row label, .check { display: inline-flex; align-items: flex-start; gap: 6px; font-weight: 400; cursor: pointer; }
.check { display: flex; margin-bottom: 8px; }
.check input { margin-top: 4px; flex: none; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input { flex: 1; }
.suffix { color: var(--muted); white-space: nowrap; }

.results { border: 1px solid var(--line); border-radius: 8px; margin-top: 8px; max-height: 360px; overflow-y: auto; }
.results .row { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.results .row:last-child { border-bottom: 0; }
.results .row:hover { background: var(--bg); }
.results .row img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; flex: none; background: var(--bg); }
.results .row .t { flex: 1; min-width: 0; }
.picked { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid #C7D2FE; background: var(--primary-soft); border-radius: 8px; flex-wrap: wrap; }
.picked img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; background: #fff; }
.picked .t { flex: 1; min-width: 200px; }

.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps > li { position: relative; padding: 0 0 18px 40px; }
.steps > li::before { counter-increment: s; content: counter(s); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--info-soft); color: #374151; text-align: center; line-height: 26px; font-size: 13px; font-weight: 600; }
.steps > li.done::before { content: "✓"; background: var(--ok-soft); color: var(--ok); }
.steps > li.todo::before { background: var(--warn-soft); color: var(--warn); }
.steps h3 { font-size: 15px; margin-bottom: 2px; }
.steps ol { margin: 6px 0; padding-left: 18px; }
.copy { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.copy code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font: 12px/1.5 Menlo, Consolas, monospace; }

.timeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.timeline div { border-left: 3px solid var(--line); padding: 2px 0 2px 12px; }
.timeline div.now { border-left-color: var(--primary); }
.timeline span { color: var(--muted); font-size: 12px; display: block; }

.logs { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.logs li { padding: 6px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 12px; }
.logs li time { color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
.logs li.error { color: var(--err); }
.logs li.warn { color: var(--warn); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty h2 { color: var(--ink); font-size: 18px; margin-bottom: 8px; }
.toast { position: fixed; left: 50%; top: 20px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 99; max-width: 90vw; }
.toast.err { background: var(--err); }
.landing { max-width: 640px; margin: 10vh auto; padding: 0 16px; }

/* 手机和窄屏：导航改成顶部横条，表格横向滑动 */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .side { width: auto; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .brand { padding: 12px 16px 0; }
  .side .shop { margin: 4px 16px 8px; padding-bottom: 8px; }
  .menu { flex-direction: row; overflow-x: auto; padding: 0 8px 8px; }
  .menu a { white-space: nowrap; }
  .side-foot { display: none; }
  .main { padding: 16px; }
  .card { padding: 16px; }
  .page-head h1 { font-size: 19px; }
  .table-wrap table.list { min-width: 760px; }
}
