/* eyedrobe 管理后台 — 设计系统
   主张：任务流优先、中文优先、密度适中的运营工具审美 */

:root {
  --bg: #f7f4ee;
  --surface: #ffffff;
  --ink: #1b1510;
  --ink-2: #6b6154;
  --line: #e7e0d4;
  --accent: #4f46b8;
  --accent-soft: #eeecfa;
  --ok: #217a4b;  --ok-soft: #e3f2e9;
  --warn: #a06414; --warn-soft: #faf0dc;
  --bad: #b3403a;  --bad-soft: #fae5e3;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(27,21,16,.07);
  --font: "Inter", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 13.5px; line-height: 1.5; }
button { font: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------- 布局骨架 ---------- */
.shell { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
aside.nav {
  background: var(--ink); color: #cfc4b4; padding: 18px 12px;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
}
.nav .logo { font-size: 19px; font-weight: 700; color: #fff; padding: 4px 10px 18px; letter-spacing: -0.02em; }
.nav .logo .o { display:inline-block; width:13px; height:13px; border-radius:50%;
  background: radial-gradient(circle at 35% 32%, #fff 0 14%, transparent 15%), radial-gradient(circle, #1b1510 0 22%, #6b5ce0 34%, #4f46b8 58%, #16123a 90%); }
.nav button.item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 8px; color: #cfc4b4; font-size: 13.5px; text-align: left;
}
.nav button.item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav button.item.on { background: var(--accent); color: #fff; font-weight: 600; }
.nav .item .n { margin-left: auto; background: #ff5d47; color: #fff; font-size: 10.5px; font-weight: 700;
  border-radius: 99px; padding: 1px 7px; }
.nav .foot { margin-top: auto; font-size: 11px; opacity: .55; padding: 10px; line-height: 1.6; }

main.stage { padding: 0 26px 60px; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 0;
  position: sticky; top: 0; background: var(--bg); z-index: 20; border-bottom: 1px solid var(--line); margin-bottom: 20px;
}
.topbar h1 { font-size: 19px; font-weight: 700; }
.topbar .sp { flex: 1; }
.topbar input.search {
  width: 260px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
.userchip { display: flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: 99px; padding: 5px 12px 5px 5px; font-weight: 600; font-size: 12.5px; }
.userchip .av { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 12px; }

/* ---------- 通用组件 ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.pad { padding: 16px 18px; }
.grid { display: grid; gap: 14px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
h2.sec { font-size: 15px; font-weight: 700; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
h2.sec .muted { font-weight: 500; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
  font-weight: 600; font-size: 13px; border: 1px solid transparent; }
.btn-pri { background: var(--ink); color: #fff; }
.btn-pri:hover { background: #372c21; }
.btn-acc { background: var(--accent); color: #fff; }
.btn-line { border-color: var(--line); background: var(--surface); }
.btn-line:hover { border-color: var(--ink); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-danger { background: var(--bad-soft); color: var(--bad); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 650; }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-bad { background: var(--bad-soft); color: var(--bad); }
.tag-acc { background: var(--accent-soft); color: var(--accent); }
.tag-mut { background: #f0ece3; color: var(--ink-2); }

/* KPI */
.kpi { padding: 14px 16px; }
.kpi b { display: block; font-size: 24px; font-weight: 750; letter-spacing: -0.02em; }
.kpi span { font-size: 12px; color: var(--ink-2); }
.kpi .delta { font-size: 11.5px; font-weight: 650; }

/* 待办卡 */
.todo { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.todo:last-child { border-bottom: none; }
.todo:hover { background: #fbf9f4; }
.todo .ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 16px; flex: none; }
.todo b { font-size: 13.5px; }
.todo .go { margin-left: auto; color: var(--accent); font-weight: 700; white-space: nowrap; }

/* 表格 */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11.5px; color: var(--ink-2); font-weight: 650; letter-spacing: .04em;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid #f0ece3; vertical-align: middle; }
.tbl tr:hover td { background: #fbf9f4; }
.tbl tr.sel td { background: var(--accent-soft); }
.tbl .mono { font-variant-numeric: tabular-nums; }
.rowlink { color: var(--accent); font-weight: 650; cursor: pointer; }

/* 过滤 tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { padding: 7px 14px; border-radius: 99px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.tabs button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.tabs .cnt { opacity: .7; font-weight: 500; margin-left: 4px; }

/* 工具条 */
.toolrow { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolrow .sp { flex: 1; }

/* 抽屉 */
.drawer-mask { position: fixed; inset: 0; background: rgba(27,21,16,.35); z-index: 50; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 480px; max-width: 92vw; background: var(--surface);
  z-index: 51; box-shadow: -20px 0 60px rgba(0,0,0,.15); display: flex; flex-direction: column; }
.drawer .dh { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.drawer .dh b { font-size: 16px; }
.drawer .db { padding: 18px 20px; overflow-y: auto; flex: 1; }
.drawer .x { margin-left: auto; font-size: 20px; color: var(--ink-2); }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 6px 12px; font-size: 13px; margin-bottom: 14px; }
.kv dt { color: var(--ink-2); }
.timeline-mini { border-left: 2px solid var(--line); padding-left: 14px; display: grid; gap: 10px; margin-top: 6px; }
.timeline-mini div { position: relative; font-size: 12.5px; }
.timeline-mini div::before { content: ""; position: absolute; left: -19px; top: 5px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent); }

/* 看板 */
.kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; align-items: start; }
.kcol { background: #f1ede4; border-radius: var(--radius); padding: 10px; }
.kcol h4 { font-size: 12.5px; font-weight: 700; padding: 2px 6px 8px; color: var(--ink-2); display: flex; justify-content: space-between; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.kcard b { font-size: 13px; display: block; margin-bottom: 4px; }
.kcard .mv { display: flex; gap: 6px; margin-top: 10px; }

/* 色系卡 */
.fam-card { overflow: hidden; }
.fam-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.fam-head .dot { width: 34px; height: 34px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 3px rgba(0,0,0,.15); }
.fam-head b { font-size: 15px; }
.var-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid #f0ece3; font-size: 12.5px; }
.var-row:last-child { border-bottom: none; }
.var-row .stock { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 650; }
.var-row .low { color: var(--bad); }
.bar { height: 5px; border-radius: 99px; background: #eee7da; width: 90px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.bar i.low { background: var(--bad); }

/* 开关 */
.switch { position: relative; width: 36px; height: 20px; background: #d8d0c2; border-radius: 99px; transition: .15s; flex: none; }
.switch.on { background: var(--ok); }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: .15s; }
.switch.on::after { left: 18px; }

/* toast */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 99; display: grid; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 99px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow); animation: pop .18s ease; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* sparkline */
.spark { display: flex; align-items: flex-end; gap: 2px; height: 26px; }
.spark i { width: 6px; background: var(--accent-soft); border-radius: 2px 2px 0 0; }
.spark i.hi { background: var(--accent); }

.empty { padding: 40px; text-align: center; color: var(--ink-2); }

/* ---------- 移动端（CEO 手机办公优先） ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  aside.nav {
    position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; width: 100%;
    flex-direction: row; overflow-x: auto; gap: 6px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    z-index: 40; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  aside.nav::-webkit-scrollbar { display: none; }
  .nav .logo, .nav .foot { display: none; }
  .nav button.item {
    flex: 0 0 auto; width: auto; white-space: nowrap;
    padding: 9px 14px; border-radius: 99px; font-size: 13px;
    background: rgba(255,255,255,.08);
  }
  .nav .item .n { margin-left: 6px; }
  main.stage { padding: 0 14px calc(78px + env(safe-area-inset-bottom)); }
  .topbar { flex-wrap: wrap; gap: 8px; }
  .topbar h1 { font-size: 17px; }
  .topbar input.search { flex: 1; width: auto; min-width: 0; font-size: 16px; } /* 16px 防 iOS 聚焦自动放大 */
  .userchip span:last-child { display: none; }
  .cols-4, .cols-3 { grid-template-columns: repeat(2, 1fr); }
  .cols-2 { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .tbl th, .tbl td { padding: 9px 8px; font-size: 12.5px; }
  .drawer { width: 100vw; max-width: 100vw; }
  .kpi b { font-size: 21px; }
  input, select, textarea { font-size: 16px; }
  .btn { padding: 9px 14px; } /* 触控热区 */
  .todo { padding: 13px 12px; }
  .todo .go { font-size: 12px; }
}
@media (max-width: 400px) {
  .cols-4, .cols-3 { grid-template-columns: 1fr 1fr; }
  .kpi b { font-size: 18px; }
}
