:root{
  --accent:#4F6EF7;
  --accent-hover:#3a5be0;
  --accent-light:#eef1fe;
  --surface:#ffffff;
  --bg:#f5f7fb;
  --border:#e4e7ed;
  --text:#1f2430;
  --text-secondary:#6b7280;
  --text-tertiary:#9aa1ad;
  --danger:#e5484d;
  --warn:#f59e0b;
  --ok:#16a34a;
  --radius:14px;
  --shadow:0 6px 22px rgba(31,36,48,.08);
  --easing:cubic-bezier(.4,0,.2,1);
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  background:var(--bg);color:var(--text);font-size:14px;line-height:1.5;
}
button{font-family:inherit;cursor:pointer;border:none;background:none}
input,select,textarea{font-family:inherit;font-size:14px}

/* ===== Layout ===== */
.app{display:flex;flex-direction:column;height:100vh;overflow:hidden}
.header{
  display:flex;align-items:center;gap:14px;padding:12px 20px;
  background:var(--surface);border-bottom:1px solid var(--border);box-shadow:0 1px 0 rgba(0,0,0,.02);
}
.brand{display:flex;align-items:center;gap:10px}
.brand__mark{
  width:38px;height:38px;border-radius:11px;background:linear-gradient(135deg,var(--accent-hover),var(--accent));
  display:flex;align-items:center;justify-content:center;color:#fff;font-size:19px;box-shadow:0 4px 12px rgba(79,110,247,.35)
}
.brand__title{font-weight:800;font-size:16px;letter-spacing:.2px}
.brand__sub{font-size:11px;color:var(--text-tertiary)}
.head-divider{width:1px;height:30px;background:var(--border);margin:0 4px}

.month-nav{display:flex;align-items:center;gap:6px}
.month-nav__btn{
  width:32px;height:32px;border-radius:9px;background:var(--bg);color:var(--text-secondary);
  display:flex;align-items:center;justify-content:center;font-size:16px;transition:.15s var(--easing)
}
.month-nav__btn:hover{background:var(--accent-light);color:var(--accent)}
.month-nav__label{
  min-width:128px;height:32px;padding:0 12px;border-radius:9px;background:var(--bg);color:var(--text);
  font-weight:700;font-size:14px;display:flex;align-items:center;justify-content:center;gap:6px
}
.month-nav__label:hover{background:var(--accent-light);color:var(--accent)}

.segmented{display:flex;background:var(--bg);border-radius:10px;padding:3px}
.segmented button{padding:6px 14px;border-radius:8px;color:var(--text-secondary);font-weight:600;font-size:13px;transition:.15s}
.segmented button.active{background:var(--surface);color:var(--accent);box-shadow:0 1px 3px rgba(0,0,0,.08)}

.header__right{display:flex;align-items:center;gap:8px;margin-left:auto}
.scope-toggle{display:flex;background:var(--bg);border-radius:10px;padding:3px;margin-right:4px}
.scope-toggle button{padding:6px 12px;border-radius:8px;color:var(--text-secondary);font-weight:600;font-size:13px}
.scope-toggle button.active{background:var(--surface);color:var(--accent);box-shadow:0 1px 3px rgba(0,0,0,.08)}

.btn{border-radius:10px;padding:8px 14px;font-weight:600;font-size:13px;transition:.15s var(--easing);display:inline-flex;align-items:center;gap:6px}
.btn-ghost{background:var(--bg);color:var(--text-secondary)}
.btn-ghost:hover{background:var(--accent-light);color:var(--accent)}
.btn-primary{background:var(--accent);color:#fff;box-shadow:0 4px 12px rgba(79,110,247,.3)}
.btn-primary:hover{background:var(--accent-hover)}
.btn-sm{padding:7px 11px;font-size:12.5px}
.btn-danger{background:var(--danger);color:#fff}
.btn-danger:hover{filter:brightness(.95)}

/* ===== Body ===== */
.body{display:flex;flex:1;overflow:hidden}

/* Sidebar 品牌库 */
.sidebar{
  width:264px;flex-shrink:0;background:var(--surface);border-right:1px solid var(--border);
  display:flex;flex-direction:column;overflow:hidden
}
.sidebar__head{display:flex;align-items:center;justify-content:space-between;padding:14px 16px 8px}
.sidebar__title{font-weight:800;font-size:15px;display:flex;align-items:center;gap:8px}
.sidebar__head-actions{display:flex;gap:6px}
.sidebar__icon{width:30px;height:30px;border-radius:8px;background:var(--bg);color:var(--text-secondary);display:flex;align-items:center;justify-content:center}
.sidebar__icon:hover{background:var(--accent-light);color:var(--accent)}
.sidebar__toolbar{padding:6px 14px 10px;display:flex;flex-direction:column;gap:8px}
.sidebar__search{
  width:100%;padding:9px 12px;border:1px solid var(--border);border-radius:10px;background:var(--bg);
  color:var(--text);outline:none
}
.sidebar__search:focus{border-color:var(--accent);background:var(--surface)}
.sidebar__meta{display:flex;justify-content:space-between;align-items:center;font-size:12px;color:var(--text-tertiary)}
.sidebar__list{flex:1;overflow-y:auto;padding:4px 10px 14px}
.brand-item{
  display:flex;align-items:center;justify-content:space-between;gap:8px;padding:9px 11px;border-radius:10px;
  cursor:pointer;transition:.12s var(--easing);border:1px solid transparent
}
.brand-item:hover{background:var(--bg)}
.brand-item.active{background:var(--accent-light);border-color:rgba(79,110,247,.3)}
.brand-item__main{display:flex;flex-direction:column;min-width:0}
.brand-item__name{font-weight:600;font-size:13.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.brand-item__sub{font-size:11px;color:var(--text-tertiary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.brand-item__count{font-size:11px;font-weight:700;color:var(--text-tertiary);background:var(--bg);border-radius:20px;padding:2px 8px;flex-shrink:0}
.brand-item__count.has{color:var(--accent);background:var(--accent-light)}
.sidebar__foot{padding:12px 14px;border-top:1px solid var(--border);font-size:11px;color:var(--text-tertiary);line-height:1.5}

/* Main */
.main{flex:1;overflow:auto;padding:18px 20px}
.cal{display:flex;flex-direction:column;gap:8px}
.cal__head{display:grid;grid-template-columns:repeat(7,1fr);gap:8px}
.cal__head div{
  text-align:center;font-weight:700;font-size:13px;color:var(--text-secondary);padding:6px 0;
  background:var(--surface);border-radius:10px;border:1px solid var(--border)
}
.cal__grid{display:grid;grid-template-columns:repeat(7,1fr);grid-auto-rows:minmax(118px,auto);gap:8px}
.day{
  background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:8px;
  display:flex;flex-direction:column;gap:6px;min-height:118px;transition:.12s
}
.day.out{background:#fafbfc;opacity:.55}
.day.today{border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)}
.day__num{font-weight:700;font-size:13px;color:var(--text);display:flex;justify-content:space-between;align-items:center}
.day__num .wk{font-size:10px;font-weight:600;color:var(--text-tertiary)}
.day__num.is-today{color:var(--accent)}
.card{
  border-radius:9px;padding:6px 8px;background:var(--accent-light);border-left:3px solid var(--accent);
  font-size:12px;cursor:pointer;transition:.12s var(--easing)
}
.card:hover{transform:translateY(-1px);box-shadow:0 3px 8px rgba(31,36,48,.1)}
.card.mine{background:#fff7e6;border-left-color:var(--warn)}
.card.locked{cursor:not-allowed;opacity:.78;filter:grayscale(.25)}
.card.locked:hover{transform:none;box-shadow:none}
.card__brand{font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.card__meta{color:var(--text-secondary);font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.card__tag{display:inline-block;font-size:10px;font-weight:700;padding:1px 6px;border-radius:6px;margin-top:3px}
.tag-超品{background:#e9e3ff;color:#6d4bd1}
.tag-主推{background:var(--accent-light);color:var(--accent)}
.tag-爆款{background:#ffe9ec;color:#e5484d}
.tag-溯源{background:#e3f7ee;color:#16a34a}
.card__owner{font-size:10px;color:var(--text-tertiary);margin-top:2px}
.card__role{font-size:10px;font-weight:600;color:var(--accent);background:var(--accent-light);border-radius:6px;padding:1px 6px;align-self:flex-start}
.day__more{font-size:11px;color:var(--accent);font-weight:600;cursor:pointer;margin-top:auto}

/* ===== Drawer ===== */
.drawer-mask{position:fixed;inset:0;background:rgba(20,24,33,.45);display:none;z-index:50;align-items:flex-end;justify-content:flex-end}
.drawer-mask.open{display:flex}
.drawer{
  width:440px;max-width:92vw;height:100%;background:var(--surface);box-shadow:-8px 0 30px rgba(0,0,0,.18);
  display:flex;flex-direction:column;animation:slideIn .22s var(--easing)
}
@keyframes slideIn{from{transform:translateX(40px);opacity:.4}to{transform:none;opacity:1}}
.drawer__head{display:flex;align-items:center;justify-content:space-between;padding:16px 18px;border-bottom:1px solid var(--border);font-weight:800;font-size:16px}
.drawer__x{width:32px;height:32px;border-radius:8px;background:var(--bg);color:var(--text-secondary);font-size:18px;display:flex;align-items:center;justify-content:center}
.drawer__x:hover{background:var(--accent-light);color:var(--accent)}
.drawer__body{flex:1;overflow-y:auto;padding:18px}
.form-grid{display:flex;flex-direction:column;gap:14px}
.field{display:flex;flex-direction:column;gap:6px}
.field label{font-size:12.5px;font-weight:600;color:var(--text-secondary)}
.field label .req{color:var(--danger);margin-left:2px}
.field input,.field select,.field textarea{
  padding:10px 12px;border:1px solid var(--border);border-radius:10px;background:var(--bg);color:var(--text);outline:none;width:100%
}
.field input:focus,.field select:focus,.field textarea:focus{border-color:var(--accent);background:var(--surface)}
.field textarea{resize:vertical;min-height:64px}
.field__hint{font-size:11.5px;color:#8a8f98;margin-top:-2px}
.field__sub{font-size:11px;font-weight:600;color:var(--text-tertiary);background:var(--bg);border-radius:6px;padding:1px 7px;margin-left:4px}

/* 品牌角色多选 chip */
.role-chips{display:flex;flex-wrap:wrap;gap:8px}
.role-chips .chip{
  padding:8px 14px;border-radius:10px;border:1px solid var(--border);background:var(--bg);
  color:var(--text-secondary);font-weight:600;font-size:13px;transition:.14s var(--easing)
}
.role-chips .chip:hover{border-color:var(--accent);color:var(--accent)}
.role-chips .chip.active{background:var(--accent);border-color:var(--accent);color:#fff;box-shadow:0 3px 10px rgba(79,110,247,.32)}
.field-row{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.drawer__foot{display:flex;align-items:center;gap:10px;padding:14px 18px;border-top:1px solid var(--border)}
.drawer__foot .spacer{flex:1}

/* ===== Toast ===== */
.toast{position:fixed;left:50%;bottom:32px;transform:translateX(-50%) translateY(20px);background:#1f2430;color:#fff;
  padding:11px 18px;border-radius:12px;font-size:13.5px;opacity:0;pointer-events:none;transition:.2s var(--easing);z-index:99;box-shadow:0 8px 24px rgba(0,0,0,.25)}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
.toast.err{background:var(--danger)}
.toast.ok{background:var(--ok)}

/* ===== Login / No-permission ===== */
.center-screen{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:var(--bg);z-index:60}
.login-card{background:var(--surface);border-radius:18px;box-shadow:var(--shadow);padding:32px;width:360px;display:flex;flex-direction:column;gap:16px}
.login-card h2{font-size:19px;font-weight:800}
.login-card p{font-size:13px;color:var(--text-secondary)}
.login-card .field input{padding:12px 14px}
.lock-icon{width:52px;height:52px;border-radius:14px;background:var(--accent-light);color:var(--accent);display:flex;align-items:center;justify-content:center;font-size:24px;margin-bottom:4px}
.noperm{text-align:center;color:var(--text-secondary)}
.noperm .lock-icon{margin:0 auto 12px}

.user-chip{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--text-secondary)}
.user-chip .avatar{width:30px;height:30px;border-radius:50%;background:linear-gradient(135deg,var(--accent-hover),var(--accent));color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:13px}
.user-chip .link{color:var(--accent);cursor:pointer;font-weight:600}

.empty-state{text-align:center;color:var(--text-tertiary);padding:60px 0;font-size:14px}
