/* ===== 川媒通 · 一期演示 视觉规范 ===== */
:root {
  --brand: #b8232f;          /* 川广红 */
  --brand-dark: #8d1a24;
  --brand-soft: #fdecec;
  --gold: #d6a74a;
  --ink: #1f2329;
  --ink-2: #4b5260;
  --ink-3: #8a90a0;
  --line: #e6e8ef;
  --bg: #f5f6fa;
  --card: #ffffff;
  --ok: #22a06b;
  --warn: #e5a30a;
  --err: #d64545;
  --info: #2b6cb0;
  --idle: #22a06b;   /* 空闲 */
  --lock: #e5a30a;   /* 已锁 */
  --sold: #8a90a0;   /* 已售 */
  --off:  #c7cbd4;   /* 下线 */
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.06);
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  background: linear-gradient(135deg, #f7f8fb 0%, #eef0f6 100%);
}
.login-hero {
  padding: 60px 68px;
  background:
    radial-gradient(1200px 500px at -10% -20%, rgba(184,35,47,.18), transparent 60%),
    radial-gradient(900px 400px at 120% 120%, rgba(214,167,74,.22), transparent 60%),
    linear-gradient(160deg, #ffffff 0%, #fbf6f3 100%);
  display: flex; flex-direction: column; justify-content: center;
}
.login-hero .badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 12px; font-weight: 600; letter-spacing: .5px;
  width: fit-content;
}
.login-hero h1 { font-size: 34px; margin: 18px 0 8px; letter-spacing: 1px; }
.login-hero h1 em { font-style: normal; color: var(--brand); }
.login-hero p.sub { color: var(--ink-2); max-width: 520px; }
.login-hero ul.pillars {
  list-style: none; padding: 0; margin: 28px 0 0; display: grid;
  grid-template-columns: 1fr 1fr; gap: 12px 20px; max-width: 620px;
}
.login-hero ul.pillars li {
  background: rgba(255,255,255,.7); border: 1px solid var(--line);
  padding: 12px 14px; border-radius: var(--radius); font-size: 13px;
}
.login-hero ul.pillars li b { color: var(--brand); font-weight: 600; }
.login-panel {
  display: flex; align-items: center; justify-content: center; padding: 40px;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--card);
  border-radius: 14px; box-shadow: var(--shadow); padding: 32px 30px;
  border: 1px solid var(--line);
}
.login-card h2 { margin: 0 0 4px; font-size: 20px; }
.login-card .hint { color: var(--ink-3); font-size: 12px; margin-bottom: 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; background: #fbfcfe; outline: none;
  transition: border-color .15s, background .15s;
  font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand); background: #fff;
}
.role-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 6px; }
.role-picker .role {
  padding: 10px 4px; border: 1px solid var(--line); border-radius: 8px;
  text-align: center; font-size: 12px; cursor: pointer; background: #fbfcfe;
  user-select: none; transition: .15s;
}
.role-picker .role:hover { border-color: var(--brand); color: var(--brand); }
.role-picker .role.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px; border: 1px solid transparent;
  background: var(--brand); color: #fff; cursor: pointer; font-size: 14px;
  font-weight: 500; transition: .15s;
}
.btn:hover { background: var(--brand-dark); }
.btn.block { width: 100%; padding: 11px; }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn.ghost:hover { background: #f5f6fa; color: var(--brand); border-color: var(--brand); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.line { background: #fff; color: var(--brand); border-color: var(--brand); }
.btn.line:hover { background: var(--brand-soft); }
.btn.ok { background: var(--ok); }
.btn.ok:hover { filter: brightness(.92); }
.btn.warn { background: var(--warn); }
.btn.danger { background: var(--err); }

/* ---------- 应用外壳 ---------- */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #1e2230 0%, #242838 100%);
  color: #dfe2ec; padding: 20px 0 0; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.sidebar .logo {
  padding: 0 22px 20px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar .logo .mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand) 0%, #e35d5d 100%);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px;
}
.sidebar .logo .name { font-size: 15px; font-weight: 600; letter-spacing: 1px; }
.sidebar .logo .sub { font-size: 10px; color: #8a92a8; }
.nav-group { padding: 16px 12px 4px; }
.nav-group .group-title {
  font-size: 11px; color: #7c849a; padding: 0 10px 8px;
  letter-spacing: 1px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 8px; font-size: 13px; color: #cfd3df; cursor: pointer;
  margin-bottom: 2px; transition: .12s;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(184,35,47,.35); }
.nav-item .ico { width: 16px; display: inline-block; text-align: center; }
.sidebar .foot {
  margin-top: auto; padding: 14px 22px; font-size: 11px; color: #6d7488;
  border-top: 1px solid rgba(255,255,255,.06);
}

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 22px; gap: 18px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .crumb { color: var(--ink-2); font-size: 13px; }
.topbar .crumb b { color: var(--ink); font-size: 15px; margin-right: 6px; }
.topbar .spacer { flex: 1; }
.topbar .search {
  width: 260px; padding: 7px 12px; border-radius: 8px;
  background: #f2f4f9; border: 1px solid transparent; font-size: 13px; outline: none;
}
.topbar .search:focus { background: #fff; border-color: var(--brand); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; background: #f2f4f9;
  font-size: 12px; color: var(--ink-2);
}
.chip.brand { background: var(--brand-soft); color: var(--brand); }
.chip.ok { background: #e5f6ee; color: var(--ok); }
.chip.warn { background: #fff5e0; color: var(--warn); }
.chip.err { background: #fcecec; color: var(--err); }
.chip.info { background: #e6efff; color: var(--info); }
.chip.gray { background: #eef0f5; color: var(--ink-3); }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot.idle { background: var(--idle); }
.dot.lock { background: var(--lock); }
.dot.sold { background: var(--sold); }
.dot.off { background: var(--off); }
.user-pill { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 10px 4px 4px; border-radius: 999px; }
.user-pill:hover { background: #f2f4f9; }
.user-pill .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand) 0%, #e35d5d 100%);
  color: #fff; font-size: 12px; font-weight: 600;
  display: grid; place-items: center;
}
.user-pill .meta { line-height: 1.15; font-size: 12px; }
.user-pill .meta .n { color: var(--ink); font-weight: 500; }
.user-pill .meta .r { color: var(--ink-3); font-size: 11px; }

.page { padding: 22px; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 20px; letter-spacing: .5px; }
.page-head .desc { color: var(--ink-3); font-size: 12px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------- 卡片 & KPI ---------- */
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c-2-1 { grid-template-columns: 2fr 1fr; }
.grid.c-1-2 { grid-template-columns: 1fr 2fr; }
.card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--line); padding: 18px 20px;
  box-shadow: var(--shadow);
}
.card h3 {
  margin: 0 0 12px; font-size: 14px; font-weight: 600;
  color: var(--ink); display: flex; align-items: center; gap: 8px;
}
.card h3 .tip { font-size: 11px; color: var(--ink-3); font-weight: 400; }
.card h3 .right { margin-left: auto; display: flex; gap: 6px; }
.kpi .lbl { font-size: 12px; color: var(--ink-3); }
.kpi .val { font-size: 26px; font-weight: 600; margin-top: 4px; letter-spacing: .5px; }
.kpi .val small { font-size: 12px; font-weight: 400; color: var(--ink-3); margin-left: 4px; }
.kpi .delta { font-size: 12px; margin-top: 4px; }
.kpi .delta.up { color: var(--ok); }
.kpi .delta.down { color: var(--err); }
.kpi.hero { background: linear-gradient(135deg, var(--brand) 0%, #d64141 100%); color: #fff; border: 0; }
.kpi.hero .lbl, .kpi.hero .delta { color: rgba(255,255,255,.85); }

/* ---------- 表格 ---------- */
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.tbl th {
  text-align: left; padding: 10px 12px; color: var(--ink-3);
  font-weight: 500; font-size: 12px; background: #f8f9fc;
  border-bottom: 1px solid var(--line); position: sticky; top: 0;
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid #f0f2f7; vertical-align: middle; }
table.tbl tr:hover td { background: #fafbfd; }
table.tbl .num { font-variant-numeric: tabular-nums; }
table.tbl .money { color: var(--brand); font-weight: 500; }
.table-scroll { max-height: 460px; overflow: auto; border-radius: 8px; border: 1px solid var(--line); }

/* ---------- 图表：纯 CSS/SVG ---------- */
.bar-row { display: grid; grid-template-columns: 90px 1fr 80px; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12px; }
.bar-row .name { color: var(--ink-2); }
.bar-row .track { height: 10px; background: #f2f4f9; border-radius: 999px; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand) 0%, #e56f6f 100%); }
.bar-row .fill.gold { background: linear-gradient(90deg, var(--gold) 0%, #eecf8b 100%); }
.bar-row .fill.info { background: linear-gradient(90deg, var(--info) 0%, #6e9edd 100%); }
.bar-row .fill.ok { background: linear-gradient(90deg, var(--ok) 0%, #61c48f 100%); }
.bar-row .val { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }

.donut { display: flex; align-items: center; gap: 20px; }
.donut .legend { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.donut .legend .row { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.donut .legend .row .sw { width: 10px; height: 10px; border-radius: 3px; }
.donut .legend .row b { color: var(--ink); margin-left: auto; padding-left: 14px; font-variant-numeric: tabular-nums; }

/* ---------- 库存时间轴 ---------- */
.timeline { overflow-x: auto; padding-bottom: 6px; }
.tl {
  display: grid; gap: 4px 2px; min-width: 900px;
  grid-template-columns: 200px repeat(14, minmax(0, 1fr));
}
.tl .hd {
  font-size: 11px; color: var(--ink-3); text-align: center; padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.tl .row-name {
  padding: 8px 10px; font-size: 12px; color: var(--ink);
  background: #fafbfd; border-radius: 6px 0 0 6px;
  display: flex; flex-direction: column; justify-content: center;
}
.tl .row-name small { color: var(--ink-3); font-size: 11px; }
.tl .cell {
  height: 26px; border-radius: 4px; margin: 3px 0;
  background: #f2f4f9; cursor: pointer; position: relative;
  transition: .12s;
}
.tl .cell:hover { outline: 2px solid var(--brand); outline-offset: -2px; }
.tl .cell.idle { background: #d5f0e2; }
.tl .cell.lock { background: #fdefcc; }
.tl .cell.sold { background: #dfe2ec; }
.tl .cell.off { background: #eef0f5;
  background-image: repeating-linear-gradient(45deg, transparent 0 4px, #d9dde5 4px 5px); }

.legend-inline { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); align-items: center; }
.legend-inline .lg { display: flex; align-items: center; gap: 6px; }
.legend-inline .sw { width: 12px; height: 12px; border-radius: 3px; }
.legend-inline .sw.idle { background: #d5f0e2; }
.legend-inline .sw.lock { background: #fdefcc; }
.legend-inline .sw.sold { background: #dfe2ec; }
.legend-inline .sw.off { background: #eef0f5; background-image: repeating-linear-gradient(45deg, transparent 0 4px, #d9dde5 4px 5px); }

/* ---------- 销售漏斗 ---------- */
.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel .step {
  padding: 14px 18px; color: #fff; border-radius: 8px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; box-shadow: var(--shadow);
}
.funnel .step .l { display: flex; flex-direction: column; gap: 2px; }
.funnel .step .l b { font-size: 18px; letter-spacing: .5px; }
.funnel .step .r { text-align: right; font-size: 12px; opacity: .9; }

/* ---------- 状态机 / 时间线 ---------- */
.statemachine { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.statemachine .node {
  padding: 6px 10px; border-radius: 999px; background: #f2f4f9; color: var(--ink-3);
}
.statemachine .node.done { background: #e5f6ee; color: var(--ok); }
.statemachine .node.cur { background: var(--brand); color: #fff; }
.statemachine .arrow { color: var(--ink-3); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs .tab {
  padding: 10px 16px; cursor: pointer; font-size: 13px; color: var(--ink-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs .tab:hover { color: var(--brand); }
.tabs .tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* ---------- 工具条 ---------- */
.toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 12px 14px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 14px;
}
.toolbar .fld { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.toolbar .fld > span { color: var(--ink-3); }
.toolbar select, .toolbar input {
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: #fbfcfe; font-size: 12px; outline: none; min-width: 120px;
}
.toolbar select:focus, .toolbar input:focus { border-color: var(--brand); }

/* ---------- 订单看板 列 ---------- */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(240px, 1fr)); gap: 14px; overflow-x: auto; }
.kb-col { background: #f5f6fa; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 380px; }
.kb-col .kb-hd { display: flex; align-items: center; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.kb-col .kb-hd .cnt { margin-left: auto; font-size: 11px; color: var(--ink-3); font-weight: 400; }
.kb-col .kb-bar { height: 3px; border-radius: 2px; margin-bottom: 10px; }
.kb-card {
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 8px; font-size: 12px; cursor: pointer;
  transition: .12s; box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.kb-card:hover { transform: translateY(-1px); border-color: var(--brand); box-shadow: var(--shadow); }
.kb-card .t { font-weight: 600; margin-bottom: 4px; font-size: 13px; }
.kb-card .m { color: var(--ink-3); display: flex; gap: 8px; flex-wrap: wrap; }
.kb-card .amt { color: var(--brand); font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; }

/* ---------- 抽屉/弹窗 ---------- */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.35);
  display: none; align-items: stretch; justify-content: flex-end; z-index: 60;
}
.drawer-mask.open { display: flex; }
.drawer {
  width: 520px; max-width: 100%; background: #fff; padding: 22px 24px;
  overflow-y: auto; animation: slide .18s ease-out;
}
@keyframes slide { from { transform: translateX(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer .close { float: right; cursor: pointer; color: var(--ink-3); font-size: 20px; line-height: 1; }
.drawer h3 { margin-top: 0; }
.drawer .kv { display: grid; grid-template-columns: 88px 1fr; gap: 8px 14px; font-size: 13px; margin: 12px 0; }
.drawer .kv .k { color: var(--ink-3); }

/* ---------- 下单清单 ---------- */
.cart .item {
  display: grid; grid-template-columns: 1fr auto auto auto 28px; gap: 10px; align-items: center;
  padding: 10px 12px; background: #fafbfd; border: 1px solid var(--line);
  border-radius: 8px; margin-bottom: 8px; font-size: 12px;
}
.cart .item .n { font-size: 13px; font-weight: 500; }
.cart .item .n small { display: block; color: var(--ink-3); font-weight: 400; font-size: 11px; }
.cart .item input.qty { width: 60px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; text-align: right; }
.cart .item .rm { cursor: pointer; color: var(--ink-3); text-align: center; }
.cart .item .rm:hover { color: var(--err); }
.total-box { background: linear-gradient(135deg, #fff8f0 0%, #fdecec 100%); border: 1px dashed var(--brand); padding: 14px 16px; border-radius: 8px; }
.total-box .row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.total-box .row.grand { font-size: 16px; font-weight: 600; color: var(--brand); border-top: 1px solid #f0c9c9; padding-top: 8px; margin-top: 4px; }

/* ---------- 角色可见性 ---------- */
[data-role-only] { display: none !important; }
[data-role-only].show { display: block !important; }
tr[data-role-only].show { display: table-row !important; }
.inline[data-role-only].show { display: inline-flex !important; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: rgba(31,35,41,.94); color: #fff; padding: 10px 18px;
  border-radius: 8px; font-size: 13px; z-index: 99; display: none;
}
.toast.show { display: block; animation: fadein .2s; }
@keyframes fadein { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- 步骤条 ---------- */
.steps { display: flex; gap: 8px; margin-bottom: 18px; font-size: 12px; }
.steps .step {
  padding: 8px 14px; background: #f2f4f9; color: var(--ink-3);
  border-radius: 999px;
}
.steps .step.active { background: var(--brand); color: #fff; }
.steps .step.done { background: #e5f6ee; color: var(--ok); }

/* ---------- 小工具 ---------- */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.hr { height: 1px; background: var(--line); margin: 14px 0; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; background: #f2f4f9; color: var(--ink-2); }
.tag.tv { background: #eef4ff; color: #2b6cb0; }
.tag.radio { background: #f3ecff; color: #6b3fbf; }
.tag.new-media { background: #e5f6ee; color: #22815a; }
.tag.event { background: #fff2e0; color: #b8651a; }
.tag.outdoor { background: #fcecec; color: #b8232f; }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); font-size: 13px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c-2-1, .grid.c-1-2 { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { padding: 40px 28px; }
}
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -220px; z-index: 40; transition: left .2s; }
  .sidebar.open { left: 0; }
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
}
